@kumix/ui 0.3.0 → 0.3.1
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/README.md +14 -1
- package/dist/components/custom/confirm-dialog.d.ts +16 -0
- package/dist/components/custom/confirm-dialog.d.ts.map +1 -0
- package/dist/components/custom/confirm-dialog.js +93 -0
- package/dist/components/custom/confirm-dialog.js.map +1 -0
- package/dist/components/custom/toast.d.ts +20 -0
- package/dist/components/custom/toast.d.ts.map +1 -0
- package/dist/components/custom/toast.js +73 -0
- package/dist/components/custom/toast.js.map +1 -0
- package/dist/components/motion/action-swap.js +1 -1
- package/dist/components/motion/animated-badge.js +2 -2
- package/dist/components/motion/animated-number.js +1 -1
- package/dist/components/motion/animated-sidebar.js +2 -2
- package/dist/components/motion/animated-toast-stack.js +4 -4
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/attachment-upload.d.ts +47 -0
- package/dist/components/motion/attachment-upload.d.ts.map +1 -0
- package/dist/components/motion/attachment-upload.js +737 -0
- package/dist/components/motion/attachment-upload.js.map +1 -0
- package/dist/components/motion/availability-scheduler/copy-menu.d.ts +10 -0
- package/dist/components/motion/availability-scheduler/copy-menu.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/copy-menu.js +3 -0
- package/dist/components/motion/availability-scheduler/day-row.d.ts +15 -0
- package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/day-row.js +181 -0
- package/dist/components/motion/availability-scheduler/day-row.js.map +1 -0
- package/dist/components/motion/availability-scheduler/icon-button.d.ts +15 -0
- package/dist/components/motion/availability-scheduler/icon-button.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/icon-button.js +24 -0
- package/dist/components/motion/availability-scheduler/icon-button.js.map +1 -0
- package/dist/components/motion/availability-scheduler/index.d.ts +14 -0
- package/dist/components/motion/availability-scheduler/index.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/index.js +59 -0
- package/dist/components/motion/availability-scheduler/index.js.map +1 -0
- package/dist/components/motion/availability-scheduler/time-select.d.ts +10 -0
- package/dist/components/motion/availability-scheduler/time-select.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/time-select.js +26 -0
- package/dist/components/motion/availability-scheduler/time-select.js.map +1 -0
- package/dist/components/motion/bloom-menu.d.ts +17 -0
- package/dist/components/motion/bloom-menu.d.ts.map +1 -0
- package/dist/components/motion/bloom-menu.js +170 -0
- package/dist/components/motion/bloom-menu.js.map +1 -0
- package/dist/components/motion/bottom-sheet.js +1 -1
- package/dist/components/motion/bounce-sidebar.js +1 -1
- package/dist/components/motion/bouncy-accordion.js +2 -2
- package/dist/components/motion/button/base.js +1 -1
- package/dist/components/motion/button/index.d.ts +4 -0
- package/dist/components/motion/button/index.js +5 -0
- package/dist/components/motion/button/magnetic.js +1 -1
- package/dist/components/motion/button/stateful.js +2 -2
- package/dist/components/motion/center-morph-modal.js +2 -2
- package/dist/components/motion/checkbox.js +1 -1
- package/dist/components/motion/chromatic-text-reveal.js +1 -1
- package/dist/components/motion/command-palette.d.ts +26 -0
- package/dist/components/motion/command-palette.d.ts.map +1 -0
- package/dist/components/motion/command-palette.js +246 -0
- package/dist/components/motion/command-palette.js.map +1 -0
- package/dist/components/motion/context-menu.js +2 -2
- package/dist/components/motion/cylinder-carousel.js +1 -1
- package/dist/components/motion/dock.js +1 -1
- package/dist/components/motion/drawer.js +1 -1
- package/dist/components/motion/dynamic-island.d.ts +22 -0
- package/dist/components/motion/dynamic-island.d.ts.map +1 -0
- package/dist/components/motion/dynamic-island.js +143 -0
- package/dist/components/motion/dynamic-island.js.map +1 -0
- package/dist/components/motion/expandable-action-bar.d.ts +52 -0
- package/dist/components/motion/expandable-action-bar.d.ts.map +1 -0
- package/dist/components/motion/expandable-action-bar.js +191 -0
- package/dist/components/motion/expandable-action-bar.js.map +1 -0
- package/dist/components/motion/expandable-tabs.d.ts +33 -0
- package/dist/components/motion/expandable-tabs.d.ts.map +1 -0
- package/dist/components/motion/expandable-tabs.js +291 -0
- package/dist/components/motion/expandable-tabs.js.map +1 -0
- package/dist/components/motion/feedback-widget.d.ts +18 -0
- package/dist/components/motion/feedback-widget.d.ts.map +1 -0
- package/dist/components/motion/feedback-widget.js +413 -0
- package/dist/components/motion/feedback-widget.js.map +1 -0
- package/dist/components/motion/file-upload.d.ts +48 -0
- package/dist/components/motion/file-upload.d.ts.map +1 -0
- package/dist/components/motion/file-upload.js +382 -0
- package/dist/components/motion/file-upload.js.map +1 -0
- package/dist/components/motion/hold-action-button.js +1 -1
- package/dist/components/motion/infinite-masonry.d.ts +31 -0
- package/dist/components/motion/infinite-masonry.d.ts.map +1 -0
- package/dist/components/motion/infinite-masonry.js +223 -0
- package/dist/components/motion/infinite-masonry.js.map +1 -0
- package/dist/components/motion/input.js +1 -1
- package/dist/components/motion/loader.js +1 -1
- package/dist/components/motion/magnetic.js +1 -1
- package/dist/components/motion/morphing-modal.js +1 -1
- package/dist/components/motion/not-found/glitch.d.ts +6 -0
- package/dist/components/motion/not-found/glitch.d.ts.map +1 -0
- package/dist/components/motion/not-found/glitch.js +90 -0
- package/dist/components/motion/not-found/glitch.js.map +1 -0
- package/dist/components/motion/not-found/magnetic.d.ts +6 -0
- package/dist/components/motion/not-found/magnetic.d.ts.map +1 -0
- package/dist/components/motion/not-found/magnetic.js +47 -0
- package/dist/components/motion/not-found/magnetic.js.map +1 -0
- package/dist/components/motion/not-found/shared.d.ts +32 -0
- package/dist/components/motion/not-found/shared.d.ts.map +1 -0
- package/dist/components/motion/not-found/shared.js +52 -0
- package/dist/components/motion/not-found/shared.js.map +1 -0
- package/dist/components/motion/not-found/spotlight.d.ts +6 -0
- package/dist/components/motion/not-found/spotlight.d.ts.map +1 -0
- package/dist/components/motion/not-found/spotlight.js +70 -0
- package/dist/components/motion/not-found/spotlight.js.map +1 -0
- package/dist/components/motion/not-found/stacked.d.ts +6 -0
- package/dist/components/motion/not-found/stacked.d.ts.map +1 -0
- package/dist/components/motion/not-found/stacked.js +95 -0
- package/dist/components/motion/not-found/stacked.js.map +1 -0
- package/dist/components/motion/not-found/terminal.d.ts +6 -0
- package/dist/components/motion/not-found/terminal.d.ts.map +1 -0
- package/dist/components/motion/not-found/terminal.js +90 -0
- package/dist/components/motion/not-found/terminal.js.map +1 -0
- package/dist/components/motion/notification-stack.d.ts +35 -0
- package/dist/components/motion/notification-stack.d.ts.map +1 -0
- package/dist/components/motion/notification-stack.js +187 -0
- package/dist/components/motion/notification-stack.js.map +1 -0
- package/dist/components/motion/number-ticker.js +1 -1
- package/dist/components/motion/otp-input.d.ts +32 -0
- package/dist/components/motion/otp-input.d.ts.map +1 -0
- package/dist/components/motion/otp-input.js +272 -0
- package/dist/components/motion/otp-input.js.map +1 -0
- package/dist/components/motion/overflow-actions.d.ts +39 -0
- package/dist/components/motion/overflow-actions.d.ts.map +1 -0
- package/dist/components/motion/overflow-actions.js +220 -0
- package/dist/components/motion/overflow-actions.js.map +1 -0
- package/dist/components/motion/parallax.js +1 -1
- package/dist/components/motion/popover-morph.js +2 -2
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/popover.js +1 -1
- package/dist/components/motion/preview-rail.js +1 -1
- package/dist/components/motion/pull-to-refresh.js +2 -2
- package/dist/components/motion/pull-to-refresh.js.map +1 -1
- package/dist/components/motion/radio.js +1 -1
- package/dist/components/motion/range-slider-bubble.js +1 -1
- package/dist/components/motion/range-slider-fluid.js +1 -1
- package/dist/components/motion/range-slider-ruler.js +2 -2
- package/dist/components/motion/range-slider-ruler.js.map +1 -1
- package/dist/components/motion/range-slider-wave.js +1 -1
- package/dist/components/motion/range-slider.js +1 -1
- package/dist/components/motion/scroll-progress.js +1 -1
- package/dist/components/motion/scroll-reveal.js +1 -1
- package/dist/components/motion/select-morph.js +2 -2
- package/dist/components/motion/select.js +2 -2
- package/dist/components/motion/shader-background.js +1 -1
- package/dist/components/motion/shared-layout-bg.js +2 -2
- package/dist/components/motion/shared-layout-bg.js.map +1 -1
- package/dist/components/motion/slide-action-button.js +1 -1
- package/dist/components/motion/smooth-scroll.js +1 -1
- package/dist/components/motion/swipeable-list.d.ts +60 -0
- package/dist/components/motion/swipeable-list.d.ts.map +1 -0
- package/dist/components/motion/swipeable-list.js +254 -0
- package/dist/components/motion/swipeable-list.js.map +1 -0
- package/dist/components/motion/switch.js +1 -1
- package/dist/components/motion/table/index.js +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +2 -2
- package/dist/components/motion/table/table-menu.js +1 -1
- package/dist/components/motion/tabs.js +1 -1
- package/dist/components/motion/text-reveal.js +1 -1
- package/dist/components/motion/text-shimmer.js +1 -1
- package/dist/components/motion/text-shimmer.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +2 -2
- package/dist/components/motion/tilt-card.js +1 -1
- package/dist/components/motion/tooltip.js +1 -1
- package/dist/components/motion/wheel-picker.js +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/alert.js +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +2 -2
- package/dist/components/reui/data-grid/data-grid-column-header.js +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +1 -1
- package/dist/components/reui/date-selector.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/filters.js +2 -2
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/frame.js +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-view.js +2 -2
- package/dist/components/reui/number-field.js +1 -1
- package/dist/components/reui/phone-input.js +2 -2
- package/dist/components/reui/rating.js +1 -1
- package/dist/components/reui/tree.js +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/attachment.js +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/empty.js +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/marker.js +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/sonner.js +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/copy-menu-BJ-MXnkN.js +201 -0
- package/dist/copy-menu-BJ-MXnkN.js.map +1 -0
- package/dist/types-smkWN_7x.d.ts +20 -0
- package/dist/types-smkWN_7x.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { cn } from "@kumix/utils";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { animate, motion, useMotionValue, useReducedMotion } from "motion/react";
|
|
6
|
+
//#region src/components/motion/swipeable-list.tsx
|
|
7
|
+
const ROW_SETTLE = {
|
|
8
|
+
type: "spring",
|
|
9
|
+
stiffness: 560,
|
|
10
|
+
damping: 48,
|
|
11
|
+
mass: .82,
|
|
12
|
+
restDelta: .5,
|
|
13
|
+
restSpeed: 8
|
|
14
|
+
};
|
|
15
|
+
const OPEN_DISTANCE_RATIO = .46;
|
|
16
|
+
const CLOSE_DISTANCE_RATIO = .72;
|
|
17
|
+
const OPEN_VELOCITY = 720;
|
|
18
|
+
const CLOSE_VELOCITY = 320;
|
|
19
|
+
const FLING_DISTANCE = 14;
|
|
20
|
+
const RELEASE_VELOCITY_LIMIT = 1500;
|
|
21
|
+
const ACTION_TONE_CLASS = {
|
|
22
|
+
neutral: "text-muted-foreground group-hover:text-foreground",
|
|
23
|
+
primary: "text-foreground",
|
|
24
|
+
success: "text-emerald-600 dark:text-emerald-400",
|
|
25
|
+
warning: "text-amber-600 dark:text-amber-400",
|
|
26
|
+
danger: "text-destructive"
|
|
27
|
+
};
|
|
28
|
+
function useControllableSwipeValue({ value, defaultValue, onValueChange }) {
|
|
29
|
+
const [internalValue, setInternalValue] = useState(defaultValue ?? null);
|
|
30
|
+
const isControlled = value !== void 0;
|
|
31
|
+
return [value ?? internalValue, useCallback((next) => {
|
|
32
|
+
if (!isControlled) setInternalValue(next);
|
|
33
|
+
onValueChange?.(next);
|
|
34
|
+
}, [isControlled, onValueChange])];
|
|
35
|
+
}
|
|
36
|
+
function isActionableSide(value, sideWidth) {
|
|
37
|
+
return sideWidth > 0 && Math.abs(value) > 0;
|
|
38
|
+
}
|
|
39
|
+
function clampReleaseVelocity(velocity) {
|
|
40
|
+
return Math.max(-1500, Math.min(RELEASE_VELOCITY_LIMIT, velocity));
|
|
41
|
+
}
|
|
42
|
+
function SwipeActionButton({ action, actionWidth, side, focusable, onAction, className }) {
|
|
43
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
disabled: action.disabled,
|
|
46
|
+
tabIndex: focusable ? 0 : -1,
|
|
47
|
+
"aria-label": typeof action.label === "string" ? action.label : void 0,
|
|
48
|
+
onClick: () => onAction(action, side),
|
|
49
|
+
className: cn("group flex h-full shrink-0 items-center justify-center outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:pointer-events-none disabled:opacity-50", className),
|
|
50
|
+
style: { width: actionWidth },
|
|
51
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
52
|
+
className: cn("grid h-9 w-9 place-items-center rounded-full transition-[background-color,color,transform] duration-150 group-hover:bg-background group-active:scale-95", ACTION_TONE_CLASS[action.tone ?? "neutral"]),
|
|
53
|
+
children: action.icon
|
|
54
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
55
|
+
className: "sr-only",
|
|
56
|
+
children: action.label
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function SwipeableListRow({ item, actionWidth, revealThreshold, openValue, setOpenValue, closeOnAction, onAction, classNames, renderItem }) {
|
|
61
|
+
const reduce = useReducedMotion();
|
|
62
|
+
const x = useMotionValue(0);
|
|
63
|
+
const animationRef = useRef(null);
|
|
64
|
+
const commandedTargetRef = useRef(0);
|
|
65
|
+
const leftActions = item.leftActions ?? [];
|
|
66
|
+
const rightActions = item.rightActions ?? [];
|
|
67
|
+
const leftWidth = leftActions.length * actionWidth;
|
|
68
|
+
const rightWidth = rightActions.length * actionWidth;
|
|
69
|
+
const openSide = openValue?.id === item.id ? openValue.side : null;
|
|
70
|
+
const targetX = openSide === "left" ? leftWidth : openSide === "right" ? -rightWidth : 0;
|
|
71
|
+
const settleX = useCallback((nextX, velocity = 0) => {
|
|
72
|
+
commandedTargetRef.current = nextX;
|
|
73
|
+
animationRef.current?.stop();
|
|
74
|
+
if (reduce) {
|
|
75
|
+
x.set(nextX);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
animationRef.current = animate(x, nextX, {
|
|
79
|
+
...ROW_SETTLE,
|
|
80
|
+
velocity: clampReleaseVelocity(velocity),
|
|
81
|
+
onComplete: () => x.set(nextX)
|
|
82
|
+
});
|
|
83
|
+
}, [reduce, x]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
return () => animationRef.current?.stop();
|
|
86
|
+
}, []);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (commandedTargetRef.current === targetX) return;
|
|
89
|
+
settleX(targetX);
|
|
90
|
+
}, [settleX, targetX]);
|
|
91
|
+
const getTargetX = useCallback((side) => side === "left" ? leftWidth : side === "right" ? -rightWidth : 0, [leftWidth, rightWidth]);
|
|
92
|
+
const snapTo = useCallback((side, velocity = 0) => {
|
|
93
|
+
setOpenValue(side ? {
|
|
94
|
+
id: item.id,
|
|
95
|
+
side
|
|
96
|
+
} : null);
|
|
97
|
+
settleX(getTargetX(side), velocity);
|
|
98
|
+
}, [
|
|
99
|
+
getTargetX,
|
|
100
|
+
item.id,
|
|
101
|
+
setOpenValue,
|
|
102
|
+
settleX
|
|
103
|
+
]);
|
|
104
|
+
const onDragStart = useCallback(() => {
|
|
105
|
+
animationRef.current?.stop();
|
|
106
|
+
if (openValue && openValue.id !== item.id) setOpenValue(null);
|
|
107
|
+
}, [
|
|
108
|
+
item.id,
|
|
109
|
+
openValue,
|
|
110
|
+
setOpenValue
|
|
111
|
+
]);
|
|
112
|
+
const onDragEnd = useCallback((_, info) => {
|
|
113
|
+
const velocity = info.velocity.x;
|
|
114
|
+
const latest = x.get();
|
|
115
|
+
const leftOpenThreshold = Math.max(revealThreshold, leftWidth * OPEN_DISTANCE_RATIO);
|
|
116
|
+
const rightOpenThreshold = Math.max(revealThreshold, rightWidth * OPEN_DISTANCE_RATIO);
|
|
117
|
+
if (openSide === "left") {
|
|
118
|
+
if (latest < leftWidth * CLOSE_DISTANCE_RATIO || velocity < -320) {
|
|
119
|
+
snapTo(null, velocity);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
snapTo("left", velocity);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (openSide === "right") {
|
|
126
|
+
if (Math.abs(latest) < rightWidth * CLOSE_DISTANCE_RATIO || velocity > CLOSE_VELOCITY) {
|
|
127
|
+
snapTo(null, velocity);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
snapTo("right", velocity);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (isActionableSide(latest, leftWidth) && (latest > leftOpenThreshold || velocity > OPEN_VELOCITY && latest > FLING_DISTANCE)) {
|
|
134
|
+
snapTo("left", velocity);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (isActionableSide(latest, rightWidth) && (latest < -rightOpenThreshold || velocity < -720 && latest < -14)) {
|
|
138
|
+
snapTo("right", velocity);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
snapTo(null, velocity);
|
|
142
|
+
}, [
|
|
143
|
+
leftWidth,
|
|
144
|
+
openSide,
|
|
145
|
+
revealThreshold,
|
|
146
|
+
rightWidth,
|
|
147
|
+
snapTo,
|
|
148
|
+
x
|
|
149
|
+
]);
|
|
150
|
+
const handleAction = useCallback((action, side) => {
|
|
151
|
+
action.onClick?.(item);
|
|
152
|
+
onAction?.({
|
|
153
|
+
item,
|
|
154
|
+
action,
|
|
155
|
+
side
|
|
156
|
+
});
|
|
157
|
+
if (closeOnAction) snapTo(null);
|
|
158
|
+
}, [
|
|
159
|
+
closeOnAction,
|
|
160
|
+
item,
|
|
161
|
+
onAction,
|
|
162
|
+
snapTo
|
|
163
|
+
]);
|
|
164
|
+
const defaultContent = /* @__PURE__ */ jsxs("div", {
|
|
165
|
+
className: "flex min-w-0 items-center gap-3",
|
|
166
|
+
children: [
|
|
167
|
+
item.leading ? /* @__PURE__ */ jsx("div", {
|
|
168
|
+
className: cn("shrink-0", classNames?.leading),
|
|
169
|
+
children: item.leading
|
|
170
|
+
}) : null,
|
|
171
|
+
/* @__PURE__ */ jsxs("div", {
|
|
172
|
+
className: cn("min-w-0 flex-1", classNames?.content),
|
|
173
|
+
children: [item.title ? /* @__PURE__ */ jsx("div", {
|
|
174
|
+
className: cn("truncate font-medium text-foreground text-sm", classNames?.title),
|
|
175
|
+
children: item.title
|
|
176
|
+
}) : null, item.description ? /* @__PURE__ */ jsx("div", {
|
|
177
|
+
className: cn("mt-0.5 truncate text-muted-foreground text-xs", classNames?.description),
|
|
178
|
+
children: item.description
|
|
179
|
+
}) : null]
|
|
180
|
+
}),
|
|
181
|
+
item.meta ? /* @__PURE__ */ jsx("div", {
|
|
182
|
+
className: cn("shrink-0 font-medium text-muted-foreground text-xs", classNames?.meta),
|
|
183
|
+
children: item.meta
|
|
184
|
+
}) : null
|
|
185
|
+
]
|
|
186
|
+
});
|
|
187
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
188
|
+
className: cn("relative isolate overflow-hidden rounded-2xl bg-muted", item.disabled && "opacity-60", classNames?.item),
|
|
189
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
190
|
+
"aria-hidden": !openSide,
|
|
191
|
+
inert: !openSide,
|
|
192
|
+
className: cn("absolute inset-0 z-0 flex overflow-hidden rounded-2xl", classNames?.rail),
|
|
193
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
194
|
+
className: "flex h-full overflow-hidden rounded-l-2xl",
|
|
195
|
+
children: leftActions.map((action) => /* @__PURE__ */ jsx(SwipeActionButton, {
|
|
196
|
+
action,
|
|
197
|
+
actionWidth,
|
|
198
|
+
className: classNames?.action,
|
|
199
|
+
focusable: openSide === "left",
|
|
200
|
+
onAction: handleAction,
|
|
201
|
+
side: "left"
|
|
202
|
+
}, action.id))
|
|
203
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
204
|
+
className: "ml-auto flex h-full overflow-hidden rounded-r-2xl",
|
|
205
|
+
children: rightActions.map((action) => /* @__PURE__ */ jsx(SwipeActionButton, {
|
|
206
|
+
action,
|
|
207
|
+
actionWidth,
|
|
208
|
+
className: classNames?.action,
|
|
209
|
+
focusable: openSide === "right",
|
|
210
|
+
onAction: handleAction,
|
|
211
|
+
side: "right"
|
|
212
|
+
}, action.id))
|
|
213
|
+
})]
|
|
214
|
+
}), /* @__PURE__ */ jsx(motion.div, {
|
|
215
|
+
drag: item.disabled ? false : "x",
|
|
216
|
+
dragConstraints: {
|
|
217
|
+
left: -rightWidth,
|
|
218
|
+
right: leftWidth
|
|
219
|
+
},
|
|
220
|
+
dragElastic: .04,
|
|
221
|
+
dragMomentum: false,
|
|
222
|
+
onDragStart,
|
|
223
|
+
onDragEnd,
|
|
224
|
+
style: { x },
|
|
225
|
+
className: cn("relative z-10 min-h-[72px] cursor-grab touch-pan-y select-none rounded-2xl border border-border bg-card px-4 py-3 shadow-sm active:cursor-grabbing", classNames?.surface),
|
|
226
|
+
children: renderItem ? renderItem(item) : item.content ?? defaultContent
|
|
227
|
+
})]
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function SwipeableList({ items, value, defaultValue = null, onValueChange, onAction, actionWidth = 56, revealThreshold = 34, closeOnAction = true, className, classNames, renderItem }) {
|
|
231
|
+
const [openValue, setOpenValue] = useControllableSwipeValue({
|
|
232
|
+
value,
|
|
233
|
+
defaultValue,
|
|
234
|
+
onValueChange
|
|
235
|
+
});
|
|
236
|
+
return /* @__PURE__ */ jsx("div", {
|
|
237
|
+
className: cn("flex w-full flex-col gap-2", className, classNames?.root),
|
|
238
|
+
children: items.map((item) => /* @__PURE__ */ jsx(SwipeableListRow, {
|
|
239
|
+
item,
|
|
240
|
+
actionWidth,
|
|
241
|
+
revealThreshold,
|
|
242
|
+
openValue,
|
|
243
|
+
setOpenValue,
|
|
244
|
+
closeOnAction,
|
|
245
|
+
onAction,
|
|
246
|
+
classNames,
|
|
247
|
+
renderItem
|
|
248
|
+
}, item.id))
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
252
|
+
export { SwipeableList };
|
|
253
|
+
|
|
254
|
+
//# sourceMappingURL=swipeable-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swipeable-list.js","names":[],"sources":["../../../src/components/motion/swipeable-list.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { animate, motion, type PanInfo, useMotionValue, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\nexport type SwipeSide = \"left\" | \"right\";\n\nexport type SwipeableListValue = {\n id: string;\n side: SwipeSide;\n};\n\nexport type SwipeActionTone = \"neutral\" | \"primary\" | \"success\" | \"warning\" | \"danger\";\n\nexport type SwipeAction = {\n id: string;\n label: ReactNode;\n icon: ReactNode;\n tone?: SwipeActionTone;\n disabled?: boolean;\n onClick?: (item: SwipeableListItem) => void;\n};\n\nexport type SwipeableListItem = {\n id: string;\n title?: ReactNode;\n description?: ReactNode;\n meta?: ReactNode;\n leading?: ReactNode;\n content?: ReactNode;\n leftActions?: SwipeAction[];\n rightActions?: SwipeAction[];\n disabled?: boolean;\n};\n\nexport type SwipeableListClassNames = {\n root?: string;\n item?: string;\n rail?: string;\n action?: string;\n surface?: string;\n leading?: string;\n content?: string;\n title?: string;\n description?: string;\n meta?: string;\n};\n\nexport interface SwipeableListProps {\n items: SwipeableListItem[];\n value?: SwipeableListValue | null;\n defaultValue?: SwipeableListValue | null;\n onValueChange?: (value: SwipeableListValue | null) => void;\n onAction?: (payload: { item: SwipeableListItem; action: SwipeAction; side: SwipeSide }) => void;\n actionWidth?: number;\n revealThreshold?: number;\n closeOnAction?: boolean;\n className?: string;\n classNames?: SwipeableListClassNames;\n renderItem?: (item: SwipeableListItem) => ReactNode;\n}\n\n// Distance-based release spring keeps short rebounds and full reveals feeling\n// equally direct, closer to native mobile list interactions.\nconst ROW_SETTLE = {\n type: \"spring\",\n stiffness: 560,\n damping: 48,\n mass: 0.82,\n restDelta: 0.5,\n restSpeed: 8,\n} as const;\nconst OPEN_DISTANCE_RATIO = 0.46;\nconst CLOSE_DISTANCE_RATIO = 0.72;\nconst OPEN_VELOCITY = 720;\nconst CLOSE_VELOCITY = 320;\nconst FLING_DISTANCE = 14;\nconst RELEASE_VELOCITY_LIMIT = 1500;\n\nconst ACTION_TONE_CLASS: Record<SwipeActionTone, string> = {\n neutral: \"text-muted-foreground group-hover:text-foreground\",\n primary: \"text-foreground\",\n success: \"text-emerald-600 dark:text-emerald-400\",\n warning: \"text-amber-600 dark:text-amber-400\",\n danger: \"text-destructive\",\n};\n\nfunction useControllableSwipeValue({\n value,\n defaultValue,\n onValueChange,\n}: {\n value?: SwipeableListValue | null;\n defaultValue?: SwipeableListValue | null;\n onValueChange?: (value: SwipeableListValue | null) => void;\n}) {\n const [internalValue, setInternalValue] = useState(defaultValue ?? null);\n const isControlled = value !== undefined;\n const currentValue = value ?? internalValue;\n\n const setValue = useCallback(\n (next: SwipeableListValue | null) => {\n if (!isControlled) {\n setInternalValue(next);\n }\n\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n return [currentValue, setValue] as const;\n}\n\nfunction isActionableSide(value: number, sideWidth: number) {\n return sideWidth > 0 && Math.abs(value) > 0;\n}\n\nfunction clampReleaseVelocity(velocity: number) {\n return Math.max(-RELEASE_VELOCITY_LIMIT, Math.min(RELEASE_VELOCITY_LIMIT, velocity));\n}\n\nfunction SwipeActionButton({\n action,\n actionWidth,\n side,\n focusable,\n onAction,\n className,\n}: {\n action: SwipeAction;\n actionWidth: number;\n side: SwipeSide;\n focusable: boolean;\n onAction: (action: SwipeAction, side: SwipeSide) => void;\n className?: string;\n}) {\n return (\n <button\n type=\"button\"\n disabled={action.disabled}\n tabIndex={focusable ? 0 : -1}\n aria-label={typeof action.label === \"string\" ? action.label : undefined}\n onClick={() => onAction(action, side)}\n className={cn(\n \"group flex h-full shrink-0 items-center justify-center outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n style={{ width: actionWidth }}\n >\n <span\n className={cn(\n \"grid h-9 w-9 place-items-center rounded-full transition-[background-color,color,transform] duration-150 group-hover:bg-background group-active:scale-95\",\n ACTION_TONE_CLASS[action.tone ?? \"neutral\"],\n )}\n >\n {action.icon}\n </span>\n <span className=\"sr-only\">{action.label}</span>\n </button>\n );\n}\n\nfunction SwipeableListRow({\n item,\n actionWidth,\n revealThreshold,\n openValue,\n setOpenValue,\n closeOnAction,\n onAction,\n classNames,\n renderItem,\n}: {\n item: SwipeableListItem;\n actionWidth: number;\n revealThreshold: number;\n openValue: SwipeableListValue | null;\n setOpenValue: (value: SwipeableListValue | null) => void;\n closeOnAction: boolean;\n onAction?: SwipeableListProps[\"onAction\"];\n classNames?: SwipeableListClassNames;\n renderItem?: (item: SwipeableListItem) => ReactNode;\n}) {\n const reduce = useReducedMotion();\n const x = useMotionValue(0);\n const animationRef = useRef<{ stop: () => void } | null>(null);\n const commandedTargetRef = useRef(0);\n const leftActions = item.leftActions ?? [];\n const rightActions = item.rightActions ?? [];\n const leftWidth = leftActions.length * actionWidth;\n const rightWidth = rightActions.length * actionWidth;\n const openSide = openValue?.id === item.id ? openValue.side : null;\n const targetX = openSide === \"left\" ? leftWidth : openSide === \"right\" ? -rightWidth : 0;\n\n const settleX = useCallback(\n (nextX: number, velocity = 0) => {\n commandedTargetRef.current = nextX;\n animationRef.current?.stop();\n\n if (reduce) {\n x.set(nextX);\n return;\n }\n\n animationRef.current = animate(x, nextX, {\n ...ROW_SETTLE,\n velocity: clampReleaseVelocity(velocity),\n onComplete: () => x.set(nextX),\n });\n },\n [reduce, x],\n );\n\n useEffect(() => {\n return () => animationRef.current?.stop();\n }, []);\n\n useEffect(() => {\n if (commandedTargetRef.current === targetX) {\n return;\n }\n\n settleX(targetX);\n }, [settleX, targetX]);\n\n const getTargetX = useCallback(\n (side: SwipeSide | null) => (side === \"left\" ? leftWidth : side === \"right\" ? -rightWidth : 0),\n [leftWidth, rightWidth],\n );\n\n const snapTo = useCallback(\n (side: SwipeSide | null, velocity = 0) => {\n setOpenValue(side ? { id: item.id, side } : null);\n settleX(getTargetX(side), velocity);\n },\n [getTargetX, item.id, setOpenValue, settleX],\n );\n\n const onDragStart = useCallback(() => {\n animationRef.current?.stop();\n\n if (openValue && openValue.id !== item.id) {\n setOpenValue(null);\n }\n }, [item.id, openValue, setOpenValue]);\n\n const onDragEnd = useCallback(\n (_: PointerEvent, info: PanInfo) => {\n const velocity = info.velocity.x;\n const latest = x.get();\n const leftOpenThreshold = Math.max(revealThreshold, leftWidth * OPEN_DISTANCE_RATIO);\n const rightOpenThreshold = Math.max(revealThreshold, rightWidth * OPEN_DISTANCE_RATIO);\n\n if (openSide === \"left\") {\n if (latest < leftWidth * CLOSE_DISTANCE_RATIO || velocity < -CLOSE_VELOCITY) {\n snapTo(null, velocity);\n return;\n }\n\n snapTo(\"left\", velocity);\n return;\n }\n\n if (openSide === \"right\") {\n if (Math.abs(latest) < rightWidth * CLOSE_DISTANCE_RATIO || velocity > CLOSE_VELOCITY) {\n snapTo(null, velocity);\n return;\n }\n\n snapTo(\"right\", velocity);\n return;\n }\n\n if (\n isActionableSide(latest, leftWidth) &&\n (latest > leftOpenThreshold || (velocity > OPEN_VELOCITY && latest > FLING_DISTANCE))\n ) {\n snapTo(\"left\", velocity);\n return;\n }\n\n if (\n isActionableSide(latest, rightWidth) &&\n (latest < -rightOpenThreshold || (velocity < -OPEN_VELOCITY && latest < -FLING_DISTANCE))\n ) {\n snapTo(\"right\", velocity);\n return;\n }\n\n snapTo(null, velocity);\n },\n [leftWidth, openSide, revealThreshold, rightWidth, snapTo, x],\n );\n\n const handleAction = useCallback(\n (action: SwipeAction, side: SwipeSide) => {\n action.onClick?.(item);\n onAction?.({ item, action, side });\n\n if (closeOnAction) {\n snapTo(null);\n }\n },\n [closeOnAction, item, onAction, snapTo],\n );\n\n const defaultContent = (\n <div className=\"flex min-w-0 items-center gap-3\">\n {item.leading ? (\n <div className={cn(\"shrink-0\", classNames?.leading)}>{item.leading}</div>\n ) : null}\n <div className={cn(\"min-w-0 flex-1\", classNames?.content)}>\n {item.title ? (\n <div className={cn(\"truncate font-medium text-foreground text-sm\", classNames?.title)}>\n {item.title}\n </div>\n ) : null}\n {item.description ? (\n <div\n className={cn(\"mt-0.5 truncate text-muted-foreground text-xs\", classNames?.description)}\n >\n {item.description}\n </div>\n ) : null}\n </div>\n {item.meta ? (\n <div className={cn(\"shrink-0 font-medium text-muted-foreground text-xs\", classNames?.meta)}>\n {item.meta}\n </div>\n ) : null}\n </div>\n );\n\n return (\n <div\n className={cn(\n \"relative isolate overflow-hidden rounded-2xl bg-muted\",\n item.disabled && \"opacity-60\",\n classNames?.item,\n )}\n >\n <div\n aria-hidden={!openSide}\n inert={!openSide}\n className={cn(\"absolute inset-0 z-0 flex overflow-hidden rounded-2xl\", classNames?.rail)}\n >\n <div className=\"flex h-full overflow-hidden rounded-l-2xl\">\n {leftActions.map((action) => (\n <SwipeActionButton\n key={action.id}\n action={action}\n actionWidth={actionWidth}\n className={classNames?.action}\n focusable={openSide === \"left\"}\n onAction={handleAction}\n side=\"left\"\n />\n ))}\n </div>\n <div className=\"ml-auto flex h-full overflow-hidden rounded-r-2xl\">\n {rightActions.map((action) => (\n <SwipeActionButton\n key={action.id}\n action={action}\n actionWidth={actionWidth}\n className={classNames?.action}\n focusable={openSide === \"right\"}\n onAction={handleAction}\n side=\"right\"\n />\n ))}\n </div>\n </div>\n\n <motion.div\n drag={item.disabled ? false : \"x\"}\n dragConstraints={{ left: -rightWidth, right: leftWidth }}\n dragElastic={0.04}\n dragMomentum={false}\n onDragStart={onDragStart}\n onDragEnd={onDragEnd}\n style={{ x }}\n className={cn(\n \"relative z-10 min-h-[72px] cursor-grab touch-pan-y select-none rounded-2xl border border-border bg-card px-4 py-3 shadow-sm active:cursor-grabbing\",\n classNames?.surface,\n )}\n >\n {renderItem ? renderItem(item) : (item.content ?? defaultContent)}\n </motion.div>\n </div>\n );\n}\n\nexport function SwipeableList({\n items,\n value,\n defaultValue = null,\n onValueChange,\n onAction,\n actionWidth = 56,\n revealThreshold = 34,\n closeOnAction = true,\n className,\n classNames,\n renderItem,\n}: SwipeableListProps) {\n const [openValue, setOpenValue] = useControllableSwipeValue({\n value,\n defaultValue,\n onValueChange,\n });\n\n return (\n <div className={cn(\"flex w-full flex-col gap-2\", className, classNames?.root)}>\n {items.map((item) => (\n <SwipeableListRow\n key={item.id}\n item={item}\n actionWidth={actionWidth}\n revealThreshold={revealThreshold}\n openValue={openValue}\n setOpenValue={setOpenValue}\n closeOnAction={closeOnAction}\n onAction={onAction}\n classNames={classNames}\n renderItem={renderItem}\n />\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;AAkEA,MAAM,aAAa;CACjB,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;CACN,WAAW;CACX,WAAW;AACb;AACA,MAAM,sBAAsB;AAC5B,MAAM,uBAAuB;AAC7B,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AACvB,MAAM,yBAAyB;AAE/B,MAAM,oBAAqD;CACz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AC1D;EACA;EACA;CACF,CAAC;CAED,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,8BAA8B,WAAW,YAAY,IAAI;EACzE,UAAA,MAAM,KAAK,SACV,oBAAC,kBAAD;GAEQ;GACO;GACI;GACN;GACG;GACC;GACL;GACE;GACA;EACb,GAVM,KAAK,EAUX,CACF;CACE,CAAA;AAET"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { cn } from "@kumix/utils";
|
|
4
|
-
import { MotionConfig, animate, motion, useReducedMotion } from "motion/react";
|
|
5
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { MotionConfig, animate, motion, useReducedMotion } from "motion/react";
|
|
6
6
|
//#region src/components/motion/switch.tsx
|
|
7
7
|
const THUMB_SPRING = {
|
|
8
8
|
type: "spring",
|
|
@@ -7,8 +7,8 @@ import { SkeletonRows } from "./skeleton-rows.js";
|
|
|
7
7
|
import { TableHeader } from "./table-header.js";
|
|
8
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { cn } from "@kumix/utils";
|
|
10
|
-
import { useReducedMotion } from "motion/react";
|
|
11
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useReducedMotion } from "motion/react";
|
|
12
12
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
13
13
|
//#region src/components/motion/table/use-column-reorder.ts
|
|
14
14
|
function useColumnReorder({ columns, thRefs, onColumnOrderChange }) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { TableMenu } from "./table-menu.js";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
import { ArrowDownToLine, ArrowUpToLine, MoreVertical, Trash2 } from "lucide-react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
//#region src/components/motion/table/row-handle.tsx
|
|
8
8
|
/** The row handle, portaled so it can sit on the row's left border without the
|
|
@@ -5,9 +5,9 @@ import { TableMenu } from "./table-menu.js";
|
|
|
5
5
|
import { i as alignText, n as COLUMN_ACTIVE_SHADOW, r as alignFlex } from "../../../utils-DQ7OpbYQ.js";
|
|
6
6
|
import { useEffect } from "react";
|
|
7
7
|
import { cn } from "@kumix/utils";
|
|
8
|
-
import { motion } from "motion/react";
|
|
9
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
8
|
import { ArrowLeftToLine, ArrowRightToLine, ChevronUp, GripVertical, MoreHorizontal, Trash2 } from "lucide-react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { motion } from "motion/react";
|
|
11
11
|
import { createPortal } from "react-dom";
|
|
12
12
|
//#region src/components/motion/table/table-header.tsx
|
|
13
13
|
/** Column insert / delete menu items shared by the header cell and the portal handle. */
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { SPRING_PANEL } from "../../../lib/ease.js";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { motion, useReducedMotion } from "motion/react";
|
|
6
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
7
7
|
import { createPortal } from "react-dom";
|
|
8
8
|
//#region src/components/motion/table/table-menu.tsx
|
|
9
9
|
const MENU_WIDTH = 188;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
3
|
import { createContext, useCallback, useContext, useId, useMemo, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { MotionConfig, motion, useReducedMotion } from "motion/react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { MotionConfig, motion, useReducedMotion } from "motion/react";
|
|
7
7
|
//#region src/components/motion/tabs.tsx
|
|
8
8
|
const TabsCtx = createContext(null);
|
|
9
9
|
function useTabs() {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
3
|
import { useRef } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { motion, useInView, useReducedMotion } from "motion/react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { motion, useInView, useReducedMotion } from "motion/react";
|
|
7
7
|
//#region src/components/motion/text-reveal.tsx
|
|
8
8
|
const DEFAULT_SPRING = {
|
|
9
9
|
stiffness: 140,
|
|
@@ -5,7 +5,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
function TextShimmer({ children, as: Comp = "span", duration = 2.5, className }) {
|
|
6
6
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("style", { children: `@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}` }), /* @__PURE__ */ jsx(Comp, {
|
|
7
7
|
style: { animation: `beui-text-shimmer ${duration}s linear infinite` },
|
|
8
|
-
className: cn("inline-block bg-[
|
|
8
|
+
className: cn("inline-block bg-size-[200%_100%] bg-clip-text text-transparent", "bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]", className),
|
|
9
9
|
children
|
|
10
10
|
})] });
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-shimmer.js","names":[],"sources":["../../../src/components/motion/text-shimmer.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ElementType, ReactNode } from \"react\";\n\nimport { cn } from \"@kumix/utils\";\n\nexport interface TextShimmerProps {\n children: ReactNode;\n as?: ElementType;\n duration?: number;\n className?: string;\n}\n\nexport function TextShimmer({\n children,\n as: Comp = \"span\",\n duration = 2.5,\n className,\n}: TextShimmerProps) {\n return (\n <>\n <style>\n {`@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}`}\n </style>\n <Comp\n style={{ animation: `beui-text-shimmer ${duration}s linear infinite` }}\n className={cn(\n \"inline-block bg-[
|
|
1
|
+
{"version":3,"file":"text-shimmer.js","names":[],"sources":["../../../src/components/motion/text-shimmer.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ElementType, ReactNode } from \"react\";\n\nimport { cn } from \"@kumix/utils\";\n\nexport interface TextShimmerProps {\n children: ReactNode;\n as?: ElementType;\n duration?: number;\n className?: string;\n}\n\nexport function TextShimmer({\n children,\n as: Comp = \"span\",\n duration = 2.5,\n className,\n}: TextShimmerProps) {\n return (\n <>\n <style>\n {`@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}`}\n </style>\n <Comp\n style={{ animation: `beui-text-shimmer ${duration}s linear infinite` }}\n className={cn(\n \"inline-block bg-size-[200%_100%] bg-clip-text text-transparent\",\n \"bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]\",\n className,\n )}\n >\n {children}\n </Comp>\n </>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,YAAY,EAC1B,UACA,IAAI,OAAO,QACX,WAAW,KACX,aACmB;CACnB,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,SAAD,EAAA,UACG,gGACI,CAAA,GACP,oBAAC,MAAD;EACE,OAAO,EAAE,WAAW,qBAAqB,SAAS,mBAAmB;EACrE,WAAW,GACT,kEACA,8GACA,SACF;EAEC;CACG,CAAA,CACN,EAAA,CAAA;AAEN"}
|
|
@@ -4,9 +4,9 @@ import { ActionSwapIcon } from "./action-swap.js";
|
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
6
|
import { useTheme } from "next-themes";
|
|
7
|
-
import { useReducedMotion } from "motion/react";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
7
|
import { Moon, Sun } from "lucide-react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { useReducedMotion } from "motion/react";
|
|
10
10
|
//#region src/components/motion/theme-toggle.tsx
|
|
11
11
|
const VT_STYLE_ID = "beui-theme-toggle-vt";
|
|
12
12
|
const VT_CSS = `
|
|
@@ -3,8 +3,8 @@ import { useHoverCapable } from "../../hooks/use-hover-capable.js";
|
|
|
3
3
|
import { SPRING_MOUSE } from "../../lib/ease.js";
|
|
4
4
|
import { useRef } from "react";
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
|
-
import { motion, useMotionTemplate, useMotionValue, useReducedMotion, useSpring } from "motion/react";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { motion, useMotionTemplate, useMotionValue, useReducedMotion, useSpring } from "motion/react";
|
|
8
8
|
//#region src/components/motion/tilt-card.tsx
|
|
9
9
|
function TiltCard({ children, max = 12, glare = true, className }) {
|
|
10
10
|
const ref = useRef(null);
|
|
@@ -3,8 +3,8 @@ import { useHoverCapable } from "../../hooks/use-hover-capable.js";
|
|
|
3
3
|
import { EASE_OUT } from "../../lib/ease.js";
|
|
4
4
|
import { cloneElement, isValidElement, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
|
-
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
7
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
8
8
|
import { createPortal } from "react-dom";
|
|
9
9
|
//#region src/components/motion/tooltip.tsx
|
|
10
10
|
const GAP = 8;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { createTickPlayer } from "../../lib/tick-sound.js";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { useReducedMotion } from "motion/react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useReducedMotion } from "motion/react";
|
|
7
7
|
//#region src/components/motion/wheel-picker.tsx
|
|
8
8
|
const DEG = Math.PI / 180;
|
|
9
9
|
const DECELERATION = 42e-5;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from "class-variance-authority";
|
|
2
2
|
//#region src/components/reui/alert.d.ts
|
|
3
3
|
declare const alertVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "default" | "success" | "destructive" | "info" | "warning" | "invert" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): import("react").JSX.Element;
|
|
7
7
|
declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "@kumix/utils";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { cva } from "class-variance-authority";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/reui/alert.tsx
|
|
6
6
|
const alertVariants = cva([
|
|
7
7
|
"relative grid w-full grid-cols-[0_1fr] items-center gap-y-0.5 border text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*3)_1fr] [&>svg:not([class*=size-])]:size-4",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ScrollArea } from "../ui/scroll-area.js";
|
|
3
3
|
import { cn } from "@kumix/utils";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import { ChevronsUpDownIcon, XIcon } from "lucide-react";
|
|
6
5
|
import { cva } from "class-variance-authority";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { Autocomplete as Autocomplete$1 } from "@base-ui/react/autocomplete";
|
|
8
8
|
//#region src/components/reui/autocomplete.tsx
|
|
9
9
|
const inputVariants = cva("flex w-full rounded-lg border border-input bg-transparent text-foreground text-sm outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [[readonly]]:cursor-not-allowed [[readonly]]:bg-muted/80", {
|
|
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { useRender } from "@base-ui/react/use-render";
|
|
3
3
|
//#region src/components/reui/badge.d.ts
|
|
4
4
|
declare const badgeVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "outline" | "secondary" | "default" | "success" | "destructive" | "info" | "warning" | "invert" | "focus" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
|
|
6
6
|
size?: "default" | "sm" | "lg" | "xs" | "xl" | null | undefined;
|
|
7
7
|
radius?: "default" | "full" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use no memo";
|
|
3
|
-
import { Badge } from "../badge.js";
|
|
4
3
|
import { Button } from "../../ui/button.js";
|
|
4
|
+
import { Badge } from "../badge.js";
|
|
5
5
|
import { Input } from "../../ui/input.js";
|
|
6
6
|
import { Separator } from "../../ui/separator.js";
|
|
7
7
|
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
8
8
|
import { useMemo, useState } from "react";
|
|
9
9
|
import { cn } from "@kumix/utils";
|
|
10
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { CheckIcon, CirclePlusIcon } from "lucide-react";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
//#region src/components/reui/data-grid/data-grid-column-filter.tsx
|
|
13
13
|
function DataGridColumnFilter({ column, title, options }) {
|
|
14
14
|
const facets = column?.getFacetedUniqueValues();
|
|
@@ -5,8 +5,8 @@ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe
|
|
|
5
5
|
import { getColumnHeaderLabel, useDataGrid } from "./data-grid.js";
|
|
6
6
|
import { memo, useMemo } from "react";
|
|
7
7
|
import { cn } from "@kumix/utils";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { ArrowDownIcon, ArrowLeftIcon, ArrowLeftToLineIcon, ArrowRightIcon, ArrowRightToLineIcon, ArrowUpIcon, CheckIcon, ChevronsUpDownIcon, PinOffIcon, Settings2Icon } from "lucide-react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/reui/data-grid/data-grid-column-header.tsx
|
|
11
11
|
function DataGridColumnHeaderInner({ column, title, icon, className, filter, visibility = false }) {
|
|
12
12
|
const { isLoading, table, props } = useDataGrid();
|
|
@@ -5,8 +5,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ".
|
|
|
5
5
|
import { Skeleton } from "../../ui/skeleton.js";
|
|
6
6
|
import { useDataGrid } from "./data-grid.js";
|
|
7
7
|
import { cn } from "@kumix/utils";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/reui/data-grid/data-grid-pagination.tsx
|
|
11
11
|
function DataGridPagination(props) {
|
|
12
12
|
const { table, recordCount, isLoading } = useDataGrid();
|
|
@@ -5,8 +5,8 @@ import { useDataGrid } from "./data-grid.js";
|
|
|
5
5
|
import { DataGridTableBase, DataGridTableBody, DataGridTableBodyRow, DataGridTableBodyRowCell, DataGridTableBodyRowExpandded, DataGridTableBodyRowSkeleton, DataGridTableBodyRowSkeletonCell, DataGridTableEmpty, DataGridTableFillBodyCell, DataGridTableFillHeadCell, DataGridTableFoot, DataGridTableHead, DataGridTableHeadRow, DataGridTableHeadRowCell, DataGridTableHeadRowCellResize, DataGridTableRowSpacer, DataGridTableViewport } from "./data-grid-table.js";
|
|
6
6
|
import { createContext, memo, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { cn } from "@kumix/utils";
|
|
8
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { GripHorizontalIcon } from "lucide-react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { DndContext, KeyboardSensor, MouseSensor, TouchSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
11
11
|
import { SortableContext, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
12
12
|
import { CSS } from "@dnd-kit/utilities";
|
|
@@ -4,8 +4,8 @@ import { Button } from "../../ui/button.js";
|
|
|
4
4
|
import { useDataGrid } from "./data-grid.js";
|
|
5
5
|
import { DataGridTableBase, DataGridTableBody, DataGridTableBodyRow, DataGridTableBodyRowCell, DataGridTableBodyRowExpandded, DataGridTableBodyRowSkeleton, DataGridTableBodyRowSkeletonCell, DataGridTableEmpty, DataGridTableFillBodyCell, DataGridTableFillHeadCell, DataGridTableFoot, DataGridTableHead, DataGridTableHeadRow, DataGridTableHeadRowCell, DataGridTableHeadRowCellResize, DataGridTableRowSpacer, DataGridTableViewport } from "./data-grid-table.js";
|
|
6
6
|
import { Fragment, memo, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
7
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { GripVerticalIcon } from "lucide-react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { DndContext, KeyboardSensor, MouseSensor, TouchSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
10
10
|
import { SortableContext, horizontalListSortingStrategy, sortableKeyboardCoordinates, useSortable } from "@dnd-kit/sortable";
|
|
11
11
|
import { CSS } from "@dnd-kit/utilities";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use no memo";
|
|
3
|
-
import { Checkbox } from "../../ui/checkbox.js";
|
|
4
3
|
import { Spinner } from "../../ui/spinner.js";
|
|
4
|
+
import { Checkbox } from "../../ui/checkbox.js";
|
|
5
5
|
import { useDataGrid } from "./data-grid.js";
|
|
6
6
|
import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
7
7
|
import { cn } from "@kumix/utils";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useIsMobile } from "../../hooks/use-mobile.js";
|
|
3
|
-
import { ScrollArea } from "../ui/scroll-area.js";
|
|
4
3
|
import { Button } from "../ui/button.js";
|
|
4
|
+
import { ScrollArea } from "../ui/scroll-area.js";
|
|
5
5
|
import { Calendar, CalendarDayButton } from "../ui/calendar.js";
|
|
6
6
|
import { Input } from "../ui/input.js";
|
|
7
7
|
import { Tabs, TabsList, TabsTrigger } from "../ui/tabs.js";
|
|
8
8
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
9
9
|
import { cn } from "@kumix/utils";
|
|
10
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { ChevronLeftIcon, ChevronRightIcon, CornerUpLeftIcon, CornerUpRightIcon, XIcon } from "lucide-react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { addMonths, format, isBefore, isSameMonth, parse, subMonths } from "date-fns";
|
|
13
13
|
//#region src/components/reui/date-selector.tsx
|
|
14
14
|
const DEFAULT_DATE_SELECTOR_I18N = {
|
|
@@ -6,8 +6,8 @@ import { EventCalendarViewContext, useEventCalendar, useEventCalendarSelector, u
|
|
|
6
6
|
import { EventCalendarEvent } from "./event-calendar-event.js";
|
|
7
7
|
import { useMemo } from "react";
|
|
8
8
|
import { cn } from "@kumix/utils";
|
|
9
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import { CalendarIcon } from "lucide-react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
12
12
|
import { useRender } from "@base-ui/react/use-render";
|
|
13
13
|
import { addDays, format } from "date-fns";
|
|
@@ -5,8 +5,8 @@ import { useEventCalendar, useEventCalendarSelector, useEventCalendarViewConfig,
|
|
|
5
5
|
import { markChipPress, useEventCalendarGestures, wasRecentDrag } from "./event-calendar-dnd.js";
|
|
6
6
|
import { createContext, useContext, useMemo } from "react";
|
|
7
7
|
import { cn } from "@kumix/utils";
|
|
8
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { RepeatIcon } from "lucide-react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
11
11
|
import { useRender } from "@base-ui/react/use-render";
|
|
12
12
|
import { addDays, format } from "date-fns";
|
|
@@ -7,8 +7,8 @@ import { useEventCalendarGestures, wasRecentChipPress, wasRecentDrag } from "./e
|
|
|
7
7
|
import { EVENT_CALENDAR_GHOST, EventCalendarEvent } from "./event-calendar-event.js";
|
|
8
8
|
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { cn } from "@kumix/utils";
|
|
10
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { PlusIcon } from "lucide-react";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
13
13
|
import { useRender } from "@base-ui/react/use-render";
|
|
14
14
|
import { addDays, format, getWeek } from "date-fns";
|
|
@@ -8,8 +8,8 @@ import { toZoned } from "./event-calendar-lib.js";
|
|
|
8
8
|
import { useEventCalendarNavigation, useEventCalendarSettings, useEventCalendarView, useEventCalendarViewConfig } from "./event-calendar.js";
|
|
9
9
|
import { useState } from "react";
|
|
10
10
|
import { cn } from "@kumix/utils";
|
|
11
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
11
|
import { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
12
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
14
14
|
import { useRender } from "@base-ui/react/use-render";
|
|
15
15
|
import { addDays, format } from "date-fns";
|