diff --git a/packages/@headlessui-react/CHANGELOG.md b/packages/@headlessui-react/CHANGELOG.md index f2ef532566..1be4751ba5 100644 --- a/packages/@headlessui-react/CHANGELOG.md +++ b/packages/@headlessui-react/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix SSR tab hydration when using Strict Mode in development ([#2231](https://github.com/tailwindlabs/headlessui/pull/2231)) - Don't break overflow when multiple dialogs are open at the same time ([#2215](https://github.com/tailwindlabs/headlessui/pull/2215)) - Fix "This `Suspense` boundary received an update before it finished hydrating" error in the `Disclosure` component ([#2238](https://github.com/tailwindlabs/headlessui/pull/2238)) +- Use the `import * as React from 'react'` pattern ([#2242](https://github.com/tailwindlabs/headlessui/pull/2242)) ## [1.7.8] - 2023-01-27 diff --git a/packages/@headlessui-react/src/components/combobox/combobox.tsx b/packages/@headlessui-react/src/components/combobox/combobox.tsx index 256b4087c4..765c822cdd 100644 --- a/packages/@headlessui-react/src/components/combobox/combobox.tsx +++ b/packages/@headlessui-react/src/components/combobox/combobox.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { Fragment, createContext, createRef, diff --git a/packages/@headlessui-react/src/components/description/description.tsx b/packages/@headlessui-react/src/components/description/description.tsx index 1924fbabc3..8500295350 100644 --- a/packages/@headlessui-react/src/components/description/description.tsx +++ b/packages/@headlessui-react/src/components/description/description.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { createContext, useContext, useMemo, diff --git a/packages/@headlessui-react/src/components/dialog/dialog.tsx b/packages/@headlessui-react/src/components/dialog/dialog.tsx index bb83b30ed9..84bb48e7e5 100644 --- a/packages/@headlessui-react/src/components/dialog/dialog.tsx +++ b/packages/@headlessui-react/src/components/dialog/dialog.tsx @@ -1,5 +1,6 @@ // WAI-ARIA: https://www.w3.org/WAI/ARIA/apg/patterns/dialogmodal/ -import React, { +import * as React from 'react' +import { createContext, createRef, useContext, diff --git a/packages/@headlessui-react/src/components/disclosure/disclosure.tsx b/packages/@headlessui-react/src/components/disclosure/disclosure.tsx index d62a91caef..911ee7373e 100644 --- a/packages/@headlessui-react/src/components/disclosure/disclosure.tsx +++ b/packages/@headlessui-react/src/components/disclosure/disclosure.tsx @@ -1,5 +1,6 @@ // WAI-ARIA: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/ -import React, { +import * as React from 'react' +import { Fragment, createContext, useContext, diff --git a/packages/@headlessui-react/src/components/focus-trap/focus-trap.tsx b/packages/@headlessui-react/src/components/focus-trap/focus-trap.tsx index df13b4312a..71777b60e1 100644 --- a/packages/@headlessui-react/src/components/focus-trap/focus-trap.tsx +++ b/packages/@headlessui-react/src/components/focus-trap/focus-trap.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { useEffect, useRef, diff --git a/packages/@headlessui-react/src/components/label/label.tsx b/packages/@headlessui-react/src/components/label/label.tsx index 2873449b90..ea10aceaf5 100644 --- a/packages/@headlessui-react/src/components/label/label.tsx +++ b/packages/@headlessui-react/src/components/label/label.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { createContext, useContext, useMemo, diff --git a/packages/@headlessui-react/src/components/listbox/listbox.tsx b/packages/@headlessui-react/src/components/listbox/listbox.tsx index bae2046c18..50ff041ff4 100644 --- a/packages/@headlessui-react/src/components/listbox/listbox.tsx +++ b/packages/@headlessui-react/src/components/listbox/listbox.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { Fragment, createContext, createRef, diff --git a/packages/@headlessui-react/src/components/menu/menu.tsx b/packages/@headlessui-react/src/components/menu/menu.tsx index 578f22cdfd..8eaa94fafc 100644 --- a/packages/@headlessui-react/src/components/menu/menu.tsx +++ b/packages/@headlessui-react/src/components/menu/menu.tsx @@ -1,5 +1,6 @@ // WAI-ARIA: https://www.w3.org/WAI/ARIA/apg/patterns/menubutton/ -import React, { +import * as React from 'react' +import { Fragment, createContext, createRef, diff --git a/packages/@headlessui-react/src/components/popover/popover.tsx b/packages/@headlessui-react/src/components/popover/popover.tsx index 3e21cbb796..419e0af3ce 100644 --- a/packages/@headlessui-react/src/components/popover/popover.tsx +++ b/packages/@headlessui-react/src/components/popover/popover.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { createContext, createRef, useContext, diff --git a/packages/@headlessui-react/src/components/portal/portal.tsx b/packages/@headlessui-react/src/components/portal/portal.tsx index 3a375615fd..b27f8ae189 100644 --- a/packages/@headlessui-react/src/components/portal/portal.tsx +++ b/packages/@headlessui-react/src/components/portal/portal.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { Fragment, createContext, useContext, diff --git a/packages/@headlessui-react/src/components/radio-group/radio-group.tsx b/packages/@headlessui-react/src/components/radio-group/radio-group.tsx index c1af35c08d..96048ebbdd 100644 --- a/packages/@headlessui-react/src/components/radio-group/radio-group.tsx +++ b/packages/@headlessui-react/src/components/radio-group/radio-group.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { createContext, useContext, useMemo, diff --git a/packages/@headlessui-react/src/components/switch/switch.tsx b/packages/@headlessui-react/src/components/switch/switch.tsx index 9e0728583d..a807138d10 100644 --- a/packages/@headlessui-react/src/components/switch/switch.tsx +++ b/packages/@headlessui-react/src/components/switch/switch.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { Fragment, createContext, useContext, diff --git a/packages/@headlessui-react/src/components/tabs/tabs.tsx b/packages/@headlessui-react/src/components/tabs/tabs.tsx index 07cece5f15..4a633b57a6 100644 --- a/packages/@headlessui-react/src/components/tabs/tabs.tsx +++ b/packages/@headlessui-react/src/components/tabs/tabs.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { Fragment, createContext, useContext, diff --git a/packages/@headlessui-react/src/components/transitions/transition.tsx b/packages/@headlessui-react/src/components/transitions/transition.tsx index 59c4f6349e..76f5d62d88 100644 --- a/packages/@headlessui-react/src/components/transitions/transition.tsx +++ b/packages/@headlessui-react/src/components/transitions/transition.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { Fragment, createContext, useContext, diff --git a/packages/@headlessui-react/src/hooks/use-event.ts b/packages/@headlessui-react/src/hooks/use-event.ts index 47115aa35a..300062ad09 100644 --- a/packages/@headlessui-react/src/hooks/use-event.ts +++ b/packages/@headlessui-react/src/hooks/use-event.ts @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import { useLatestValue } from './use-latest-value' export let useEvent = diff --git a/packages/@headlessui-react/src/hooks/use-id.ts b/packages/@headlessui-react/src/hooks/use-id.ts index 761d6c1c34..897bcad2fb 100644 --- a/packages/@headlessui-react/src/hooks/use-id.ts +++ b/packages/@headlessui-react/src/hooks/use-id.ts @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import { useIsoMorphicEffect } from './use-iso-morphic-effect' import { useServerHandoffComplete } from './use-server-handoff-complete' import { env } from '../utils/env' diff --git a/packages/@headlessui-react/src/internal/focus-sentinel.tsx b/packages/@headlessui-react/src/internal/focus-sentinel.tsx index de3268210d..7e6b8ff8d7 100644 --- a/packages/@headlessui-react/src/internal/focus-sentinel.tsx +++ b/packages/@headlessui-react/src/internal/focus-sentinel.tsx @@ -1,4 +1,5 @@ -import React, { useState, FocusEvent as ReactFocusEvent } from 'react' +import * as React from 'react' +import { useState, FocusEvent as ReactFocusEvent } from 'react' import { Hidden, Features } from './hidden' diff --git a/packages/@headlessui-react/src/internal/open-closed.tsx b/packages/@headlessui-react/src/internal/open-closed.tsx index 143dc26d90..f596ddb206 100644 --- a/packages/@headlessui-react/src/internal/open-closed.tsx +++ b/packages/@headlessui-react/src/internal/open-closed.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { createContext, useContext, diff --git a/packages/@headlessui-react/src/internal/portal-force-root.tsx b/packages/@headlessui-react/src/internal/portal-force-root.tsx index d688f28459..56ea2271b5 100644 --- a/packages/@headlessui-react/src/internal/portal-force-root.tsx +++ b/packages/@headlessui-react/src/internal/portal-force-root.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { createContext, useContext, diff --git a/packages/@headlessui-react/src/internal/stack-context.tsx b/packages/@headlessui-react/src/internal/stack-context.tsx index e8ff63d5bb..df7b5b7be1 100644 --- a/packages/@headlessui-react/src/internal/stack-context.tsx +++ b/packages/@headlessui-react/src/internal/stack-context.tsx @@ -1,4 +1,5 @@ -import React, { +import * as React from 'react' +import { createContext, useContext, diff --git a/packages/@headlessui-react/src/utils/start-transition.ts b/packages/@headlessui-react/src/utils/start-transition.ts index 9fe7864327..e9b389b4ae 100644 --- a/packages/@headlessui-react/src/utils/start-transition.ts +++ b/packages/@headlessui-react/src/utils/start-transition.ts @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' export let startTransition = // Prefer React's `startTransition` if it's available.