From 54783acaa802754b3d4e10a50b3300cbf869000a Mon Sep 17 00:00:00 2001 From: ht-lovrozagar <157136236+ht-lovrozagar@users.noreply.github.com> Date: Wed, 28 Aug 2024 21:41:20 +0200 Subject: [PATCH] chore: fix imports --- .todo | 5 +++ .../field/field-context/field-context.ts | 16 ---------- .../field/field-label/field-label.tsx | 26 --------------- .../field/field-message/field-message.tsx | 32 ------------------- .../_shared/components/field/field/field.tsx | 19 ----------- .../components/icons/chevron-down-icon.tsx | 3 +- .../components/icons/cross-small-icon.tsx | 3 +- .../components/icons/eye-open-icon.tsx | 3 +- .../modal-description/modal-description.tsx | 1 - .../components/modal-footer/modal-footer.tsx | 1 - .../components/modal-header/modal-header.tsx | 1 - .../_shared/hooks/use-aria-handlers.ts | 10 +++--- .../_shared/hooks/use-controllable-state.ts | 5 ++- src/components/_shared/hooks/use-is-online.ts | 28 ++++++++++++++++ .../components/accordion-content.tsx | 1 - .../accordion/components/accordion-item.tsx | 1 - .../components/accordion-trigger.tsx | 1 - .../accordion/components/accordion.tsx | 1 - .../aspect-ratio/components/aspect-ratio.tsx | 1 - src/components/box/components/box.tsx | 1 - src/components/card/components/card-body.tsx | 1 - .../card/components/card-header.tsx | 1 - src/components/card/components/card.tsx | 1 - .../collapsible/components/collapsible.tsx | 1 - .../combobox/components/combobox-input.tsx | 1 - .../command/components/command-dialog.tsx | 1 - .../command/components/command-empty.tsx | 1 - .../command/components/command-group.tsx | 1 - .../command/components/command-input.tsx | 1 - .../command/components/command-item.tsx | 1 - .../command/components/command-list.tsx | 1 - .../container/components/container.tsx | 1 - .../dialog/components/dialog-content.tsx | 1 - .../dialog/components/dialog-trigger.tsx | 1 - src/components/dialog/components/dialog.tsx | 7 +--- src/components/dialog/types/dialog.ts | 9 +----- src/components/flex/components/flex.tsx | 1 - src/components/form/components/form.tsx | 1 - src/components/grid/components/grid.tsx | 1 - src/components/heading/components/heading.tsx | 1 - .../components/hover-card-trigger.tsx | 1 - .../hover-card/components/hover-card.tsx | 1 - src/components/kbd/components/kbd.tsx | 1 - src/components/label/components/label.tsx | 1 - .../loader/components/loader-dot.tsx | 1 - src/components/loader/components/loader.tsx | 1 - .../components/navigation-menu-content.tsx | 1 - .../components/navigation-menu-item.tsx | 1 - .../components/navigation-menu-link.tsx | 1 - .../components/navigation-menu.tsx | 1 - .../number-input/components/number-input.tsx | 1 - .../number-input/hooks/use-number-spin.ts | 5 ++- src/components/overlay/components/overlay.tsx | 1 - .../popover/components/popover-trigger.tsx | 1 - .../progress/components/progress.tsx | 1 - .../components/radio-group-item.tsx | 1 - .../radio-group/components/radio-group.tsx | 1 - src/components/ripple/components/ripple.tsx | 1 - src/components/select/components/select.tsx | 2 -- .../separator/components/separator.tsx | 1 - .../sheet/components/sheet-content.tsx | 1 - .../sheet/components/sheet-trigger.tsx | 1 - src/components/sheet/components/sheet.tsx | 5 +-- src/components/sheet/types/sheet.ts | 9 +----- .../skeleton/components/skeleton.tsx | 1 - .../slider/components/slider-thumb.tsx | 1 - src/components/slider/components/slider.tsx | 1 - .../sub-layer/components/sub-layer.tsx | 1 - .../switch/components/switch-thumb.tsx | 1 - .../tabs/components/tabs-content.tsx | 1 - .../tabs-trigger-children-container.tsx | 1 - .../tabs/components/tabs-trigger-list.tsx | 1 - .../tabs/components/tabs-trigger.tsx | 1 - .../text-input/components/password-toggle.tsx | 1 - .../text-input/components/text-input.tsx | 3 +- src/components/text/components/text.tsx | 1 - src/components/toast/components/toast.tsx | 1 - .../components/toggle-group-item.tsx | 1 - .../toggle-group/components/toggle-group.tsx | 1 - src/components/toggle/components/toggle.tsx | 1 - .../tooltip/components/tooltip-content.tsx | 1 - src/components/tooltip/components/tooltip.tsx | 1 - .../components/visually-hidden.tsx | 1 - src/index.ts | 1 + .../components/mode-provider.tsx | 1 - src/providers/mode-provider/hooks/use-mode.ts | 17 +++++++++- 86 files changed, 69 insertions(+), 205 deletions(-) delete mode 100644 src/components/_shared/components/field/field-context/field-context.ts delete mode 100644 src/components/_shared/components/field/field-label/field-label.tsx delete mode 100644 src/components/_shared/components/field/field-message/field-message.tsx delete mode 100644 src/components/_shared/components/field/field/field.tsx create mode 100644 src/components/_shared/hooks/use-is-online.ts diff --git a/.todo b/.todo index 801f116..c310b9b 100644 --- a/.todo +++ b/.todo @@ -36,3 +36,8 @@ -refactor: collapsible to use css height: calc-size(auto) when better browser support -also see what can be done with starting style and and transition behaviour when better browser support + +- fix: react ref types in hooks +- refactor: make prop naming more consistend, modal/isModal, open/isOpen... + +- refactor: remove barrell imports to better support treeshaking with different bundlers/frameworks diff --git a/src/components/_shared/components/field/field-context/field-context.ts b/src/components/_shared/components/field/field-context/field-context.ts deleted file mode 100644 index a3eb90a..0000000 --- a/src/components/_shared/components/field/field-context/field-context.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { initializeContext } from '@renderui/utils' -import type React from 'react' - -const [FieldProvider, useFieldContext] = initializeContext<{ - id: string - error: React.ReactNode -}>({ - errorMessage: - 'Components using useField must be wrapped in their a <{InputName}Field /> component.', - providerName: 'ToggleGroupProvider', - hookName: 'useField', - name: 'fieldContext', - strict: false, -}) - -export { FieldProvider, useFieldContext } diff --git a/src/components/_shared/components/field/field-label/field-label.tsx b/src/components/_shared/components/field/field-label/field-label.tsx deleted file mode 100644 index 05912d8..0000000 --- a/src/components/_shared/components/field/field-label/field-label.tsx +++ /dev/null @@ -1,26 +0,0 @@ -'use client' - -import { cx } from 'class-variance-authority' -import React from 'react' - -import { useFieldContext } from '@/components/_shared/components/field/field-context/field-context' -import { Label } from '@/components/label' - -const FieldLabel = (props) => { - const { children, info, className, ...restProps } = props - - const { id } = useFieldContext() - - return ( - - ) -} - -export { FieldLabel } diff --git a/src/components/_shared/components/field/field-message/field-message.tsx b/src/components/_shared/components/field/field-message/field-message.tsx deleted file mode 100644 index 7169a71..0000000 --- a/src/components/_shared/components/field/field-message/field-message.tsx +++ /dev/null @@ -1,32 +0,0 @@ -'use client' - -import { cn } from '@renderui/utils' -import React from 'react' - -import { useFieldContext } from '@/components/_shared/components/field/field-context/field-context' - -const FieldMessage = (props) => { - const { children } = props - - const { error } = useFieldContext() - - const hasDescription = children !== undefined - const hasError = error !== undefined - - return ( -
- {error ?? children} -
- ) -} - -export { FieldMessage } diff --git a/src/components/_shared/components/field/field/field.tsx b/src/components/_shared/components/field/field/field.tsx deleted file mode 100644 index 276661f..0000000 --- a/src/components/_shared/components/field/field/field.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react' - -import { FieldProvider } from '@/components/_shared/components/field/field-context/field-context' - -const Field = React.forwardRef((props, ref) => { - const { children, error } = props - - const id = React.useId() - - return ( -
- {children} -
- ) -}) - -Field.displayName = 'Field' - -export { Field } diff --git a/src/components/_shared/components/icons/chevron-down-icon.tsx b/src/components/_shared/components/icons/chevron-down-icon.tsx index 6c42648..37dce55 100644 --- a/src/components/_shared/components/icons/chevron-down-icon.tsx +++ b/src/components/_shared/components/icons/chevron-down-icon.tsx @@ -1,5 +1,4 @@ -// biome-ignore lint/style/useImportType: react import needed here -import React from 'react' +import type React from 'react' const ChevronDownIcon = (props: React.ComponentPropsWithRef<'svg'>) => { return ( diff --git a/src/components/_shared/components/icons/cross-small-icon.tsx b/src/components/_shared/components/icons/cross-small-icon.tsx index 7f21dd9..31eb3e1 100644 --- a/src/components/_shared/components/icons/cross-small-icon.tsx +++ b/src/components/_shared/components/icons/cross-small-icon.tsx @@ -1,5 +1,4 @@ -// biome-ignore lint/style/useImportType: react import needed here -import React from 'react' +import type React from 'react' const CrossSmallIcon = (props: React.ComponentPropsWithRef<'svg'>) => { return ( diff --git a/src/components/_shared/components/icons/eye-open-icon.tsx b/src/components/_shared/components/icons/eye-open-icon.tsx index 1ac0c86..066f102 100644 --- a/src/components/_shared/components/icons/eye-open-icon.tsx +++ b/src/components/_shared/components/icons/eye-open-icon.tsx @@ -1,5 +1,4 @@ -// biome-ignore lint/style/useImportType: react import needed here -import React from 'react' +import type React from 'react' const EyeOpenIcon = (props: React.ComponentPropsWithRef<'svg'>) => { return ( diff --git a/src/components/_shared/components/modal-description/modal-description.tsx b/src/components/_shared/components/modal-description/modal-description.tsx index 1e28516..902c321 100644 --- a/src/components/_shared/components/modal-description/modal-description.tsx +++ b/src/components/_shared/components/modal-description/modal-description.tsx @@ -1,5 +1,4 @@ import { cx } from '@renderui/utils' -import React from 'react' import { Text, type TextProps } from '@/components/text' diff --git a/src/components/_shared/components/modal-footer/modal-footer.tsx b/src/components/_shared/components/modal-footer/modal-footer.tsx index ebea1f5..654ba1d 100644 --- a/src/components/_shared/components/modal-footer/modal-footer.tsx +++ b/src/components/_shared/components/modal-footer/modal-footer.tsx @@ -1,5 +1,4 @@ import { cx } from '@renderui/utils' -import React from 'react' import { Flex, type FlexProps } from '@/components/flex' diff --git a/src/components/_shared/components/modal-header/modal-header.tsx b/src/components/_shared/components/modal-header/modal-header.tsx index 8032fc6..becd663 100644 --- a/src/components/_shared/components/modal-header/modal-header.tsx +++ b/src/components/_shared/components/modal-header/modal-header.tsx @@ -1,5 +1,4 @@ import { cx } from '@renderui/utils' -import React from 'react' import { Grid, type GridProps } from '@/components/grid' diff --git a/src/components/_shared/hooks/use-aria-handlers.ts b/src/components/_shared/hooks/use-aria-handlers.ts index 29d1ab1..70df0fb 100644 --- a/src/components/_shared/hooks/use-aria-handlers.ts +++ b/src/components/_shared/hooks/use-aria-handlers.ts @@ -1,17 +1,17 @@ import { mergeProps } from '@renderui/utils' import React from 'react' import { + useFocus, + useFocusRing, + useHover, + useLongPress, + usePress, type FocusProps, type FocusRingProps, type HoverProps, type LongPressProps, type PressEvent, type PressHookProps, - useFocus, - useFocusRing, - useHover, - useLongPress, - usePress, } from 'react-aria' import type { UseAriaHandlersProps } from '@/components/_shared/types/aria' diff --git a/src/components/_shared/hooks/use-controllable-state.ts b/src/components/_shared/hooks/use-controllable-state.ts index 84b9110..bc7330e 100644 --- a/src/components/_shared/hooks/use-controllable-state.ts +++ b/src/components/_shared/hooks/use-controllable-state.ts @@ -2,11 +2,10 @@ import { useFreshRef } from '@/components/_shared/hooks/use-fresh-ref' import { - type UseControllableStateProps, useUncontrolledState, + type UseControllableStateProps, } from '@/components/_shared/hooks/use-uncontrolled-state' -import { isFunction } from '@renderui/utils' -import { noop } from '@renderui/utils' +import { isFunction, noop } from '@renderui/utils' import React from 'react' type SetStateFunction = (previousState?: T) => T diff --git a/src/components/_shared/hooks/use-is-online.ts b/src/components/_shared/hooks/use-is-online.ts new file mode 100644 index 0000000..95ff0d9 --- /dev/null +++ b/src/components/_shared/hooks/use-is-online.ts @@ -0,0 +1,28 @@ +'use client' + +import { useSyncExternalStore } from 'react' + +function getClientSnapshot() { + return navigator.onLine +} + +function getServerSnapshot() { + return true +} + +function subscribe(callback: () => void) { + window.addEventListener('online', callback) + window.addEventListener('offline', callback) + return () => { + window.removeEventListener('online', callback) + window.removeEventListener('offline', callback) + } +} + +function useIsOnline() { + const isOnline = useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot) + + return isOnline +} + +export { useIsOnline } diff --git a/src/components/accordion/components/accordion-content.tsx b/src/components/accordion/components/accordion-content.tsx index 2f2f9a3..0d4a504 100644 --- a/src/components/accordion/components/accordion-content.tsx +++ b/src/components/accordion/components/accordion-content.tsx @@ -2,7 +2,6 @@ import { AccordionContent as AccordionContentPrimitive } from '@radix-ui/react-accordion' import { cn, getAnimationStyleVariables, getOptionalObject, polymorphic } from '@renderui/utils' -import React from 'react' import { DEFAULT_ACCORDION_CONTENT_CHILDREN_CONTAINER_CLASSNAME, diff --git a/src/components/accordion/components/accordion-item.tsx b/src/components/accordion/components/accordion-item.tsx index 489ba60..71e3638 100644 --- a/src/components/accordion/components/accordion-item.tsx +++ b/src/components/accordion/components/accordion-item.tsx @@ -2,7 +2,6 @@ import { AccordionItem as AccordionItemPrimitive } from '@radix-ui/react-accordion' import { cn } from '@renderui/utils' -import React from 'react' import { DEFAULT_ACCORDION_ITEM_CLASSNAME } from '@/components/accordion/constants/constants' import type { AccordionItemProps } from '@/components/accordion/types/accordion-item' diff --git a/src/components/accordion/components/accordion-trigger.tsx b/src/components/accordion/components/accordion-trigger.tsx index 266e1dd..39729d1 100644 --- a/src/components/accordion/components/accordion-trigger.tsx +++ b/src/components/accordion/components/accordion-trigger.tsx @@ -5,7 +5,6 @@ import { AccordionTrigger as AccordionTriggerPrimitive, } from '@radix-ui/react-accordion' import { cn, getOptionalObject } from '@renderui/utils' -import React from 'react' import { ChevronDownIcon } from '@/components/_shared/components/icons/chevron-down-icon' import { diff --git a/src/components/accordion/components/accordion.tsx b/src/components/accordion/components/accordion.tsx index 848188a..8808633 100644 --- a/src/components/accordion/components/accordion.tsx +++ b/src/components/accordion/components/accordion.tsx @@ -2,7 +2,6 @@ import { Accordion as AccordionPrimitive } from '@radix-ui/react-accordion' import { cn } from '@renderui/utils' -import React from 'react' import type { AccordionProps } from '@/components/accordion/types/accordion' diff --git a/src/components/aspect-ratio/components/aspect-ratio.tsx b/src/components/aspect-ratio/components/aspect-ratio.tsx index a51d96a..9e5e2c3 100644 --- a/src/components/aspect-ratio/components/aspect-ratio.tsx +++ b/src/components/aspect-ratio/components/aspect-ratio.tsx @@ -1,5 +1,4 @@ import { polymorphic } from '@renderui/utils' -import React from 'react' import type { AspectRatioProps } from '@/components/aspect-ratio/types/aspect-ratio' import { getMergedStyles } from '@/components/aspect-ratio/utils/get-merged-styles' diff --git a/src/components/box/components/box.tsx b/src/components/box/components/box.tsx index 090d843..5553b33 100644 --- a/src/components/box/components/box.tsx +++ b/src/components/box/components/box.tsx @@ -1,5 +1,4 @@ import { polymorphic } from '@renderui/utils' -import React from 'react' import type { BoxProps } from '@/components/box/types/box' import { getMergedClassName } from '@/components/box/utils/get-merged-class-name' diff --git a/src/components/card/components/card-body.tsx b/src/components/card/components/card-body.tsx index 5c38e62..999b418 100644 --- a/src/components/card/components/card-body.tsx +++ b/src/components/card/components/card-body.tsx @@ -1,5 +1,4 @@ import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import { DEFAULT_CARD_BODY_CLASSNAME } from '@/components/card/constants/constants' import type { CardBodyProps } from '@/components/card/types/card-body' diff --git a/src/components/card/components/card-header.tsx b/src/components/card/components/card-header.tsx index 1297ae3..b91fe43 100644 --- a/src/components/card/components/card-header.tsx +++ b/src/components/card/components/card-header.tsx @@ -1,5 +1,4 @@ import { cn, getOptionalObject, polymorphic } from '@renderui/utils' -import React from 'react' import { DEFAULT_CARD_HEADER_CHILDREN_CLASSNAME, diff --git a/src/components/card/components/card.tsx b/src/components/card/components/card.tsx index adc4bf5..e706a15 100644 --- a/src/components/card/components/card.tsx +++ b/src/components/card/components/card.tsx @@ -1,5 +1,4 @@ import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import { cardClasses } from '@/components/card/classes/card-classes' import type { CardProps } from '@/components/card/types/card' diff --git a/src/components/collapsible/components/collapsible.tsx b/src/components/collapsible/components/collapsible.tsx index 5d24473..08ac30a 100644 --- a/src/components/collapsible/components/collapsible.tsx +++ b/src/components/collapsible/components/collapsible.tsx @@ -3,7 +3,6 @@ import type { CollapsibleProps } from '@/components/collapsible/types/collapsible' import { Collapsible as CollapsiblePrimitive } from '@radix-ui/react-collapsible' import { cn } from '@renderui/utils' -import React from 'react' const Collapsible = (props: CollapsibleProps) => { const { className, ...restProps } = props diff --git a/src/components/combobox/components/combobox-input.tsx b/src/components/combobox/components/combobox-input.tsx index ceec1ac..b91cd3d 100644 --- a/src/components/combobox/components/combobox-input.tsx +++ b/src/components/combobox/components/combobox-input.tsx @@ -1,7 +1,6 @@ 'use client' import { cn } from '@renderui/utils' -import React from 'react' import type { ComboboxInputProps } from '@/components/combobox/types/combobox-input' import { CommandInput } from '@/components/command/components/command-input' diff --git a/src/components/command/components/command-dialog.tsx b/src/components/command/components/command-dialog.tsx index 44e8db4..043c7e2 100644 --- a/src/components/command/components/command-dialog.tsx +++ b/src/components/command/components/command-dialog.tsx @@ -1,5 +1,4 @@ import { cx } from '@renderui/utils' -import React from 'react' import { Command } from '@/components/command/components/command' import { diff --git a/src/components/command/components/command-empty.tsx b/src/components/command/components/command-empty.tsx index c6acf0f..5023934 100644 --- a/src/components/command/components/command-empty.tsx +++ b/src/components/command/components/command-empty.tsx @@ -2,7 +2,6 @@ import { cn } from '@renderui/utils' import { CommandEmpty as CommandEmptyPrimitive } from 'cmdk' -import React from 'react' import { DEFAULT_COMMAND_EMPTY_CLASSNAME } from '@/components/command/constants/constants' import type { CommandEmptyProps } from '@/components/command/types/command-empty' diff --git a/src/components/command/components/command-group.tsx b/src/components/command/components/command-group.tsx index 03e173d..d51c3f9 100644 --- a/src/components/command/components/command-group.tsx +++ b/src/components/command/components/command-group.tsx @@ -2,7 +2,6 @@ import { cn } from '@renderui/utils' import { CommandGroup as CommandGroupPrimitive } from 'cmdk' -import React from 'react' import { DEFAULT_COMMAND_GROUP_CLASSNAME } from '@/components/command/constants/constants' import type { CommandGroupProps } from '@/components/command/types/command-group' diff --git a/src/components/command/components/command-input.tsx b/src/components/command/components/command-input.tsx index b2d1eda..f711a0a 100644 --- a/src/components/command/components/command-input.tsx +++ b/src/components/command/components/command-input.tsx @@ -2,7 +2,6 @@ import { cn, getOptionalObject, polymorphic } from '@renderui/utils' import { CommandInput as CommandInputPrimitive } from 'cmdk' -import React from 'react' import { MagnifyingGlassIcon } from '@/components/_shared/components/icons/magnifying-glass-icon' import { useControllableState } from '@/components/_shared/hooks/use-controllable-state' diff --git a/src/components/command/components/command-item.tsx b/src/components/command/components/command-item.tsx index 0b64ed5..767d009 100644 --- a/src/components/command/components/command-item.tsx +++ b/src/components/command/components/command-item.tsx @@ -2,7 +2,6 @@ import { cn } from '@renderui/utils' import { CommandItem as CommandItemPrimitive } from 'cmdk' -import React from 'react' import { DEFAULT_COMMAND_ITEM_CLASSNAME } from '@/components/command/constants/constants' import type { CommandItemProps } from '@/components/command/types/command-item' diff --git a/src/components/command/components/command-list.tsx b/src/components/command/components/command-list.tsx index 4dd06a4..a5e2038 100644 --- a/src/components/command/components/command-list.tsx +++ b/src/components/command/components/command-list.tsx @@ -2,7 +2,6 @@ import { cn } from '@renderui/utils' import { CommandList as CommandListPrimitive } from 'cmdk' -import React from 'react' import { DEFAULT_COMMAND_LIST_CLASSNAME } from '@/components/command/constants/constants' import type { CommandListProps } from '@/components/command/types/command-list' diff --git a/src/components/container/components/container.tsx b/src/components/container/components/container.tsx index ab94181..529d28b 100644 --- a/src/components/container/components/container.tsx +++ b/src/components/container/components/container.tsx @@ -1,5 +1,4 @@ import { polymorphic } from '@renderui/utils' -import React from 'react' import type { ContainerProps } from '@/components/container/types/container' import { getMergedClassName } from '@/components/container/utils/get-merged-class-name' diff --git a/src/components/dialog/components/dialog-content.tsx b/src/components/dialog/components/dialog-content.tsx index ab239a8..b2d18e1 100644 --- a/src/components/dialog/components/dialog-content.tsx +++ b/src/components/dialog/components/dialog-content.tsx @@ -5,7 +5,6 @@ import { DialogPortal as DialogPortalPrimitive, } from '@radix-ui/react-dialog' import { cn, cx, getOptionalObject } from '@renderui/utils' -import React from 'react' import { CrossSmallIcon } from '@/components/_shared/components/icons/cross-small-icon' import { Button } from '@/components/button/components/button' diff --git a/src/components/dialog/components/dialog-trigger.tsx b/src/components/dialog/components/dialog-trigger.tsx index 93b4fd6..f2c844a 100644 --- a/src/components/dialog/components/dialog-trigger.tsx +++ b/src/components/dialog/components/dialog-trigger.tsx @@ -2,7 +2,6 @@ import { DialogTrigger as DialogTriggerPrimitive } from '@radix-ui/react-dialog' import { cn } from '@renderui/utils' -import React from 'react' import { Button } from '@/components/button/components/button' import { DEFAULT_DIALOG_TRIGGER_CLASSNAME } from '@/components/dialog/constants/constants' diff --git a/src/components/dialog/components/dialog.tsx b/src/components/dialog/components/dialog.tsx index a44b4e7..b396e26 100644 --- a/src/components/dialog/components/dialog.tsx +++ b/src/components/dialog/components/dialog.tsx @@ -1,16 +1,11 @@ 'use client' import { Dialog as DialogPrimitive } from '@radix-ui/react-dialog' -import React from 'react' import type { DialogProps } from '@/components/dialog/types/dialog' const Dialog = (props: DialogProps) => { - const { isModal, ...restProps } = props - - return + return } -Dialog.displayName = 'Dialog' - export { Dialog } diff --git a/src/components/dialog/types/dialog.ts b/src/components/dialog/types/dialog.ts index 7da6a51..d382895 100644 --- a/src/components/dialog/types/dialog.ts +++ b/src/components/dialog/types/dialog.ts @@ -1,13 +1,6 @@ -import type { Simplify } from '@/components/_shared/types/simplify' import type { Dialog as DialogPrimitive } from '@radix-ui/react-dialog' import type React from 'react' -type DialogPrimitiveProps = Omit, 'modal'> - -type DialogCustomProps = { - isModal?: boolean -} - -type DialogProps = Simplify +type DialogProps = React.ComponentProps export type { DialogProps } diff --git a/src/components/flex/components/flex.tsx b/src/components/flex/components/flex.tsx index 15f4e03..7bf1dc4 100644 --- a/src/components/flex/components/flex.tsx +++ b/src/components/flex/components/flex.tsx @@ -1,5 +1,4 @@ import { polymorphic } from '@renderui/utils' -import React from 'react' import type { FlexProps } from '@/components/flex/types/flex' import { getMergedClassName } from '@/components/flex/utils/get-merged-class-name' diff --git a/src/components/form/components/form.tsx b/src/components/form/components/form.tsx index 3e63ea3..c966173 100644 --- a/src/components/form/components/form.tsx +++ b/src/components/form/components/form.tsx @@ -1,5 +1,4 @@ import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import type { FormProps } from '@/components/form/types/form' import { getSubmitProps } from '@/components/form/utils/get-submit-props' diff --git a/src/components/grid/components/grid.tsx b/src/components/grid/components/grid.tsx index 59ca313..e340471 100644 --- a/src/components/grid/components/grid.tsx +++ b/src/components/grid/components/grid.tsx @@ -1,5 +1,4 @@ import { polymorphic } from '@renderui/utils' -import React from 'react' import type { GridProps } from '@/components/grid/types/grid' import { getMergedStyles } from '@/components/grid/utils/get-merged-styles' diff --git a/src/components/heading/components/heading.tsx b/src/components/heading/components/heading.tsx index 4e48ab6..7cc91ba 100644 --- a/src/components/heading/components/heading.tsx +++ b/src/components/heading/components/heading.tsx @@ -1,5 +1,4 @@ import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import { headingClasses } from '@/components/heading/classes/heading-classes' import type { HeadingProps } from '@/components/heading/types/heading' diff --git a/src/components/hover-card/components/hover-card-trigger.tsx b/src/components/hover-card/components/hover-card-trigger.tsx index 7f4af82..4447aa4 100644 --- a/src/components/hover-card/components/hover-card-trigger.tsx +++ b/src/components/hover-card/components/hover-card-trigger.tsx @@ -3,7 +3,6 @@ import { useHoverCardContext } from '@/components/hover-card/contexts/hover-card import type { HoverCardTriggerProps } from '@/components/hover-card/types/hover-card-trigger' import { HoverCardTrigger as HoverCardTriggerPrimitive } from '@radix-ui/react-hover-card' import { chain } from '@renderui/utils' -import React from 'react' const HoverCardTrigger = (props: HoverCardTriggerProps) => { const { variant = 'plain', onPress, ...restProps } = props diff --git a/src/components/hover-card/components/hover-card.tsx b/src/components/hover-card/components/hover-card.tsx index d6308c3..f27a508 100644 --- a/src/components/hover-card/components/hover-card.tsx +++ b/src/components/hover-card/components/hover-card.tsx @@ -2,7 +2,6 @@ import { useControllableState } from '@/components/_shared/hooks/use-controllabl import { HoverCardProvider } from '@/components/hover-card/contexts/hover-card-context' import type { HoverCardProps } from '@/components/hover-card/types/hover-card' import { HoverCard as HoverCardPrimitive } from '@radix-ui/react-hover-card' -import React from 'react' const HoverCard = (props: HoverCardProps) => { const { diff --git a/src/components/kbd/components/kbd.tsx b/src/components/kbd/components/kbd.tsx index 86e10fe..0a14bcb 100644 --- a/src/components/kbd/components/kbd.tsx +++ b/src/components/kbd/components/kbd.tsx @@ -1,7 +1,6 @@ 'use client' import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import { useKeyboardHotkey } from '@/components/_shared/hooks/use-keyboard-hotkey' import { DEFAULT_KBD_CLASSNAME } from '@/components/kbd/constants/constants' diff --git a/src/components/label/components/label.tsx b/src/components/label/components/label.tsx index 85521bc..aaa1ae1 100644 --- a/src/components/label/components/label.tsx +++ b/src/components/label/components/label.tsx @@ -1,7 +1,6 @@ 'use client' import { chain, cn, polymorphic } from '@renderui/utils' -import React from 'react' import { DEFAULT_LABEL_CLASSNAME } from '@/components/label/constants/constants' import type { LabelProps } from '@/components/label/types/label' diff --git a/src/components/loader/components/loader-dot.tsx b/src/components/loader/components/loader-dot.tsx index fd19c4a..6848f3b 100644 --- a/src/components/loader/components/loader-dot.tsx +++ b/src/components/loader/components/loader-dot.tsx @@ -1,5 +1,4 @@ import { cn } from '@renderui/utils' -import React from 'react' import { DEFAULT_LOADER_DOT_CLASSNAME, diff --git a/src/components/loader/components/loader.tsx b/src/components/loader/components/loader.tsx index f763494..de8e951 100644 --- a/src/components/loader/components/loader.tsx +++ b/src/components/loader/components/loader.tsx @@ -1,5 +1,4 @@ import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import { loaderClasses } from '@/components/loader/classes/loader-classes' import { LoaderDot } from '@/components/loader/components/loader-dot' diff --git a/src/components/navigation-menu/components/navigation-menu-content.tsx b/src/components/navigation-menu/components/navigation-menu-content.tsx index 65493ee..4b45fef 100644 --- a/src/components/navigation-menu/components/navigation-menu-content.tsx +++ b/src/components/navigation-menu/components/navigation-menu-content.tsx @@ -2,7 +2,6 @@ import { NavigationMenuContent as NavigationMenuContentPrimitive } from '@radix-ui/react-navigation-menu' import { cn } from '@renderui/utils' -import React from 'react' import { DEFAULT_NAVIGATION_MENU_CONTENT_CLASSNAME } from '@/components/navigation-menu/constants/constants' import type { NavigationMenuContentProps } from '@/components/navigation-menu/types/navigation-menu-content' diff --git a/src/components/navigation-menu/components/navigation-menu-item.tsx b/src/components/navigation-menu/components/navigation-menu-item.tsx index b9bdbbe..916faba 100644 --- a/src/components/navigation-menu/components/navigation-menu-item.tsx +++ b/src/components/navigation-menu/components/navigation-menu-item.tsx @@ -2,7 +2,6 @@ import { NavigationMenuItem as NavigationMenuItemPrimitive } from '@radix-ui/react-navigation-menu' import { cn } from '@renderui/utils' -import React from 'react' import { DEFAULT_NAVIGATION_MENU_ITEM_CLASSNAME } from '@/components/navigation-menu/constants/constants' import type { NavigationMenuItemProps } from '@/components/navigation-menu/types/navigation-menu-item' diff --git a/src/components/navigation-menu/components/navigation-menu-link.tsx b/src/components/navigation-menu/components/navigation-menu-link.tsx index 2f151aa..6ce57e3 100644 --- a/src/components/navigation-menu/components/navigation-menu-link.tsx +++ b/src/components/navigation-menu/components/navigation-menu-link.tsx @@ -2,7 +2,6 @@ import { NavigationMenuLink as NavigationMenuLinkPrimitive } from '@radix-ui/react-navigation-menu' import { cn } from '@renderui/utils' -import React from 'react' import { Button } from '@/components/button' import { DEFAULT_NAVIGATION_MENU_LINK_CLASSNAME } from '@/components/navigation-menu/constants/constants' diff --git a/src/components/navigation-menu/components/navigation-menu.tsx b/src/components/navigation-menu/components/navigation-menu.tsx index e3b5eac..1c78bf1 100644 --- a/src/components/navigation-menu/components/navigation-menu.tsx +++ b/src/components/navigation-menu/components/navigation-menu.tsx @@ -7,7 +7,6 @@ import { NavigationMenuViewport as NavigationMenuViewportPrimitive, } from '@radix-ui/react-navigation-menu' import { cn, getOptionalObject } from '@renderui/utils' -import React from 'react' import { DEFAULT_NAVIGATION_MENU_ARROW_CLASSNAME, diff --git a/src/components/number-input/components/number-input.tsx b/src/components/number-input/components/number-input.tsx index db49474..077dde5 100644 --- a/src/components/number-input/components/number-input.tsx +++ b/src/components/number-input/components/number-input.tsx @@ -1,7 +1,6 @@ 'use client' import { polymorphic } from '@renderui/utils' -import React from 'react' import { Aria } from '@/components/aria' import { NumberSpinButton } from '@/components/number-input/components/number-spin-button' diff --git a/src/components/number-input/hooks/use-number-spin.ts b/src/components/number-input/hooks/use-number-spin.ts index 3bef403..820f91d 100644 --- a/src/components/number-input/hooks/use-number-spin.ts +++ b/src/components/number-input/hooks/use-number-spin.ts @@ -18,7 +18,10 @@ type UseNumberSpinArgs = { onSpinDecrement: NumberInputProps['onSpinDecrement'] } -function useNumberSpin(args: UseNumberSpinArgs, inputRef: React.RefObject) { +function useNumberSpin( + args: UseNumberSpinArgs, + inputRef: React.RefObject, +) { const { value, min, max, step, pattern, setValue, onSpin, onSpinIncrement, onSpinDecrement } = args diff --git a/src/components/overlay/components/overlay.tsx b/src/components/overlay/components/overlay.tsx index b06f04b..161b7dc 100644 --- a/src/components/overlay/components/overlay.tsx +++ b/src/components/overlay/components/overlay.tsx @@ -2,7 +2,6 @@ import { DialogOverlay } from '@radix-ui/react-dialog' import { cn } from '@renderui/utils' -import React from 'react' import { DEFAULT_OVERLAY_CLASSNAME } from '@/components/overlay/constants/constants' import type { OverlayProps } from '@/components/overlay/types/overlay' diff --git a/src/components/popover/components/popover-trigger.tsx b/src/components/popover/components/popover-trigger.tsx index b3a7d15..56d5f93 100644 --- a/src/components/popover/components/popover-trigger.tsx +++ b/src/components/popover/components/popover-trigger.tsx @@ -2,7 +2,6 @@ import { PopoverTrigger as PopoverTriggerPrimitive } from '@radix-ui/react-popover' import { cx } from '@renderui/utils' -import React from 'react' import { Button } from '@/components/button' import { DEFAULT_POPOVER_TRIGGER_CLASSNAME } from '@/components/popover/constants/constants' diff --git a/src/components/progress/components/progress.tsx b/src/components/progress/components/progress.tsx index 9250234..7dea9d4 100644 --- a/src/components/progress/components/progress.tsx +++ b/src/components/progress/components/progress.tsx @@ -1,5 +1,4 @@ import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import { EMPTY_OBJECT } from '@/components/_shared/constants/constants' import { DEFAULT_PROGRESS_CLASSNAME } from '@/components/progress/constants/constants' diff --git a/src/components/radio-group/components/radio-group-item.tsx b/src/components/radio-group/components/radio-group-item.tsx index 09a85a2..67fda25 100644 --- a/src/components/radio-group/components/radio-group-item.tsx +++ b/src/components/radio-group/components/radio-group-item.tsx @@ -1,7 +1,6 @@ 'use client' import { chain, cn, cx, functionCallOrValue, getOptionalObject, polymorphic } from '@renderui/utils' -import React from 'react' import { DEFAULT_RADIO_GROUP_ITEM_CLASSNAME, diff --git a/src/components/radio-group/components/radio-group.tsx b/src/components/radio-group/components/radio-group.tsx index 6b8497c..b7156cf 100644 --- a/src/components/radio-group/components/radio-group.tsx +++ b/src/components/radio-group/components/radio-group.tsx @@ -1,7 +1,6 @@ 'use client' import { cx, functionCallOrValue } from '@renderui/utils' -import React from 'react' import { useControllableState } from '@/components/_shared/hooks/use-controllable-state' import { DEFAULT_RADIO_GROUP_CLASSNAME } from '@/components/radio-group/constants/constants' diff --git a/src/components/ripple/components/ripple.tsx b/src/components/ripple/components/ripple.tsx index f1b0c70..ac0a181 100644 --- a/src/components/ripple/components/ripple.tsx +++ b/src/components/ripple/components/ripple.tsx @@ -1,7 +1,6 @@ 'use client' import { AnimatePresence, m } from 'framer-motion' -import React from 'react' import { useRipple } from '@/components/ripple/hooks/use-ripple' import type { RippleProps } from '@/components/ripple/types/ripple' diff --git a/src/components/select/components/select.tsx b/src/components/select/components/select.tsx index 91e7f85..8118fd3 100644 --- a/src/components/select/components/select.tsx +++ b/src/components/select/components/select.tsx @@ -1,5 +1,3 @@ -import React from 'react' - import { Combobox, type ComboboxProps } from '@/components/combobox' const Select = (props: ComboboxProps) => { diff --git a/src/components/separator/components/separator.tsx b/src/components/separator/components/separator.tsx index 28ae14e..8c66b2f 100644 --- a/src/components/separator/components/separator.tsx +++ b/src/components/separator/components/separator.tsx @@ -1,5 +1,4 @@ import { polymorphic } from '@renderui/utils' -import React from 'react' import type { SeparatorProps } from '@/components/separator/types/separator' import { getMergedClassName } from '@/components/separator/utils/get-merged-class-name' diff --git a/src/components/sheet/components/sheet-content.tsx b/src/components/sheet/components/sheet-content.tsx index 64fb2d0..348684d 100644 --- a/src/components/sheet/components/sheet-content.tsx +++ b/src/components/sheet/components/sheet-content.tsx @@ -5,7 +5,6 @@ import { DialogPortal as SheetPortalPrimitive, } from '@radix-ui/react-dialog' import { cn, cx, getOptionalObject } from '@renderui/utils' -import React from 'react' import { CrossSmallIcon } from '@/components/_shared/components/icons/cross-small-icon' import { ModalClose } from '@/components/_shared/components/modal-close/modal-close' diff --git a/src/components/sheet/components/sheet-trigger.tsx b/src/components/sheet/components/sheet-trigger.tsx index 27d49c2..d23e6ef 100644 --- a/src/components/sheet/components/sheet-trigger.tsx +++ b/src/components/sheet/components/sheet-trigger.tsx @@ -2,7 +2,6 @@ import { DialogTrigger as SheetTriggerPrimitive } from '@radix-ui/react-dialog' import { cn } from '@renderui/utils' -import React from 'react' import { Button } from '@/components/button' import { DEFAULT_SHEET_TRIGGER_CLASSNAME } from '@/components/sheet/constants/constants' diff --git a/src/components/sheet/components/sheet.tsx b/src/components/sheet/components/sheet.tsx index 710f842..41c3680 100644 --- a/src/components/sheet/components/sheet.tsx +++ b/src/components/sheet/components/sheet.tsx @@ -1,14 +1,11 @@ 'use client' import { Dialog as SheetPrimitive } from '@radix-ui/react-dialog' -import React from 'react' import type { SheetProps } from '@/components/sheet/types/sheet' const Sheet = (props: SheetProps) => { - const { isModal, ...restProps } = props - - return + return } export { Sheet } diff --git a/src/components/sheet/types/sheet.ts b/src/components/sheet/types/sheet.ts index 7251afc..47b342e 100644 --- a/src/components/sheet/types/sheet.ts +++ b/src/components/sheet/types/sheet.ts @@ -1,12 +1,5 @@ -import type { Simplify } from '@/components/_shared/types/simplify' import type { Dialog as SheetPrimitive } from '@radix-ui/react-dialog' -type SheetPrimitiveProps = Omit, 'modal'> - -type SheetRenderUIProps = { - isModal?: boolean -} - -type SheetProps = Simplify +type SheetProps = React.ComponentProps export type { SheetProps } diff --git a/src/components/skeleton/components/skeleton.tsx b/src/components/skeleton/components/skeleton.tsx index d2e6753..14c2d93 100644 --- a/src/components/skeleton/components/skeleton.tsx +++ b/src/components/skeleton/components/skeleton.tsx @@ -1,5 +1,4 @@ import { polymorphic } from '@renderui/utils' -import React from 'react' import type { SkeletonProps } from '@/components/skeleton/types/skeleton' import { getMergedClassName } from '@/components/skeleton/utils/get-merged-class-name' diff --git a/src/components/slider/components/slider-thumb.tsx b/src/components/slider/components/slider-thumb.tsx index 568b6a4..9e7edd5 100644 --- a/src/components/slider/components/slider-thumb.tsx +++ b/src/components/slider/components/slider-thumb.tsx @@ -2,7 +2,6 @@ import { SliderThumb as SliderThumbPrimitive } from '@radix-ui/react-slider' import { cn } from '@renderui/utils' -import React from 'react' import { DEFAULT_SLIDER_THUMB_CLASSNAME } from '@/components/slider/constants/constants' import type { SliderThumbProps } from '@/components/slider/types/slider-thumb' diff --git a/src/components/slider/components/slider.tsx b/src/components/slider/components/slider.tsx index eed6804..6cb328e 100644 --- a/src/components/slider/components/slider.tsx +++ b/src/components/slider/components/slider.tsx @@ -6,7 +6,6 @@ import { SliderTrack as SliderTrackPrimitive, } from '@radix-ui/react-slider' import { cn, getOptionalObject } from '@renderui/utils' -import React from 'react' import { SliderThumb } from '@/components/slider/components/slider-thumb' import { diff --git a/src/components/sub-layer/components/sub-layer.tsx b/src/components/sub-layer/components/sub-layer.tsx index 818c942..df06a82 100644 --- a/src/components/sub-layer/components/sub-layer.tsx +++ b/src/components/sub-layer/components/sub-layer.tsx @@ -1,5 +1,4 @@ import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import { DEFAULT_SUB_LAYER_CLASSNAME } from '@/components/sub-layer/constants/constants' import type { SubLayerProps } from '@/components/sub-layer/types/sub-layer' diff --git a/src/components/switch/components/switch-thumb.tsx b/src/components/switch/components/switch-thumb.tsx index 359994e..ae3a6e7 100644 --- a/src/components/switch/components/switch-thumb.tsx +++ b/src/components/switch/components/switch-thumb.tsx @@ -1,5 +1,4 @@ import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import { DEFAULT_SWITCH_THUMB_CLASSNAME } from '@/components/switch/constants/constants' import type { SwitchThumbProps } from '@/components/switch/types/switch-thumb' diff --git a/src/components/tabs/components/tabs-content.tsx b/src/components/tabs/components/tabs-content.tsx index 39d5967..61e4e25 100644 --- a/src/components/tabs/components/tabs-content.tsx +++ b/src/components/tabs/components/tabs-content.tsx @@ -2,7 +2,6 @@ import { TabsContent as TabsContentPrimitive } from '@radix-ui/react-tabs' import { cn } from '@renderui/utils' -import React from 'react' import { DEFAULT_TABS_CONTENT_CLASSNAME } from '@/components/tabs/constants/constants' import type { TabsContentProps } from '@/components/tabs/types/tabs-content' diff --git a/src/components/tabs/components/tabs-trigger-children-container.tsx b/src/components/tabs/components/tabs-trigger-children-container.tsx index 9f4fc8a..a558470 100644 --- a/src/components/tabs/components/tabs-trigger-children-container.tsx +++ b/src/components/tabs/components/tabs-trigger-children-container.tsx @@ -1,7 +1,6 @@ import { DEFAULT_TABS_TRIGGER_CHILDREN_CONTAINER_CLASSNAME } from '@/components/tabs/constants/constants' import type { TabsTriggerChildrenContainerProps } from '@/components/tabs/types/tabs-trigger-children-container' import { cn } from '@renderui/utils' -import React from 'react' const TabsTriggerChildrenContainer = (props: TabsTriggerChildrenContainerProps) => { const { className, children, ...restProps } = props diff --git a/src/components/tabs/components/tabs-trigger-list.tsx b/src/components/tabs/components/tabs-trigger-list.tsx index 23da171..ce97e9a 100644 --- a/src/components/tabs/components/tabs-trigger-list.tsx +++ b/src/components/tabs/components/tabs-trigger-list.tsx @@ -2,7 +2,6 @@ import { TabsList as TabsTriggerListPrimitive } from '@radix-ui/react-tabs' import { cn } from '@renderui/utils' -import React from 'react' import { tabsTriggerListClasses } from '@/components/tabs/classes/tabs-trigger-list-classes' import { useTabsContext } from '@/components/tabs/context/tabs-context' diff --git a/src/components/tabs/components/tabs-trigger.tsx b/src/components/tabs/components/tabs-trigger.tsx index a96bf46..90fb368 100644 --- a/src/components/tabs/components/tabs-trigger.tsx +++ b/src/components/tabs/components/tabs-trigger.tsx @@ -2,7 +2,6 @@ import { TabsTrigger as TabsTriggerPrimitive } from '@radix-ui/react-tabs' import { cx, functionCallOrValue, getOptionalObject } from '@renderui/utils' -import React from 'react' import { chain } from 'react-aria' import { Button } from '@/components/button' diff --git a/src/components/text-input/components/password-toggle.tsx b/src/components/text-input/components/password-toggle.tsx index 3ed3567..543339c 100644 --- a/src/components/text-input/components/password-toggle.tsx +++ b/src/components/text-input/components/password-toggle.tsx @@ -1,5 +1,4 @@ import { cn, getOptionalObject } from '@renderui/utils' -import React from 'react' import { EyeNoneIcon } from '@/components/_shared/components/icons/eye-none-icon' import { EyeOpenIcon } from '@/components/_shared/components/icons/eye-open-icon' diff --git a/src/components/text-input/components/text-input.tsx b/src/components/text-input/components/text-input.tsx index 684d78b..cee5604 100644 --- a/src/components/text-input/components/text-input.tsx +++ b/src/components/text-input/components/text-input.tsx @@ -1,14 +1,13 @@ 'use client' import { polymorphic } from '@renderui/utils' -import React from 'react' import { CrossSmallIcon } from '@/components/_shared/components/icons/cross-small-icon' import { Aria } from '@/components/aria' import { Button } from '@/components/button' import { PasswordToggle } from '@/components/text-input/components/password-toggle' import { useTextInput } from '@/components/text-input/hooks/use-text-input' -import { type TextInputProps, TextInputRef } from '@/components/text-input/types/text-input' +import type { TextInputProps } from '@/components/text-input/types/text-input' const TextInput = (props: TextInputProps) => { const { diff --git a/src/components/text/components/text.tsx b/src/components/text/components/text.tsx index 7a1641f..eb5f9c6 100644 --- a/src/components/text/components/text.tsx +++ b/src/components/text/components/text.tsx @@ -1,5 +1,4 @@ import { cn, polymorphic } from '@renderui/utils' -import React from 'react' import { textClasses } from '@/components/text/classes/text-classes' import type { TextProps } from '@/components/text/types/text' diff --git a/src/components/toast/components/toast.tsx b/src/components/toast/components/toast.tsx index fc53713..a5fa2e3 100644 --- a/src/components/toast/components/toast.tsx +++ b/src/components/toast/components/toast.tsx @@ -4,7 +4,6 @@ import { CrossSmallIcon } from '@/components/_shared/components/icons/cross-smal import { DEFAULT_TOAST_PROPS } from '@/components/toast/constants/constants' import type { ToastClasses, ToastContentProps, ToastProps } from '@/components/toast/types/toast' import { chain, cn, getOptionalObject } from '@renderui/utils' -import React from 'react' import { toast } from 'sonner' const ToastContent = (props: ToastContentProps) => { diff --git a/src/components/toggle-group/components/toggle-group-item.tsx b/src/components/toggle-group/components/toggle-group-item.tsx index 14cc533..2c72d65 100644 --- a/src/components/toggle-group/components/toggle-group-item.tsx +++ b/src/components/toggle-group/components/toggle-group-item.tsx @@ -2,7 +2,6 @@ import { ToggleGroupItem as ToggleGroupItemPrimitive } from '@radix-ui/react-toggle-group' import { cn, functionCallOrValue } from '@renderui/utils' -import React from 'react' import { Button } from '@/components/button' import { useToggleGroupContext } from '@/components/toggle-group/contexts/toggle-group-context' diff --git a/src/components/toggle-group/components/toggle-group.tsx b/src/components/toggle-group/components/toggle-group.tsx index a1414ed..4236b73 100644 --- a/src/components/toggle-group/components/toggle-group.tsx +++ b/src/components/toggle-group/components/toggle-group.tsx @@ -2,7 +2,6 @@ import { ToggleGroup as ToggleGroupPrimitive } from '@radix-ui/react-toggle-group' import { cn, functionCallOrValue } from '@renderui/utils' -import React from 'react' import { EMPTY_ARRAY } from '@/components/_shared/constants/constants' import { useControllableState } from '@/components/_shared/hooks/use-controllable-state' diff --git a/src/components/toggle/components/toggle.tsx b/src/components/toggle/components/toggle.tsx index ffb6156..695a5be 100644 --- a/src/components/toggle/components/toggle.tsx +++ b/src/components/toggle/components/toggle.tsx @@ -2,7 +2,6 @@ import { Toggle as TogglePrimitive } from '@radix-ui/react-toggle' import { cn, functionCallOrValue } from '@renderui/utils' -import React from 'react' import { useControllableState } from '@/components/_shared/hooks/use-controllable-state' import { Button } from '@/components/button' diff --git a/src/components/tooltip/components/tooltip-content.tsx b/src/components/tooltip/components/tooltip-content.tsx index 6280aad..b28ad0a 100644 --- a/src/components/tooltip/components/tooltip-content.tsx +++ b/src/components/tooltip/components/tooltip-content.tsx @@ -5,7 +5,6 @@ import { TooltipContent as TooltipContentPrimitive, } from '@radix-ui/react-tooltip' import { cn, getOptionalObject } from '@renderui/utils' -import React from 'react' import { DEFAULT_SIDE_OFFSET, diff --git a/src/components/tooltip/components/tooltip.tsx b/src/components/tooltip/components/tooltip.tsx index ae81783..a0615e1 100644 --- a/src/components/tooltip/components/tooltip.tsx +++ b/src/components/tooltip/components/tooltip.tsx @@ -1,7 +1,6 @@ 'use client' import { Tooltip as TooltipPrimitive, TooltipProvider } from '@radix-ui/react-tooltip' -import React from 'react' import type { TooltipProps } from '@/components/tooltip/types/tooltip' diff --git a/src/components/visually-hidden/components/visually-hidden.tsx b/src/components/visually-hidden/components/visually-hidden.tsx index 8b89b4e..f106f1e 100644 --- a/src/components/visually-hidden/components/visually-hidden.tsx +++ b/src/components/visually-hidden/components/visually-hidden.tsx @@ -1,5 +1,4 @@ import { cn } from '@renderui/utils' -import React from 'react' import type { VisuallyHiddenProps } from '@/components/visually-hidden/types/visually-hidden' diff --git a/src/index.ts b/src/index.ts index 7f7e79b..5fa7db8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,3 +22,4 @@ export * from '@/components/_shared/hooks/use-on-click-outside' export * from '@/components/_shared/hooks/use-uncontrolled-state' export * from '@/components/_shared/hooks/use-isomorphic-layout-effect' export * from '@/components/_shared/hooks/use-media-query' +export * from '@/components/_shared/hooks/use-is-online' diff --git a/src/providers/mode-provider/components/mode-provider.tsx b/src/providers/mode-provider/components/mode-provider.tsx index 605317b..4d3b2fd 100644 --- a/src/providers/mode-provider/components/mode-provider.tsx +++ b/src/providers/mode-provider/components/mode-provider.tsx @@ -2,7 +2,6 @@ import { ThemeProvider as NextModeProvider } from 'next-themes' import type { ThemeProviderProps } from 'next-themes/dist/types' -import React from 'react' const ModeProvider = (props: ThemeProviderProps) => { return diff --git a/src/providers/mode-provider/hooks/use-mode.ts b/src/providers/mode-provider/hooks/use-mode.ts index a197e1a..a368fe3 100644 --- a/src/providers/mode-provider/hooks/use-mode.ts +++ b/src/providers/mode-provider/hooks/use-mode.ts @@ -1 +1,16 @@ -export { useTheme as useMode } from 'next-themes' +import { useTheme } from 'next-themes' + +function useMode() { + const theme = useTheme() + + return { + mode: theme.theme, + setMode: theme.setTheme, + modes: theme.themes, + forcedMode: theme.forcedTheme, + systemMode: theme.systemTheme, + resolvedMode: theme.resolvedTheme, + } +} + +export { useMode }