@kumix/ui 0.3.10 → 0.3.11
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 -14
- package/dist/components/motion/adaptive-stepper.d.ts +32 -0
- package/dist/components/motion/adaptive-stepper.d.ts.map +1 -0
- package/dist/components/motion/adaptive-stepper.js +302 -0
- package/dist/components/motion/adaptive-stepper.js.map +1 -0
- package/dist/components/motion/combobox/content.js +1 -1
- package/dist/components/motion/combobox/context.js +216 -1
- package/dist/components/motion/combobox/context.js.map +1 -0
- package/dist/components/motion/combobox/list.js +1 -1
- package/dist/components/motion/combobox/trigger.js +1 -1
- package/dist/components/motion/combobox.js +1 -1
- package/dist/components/motion/input.d.ts +2 -0
- package/dist/components/motion/input.d.ts.map +1 -1
- package/dist/components/motion/input.js +28 -25
- package/dist/components/motion/input.js.map +1 -1
- package/dist/components/motion/liquid.d.ts +30 -0
- package/dist/components/motion/liquid.d.ts.map +1 -0
- package/dist/components/motion/liquid.js +248 -0
- package/dist/components/motion/liquid.js.map +1 -0
- package/dist/components/motion/multi-select/content.d.ts +16 -0
- package/dist/components/motion/multi-select/content.d.ts.map +1 -0
- package/dist/components/motion/multi-select/content.js +91 -0
- package/dist/components/motion/multi-select/content.js.map +1 -0
- package/dist/components/motion/multi-select/context.d.ts +64 -0
- package/dist/components/motion/multi-select/context.d.ts.map +1 -0
- package/dist/{context-BizvUNZv.js → components/motion/multi-select/context.js} +44 -114
- package/dist/components/motion/multi-select/context.js.map +1 -0
- package/dist/components/motion/multi-select/index.d.ts +5 -0
- package/dist/components/motion/multi-select/index.js +6 -0
- package/dist/components/motion/multi-select/list.d.ts +40 -0
- package/dist/components/motion/multi-select/list.d.ts.map +1 -0
- package/dist/components/motion/multi-select/list.js +144 -0
- package/dist/components/motion/multi-select/list.js.map +1 -0
- package/dist/components/motion/multi-select/trigger.d.ts +22 -0
- package/dist/components/motion/multi-select/trigger.d.ts.map +1 -0
- package/dist/components/motion/multi-select/trigger.js +185 -0
- package/dist/components/motion/multi-select/trigger.js.map +1 -0
- package/dist/components/motion/signup-form.js +6 -2
- package/dist/components/motion/signup-form.js.map +1 -1
- package/dist/components/motion/table/index.js.map +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-async.js.map +1 -1
- package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-virtual.js.map +1 -1
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader.js.map +1 -1
- package/dist/components/reui/code-block/code-block.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts +117 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.js +1554 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +6 -4
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +10 -7
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +3 -2
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-i18n.d.ts +2 -0
- package/dist/components/reui/data-grid/data-grid-i18n.js +53 -0
- package/dist/components/reui/data-grid/data-grid-i18n.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-pagination.js +14 -8
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +3 -3
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +6 -4
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +2 -2
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +17 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +146 -50
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +23 -4
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +215 -68
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +276 -6
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +150 -15
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/filters/filters-advanced.js.map +1 -1
- package/dist/components/reui/filters/filters-chip.js.map +1 -1
- package/dist/components/reui/filters/filters.d.ts.map +1 -1
- package/dist/components/reui/filters/filters.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/message-scroller.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/data-grid-i18n-52UUYPbr.d.ts +66 -0
- package/dist/data-grid-i18n-52UUYPbr.d.ts.map +1 -0
- package/dist/use-active-option-CmX6Z-4S.js +86 -0
- package/dist/use-active-option-CmX6Z-4S.js.map +1 -0
- package/package.json +5 -5
- package/dist/context-BizvUNZv.js.map +0 -1
package/README.md
CHANGED
|
@@ -118,25 +118,25 @@ Base UI / shadcn base-nova. Preview: [ui.shadcn.com](https://ui.shadcn.com/docs/
|
|
|
118
118
|
|
|
119
119
|
Extended patterns. Preview: [reui.io](https://reui.io/docs).
|
|
120
120
|
|
|
121
|
-
| Module | Notes
|
|
122
|
-
| ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
123
|
-
| `alert` · `badge` | Extended variants (info/success/warning/…)
|
|
124
|
-
| `autocomplete` | Base UI autocomplete
|
|
125
|
-
| `cascader/*` | Multi-column cascading select, i18n, async
|
|
126
|
-
| `data-grid/*` |
|
|
127
|
-
| `date-selector` | Day / month / quarter / range
|
|
128
|
-
| `event-calendar/*` | Month, week, day, agenda, resource
|
|
129
|
-
| `filters/*` | Advanced filter builder (chip, date, DnD)
|
|
130
|
-
| `code-block/*` | Shiki syntax highlighting, ANSI, collapsible
|
|
131
|
-
| `frame` | Nested panel layout
|
|
132
|
-
| `gantt/*` | Day–year scales, resources, DnD
|
|
133
|
-
| `icon-stack` · `icon-tile` · `kanban` · `number-field` · `phone-input` · `rating` · `scrollspy` · `sortable` · `stepper` · `timeline` · `tree` | —
|
|
121
|
+
| Module | Notes |
|
|
122
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
123
|
+
| `alert` · `badge` | Extended variants (info/success/warning/…) |
|
|
124
|
+
| `autocomplete` | Base UI autocomplete |
|
|
125
|
+
| `cascader/*` | Multi-column cascading select, i18n, async |
|
|
126
|
+
| `data-grid/*` | Spreadsheet cell selection (ranges, clipboard, fill handle, editor), i18n, quick-create row, pagination, filters, DnD, virtual (rows + opt-in columns) |
|
|
127
|
+
| `date-selector` | Day / month / quarter / range |
|
|
128
|
+
| `event-calendar/*` | Month, week, day, agenda, resource |
|
|
129
|
+
| `filters/*` | Advanced filter builder (chip, date, DnD) |
|
|
130
|
+
| `code-block/*` | Shiki syntax highlighting, ANSI, collapsible |
|
|
131
|
+
| `frame` | Nested panel layout |
|
|
132
|
+
| `gantt/*` | Day–year scales, resources, DnD |
|
|
133
|
+
| `icon-stack` · `icon-tile` · `kanban` · `number-field` · `phone-input` · `rating` · `scrollspy` · `sortable` · `stepper` · `timeline` · `tree` | — |
|
|
134
134
|
|
|
135
135
|
### beUI (`components/motion`)
|
|
136
136
|
|
|
137
137
|
Animated components built with [Motion](https://motion.dev). Preview: [beui.dev](https://beui.dev/components/motion). Bundled — `motion`, `lenis`, `@paper-design/shaders-react` are included, no extra installs needed.
|
|
138
138
|
|
|
139
|
-
`action-swap` (4 variants: base, blur, cascade, roll) · `animated-badge` · `animated-number` · `animated-sidebar` · `animated-toast-stack` · `attachment-upload` · `availability-scheduler/*` (copy-menu, day-row, time-select) · `bloom-menu` · `bottom-sheet` · `bounce-sidebar` · `bouncy-accordion` · `button/*` (base, magnetic, metallic, stateful, `ButtonLink`) · `center-morph-modal` · `checkbox` · `chromatic-text-reveal` · `combobox` + `combobox/*` (trigger, list, content, context) · `command-palette` · `context-menu` · `cylinder-carousel` · `dock` · `drawer` · `dynamic-island` · `expandable-action-bar` · `expandable-control` · `expandable-tabs` · `expanding-arrow-button` · `feedback-widget` · `file-tree` · `file-upload` · `hold-action-button` · `infinite-masonry` · `input` · `loader` · `magnetic` · `marquee` · `morphing-modal` · `morphing-search` · `morphing-tabs` · `not-found/*` (glitch, magnetic, spotlight, stacked, terminal) · `notification-stack` · `number-ticker` · `otp-input` · `overflow-actions` · `parallax` · `popover` · `popover-morph` · `preview-rail` · `project-folder` · `pull-to-refresh` · `radio` · `range-slider` (5 variants) · `scroll-progress` · `scroll-reveal` · `scroll-to` · `select` · `select-morph` · `shader-background` · `shared-layout-bg` · `signup-form` · `slide-action-button` · `smooth-scroll` · `swipeable-list` · `switch` · `table/*` (virtualized, editable, async) · `tabs` · `text-cascade` · `text-reveal` · `text-scramble` · `text-shimmer` · `theme-toggle` · `tilt-card` · `tooltip` · `wheel-picker`
|
|
139
|
+
`action-swap` (4 variants: base, blur, cascade, roll) · `adaptive-stepper` (+ `Liquid` easing backdrop) · `animated-badge` · `animated-number` · `animated-sidebar` · `animated-toast-stack` · `attachment-upload` · `availability-scheduler/*` (copy-menu, day-row, time-select) · `bloom-menu` · `bottom-sheet` · `bounce-sidebar` · `bouncy-accordion` · `button/*` (base, magnetic, metallic, stateful, `ButtonLink`) · `center-morph-modal` · `checkbox` · `chromatic-text-reveal` · `combobox` + `combobox/*` (trigger, list, content, context) · `command-palette` · `context-menu` · `cylinder-carousel` · `dock` · `drawer` · `dynamic-island` · `expandable-action-bar` · `expandable-control` · `expandable-tabs` · `expanding-arrow-button` · `feedback-widget` · `file-tree` · `file-upload` · `hold-action-button` · `infinite-masonry` · `input` (`reserveErrorLine` reserves one validation line) · `liquid` (gooey SVG backdrop: `Liquid`, `LiquidItem`) · `loader` · `magnetic` · `marquee` · `morphing-modal` · `morphing-search` · `morphing-tabs` · `multi-select/*` (composable: trigger, list, content, context — entry `multi-select`) · `not-found/*` (glitch, magnetic, spotlight, stacked, terminal) · `notification-stack` · `number-ticker` · `otp-input` · `overflow-actions` · `parallax` · `popover` · `popover-morph` · `preview-rail` · `project-folder` · `pull-to-refresh` · `radio` · `range-slider` (5 variants) · `scroll-progress` · `scroll-reveal` · `scroll-to` · `select` · `select-morph` · `shader-background` · `shared-layout-bg` · `signup-form` · `slide-action-button` · `smooth-scroll` · `swipeable-list` · `switch` · `table/*` (virtualized, editable, async) · `tabs` · `text-cascade` · `text-reveal` · `text-scramble` · `text-shimmer` · `theme-toggle` · `tilt-card` · `tooltip` · `wheel-picker`
|
|
140
140
|
|
|
141
141
|
### beUI — AI Agents (`components/agents`)
|
|
142
142
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MouseEvent, ReactNode, Ref } from "react";
|
|
2
|
+
import { HTMLMotionProps } from "motion/react";
|
|
3
|
+
//#region src/components/motion/adaptive-stepper.d.ts
|
|
4
|
+
interface AdaptiveStepperProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
value?: number;
|
|
7
|
+
defaultValue?: number;
|
|
8
|
+
onValueChange?: (value: number) => void;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
step?: number;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
name?: string;
|
|
14
|
+
formatValueText?: (value: number) => string;
|
|
15
|
+
className?: string;
|
|
16
|
+
"aria-label"?: string;
|
|
17
|
+
}
|
|
18
|
+
declare function AdaptiveStepper({ children, value: controlledValue, defaultValue, onValueChange, min, max, step, disabled, name, formatValueText, className, "aria-label": ariaLabel }: AdaptiveStepperProps): import("react").JSX.Element;
|
|
19
|
+
interface AdaptiveStepperActionProps extends Omit<HTMLMotionProps<"button">, "children" | "onClick"> {
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
22
|
+
ref?: Ref<HTMLButtonElement>;
|
|
23
|
+
}
|
|
24
|
+
declare function AdaptiveStepperDecrement(props: AdaptiveStepperActionProps): import("react").JSX.Element;
|
|
25
|
+
interface AdaptiveStepperValueProps extends Omit<HTMLMotionProps<"output">, "children"> {
|
|
26
|
+
children?: ReactNode | ((value: number) => ReactNode);
|
|
27
|
+
}
|
|
28
|
+
declare function AdaptiveStepperValue({ children, className, style, ...props }: AdaptiveStepperValueProps): import("react").JSX.Element;
|
|
29
|
+
declare function AdaptiveStepperIncrement(props: AdaptiveStepperActionProps): import("react").JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { AdaptiveStepper, AdaptiveStepperActionProps, AdaptiveStepperDecrement, AdaptiveStepperIncrement, AdaptiveStepperProps, AdaptiveStepperValue, AdaptiveStepperValueProps };
|
|
32
|
+
//# sourceMappingURL=adaptive-stepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adaptive-stepper.d.ts","names":[],"sources":["../../../src/components/motion/adaptive-stepper.tsx"],"mappings":";;;UAmFiB;EACf,UAAU;EACV;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA,mBAAmB;EACnB;EACA;;iBAGc,kBACd,UACA,OAAO,iBACP,cACA,eACA,KACA,KACA,MACA,UACA,MACA,iBACA,yBACc,aACb,uCAAoB,IAAA;UAoGN,mCACP,KAAK;EACb,WAAW;EACX,WAAW,OAAO,WAAW;EAC7B,MAAM,IAAI;;iBA4EI,yBAAyB,OAAO,6CAA0B,IAAA;UAIzD,kCAAkC,KAAK;EACtD,WAAW,cAAc,kBAAkB;;iBAG7B,uBACd,UACA,WACA,UACG,SACF,4CAAyB,IAAA;iBA8EZ,yBAAyB,OAAO,6CAA0B,IAAA"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EASE_OUT, SPRING_PRESS } from "../../lib/ease.js";
|
|
3
|
+
import { Liquid, LiquidItem } from "./liquid.js";
|
|
4
|
+
import { createContext, useCallback, useContext, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { cn } from "@kumix/utils";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
8
|
+
import { Minus, Plus } from "lucide-react";
|
|
9
|
+
//#region src/components/motion/adaptive-stepper.tsx
|
|
10
|
+
const STEPPER_LIQUID_TRANSITION = {
|
|
11
|
+
duration: 600,
|
|
12
|
+
ease: [
|
|
13
|
+
.22,
|
|
14
|
+
1.3,
|
|
15
|
+
.71,
|
|
16
|
+
1
|
|
17
|
+
]
|
|
18
|
+
};
|
|
19
|
+
const AdaptiveStepperContext = createContext(null);
|
|
20
|
+
function useAdaptiveStepperContext(component) {
|
|
21
|
+
const context = useContext(AdaptiveStepperContext);
|
|
22
|
+
if (!context) throw new Error(`${component} must be used within <AdaptiveStepper>`);
|
|
23
|
+
return context;
|
|
24
|
+
}
|
|
25
|
+
function clamp(value, min, max) {
|
|
26
|
+
return Math.min(max, Math.max(min, value));
|
|
27
|
+
}
|
|
28
|
+
function cleanNumber(value) {
|
|
29
|
+
return Number(value.toFixed(10));
|
|
30
|
+
}
|
|
31
|
+
function nextStep(value, direction, min, max, step) {
|
|
32
|
+
if (direction === 1) {
|
|
33
|
+
const nextIndex = Math.floor((value - min) / step + 1e-10) + 1;
|
|
34
|
+
return cleanNumber(Math.min(max, min + nextIndex * step));
|
|
35
|
+
}
|
|
36
|
+
const previousIndex = Math.ceil((value - min) / step - 1e-10) - 1;
|
|
37
|
+
return cleanNumber(Math.max(min, min + previousIndex * step));
|
|
38
|
+
}
|
|
39
|
+
function mergeRefs(...refs) {
|
|
40
|
+
return (node) => {
|
|
41
|
+
for (const ref of refs) if (typeof ref === "function") ref(node);
|
|
42
|
+
else if (ref && typeof ref === "object") ref.current = node;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function AdaptiveStepper({ children, value: controlledValue, defaultValue = 0, onValueChange, min = 0, max = 10, step = 1, disabled = false, name, formatValueText, className, "aria-label": ariaLabel = "Quantity" }) {
|
|
46
|
+
const reduce = useReducedMotion() ?? false;
|
|
47
|
+
const labelId = useId();
|
|
48
|
+
const decrementRef = useRef(null);
|
|
49
|
+
const incrementRef = useRef(null);
|
|
50
|
+
const lower = Number.isFinite(min) ? min : 0;
|
|
51
|
+
const suppliedMax = Number.isFinite(max) ? max : lower;
|
|
52
|
+
const upper = suppliedMax > lower ? suppliedMax : lower;
|
|
53
|
+
const stride = Number.isFinite(step) && step > 0 ? step : 1;
|
|
54
|
+
const [internalValue, setInternalValue] = useState(() => clamp(Number.isFinite(defaultValue) ? defaultValue : lower, lower, upper));
|
|
55
|
+
const controlled = controlledValue !== void 0;
|
|
56
|
+
const suppliedValue = controlled ? controlledValue : internalValue;
|
|
57
|
+
const currentValue = clamp(Number.isFinite(suppliedValue) ? suppliedValue : lower, lower, upper);
|
|
58
|
+
const previousValueRef = useRef(currentValue);
|
|
59
|
+
const currentValueRef = useRef(currentValue);
|
|
60
|
+
const direction = currentValue === previousValueRef.current ? 0 : currentValue > previousValueRef.current ? 1 : -1;
|
|
61
|
+
useLayoutEffect(() => {
|
|
62
|
+
previousValueRef.current = currentValue;
|
|
63
|
+
currentValueRef.current = currentValue;
|
|
64
|
+
}, [currentValue]);
|
|
65
|
+
const commit = useCallback((nextValue, restoreFocus) => {
|
|
66
|
+
const next = clamp(cleanNumber(nextValue), lower, upper);
|
|
67
|
+
if (next === currentValue) return;
|
|
68
|
+
if (!controlled) setInternalValue(next);
|
|
69
|
+
onValueChange?.(next);
|
|
70
|
+
if (!restoreFocus) return;
|
|
71
|
+
requestAnimationFrame(() => {
|
|
72
|
+
if (next === upper && currentValueRef.current === upper) decrementRef.current?.focus();
|
|
73
|
+
else if (next === lower && currentValueRef.current === lower) incrementRef.current?.focus();
|
|
74
|
+
});
|
|
75
|
+
}, [
|
|
76
|
+
controlled,
|
|
77
|
+
currentValue,
|
|
78
|
+
lower,
|
|
79
|
+
onValueChange,
|
|
80
|
+
upper
|
|
81
|
+
]);
|
|
82
|
+
const decrement = useCallback((restoreFocus) => {
|
|
83
|
+
if (disabled || currentValue <= lower) return;
|
|
84
|
+
commit(nextStep(currentValue, -1, lower, upper, stride), restoreFocus);
|
|
85
|
+
}, [
|
|
86
|
+
commit,
|
|
87
|
+
currentValue,
|
|
88
|
+
disabled,
|
|
89
|
+
lower,
|
|
90
|
+
stride,
|
|
91
|
+
upper
|
|
92
|
+
]);
|
|
93
|
+
const increment = useCallback((restoreFocus) => {
|
|
94
|
+
if (disabled || currentValue >= upper) return;
|
|
95
|
+
commit(nextStep(currentValue, 1, lower, upper, stride), restoreFocus);
|
|
96
|
+
}, [
|
|
97
|
+
commit,
|
|
98
|
+
currentValue,
|
|
99
|
+
disabled,
|
|
100
|
+
lower,
|
|
101
|
+
stride,
|
|
102
|
+
upper
|
|
103
|
+
]);
|
|
104
|
+
const valueText = formatValueText?.(currentValue) ?? String(currentValue);
|
|
105
|
+
const context = useMemo(() => ({
|
|
106
|
+
value: currentValue,
|
|
107
|
+
valueText,
|
|
108
|
+
direction,
|
|
109
|
+
atMin: currentValue <= lower,
|
|
110
|
+
atMax: currentValue >= upper,
|
|
111
|
+
disabled,
|
|
112
|
+
reduce,
|
|
113
|
+
decrement,
|
|
114
|
+
increment,
|
|
115
|
+
decrementRef,
|
|
116
|
+
incrementRef
|
|
117
|
+
}), [
|
|
118
|
+
currentValue,
|
|
119
|
+
decrement,
|
|
120
|
+
direction,
|
|
121
|
+
disabled,
|
|
122
|
+
increment,
|
|
123
|
+
lower,
|
|
124
|
+
reduce,
|
|
125
|
+
upper,
|
|
126
|
+
valueText
|
|
127
|
+
]);
|
|
128
|
+
return /* @__PURE__ */ jsx(AdaptiveStepperContext.Provider, {
|
|
129
|
+
value: context,
|
|
130
|
+
children: /* @__PURE__ */ jsxs("fieldset", {
|
|
131
|
+
disabled,
|
|
132
|
+
className: cn("relative isolate m-0 inline-block h-12 w-[13.5rem] border-0 p-0", className),
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsxs("legend", {
|
|
135
|
+
id: labelId,
|
|
136
|
+
className: "sr-only",
|
|
137
|
+
children: [
|
|
138
|
+
ariaLabel,
|
|
139
|
+
". Current value: ",
|
|
140
|
+
valueText
|
|
141
|
+
]
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ jsx(Liquid, {
|
|
144
|
+
blur: 8,
|
|
145
|
+
contrast: 22,
|
|
146
|
+
fill: "var(--background)",
|
|
147
|
+
className: "size-full",
|
|
148
|
+
children
|
|
149
|
+
}),
|
|
150
|
+
name ? /* @__PURE__ */ jsx("input", {
|
|
151
|
+
type: "hidden",
|
|
152
|
+
name,
|
|
153
|
+
value: currentValue
|
|
154
|
+
}) : null
|
|
155
|
+
]
|
|
156
|
+
})
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function StepperAction({ direction, children, className, onClick, ref, style, tabIndex, "aria-label": ariaLabel, ...props }) {
|
|
160
|
+
const context = useAdaptiveStepperContext("AdaptiveStepper action");
|
|
161
|
+
const hidden = direction === -1 ? context.atMin : context.atMax;
|
|
162
|
+
const actionRef = direction === -1 ? context.decrementRef : context.incrementRef;
|
|
163
|
+
const label = ariaLabel ?? (direction === -1 ? "Decrease value" : "Increase value");
|
|
164
|
+
const action = direction === -1 ? context.decrement : context.increment;
|
|
165
|
+
return /* @__PURE__ */ jsx(LiquidItem, {
|
|
166
|
+
x: direction === -1 ? hidden ? 32 : 0 : hidden ? 136 : 168,
|
|
167
|
+
y: 0,
|
|
168
|
+
width: 48,
|
|
169
|
+
height: 48,
|
|
170
|
+
radius: 24,
|
|
171
|
+
transition: STEPPER_LIQUID_TRANSITION,
|
|
172
|
+
children: /* @__PURE__ */ jsx(motion.button, {
|
|
173
|
+
...props,
|
|
174
|
+
ref: mergeRefs(ref, actionRef),
|
|
175
|
+
type: "button",
|
|
176
|
+
"aria-label": label,
|
|
177
|
+
"aria-hidden": hidden || void 0,
|
|
178
|
+
tabIndex: hidden ? -1 : tabIndex,
|
|
179
|
+
disabled: context.disabled || hidden,
|
|
180
|
+
whileTap: context.reduce || context.disabled || hidden ? void 0 : { scale: .94 },
|
|
181
|
+
transition: context.reduce ? { duration: 0 } : SPRING_PRESS,
|
|
182
|
+
style,
|
|
183
|
+
className: cn("grid size-full place-items-center rounded-full border border-transparent bg-transparent bg-clip-padding text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none", hidden && "hover:bg-transparent", context.disabled && "opacity-50", className),
|
|
184
|
+
onClick: (event) => {
|
|
185
|
+
onClick?.(event);
|
|
186
|
+
if (!event.defaultPrevented) action(event.detail === 0);
|
|
187
|
+
},
|
|
188
|
+
children: /* @__PURE__ */ jsx(motion.span, {
|
|
189
|
+
"aria-hidden": "true",
|
|
190
|
+
initial: {
|
|
191
|
+
opacity: hidden ? 0 : 1,
|
|
192
|
+
filter: hidden ? "blur(2px)" : "blur(0px)"
|
|
193
|
+
},
|
|
194
|
+
animate: {
|
|
195
|
+
opacity: hidden ? 0 : 1,
|
|
196
|
+
filter: hidden ? "blur(2px)" : "blur(0px)"
|
|
197
|
+
},
|
|
198
|
+
transition: {
|
|
199
|
+
duration: context.reduce ? 0 : .15,
|
|
200
|
+
ease: EASE_OUT
|
|
201
|
+
},
|
|
202
|
+
children: children ?? (direction === -1 ? /* @__PURE__ */ jsx(Minus, {
|
|
203
|
+
className: "size-5",
|
|
204
|
+
strokeWidth: 2.5
|
|
205
|
+
}) : /* @__PURE__ */ jsx(Plus, {
|
|
206
|
+
className: "size-5",
|
|
207
|
+
strokeWidth: 2.5
|
|
208
|
+
}))
|
|
209
|
+
})
|
|
210
|
+
})
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function AdaptiveStepperDecrement(props) {
|
|
214
|
+
return /* @__PURE__ */ jsx(StepperAction, {
|
|
215
|
+
...props,
|
|
216
|
+
direction: -1
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function AdaptiveStepperValue({ children, className, style, ...props }) {
|
|
220
|
+
const context = useAdaptiveStepperContext("AdaptiveStepperValue");
|
|
221
|
+
const geometry = context.atMin && context.atMax ? {
|
|
222
|
+
x: 0,
|
|
223
|
+
width: 216
|
|
224
|
+
} : context.atMin ? {
|
|
225
|
+
x: 0,
|
|
226
|
+
width: 152
|
|
227
|
+
} : context.atMax ? {
|
|
228
|
+
x: 64,
|
|
229
|
+
width: 152
|
|
230
|
+
} : {
|
|
231
|
+
x: 64,
|
|
232
|
+
width: 88
|
|
233
|
+
};
|
|
234
|
+
const renderedValue = (typeof children === "function" ? children(context.value) : children) ?? context.value;
|
|
235
|
+
const canRoll = typeof renderedValue === "number" || typeof renderedValue === "string";
|
|
236
|
+
const distance = context.reduce || !canRoll ? 0 : context.direction * 32;
|
|
237
|
+
const enterFrom = `translateY(${distance}%)`;
|
|
238
|
+
const exitTo = `translateY(${-distance}%)`;
|
|
239
|
+
return /* @__PURE__ */ jsx(LiquidItem, {
|
|
240
|
+
x: geometry.x,
|
|
241
|
+
y: 0,
|
|
242
|
+
width: geometry.width,
|
|
243
|
+
height: 48,
|
|
244
|
+
radius: 24,
|
|
245
|
+
transition: STEPPER_LIQUID_TRANSITION,
|
|
246
|
+
children: /* @__PURE__ */ jsxs(motion.output, {
|
|
247
|
+
...props,
|
|
248
|
+
"aria-live": "polite",
|
|
249
|
+
"aria-atomic": "true",
|
|
250
|
+
style,
|
|
251
|
+
className: cn("flex size-full min-w-0 items-center justify-center overflow-hidden rounded-full border border-transparent bg-transparent bg-clip-padding px-4 font-semibold text-foreground text-lg tabular-nums", className),
|
|
252
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
253
|
+
className: "sr-only",
|
|
254
|
+
children: context.valueText
|
|
255
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
256
|
+
"aria-hidden": "true",
|
|
257
|
+
className: "relative grid min-h-[1.1em] min-w-[1ch] place-items-center overflow-hidden leading-none",
|
|
258
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
259
|
+
initial: false,
|
|
260
|
+
mode: "popLayout",
|
|
261
|
+
children: /* @__PURE__ */ jsx(motion.span, {
|
|
262
|
+
initial: {
|
|
263
|
+
opacity: context.reduce ? 1 : .35,
|
|
264
|
+
filter: context.reduce ? "blur(0px)" : "blur(2px)",
|
|
265
|
+
transform: enterFrom
|
|
266
|
+
},
|
|
267
|
+
animate: {
|
|
268
|
+
opacity: 1,
|
|
269
|
+
filter: "blur(0px)",
|
|
270
|
+
transform: "translateY(0%)"
|
|
271
|
+
},
|
|
272
|
+
exit: {
|
|
273
|
+
opacity: context.reduce ? 1 : 0,
|
|
274
|
+
filter: context.reduce ? "blur(0px)" : "blur(2px)",
|
|
275
|
+
transform: exitTo,
|
|
276
|
+
transition: {
|
|
277
|
+
duration: context.reduce ? 0 : .12,
|
|
278
|
+
ease: EASE_OUT
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
transition: {
|
|
282
|
+
duration: context.reduce ? 0 : .18,
|
|
283
|
+
ease: EASE_OUT
|
|
284
|
+
},
|
|
285
|
+
className: "col-start-1 row-start-1 will-change-[transform,filter,opacity]",
|
|
286
|
+
children: renderedValue
|
|
287
|
+
}, context.value)
|
|
288
|
+
})
|
|
289
|
+
})]
|
|
290
|
+
})
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
function AdaptiveStepperIncrement(props) {
|
|
294
|
+
return /* @__PURE__ */ jsx(StepperAction, {
|
|
295
|
+
...props,
|
|
296
|
+
direction: 1
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
300
|
+
export { AdaptiveStepper, AdaptiveStepperDecrement, AdaptiveStepperIncrement, AdaptiveStepperValue };
|
|
301
|
+
|
|
302
|
+
//# sourceMappingURL=adaptive-stepper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adaptive-stepper.js","names":[],"sources":["../../../src/components/motion/adaptive-stepper.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n type MouseEvent,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Minus, Plus } from \"lucide-react\";\nimport { AnimatePresence, type HTMLMotionProps, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PRESS } from \"../../lib/ease\";\nimport { Liquid, LiquidItem, type LiquidTransition } from \"./liquid\";\n\n// The deliberately elastic separation curve from the liquid email reference.\nconst STEPPER_LIQUID_TRANSITION = {\n duration: 600,\n ease: [0.22, 1.3, 0.71, 1],\n} as const satisfies LiquidTransition;\n\ntype StepDirection = -1 | 0 | 1;\n\ntype AdaptiveStepperContextValue = {\n value: number;\n valueText: string;\n direction: StepDirection;\n atMin: boolean;\n atMax: boolean;\n disabled: boolean;\n reduce: boolean;\n decrement: (restoreFocus: boolean) => void;\n increment: (restoreFocus: boolean) => void;\n decrementRef: React.MutableRefObject<HTMLButtonElement | null>;\n incrementRef: React.MutableRefObject<HTMLButtonElement | null>;\n};\n\nconst AdaptiveStepperContext = createContext<AdaptiveStepperContextValue | null>(null);\n\nfunction useAdaptiveStepperContext(component: string) {\n const context = useContext(AdaptiveStepperContext);\n if (!context) {\n throw new Error(`${component} must be used within <AdaptiveStepper>`);\n }\n return context;\n}\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(max, Math.max(min, value));\n}\n\nfunction cleanNumber(value: number) {\n return Number(value.toFixed(10));\n}\n\nfunction nextStep(value: number, direction: -1 | 1, min: number, max: number, step: number) {\n if (direction === 1) {\n const nextIndex = Math.floor((value - min) / step + 1e-10) + 1;\n return cleanNumber(Math.min(max, min + nextIndex * step));\n }\n\n const previousIndex = Math.ceil((value - min) / step - 1e-10) - 1;\n return cleanNumber(Math.max(min, min + previousIndex * step));\n}\n\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref && typeof ref === \"object\") {\n (ref as React.MutableRefObject<T | null>).current = node;\n }\n }\n };\n}\n\nexport interface AdaptiveStepperProps {\n children: ReactNode;\n value?: number;\n defaultValue?: number;\n onValueChange?: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n disabled?: boolean;\n name?: string;\n formatValueText?: (value: number) => string;\n className?: string;\n \"aria-label\"?: string;\n}\n\nexport function AdaptiveStepper({\n children,\n value: controlledValue,\n defaultValue = 0,\n onValueChange,\n min = 0,\n max = 10,\n step = 1,\n disabled = false,\n name,\n formatValueText,\n className,\n \"aria-label\": ariaLabel = \"Quantity\",\n}: AdaptiveStepperProps) {\n const reduce = useReducedMotion() ?? false;\n const labelId = useId();\n const decrementRef = useRef<HTMLButtonElement>(null);\n const incrementRef = useRef<HTMLButtonElement>(null);\n const lower = Number.isFinite(min) ? min : 0;\n const suppliedMax = Number.isFinite(max) ? max : lower;\n const upper = suppliedMax > lower ? suppliedMax : lower;\n const stride = Number.isFinite(step) && step > 0 ? step : 1;\n const [internalValue, setInternalValue] = useState(() =>\n clamp(Number.isFinite(defaultValue) ? defaultValue : lower, lower, upper),\n );\n const controlled = controlledValue !== undefined;\n const suppliedValue = controlled ? controlledValue : internalValue;\n const currentValue = clamp(Number.isFinite(suppliedValue) ? suppliedValue : lower, lower, upper);\n const previousValueRef = useRef(currentValue);\n const currentValueRef = useRef(currentValue);\n const direction: StepDirection =\n currentValue === previousValueRef.current\n ? 0\n : currentValue > previousValueRef.current\n ? 1\n : -1;\n\n useLayoutEffect(() => {\n previousValueRef.current = currentValue;\n currentValueRef.current = currentValue;\n }, [currentValue]);\n\n const commit = useCallback(\n (nextValue: number, restoreFocus: boolean) => {\n const next = clamp(cleanNumber(nextValue), lower, upper);\n if (next === currentValue) return;\n if (!controlled) setInternalValue(next);\n onValueChange?.(next);\n\n if (!restoreFocus) return;\n requestAnimationFrame(() => {\n if (next === upper && currentValueRef.current === upper) {\n decrementRef.current?.focus();\n } else if (next === lower && currentValueRef.current === lower) {\n incrementRef.current?.focus();\n }\n });\n },\n [controlled, currentValue, lower, onValueChange, upper],\n );\n\n const decrement = useCallback(\n (restoreFocus: boolean) => {\n if (disabled || currentValue <= lower) return;\n commit(nextStep(currentValue, -1, lower, upper, stride), restoreFocus);\n },\n [commit, currentValue, disabled, lower, stride, upper],\n );\n\n const increment = useCallback(\n (restoreFocus: boolean) => {\n if (disabled || currentValue >= upper) return;\n commit(nextStep(currentValue, 1, lower, upper, stride), restoreFocus);\n },\n [commit, currentValue, disabled, lower, stride, upper],\n );\n\n const valueText = formatValueText?.(currentValue) ?? String(currentValue);\n const context = useMemo<AdaptiveStepperContextValue>(\n () => ({\n value: currentValue,\n valueText,\n direction,\n atMin: currentValue <= lower,\n atMax: currentValue >= upper,\n disabled,\n reduce,\n decrement,\n increment,\n decrementRef,\n incrementRef,\n }),\n [currentValue, decrement, direction, disabled, increment, lower, reduce, upper, valueText],\n );\n\n return (\n <AdaptiveStepperContext.Provider value={context}>\n <fieldset\n disabled={disabled}\n className={cn(\"relative isolate m-0 inline-block h-12 w-[13.5rem] border-0 p-0\", className)}\n >\n <legend id={labelId} className=\"sr-only\">\n {ariaLabel}. Current value: {valueText}\n </legend>\n <Liquid blur={8} contrast={22} fill=\"var(--background)\" className=\"size-full\">\n {children}\n </Liquid>\n {name ? <input type=\"hidden\" name={name} value={currentValue} /> : null}\n </fieldset>\n </AdaptiveStepperContext.Provider>\n );\n}\n\nexport interface AdaptiveStepperActionProps\n extends Omit<HTMLMotionProps<\"button\">, \"children\" | \"onClick\"> {\n children?: ReactNode;\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n ref?: Ref<HTMLButtonElement>;\n}\n\nfunction StepperAction({\n direction,\n children,\n className,\n onClick,\n ref,\n style,\n tabIndex,\n \"aria-label\": ariaLabel,\n ...props\n}: AdaptiveStepperActionProps & { direction: -1 | 1 }) {\n const context = useAdaptiveStepperContext(\"AdaptiveStepper action\");\n const hidden = direction === -1 ? context.atMin : context.atMax;\n const actionRef = direction === -1 ? context.decrementRef : context.incrementRef;\n const label = ariaLabel ?? (direction === -1 ? \"Decrease value\" : \"Increase value\");\n const action = direction === -1 ? context.decrement : context.increment;\n const x = direction === -1 ? (hidden ? 32 : 0) : hidden ? 136 : 168;\n\n return (\n <LiquidItem\n x={x}\n y={0}\n width={48}\n height={48}\n radius={24}\n transition={STEPPER_LIQUID_TRANSITION}\n >\n <motion.button\n {...props}\n ref={mergeRefs(ref, actionRef)}\n type=\"button\"\n aria-label={label}\n aria-hidden={hidden || undefined}\n tabIndex={hidden ? -1 : tabIndex}\n disabled={context.disabled || hidden}\n whileTap={context.reduce || context.disabled || hidden ? undefined : { scale: 0.94 }}\n transition={context.reduce ? { duration: 0 } : SPRING_PRESS}\n style={style}\n className={cn(\n \"grid size-full place-items-center rounded-full border border-transparent bg-transparent bg-clip-padding text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none\",\n hidden && \"hover:bg-transparent\",\n context.disabled && \"opacity-50\",\n className,\n )}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) action(event.detail === 0);\n }}\n >\n <motion.span\n aria-hidden=\"true\"\n initial={{\n opacity: hidden ? 0 : 1,\n filter: hidden ? \"blur(2px)\" : \"blur(0px)\",\n }}\n animate={{\n opacity: hidden ? 0 : 1,\n filter: hidden ? \"blur(2px)\" : \"blur(0px)\",\n }}\n transition={{ duration: context.reduce ? 0 : 0.15, ease: EASE_OUT }}\n >\n {children ??\n (direction === -1 ? (\n <Minus className=\"size-5\" strokeWidth={2.5} />\n ) : (\n <Plus className=\"size-5\" strokeWidth={2.5} />\n ))}\n </motion.span>\n </motion.button>\n </LiquidItem>\n );\n}\n\nexport function AdaptiveStepperDecrement(props: AdaptiveStepperActionProps) {\n return <StepperAction {...props} direction={-1} />;\n}\n\nexport interface AdaptiveStepperValueProps extends Omit<HTMLMotionProps<\"output\">, \"children\"> {\n children?: ReactNode | ((value: number) => ReactNode);\n}\n\nexport function AdaptiveStepperValue({\n children,\n className,\n style,\n ...props\n}: AdaptiveStepperValueProps) {\n const context = useAdaptiveStepperContext(\"AdaptiveStepperValue\");\n const geometry =\n context.atMin && context.atMax\n ? { x: 0, width: 216 }\n : context.atMin\n ? { x: 0, width: 152 }\n : context.atMax\n ? { x: 64, width: 152 }\n : { x: 64, width: 88 };\n const displayValue = typeof children === \"function\" ? children(context.value) : children;\n const renderedValue = displayValue ?? context.value;\n const canRoll = typeof renderedValue === \"number\" || typeof renderedValue === \"string\";\n const distance = context.reduce || !canRoll ? 0 : context.direction * 32;\n const enterFrom = `translateY(${distance}%)`;\n const exitTo = `translateY(${-distance}%)`;\n\n return (\n <LiquidItem\n x={geometry.x}\n y={0}\n width={geometry.width}\n height={48}\n radius={24}\n transition={STEPPER_LIQUID_TRANSITION}\n >\n <motion.output\n {...props}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n style={style}\n className={cn(\n \"flex size-full min-w-0 items-center justify-center overflow-hidden rounded-full border border-transparent bg-transparent bg-clip-padding px-4 font-semibold text-foreground text-lg tabular-nums\",\n className,\n )}\n >\n <span className=\"sr-only\">{context.valueText}</span>\n <span\n aria-hidden=\"true\"\n className=\"relative grid min-h-[1.1em] min-w-[1ch] place-items-center overflow-hidden leading-none\"\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n <motion.span\n key={context.value}\n initial={{\n opacity: context.reduce ? 1 : 0.35,\n filter: context.reduce ? \"blur(0px)\" : \"blur(2px)\",\n transform: enterFrom,\n }}\n animate={{\n opacity: 1,\n filter: \"blur(0px)\",\n transform: \"translateY(0%)\",\n }}\n exit={{\n opacity: context.reduce ? 1 : 0,\n filter: context.reduce ? \"blur(0px)\" : \"blur(2px)\",\n transform: exitTo,\n transition: {\n duration: context.reduce ? 0 : 0.12,\n ease: EASE_OUT,\n },\n }}\n transition={{\n duration: context.reduce ? 0 : 0.18,\n ease: EASE_OUT,\n }}\n className=\"col-start-1 row-start-1 will-change-[transform,filter,opacity]\"\n >\n {renderedValue}\n </motion.span>\n </AnimatePresence>\n </span>\n </motion.output>\n </LiquidItem>\n );\n}\n\nexport function AdaptiveStepperIncrement(props: AdaptiveStepperActionProps) {\n return <StepperAction {...props} direction={1} />;\n}\n"],"mappings":";;;;;;;;;AAuBA,MAAM,4BAA4B;CAChC,UAAU;CACV,MAAM;EAAC;EAAM;EAAK;EAAM;CAAC;AAC3B;AAkBA,MAAM,yBAAyB,cAAkD,IAAI;AAErF,SAAS,0BAA0B,WAAmB;CACpD,MAAM,UAAU,WAAW,sBAAsB;CACjD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,GAAG,UAAU,uCAAuC;CAEtE,OAAO;AACT;AAEA,S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,YAAY;CACtE,MAAM,YAAY,cAAc,SAAS;CACzC,MAAM,SAAS,cAAc,CAAC,SAAS;CAEvC,OACE,oBAAC,YAAD;EACE,GAAG,SAAS;EACZ,GAAG;EACH,OAAO,SAAS;EAChB,QAAQ;EACR,QAAQ;EACR,YAAY;EAEZ,UAAA,qBAAC,OAAO,QAAR;GACE,GAAI;GACJ,aAAU;GACV,eAAY;GACL;GACP,WAAW,GACT,oMACA,SACF;GARF,UAAA,CAUE,oBAAC,QAAD;IAAM,WAAU;IAAW,UAAA,QAAQ;GAAgB,CAAA,GACnD,oBAAC,QAAD;IACE,eAAY;IACZ,WAAU;IAEV,UAAA,oBAAC,iBAAD;KAAiB,SAAS;KAAO,MAAK;KACpC,UAAA,oBAAC,OAAO,MAAR;MAEE,SAAS;OACP,SAAS,QAAQ,SAAS,IAAI;OAC9B,QAAQ,QAAQ,SAAS,cAAc;OACvC,WAAW;MACb;MACA,SAAS;OACP,SAAS;OACT,QAAQ;OACR,WAAW;MACb;MACA,MAAM;OACJ,SAAS,QAAQ,SAAS,IAAI;OAC9B,QAAQ,QAAQ,SAAS,cAAc;OACvC,WAAW;OACX,YAAY;QACV,UAAU,QAAQ,SAAS,IAAI;QAC/B,MAAM;OACR;MACF;MACA,YAAY;OACV,UAAU,QAAQ,SAAS,IAAI;OAC/B,MAAM;MACR;MACA,WAAU;MAET,UAAA;KACU,GA3BN,QAAQ,KA2BF;IACE,CAAA;GACb,CAAA,CACO;;CACL,CAAA;AAEhB;AAEA,SAAgB,yBAAyB,OAAmC;CAC1E,OAAO,oBAAC,eAAD;EAAe,GAAI;EAAO,WAAW;CAAI,CAAA;AAClD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { t as usePopoverPortalPosition } from "../../../popover-position-BUqYCq8X.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useComboboxContext } from "./context.js";
|
|
4
4
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,3 +1,218 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { t as useActiveOption } from "../../../use-active-option-CmX6Z-4S.js";
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { cn } from "@kumix/utils";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useReducedMotion } from "motion/react";
|
|
7
|
+
//#region src/components/motion/combobox/context.tsx
|
|
8
|
+
const defaultFilter = (value, query, keywords) => {
|
|
9
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
10
|
+
if (!needle) return true;
|
|
11
|
+
const haystack = [value, ...keywords].join(" ").toLocaleLowerCase();
|
|
12
|
+
let queryIndex = 0;
|
|
13
|
+
for (const character of haystack) {
|
|
14
|
+
if (character === needle[queryIndex]) queryIndex += 1;
|
|
15
|
+
if (queryIndex === needle.length) return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
};
|
|
19
|
+
const ComboboxContext = createContext(null);
|
|
20
|
+
const ComboboxGroupContext = createContext(null);
|
|
21
|
+
function useComboboxContext(component) {
|
|
22
|
+
const context = useContext(ComboboxContext);
|
|
23
|
+
if (!context) throw new Error(`${component} must be used within <Combobox>`);
|
|
24
|
+
return context;
|
|
25
|
+
}
|
|
26
|
+
function mergeRefs(...refs) {
|
|
27
|
+
return (node) => {
|
|
28
|
+
for (const ref of refs) if (typeof ref === "function") ref(node);
|
|
29
|
+
else if (ref && typeof ref === "object") ref.current = node;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function Combobox({ children, value: controlledValue, defaultValue, onValueChange, open: controlledOpen, defaultOpen = false, onOpenChange, query: controlledQuery, defaultQuery = "", onQueryChange, filter = defaultFilter, disabled = false, className }) {
|
|
33
|
+
const reduce = useReducedMotion() ?? false;
|
|
34
|
+
const baseId = useId();
|
|
35
|
+
const rootRef = useRef(null);
|
|
36
|
+
const triggerRef = useRef(null);
|
|
37
|
+
const contentRef = useRef(null);
|
|
38
|
+
const inputRef = useRef(null);
|
|
39
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
40
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
41
|
+
const [internalQuery, setInternalQuery] = useState(defaultQuery);
|
|
42
|
+
const [items, setItems] = useState(/* @__PURE__ */ new Map());
|
|
43
|
+
const valueControlled = controlledValue !== void 0;
|
|
44
|
+
const openControlled = controlledOpen !== void 0;
|
|
45
|
+
const queryControlled = controlledQuery !== void 0;
|
|
46
|
+
const value = valueControlled ? controlledValue : internalValue;
|
|
47
|
+
const open = openControlled ? controlledOpen : internalOpen;
|
|
48
|
+
const query = queryControlled ? controlledQuery : internalQuery;
|
|
49
|
+
const updateQuery = useCallback((next) => {
|
|
50
|
+
if (!queryControlled) setInternalQuery(next);
|
|
51
|
+
onQueryChange?.(next);
|
|
52
|
+
}, [onQueryChange, queryControlled]);
|
|
53
|
+
const updateOpen = useCallback((next, restoreFocus = false) => {
|
|
54
|
+
if (disabled && next) return;
|
|
55
|
+
if (!openControlled) setInternalOpen(next);
|
|
56
|
+
onOpenChange?.(next);
|
|
57
|
+
if (!next) updateQuery("");
|
|
58
|
+
if (restoreFocus) requestAnimationFrame(() => inputRef.current?.focus({ preventScroll: true }));
|
|
59
|
+
}, [
|
|
60
|
+
disabled,
|
|
61
|
+
onOpenChange,
|
|
62
|
+
openControlled,
|
|
63
|
+
updateQuery
|
|
64
|
+
]);
|
|
65
|
+
const registerItem = useCallback((item) => {
|
|
66
|
+
setItems((current) => {
|
|
67
|
+
const existing = current.get(item.value);
|
|
68
|
+
if (existing?.label === item.label && existing.disabled === item.disabled && existing.id === item.id && existing.ref === item.ref && existing.groupId === item.groupId && existing.keywords.join("\0") === item.keywords.join("\0")) return current;
|
|
69
|
+
const next = new Map(current);
|
|
70
|
+
next.set(item.value, item);
|
|
71
|
+
return next;
|
|
72
|
+
});
|
|
73
|
+
}, []);
|
|
74
|
+
const unregisterItem = useCallback((itemValue) => {
|
|
75
|
+
setItems((current) => {
|
|
76
|
+
if (!current.has(itemValue)) return current;
|
|
77
|
+
const next = new Map(current);
|
|
78
|
+
next.delete(itemValue);
|
|
79
|
+
return next;
|
|
80
|
+
});
|
|
81
|
+
}, []);
|
|
82
|
+
const [openQuery, setOpenQuery] = useState(query);
|
|
83
|
+
if (open && openQuery !== query) setOpenQuery(query);
|
|
84
|
+
const listQuery = open ? query : openQuery;
|
|
85
|
+
const visibleItems = useMemo(() => Array.from(items.values()).filter((item) => filter(item.value, listQuery, [item.label, ...item.keywords])), [
|
|
86
|
+
filter,
|
|
87
|
+
items,
|
|
88
|
+
listQuery
|
|
89
|
+
]);
|
|
90
|
+
const enabledVisibleItems = useMemo(() => visibleItems.filter((item) => !item.disabled), [visibleItems]);
|
|
91
|
+
const visibleValues = useMemo(() => new Set(visibleItems.map((item) => item.value)), [visibleItems]);
|
|
92
|
+
const visibleGroupIds = useMemo(() => new Set(visibleItems.map((item) => item.groupId)), [visibleItems]);
|
|
93
|
+
const { activeValue, setActiveValue, moveActive } = useActiveOption({
|
|
94
|
+
open,
|
|
95
|
+
query: listQuery,
|
|
96
|
+
value,
|
|
97
|
+
enabledItems: enabledVisibleItems
|
|
98
|
+
});
|
|
99
|
+
const select = useCallback((next) => {
|
|
100
|
+
if (items.get(next)?.disabled) return;
|
|
101
|
+
if (!valueControlled) setInternalValue(next);
|
|
102
|
+
onValueChange?.(next);
|
|
103
|
+
updateOpen(false, true);
|
|
104
|
+
}, [
|
|
105
|
+
items,
|
|
106
|
+
onValueChange,
|
|
107
|
+
updateOpen,
|
|
108
|
+
valueControlled
|
|
109
|
+
]);
|
|
110
|
+
const selectActive = useCallback(() => {
|
|
111
|
+
if (activeValue) select(activeValue);
|
|
112
|
+
}, [activeValue, select]);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!open) return;
|
|
115
|
+
const frame = requestAnimationFrame(() => inputRef.current?.focus({ preventScroll: true }));
|
|
116
|
+
return () => cancelAnimationFrame(frame);
|
|
117
|
+
}, [open]);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (!activeValue || !open) return;
|
|
120
|
+
const item = items.get(activeValue)?.ref.current;
|
|
121
|
+
const list = item?.closest("[role='listbox']");
|
|
122
|
+
if (!item || !list) return;
|
|
123
|
+
const itemRect = item.getBoundingClientRect();
|
|
124
|
+
const listRect = list.getBoundingClientRect();
|
|
125
|
+
if (itemRect.top < listRect.top) list.scrollTop -= listRect.top - itemRect.top;
|
|
126
|
+
else if (itemRect.bottom > listRect.bottom) list.scrollTop += itemRect.bottom - listRect.bottom;
|
|
127
|
+
}, [
|
|
128
|
+
activeValue,
|
|
129
|
+
items,
|
|
130
|
+
open
|
|
131
|
+
]);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (!open) return;
|
|
134
|
+
const isInside = (target) => rootRef.current?.contains(target) || contentRef.current?.contains(target);
|
|
135
|
+
const onPointerDown = (event) => {
|
|
136
|
+
if (!isInside(event.target)) updateOpen(false);
|
|
137
|
+
};
|
|
138
|
+
const onFocusIn = (event) => {
|
|
139
|
+
if (!isInside(event.target)) updateOpen(false);
|
|
140
|
+
};
|
|
141
|
+
const onKeyDown = (event) => {
|
|
142
|
+
if (event.key !== "Escape") return;
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
updateOpen(false, true);
|
|
145
|
+
};
|
|
146
|
+
window.addEventListener("pointerdown", onPointerDown);
|
|
147
|
+
window.addEventListener("focusin", onFocusIn);
|
|
148
|
+
window.addEventListener("keydown", onKeyDown);
|
|
149
|
+
return () => {
|
|
150
|
+
window.removeEventListener("pointerdown", onPointerDown);
|
|
151
|
+
window.removeEventListener("focusin", onFocusIn);
|
|
152
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
153
|
+
};
|
|
154
|
+
}, [open, updateOpen]);
|
|
155
|
+
const activeItem = activeValue ? items.get(activeValue) : void 0;
|
|
156
|
+
const context = useMemo(() => ({
|
|
157
|
+
open,
|
|
158
|
+
setOpen: updateOpen,
|
|
159
|
+
value,
|
|
160
|
+
select,
|
|
161
|
+
query,
|
|
162
|
+
setQuery: updateQuery,
|
|
163
|
+
activeValue,
|
|
164
|
+
setActiveValue,
|
|
165
|
+
moveActive,
|
|
166
|
+
selectActive,
|
|
167
|
+
registerItem,
|
|
168
|
+
unregisterItem,
|
|
169
|
+
labelFor: (itemValue) => itemValue === void 0 ? void 0 : items.get(itemValue)?.label,
|
|
170
|
+
isVisible: (itemValue) => !listQuery.trim() || visibleValues.has(itemValue),
|
|
171
|
+
hasVisibleItems: (groupId) => visibleGroupIds.has(groupId),
|
|
172
|
+
visibleCount: visibleItems.length,
|
|
173
|
+
activeItemId: activeItem?.id,
|
|
174
|
+
triggerId: `${baseId}-trigger`,
|
|
175
|
+
listId: `${baseId}-list`,
|
|
176
|
+
inputId: `${baseId}-input`,
|
|
177
|
+
disabled,
|
|
178
|
+
reduce,
|
|
179
|
+
triggerRef,
|
|
180
|
+
contentRef,
|
|
181
|
+
inputRef,
|
|
182
|
+
activeLayoutId: `${baseId}-active`
|
|
183
|
+
}), [
|
|
184
|
+
activeItem?.id,
|
|
185
|
+
activeValue,
|
|
186
|
+
baseId,
|
|
187
|
+
disabled,
|
|
188
|
+
items,
|
|
189
|
+
listQuery,
|
|
190
|
+
moveActive,
|
|
191
|
+
open,
|
|
192
|
+
query,
|
|
193
|
+
reduce,
|
|
194
|
+
registerItem,
|
|
195
|
+
select,
|
|
196
|
+
selectActive,
|
|
197
|
+
setActiveValue,
|
|
198
|
+
unregisterItem,
|
|
199
|
+
updateOpen,
|
|
200
|
+
updateQuery,
|
|
201
|
+
value,
|
|
202
|
+
visibleItems.length,
|
|
203
|
+
visibleGroupIds,
|
|
204
|
+
visibleValues
|
|
205
|
+
]);
|
|
206
|
+
return /* @__PURE__ */ jsx(ComboboxContext.Provider, {
|
|
207
|
+
value: context,
|
|
208
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
209
|
+
ref: rootRef,
|
|
210
|
+
className: cn("relative w-full", className),
|
|
211
|
+
children
|
|
212
|
+
})
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
3
216
|
export { Combobox, ComboboxContext, ComboboxGroupContext, mergeRefs, useComboboxContext };
|
|
217
|
+
|
|
218
|
+
//# sourceMappingURL=context.js.map
|