@flikk/ui 1.0.0-beta.22 → 1.0.0-beta.24
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/dist/components/ai/PromptInput/PromptInput.js +139 -7
- package/dist/components/ai/PromptInput/VoiceRecorder.js +84 -0
- package/dist/components/charts/AreaChart/AreaChart.types.d.ts +2 -2
- package/dist/components/charts/BarChart/BarChart.types.d.ts +2 -2
- package/dist/components/charts/ComboChart/ComboChart.types.d.ts +2 -2
- package/dist/components/charts/LineChart/LineChart.types.d.ts +2 -2
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.d.ts +2 -2
- package/dist/components/charts/StackedBarChart/StackedBarChart.types.d.ts +2 -2
- package/dist/components/core/Accordion/AccordionTrigger.js +28 -1
- package/dist/components/core/Alert/Alert.js +2 -1
- package/dist/components/core/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/core/Badge/Badge.js +6 -17
- package/dist/components/core/Breadcrumbs/Breadcrumbs.js +17 -28
- package/dist/components/core/Calendar/Calendar.js +1 -1
- package/dist/components/core/Carousel/CarouselBody.js +6 -1
- package/dist/components/core/ContextMenu/ContextMenuBody.js +6 -3
- package/dist/components/core/ContextMenu/ContextMenuSubBody.js +6 -3
- package/dist/components/core/DragDrop/DragDrop.js +170 -17
- package/dist/components/core/DragDrop/DragDrop.types.d.ts +6 -0
- package/dist/components/core/Drawer/Drawer.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.js +2 -0
- package/dist/components/core/Drawer/Drawer.types.d.ts +2 -0
- package/dist/components/core/Drawer/DrawerTitle.d.ts +1 -1
- package/dist/components/core/Drawer/DrawerTitle.js +2 -2
- package/dist/components/core/Dropdown/DropdownMenu.js +2 -30
- package/dist/components/core/Masonry/Masonry.js +7 -2
- package/dist/components/core/Modal/Modal.d.ts +1 -1
- package/dist/components/core/Modal/Modal.js +3 -3
- package/dist/components/core/Modal/Modal.types.d.ts +2 -0
- package/dist/components/core/Modal/ModalTitle.d.ts +1 -1
- package/dist/components/core/Modal/ModalTitle.js +2 -2
- package/dist/components/core/NavItem/NavItem.js +21 -6
- package/dist/components/core/NavItem/NavItem.theme.js +2 -2
- package/dist/components/core/Pagination/Pagination.js +1 -1
- package/dist/components/core/Popover/PopoverBody.js +3 -27
- package/dist/components/core/Popover/PopoverTrigger.js +1 -1
- package/dist/components/core/Progress/Progress.js +4 -4
- package/dist/components/core/Rating/Rating.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.js +3 -2
- package/dist/components/core/Segmented/Segmented.js +6 -6
- package/dist/components/core/Segmented/SegmentedItem.js +28 -2
- package/dist/components/core/Sidebar/Sidebar.d.ts +1 -0
- package/dist/components/core/Sidebar/Sidebar.js +5 -3
- package/dist/components/core/Sidebar/Sidebar.types.d.ts +7 -1
- package/dist/components/core/Sidebar/SidebarContent.js +1 -1
- package/dist/components/core/Sidebar/SidebarFooter.js +1 -1
- package/dist/components/core/Sidebar/SidebarHeader.js +5 -2
- package/dist/components/core/Sidebar/SidebarLogo.d.ts +3 -0
- package/dist/components/core/Sidebar/SidebarLogo.js +17 -0
- package/dist/components/core/Sidebar/SidebarNavGroup.js +2 -1
- package/dist/components/core/Sidebar/SidebarToggle.js +2 -4
- package/dist/components/core/Sidebar/SidebarUserProfile.js +3 -6
- package/dist/components/core/Sidebar/index.d.ts +2 -1
- package/dist/components/core/Skeleton/Skeleton.js +2 -2
- package/dist/components/core/Sortable/Sortable.d.ts +1 -1
- package/dist/components/core/Sortable/Sortable.js +20 -4
- package/dist/components/core/Sortable/Sortable.types.d.ts +2 -0
- package/dist/components/core/Tabs/Tabs.js +6 -4
- package/dist/components/core/Tabs/Tabs.types.d.ts +2 -0
- package/dist/components/core/Tabs/TabsBody.js +3 -3
- package/dist/components/core/Tabs/TabsList.js +19 -21
- package/dist/components/core/Tabs/TabsTrigger.js +47 -28
- package/dist/components/core/Toast/Toast.js +1 -1
- package/dist/components/core/Toast/ToastProvider.js +3 -2
- package/dist/components/core/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.js +26 -35
- package/dist/components/core/Tooltip/Tooltip.types.d.ts +5 -1
- package/dist/components/core/Tree/Tree.js +178 -8
- package/dist/components/core/index.js +1 -0
- package/dist/components/data-display/GanttChart/GanttSplitter.js +15 -1
- package/dist/components/data-display/Table/Table.js +2 -2
- package/dist/components/data-display/Table/Table.types.d.ts +2 -0
- package/dist/components/data-display/Table/TableFilter.js +21 -18
- package/dist/components/effects/CustomCursor/CustomCursor.js +3 -7
- package/dist/components/effects/Overlay/Overlay.js +4 -9
- package/dist/components/effects/PageTransition/PageTransition.js +17 -6
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.js +3 -4
- package/dist/components/forms/Checkbox/Checkbox.js +11 -1
- package/dist/components/forms/Checkbox/Checkbox.theme.js +4 -1
- package/dist/components/forms/Checkbox/Checkbox.types.d.ts +7 -5
- package/dist/components/forms/Checkbox/CheckboxGroup.js +9 -4
- package/dist/components/forms/ColorPicker/ColorPicker.js +7 -4
- package/dist/components/forms/ColorPicker/ColorPicker.types.d.ts +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerBody.js +5 -3
- package/dist/components/forms/ColorPicker/ColorPickerEyeDropper.js +3 -3
- package/dist/components/forms/ColorPicker/ColorPickerGradient.js +8 -8
- package/dist/components/forms/ColorPicker/ColorPickerInput.js +1 -1
- package/dist/components/forms/ColorPicker/index.d.ts +1 -1
- package/dist/components/forms/Combobox/Combobox.js +20 -45
- package/dist/components/forms/Combobox/Combobox.types.d.ts +4 -2
- package/dist/components/forms/CronInput/CronInput.js +10 -4
- package/dist/components/forms/CronInput/CronInput.types.d.ts +12 -1
- package/dist/components/forms/DatePicker/DatePicker.js +2 -2
- package/dist/components/forms/DatePicker/DatePicker.types.d.ts +4 -2
- package/dist/components/forms/DatePicker/DatePickerBody.js +1 -29
- package/dist/components/forms/DatePicker/DatePickerTrigger.js +2 -2
- package/dist/components/forms/DateRangePicker/DateRangePicker.js +3 -3
- package/dist/components/forms/DateRangePicker/DateRangePicker.types.d.ts +4 -2
- package/dist/components/forms/DateRangePicker/DateRangePickerBody.js +1 -28
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.js +2 -2
- package/dist/components/forms/FileUpload/FileUpload.js +99 -10
- package/dist/components/forms/FileUpload/FileUpload.types.d.ts +15 -0
- package/dist/components/forms/FormLabel/FormLabel.js +2 -2
- package/dist/components/forms/Input/Input.js +5 -3
- package/dist/components/forms/Input/Input.types.d.ts +2 -0
- package/dist/components/forms/InputAddress/InputAddress.d.ts +1 -1
- package/dist/components/forms/InputAddress/InputAddress.js +8 -9
- package/dist/components/forms/InputCounter/InputCounter.js +25 -18
- package/dist/components/forms/InputCounter/InputCounter.types.d.ts +8 -1
- package/dist/components/forms/InputCreditCard/InputCreditCard.d.ts +1 -1
- package/dist/components/forms/InputCreditCard/InputCreditCard.js +27 -9
- package/dist/components/forms/InputCreditCard/InputCreditCard.types.d.ts +5 -0
- package/dist/components/forms/InputOTP/InputOTP.js +26 -17
- package/dist/components/forms/InputOTP/InputOTP.types.d.ts +21 -4
- package/dist/components/forms/InputTag/InputTag.js +12 -39
- package/dist/components/forms/InputTag/InputTag.types.d.ts +2 -2
- package/dist/components/forms/Mention/Mention.js +13 -6
- package/dist/components/forms/Mention/Mention.types.d.ts +9 -0
- package/dist/components/forms/Radio/Radio.js +12 -2
- package/dist/components/forms/Radio/Radio.theme.js +5 -1
- package/dist/components/forms/Radio/Radio.types.d.ts +7 -5
- package/dist/components/forms/Radio/RadioGroup.js +8 -3
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +21 -21
- package/dist/components/forms/RichTextEditor/RichTextEditor.types.d.ts +2 -2
- package/dist/components/forms/Select/Select.d.ts +2 -0
- package/dist/components/forms/Select/Select.js +26 -56
- package/dist/components/forms/Select/Select.types.d.ts +14 -0
- package/dist/components/forms/Signature/Signature.js +1 -1
- package/dist/components/forms/Signature/Signature.types.d.ts +3 -3
- package/dist/components/forms/Slider/Slider.js +18 -4
- package/dist/components/forms/Slider/Slider.types.d.ts +2 -2
- package/dist/components/forms/Switch/Switch.js +12 -19
- package/dist/components/forms/Switch/Switch.theme.js +12 -2
- package/dist/components/forms/Switch/Switch.types.d.ts +20 -2
- package/dist/components/forms/Textarea/Textarea.js +8 -3
- package/dist/components/forms/Textarea/Textarea.types.d.ts +2 -0
- package/dist/components/forms/TimePicker/TimePicker.js +1 -1
- package/dist/components/forms/TimePicker/TimePicker.types.d.ts +6 -2
- package/dist/components/forms/TimePicker/TimePickerContent.js +88 -30
- package/dist/components/forms/TimePicker/TimePickerTrigger.js +2 -2
- package/dist/components/forms/index.js +86 -1
- package/dist/components/layout/FormLayout/FormLayout.js +87 -1
- package/dist/components/layout/index.js +4 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useClickOutside.d.ts +10 -4
- package/dist/hooks/useClickOutside.js +44 -24
- package/dist/hooks/useDarkMode.d.ts +1 -0
- package/dist/hooks/useDarkMode.js +42 -0
- package/dist/hooks/useFormStateMachine.d.ts +1 -1
- package/dist/hooks/useNetworkStatus.js +1 -1
- package/dist/hooks/useOverlay.js +4 -0
- package/dist/hooks/useScaleBackground.js +5 -2
- package/dist/hooks/useSelectPortal.js +14 -5
- package/dist/index.d.ts +0 -2
- package/dist/index.js +174 -223
- package/dist/shadcn-compat.css +80 -0
- package/dist/styles.css +1 -1
- package/dist/utils/stateMachine.d.ts +4 -4
- package/package.json +12 -10
- package/tailwind.preset.cjs +32 -3
- /package/{src/theme-plugin.css → dist/theme.css} +0 -0
|
@@ -1,42 +1,100 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useContext, useCallback
|
|
2
|
+
import { useContext, useCallback } from 'react';
|
|
3
3
|
import { AnimatePresence, motion } from 'motion/react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { cn } from '../../../utils/cn.js';
|
|
6
6
|
import { TimePickerContext } from './TimePicker.js';
|
|
7
7
|
import { useSelectPortal } from '../../../hooks/useSelectPortal.js';
|
|
8
8
|
import { createDropdownAnimations } from '../Select/Select.animations.js';
|
|
9
|
-
import
|
|
9
|
+
import '../../core/Accordion/Accordion.js';
|
|
10
|
+
import '../../core/AlertDialog/AlertDialog.js';
|
|
11
|
+
import '../../core/AspectRatio/AspectRatio.js';
|
|
12
|
+
import '../../core/Avatar/Avatar.js';
|
|
13
|
+
import '../../core/AvatarGroup/AvatarGroup.js';
|
|
14
|
+
import '../../core/Badge/Badge.js';
|
|
15
|
+
import '../../core/Breadcrumbs/Breadcrumbs.js';
|
|
16
|
+
import '../../core/Breadcrumbs/Breadcrumbs.theme.js';
|
|
10
17
|
import { Button } from '../../core/Button/Button.js';
|
|
18
|
+
import '../../core/ButtonGroup/ButtonGroup.js';
|
|
19
|
+
import '../../core/ButtonGroup/ButtonGroupSeparator.js';
|
|
20
|
+
import '../../core/ButtonGroup/ButtonGroupText.js';
|
|
21
|
+
import '../../core/Calendar/Calendar.js';
|
|
22
|
+
import '../../core/Calendar/CalendarMini/CalendarMini.js';
|
|
23
|
+
import '../../core/Card/Card.js';
|
|
24
|
+
import '../../core/CardStack/CardStack.js';
|
|
25
|
+
import '../../core/Carousel/Carousel.js';
|
|
26
|
+
import '../../core/Carousel/CarouselBody.js';
|
|
27
|
+
import '../../core/CommandPalette/CommandPalette.js';
|
|
28
|
+
import '../../core/Separator/Separator.js';
|
|
29
|
+
import '../../core/Drawer/Drawer.js';
|
|
30
|
+
import '../../core/Drawer/DrawerBody.js';
|
|
31
|
+
import '../../core/Dropdown/Dropdown.js';
|
|
32
|
+
import '../../core/Dropdown/DropdownTrigger.js';
|
|
33
|
+
import '../../core/Dropdown/DropdownMenu.js';
|
|
34
|
+
import '../../core/Dropdown/DropdownItem.js';
|
|
35
|
+
import '../../core/Dropdown/DropdownSection.js';
|
|
36
|
+
import '../../core/Dropdown/DropdownSeparator.js';
|
|
37
|
+
import '../../core/Dropdown/Dropdown.theme.js';
|
|
38
|
+
import '../../core/Kbd/Kbd.js';
|
|
39
|
+
import '../../core/MenuItem/MenuItem.js';
|
|
40
|
+
import '../../core/Link/Link.js';
|
|
41
|
+
import '../../core/Modal/Modal.js';
|
|
42
|
+
import '../../core/ModalStack/ModalStack.js';
|
|
43
|
+
import '../../core/PageHeading/PageHeading.js';
|
|
44
|
+
import '../../core/Pagination/Pagination.js';
|
|
45
|
+
import '../../core/Popover/Popover.js';
|
|
46
|
+
import '../../core/Popover/PopoverContext.js';
|
|
47
|
+
import '../../core/Popover/PopoverBody.js';
|
|
48
|
+
import '../../core/Progress/Progress.js';
|
|
49
|
+
import '../../core/Rating/Rating.js';
|
|
50
|
+
import '../../core/ScrollArea/ScrollArea.js';
|
|
51
|
+
import '../../core/ScrollArea/smooth/SmoothScrollEngine.js';
|
|
52
|
+
import '../../core/Segmented/Segmented.js';
|
|
53
|
+
import '../../core/Skeleton/Skeleton.js';
|
|
54
|
+
import '../../core/SlidingNumber/SlidingNumber.js';
|
|
55
|
+
import '../../core/Tabs/Tabs.js';
|
|
56
|
+
import '../../core/Tabs/TabsList.js';
|
|
57
|
+
import '../../core/Tabs/TabsTrigger.js';
|
|
58
|
+
import '../../core/Tabs/TabsBody.js';
|
|
59
|
+
import '../../core/Tabs/TabsContext.js';
|
|
60
|
+
import '../../core/Tooltip/Tooltip.js';
|
|
61
|
+
import '../../core/Tooltip/Tooltip.animations.js';
|
|
62
|
+
import '../../core/Tree/Tree.js';
|
|
63
|
+
import '../../core/Tag/Tag.js';
|
|
64
|
+
import '../../core/Alert/Alert.js';
|
|
65
|
+
import '../../core/Toast/Toast.js';
|
|
66
|
+
import '../../core/Toast/ToastProvider.js';
|
|
67
|
+
import '@heroicons/react/24/solid';
|
|
68
|
+
import '../../core/Spinner/Spinner.js';
|
|
69
|
+
import '../../core/Message/Message.js';
|
|
70
|
+
import '../../core/Message/TypeWriter.js';
|
|
71
|
+
import '../../core/Message/MessageBody.js';
|
|
72
|
+
import '@heroicons/react/16/solid';
|
|
73
|
+
import '@heroicons/react/24/outline';
|
|
74
|
+
import '../../core/Empty/Empty.js';
|
|
75
|
+
import '../../core/Masonry/Masonry.js';
|
|
76
|
+
import '../../core/DragDrop/DragDrop.js';
|
|
77
|
+
import '../../core/Sortable/Sortable.js';
|
|
78
|
+
import '../../core/NavItem/NavItem.js';
|
|
79
|
+
import '../../core/Sidebar/Sidebar.js';
|
|
80
|
+
import '../../core/Sidebar/SidebarHeader.js';
|
|
81
|
+
import '../../core/Sidebar/SidebarContent.js';
|
|
82
|
+
import '../../core/Sidebar/SidebarFooter.js';
|
|
83
|
+
import '../../core/Sidebar/SidebarNav.js';
|
|
84
|
+
import '../../core/Sidebar/SidebarNavGroup.js';
|
|
85
|
+
import '../../core/Sidebar/SidebarToggle.js';
|
|
86
|
+
import '../../core/Sidebar/SidebarMobileTrigger.js';
|
|
87
|
+
import '../../core/Sidebar/SidebarUserProfile.js';
|
|
88
|
+
import '../../core/Sidebar/SidebarLogo.js';
|
|
89
|
+
import '../../core/Sidebar/SidebarContext.js';
|
|
90
|
+
import '../../core/OfflineIndicator/OfflineIndicator.js';
|
|
91
|
+
import '../../core/ContextMenu/ContextMenu.js';
|
|
92
|
+
import '../../core/ContextMenu/ContextMenu.theme.js';
|
|
93
|
+
import '../../core/Pill/Pill.js';
|
|
94
|
+
import '../../core/Icon/Icon.js';
|
|
95
|
+
import { useIsClient } from '../../../hooks/useIsClient.js';
|
|
96
|
+
import { useDarkMode } from '../../../hooks/useDarkMode.js';
|
|
11
97
|
|
|
12
|
-
/**
|
|
13
|
-
* Hook to detect dark mode state from document
|
|
14
|
-
*/
|
|
15
|
-
const useDarkMode = () => {
|
|
16
|
-
const [isDark, setIsDark] = useState(false);
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (typeof document === "undefined")
|
|
19
|
-
return;
|
|
20
|
-
const checkDarkMode = () => {
|
|
21
|
-
const hasDarkClass = document.documentElement.classList.contains("dark") ||
|
|
22
|
-
document.body.classList.contains("dark") ||
|
|
23
|
-
document.querySelector(".dark") !== null;
|
|
24
|
-
setIsDark(hasDarkClass);
|
|
25
|
-
};
|
|
26
|
-
checkDarkMode();
|
|
27
|
-
const observer = new MutationObserver(checkDarkMode);
|
|
28
|
-
observer.observe(document.documentElement, {
|
|
29
|
-
attributes: true,
|
|
30
|
-
attributeFilter: ["class"],
|
|
31
|
-
});
|
|
32
|
-
observer.observe(document.body, {
|
|
33
|
-
attributes: true,
|
|
34
|
-
attributeFilter: ["class"],
|
|
35
|
-
});
|
|
36
|
-
return () => observer.disconnect();
|
|
37
|
-
}, []);
|
|
38
|
-
return isDark;
|
|
39
|
-
};
|
|
40
98
|
/**
|
|
41
99
|
* TimePickerContent Component - contains the time selector dropdown
|
|
42
100
|
* Uses portal positioning like Select and DatePicker components
|
|
@@ -9,7 +9,7 @@ import { TimePickerContext } from './TimePicker.js';
|
|
|
9
9
|
* Displays a masked time input that opens the wheel picker on focus
|
|
10
10
|
* Follows the same visual pattern as DatePickerTrigger and SelectButton
|
|
11
11
|
*/
|
|
12
|
-
const TimePickerTrigger = ({ id, disabled, isOpen, state = 'default', size = 'md', clearable, onClear, iconStart, iconEnd, className, inputValue, onInputChange, onInputFocus, onInputKeyDown, format, period, onPeriodToggle, placeholder, }) => {
|
|
12
|
+
const TimePickerTrigger = ({ id, disabled, isOpen, state = 'default', size = 'md', clearable, onClear, iconStart, iconEnd, className, inputValue, onInputChange, onInputFocus, onInputKeyDown, format, period, onPeriodToggle, placeholder, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedby, }) => {
|
|
13
13
|
var _a, _b, _c, _d;
|
|
14
14
|
const context = useContext(TimePickerContext);
|
|
15
15
|
if (!context) {
|
|
@@ -31,7 +31,7 @@ const TimePickerTrigger = ({ id, disabled, isOpen, state = 'default', size = 'md
|
|
|
31
31
|
const hasStartIcon = iconStart !== undefined ? Boolean(iconStart) : true;
|
|
32
32
|
const iconStartPadding = theme.iconStartPadding || "";
|
|
33
33
|
return (jsx("div", { ref: triggerRef, className: "relative w-full", children: jsxs("div", { className: cn(baseStyle, stateStyle, hoverStateStyle, activeFocusState, 'w-full items-center', className // User overrides take highest precedence
|
|
34
|
-
), children: [jsxs("div", { className: "relative flex-1", children: [jsx("input", { ref: inputRef, id: id, type: "text", inputMode: "numeric", value: inputValue, onChange: (e) => onInputChange(e.target.value), onFocus: onInputFocus, onKeyDown: onInputKeyDown, placeholder: placeholder, maxLength: 5, disabled: disabled, className: cn(inputStyle, sizeStyle, hasStartIcon && iconStartPadding), "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-label": "Enter time", autoComplete: "off" }), iconStart !== undefined ? (iconStart && jsx("div", { className: iconStartStyle, children: iconStart })) : (jsx("div", { className: iconStartStyle, children: jsx(ClockIcon, { className: "h-4 w-4" }) }))] }), format === '12h' && (jsx("button", { type: "button", onClick: onPeriodToggle, disabled: disabled, className: cn(periodToggleStyle, "shrink-0"), "aria-label": `Toggle AM/PM, current: ${period}`, tabIndex: -1, children: period || 'AM' })), clearable && hasValue && !disabled && (jsx("button", { type: "button", onClick: (e) => {
|
|
34
|
+
), children: [jsxs("div", { className: "relative flex-1", children: [jsx("input", { ref: inputRef, id: id, type: "text", inputMode: "numeric", value: inputValue, onChange: (e) => onInputChange(e.target.value), onFocus: onInputFocus, onKeyDown: onInputKeyDown, placeholder: placeholder, maxLength: 5, disabled: disabled, className: cn(inputStyle, sizeStyle, hasStartIcon && iconStartPadding), "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-label": "Enter time", "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, autoComplete: "off" }), iconStart !== undefined ? (iconStart && jsx("div", { className: iconStartStyle, children: iconStart })) : (jsx("div", { className: iconStartStyle, children: jsx(ClockIcon, { className: "h-4 w-4" }) }))] }), format === '12h' && (jsx("button", { type: "button", onClick: onPeriodToggle, disabled: disabled, className: cn(periodToggleStyle, "shrink-0"), "aria-label": `Toggle AM/PM, current: ${period}`, tabIndex: -1, children: period || 'AM' })), clearable && hasValue && !disabled && (jsx("button", { type: "button", onClick: (e) => {
|
|
35
35
|
e.stopPropagation();
|
|
36
36
|
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
37
37
|
}, className: "shrink-0 p-0.5 rounded text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-background-secondary)] transition-colors", "aria-label": "Clear time", tabIndex: -1, children: jsx(XMarkIcon, { className: "w-4 h-4" }) })), iconEnd !== undefined ? (iconEnd && (jsx("span", { className: "shrink-0 flex items-center pr-3 pointer-events-none text-[var(--color-text-muted)] dark:text-[var(--color-neutral-500)]", children: iconEnd }))) : (jsx("span", { className: "shrink-0 flex items-center pr-3 pointer-events-none text-[var(--color-text-muted)] dark:text-[var(--color-neutral-500)]", children: jsx(ChevronUpDownIcon, { className: "h-4 w-4" }) }))] }) }));
|
|
@@ -29,6 +29,91 @@ import 'clsx';
|
|
|
29
29
|
import 'tailwind-merge';
|
|
30
30
|
import 'motion/react';
|
|
31
31
|
import 'react-dom';
|
|
32
|
+
import '../core/Accordion/Accordion.js';
|
|
33
|
+
import '../core/AlertDialog/AlertDialog.js';
|
|
34
|
+
import '../core/AspectRatio/AspectRatio.js';
|
|
35
|
+
import '../core/Avatar/Avatar.js';
|
|
36
|
+
import '../core/AvatarGroup/AvatarGroup.js';
|
|
37
|
+
import '../core/Badge/Badge.js';
|
|
38
|
+
import '../core/Breadcrumbs/Breadcrumbs.js';
|
|
39
|
+
import '../core/Breadcrumbs/Breadcrumbs.theme.js';
|
|
40
|
+
import '../core/Button/Button.js';
|
|
41
|
+
import '../core/ButtonGroup/ButtonGroup.js';
|
|
42
|
+
import '../core/ButtonGroup/ButtonGroupSeparator.js';
|
|
43
|
+
import '../core/ButtonGroup/ButtonGroupText.js';
|
|
44
|
+
import '../core/Calendar/Calendar.js';
|
|
45
|
+
import '../core/Calendar/CalendarMini/CalendarMini.js';
|
|
46
|
+
import '../core/Card/Card.js';
|
|
47
|
+
import '../core/CardStack/CardStack.js';
|
|
48
|
+
import '../core/Carousel/Carousel.js';
|
|
49
|
+
import '../core/Carousel/CarouselBody.js';
|
|
50
|
+
import '../core/CommandPalette/CommandPalette.js';
|
|
51
|
+
import '../core/Separator/Separator.js';
|
|
52
|
+
import '../core/Drawer/Drawer.js';
|
|
53
|
+
import '../core/Drawer/DrawerBody.js';
|
|
54
|
+
import '../core/Dropdown/Dropdown.js';
|
|
55
|
+
import '../core/Dropdown/DropdownTrigger.js';
|
|
56
|
+
import '../core/Dropdown/DropdownMenu.js';
|
|
57
|
+
import '../core/Dropdown/DropdownItem.js';
|
|
58
|
+
import '../core/Dropdown/DropdownSection.js';
|
|
59
|
+
import '../core/Dropdown/DropdownSeparator.js';
|
|
60
|
+
import '../core/Dropdown/Dropdown.theme.js';
|
|
61
|
+
import '../core/Kbd/Kbd.js';
|
|
62
|
+
import '../core/MenuItem/MenuItem.js';
|
|
63
|
+
import '../core/Link/Link.js';
|
|
64
|
+
import '../core/Modal/Modal.js';
|
|
65
|
+
import '../core/ModalStack/ModalStack.js';
|
|
66
|
+
import '../core/PageHeading/PageHeading.js';
|
|
67
|
+
import '../core/Pagination/Pagination.js';
|
|
68
|
+
import '../core/Popover/Popover.js';
|
|
69
|
+
import '../core/Popover/PopoverContext.js';
|
|
70
|
+
import '../core/Popover/PopoverBody.js';
|
|
71
|
+
import '../core/Progress/Progress.js';
|
|
72
|
+
import '../core/Rating/Rating.js';
|
|
73
|
+
import '../core/ScrollArea/ScrollArea.js';
|
|
74
|
+
import '../core/ScrollArea/smooth/SmoothScrollEngine.js';
|
|
75
|
+
import '../core/Segmented/Segmented.js';
|
|
76
|
+
import '../core/Skeleton/Skeleton.js';
|
|
77
|
+
import '../core/SlidingNumber/SlidingNumber.js';
|
|
78
|
+
import '../core/Tabs/Tabs.js';
|
|
79
|
+
import '../core/Tabs/TabsList.js';
|
|
80
|
+
import '../core/Tabs/TabsTrigger.js';
|
|
81
|
+
import '../core/Tabs/TabsBody.js';
|
|
82
|
+
import '../core/Tabs/TabsContext.js';
|
|
83
|
+
import '../core/Tooltip/Tooltip.js';
|
|
84
|
+
import '../core/Tooltip/Tooltip.animations.js';
|
|
85
|
+
import '../core/Tree/Tree.js';
|
|
86
|
+
import '../core/Tag/Tag.js';
|
|
87
|
+
import '../core/Alert/Alert.js';
|
|
88
|
+
import '../core/Toast/Toast.js';
|
|
89
|
+
import '../core/Toast/ToastProvider.js';
|
|
90
|
+
import '@heroicons/react/24/solid';
|
|
91
|
+
import '../core/Spinner/Spinner.js';
|
|
92
|
+
import '../core/Message/Message.js';
|
|
93
|
+
import '../core/Message/TypeWriter.js';
|
|
94
|
+
import '../core/Message/MessageBody.js';
|
|
95
|
+
import '@heroicons/react/16/solid';
|
|
96
|
+
import '../core/Empty/Empty.js';
|
|
97
|
+
import '../core/Masonry/Masonry.js';
|
|
98
|
+
import '../core/DragDrop/DragDrop.js';
|
|
99
|
+
import '../core/Sortable/Sortable.js';
|
|
100
|
+
import '../core/NavItem/NavItem.js';
|
|
101
|
+
import '../core/Sidebar/Sidebar.js';
|
|
102
|
+
import '../core/Sidebar/SidebarHeader.js';
|
|
103
|
+
import '../core/Sidebar/SidebarContent.js';
|
|
104
|
+
import '../core/Sidebar/SidebarFooter.js';
|
|
105
|
+
import '../core/Sidebar/SidebarNav.js';
|
|
106
|
+
import '../core/Sidebar/SidebarNavGroup.js';
|
|
107
|
+
import '../core/Sidebar/SidebarToggle.js';
|
|
108
|
+
import '../core/Sidebar/SidebarMobileTrigger.js';
|
|
109
|
+
import '../core/Sidebar/SidebarUserProfile.js';
|
|
110
|
+
import '../core/Sidebar/SidebarLogo.js';
|
|
111
|
+
import '../core/Sidebar/SidebarContext.js';
|
|
112
|
+
import '../core/OfflineIndicator/OfflineIndicator.js';
|
|
113
|
+
import '../core/ContextMenu/ContextMenu.js';
|
|
114
|
+
import '../core/ContextMenu/ContextMenu.theme.js';
|
|
115
|
+
import '../core/Pill/Pill.js';
|
|
116
|
+
import '../core/Icon/Icon.js';
|
|
32
117
|
import './TimePicker/WheelColumn.js';
|
|
33
118
|
export { timePickerTheme } from './TimePicker/TimePicker.theme.js';
|
|
34
119
|
export { Slider } from './Slider/Slider.js';
|
|
@@ -53,7 +138,7 @@ export { inputTagTheme } from './InputTag/InputTag.theme.js';
|
|
|
53
138
|
export { Combobox } from './Combobox/Combobox.js';
|
|
54
139
|
export { comboboxTheme } from './Combobox/Combobox.theme.js';
|
|
55
140
|
export { ColorPicker } from './ColorPicker/ColorPicker.js';
|
|
56
|
-
export {
|
|
141
|
+
export { useColorPicker } from './ColorPicker/ColorPickerContext.js';
|
|
57
142
|
export { ColorPickerTrigger } from './ColorPicker/ColorPickerTrigger.js';
|
|
58
143
|
export { ColorPickerBody } from './ColorPicker/ColorPickerBody.js';
|
|
59
144
|
export { ColorPicker2DCanvas } from './ColorPicker/ColorPicker2DCanvas.js';
|
|
@@ -1,10 +1,96 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import '../../core/Accordion/Accordion.js';
|
|
5
|
+
import '../../core/AlertDialog/AlertDialog.js';
|
|
6
|
+
import '../../core/AspectRatio/AspectRatio.js';
|
|
7
|
+
import '../../core/Avatar/Avatar.js';
|
|
8
|
+
import '../../core/AvatarGroup/AvatarGroup.js';
|
|
9
|
+
import '../../core/Badge/Badge.js';
|
|
10
|
+
import '../../core/Breadcrumbs/Breadcrumbs.js';
|
|
11
|
+
import '../../core/Breadcrumbs/Breadcrumbs.theme.js';
|
|
12
|
+
import '../../core/Button/Button.js';
|
|
13
|
+
import '../../core/ButtonGroup/ButtonGroup.js';
|
|
14
|
+
import '../../core/ButtonGroup/ButtonGroupSeparator.js';
|
|
15
|
+
import '../../core/ButtonGroup/ButtonGroupText.js';
|
|
16
|
+
import '../../core/Calendar/Calendar.js';
|
|
17
|
+
import '../../core/Calendar/CalendarMini/CalendarMini.js';
|
|
18
|
+
import '../../core/Card/Card.js';
|
|
19
|
+
import '../../core/CardStack/CardStack.js';
|
|
20
|
+
import '../../core/Carousel/Carousel.js';
|
|
21
|
+
import '../../core/Carousel/CarouselBody.js';
|
|
22
|
+
import '../../core/CommandPalette/CommandPalette.js';
|
|
23
|
+
import { Separator } from '../../core/Separator/Separator.js';
|
|
24
|
+
import '../../core/Drawer/Drawer.js';
|
|
25
|
+
import '../../core/Drawer/DrawerBody.js';
|
|
26
|
+
import '../../core/Dropdown/Dropdown.js';
|
|
27
|
+
import '../../core/Dropdown/DropdownTrigger.js';
|
|
28
|
+
import '../../core/Dropdown/DropdownMenu.js';
|
|
29
|
+
import '../../core/Dropdown/DropdownItem.js';
|
|
30
|
+
import '../../core/Dropdown/DropdownSection.js';
|
|
31
|
+
import '../../core/Dropdown/DropdownSeparator.js';
|
|
32
|
+
import '../../core/Dropdown/Dropdown.theme.js';
|
|
33
|
+
import '../../core/Kbd/Kbd.js';
|
|
34
|
+
import '../../core/MenuItem/MenuItem.js';
|
|
35
|
+
import '../../core/Link/Link.js';
|
|
36
|
+
import '../../core/Modal/Modal.js';
|
|
37
|
+
import '../../core/ModalStack/ModalStack.js';
|
|
38
|
+
import '../../core/PageHeading/PageHeading.js';
|
|
39
|
+
import '../../core/Pagination/Pagination.js';
|
|
40
|
+
import '../../core/Popover/Popover.js';
|
|
41
|
+
import '../../core/Popover/PopoverContext.js';
|
|
42
|
+
import '../../core/Popover/PopoverBody.js';
|
|
43
|
+
import '../../core/Progress/Progress.js';
|
|
44
|
+
import '../../core/Rating/Rating.js';
|
|
45
|
+
import '../../core/ScrollArea/ScrollArea.js';
|
|
46
|
+
import '../../core/ScrollArea/smooth/SmoothScrollEngine.js';
|
|
47
|
+
import '../../core/Segmented/Segmented.js';
|
|
48
|
+
import '../../core/Skeleton/Skeleton.js';
|
|
49
|
+
import '../../core/SlidingNumber/SlidingNumber.js';
|
|
50
|
+
import '../../core/Tabs/Tabs.js';
|
|
51
|
+
import '../../core/Tabs/TabsList.js';
|
|
52
|
+
import '../../core/Tabs/TabsTrigger.js';
|
|
53
|
+
import '../../core/Tabs/TabsBody.js';
|
|
54
|
+
import '../../core/Tabs/TabsContext.js';
|
|
55
|
+
import '../../core/Tooltip/Tooltip.js';
|
|
56
|
+
import '../../core/Tooltip/Tooltip.animations.js';
|
|
57
|
+
import '../../core/Tree/Tree.js';
|
|
58
|
+
import '../../core/Tag/Tag.js';
|
|
59
|
+
import '../../core/Alert/Alert.js';
|
|
60
|
+
import '../../core/Toast/Toast.js';
|
|
61
|
+
import '../../core/Toast/ToastProvider.js';
|
|
62
|
+
import '@heroicons/react/24/solid';
|
|
63
|
+
import '../../core/Spinner/Spinner.js';
|
|
64
|
+
import '../../core/Message/Message.js';
|
|
65
|
+
import '../../core/Message/TypeWriter.js';
|
|
66
|
+
import '../../core/Message/MessageBody.js';
|
|
67
|
+
import '@heroicons/react/16/solid';
|
|
68
|
+
import '@heroicons/react/24/outline';
|
|
69
|
+
import '../../core/Empty/Empty.js';
|
|
70
|
+
import '../../core/Masonry/Masonry.js';
|
|
71
|
+
import '../../core/DragDrop/DragDrop.js';
|
|
72
|
+
import '../../core/Sortable/Sortable.js';
|
|
73
|
+
import '../../core/NavItem/NavItem.js';
|
|
74
|
+
import '../../core/Sidebar/Sidebar.js';
|
|
75
|
+
import '../../core/Sidebar/SidebarHeader.js';
|
|
76
|
+
import '../../core/Sidebar/SidebarContent.js';
|
|
77
|
+
import '../../core/Sidebar/SidebarFooter.js';
|
|
78
|
+
import '../../core/Sidebar/SidebarNav.js';
|
|
79
|
+
import '../../core/Sidebar/SidebarNavGroup.js';
|
|
80
|
+
import 'motion/react';
|
|
81
|
+
import '../../core/Sidebar/SidebarToggle.js';
|
|
82
|
+
import '../../core/Sidebar/SidebarMobileTrigger.js';
|
|
83
|
+
import '../../core/Sidebar/SidebarUserProfile.js';
|
|
84
|
+
import '../../core/Sidebar/SidebarLogo.js';
|
|
85
|
+
import '../../core/Sidebar/SidebarContext.js';
|
|
86
|
+
import '../../core/OfflineIndicator/OfflineIndicator.js';
|
|
87
|
+
import '../../core/ContextMenu/ContextMenu.js';
|
|
88
|
+
import '../../core/ContextMenu/ContextMenu.theme.js';
|
|
89
|
+
import '../../core/Pill/Pill.js';
|
|
90
|
+
import '../../core/Icon/Icon.js';
|
|
4
91
|
import { formLayoutTheme } from './FormLayout.theme.js';
|
|
5
92
|
import { FormLayoutSection } from './FormLayoutSection.js';
|
|
6
93
|
import { FormLayoutFooter } from './FormLayoutFooter.js';
|
|
7
|
-
import { Separator } from '../../core/Separator/Separator.js';
|
|
8
94
|
|
|
9
95
|
const isFooter = (child) => React__default.isValidElement(child) && child.type === FormLayoutFooter;
|
|
10
96
|
const FormLayoutRoot = React__default.forwardRef(({ className, theme: customTheme, children, ...props }, ref) => {
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export { useClickOutside } from "./useClickOutside";
|
|
|
14
14
|
export { useScaleBackground } from "./useScaleBackground";
|
|
15
15
|
export type { UseScaleBackgroundOptions } from "./useScaleBackground";
|
|
16
16
|
export { useMediaQuery } from "./useMediaQuery";
|
|
17
|
+
export { useDarkMode } from './useDarkMode';
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @param handler The callback function to execute when a click outside is detected
|
|
3
|
+
* Overload 1 — legacy API: useClickOutside(ref, handler)
|
|
4
|
+
* Preserves backward compatibility with existing callers.
|
|
6
5
|
*/
|
|
7
|
-
export declare
|
|
6
|
+
export declare function useClickOutside<T extends HTMLElement | null>(ref: RefObject<T>, handler: (event: MouseEvent | TouchEvent) => void): void;
|
|
7
|
+
/**
|
|
8
|
+
* Overload 2 — new API: useClickOutside(callback, isActive?, additionalRefs?)
|
|
9
|
+
* Returns a ref to attach to the primary element.
|
|
10
|
+
* Accepts an optional array of additional refs whose contents count as "inside"
|
|
11
|
+
* (useful for trigger+content patterns).
|
|
12
|
+
*/
|
|
13
|
+
export declare function useClickOutside(callback: () => void, isActive?: boolean, additionalRefs?: RefObject<HTMLElement | null>[]): RefObject<HTMLElement | null>;
|
|
@@ -1,28 +1,48 @@
|
|
|
1
|
-
import { useRef, useEffect } from 'react';
|
|
1
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
// Implementation
|
|
4
|
+
function useClickOutside(refOrCallback, handlerOrIsActive, additionalRefs) {
|
|
5
|
+
const internalRef = useRef(null);
|
|
6
|
+
const legacyHandlerRef = useRef(null);
|
|
7
|
+
// Keep legacy handler ref current
|
|
8
|
+
if (typeof refOrCallback !== 'function' && typeof handlerOrIsActive === 'function') {
|
|
9
|
+
legacyHandlerRef.current = handlerOrIsActive;
|
|
10
|
+
}
|
|
11
|
+
const isLegacy = typeof refOrCallback !== 'function';
|
|
12
|
+
const isActive = isLegacy
|
|
13
|
+
? true
|
|
14
|
+
: typeof handlerOrIsActive === 'boolean'
|
|
15
|
+
? handlerOrIsActive
|
|
16
|
+
: true;
|
|
17
|
+
const handleClickOutside = useCallback((event) => {
|
|
18
|
+
var _a;
|
|
19
|
+
const target = event.target;
|
|
20
|
+
if (isLegacy) {
|
|
21
|
+
const legacyRef = refOrCallback;
|
|
22
|
+
const el = legacyRef.current;
|
|
23
|
+
if (!el || el.contains(target))
|
|
24
|
+
return;
|
|
25
|
+
(_a = legacyHandlerRef.current) === null || _a === void 0 ? void 0 : _a.call(legacyHandlerRef, event);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
if (internalRef.current && internalRef.current.contains(target))
|
|
15
29
|
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
if (additionalRefs === null || additionalRefs === void 0 ? void 0 : additionalRefs.some(r => { var _a; return (_a = r.current) === null || _a === void 0 ? void 0 : _a.contains(target); }))
|
|
31
|
+
return;
|
|
32
|
+
refOrCallback();
|
|
33
|
+
}
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, [isLegacy, additionalRefs]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!isActive)
|
|
38
|
+
return;
|
|
39
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
40
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
41
|
+
}, [handleClickOutside, isActive]);
|
|
42
|
+
if (isLegacy) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
return internalRef;
|
|
46
|
+
}
|
|
27
47
|
|
|
28
48
|
export { useClickOutside };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDarkMode(): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const _subscribers = new Set();
|
|
4
|
+
let _observer = null;
|
|
5
|
+
function _getIsDark() {
|
|
6
|
+
if (typeof document === 'undefined')
|
|
7
|
+
return false;
|
|
8
|
+
return (document.documentElement.classList.contains('dark') ||
|
|
9
|
+
document.body.classList.contains('dark') ||
|
|
10
|
+
document.querySelector('.dark') !== null);
|
|
11
|
+
}
|
|
12
|
+
function _ensureObserver() {
|
|
13
|
+
if (_observer || typeof document === 'undefined')
|
|
14
|
+
return;
|
|
15
|
+
_getIsDark();
|
|
16
|
+
_observer = new MutationObserver(() => {
|
|
17
|
+
_getIsDark();
|
|
18
|
+
_subscribers.forEach((fn) => fn());
|
|
19
|
+
});
|
|
20
|
+
_observer.observe(document.documentElement, {
|
|
21
|
+
attributes: true,
|
|
22
|
+
attributeFilter: ['class'],
|
|
23
|
+
});
|
|
24
|
+
_observer.observe(document.body, {
|
|
25
|
+
attributes: true,
|
|
26
|
+
attributeFilter: ['class'],
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function useDarkMode() {
|
|
30
|
+
const [, rerender] = useState(0);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
_ensureObserver();
|
|
33
|
+
const notify = () => rerender((n) => n + 1);
|
|
34
|
+
_subscribers.add(notify);
|
|
35
|
+
return () => {
|
|
36
|
+
_subscribers.delete(notify);
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
return typeof document === 'undefined' ? false : _getIsDark();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { useDarkMode };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StateMachineConfig, StateIdentifier } from "../utils/stateMachine";
|
|
2
|
-
export interface UseFormStateMachineOptions<TData =
|
|
2
|
+
export interface UseFormStateMachineOptions<TData = unknown> {
|
|
3
3
|
/** Initial form data */
|
|
4
4
|
initialData?: TData;
|
|
5
5
|
/** Callback when state changes */
|
|
@@ -32,7 +32,7 @@ const getConnection = () => {
|
|
|
32
32
|
* }
|
|
33
33
|
*/
|
|
34
34
|
const useNetworkStatus = () => {
|
|
35
|
-
const [isOnline, setIsOnline] = useState(
|
|
35
|
+
const [isOnline, setIsOnline] = useState(true);
|
|
36
36
|
const [wasOffline, setWasOffline] = useState(false);
|
|
37
37
|
const [networkInfo, setNetworkInfo] = useState({});
|
|
38
38
|
const updateNetworkInfo = useCallback(() => {
|
package/dist/hooks/useOverlay.js
CHANGED
|
@@ -7,6 +7,8 @@ let lockCount = 0;
|
|
|
7
7
|
let savedOverflow = '';
|
|
8
8
|
let savedPaddingRight = '';
|
|
9
9
|
function lockScroll() {
|
|
10
|
+
if (typeof window === 'undefined')
|
|
11
|
+
return;
|
|
10
12
|
lockCount++;
|
|
11
13
|
if (lockCount === 1) {
|
|
12
14
|
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
@@ -23,6 +25,8 @@ function lockScroll() {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
function unlockScroll() {
|
|
28
|
+
if (typeof window === 'undefined')
|
|
29
|
+
return;
|
|
26
30
|
lockCount = Math.max(0, lockCount - 1);
|
|
27
31
|
if (lockCount === 0) {
|
|
28
32
|
document.body.style.overflow = savedOverflow;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { useRef,
|
|
1
|
+
import { useRef, useEffect, useLayoutEffect } from 'react';
|
|
2
2
|
import { animate } from 'motion/react';
|
|
3
3
|
|
|
4
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
4
5
|
const WRAPPER_SELECTOR = "[data-flik-drawer-wrapper]";
|
|
5
6
|
/**
|
|
6
7
|
* useScaleBackground
|
|
@@ -22,7 +23,9 @@ function useScaleBackground({ isOpen, scale = 0.94, borderRadius = 24, position
|
|
|
22
23
|
const controlsRef = useRef(null);
|
|
23
24
|
// Track current animation progress so rapid toggling picks up where it left off
|
|
24
25
|
const progressRef = useRef(0);
|
|
25
|
-
|
|
26
|
+
useIsomorphicLayoutEffect(() => {
|
|
27
|
+
if (typeof window === 'undefined')
|
|
28
|
+
return;
|
|
26
29
|
// Skip if no scaling needed
|
|
27
30
|
if (scale >= 1)
|
|
28
31
|
return;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { useRef, useState, useCallback, useLayoutEffect } from 'react';
|
|
1
|
+
import { useRef, useState, useCallback, useLayoutEffect, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
3
4
|
/**
|
|
4
5
|
* Fixed dropdown positioning hook
|
|
5
6
|
* Uses position: fixed with pure viewport coordinates to properly follow scroll
|
|
@@ -288,7 +289,9 @@ const useSimpleDropdown = ({ triggerRef, isOpen, placement = "bottom-start", off
|
|
|
288
289
|
contentRef.current.style.left = `${left}px`;
|
|
289
290
|
}, [triggerRef, measureDropdownHeight, measureDropdownWidth, offset]);
|
|
290
291
|
// Reset initial render flag when dropdown opens
|
|
291
|
-
|
|
292
|
+
useIsomorphicLayoutEffect(() => {
|
|
293
|
+
if (typeof window === 'undefined')
|
|
294
|
+
return;
|
|
292
295
|
if (!isOpen) {
|
|
293
296
|
if (rafIdRef.current !== null) {
|
|
294
297
|
cancelAnimationFrame(rafIdRef.current);
|
|
@@ -319,7 +322,9 @@ const useSimpleDropdown = ({ triggerRef, isOpen, placement = "bottom-start", off
|
|
|
319
322
|
};
|
|
320
323
|
}, [isOpen, calculatePosition]);
|
|
321
324
|
// Initial position calculation
|
|
322
|
-
|
|
325
|
+
useIsomorphicLayoutEffect(() => {
|
|
326
|
+
if (typeof window === 'undefined')
|
|
327
|
+
return;
|
|
323
328
|
if (!isOpen)
|
|
324
329
|
return;
|
|
325
330
|
calculatePosition();
|
|
@@ -363,7 +368,9 @@ const useSimpleDropdown = ({ triggerRef, isOpen, placement = "bottom-start", off
|
|
|
363
368
|
});
|
|
364
369
|
}, [calculatePosition]);
|
|
365
370
|
// Update position on scroll and resize - rAF-synced for smooth tracking
|
|
366
|
-
|
|
371
|
+
useIsomorphicLayoutEffect(() => {
|
|
372
|
+
if (typeof window === 'undefined')
|
|
373
|
+
return;
|
|
367
374
|
if (!isOpen)
|
|
368
375
|
return;
|
|
369
376
|
window.addEventListener("scroll", handleScroll, { passive: true, capture: true });
|
|
@@ -378,7 +385,9 @@ const useSimpleDropdown = ({ triggerRef, isOpen, placement = "bottom-start", off
|
|
|
378
385
|
};
|
|
379
386
|
}, [isOpen, handleScroll, handleResize]);
|
|
380
387
|
// Recalculate when dropdown content resizes (e.g. search filtering)
|
|
381
|
-
|
|
388
|
+
useIsomorphicLayoutEffect(() => {
|
|
389
|
+
if (typeof window === 'undefined')
|
|
390
|
+
return;
|
|
382
391
|
if (!isOpen)
|
|
383
392
|
return;
|
|
384
393
|
if (!contentRef.current)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export * from "./components/core";
|
|
2
2
|
export * from "./components/data-display";
|
|
3
3
|
export * from "./components/forms";
|
|
4
|
-
export * from "./components/charts";
|
|
5
4
|
export * from "./components/layout";
|
|
6
|
-
export * from "./components/effects";
|
|
7
5
|
export { cn } from "./utils/cn";
|
|
8
6
|
export { debounce } from "./utils/debounce";
|
|
9
7
|
export { useClickOutside } from "./hooks/useClickOutside";
|