@constructive-io/ui 0.3.1 → 0.6.0
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/LICENSE +21 -0
- package/README.md +17 -22
- package/dist/components/alert-dialog.cjs +333 -0
- package/dist/components/alert-dialog.cjs.map +1 -0
- package/dist/components/alert-dialog.d.cts +32 -0
- package/dist/components/alert-dialog.d.ts +16 -15
- package/dist/components/alert-dialog.js +89 -102
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +119 -0
- package/dist/components/alert.cjs.map +1 -0
- package/dist/components/alert.d.cts +19 -0
- package/dist/components/alert.d.ts +10 -5
- package/dist/components/alert.js +62 -6
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-bar.cjs +367 -0
- package/dist/components/app-bar.cjs.map +1 -0
- package/dist/components/app-bar.d.cts +26 -0
- package/dist/components/app-bar.d.ts +26 -0
- package/dist/components/app-bar.js +344 -0
- package/dist/components/app-bar.js.map +1 -0
- package/dist/components/app-shell.cjs +1792 -0
- package/dist/components/app-shell.cjs.map +1 -0
- package/dist/components/app-shell.d.cts +106 -0
- package/dist/components/app-shell.d.ts +106 -0
- package/dist/components/app-shell.js +1771 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/autocomplete.cjs +418 -0
- package/dist/components/autocomplete.cjs.map +1 -0
- package/dist/components/autocomplete.d.cts +28 -0
- package/dist/components/autocomplete.d.ts +15 -15
- package/dist/components/autocomplete.js +9 -30
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +51 -0
- package/dist/components/avatar.cjs.map +1 -0
- package/dist/components/avatar.d.cts +12 -0
- package/dist/components/avatar.d.ts +3 -4
- package/dist/components/avatar.js +11 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +66 -0
- package/dist/components/badge.cjs.map +1 -0
- package/dist/components/badge.d.cts +15 -0
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +118 -0
- package/dist/components/breadcrumb.cjs.map +1 -0
- package/dist/components/breadcrumb.d.cts +14 -0
- package/dist/components/breadcrumb.d.ts +9 -9
- package/dist/components/breadcrumb.js +19 -83
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.cjs +169 -0
- package/dist/components/button.cjs.map +1 -0
- package/dist/components/button.d.cts +20 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +105 -21
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +85 -0
- package/dist/components/calendar-rac.cjs.map +1 -0
- package/dist/components/calendar-rac.d.cts +13 -0
- package/dist/components/calendar-rac.d.ts +3 -3
- package/dist/components/card.cjs +99 -0
- package/dist/components/card.cjs.map +1 -0
- package/dist/components/card.d.cts +18 -0
- package/dist/components/card.d.ts +7 -8
- package/dist/components/card.js +23 -8
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-group.cjs +18 -0
- package/dist/components/checkbox-group.cjs.map +1 -0
- package/dist/components/checkbox-group.d.cts +7 -0
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox.cjs +121 -0
- package/dist/components/checkbox.cjs.map +1 -0
- package/dist/components/checkbox.d.cts +8 -0
- package/dist/components/checkbox.d.ts +3 -3
- package/dist/components/checkbox.js +73 -41
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +127 -0
- package/dist/components/collapsible.cjs.map +1 -0
- package/dist/components/collapsible.d.cts +44 -0
- package/dist/components/collapsible.d.ts +8 -18
- package/dist/components/collapsible.js +7 -27
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +551 -0
- package/dist/components/combobox.cjs.map +1 -0
- package/dist/components/combobox.d.cts +43 -0
- package/dist/components/combobox.d.ts +17 -18
- package/dist/components/combobox.js +37 -48
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +236 -0
- package/dist/components/command.cjs.map +1 -0
- package/dist/components/command.d.cts +23 -0
- package/dist/components/command.d.ts +14 -15
- package/dist/components/command.js +5 -38
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +431 -0
- package/dist/components/dialog.cjs.map +1 -0
- package/dist/components/dialog.d.cts +30 -0
- package/dist/components/dialog.d.ts +13 -18
- package/dist/components/dialog.js +75 -119
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +121 -0
- package/dist/components/dock.cjs.map +1 -0
- package/dist/components/dock.d.cts +30 -0
- package/dist/components/dock.d.ts +1 -2
- package/dist/components/dock.js +7 -5
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +149 -0
- package/dist/components/drawer.cjs.map +1 -0
- package/dist/components/drawer.d.cts +15 -0
- package/dist/components/drawer.d.ts +10 -11
- package/dist/components/drawer.js +11 -40
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +292 -0
- package/dist/components/dropdown-menu.cjs.map +1 -0
- package/dist/components/dropdown-menu.d.cts +52 -0
- package/dist/components/dropdown-menu.d.ts +23 -21
- package/dist/components/dropdown-menu.js +67 -191
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +106 -0
- package/dist/components/empty.cjs.map +1 -0
- package/dist/components/empty.d.cts +15 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +99 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.cjs +295 -0
- package/dist/components/field.cjs.map +1 -0
- package/dist/components/field.d.cts +46 -0
- package/dist/components/field.d.ts +34 -39
- package/dist/components/field.js +220 -72
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +176 -0
- package/dist/components/flickering-grid.cjs.map +1 -0
- package/dist/components/flickering-grid.d.cts +15 -0
- package/dist/components/flickering-grid.js +25 -2
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +194 -0
- package/dist/components/flow-zoom-panel.cjs.map +1 -0
- package/dist/components/flow-zoom-panel.d.cts +12 -0
- package/dist/components/flow-zoom-panel.d.ts +12 -0
- package/dist/components/flow-zoom-panel.js +173 -0
- package/dist/components/flow-zoom-panel.js.map +1 -0
- package/dist/components/form-control.cjs +193 -0
- package/dist/components/form-control.cjs.map +1 -0
- package/dist/components/form-control.d.cts +14 -0
- package/dist/components/form-control.d.ts +1 -2
- package/dist/components/form-control.js +2 -4
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +208 -0
- package/dist/components/form.cjs.map +1 -0
- package/dist/components/form.d.cts +36 -0
- package/dist/components/form.d.ts +7 -8
- package/dist/components/input-group.cjs +184 -0
- package/dist/components/input-group.cjs.map +1 -0
- package/dist/components/input-group.d.cts +17 -0
- package/dist/components/input-group.d.ts +6 -7
- package/dist/components/input-group.js +3 -2
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.cjs +62 -0
- package/dist/components/input.cjs.map +1 -0
- package/dist/components/input.d.cts +10 -0
- package/dist/components/input.d.ts +1 -2
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/json-input.cjs +351 -0
- package/dist/components/json-input.cjs.map +1 -0
- package/dist/components/json-input.d.cts +25 -0
- package/dist/components/json-input.d.ts +3 -3
- package/dist/components/json-input.js +89 -112
- package/dist/components/json-input.js.map +1 -1
- package/dist/components/label.cjs +29 -0
- package/dist/components/label.cjs.map +1 -0
- package/dist/components/label.d.cts +10 -0
- package/dist/components/label.d.ts +1 -2
- package/dist/components/motion-grid.cjs +108 -0
- package/dist/components/motion-grid.cjs.map +1 -0
- package/dist/components/motion-grid.d.cts +19 -0
- package/dist/components/motion-grid.d.ts +1 -2
- package/dist/components/motion-grid.js +9 -4
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +796 -0
- package/dist/components/multi-select.cjs.map +1 -0
- package/dist/components/multi-select.d.cts +198 -0
- package/dist/components/multi-select.js +54 -162
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +19 -0
- package/dist/components/page-header.cjs.map +1 -0
- package/dist/components/page-header.d.cts +17 -0
- package/dist/components/page-header.d.ts +2 -2
- package/dist/components/pagination.cjs +295 -0
- package/dist/components/pagination.cjs.map +1 -0
- package/dist/components/pagination.d.cts +18 -0
- package/dist/components/pagination.d.ts +7 -8
- package/dist/components/pagination.js +152 -29
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.cjs +140 -0
- package/dist/components/popover.cjs.map +1 -0
- package/dist/components/popover.d.cts +39 -0
- package/dist/components/popover.d.ts +13 -9
- package/dist/components/popover.js +56 -132
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.cjs +109 -0
- package/dist/components/portal.cjs.map +1 -0
- package/dist/components/portal.d.cts +117 -0
- package/dist/components/portal.d.ts +16 -7
- package/dist/components/portal.js +13 -8
- package/dist/components/portal.js.map +1 -1
- package/dist/components/progress.cjs +31 -0
- package/dist/components/progress.cjs.map +1 -0
- package/dist/components/progress.d.cts +9 -0
- package/dist/components/progress.d.ts +1 -2
- package/dist/components/progress.js +1 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +144 -0
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -0
- package/dist/components/progressive-blur-scroll-container.d.cts +25 -0
- package/dist/components/progressive-blur-scroll-container.d.ts +2 -2
- package/dist/components/progressive-blur.cjs +70 -0
- package/dist/components/progressive-blur.cjs.map +1 -0
- package/dist/components/progressive-blur.d.cts +16 -0
- package/dist/components/progressive-blur.d.ts +2 -2
- package/dist/components/radio-group.cjs +52 -0
- package/dist/components/radio-group.cjs.map +1 -0
- package/dist/components/radio-group.d.cts +10 -0
- package/dist/components/radio-group.d.ts +3 -3
- package/dist/components/radio-group.js +21 -10
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +420 -0
- package/dist/components/record-picker.cjs.map +1 -0
- package/dist/components/record-picker.d.cts +16 -0
- package/dist/components/record-picker.d.ts +2 -2
- package/dist/components/record-picker.js +76 -43
- package/dist/components/record-picker.js.map +1 -1
- package/dist/components/resizable.cjs +76 -0
- package/dist/components/resizable.cjs.map +1 -0
- package/dist/components/resizable.d.cts +10 -0
- package/dist/components/resizable.d.ts +3 -4
- package/dist/components/responsive-diagram.cjs +67 -0
- package/dist/components/responsive-diagram.cjs.map +1 -0
- package/dist/components/responsive-diagram.d.cts +10 -0
- package/dist/components/responsive-diagram.d.ts +2 -2
- package/dist/components/scroll-area.cjs +92 -0
- package/dist/components/scroll-area.cjs.map +1 -0
- package/dist/components/scroll-area.d.cts +11 -0
- package/dist/components/scroll-area.d.ts +5 -6
- package/dist/components/select.cjs +329 -0
- package/dist/components/select.cjs.map +1 -0
- package/dist/components/select.d.cts +46 -0
- package/dist/components/select.d.ts +13 -14
- package/dist/components/select.js +76 -67
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +26 -0
- package/dist/components/separator.cjs.map +1 -0
- package/dist/components/separator.d.cts +10 -0
- package/dist/components/separator.d.ts +1 -2
- package/dist/components/sheet.cjs +489 -0
- package/dist/components/sheet.cjs.map +1 -0
- package/dist/components/sheet.d.cts +107 -0
- package/dist/components/sheet.d.ts +14 -19
- package/dist/components/sheet.js +119 -264
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.cjs +1300 -0
- package/dist/components/sidebar.cjs.map +1 -0
- package/dist/components/sidebar.d.cts +70 -0
- package/dist/components/sidebar.d.ts +32 -39
- package/dist/components/sidebar.js +401 -362
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.cjs +36 -0
- package/dist/components/skeleton.cjs.map +1 -0
- package/dist/components/skeleton.d.cts +10 -0
- package/dist/components/skeleton.d.ts +5 -2
- package/dist/components/skeleton.js +19 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/sonner.cjs +25 -0
- package/dist/components/sonner.cjs.map +1 -0
- package/dist/components/sonner.d.cts +10 -0
- package/dist/components/sonner.d.ts +2 -2
- package/dist/components/stack/index.cjs +1516 -0
- package/dist/components/stack/index.cjs.map +1 -0
- package/dist/components/stack/index.d.cts +672 -0
- package/dist/components/stack/index.d.ts +36 -38
- package/dist/components/stack/index.js +42 -31
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/stepper.cjs +314 -0
- package/dist/components/stepper.cjs.map +1 -0
- package/dist/components/stepper.d.cts +31 -0
- package/dist/components/stepper.d.ts +9 -8
- package/dist/components/stepper.js +22 -15
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +46 -0
- package/dist/components/switch.cjs.map +1 -0
- package/dist/components/switch.d.cts +7 -0
- package/dist/components/switch.d.ts +1 -2
- package/dist/components/switch.js +9 -5
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +133 -0
- package/dist/components/table.cjs.map +1 -0
- package/dist/components/table.d.cts +22 -0
- package/dist/components/table.d.ts +19 -12
- package/dist/components/table.js +72 -13
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +53 -0
- package/dist/components/tabs.cjs.map +1 -0
- package/dist/components/tabs.d.cts +9 -0
- package/dist/components/tabs.d.ts +4 -5
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +451 -0
- package/dist/components/tags.cjs.map +1 -0
- package/dist/components/tags.d.cts +40 -0
- package/dist/components/tags.d.ts +10 -10
- package/dist/components/tags.js +129 -154
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +56 -0
- package/dist/components/textarea.cjs.map +1 -0
- package/dist/components/textarea.d.cts +9 -0
- package/dist/components/textarea.d.ts +1 -2
- package/dist/components/toast/index.cjs +612 -0
- package/dist/components/toast/index.cjs.map +1 -0
- package/dist/components/toast/index.d.cts +52 -0
- package/dist/components/toast/index.js +90 -127
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/tooltip.cjs +92 -0
- package/dist/components/tooltip.cjs.map +1 -0
- package/dist/components/tooltip.d.cts +28 -0
- package/dist/components/tooltip.d.ts +5 -6
- package/dist/components/tooltip.js +23 -130
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +197 -0
- package/dist/components/unlink-button.cjs.map +1 -0
- package/dist/components/unlink-button.d.cts +14 -0
- package/dist/components/unlink-button.d.ts +2 -2
- package/dist/components/unlink-button.js +105 -21
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/index.cjs +2040 -1577
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +492 -509
- package/dist/index.d.ts +492 -509
- package/dist/index.js +1862 -1443
- package/dist/index.js.map +1 -1
- package/package.json +286 -45
- package/src/styles/globals.css +155 -203
- package/dist/components/org-chart/index.d.ts +0 -54
- package/dist/components/org-chart/index.js +0 -861
- package/dist/components/org-chart/index.js.map +0 -1
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React$1 from 'react';
|
|
3
2
|
import { ComponentType } from 'react';
|
|
4
|
-
import * as _use_gesture_react from '@use-gesture/react';
|
|
5
|
-
import { useDrag } from '@use-gesture/react';
|
|
6
3
|
import { Variants, Transition } from 'motion/react';
|
|
7
4
|
|
|
8
5
|
type CardId = string;
|
|
@@ -308,7 +305,7 @@ type StackContextValue = {
|
|
|
308
305
|
};
|
|
309
306
|
};
|
|
310
307
|
|
|
311
|
-
declare function CardStackProvider({ children, routes, initial, onChange, zIndexBase, layoutMode, defaultPeekOffset, defaultWidth, }: CardStackProviderProps):
|
|
308
|
+
declare function CardStackProvider({ children, routes, initial, onChange, zIndexBase, layoutMode, defaultPeekOffset, defaultWidth, }: CardStackProviderProps): React$1.JSX.Element;
|
|
312
309
|
declare function useCardStack(): CardStackApi;
|
|
313
310
|
declare function useStackContext(): StackContextValue;
|
|
314
311
|
/** Hook to get current layout mode */
|
|
@@ -362,7 +359,7 @@ declare function useCardReady(): {
|
|
|
362
359
|
isReady: boolean;
|
|
363
360
|
};
|
|
364
361
|
|
|
365
|
-
declare function CardStackViewport({ backdrop, renderBackdrop, renderHeader, renderEmpty, peekDepth, animation, mobile, peekGestures, className, }: CardStackViewportProps): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> |
|
|
362
|
+
declare function CardStackViewport({ backdrop, renderBackdrop, renderHeader, renderEmpty, peekDepth, animation, mobile, peekGestures, className, }: CardStackViewportProps): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | React$1.JSX.Element | null | undefined;
|
|
366
363
|
|
|
367
364
|
type StackBackdropProps = {
|
|
368
365
|
/** Additional class names */
|
|
@@ -372,7 +369,7 @@ type StackBackdropProps = {
|
|
|
372
369
|
/** Backdrop configuration (blur, custom className) */
|
|
373
370
|
config?: BackdropConfig;
|
|
374
371
|
};
|
|
375
|
-
declare function StackBackdrop({ className, onClick, config: backdropConfig }: StackBackdropProps):
|
|
372
|
+
declare function StackBackdrop({ className, onClick, config: backdropConfig }: StackBackdropProps): React$1.JSX.Element;
|
|
376
373
|
|
|
377
374
|
type StackHeaderProps = {
|
|
378
375
|
/** The card spec */
|
|
@@ -384,14 +381,42 @@ type StackHeaderProps = {
|
|
|
384
381
|
/** Custom title renderer */
|
|
385
382
|
renderTitle?: (card: CardSpec) => React$1.ReactNode;
|
|
386
383
|
};
|
|
387
|
-
declare function StackHeader({ card, onClose, className, renderTitle }: StackHeaderProps):
|
|
384
|
+
declare function StackHeader({ card, onClose, className, renderTitle }: StackHeaderProps): React$1.JSX.Element;
|
|
388
385
|
type StackHeaderSlotProps = {
|
|
389
386
|
/** Additional class names */
|
|
390
387
|
className?: string;
|
|
391
388
|
children: React$1.ReactNode;
|
|
392
389
|
};
|
|
393
390
|
/** Slot for custom header content */
|
|
394
|
-
declare function StackHeaderSlot({ className, children }: StackHeaderSlotProps):
|
|
391
|
+
declare function StackHeaderSlot({ className, children }: StackHeaderSlotProps): React$1.JSX.Element;
|
|
392
|
+
|
|
393
|
+
type UseStackGesturesOptions = GestureConfig & {
|
|
394
|
+
/** Whether gestures are enabled */
|
|
395
|
+
enabled?: boolean;
|
|
396
|
+
/** Callback when swipe completes and should dismiss */
|
|
397
|
+
onDismiss: () => void;
|
|
398
|
+
};
|
|
399
|
+
type StackGestureBind = () => object;
|
|
400
|
+
type UseStackGesturesResult = {
|
|
401
|
+
/** Current drag X offset */
|
|
402
|
+
dragX: number;
|
|
403
|
+
/** Whether currently dragging */
|
|
404
|
+
isDragging: boolean;
|
|
405
|
+
/** Bind function to attach to the draggable element */
|
|
406
|
+
bind: StackGestureBind;
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Hook for swipe-to-dismiss gesture on stack cards using @use-gesture/react.
|
|
410
|
+
*
|
|
411
|
+
* Features:
|
|
412
|
+
* - Only allows swiping to the right (positive X direction)
|
|
413
|
+
* - Ignores touches near left edge (avoids iOS Safari back gesture conflict)
|
|
414
|
+
* - Requires horizontal intent before activating (won't interfere with scroll)
|
|
415
|
+
* - Dismisses on release after distance or velocity threshold
|
|
416
|
+
* - Auto-dismisses near the end of the drag (configurable)
|
|
417
|
+
* - 1:1 finger tracking for responsive feel
|
|
418
|
+
*/
|
|
419
|
+
declare function useStackGestures(options: UseStackGesturesOptions): UseStackGesturesResult;
|
|
395
420
|
|
|
396
421
|
type StackCardProps = {
|
|
397
422
|
/** The card specification */
|
|
@@ -419,7 +444,7 @@ type StackCardProps = {
|
|
|
419
444
|
/** Drag state from gesture hook (for top card swipe-to-dismiss) */
|
|
420
445
|
dragX?: number;
|
|
421
446
|
/** Gesture bind from @use-gesture/react */
|
|
422
|
-
gestureBind?:
|
|
447
|
+
gestureBind?: StackGestureBind;
|
|
423
448
|
/** Whether this card's peek zone is hovered (viewport-coordinated) */
|
|
424
449
|
isPeekHovered?: boolean;
|
|
425
450
|
/** Callback when peek hover starts */
|
|
@@ -439,7 +464,7 @@ type StackCardProps = {
|
|
|
439
464
|
/** Additional class name for the card */
|
|
440
465
|
className?: string;
|
|
441
466
|
};
|
|
442
|
-
declare function StackCardInner({ card, index, totalCards, topCardWidth, animation, isMobile, renderHeader, peekGestureConfig, compressionRatio, adjustedPeekOffset, dragX, gestureBind, isPeekHovered, onPeekHoverStart, onPeekHoverEnd, peekDragOffset, onPeekDragStart, onPeekDrag, onPeekDragEnd, isLastCard, className, }: StackCardProps):
|
|
467
|
+
declare function StackCardInner({ card, index, totalCards, topCardWidth, animation, isMobile, renderHeader, peekGestureConfig, compressionRatio, adjustedPeekOffset, dragX, gestureBind, isPeekHovered, onPeekHoverStart, onPeekHoverEnd, peekDragOffset, onPeekDragStart, onPeekDrag, onPeekDragEnd, isLastCard, className, }: StackCardProps): React$1.JSX.Element;
|
|
443
468
|
declare const StackCard: React$1.MemoExoticComponent<typeof StackCardInner>;
|
|
444
469
|
|
|
445
470
|
interface DeferredCardContentProps {
|
|
@@ -478,7 +503,7 @@ interface DeferredCardContentProps {
|
|
|
478
503
|
* </DeferredCardContent>
|
|
479
504
|
* ```
|
|
480
505
|
*/
|
|
481
|
-
declare function DeferredCardContent({ children, placeholder, delay, immediate, priority, onReady, }: DeferredCardContentProps): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> |
|
|
506
|
+
declare function DeferredCardContent({ children, placeholder, delay, immediate, priority, onReady, }: DeferredCardContentProps): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | React$1.JSX.Element;
|
|
482
507
|
|
|
483
508
|
type UseStackResponsiveOptions = MobileConfig;
|
|
484
509
|
type UseStackResponsiveResult = {
|
|
@@ -498,33 +523,6 @@ declare function useStackResponsive(options?: UseStackResponsiveOptions): UseSta
|
|
|
498
523
|
*/
|
|
499
524
|
declare function useIsMobile(breakpoint?: number): boolean;
|
|
500
525
|
|
|
501
|
-
type UseStackGesturesOptions = GestureConfig & {
|
|
502
|
-
/** Whether gestures are enabled */
|
|
503
|
-
enabled?: boolean;
|
|
504
|
-
/** Callback when swipe completes and should dismiss */
|
|
505
|
-
onDismiss: () => void;
|
|
506
|
-
};
|
|
507
|
-
type UseStackGesturesResult = {
|
|
508
|
-
/** Current drag X offset */
|
|
509
|
-
dragX: number;
|
|
510
|
-
/** Whether currently dragging */
|
|
511
|
-
isDragging: boolean;
|
|
512
|
-
/** Bind function to attach to the draggable element */
|
|
513
|
-
bind: ReturnType<typeof useDrag>;
|
|
514
|
-
};
|
|
515
|
-
/**
|
|
516
|
-
* Hook for swipe-to-dismiss gesture on stack cards using @use-gesture/react.
|
|
517
|
-
*
|
|
518
|
-
* Features:
|
|
519
|
-
* - Only allows swiping to the right (positive X direction)
|
|
520
|
-
* - Ignores touches near left edge (avoids iOS Safari back gesture conflict)
|
|
521
|
-
* - Requires horizontal intent before activating (won't interfere with scroll)
|
|
522
|
-
* - Dismisses on release after distance or velocity threshold
|
|
523
|
-
* - Auto-dismisses near the end of the drag (configurable)
|
|
524
|
-
* - 1:1 finger tracking for responsive feel
|
|
525
|
-
*/
|
|
526
|
-
declare function useStackGestures(options: UseStackGesturesOptions): UseStackGesturesResult;
|
|
527
|
-
|
|
528
526
|
type UsePeekGesturesOptions = PeekGestureConfig & {
|
|
529
527
|
/** Card index in the stack */
|
|
530
528
|
cardIndex: number;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
2
|
+
import * as React3 from 'react';
|
|
3
3
|
import { createContext, memo, useState, useCallback, useMemo, useContext, useRef, useReducer, useEffect } from 'react';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { useReducedMotion, motion, AnimatePresence } from 'motion/react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import { twMerge } from 'tailwind-merge';
|
|
9
|
+
import { useRootPortalContainer } from '@constructive-io/ui/portal';
|
|
9
10
|
import { ChevronRight } from 'lucide-react';
|
|
10
11
|
import { useDrag } from '@use-gesture/react';
|
|
11
12
|
|
|
@@ -112,7 +113,22 @@ function CardStackProvider({
|
|
|
112
113
|
defaultPeekOffset = DEFAULT_PEEK_OFFSET,
|
|
113
114
|
defaultWidth = DEFAULT_WIDTH
|
|
114
115
|
}) {
|
|
115
|
-
const [state,
|
|
116
|
+
const [state, reducerDispatch] = useReducer(stackReducer, { cards: initial });
|
|
117
|
+
const routesRef = useRef(routes);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
routesRef.current = routes;
|
|
120
|
+
}, [routes]);
|
|
121
|
+
const stateRef = useRef(state);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
stateRef.current = state;
|
|
124
|
+
}, [state]);
|
|
125
|
+
const dispatch = React3.useCallback(
|
|
126
|
+
(action) => {
|
|
127
|
+
stateRef.current = stackReducer(stateRef.current, action);
|
|
128
|
+
reducerDispatch(action);
|
|
129
|
+
},
|
|
130
|
+
[reducerDispatch]
|
|
131
|
+
);
|
|
116
132
|
const prevCardsRef = useRef(state.cards);
|
|
117
133
|
useEffect(() => {
|
|
118
134
|
if (prevCardsRef.current !== state.cards) {
|
|
@@ -127,10 +143,6 @@ function CardStackProvider({
|
|
|
127
143
|
onChange?.(state.cards);
|
|
128
144
|
}
|
|
129
145
|
}, [state.cards, onChange]);
|
|
130
|
-
const routesRef = useRef(routes);
|
|
131
|
-
routesRef.current = routes;
|
|
132
|
-
const stateRef = useRef(state);
|
|
133
|
-
stateRef.current = state;
|
|
134
146
|
const api = useMemo(() => {
|
|
135
147
|
const top = () => {
|
|
136
148
|
const cards = stateRef.current.cards;
|
|
@@ -231,7 +243,7 @@ function CardStackProvider({
|
|
|
231
243
|
dismiss,
|
|
232
244
|
insertAt
|
|
233
245
|
};
|
|
234
|
-
}, []);
|
|
246
|
+
}, [dispatch]);
|
|
235
247
|
useEffect(() => {
|
|
236
248
|
const handleEscape = (event) => {
|
|
237
249
|
if (event.key === "Escape" && stateRef.current.cards.length > 0) {
|
|
@@ -337,21 +349,6 @@ function useCardReady() {
|
|
|
337
349
|
function cn(...inputs) {
|
|
338
350
|
return twMerge(clsx(inputs));
|
|
339
351
|
}
|
|
340
|
-
var PORTAL_ROOT_ID = "portal-root";
|
|
341
|
-
React.createContext({
|
|
342
|
-
layer: "base",
|
|
343
|
-
depth: 0,
|
|
344
|
-
floatingPortalStrategy: "root",
|
|
345
|
-
floatingZIndex: "default"
|
|
346
|
-
});
|
|
347
|
-
function useRootPortalContainer() {
|
|
348
|
-
const [container, setContainer] = React.useState(null);
|
|
349
|
-
React.useLayoutEffect(() => {
|
|
350
|
-
const el = document.getElementById(PORTAL_ROOT_ID);
|
|
351
|
-
setContainer(el);
|
|
352
|
-
}, []);
|
|
353
|
-
return container;
|
|
354
|
-
}
|
|
355
352
|
|
|
356
353
|
// src/components/stack/stack-animations.ts
|
|
357
354
|
var DEFAULT_ANIMATION_CONFIG = {
|
|
@@ -478,7 +475,7 @@ function StackBackdrop({ className, onClick, config: backdropConfig }) {
|
|
|
478
475
|
const { config, state } = useStackContext();
|
|
479
476
|
const api = useCardStack();
|
|
480
477
|
const prefersReducedMotion = useReducedMotion();
|
|
481
|
-
const handleClick =
|
|
478
|
+
const handleClick = React3.useCallback(() => {
|
|
482
479
|
if (state.cards.some((c) => c.dismissable === false)) return;
|
|
483
480
|
if (onClick) {
|
|
484
481
|
onClick();
|
|
@@ -497,10 +494,7 @@ function StackBackdrop({ className, onClick, config: backdropConfig }) {
|
|
|
497
494
|
animate: "animate",
|
|
498
495
|
exit: "exit",
|
|
499
496
|
onClick: handleClick,
|
|
500
|
-
style: {
|
|
501
|
-
zIndex: config.zIndexBase - 1,
|
|
502
|
-
willChange: "opacity"
|
|
503
|
-
},
|
|
497
|
+
style: { zIndex: config.zIndexBase - 1 },
|
|
504
498
|
className: cn(
|
|
505
499
|
"fixed inset-0",
|
|
506
500
|
"cursor-pointer",
|
|
@@ -1016,7 +1010,6 @@ function StackCardInner({
|
|
|
1016
1010
|
height: "100dvh",
|
|
1017
1011
|
width: cardWidth,
|
|
1018
1012
|
zIndex,
|
|
1019
|
-
willChange: "transform",
|
|
1020
1013
|
// On mobile, allow vertical pan (scroll) but handle horizontal ourselves
|
|
1021
1014
|
// This prevents conflict with iOS Safari gestures while allowing content scroll
|
|
1022
1015
|
touchAction: isMobile ? "pan-y pinch-zoom" : void 0
|
|
@@ -1303,7 +1296,7 @@ function CardStackViewport({
|
|
|
1303
1296
|
const defaultBackdrop = /* @__PURE__ */ jsx(StackBackdrop, { className: "pointer-events-auto", config: config2 }, "backdrop");
|
|
1304
1297
|
if (renderBackdrop) {
|
|
1305
1298
|
const customBackdrop = renderBackdrop();
|
|
1306
|
-
return
|
|
1299
|
+
return React3.isValidElement(customBackdrop) ? React3.cloneElement(customBackdrop, { key: "backdrop" }) : defaultBackdrop;
|
|
1307
1300
|
}
|
|
1308
1301
|
return defaultBackdrop;
|
|
1309
1302
|
};
|
|
@@ -1332,7 +1325,7 @@ function CardStackViewport({
|
|
|
1332
1325
|
if (!hasCards && exitComplete) {
|
|
1333
1326
|
return renderEmpty ? renderEmpty() : null;
|
|
1334
1327
|
}
|
|
1335
|
-
const content = /* @__PURE__ */ jsx("div", { "data-slot": "stack-viewport", className: cn("pointer-events-none fixed inset-0", className), children: /* @__PURE__ */ jsxs(AnimatePresence, { mode: "popLayout", onExitComplete: handleExitComplete, children: [
|
|
1328
|
+
const content = /* @__PURE__ */ jsx("div", { "data-slot": "stack-viewport", className: cn("pointer-events-none fixed inset-0", className), children: /* @__PURE__ */ jsxs(AnimatePresence, { initial: false, mode: "popLayout", onExitComplete: handleExitComplete, children: [
|
|
1336
1329
|
shouldShowBackdrop && hasCards && renderBackdropNode(resolvedBackdrop.config),
|
|
1337
1330
|
visibleCards.map((card, visibleIndex) => {
|
|
1338
1331
|
const actualIndex = cards.length - visibleCards.length + visibleIndex;
|
|
@@ -1373,7 +1366,25 @@ function CardStackViewport({
|
|
|
1373
1366
|
return content;
|
|
1374
1367
|
}
|
|
1375
1368
|
function Skeleton({ className, ...props }) {
|
|
1376
|
-
return /* @__PURE__ */ jsx(
|
|
1369
|
+
return /* @__PURE__ */ jsx(
|
|
1370
|
+
"div",
|
|
1371
|
+
{
|
|
1372
|
+
"data-slot": "skeleton",
|
|
1373
|
+
className: cn(
|
|
1374
|
+
"rounded-md",
|
|
1375
|
+
// Quiet base (muted, not primary/10)
|
|
1376
|
+
"bg-muted",
|
|
1377
|
+
// Soft, low-contrast band — mostly muted with a faint lift mid-pass
|
|
1378
|
+
"[background-image:linear-gradient(90deg,var(--muted)_0%,color-mix(in_oklch,var(--muted)_92%,var(--foreground))_50%,var(--muted)_100%)]",
|
|
1379
|
+
"bg-[length:220%_100%]",
|
|
1380
|
+
// Slow, relaxed sweep
|
|
1381
|
+
"animate-[shimmer_4.5s_ease-in-out_infinite]",
|
|
1382
|
+
"motion-reduce:animate-none",
|
|
1383
|
+
className
|
|
1384
|
+
),
|
|
1385
|
+
...props
|
|
1386
|
+
}
|
|
1387
|
+
);
|
|
1377
1388
|
}
|
|
1378
1389
|
function DeferredCardContent({
|
|
1379
1390
|
children,
|