@oneplatformdev/ui 0.1.0-5 → 0.1.0-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +12 -0
- package/.storybook/main.ts +48 -0
- package/.storybook/manager.ts +6 -0
- package/.storybook/preview.ts +29 -0
- package/CHANGELOG.md +38 -0
- package/dist/CHANGELOG.md +14 -0
- package/dist/index.js +14 -13
- package/dist/package.json +2 -1
- package/external.ts +78 -0
- package/kit/MultiSelectCombobox/MultiSelectCombobox.tsx +211 -0
- package/kit/MultiSelectCombobox/index.tsx +2 -0
- package/kit/MultiSelectCombobox/types.ts +22 -0
- package/kit/NLTDateRangePicker/index.tsx +85 -0
- package/kit/NLTFilesDropZone/imageList/index.tsx +86 -0
- package/kit/NLTFilesDropZone/index.tsx +52 -0
- package/kit/NLTFormDateRangePicker/index.tsx +29 -0
- package/kit/NLTFormFilesDropZone/index.tsx +73 -0
- package/kit/NLTFormPhoneField/index.tsx +36 -0
- package/kit/NLTFormPhoneInput/index.tsx +32 -0
- package/kit/NLTImageDropZone/index.tsx +105 -0
- package/kit/NLTModal/index.tsx +36 -0
- package/kit/NLTModal/useModal.ts +10 -0
- package/kit/NLTModalHeader/index.tsx +48 -0
- package/kit/NLTModalHeader/useModal.ts +10 -0
- package/kit/NLTMonthYearPicker/index.tsx +66 -0
- package/kit/NLTMonthYearPicker/useMonthYearPicker.ts +37 -0
- package/kit/NLTPhoneInput/index.tsx +153 -0
- package/kit/NLTPieChart/index.tsx +62 -0
- package/kit/NLTSidebar/app-sidebar.tsx +39 -0
- package/kit/NLTSidebar/nav-main.tsx +68 -0
- package/kit/NLTSidebar/nav-projects.tsx +89 -0
- package/kit/NLTSidebar/nav-user.tsx +114 -0
- package/kit/NLTSidebar/team-switcher.tsx +89 -0
- package/kit/NLTTable/NLTTable.tsx +50 -0
- package/kit/NLTTable/index.tsx +1 -0
- package/kit/NLTTablePagination/index.tsx +75 -0
- package/kit/Sidebar/SidebarNav/SidebarNavGroup.tsx +27 -0
- package/kit/Sidebar/SidebarNav/SidebarNavGroupItem.tsx +120 -0
- package/kit/Sidebar/SidebarNav/index.ts +3 -0
- package/kit/Sidebar/SidebarNav/types.ts +19 -0
- package/kit/Sidebar/index.ts +1 -0
- package/kit/Stepper/LinearStepper.tsx +91 -0
- package/kit/Stepper/Stepper.tsx +17 -0
- package/kit/Stepper/VerticalStepper.tsx +91 -0
- package/kit/Stepper/index.ts +1 -0
- package/kit/Stepper/types.ts +21 -0
- package/kit/Stepper/useStepper.ts +40 -0
- package/node_modules/@oneplatformdev/hooks/.babelrc +12 -0
- package/node_modules/@oneplatformdev/hooks/CHANGELOG.md +23 -0
- package/node_modules/@oneplatformdev/hooks/LICENSE +21 -0
- package/node_modules/@oneplatformdev/hooks/README.md +7 -0
- package/node_modules/@oneplatformdev/hooks/dist/CHANGELOG.md +19 -0
- package/node_modules/@oneplatformdev/hooks/dist/LICENSE +21 -0
- package/node_modules/@oneplatformdev/hooks/dist/README.md +7 -0
- package/node_modules/@oneplatformdev/hooks/dist/index.d.ts +37 -0
- package/node_modules/@oneplatformdev/hooks/dist/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/index.js +74 -0
- package/node_modules/@oneplatformdev/hooks/dist/package.json +68 -0
- package/node_modules/@oneplatformdev/hooks/dist/useBoolean/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useBoolean/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useBoolean/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useBoolean/useBoolean.d.ts +29 -0
- package/node_modules/@oneplatformdev/hooks/dist/useBoolean/useBoolean.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useBoolean/useBoolean.js +16 -0
- package/node_modules/@oneplatformdev/hooks/dist/useClickAnyWhere/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useClickAnyWhere/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useClickAnyWhere/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useClickAnyWhere/useClickAnyWhere.d.ts +17 -0
- package/node_modules/@oneplatformdev/hooks/dist/useClickAnyWhere/useClickAnyWhere.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useClickAnyWhere/useClickAnyWhere.js +9 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCopyToClipboard/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCopyToClipboard/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCopyToClipboard/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCopyToClipboard/useCopyToClipboard.d.ts +34 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCopyToClipboard/useCopyToClipboard.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCopyToClipboard/useCopyToClipboard.js +16 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCountdown/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCountdown/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCountdown/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCountdown/useCountdown.d.ts +47 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCountdown/useCountdown.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCountdown/useCountdown.js +33 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCounter/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCounter/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCounter/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCounter/useCounter.d.ts +28 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCounter/useCounter.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useCounter/useCounter.js +20 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDarkMode/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDarkMode/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDarkMode/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDarkMode/useDarkMode.d.ts +46 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDarkMode/useDarkMode.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDarkMode/useDarkMode.js +38 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceCallback/index.d.ts +3 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceCallback/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceCallback/index.js +5 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceCallback/useDebounceCallback.d.ts +62 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceCallback/useDebounceCallback.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceCallback/useDebounceCallback.js +21 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceValue/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceValue/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceValue/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceValue/useDebounceValue.d.ts +40 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceValue/useDebounceValue.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDebounceValue/useDebounceValue.js +13 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDocumentTitle/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDocumentTitle/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDocumentTitle/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDocumentTitle/useDocumentTitle.d.ts +19 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDocumentTitle/useDocumentTitle.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useDocumentTitle/useDocumentTitle.js +16 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventCallback/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventCallback/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventCallback/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventCallback/useEventCallback.d.ts +18 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventCallback/useEventCallback.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventCallback/useEventCallback.js +13 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventListener/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventListener/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventListener/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventListener/useEventListener.d.ts +7 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventListener/useEventListener.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useEventListener/useEventListener.js +20 -0
- package/node_modules/@oneplatformdev/hooks/dist/useHover/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useHover/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useHover/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useHover/useHover.d.ts +17 -0
- package/node_modules/@oneplatformdev/hooks/dist/useHover/useHover.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useHover/useHover.js +13 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIntersectionObserver/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIntersectionObserver/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIntersectionObserver/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIntersectionObserver/useIntersectionObserver.d.ts +72 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIntersectionObserver/useIntersectionObserver.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIntersectionObserver/useIntersectionObserver.js +53 -0
- package/node_modules/@oneplatformdev/hooks/dist/useInterval/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useInterval/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useInterval/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useInterval/useInterval.d.ts +16 -0
- package/node_modules/@oneplatformdev/hooks/dist/useInterval/useInterval.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useInterval/useInterval.js +20 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsClient/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsClient/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsClient/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsClient/useIsClient.d.ts +13 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsClient/useIsClient.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsClient/useIsClient.js +10 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMobile/index.d.ts +3 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMobile/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMobile/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMobile/types.d.ts +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMobile/types.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMobile/types.js +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMobile/useIsMobile.d.ts +3 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMobile/useIsMobile.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMobile/useIsMobile.js +16 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMounted/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMounted/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMounted/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMounted/useIsMounted.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMounted/useIsMounted.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsMounted/useIsMounted.js +10 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsomorphicLayoutEffect/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsomorphicLayoutEffect/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsomorphicLayoutEffect/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +16 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +5 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLocalStorage/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLocalStorage/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLocalStorage/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLocalStorage/useLocalStorage.d.ts +39 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLocalStorage/useLocalStorage.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLocalStorage/useLocalStorage.js +65 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLockBody/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLockBody/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLockBody/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLockBody/useLockBody.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLockBody/useLockBody.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useLockBody/useLockBody.js +12 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMap/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMap/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMap/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMap/useMap.d.ts +48 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMap/useMap.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMap/useMap.js +27 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMediaQuery/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMediaQuery/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMediaQuery/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMediaQuery/useMediaQuery.d.ts +29 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMediaQuery/useMediaQuery.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useMediaQuery/useMediaQuery.js +21 -0
- package/node_modules/@oneplatformdev/hooks/dist/useOnClickOutside/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useOnClickOutside/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useOnClickOutside/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useOnClickOutside/useOnClickOutside.d.ts +24 -0
- package/node_modules/@oneplatformdev/hooks/dist/useOnClickOutside/useOnClickOutside.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useOnClickOutside/useOnClickOutside.js +17 -0
- package/node_modules/@oneplatformdev/hooks/dist/useQueryString/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useQueryString/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useQueryString/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useQueryString/useQueryString.d.ts +10 -0
- package/node_modules/@oneplatformdev/hooks/dist/useQueryString/useQueryString.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useQueryString/useQueryString.js +10 -0
- package/node_modules/@oneplatformdev/hooks/dist/useReadLocalStorage/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useReadLocalStorage/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useReadLocalStorage/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useReadLocalStorage/useReadLocalStorage.d.ts +14 -0
- package/node_modules/@oneplatformdev/hooks/dist/useReadLocalStorage/useReadLocalStorage.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useReadLocalStorage/useReadLocalStorage.js +48 -0
- package/node_modules/@oneplatformdev/hooks/dist/useResizeObserver/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useResizeObserver/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useResizeObserver/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useResizeObserver/useResizeObserver.d.ts +44 -0
- package/node_modules/@oneplatformdev/hooks/dist/useResizeObserver/useResizeObserver.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useResizeObserver/useResizeObserver.js +31 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScreen/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScreen/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScreen/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScreen/useScreen.d.ts +20 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScreen/useScreen.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScreen/useScreen.js +48 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScript/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScript/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScript/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScript/useScript.d.ts +24 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScript/useScript.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScript/useScript.js +45 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScrollLock/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScrollLock/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScrollLock/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScrollLock/useScrollLock.d.ts +54 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScrollLock/useScrollLock.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useScrollLock/useScrollLock.js +26 -0
- package/node_modules/@oneplatformdev/hooks/dist/useSessionStorage/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useSessionStorage/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useSessionStorage/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useSessionStorage/useSessionStorage.d.ts +39 -0
- package/node_modules/@oneplatformdev/hooks/dist/useSessionStorage/useSessionStorage.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useSessionStorage/useSessionStorage.js +65 -0
- package/node_modules/@oneplatformdev/hooks/dist/useStep/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useStep/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useStep/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useStep/useStep.d.ts +31 -0
- package/node_modules/@oneplatformdev/hooks/dist/useStep/useStep.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useStep/useStep.js +34 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTernaryDarkMode/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTernaryDarkMode/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTernaryDarkMode/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTernaryDarkMode/useTernaryDarkMode.d.ts +46 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTernaryDarkMode/useTernaryDarkMode.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTernaryDarkMode/useTernaryDarkMode.js +27 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTimeout/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTimeout/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTimeout/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTimeout/useTimeout.d.ts +17 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTimeout/useTimeout.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useTimeout/useTimeout.js +20 -0
- package/node_modules/@oneplatformdev/hooks/dist/useToggle/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useToggle/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useToggle/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useToggle/useToggle.d.ts +18 -0
- package/node_modules/@oneplatformdev/hooks/dist/useToggle/useToggle.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useToggle/useToggle.js +10 -0
- package/node_modules/@oneplatformdev/hooks/dist/useUnmount/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useUnmount/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useUnmount/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useUnmount/useUnmount.d.ts +14 -0
- package/node_modules/@oneplatformdev/hooks/dist/useUnmount/useUnmount.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useUnmount/useUnmount.js +13 -0
- package/node_modules/@oneplatformdev/hooks/dist/useWindowSize/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/dist/useWindowSize/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useWindowSize/index.js +4 -0
- package/node_modules/@oneplatformdev/hooks/dist/useWindowSize/useWindowSize.d.ts +30 -0
- package/node_modules/@oneplatformdev/hooks/dist/useWindowSize/useWindowSize.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/hooks/dist/useWindowSize/useWindowSize.js +31 -0
- package/node_modules/@oneplatformdev/hooks/package.json +68 -0
- package/node_modules/@oneplatformdev/hooks/src/index.ts +36 -0
- package/node_modules/@oneplatformdev/hooks/src/useBoolean/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useBoolean/useBoolean.ts +50 -0
- package/node_modules/@oneplatformdev/hooks/src/useClickAnyWhere/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useClickAnyWhere/useClickAnyWhere.ts +22 -0
- package/node_modules/@oneplatformdev/hooks/src/useCopyToClipboard/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useCopyToClipboard/useCopyToClipboard.ts +58 -0
- package/node_modules/@oneplatformdev/hooks/src/useCountdown/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useCountdown/useCountdown.ts +102 -0
- package/node_modules/@oneplatformdev/hooks/src/useCounter/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useCounter/useCounter.ts +52 -0
- package/node_modules/@oneplatformdev/hooks/src/useDarkMode/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useDarkMode/useDarkMode.ts +92 -0
- package/node_modules/@oneplatformdev/hooks/src/useDebounceCallback/index.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/src/useDebounceCallback/useDebounceCallback.ts +115 -0
- package/node_modules/@oneplatformdev/hooks/src/useDebounceValue/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useDebounceValue/useDebounceValue.ts +67 -0
- package/node_modules/@oneplatformdev/hooks/src/useDocumentTitle/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useDocumentTitle/useDocumentTitle.ts +43 -0
- package/node_modules/@oneplatformdev/hooks/src/useEventCallback/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useEventCallback/useEventCallback.ts +40 -0
- package/node_modules/@oneplatformdev/hooks/src/useEventListener/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useEventListener/useEventListener.ts +121 -0
- package/node_modules/@oneplatformdev/hooks/src/useHover/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useHover/useHover.ts +37 -0
- package/node_modules/@oneplatformdev/hooks/src/useIntersectionObserver/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useIntersectionObserver/useIntersectionObserver.ts +186 -0
- package/node_modules/@oneplatformdev/hooks/src/useInterval/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useInterval/useInterval.ts +43 -0
- package/node_modules/@oneplatformdev/hooks/src/useIsClient/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useIsClient/useIsClient.ts +22 -0
- package/node_modules/@oneplatformdev/hooks/src/useIsMobile/index.ts +2 -0
- package/node_modules/@oneplatformdev/hooks/src/useIsMobile/types.ts +3 -0
- package/node_modules/@oneplatformdev/hooks/src/useIsMobile/useIsMobile.tsx +23 -0
- package/node_modules/@oneplatformdev/hooks/src/useIsMounted/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useIsMounted/useIsMounted.ts +15 -0
- package/node_modules/@oneplatformdev/hooks/src/useIsomorphicLayoutEffect/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts +17 -0
- package/node_modules/@oneplatformdev/hooks/src/useLocalStorage/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useLocalStorage/useLocalStorage.ts +191 -0
- package/node_modules/@oneplatformdev/hooks/src/useLockBody/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useLockBody/useLockBody.tsx +12 -0
- package/node_modules/@oneplatformdev/hooks/src/useMap/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useMap/useMap.ts +83 -0
- package/node_modules/@oneplatformdev/hooks/src/useMediaQuery/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useMediaQuery/useMediaQuery.ts +83 -0
- package/node_modules/@oneplatformdev/hooks/src/useOnClickOutside/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useOnClickOutside/useOnClickOutside.ts +61 -0
- package/node_modules/@oneplatformdev/hooks/src/useQueryString/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useQueryString/useQueryString.ts +26 -0
- package/node_modules/@oneplatformdev/hooks/src/useReadLocalStorage/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useReadLocalStorage/useReadLocalStorage.ts +122 -0
- package/node_modules/@oneplatformdev/hooks/src/useResizeObserver/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useResizeObserver/useResizeObserver.ts +131 -0
- package/node_modules/@oneplatformdev/hooks/src/useScreen/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useScreen/useScreen.ts +106 -0
- package/node_modules/@oneplatformdev/hooks/src/useScript/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useScript/useScript.ts +142 -0
- package/node_modules/@oneplatformdev/hooks/src/useScrollLock/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useScrollLock/useScrollLock.ts +141 -0
- package/node_modules/@oneplatformdev/hooks/src/useSessionStorage/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useSessionStorage/useSessionStorage.ts +191 -0
- package/node_modules/@oneplatformdev/hooks/src/useStep/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useStep/useStep.ts +83 -0
- package/node_modules/@oneplatformdev/hooks/src/useTernaryDarkMode/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useTernaryDarkMode/useTernaryDarkMode.ts +81 -0
- package/node_modules/@oneplatformdev/hooks/src/useTimeout/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useTimeout/useTimeout.ts +44 -0
- package/node_modules/@oneplatformdev/hooks/src/useToggle/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useToggle/useToggle.ts +30 -0
- package/node_modules/@oneplatformdev/hooks/src/useUnmount/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useUnmount/useUnmount.ts +26 -0
- package/node_modules/@oneplatformdev/hooks/src/useWindowSize/index.ts +1 -0
- package/node_modules/@oneplatformdev/hooks/src/useWindowSize/useWindowSize.ts +100 -0
- package/node_modules/@oneplatformdev/hooks/tsconfig.json +10 -0
- package/node_modules/@oneplatformdev/hooks/tsconfig.lib.json +33 -0
- package/node_modules/@oneplatformdev/hooks/vite.config.ts +62 -0
- package/node_modules/@oneplatformdev/utils/.babelrc +12 -0
- package/node_modules/@oneplatformdev/utils/CHANGELOG.md +23 -0
- package/node_modules/@oneplatformdev/utils/LICENSE +21 -0
- package/node_modules/@oneplatformdev/utils/README.md +7 -0
- package/node_modules/@oneplatformdev/utils/dist/CHANGELOG.md +19 -0
- package/node_modules/@oneplatformdev/utils/dist/LICENSE +21 -0
- package/node_modules/@oneplatformdev/utils/dist/README.md +7 -0
- package/node_modules/@oneplatformdev/utils/dist/cn/cn.d.ts +4 -0
- package/node_modules/@oneplatformdev/utils/dist/cn/cn.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/utils/dist/cn/cn.js +9 -0
- package/node_modules/@oneplatformdev/utils/dist/cn/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/utils/dist/cn/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/utils/dist/cn/index.js +5 -0
- package/node_modules/@oneplatformdev/utils/dist/composeRefs/composeRefs.d.ts +4 -0
- package/node_modules/@oneplatformdev/utils/dist/composeRefs/composeRefs.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/utils/dist/composeRefs/composeRefs.js +10 -0
- package/node_modules/@oneplatformdev/utils/dist/composeRefs/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/utils/dist/composeRefs/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/utils/dist/composeRefs/index.js +5 -0
- package/node_modules/@oneplatformdev/utils/dist/index.d.ts +4 -0
- package/node_modules/@oneplatformdev/utils/dist/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/utils/dist/index.js +6 -0
- package/node_modules/@oneplatformdev/utils/dist/package.json +64 -0
- package/node_modules/@oneplatformdev/utils/dist/types/PartialOne.d.ts +2 -0
- package/node_modules/@oneplatformdev/utils/dist/types/PartialOne.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/utils/dist/types/PartialOne.js +1 -0
- package/node_modules/@oneplatformdev/utils/dist/types/index.d.ts +2 -0
- package/node_modules/@oneplatformdev/utils/dist/types/index.d.ts.map +1 -0
- package/node_modules/@oneplatformdev/utils/dist/types/index.js +1 -0
- package/node_modules/@oneplatformdev/utils/package.json +64 -0
- package/node_modules/@oneplatformdev/utils/src/cn/cn.ts +7 -0
- package/node_modules/@oneplatformdev/utils/src/cn/index.ts +1 -0
- package/node_modules/@oneplatformdev/utils/src/composeRefs/composeRefs.ts +12 -0
- package/node_modules/@oneplatformdev/utils/src/composeRefs/index.ts +1 -0
- package/node_modules/@oneplatformdev/utils/src/index.ts +3 -0
- package/node_modules/@oneplatformdev/utils/src/types/PartialOne.ts +1 -0
- package/node_modules/@oneplatformdev/utils/src/types/index.ts +1 -0
- package/node_modules/@oneplatformdev/utils/tsconfig.json +10 -0
- package/node_modules/@oneplatformdev/utils/tsconfig.lib.json +34 -0
- package/node_modules/@oneplatformdev/utils/vite.config.ts +60 -0
- package/node_modules/@radix-ui/react-slot/README.md +13 -0
- package/node_modules/@radix-ui/react-slot/dist/index.d.mts +13 -0
- package/node_modules/@radix-ui/react-slot/dist/index.d.ts +13 -0
- package/node_modules/@radix-ui/react-slot/dist/index.js +118 -0
- package/node_modules/@radix-ui/react-slot/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-slot/dist/index.mjs +85 -0
- package/node_modules/@radix-ui/react-slot/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-slot/package.json +50 -0
- package/node_modules/@radix-ui/react-tooltip/LICENSE +21 -0
- package/node_modules/@radix-ui/react-tooltip/README.md +3 -0
- package/node_modules/@radix-ui/react-tooltip/dist/index.d.mts +101 -0
- package/node_modules/@radix-ui/react-tooltip/dist/index.d.ts +101 -0
- package/node_modules/@radix-ui/react-tooltip/dist/index.js +540 -0
- package/node_modules/@radix-ui/react-tooltip/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-tooltip/dist/index.mjs +508 -0
- package/node_modules/@radix-ui/react-tooltip/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-tooltip/package.json +79 -0
- package/package.json +4 -3
- package/src/Button/Button.stories.tsx +33 -0
- package/src/Button/Button.tsx +33 -0
- package/src/Button/Button.types.ts +11 -0
- package/src/Button/buttonVariants.ts +38 -0
- package/src/Button/index.ts +3 -0
- package/src/ButtonIcon/ButtonIcon.stories.tsx +186 -0
- package/src/ButtonIcon/ButtonIcon.tsx +28 -0
- package/src/ButtonIcon/ButtonIcon.types.ts +10 -0
- package/src/ButtonIcon/buttonIconVariants.ts +137 -0
- package/src/ButtonIcon/index.ts +3 -0
- package/src/Tooltip/Tooltip.tsx +20 -0
- package/src/Tooltip/Tooltip.types.tsx +9 -0
- package/src/Tooltip/TooltipRoot.tsx +32 -0
- package/src/Tooltip/index.ts +3 -0
- package/src/global.css +123 -0
- package/src/index.ts +5 -0
- package/src_old/Accordion/Accordion.tsx +62 -0
- package/src_old/Accordion/index.ts +1 -0
- package/src_old/Alert/Alert.tsx +42 -0
- package/src_old/Alert/alertVariants.ts +19 -0
- package/src_old/Alert/index.ts +1 -0
- package/src_old/AlertDialog/AlertDialog.stories.tsx +131 -0
- package/src_old/AlertDialog/AlertDialog.tsx +257 -0
- package/src_old/AlertDialog/AlertDialog.types.tsx +66 -0
- package/src_old/AlertDialog/AlertDialogRoot.tsx +141 -0
- package/src_old/AlertDialog/index.ts +15 -0
- package/src_old/AreaChart/AreaChart.tsx +39 -0
- package/src_old/AreaChart/AreaChart.types.ts +18 -0
- package/src_old/AreaChart/index.tsx +2 -0
- package/src_old/Aside/Aside.tsx +26 -0
- package/src_old/Aside/Aside.types.ts +21 -0
- package/src_old/Aside/AsideSidebar.tsx +78 -0
- package/src_old/Aside/index.ts +3 -0
- package/src_old/AspectRatio/AspectRatio.tsx +5 -0
- package/src_old/AspectRatio/index.ts +1 -0
- package/src_old/Avatar/Avatar.tsx +48 -0
- package/src_old/Avatar/index.ts +1 -0
- package/src_old/Badge/Badge.tsx +13 -0
- package/src_old/Badge/Badge.types.ts +8 -0
- package/src_old/Badge/badgeVariants.ts +21 -0
- package/src_old/Badge/index.ts +3 -0
- package/src_old/Breadcrumb/Breadcrumb.tsx +115 -0
- package/src_old/Breadcrumb/index.ts +1 -0
- package/src_old/Calendar/Calendar.tsx +77 -0
- package/src_old/Calendar/index.ts +1 -0
- package/src_old/Card/Card.tsx +77 -0
- package/src_old/Card/index.ts +1 -0
- package/src_old/Carousel/Carousel.tsx +262 -0
- package/src_old/Carousel/index.ts +1 -0
- package/src_old/Chart/Chart.tsx +365 -0
- package/src_old/Chart/index.ts +1 -0
- package/src_old/Checkbox/Checkbox.tsx +62 -0
- package/src_old/Checkbox/Checkbox.types.ts +15 -0
- package/src_old/Checkbox/index.ts +2 -0
- package/src_old/Collapsible/Collapsible.tsx +11 -0
- package/src_old/Collapsible/index.ts +1 -0
- package/src_old/Combobox/Combobox.tsx +256 -0
- package/src_old/Combobox/Combobox.types.ts +55 -0
- package/src_old/Combobox/ComboboxOptionItem.tsx +46 -0
- package/src_old/Combobox/ComboboxOptions.tsx +90 -0
- package/src_old/Combobox/index.tsx +2 -0
- package/src_old/Command/Command.tsx +161 -0
- package/src_old/Command/index.ts +1 -0
- package/src_old/DataTable/DataTable.tsx +118 -0
- package/src_old/DataTable/DataTable.types.tsx +14 -0
- package/src_old/DataTable/DataTableColumnFilter.tsx +57 -0
- package/src_old/DataTable/index.tsx +2 -0
- package/src_old/DataTable/useDataTable.ts +44 -0
- package/src_old/DatePicker/DatePicker.tsx +56 -0
- package/src_old/DatePicker/DatePicker.types.tsx +7 -0
- package/src_old/DatePicker/index.tsx +3 -0
- package/src_old/Dialog/Dialog.tsx +182 -0
- package/src_old/Dialog/DialogOverlayScope.tsx +19 -0
- package/src_old/Dialog/index.ts +2 -0
- package/src_old/Drawer/Drawer.tsx +118 -0
- package/src_old/Drawer/index.ts +1 -0
- package/src_old/DropdownMenu/DropdownMenu.tsx +206 -0
- package/src_old/DropdownMenu/index.ts +1 -0
- package/src_old/Dropzone/Dropzone.tsx +229 -0
- package/src_old/Dropzone/Dropzone.types.tsx +69 -0
- package/src_old/Dropzone/DropzoneFilePreview.tsx +69 -0
- package/src_old/Dropzone/DropzoneSinglePickPreview.tsx +64 -0
- package/src_old/Dropzone/DropzoneUtils.tsx +31 -0
- package/src_old/Dropzone/index.tsx +2 -0
- package/src_old/Form/Form.tsx +181 -0
- package/src_old/Form/FormRenderControl.tsx +23 -0
- package/src_old/Form/FormRenderControl.types.tsx +29 -0
- package/src_old/Form/index.ts +4 -0
- package/src_old/FormCheckbox/FormCheckbox.tsx +34 -0
- package/src_old/FormCheckbox/FormCheckbox.types.tsx +10 -0
- package/src_old/FormCheckbox/index.tsx +2 -0
- package/src_old/FormCombobox/FormCombobox.tsx +27 -0
- package/src_old/FormCombobox/FormCombobox.types.ts +7 -0
- package/src_old/FormCombobox/index.tsx +2 -0
- package/src_old/FormDatePicker/FormDatePicker.tsx +33 -0
- package/src_old/FormDatePicker/FormDatePicker.types.ts +9 -0
- package/src_old/FormDatePicker/index.tsx +3 -0
- package/src_old/FormDropzone/FormDropzone.tsx +23 -0
- package/src_old/FormDropzone/FormDropzone.types.ts +7 -0
- package/src_old/FormDropzone/index.tsx +2 -0
- package/src_old/FormInput/FormInput.tsx +109 -0
- package/src_old/FormInput/FormInput.types.tsx +7 -0
- package/src_old/FormInput/index.tsx +2 -0
- package/src_old/FormRadio/FormRadio.tsx +54 -0
- package/src_old/FormRadio/FormRadio.types.ts +11 -0
- package/src_old/FormRadio/index.ts +2 -0
- package/src_old/FormSelect/FormSelect.tsx +44 -0
- package/src_old/FormSelect/FormSelect.types.ts +8 -0
- package/src_old/FormSelect/index.tsx +2 -0
- package/src_old/FormTextarea/FormTextarea.tsx +28 -0
- package/src_old/FormTextarea/FormTextarea.types.tsx +7 -0
- package/src_old/FormTextarea/index.tsx +2 -0
- package/src_old/Header/Header.tsx +34 -0
- package/src_old/Header/Header.types.tsx +3 -0
- package/src_old/Header/index.ts +2 -0
- package/src_old/HoverCard/HoverCard.tsx +29 -0
- package/src_old/HoverCard/index.ts +1 -0
- package/src_old/Input/Input.tsx +95 -0
- package/src_old/Input/Input.types.ts +26 -0
- package/src_old/Input/index.ts +3 -0
- package/src_old/Input/inputVariants.tsx +22 -0
- package/src_old/InputOTP/InputOTP.tsx +71 -0
- package/src_old/InputOTP/index.ts +1 -0
- package/src_old/Label/Label.tsx +23 -0
- package/src_old/Label/index.ts +2 -0
- package/src_old/Label/labelVariants.ts +8 -0
- package/src_old/LazyLoader/LazyLoader.tsx +30 -0
- package/src_old/LazyLoader/index.ts +1 -0
- package/src_old/LoadedIcon/LoadedIcon.tsx +36 -0
- package/src_old/LoadedIcon/index.ts +1 -0
- package/src_old/LoadingMask/LoadingMask.tsx +21 -0
- package/src_old/LoadingMask/LoadingMask.types.ts +5 -0
- package/src_old/LoadingMask/RenderLoadingMask.tsx +80 -0
- package/src_old/LoadingMask/index.ts +3 -0
- package/src_old/LoadingProgress/LoadingProgress.tsx +36 -0
- package/src_old/LoadingProgress/LoadingProgress.types.tsx +8 -0
- package/src_old/LoadingProgress/index.ts +3 -0
- package/src_old/LoadingProgress/loadingProgressVariants.ts +22 -0
- package/src_old/Menubar/Menubar.tsx +232 -0
- package/src_old/Menubar/index.ts +1 -0
- package/src_old/NavigationMenu/NavigationMenu.tsx +123 -0
- package/src_old/NavigationMenu/index.ts +2 -0
- package/src_old/NavigationMenu/navigationMenuVariants.ts +5 -0
- package/src_old/Pagination/Pagination.tsx +117 -0
- package/src_old/Pagination/index.ts +1 -0
- package/src_old/Popover/Popover.tsx +47 -0
- package/src_old/Popover/index.ts +1 -0
- package/src_old/Progress/Progress.tsx +28 -0
- package/src_old/Progress/index.ts +1 -0
- package/src_old/Radio/Radio.tsx +23 -0
- package/src_old/Radio/Radio.types.ts +17 -0
- package/src_old/Radio/index.ts +2 -0
- package/src_old/RadioGroup/RadioGroup.tsx +67 -0
- package/src_old/RadioGroup/index.ts +1 -0
- package/src_old/Resizable/Resizable.tsx +45 -0
- package/src_old/Resizable/index.ts +1 -0
- package/src_old/ScrollArea/ScrollArea.tsx +58 -0
- package/src_old/ScrollArea/index.ts +1 -0
- package/src_old/Search/Search.tsx +57 -0
- package/src_old/Search/Search.types.tsx +9 -0
- package/src_old/Search/index.tsx +3 -0
- package/src_old/Select/Select.stories.tsx +45 -0
- package/src_old/Select/Select.tsx +171 -0
- package/src_old/Select/Select.types.ts +46 -0
- package/src_old/Select/SelectRoot.tsx +164 -0
- package/src_old/Select/index.ts +3 -0
- package/src_old/Separator/Separator.tsx +31 -0
- package/src_old/Separator/index.ts +1 -0
- package/src_old/Sheet/Sheet.tsx +144 -0
- package/src_old/Sheet/index.ts +1 -0
- package/src_old/Sidebar/Sidebar.tsx +763 -0
- package/src_old/Sidebar/index.ts +1 -0
- package/src_old/Skeleton/Skeleton.tsx +17 -0
- package/src_old/Skeleton/index.ts +1 -0
- package/src_old/Slider/Slider.tsx +28 -0
- package/src_old/Slider/index.ts +1 -0
- package/src_old/Sonner/Sonner.tsx +31 -0
- package/src_old/Sonner/index.ts +1 -0
- package/src_old/Switch/Switch.tsx +29 -0
- package/src_old/Switch/index.ts +1 -0
- package/src_old/Table/Table.tsx +120 -0
- package/src_old/Table/index.ts +1 -0
- package/src_old/TablePagination/TablePagination.tsx +96 -0
- package/src_old/TablePagination/index.ts +1 -0
- package/src_old/Tabs/Tabs.tsx +35 -0
- package/src_old/Tabs/Tabs.types.tsx +13 -0
- package/src_old/Tabs/TabsRoot.tsx +55 -0
- package/src_old/Tabs/index.ts +2 -0
- package/src_old/Textarea/Textarea.tsx +78 -0
- package/src_old/Textarea/Textarea.types.tsx +21 -0
- package/src_old/Textarea/index.ts +2 -0
- package/src_old/Textarea/useAutosizeTextArea.ts +33 -0
- package/src_old/Theme/ThemeModeToggle.tsx +71 -0
- package/src_old/Theme/ThemeProvider.tsx +29 -0
- package/src_old/Theme/index.ts +2 -0
- package/src_old/Toast/Toast.tsx +109 -0
- package/src_old/Toast/Toast.types.tsx +45 -0
- package/src_old/Toast/index.ts +3 -0
- package/src_old/Toast/toast.constants.tsx +6 -0
- package/src_old/Toast/toastVariants.ts +20 -0
- package/src_old/Toast/useToast.ts +156 -0
- package/src_old/Toaster/Toaster.tsx +35 -0
- package/src_old/Toaster/index.ts +1 -0
- package/src_old/Toggle/Toggle.tsx +45 -0
- package/src_old/Toggle/index.ts +1 -0
- package/src_old/ToggleGroup/ToggleGroup.tsx +61 -0
- package/src_old/ToggleGroup/index.ts +1 -0
- package/src_old/global.css +275 -0
- package/src_old/index.ts +72 -0
- package/tsconfig.json +16 -0
- package/tsconfig.lib.json +41 -0
- package/vite.config.ts +67 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
import { useRef, useState } from 'react'
|
2
|
+
|
3
|
+
import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect'
|
4
|
+
|
5
|
+
/** Hook options. */
|
6
|
+
type UseScrollLockOptions = {
|
7
|
+
/**
|
8
|
+
* Whether to lock the scroll initially.
|
9
|
+
* @default true
|
10
|
+
*/
|
11
|
+
autoLock?: boolean
|
12
|
+
/**
|
13
|
+
* The target element to lock the scroll (default is the body element).
|
14
|
+
* @default document.body
|
15
|
+
*/
|
16
|
+
lockTarget?: HTMLElement | string
|
17
|
+
/**
|
18
|
+
* Whether to prevent width reflow when locking the scroll.
|
19
|
+
* @default true
|
20
|
+
*/
|
21
|
+
widthReflow?: boolean
|
22
|
+
}
|
23
|
+
|
24
|
+
/** Hook return type. */
|
25
|
+
type UseScrollLockReturn = {
|
26
|
+
/** Whether the scroll is locked. */
|
27
|
+
isLocked: boolean
|
28
|
+
/** Lock the scroll. */
|
29
|
+
lock: () => void
|
30
|
+
/** Unlock the scroll. */
|
31
|
+
unlock: () => void
|
32
|
+
}
|
33
|
+
|
34
|
+
type OriginalStyle = {
|
35
|
+
overflow: CSSStyleDeclaration['overflow']
|
36
|
+
paddingRight: CSSStyleDeclaration['paddingRight']
|
37
|
+
}
|
38
|
+
|
39
|
+
const IS_SERVER = typeof window === 'undefined'
|
40
|
+
|
41
|
+
/**
|
42
|
+
* A custom hook that locks and unlocks scroll.
|
43
|
+
* @param {UseScrollLockOptions} [options] - Options to configure the hook, by default it will lock the scroll automatically.
|
44
|
+
* @returns {UseScrollLockReturn} - An object containing the lock and unlock functions.
|
45
|
+
* @public
|
46
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-scroll-lock)
|
47
|
+
* @example
|
48
|
+
* ```tsx
|
49
|
+
* // Lock the scroll when the modal is mounted, and unlock it when it's unmounted
|
50
|
+
* useScrollLock()
|
51
|
+
* ```
|
52
|
+
* @example
|
53
|
+
* ```tsx
|
54
|
+
* // Manually lock and unlock the scroll
|
55
|
+
* const { lock, unlock } = useScrollLock({ autoLock: false })
|
56
|
+
*
|
57
|
+
* return (
|
58
|
+
* <div>
|
59
|
+
* <button onClick={lock}>Lock</button>
|
60
|
+
* <button onClick={unlock}>Unlock</button>
|
61
|
+
* </div>
|
62
|
+
* )
|
63
|
+
* ```
|
64
|
+
*/
|
65
|
+
export function useScrollLock(
|
66
|
+
options: UseScrollLockOptions = {},
|
67
|
+
): UseScrollLockReturn {
|
68
|
+
const { autoLock = true, lockTarget, widthReflow = true } = options
|
69
|
+
const [isLocked, setIsLocked] = useState(false)
|
70
|
+
const target = useRef<HTMLElement | null>(null)
|
71
|
+
const originalStyle = useRef<OriginalStyle | null>(null)
|
72
|
+
|
73
|
+
const lock = () => {
|
74
|
+
if (target.current) {
|
75
|
+
const { overflow, paddingRight } = target.current.style
|
76
|
+
|
77
|
+
// Save the original styles
|
78
|
+
originalStyle.current = { overflow, paddingRight }
|
79
|
+
|
80
|
+
// Prevent width reflow
|
81
|
+
if (widthReflow) {
|
82
|
+
// Use window inner width if body is the target as global scrollbar isn't part of the document
|
83
|
+
const offsetWidth =
|
84
|
+
target.current === document.body
|
85
|
+
? window.innerWidth
|
86
|
+
: target.current.offsetWidth
|
87
|
+
// Get current computed padding right in pixels
|
88
|
+
const currentPaddingRight =
|
89
|
+
parseInt(window.getComputedStyle(target.current).paddingRight, 10) ||
|
90
|
+
0
|
91
|
+
|
92
|
+
const scrollbarWidth = offsetWidth - target.current.scrollWidth
|
93
|
+
target.current.style.paddingRight = `${scrollbarWidth + currentPaddingRight}px`
|
94
|
+
}
|
95
|
+
|
96
|
+
// Lock the scroll
|
97
|
+
target.current.style.overflow = 'hidden'
|
98
|
+
|
99
|
+
setIsLocked(true)
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
const unlock = () => {
|
104
|
+
if (target.current && originalStyle.current) {
|
105
|
+
target.current.style.overflow = originalStyle.current.overflow
|
106
|
+
|
107
|
+
// Only reset padding right if we changed it
|
108
|
+
if (widthReflow) {
|
109
|
+
target.current.style.paddingRight = originalStyle.current.paddingRight
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
setIsLocked(false)
|
114
|
+
}
|
115
|
+
|
116
|
+
useIsomorphicLayoutEffect(() => {
|
117
|
+
if (IS_SERVER) return
|
118
|
+
|
119
|
+
if (lockTarget) {
|
120
|
+
target.current =
|
121
|
+
typeof lockTarget === 'string'
|
122
|
+
? document.querySelector(lockTarget)
|
123
|
+
: lockTarget
|
124
|
+
}
|
125
|
+
|
126
|
+
if (!target.current) {
|
127
|
+
target.current = document.body
|
128
|
+
}
|
129
|
+
|
130
|
+
if (autoLock) {
|
131
|
+
lock()
|
132
|
+
}
|
133
|
+
|
134
|
+
return () => {
|
135
|
+
unlock()
|
136
|
+
}
|
137
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
138
|
+
}, [autoLock, lockTarget, widthReflow])
|
139
|
+
|
140
|
+
return { isLocked, lock, unlock }
|
141
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useSessionStorage'
|
@@ -0,0 +1,191 @@
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react'
|
2
|
+
|
3
|
+
import type { Dispatch, SetStateAction } from 'react'
|
4
|
+
|
5
|
+
import { useEventCallback } from '../useEventCallback'
|
6
|
+
import { useEventListener } from '../useEventListener'
|
7
|
+
|
8
|
+
declare global {
|
9
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
10
|
+
interface WindowEventMap {
|
11
|
+
'session-storage': CustomEvent
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Represents the options for customizing the behavior of serialization and deserialization.
|
17
|
+
* @template T - The type of the state to be stored in session storage.
|
18
|
+
*/
|
19
|
+
type UseSessionStorageOptions<T> = {
|
20
|
+
/** A function to serialize the value before storing it. */
|
21
|
+
serializer?: (value: T) => string
|
22
|
+
/** A function to deserialize the stored value. */
|
23
|
+
deserializer?: (value: string) => T
|
24
|
+
/**
|
25
|
+
* If `true` (default), the hook will initialize reading the session storage. In SSR, you should set it to `false`, returning the initial value initially.
|
26
|
+
* @default true
|
27
|
+
*/
|
28
|
+
initializeWithValue?: boolean
|
29
|
+
}
|
30
|
+
|
31
|
+
const IS_SERVER = typeof window === 'undefined'
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Custom hook that uses the [`sessionStorage API`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) to persist state across page reloads.
|
35
|
+
* @template T - The type of the state to be stored in session storage.
|
36
|
+
* @param {string} key - The key under which the value will be stored in session storage.
|
37
|
+
* @param {T | (() => T)} initialValue - The initial value of the state or a function that returns the initial value.
|
38
|
+
* @param {?UseSessionStorageOptions<T>} [options] - Options for customizing the behavior of serialization and deserialization (optional).
|
39
|
+
* @returns {[T, Dispatch<SetStateAction<T>>, () => void]} A tuple containing the stored value, a function to set the value and a function to remove the key from storage.
|
40
|
+
* @public
|
41
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-session-storage)
|
42
|
+
* @example
|
43
|
+
* ```tsx
|
44
|
+
* const [count, setCount, removeCount] = useSessionStorage('count', 0);
|
45
|
+
* // Access the `count` value, the `setCount` function to update it and `removeCount` function to remove the key from storage.
|
46
|
+
* ```
|
47
|
+
*/
|
48
|
+
export function useSessionStorage<T>(
|
49
|
+
key: string,
|
50
|
+
initialValue: T | (() => T),
|
51
|
+
options: UseSessionStorageOptions<T> = {},
|
52
|
+
): [T, Dispatch<SetStateAction<T>>, () => void] {
|
53
|
+
const { initializeWithValue = true } = options
|
54
|
+
|
55
|
+
const serializer = useCallback<(value: T) => string>(
|
56
|
+
value => {
|
57
|
+
if (options.serializer) {
|
58
|
+
return options.serializer(value)
|
59
|
+
}
|
60
|
+
|
61
|
+
return JSON.stringify(value)
|
62
|
+
},
|
63
|
+
[options],
|
64
|
+
)
|
65
|
+
|
66
|
+
const deserializer = useCallback<(value: string) => T>(
|
67
|
+
value => {
|
68
|
+
if (options.deserializer) {
|
69
|
+
return options.deserializer(value)
|
70
|
+
}
|
71
|
+
// Support 'undefined' as a value
|
72
|
+
if (value === 'undefined') {
|
73
|
+
return undefined as unknown as T
|
74
|
+
}
|
75
|
+
|
76
|
+
const defaultValue =
|
77
|
+
initialValue instanceof Function ? initialValue() : initialValue
|
78
|
+
|
79
|
+
let parsed: unknown
|
80
|
+
try {
|
81
|
+
parsed = JSON.parse(value)
|
82
|
+
} catch (error) {
|
83
|
+
console.error('Error parsing JSON:', error)
|
84
|
+
return defaultValue // Return initialValue if parsing fails
|
85
|
+
}
|
86
|
+
|
87
|
+
return parsed as T
|
88
|
+
},
|
89
|
+
[options, initialValue],
|
90
|
+
)
|
91
|
+
|
92
|
+
// Get from session storage then
|
93
|
+
// parse stored json or return initialValue
|
94
|
+
const readValue = useCallback((): T => {
|
95
|
+
const initialValueToUse =
|
96
|
+
initialValue instanceof Function ? initialValue() : initialValue
|
97
|
+
|
98
|
+
// Prevent build error "window is undefined" but keep working
|
99
|
+
if (IS_SERVER) {
|
100
|
+
return initialValueToUse
|
101
|
+
}
|
102
|
+
|
103
|
+
try {
|
104
|
+
const raw = window.sessionStorage.getItem(key)
|
105
|
+
return raw ? deserializer(raw) : initialValueToUse
|
106
|
+
} catch (error) {
|
107
|
+
console.warn(`Error reading sessionStorage key “${key}”:`, error)
|
108
|
+
return initialValueToUse
|
109
|
+
}
|
110
|
+
}, [initialValue, key, deserializer])
|
111
|
+
|
112
|
+
const [storedValue, setStoredValue] = useState(() => {
|
113
|
+
if (initializeWithValue) {
|
114
|
+
return readValue()
|
115
|
+
}
|
116
|
+
|
117
|
+
return initialValue instanceof Function ? initialValue() : initialValue
|
118
|
+
})
|
119
|
+
|
120
|
+
// Return a wrapped version of useState's setter function that ...
|
121
|
+
// ... persists the new value to sessionStorage.
|
122
|
+
const setValue: Dispatch<SetStateAction<T>> = useEventCallback(value => {
|
123
|
+
// Prevent build error "window is undefined" but keeps working
|
124
|
+
if (IS_SERVER) {
|
125
|
+
console.warn(
|
126
|
+
`Tried setting sessionStorage key “${key}” even though environment is not a client`,
|
127
|
+
)
|
128
|
+
}
|
129
|
+
|
130
|
+
try {
|
131
|
+
// Allow value to be a function so we have the same API as useState
|
132
|
+
const newValue = value instanceof Function ? value(readValue()) : value
|
133
|
+
|
134
|
+
// Save to session storage
|
135
|
+
window.sessionStorage.setItem(key, serializer(newValue))
|
136
|
+
|
137
|
+
// Save state
|
138
|
+
setStoredValue(newValue)
|
139
|
+
|
140
|
+
// We dispatch a custom event so every similar useSessionStorage hook is notified
|
141
|
+
window.dispatchEvent(new StorageEvent('session-storage', { key }))
|
142
|
+
} catch (error) {
|
143
|
+
console.warn(`Error setting sessionStorage key “${key}”:`, error)
|
144
|
+
}
|
145
|
+
})
|
146
|
+
|
147
|
+
const removeValue = useEventCallback(() => {
|
148
|
+
// Prevent build error "window is undefined" but keeps working
|
149
|
+
if (IS_SERVER) {
|
150
|
+
console.warn(
|
151
|
+
`Tried removing sessionStorage key “${key}” even though environment is not a client`,
|
152
|
+
)
|
153
|
+
}
|
154
|
+
|
155
|
+
const defaultValue =
|
156
|
+
initialValue instanceof Function ? initialValue() : initialValue
|
157
|
+
|
158
|
+
// Remove the key from session storage
|
159
|
+
window.sessionStorage.removeItem(key)
|
160
|
+
|
161
|
+
// Save state with default value
|
162
|
+
setStoredValue(defaultValue)
|
163
|
+
|
164
|
+
// We dispatch a custom event so every similar useSessionStorage hook is notified
|
165
|
+
window.dispatchEvent(new StorageEvent('session-storage', { key }))
|
166
|
+
})
|
167
|
+
|
168
|
+
useEffect(() => {
|
169
|
+
setStoredValue(readValue())
|
170
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
171
|
+
}, [key])
|
172
|
+
|
173
|
+
const handleStorageChange = useCallback(
|
174
|
+
(event: StorageEvent | CustomEvent) => {
|
175
|
+
if ((event as StorageEvent).key && (event as StorageEvent).key !== key) {
|
176
|
+
return
|
177
|
+
}
|
178
|
+
setStoredValue(readValue())
|
179
|
+
},
|
180
|
+
[key, readValue],
|
181
|
+
)
|
182
|
+
|
183
|
+
// this only works for other documents, not the current one
|
184
|
+
useEventListener('storage', handleStorageChange)
|
185
|
+
|
186
|
+
// this is a custom event, triggered in writeValueToSessionStorage
|
187
|
+
// See: useSessionStorage()
|
188
|
+
useEventListener('session-storage', handleStorageChange)
|
189
|
+
|
190
|
+
return [storedValue, setValue, removeValue]
|
191
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useStep'
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { useCallback, useState } from 'react'
|
2
|
+
|
3
|
+
import type { Dispatch, SetStateAction } from 'react'
|
4
|
+
|
5
|
+
/** Represents the second element of the output of the `useStep` hook. */
|
6
|
+
type UseStepActions = {
|
7
|
+
/** Go to the next step in the process. */
|
8
|
+
goToNextStep: () => void
|
9
|
+
/** Go to the previous step in the process. */
|
10
|
+
goToPrevStep: () => void
|
11
|
+
/** Reset the step to the initial step. */
|
12
|
+
reset: () => void
|
13
|
+
/** Check if the next step is available. */
|
14
|
+
canGoToNextStep: boolean
|
15
|
+
/** Check if the previous step is available. */
|
16
|
+
canGoToPrevStep: boolean
|
17
|
+
/** Set the current step to a specific value. */
|
18
|
+
setStep: Dispatch<SetStateAction<number>>
|
19
|
+
}
|
20
|
+
|
21
|
+
type SetStepCallbackType = (step: number | ((step: number) => number)) => void
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Custom hook that manages and navigates between steps in a multi-step process.
|
25
|
+
* @param {number} maxStep - The maximum step in the process.
|
26
|
+
* @returns {[number, UseStepActions]} An tuple containing the current step and helper functions for navigating steps.
|
27
|
+
* @public
|
28
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-step)
|
29
|
+
* @example
|
30
|
+
* ```tsx
|
31
|
+
* const [currentStep, { goToNextStep, goToPrevStep, reset, canGoToNextStep, canGoToPrevStep, setStep }] = useStep(3);
|
32
|
+
* // Access and use the current step and provided helper functions.
|
33
|
+
* ```
|
34
|
+
*/
|
35
|
+
export function useStep(maxStep: number): [number, UseStepActions] {
|
36
|
+
const [currentStep, setCurrentStep] = useState(1)
|
37
|
+
|
38
|
+
const canGoToNextStep = currentStep + 1 <= maxStep
|
39
|
+
const canGoToPrevStep = currentStep - 1 > 0
|
40
|
+
|
41
|
+
const setStep = useCallback<SetStepCallbackType>(
|
42
|
+
step => {
|
43
|
+
// Allow value to be a function so we have the same API as useState
|
44
|
+
const newStep = step instanceof Function ? step(currentStep) : step
|
45
|
+
|
46
|
+
if (newStep >= 1 && newStep <= maxStep) {
|
47
|
+
setCurrentStep(newStep)
|
48
|
+
return
|
49
|
+
}
|
50
|
+
|
51
|
+
throw new Error('Step not valid')
|
52
|
+
},
|
53
|
+
[maxStep, currentStep],
|
54
|
+
)
|
55
|
+
|
56
|
+
const goToNextStep = useCallback(() => {
|
57
|
+
if (canGoToNextStep) {
|
58
|
+
setCurrentStep(step => step + 1)
|
59
|
+
}
|
60
|
+
}, [canGoToNextStep])
|
61
|
+
|
62
|
+
const goToPrevStep = useCallback(() => {
|
63
|
+
if (canGoToPrevStep) {
|
64
|
+
setCurrentStep(step => step - 1)
|
65
|
+
}
|
66
|
+
}, [canGoToPrevStep])
|
67
|
+
|
68
|
+
const reset = useCallback(() => {
|
69
|
+
setCurrentStep(1)
|
70
|
+
}, [])
|
71
|
+
|
72
|
+
return [
|
73
|
+
currentStep,
|
74
|
+
{
|
75
|
+
goToNextStep,
|
76
|
+
goToPrevStep,
|
77
|
+
canGoToNextStep,
|
78
|
+
canGoToPrevStep,
|
79
|
+
setStep,
|
80
|
+
reset,
|
81
|
+
},
|
82
|
+
]
|
83
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useTernaryDarkMode'
|
@@ -0,0 +1,81 @@
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react'
|
2
|
+
|
3
|
+
import { useLocalStorage } from '../useLocalStorage'
|
4
|
+
import { useMediaQuery } from '../useMediaQuery'
|
5
|
+
|
6
|
+
const COLOR_SCHEME_QUERY = '(prefers-color-scheme: dark)'
|
7
|
+
const LOCAL_STORAGE_KEY = 'usehooks-ts-ternary-dark-mode'
|
8
|
+
|
9
|
+
/** Ternary dark mode options. */
|
10
|
+
export type TernaryDarkMode = 'system' | 'dark' | 'light'
|
11
|
+
|
12
|
+
/** Options for the `useTernaryDarkMode` hook. */
|
13
|
+
export type TernaryDarkModeOptions = {
|
14
|
+
/**
|
15
|
+
* The default value for the dark mode.
|
16
|
+
* @default 'system'
|
17
|
+
*/
|
18
|
+
defaultValue?: TernaryDarkMode
|
19
|
+
/**
|
20
|
+
* The key for storing dark mode preference in local storage.
|
21
|
+
* @default 'usehooks-ts-ternary-dark-mode'
|
22
|
+
*/
|
23
|
+
localStorageKey?: string
|
24
|
+
/**
|
25
|
+
* If `true` (default), the hook will initialize reading `localStorage`. In SSR, you should set it to `false`, returning default values initially.
|
26
|
+
* @default true
|
27
|
+
*/
|
28
|
+
initializeWithValue?: boolean
|
29
|
+
}
|
30
|
+
|
31
|
+
/** Represents the return type of the `useTernaryDarkMode` hook. */
|
32
|
+
export type TernaryDarkModeReturn = {
|
33
|
+
/** The current state of the dark mode. */
|
34
|
+
isDarkMode: boolean
|
35
|
+
/** The current state of the dark mode. */
|
36
|
+
ternaryDarkMode: TernaryDarkMode
|
37
|
+
/** A function to set the dark mode state. */
|
38
|
+
setTernaryDarkMode: Dispatch<SetStateAction<TernaryDarkMode>>
|
39
|
+
/** A function to toggle the dark mode state. */
|
40
|
+
toggleTernaryDarkMode: () => void
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Custom hook that manages ternary (system, dark, light) dark mode with local storage support.
|
45
|
+
* @param {?TernaryDarkModeOptions | string} [options] - Options or the local storage key for the hook.
|
46
|
+
* @returns {TernaryDarkModeReturn} An object containing the dark mode state and helper functions.
|
47
|
+
* @public
|
48
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-ternary-dark-mode)
|
49
|
+
* @example
|
50
|
+
* ```tsx
|
51
|
+
* const { isDarkMode, ternaryDarkMode, setTernaryDarkMode, toggleTernaryDarkMode } = useTernaryDarkMode({ defaultValue: 'dark' });
|
52
|
+
* // Access and use the dark mode state and provided helper functions.
|
53
|
+
* ```
|
54
|
+
*/
|
55
|
+
export function useTernaryDarkMode({
|
56
|
+
defaultValue = 'system',
|
57
|
+
localStorageKey = LOCAL_STORAGE_KEY,
|
58
|
+
initializeWithValue = true,
|
59
|
+
}: TernaryDarkModeOptions = {}): TernaryDarkModeReturn {
|
60
|
+
const isDarkOS = useMediaQuery(COLOR_SCHEME_QUERY, { initializeWithValue })
|
61
|
+
const [mode, setMode] = useLocalStorage(localStorageKey, defaultValue, {
|
62
|
+
initializeWithValue,
|
63
|
+
})
|
64
|
+
|
65
|
+
const isDarkMode = mode === 'dark' || (mode === 'system' && isDarkOS)
|
66
|
+
|
67
|
+
const toggleTernaryDarkMode = () => {
|
68
|
+
const modes: TernaryDarkMode[] = ['light', 'system', 'dark']
|
69
|
+
setMode((prevMode): TernaryDarkMode => {
|
70
|
+
const nextIndex = (modes.indexOf(prevMode) + 1) % modes.length
|
71
|
+
return modes[nextIndex]
|
72
|
+
})
|
73
|
+
}
|
74
|
+
|
75
|
+
return {
|
76
|
+
isDarkMode,
|
77
|
+
ternaryDarkMode: mode,
|
78
|
+
setTernaryDarkMode: setMode,
|
79
|
+
toggleTernaryDarkMode,
|
80
|
+
}
|
81
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useTimeout'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
2
|
+
|
3
|
+
import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Custom hook that handles timeouts in React components using the [`setTimeout API`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout).
|
7
|
+
* @param {() => void} callback - The function to be executed when the timeout elapses.
|
8
|
+
* @param {number | null} delay - The duration (in milliseconds) for the timeout. Set to `null` to clear the timeout.
|
9
|
+
* @returns {void} This hook does not return anything.
|
10
|
+
* @public
|
11
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-timeout)
|
12
|
+
* @example
|
13
|
+
* ```tsx
|
14
|
+
* // Usage of useTimeout hook
|
15
|
+
* useTimeout(() => {
|
16
|
+
* // Code to be executed after the specified delay
|
17
|
+
* }, 1000); // Set a timeout of 1000 milliseconds (1 second)
|
18
|
+
* ```
|
19
|
+
*/
|
20
|
+
export function useTimeout(callback: () => void, delay: number | null): void {
|
21
|
+
const savedCallback = useRef(callback)
|
22
|
+
|
23
|
+
// Remember the latest callback if it changes.
|
24
|
+
useIsomorphicLayoutEffect(() => {
|
25
|
+
savedCallback.current = callback
|
26
|
+
}, [callback])
|
27
|
+
|
28
|
+
// Set up the timeout.
|
29
|
+
useEffect(() => {
|
30
|
+
// Don't schedule if no delay is specified.
|
31
|
+
// Note: 0 is a valid value for delay.
|
32
|
+
if (!delay && delay !== 0) {
|
33
|
+
return
|
34
|
+
}
|
35
|
+
|
36
|
+
const id = setTimeout(() => {
|
37
|
+
savedCallback.current()
|
38
|
+
}, delay)
|
39
|
+
|
40
|
+
return () => {
|
41
|
+
clearTimeout(id)
|
42
|
+
}
|
43
|
+
}, [delay])
|
44
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useToggle'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { useCallback, useState } from 'react'
|
2
|
+
|
3
|
+
import type { Dispatch, SetStateAction } from 'react'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Custom hook that manages a boolean toggle state in React components.
|
7
|
+
* @param {boolean} [defaultValue] - The initial value for the toggle state.
|
8
|
+
* @returns {[boolean, () => void, Dispatch<SetStateAction<boolean>>]} A tuple containing the current state,
|
9
|
+
* a function to toggle the state, and a function to set the state explicitly.
|
10
|
+
* @public
|
11
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-toggle)
|
12
|
+
* @example
|
13
|
+
* ```tsx
|
14
|
+
* const [isToggled, toggle, setToggle] = useToggle(); // Initial value is false
|
15
|
+
* // OR
|
16
|
+
* const [isToggled, toggle, setToggle] = useToggle(true); // Initial value is true
|
17
|
+
* // Use isToggled in your component, toggle to switch the state, setToggle to set the state explicitly.
|
18
|
+
* ```
|
19
|
+
*/
|
20
|
+
export function useToggle(
|
21
|
+
defaultValue?: boolean,
|
22
|
+
): [boolean, () => void, Dispatch<SetStateAction<boolean>>] {
|
23
|
+
const [value, setValue] = useState(!!defaultValue)
|
24
|
+
|
25
|
+
const toggle = useCallback(() => {
|
26
|
+
setValue(x => !x)
|
27
|
+
}, [])
|
28
|
+
|
29
|
+
return [value, toggle, setValue]
|
30
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useUnmount'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Custom hook that runs a cleanup function when the component is unmounted.
|
5
|
+
* @param {() => void} func - The cleanup function to be executed on unmount.
|
6
|
+
* @public
|
7
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-unmount)
|
8
|
+
* @example
|
9
|
+
* ```tsx
|
10
|
+
* useUnmount(() => {
|
11
|
+
* // Cleanup logic here
|
12
|
+
* });
|
13
|
+
* ```
|
14
|
+
*/
|
15
|
+
export function useUnmount(func: () => void) {
|
16
|
+
const funcRef = useRef(func)
|
17
|
+
|
18
|
+
funcRef.current = func
|
19
|
+
|
20
|
+
useEffect(
|
21
|
+
() => () => {
|
22
|
+
funcRef.current()
|
23
|
+
},
|
24
|
+
[],
|
25
|
+
)
|
26
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useWindowSize'
|