@kumix/ui 0.3.12 → 0.3.14
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 +1 -1
- package/dist/components/agents/agent-activity/activity-row.js +1 -1
- package/dist/components/agents/agent-activity/index.js +1 -1
- package/dist/components/agents/agent-code.js +1 -1
- package/dist/components/agents/ai-sidebar.js +1 -1
- package/dist/components/agents/approval-card/index.js +1 -1
- package/dist/components/agents/citations.js +1 -1
- package/dist/components/agents/code-block.js +1 -1
- package/dist/components/agents/file-diff.js +1 -1
- package/dist/components/agents/image-generation.js +1 -1
- package/dist/components/agents/message-bubble.js +1 -1
- package/dist/components/agents/prompt-input.js +1 -1
- package/dist/components/agents/streaming-response.js +1 -1
- package/dist/components/agents/todo-list.js +1 -1
- package/dist/components/agents/tool-approval.js +1 -1
- package/dist/components/agents/tool-result.js +1 -1
- package/dist/components/custom/confirm-dialog.js +1 -1
- package/dist/components/motion/adaptive-stepper.js +1 -1
- package/dist/components/motion/animated-badge.js +1 -1
- package/dist/components/motion/animated-sidebar.js +1 -1
- package/dist/components/motion/animated-toast-stack.js +1 -1
- package/dist/components/motion/attachment-upload.js +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- package/dist/components/motion/availability-scheduler/day-row.js +2 -2
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/bloom-menu.js +1 -1
- package/dist/components/motion/bouncy-accordion.js +1 -1
- package/dist/components/motion/button/stateful.js +1 -1
- package/dist/components/motion/card-folder.d.ts +30 -0
- package/dist/components/motion/card-folder.d.ts.map +1 -0
- package/dist/components/motion/card-folder.js +254 -0
- package/dist/components/motion/card-folder.js.map +1 -0
- package/dist/components/motion/center-morph-modal.js +1 -1
- package/dist/components/motion/combobox/list.js +1 -1
- package/dist/components/motion/combobox/trigger.js +1 -1
- package/dist/components/motion/command-palette.js +1 -1
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/digit-swap.d.ts +23 -0
- package/dist/components/motion/digit-swap.d.ts.map +1 -0
- package/dist/components/motion/digit-swap.js +77 -0
- package/dist/components/motion/digit-swap.js.map +1 -0
- package/dist/components/motion/feedback-widget.js +1 -1
- package/dist/components/motion/file-tree.js +1 -1
- package/dist/components/motion/file-upload.js +1 -1
- package/dist/components/motion/infinite-masonry.js +1 -1
- package/dist/components/motion/morphing-search.js +1 -1
- package/dist/components/motion/morphing-tabs.js +1 -1
- package/dist/components/motion/multi-select/list.js +1 -1
- package/dist/components/motion/multi-select/trigger.js +1 -1
- package/dist/components/motion/notification-stack.js +1 -1
- package/dist/components/motion/overflow-actions.js +1 -1
- package/dist/components/motion/project-folder.js +1 -1
- package/dist/components/motion/range-slider-inline.d.ts +18 -0
- package/dist/components/motion/range-slider-inline.d.ts.map +1 -0
- package/dist/components/motion/range-slider-inline.js +267 -0
- package/dist/components/motion/range-slider-inline.js.map +1 -0
- package/dist/components/motion/range-slider.d.ts.map +1 -1
- package/dist/components/motion/range-slider.js +26 -10
- package/dist/components/motion/range-slider.js.map +1 -1
- package/dist/components/motion/select-morph.js +1 -1
- package/dist/components/motion/select.js +1 -1
- package/dist/components/motion/signup-form.js +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +1 -1
- package/dist/components/motion/theme-toggle.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 +2 -2
- package/dist/components/reui/cascader/cascader-columns.js +1 -1
- package/dist/components/reui/cascader/cascader-footer.js +1 -1
- package/dist/components/reui/cascader/cascader-item.js +1 -1
- package/dist/components/reui/cascader/cascader-nav.js +1 -1
- package/dist/components/reui/cascader/cascader.js +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -1
- 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 +1 -1
- 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/filters-advanced.js +1 -1
- package/dist/components/reui/filters/filters-advanced.js.map +1 -1
- package/dist/components/reui/filters/filters-builder.js +1 -1
- package/dist/components/reui/filters/filters-chip.js +1 -1
- package/dist/components/reui/filters/filters-editors.js +1 -1
- package/dist/components/reui/filters/filters.js +1 -1
- package/dist/components/reui/frame.d.ts +2 -2
- 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 +1 -1
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/reui/number-field.js +1 -1
- package/dist/components/reui/phone-input.js +1 -1
- 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.js +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/checkbox.js +2 -2
- package/dist/components/ui/checkbox.js.map +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.js +2 -2
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/input-group.d.ts +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.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/questionnaire.js +3 -3
- package/dist/components/ui/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/radio-group.js.map +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/spinner.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toast.js +2 -2
- package/dist/components/ui/toast.js.map +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/{copy-menu-TIKvPaAZ.js → copy-menu-C5GaT4Z-.js} +2 -2
- package/dist/{copy-menu-TIKvPaAZ.js.map → copy-menu-C5GaT4Z-.js.map} +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { TOUCH_GESTURE_CLASS, capturePointer, releasePointer } from "../../lib/touch.js";
|
|
3
|
+
import { snapSliderValue, useSlider } from "../../hooks/use-slider.js";
|
|
4
|
+
import { SPRING_GLIDE } from "../../lib/ease.js";
|
|
5
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { cn } from "@kumix/utils";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { animate, motion, useMotionValue, useReducedMotion, useTransform } from "motion/react";
|
|
9
|
+
//#region src/components/motion/range-slider-inline.tsx
|
|
10
|
+
const STOP_COUNT = 10;
|
|
11
|
+
const HANDLE_START = 8;
|
|
12
|
+
const HANDLE_END_INSET = 12;
|
|
13
|
+
const TEXT_INSET = 20;
|
|
14
|
+
const SPRING_BOUNCY = {
|
|
15
|
+
type: "spring",
|
|
16
|
+
stiffness: 500,
|
|
17
|
+
damping: 14,
|
|
18
|
+
mass: .7
|
|
19
|
+
};
|
|
20
|
+
function mapBetweenStops(stops, point, from, to) {
|
|
21
|
+
const upperIndex = stops.findIndex((stop) => stop[from] >= point);
|
|
22
|
+
const upper = stops[upperIndex < 0 ? stops.length - 1 : upperIndex];
|
|
23
|
+
const lower = stops[Math.max(0, upperIndex - 1)];
|
|
24
|
+
if (lower[from] === upper[from]) return upper[to];
|
|
25
|
+
return lower[to] + (point - lower[from]) / (upper[from] - lower[from]) * (upper[to] - lower[to]);
|
|
26
|
+
}
|
|
27
|
+
function nearestStop(stops, x) {
|
|
28
|
+
return stops.reduce((nearest, stop) => Math.abs(stop.x - x) < Math.abs(nearest.x - x) ? stop : nearest);
|
|
29
|
+
}
|
|
30
|
+
/** An always-visible inline slider with an inset fill and a thumb that parts
|
|
31
|
+
* around its labels, keeping their text readable as the handle passes them. */
|
|
32
|
+
function InlineSlider({ label, format = String, showTicks = true, className, ...options }) {
|
|
33
|
+
const reduce = useReducedMotion();
|
|
34
|
+
const step = options.step && options.step > 0 ? options.step : 1;
|
|
35
|
+
const precision = step.toFixed(6).replace(/0+$/, "").split(".")[1]?.length ?? 0;
|
|
36
|
+
const { current, min, max, commit, trackProps, sliderProps } = useSlider({
|
|
37
|
+
...options,
|
|
38
|
+
step: 10 ** -precision,
|
|
39
|
+
"aria-label": options["aria-label"] ?? label,
|
|
40
|
+
formatValueText: options.formatValueText ?? format
|
|
41
|
+
});
|
|
42
|
+
const labelRef = useRef(null);
|
|
43
|
+
const readoutRef = useRef(null);
|
|
44
|
+
const [geometry, setGeometry] = useState({
|
|
45
|
+
width: 292,
|
|
46
|
+
labelWidth: 22,
|
|
47
|
+
readoutWidth: 24
|
|
48
|
+
});
|
|
49
|
+
const [dragging, setDragging] = useState(false);
|
|
50
|
+
const dragFrame = useRef(null);
|
|
51
|
+
const pendingDragValue = useRef(null);
|
|
52
|
+
const gesture = useRef(null);
|
|
53
|
+
useLayoutEffect(() => {
|
|
54
|
+
const track = trackProps.ref.current;
|
|
55
|
+
const labelElement = labelRef.current;
|
|
56
|
+
const readout = readoutRef.current;
|
|
57
|
+
if (!track || !labelElement || !readout) return;
|
|
58
|
+
const measure = () => {
|
|
59
|
+
const width = track.getBoundingClientRect().width;
|
|
60
|
+
if (!width) return;
|
|
61
|
+
const next = {
|
|
62
|
+
width,
|
|
63
|
+
labelWidth: labelElement.getBoundingClientRect().width,
|
|
64
|
+
readoutWidth: readout.getBoundingClientRect().width
|
|
65
|
+
};
|
|
66
|
+
setGeometry((previous) => previous.width === next.width && previous.labelWidth === next.labelWidth && previous.readoutWidth === next.readoutWidth ? previous : next);
|
|
67
|
+
};
|
|
68
|
+
measure();
|
|
69
|
+
const observer = new ResizeObserver(measure);
|
|
70
|
+
observer.observe(track);
|
|
71
|
+
observer.observe(labelElement);
|
|
72
|
+
observer.observe(readout);
|
|
73
|
+
return () => observer.disconnect();
|
|
74
|
+
}, [trackProps.ref]);
|
|
75
|
+
const endX = Math.max(HANDLE_START, geometry.width - HANDLE_END_INSET);
|
|
76
|
+
const stops = useMemo(() => {
|
|
77
|
+
const values = [...new Set(Array.from({ length: STOP_COUNT }, (_, index) => snapSliderValue(min + index / 9 * (max - min), min, max, step)))];
|
|
78
|
+
return values.map((value, index) => ({
|
|
79
|
+
value,
|
|
80
|
+
x: values.length === 1 ? HANDLE_START : HANDLE_START + index / (values.length - 1) * (endX - HANDLE_START)
|
|
81
|
+
}));
|
|
82
|
+
}, [
|
|
83
|
+
min,
|
|
84
|
+
max,
|
|
85
|
+
step,
|
|
86
|
+
endX
|
|
87
|
+
]);
|
|
88
|
+
const restingX = mapBetweenStops(stops, current, "value", "x");
|
|
89
|
+
const handleX = useMotionValue(restingX);
|
|
90
|
+
const restingTarget = useRef(restingX);
|
|
91
|
+
const settleTo = useCallback((x) => {
|
|
92
|
+
restingTarget.current = x;
|
|
93
|
+
handleX.jump(handleX.get());
|
|
94
|
+
if (reduce) handleX.jump(x);
|
|
95
|
+
else animate(handleX, x, {
|
|
96
|
+
type: "spring",
|
|
97
|
+
...SPRING_GLIDE
|
|
98
|
+
});
|
|
99
|
+
}, [handleX, reduce]);
|
|
100
|
+
useLayoutEffect(() => {
|
|
101
|
+
if (gesture.current || restingTarget.current === restingX) return;
|
|
102
|
+
settleTo(restingX);
|
|
103
|
+
}, [restingX, settleTo]);
|
|
104
|
+
useEffect(() => () => {
|
|
105
|
+
handleX.stop();
|
|
106
|
+
if (dragFrame.current !== null) cancelAnimationFrame(dragFrame.current);
|
|
107
|
+
}, [handleX]);
|
|
108
|
+
const fillRight = useTransform(handleX, (x) => x >= endX ? geometry.width - 2 : x + 8);
|
|
109
|
+
const fillX = useTransform(fillRight, (right) => right - geometry.width + 2);
|
|
110
|
+
const split = useTransform(handleX, (x) => {
|
|
111
|
+
const overlap = (start, end) => Math.max(0, Math.min(1, (x + 4 - start) / 6, (end - x) / 6));
|
|
112
|
+
return Math.max(overlap(TEXT_INSET, TEXT_INSET + geometry.labelWidth), overlap(geometry.width - TEXT_INSET - geometry.readoutWidth, geometry.width - TEXT_INSET));
|
|
113
|
+
});
|
|
114
|
+
const stemOpacity = useTransform(split, (amount) => 1 - amount);
|
|
115
|
+
const capTop = useTransform(split, (amount) => -amount);
|
|
116
|
+
const capBottom = useTransform(split, (amount) => amount);
|
|
117
|
+
const labelBounds = {
|
|
118
|
+
start: TEXT_INSET,
|
|
119
|
+
end: TEXT_INSET + geometry.labelWidth
|
|
120
|
+
};
|
|
121
|
+
const readoutBounds = {
|
|
122
|
+
start: geometry.width - TEXT_INSET - geometry.readoutWidth,
|
|
123
|
+
end: geometry.width - TEXT_INSET
|
|
124
|
+
};
|
|
125
|
+
const overlapsText = (x, bounds) => x + 2 >= bounds.start && x - 2 <= bounds.end;
|
|
126
|
+
const ticks = showTicks ? stops.map((stop) => stop.x).filter((x) => !overlapsText(x, labelBounds) && !overlapsText(x, readoutBounds)) : [];
|
|
127
|
+
const queueDragCommit = (value) => {
|
|
128
|
+
pendingDragValue.current = value;
|
|
129
|
+
if (dragFrame.current !== null) return;
|
|
130
|
+
dragFrame.current = requestAnimationFrame(() => {
|
|
131
|
+
dragFrame.current = null;
|
|
132
|
+
if (pendingDragValue.current !== null) commit(pendingDragValue.current);
|
|
133
|
+
pendingDragValue.current = null;
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
const cancelDragCommit = () => {
|
|
137
|
+
if (dragFrame.current !== null) cancelAnimationFrame(dragFrame.current);
|
|
138
|
+
dragFrame.current = null;
|
|
139
|
+
pendingDragValue.current = null;
|
|
140
|
+
};
|
|
141
|
+
const endGesture = (event) => {
|
|
142
|
+
const active = gesture.current;
|
|
143
|
+
if (!active || active.id !== event.pointerId) return;
|
|
144
|
+
gesture.current = null;
|
|
145
|
+
cancelDragCommit();
|
|
146
|
+
setDragging(false);
|
|
147
|
+
if (!options.disabled && geometry.width > 0) {
|
|
148
|
+
const x = event.type === "pointerup" ? event.clientX - active.left - active.offset : active.x;
|
|
149
|
+
const stop = nearestStop(stops, x);
|
|
150
|
+
commit(stop.value);
|
|
151
|
+
settleTo(options.value === void 0 ? stop.x : restingX);
|
|
152
|
+
} else settleTo(restingX);
|
|
153
|
+
releasePointer(event.currentTarget, event.pointerId);
|
|
154
|
+
};
|
|
155
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
156
|
+
...trackProps,
|
|
157
|
+
onPointerDown: (event) => {
|
|
158
|
+
if (options.disabled || event.button !== 0 || gesture.current) return;
|
|
159
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
160
|
+
if (!rect.width) return;
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
const pointerX = event.clientX - rect.left;
|
|
163
|
+
const thumbX = handleX.get();
|
|
164
|
+
const offset = Math.abs(pointerX - thumbX - 2) <= 12 ? pointerX - thumbX : 2;
|
|
165
|
+
gesture.current = {
|
|
166
|
+
id: event.pointerId,
|
|
167
|
+
left: rect.left,
|
|
168
|
+
offset,
|
|
169
|
+
x: thumbX
|
|
170
|
+
};
|
|
171
|
+
setDragging(true);
|
|
172
|
+
handleX.stop();
|
|
173
|
+
cancelDragCommit();
|
|
174
|
+
capturePointer(event.currentTarget, event.pointerId);
|
|
175
|
+
event.currentTarget.querySelector("[role=slider]")?.focus({ preventScroll: true });
|
|
176
|
+
},
|
|
177
|
+
onPointerMove: (event) => {
|
|
178
|
+
const active = gesture.current;
|
|
179
|
+
if (!active || active.id !== event.pointerId || options.disabled) return;
|
|
180
|
+
const x = Math.min(endX, Math.max(HANDLE_START, event.clientX - active.left - active.offset));
|
|
181
|
+
active.x = x;
|
|
182
|
+
handleX.set(x);
|
|
183
|
+
queueDragCommit(mapBetweenStops(stops, x, "x", "value"));
|
|
184
|
+
},
|
|
185
|
+
onPointerUp: endGesture,
|
|
186
|
+
onPointerCancel: endGesture,
|
|
187
|
+
onLostPointerCapture: endGesture,
|
|
188
|
+
className: cn("relative h-10 w-full touch-none select-none overflow-hidden rounded-lg bg-muted", TOUCH_GESTURE_CLASS, options.disabled ? "pointer-events-none opacity-50" : "cursor-grab active:cursor-grabbing", className),
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ jsx("div", {
|
|
191
|
+
"aria-hidden": "true",
|
|
192
|
+
className: "pointer-events-none absolute inset-x-[2px] inset-y-0 overflow-hidden rounded-lg",
|
|
193
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
194
|
+
className: "absolute inset-0 rounded-lg bg-foreground/15",
|
|
195
|
+
style: { x: fillX }
|
|
196
|
+
})
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ jsxs("div", {
|
|
199
|
+
"aria-hidden": "true",
|
|
200
|
+
className: "pointer-events-none absolute inset-0 text-foreground",
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ jsx("span", {
|
|
203
|
+
ref: labelRef,
|
|
204
|
+
className: "absolute top-1/2 left-5 max-w-[40%] -translate-y-1/2 truncate font-medium text-sm leading-5",
|
|
205
|
+
children: label
|
|
206
|
+
}),
|
|
207
|
+
/* @__PURE__ */ jsx("span", {
|
|
208
|
+
ref: readoutRef,
|
|
209
|
+
className: "absolute top-1/2 right-5 max-w-[40%] -translate-y-1/2 truncate font-semibold text-[13px] tabular-nums leading-[18px] tracking-tight",
|
|
210
|
+
children: format(current)
|
|
211
|
+
}),
|
|
212
|
+
ticks.map((left) => /* @__PURE__ */ jsx("span", {
|
|
213
|
+
className: "absolute top-1/2 size-1 -translate-y-1/2 rounded-full bg-foreground/25",
|
|
214
|
+
style: { left }
|
|
215
|
+
}, left))
|
|
216
|
+
]
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ jsxs(motion.div, {
|
|
219
|
+
"aria-hidden": "true",
|
|
220
|
+
animate: reduce ? void 0 : { scaleY: dragging ? 1.35 : 1 },
|
|
221
|
+
transition: SPRING_BOUNCY,
|
|
222
|
+
className: "pointer-events-none absolute top-2 left-0 h-6 w-1 text-foreground",
|
|
223
|
+
style: { x: handleX },
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx(motion.span, {
|
|
226
|
+
className: "absolute top-0 size-1 rounded-full bg-current",
|
|
227
|
+
style: { y: reduce ? 0 : capTop }
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ jsx(motion.span, {
|
|
230
|
+
className: "absolute inset-y-0 w-1 rounded-full bg-current",
|
|
231
|
+
style: { opacity: stemOpacity }
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ jsx(motion.span, {
|
|
234
|
+
className: "absolute bottom-0 size-1 rounded-full bg-current",
|
|
235
|
+
style: { y: reduce ? 0 : capBottom }
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
}),
|
|
239
|
+
/* @__PURE__ */ jsx("button", {
|
|
240
|
+
type: "button",
|
|
241
|
+
...sliderProps,
|
|
242
|
+
onKeyDown: (event) => {
|
|
243
|
+
if (options.disabled) return;
|
|
244
|
+
const next = {
|
|
245
|
+
ArrowRight: stops.find((stop) => stop.value > current)?.value ?? max,
|
|
246
|
+
ArrowUp: stops.find((stop) => stop.value > current)?.value ?? max,
|
|
247
|
+
ArrowLeft: stops.findLast((stop) => stop.value < current)?.value ?? min,
|
|
248
|
+
ArrowDown: stops.findLast((stop) => stop.value < current)?.value ?? min,
|
|
249
|
+
Home: min,
|
|
250
|
+
End: max,
|
|
251
|
+
PageUp: max,
|
|
252
|
+
PageDown: min
|
|
253
|
+
}[event.key];
|
|
254
|
+
if (next !== void 0) {
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
commit(next);
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
className: "absolute inset-0 cursor-inherit touch-none rounded-lg border-0 outline-none"
|
|
260
|
+
})
|
|
261
|
+
]
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
export { InlineSlider };
|
|
266
|
+
|
|
267
|
+
//# sourceMappingURL=range-slider-inline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range-slider-inline.js","names":[],"sources":["../../../src/components/motion/range-slider-inline.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type PointerEvent,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { animate, motion, useMotionValue, useReducedMotion, useTransform } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { type SliderOptions, snapSliderValue, useSlider } from \"../../hooks/use-slider\";\nimport { SPRING_GLIDE } from \"../../lib/ease\";\nimport { capturePointer, releasePointer, TOUCH_GESTURE_CLASS } from \"../../lib/touch\";\n\nconst STOP_COUNT = 10;\nconst HANDLE_START = 8;\nconst HANDLE_END_INSET = 12;\nconst TEXT_INSET = 20;\n// Matches RangeSlider's bouncy grab and release feedback.\nconst SPRING_BOUNCY = { type: \"spring\", stiffness: 500, damping: 14, mass: 0.7 } as const;\n\ntype Stop = { value: number; x: number };\n\nfunction mapBetweenStops(stops: Stop[], point: number, from: keyof Stop, to: keyof Stop) {\n const upperIndex = stops.findIndex((stop) => stop[from] >= point);\n const upper = stops[upperIndex < 0 ? stops.length - 1 : upperIndex];\n const lower = stops[Math.max(0, upperIndex - 1)];\n if (lower[from] === upper[from]) return upper[to];\n return (\n lower[to] + ((point - lower[from]) / (upper[from] - lower[from])) * (upper[to] - lower[to])\n );\n}\n\nfunction nearestStop(stops: Stop[], x: number) {\n return stops.reduce((nearest, stop) =>\n Math.abs(stop.x - x) < Math.abs(nearest.x - x) ? stop : nearest,\n );\n}\n\nexport interface InlineSliderProps extends SliderOptions {\n /** Rounds snap-stop values. While dragging, the readout keeps this step's decimal precision. */\n step?: number;\n /** Compact label inside the left edge of the track. */\n label: string;\n /** Formats the inline value without changing its precision. */\n format?: (value: number) => string;\n /** Show markers for the ten evenly spaced snap stops, except where they overlap inline text. */\n showTicks?: boolean;\n className?: string;\n}\n\n/** An always-visible inline slider with an inset fill and a thumb that parts\n * around its labels, keeping their text readable as the handle passes them. */\nexport function InlineSlider({\n label,\n format = String,\n showTicks = true,\n className,\n ...options\n}: InlineSliderProps) {\n const reduce = useReducedMotion();\n const step = options.step && options.step > 0 ? options.step : 1;\n const precision = step.toFixed(6).replace(/0+$/, \"\").split(\".\")[1]?.length ?? 0;\n const { current, min, max, commit, trackProps, sliderProps } = useSlider({\n ...options,\n step: 10 ** -precision,\n \"aria-label\": options[\"aria-label\"] ?? label,\n formatValueText: options.formatValueText ?? format,\n });\n const labelRef = useRef<HTMLSpanElement>(null);\n const readoutRef = useRef<HTMLSpanElement>(null);\n const [geometry, setGeometry] = useState({\n width: 292,\n labelWidth: 22,\n readoutWidth: 24,\n });\n const [dragging, setDragging] = useState(false);\n const dragFrame = useRef<number | null>(null);\n const pendingDragValue = useRef<number | null>(null);\n const gesture = useRef<{\n id: number;\n left: number;\n offset: number;\n x: number;\n } | null>(null);\n\n useLayoutEffect(() => {\n const track = trackProps.ref.current;\n const labelElement = labelRef.current;\n const readout = readoutRef.current;\n if (!track || !labelElement || !readout) return;\n const measure = () => {\n const width = track.getBoundingClientRect().width;\n if (!width) return;\n const next = {\n width,\n labelWidth: labelElement.getBoundingClientRect().width,\n readoutWidth: readout.getBoundingClientRect().width,\n };\n setGeometry((previous) =>\n previous.width === next.width &&\n previous.labelWidth === next.labelWidth &&\n previous.readoutWidth === next.readoutWidth\n ? previous\n : next,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(track);\n observer.observe(labelElement);\n observer.observe(readout);\n return () => observer.disconnect();\n }, [trackProps.ref]);\n\n // Each stop owns both a value and a physical position. As in RangeSlider,\n // the stops span the entire track at even intervals; text only affects\n // whether a marker is painted, never whether its stop remains interactive.\n const endX = Math.max(HANDLE_START, geometry.width - HANDLE_END_INSET);\n const stops = useMemo(() => {\n const values = [\n ...new Set(\n Array.from({ length: STOP_COUNT }, (_, index) =>\n snapSliderValue(min + (index / (STOP_COUNT - 1)) * (max - min), min, max, step),\n ),\n ),\n ];\n return values.map((value, index) => ({\n value,\n x:\n values.length === 1\n ? HANDLE_START\n : HANDLE_START + (index / (values.length - 1)) * (endX - HANDLE_START),\n }));\n }, [min, max, step, endX]);\n const restingX = mapBetweenStops(stops, current, \"value\", \"x\");\n // One motion value owns the thumb for the entire gesture. Pointer movement\n // writes pixels directly; only release/click/keyboard changes use a spring.\n // Never derive dragging pixels from a rounded value or swap to a lagging spring.\n const handleX = useMotionValue(restingX);\n const restingTarget = useRef(restingX);\n const settleTo = useCallback(\n (x: number) => {\n restingTarget.current = x;\n handleX.jump(handleX.get());\n if (reduce) handleX.jump(x);\n else animate(handleX, x, { type: \"spring\", ...SPRING_GLIDE });\n },\n [handleX, reduce],\n );\n useLayoutEffect(() => {\n if (gesture.current || restingTarget.current === restingX) return;\n settleTo(restingX);\n }, [restingX, settleTo]);\n useEffect(\n () => () => {\n handleX.stop();\n if (dragFrame.current !== null) cancelAnimationFrame(dragFrame.current);\n },\n [handleX],\n );\n const fillRight = useTransform(handleX, (x) => (x >= endX ? geometry.width - 2 : x + 8));\n // Slide a fixed-size fill inside the inset clipping window. The labels and\n // dots stay above it, and only transforms animate.\n const fillX = useTransform(fillRight, (right) => right - geometry.width + 2);\n // Part progressively over six pixels at each text edge instead of\n // toggling the stem on/off in a single pointer frame. The thumb uses the\n // same two-dot treatment across both the label and numeric readout.\n const split = useTransform(handleX, (x) => {\n const overlap = (start: number, end: number) =>\n Math.max(0, Math.min(1, (x + 4 - start) / 6, (end - x) / 6));\n return Math.max(\n overlap(TEXT_INSET, TEXT_INSET + geometry.labelWidth),\n overlap(geometry.width - TEXT_INSET - geometry.readoutWidth, geometry.width - TEXT_INSET),\n );\n });\n const stemOpacity = useTransform(split, (amount) => 1 - amount);\n const capTop = useTransform(split, (amount) => -amount);\n const capBottom = useTransform(split, (amount) => amount);\n const labelBounds = { start: TEXT_INSET, end: TEXT_INSET + geometry.labelWidth };\n const readoutBounds = {\n start: geometry.width - TEXT_INSET - geometry.readoutWidth,\n end: geometry.width - TEXT_INSET,\n };\n const overlapsText = (x: number, bounds: { start: number; end: number }) =>\n x + 2 >= bounds.start && x - 2 <= bounds.end;\n const ticks = showTicks\n ? stops\n .map((stop) => stop.x)\n .filter((x) => !overlapsText(x, labelBounds) && !overlapsText(x, readoutBounds))\n : [];\n\n const queueDragCommit = (value: number) => {\n pendingDragValue.current = value;\n if (dragFrame.current !== null) return;\n dragFrame.current = requestAnimationFrame(() => {\n dragFrame.current = null;\n if (pendingDragValue.current !== null) commit(pendingDragValue.current);\n pendingDragValue.current = null;\n });\n };\n\n const cancelDragCommit = () => {\n if (dragFrame.current !== null) cancelAnimationFrame(dragFrame.current);\n dragFrame.current = null;\n pendingDragValue.current = null;\n };\n\n const endGesture = (event: PointerEvent<HTMLDivElement>) => {\n const active = gesture.current;\n if (!active || active.id !== event.pointerId) return;\n // Clear before releasing capture: its lost-capture event must not commit twice.\n gesture.current = null;\n cancelDragCommit();\n setDragging(false);\n if (!options.disabled && geometry.width > 0) {\n const x = event.type === \"pointerup\" ? event.clientX - active.left - active.offset : active.x;\n const stop = nearestStop(stops, x);\n commit(stop.value);\n settleTo(options.value === undefined ? stop.x : restingX);\n } else {\n settleTo(restingX);\n }\n releasePointer(event.currentTarget, event.pointerId);\n };\n\n return (\n <div\n {...trackProps}\n onPointerDown={(event) => {\n if (options.disabled || event.button !== 0 || gesture.current) return;\n const rect = event.currentTarget.getBoundingClientRect();\n if (!rect.width) return;\n event.preventDefault();\n const pointerX = event.clientX - rect.left;\n const thumbX = handleX.get();\n // Grabbing the thumb preserves the exact grab point. A track click\n // waits for release, so it glides to a dot without an intermediate jump.\n const offset = Math.abs(pointerX - thumbX - 2) <= 12 ? pointerX - thumbX : 2;\n gesture.current = { id: event.pointerId, left: rect.left, offset, x: thumbX };\n setDragging(true);\n handleX.stop();\n cancelDragCommit();\n capturePointer(event.currentTarget, event.pointerId);\n event.currentTarget\n .querySelector<HTMLButtonElement>(\"[role=slider]\")\n ?.focus({ preventScroll: true });\n }}\n onPointerMove={(event) => {\n const active = gesture.current;\n if (!active || active.id !== event.pointerId || options.disabled) return;\n const x = Math.min(\n endX,\n Math.max(HANDLE_START, event.clientX - active.left - active.offset),\n );\n active.x = x;\n handleX.set(x);\n // Use the same piecewise map as the resting stops, so value and\n // position agree throughout the drag.\n queueDragCommit(mapBetweenStops(stops, x, \"x\", \"value\"));\n }}\n onPointerUp={endGesture}\n onPointerCancel={endGesture}\n onLostPointerCapture={endGesture}\n className={cn(\n \"relative h-10 w-full touch-none select-none overflow-hidden rounded-lg bg-muted\",\n TOUCH_GESTURE_CLASS,\n options.disabled ? \"pointer-events-none opacity-50\" : \"cursor-grab active:cursor-grabbing\",\n className,\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-x-[2px] inset-y-0 overflow-hidden rounded-lg\"\n >\n <motion.div className=\"absolute inset-0 rounded-lg bg-foreground/15\" style={{ x: fillX }} />\n </div>\n <div aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0 text-foreground\">\n <span\n ref={labelRef}\n className=\"absolute top-1/2 left-5 max-w-[40%] -translate-y-1/2 truncate font-medium text-sm leading-5\"\n >\n {label}\n </span>\n <span\n ref={readoutRef}\n className=\"absolute top-1/2 right-5 max-w-[40%] -translate-y-1/2 truncate font-semibold text-[13px] tabular-nums leading-[18px] tracking-tight\"\n >\n {format(current)}\n </span>\n {ticks.map((left) => (\n <span\n key={left}\n className=\"absolute top-1/2 size-1 -translate-y-1/2 rounded-full bg-foreground/25\"\n style={{ left }}\n />\n ))}\n </div>\n <motion.div\n aria-hidden=\"true\"\n animate={reduce ? undefined : { scaleY: dragging ? 1.35 : 1 }}\n transition={SPRING_BOUNCY}\n className=\"pointer-events-none absolute top-2 left-0 h-6 w-1 text-foreground\"\n style={{ x: handleX }}\n >\n <motion.span\n className=\"absolute top-0 size-1 rounded-full bg-current\"\n style={{ y: reduce ? 0 : capTop }}\n />\n <motion.span\n className=\"absolute inset-y-0 w-1 rounded-full bg-current\"\n style={{ opacity: stemOpacity }}\n />\n <motion.span\n className=\"absolute bottom-0 size-1 rounded-full bg-current\"\n style={{ y: reduce ? 0 : capBottom }}\n />\n </motion.div>\n <button\n type=\"button\"\n {...sliderProps}\n onKeyDown={(event) => {\n if (options.disabled) return;\n const next = {\n ArrowRight: stops.find((stop) => stop.value > current)?.value ?? max,\n ArrowUp: stops.find((stop) => stop.value > current)?.value ?? max,\n ArrowLeft: stops.findLast((stop) => stop.value < current)?.value ?? min,\n ArrowDown: stops.findLast((stop) => stop.value < current)?.value ?? min,\n Home: min,\n End: max,\n PageUp: max,\n PageDown: min,\n }[event.key];\n if (next !== undefined) {\n event.preventDefault();\n commit(next);\n }\n }}\n className=\"absolute inset-0 cursor-inherit touch-none rounded-lg border-0 outline-none\"\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAkBA,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,mBAAmB;AACzB,MAAM,aAAa;AAEnB,MAAM,gBAAgB;CAAE,MAAM;CAAU,WAAW;CAAK,SAAS;CAAI,MAAM;AAAI;AAI/E,SAAS,gBAAgB,OAAe,OAAe,MAAkB,IAAgB;CACvF,MAAM,aAAa,MAAM,WAAW,SAAS,KAAK,SAAS,KAAK;CAChE,MAAM,QAAQ,MAAM,aAAa,IAAI,MAAM,SAAS,IAAI;CACxD,MAAM,QAAQ,MAAM,KAAK,IAAI,GAAG,aAAa,CAAC;CAC9C,IAAI,MAAM,UAAU,MAAM,OAAO,OAAO,MAAM;CAC9C,OACE,MAAM,OAAQ,QAAQ,MAAM,UAAU,MAAM,QAAQ,MAAM,UAAW,MAAM,MAAM,MAAM;AAE3F;AAEA,SAAS,YAAY,OAAe,GAAW;CAC7C,OAAO,MAAM,QAAQ,SAAS,SAC5B,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,QAAQ,IAAI,CAAC,IAAI,OAAO,OAC1D;AACF;;;AAgBA,SAAgB,aAAa,EAC3B,OACA,SAAS,QACT,YAAY,MACZ,WACA,GAAG,WACiB;CACpB,MAAM,SAAS,iBAAiB;CAChC,MAAM,OAAO,QAAQ,QAAQ,QAAQ,OAAO,IAAI,QAAQ,OAAO;CAC/D,MAAM,YAAY,KAAK,QAAQ,CAAC,CAAC,CAA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AAQ;MACR,UAAU;KACZ,EAAE,MAAM;KACR,IAAI,SAAS,KAAA,GAAW;MACtB,MAAM,eAAe;MACrB,OAAO,IAAI;KACb;IACF;IACA,WAAU;GACX,CAAA;EACE;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-slider.d.ts","names":[],"sources":["../../../src/components/motion/range-slider.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"range-slider.d.ts","names":[],"sources":["../../../src/components/motion/range-slider.tsx"],"mappings":";;iBAaiB,yBAAyB;;EAExC;EACA;;wBAGc,cAAc,WAAkB,cAAc,WAAW,mCAAgB,IAAA"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { TOUCH_GESTURE_CLASS } from "../../lib/touch.js";
|
|
3
3
|
import { useSlider } from "../../hooks/use-slider.js";
|
|
4
4
|
import { SPRING_GLIDE } from "../../lib/ease.js";
|
|
5
|
-
import { useEffect } from "react";
|
|
5
|
+
import { useEffect, useLayoutEffect, useState } from "react";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { motion,
|
|
8
|
+
import { motion, useMotionValue, useReducedMotion, useSpring, useTransform } from "motion/react";
|
|
9
9
|
//#region src/components/motion/range-slider.tsx
|
|
10
10
|
const SPRING_BOUNCY = {
|
|
11
11
|
type: "spring",
|
|
@@ -16,26 +16,43 @@ const SPRING_BOUNCY = {
|
|
|
16
16
|
function RangeSlider({ showTicks = true, className, ...options }) {
|
|
17
17
|
const reduce = useReducedMotion();
|
|
18
18
|
const { percent, dragging, min, max, step, trackProps, sliderProps } = useSlider(options);
|
|
19
|
+
const [trackWidth, setTrackWidth] = useState(292);
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
const track = trackProps.ref.current;
|
|
22
|
+
if (!track) return;
|
|
23
|
+
const measure = () => {
|
|
24
|
+
const width = track.getBoundingClientRect().width;
|
|
25
|
+
if (width > 0) setTrackWidth(width);
|
|
26
|
+
};
|
|
27
|
+
measure();
|
|
28
|
+
const observer = new ResizeObserver(measure);
|
|
29
|
+
observer.observe(track);
|
|
30
|
+
return () => observer.disconnect();
|
|
31
|
+
}, [trackProps.ref]);
|
|
19
32
|
const target = useMotionValue(percent);
|
|
20
33
|
useEffect(() => {
|
|
21
34
|
target.set(percent);
|
|
22
35
|
}, [percent, target]);
|
|
23
36
|
const smooth = useSpring(target, SPRING_GLIDE);
|
|
24
37
|
const pos = reduce ? target : smooth;
|
|
25
|
-
const
|
|
26
|
-
const
|
|
38
|
+
const thumbX = useTransform(pos, (p) => 8 + Math.max(0, trackWidth - 20) * p / 100);
|
|
39
|
+
const fillX = useTransform(pos, (p) => p >= 100 ? "0%" : `calc(${p - 100}% + ${14 - .16 * p}px)`);
|
|
27
40
|
const steps = Math.floor(Number(((max - min) / step).toFixed(6)));
|
|
28
41
|
const ticks = showTicks && steps > 0 && steps <= 50 ? Array.from({ length: steps + 1 }, (_, i) => Number((min + i * step).toFixed(6))) : [];
|
|
29
42
|
return /* @__PURE__ */ jsxs("div", {
|
|
30
43
|
...trackProps,
|
|
31
44
|
className: cn("relative flex h-10 w-full touch-none items-center overflow-hidden rounded-lg bg-muted", TOUCH_GESTURE_CLASS, options.disabled ? "pointer-events-none opacity-50" : "cursor-grab active:cursor-grabbing", className),
|
|
32
45
|
children: [
|
|
33
|
-
/* @__PURE__ */ jsx(
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
/* @__PURE__ */ jsx("div", {
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
className: "pointer-events-none absolute inset-x-[2px] inset-y-0 overflow-hidden rounded-lg",
|
|
49
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
50
|
+
className: "absolute inset-0 rounded-lg bg-foreground/15",
|
|
51
|
+
style: { x: fillX }
|
|
52
|
+
})
|
|
36
53
|
}),
|
|
37
54
|
/* @__PURE__ */ jsx("div", {
|
|
38
|
-
className: "pointer-events-none absolute inset-x-[
|
|
55
|
+
className: "pointer-events-none absolute inset-x-[10px] inset-y-0",
|
|
39
56
|
children: ticks.map((t) => {
|
|
40
57
|
const tp = (t - min) / (max - min) * 100;
|
|
41
58
|
return /* @__PURE__ */ jsx("span", {
|
|
@@ -48,9 +65,8 @@ function RangeSlider({ showTicks = true, className, ...options }) {
|
|
|
48
65
|
...sliderProps,
|
|
49
66
|
animate: reduce ? void 0 : { scaleY: dragging ? 1.35 : 1 },
|
|
50
67
|
transition: SPRING_BOUNCY,
|
|
51
|
-
className: "absolute top-1/2 h-
|
|
68
|
+
className: "absolute top-1/2 left-0 h-6 w-1 rounded-full bg-foreground outline-none ring-foreground/30 ring-inset focus-visible:ring-4",
|
|
52
69
|
style: {
|
|
53
|
-
left,
|
|
54
70
|
x: thumbX,
|
|
55
71
|
y: "-50%"
|
|
56
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-slider.js","names":[],"sources":["../../../src/components/motion/range-slider.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"range-slider.js","names":[],"sources":["../../../src/components/motion/range-slider.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useLayoutEffect, useState } from \"react\";\nimport { motion, useMotionValue, useReducedMotion, useSpring, useTransform } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { type SliderOptions, useSlider } from \"../../hooks/use-slider\";\nimport { SPRING_GLIDE } from \"../../lib/ease\";\nimport { TOUCH_GESTURE_CLASS } from \"../../lib/touch\";\n\n// Bouncy grab feedback for the thumb scale only.\nconst SPRING_BOUNCY = { type: \"spring\", stiffness: 500, damping: 14, mass: 0.7 } as const;\n\nexport interface RangeSliderProps extends SliderOptions {\n /** Render a tick dot at each step. */\n showTicks?: boolean;\n className?: string;\n}\n\nexport function RangeSlider({ showTicks = true, className, ...options }: RangeSliderProps) {\n const reduce = useReducedMotion();\n const { percent, dragging, min, max, step, trackProps, sliderProps } = useSlider(options);\n const [trackWidth, setTrackWidth] = useState(292);\n useLayoutEffect(() => {\n const track = trackProps.ref.current;\n if (!track) return;\n const measure = () => {\n const width = track.getBoundingClientRect().width;\n if (width > 0) setTrackWidth(width);\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(track);\n return () => observer.disconnect();\n }, [trackProps.ref]);\n\n // Spring-smoothed position drives both the thumb and the fill.\n const target = useMotionValue(percent);\n useEffect(() => {\n target.set(percent);\n }, [percent, target]);\n const smooth = useSpring(target, SPRING_GLIDE);\n const pos = reduce ? target : smooth;\n const thumbX = useTransform(pos, (p) => 8 + (Math.max(0, trackWidth - 20) * p) / 100);\n // Match InlineSlider: the 4px handle starts 8px inside the track, and\n // the rounded fill extends 8px past its left edge. Translate a full-size\n // fill inside the 2px inset clip so its corner never stretches.\n const fillX = useTransform(pos, (p) =>\n p >= 100 ? \"0%\" : `calc(${p - 100}% + ${14 - 0.16 * p}px)`,\n );\n\n // Floor rather than round, so a range the step does not divide (0 to 10 by 4)\n // stops its dots at the last whole step instead of drawing one past max.\n // toFixed comes first because 0.3/0.1 is 2.9999999999999996, which would\n // floor to 2 and drop the last dot.\n const steps = Math.floor(Number(((max - min) / step).toFixed(6)));\n const ticks =\n showTicks && steps > 0 && steps <= 50\n ? Array.from({ length: steps + 1 }, (_, i) => Number((min + i * step).toFixed(6)))\n : [];\n\n return (\n <div\n {...trackProps}\n className={cn(\n \"relative flex h-10 w-full touch-none items-center overflow-hidden rounded-lg bg-muted\",\n TOUCH_GESTURE_CLASS,\n options.disabled ? \"pointer-events-none opacity-50\" : \"cursor-grab active:cursor-grabbing\",\n className,\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-x-[2px] inset-y-0 overflow-hidden rounded-lg\"\n >\n <motion.div className=\"absolute inset-0 rounded-lg bg-foreground/15\" style={{ x: fillX }} />\n </div>\n\n {/* Tick centres follow the same inset path as the handle centre. */}\n <div className=\"pointer-events-none absolute inset-x-[10px] inset-y-0\">\n {ticks.map((t) => {\n const tp = ((t - min) / (max - min)) * 100;\n return (\n <span\n key={t}\n className=\"absolute top-1/2 size-1 -translate-x-1/2 -translate-y-1/2 rounded-full bg-foreground/25\"\n style={{ left: `${tp}%` }}\n />\n );\n })}\n </div>\n\n {/* Keep the handle inside the rounded progress fill at both ends. */}\n <motion.div\n {...sliderProps}\n animate={reduce ? undefined : { scaleY: dragging ? 1.35 : 1 }}\n transition={SPRING_BOUNCY}\n className=\"absolute top-1/2 left-0 h-6 w-1 rounded-full bg-foreground outline-none ring-foreground/30 ring-inset focus-visible:ring-4\"\n style={{ x: thumbX, y: \"-50%\" }}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAWA,MAAM,gBAAgB;CAAE,MAAM;CAAU,WAAW;CAAK,SAAS;CAAI,MAAM;AAAI;AAQ/E,SAAgB,YAAY,EAAE,YAAY,MAAM,WAAW,GAAG,WAA6B;CACzF,MAAM,SAAS,iBAAiB;CAChC,MAAM,EAAE,SAAS,UAAU,KAAK,KAAK,MAAM,YAAY,gBAAgB,UAAU,OAAO;CACxF,MAAM,CAAC,YAAY,iBAAiB,SAAS,GAAG;CAChD,sBAAsB;EACpB,MAAM,QAAQ,WAAW,IAAI;EAC7B,IAAI,CAAC,OAAO;EACZ,MAAM,gBAAgB;GACpB,MAAM,QAAQ,MAAM,sBAAsB,CAAC,CAAC;GAC5C,IAAI,QAAQ,GAAG,cAAc,KAAK;EACpC;EACA,QAAQ;EACR,MAAM,WAAW,IAAI,eAAe,OAAO;EAC3C,SAAS,QAAQ,KAAK;EACtB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,WAAW,GAAG,CAAC;CAGnB,MAAM,SAAS,eAAe,OAAO;CACrC,gBAAgB;EACd,OAAO,IAAI,OAAO;CACpB,GAAG,CAAC,SAAS,MAAM,CAAC;CACpB,MAAM,SAAS,UAAU,QAAQ,YAAY;CAC7C,MAAM,MAAM,SAAS,SAAS;CAC9B,M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
|
|
3
3
|
import { cn } from "@kumix/utils";
|
|
4
|
-
import { Check, ChevronDown } from "lucide-react";
|
|
5
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
6
|
+
import { Check, ChevronDown } from "lucide-react";
|
|
7
7
|
//#region src/components/motion/select-morph.tsx
|
|
8
8
|
const MORPH = {
|
|
9
9
|
type: "spring",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
3
|
import { createContext, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { Check, ChevronDown } from "lucide-react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { motion, useReducedMotion } from "motion/react";
|
|
7
|
+
import { Check, ChevronDown } from "lucide-react";
|
|
8
8
|
//#region src/components/motion/select.tsx
|
|
9
9
|
const INSTANT_TRANSITION = { duration: 0 };
|
|
10
10
|
const CHEVRON_TRANSITION = {
|
|
@@ -6,9 +6,9 @@ import { Checkbox } from "./checkbox.js";
|
|
|
6
6
|
import { Input } from "./input.js";
|
|
7
7
|
import { useCallback, useId, useMemo, useState } from "react";
|
|
8
8
|
import { cn } from "@kumix/utils";
|
|
9
|
-
import { Eye, EyeOff, Lock, Mail, User } from "lucide-react";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
11
|
+
import { Eye, EyeOff, Lock, Mail, User } from "lucide-react";
|
|
12
12
|
//#region src/components/motion/signup-form.tsx
|
|
13
13
|
const EMPTY_VALUES = {
|
|
14
14
|
name: "",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { TableMenu } from "./table-menu.js";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
|
-
import { ArrowDownToLine, ArrowUpToLine, MoreVertical, Trash2 } from "lucide-react";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { ArrowDownToLine, ArrowUpToLine, MoreVertical, Trash2 } from "lucide-react";
|
|
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
|
|
@@ -6,9 +6,9 @@ import { TableMenu } from "./table-menu.js";
|
|
|
6
6
|
import { i as alignText, n as COLUMN_ACTIVE_SHADOW, r as alignFlex } from "../../../utils-DQ7OpbYQ.js";
|
|
7
7
|
import { useEffect } from "react";
|
|
8
8
|
import { cn } from "@kumix/utils";
|
|
9
|
-
import { ArrowLeftToLine, ArrowRightToLine, ChevronUp, GripVertical, MoreHorizontal, Trash2 } from "lucide-react";
|
|
10
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { motion } from "motion/react";
|
|
11
|
+
import { ArrowLeftToLine, ArrowRightToLine, ChevronUp, GripVertical, MoreHorizontal, Trash2 } from "lucide-react";
|
|
12
12
|
import { createPortal } from "react-dom";
|
|
13
13
|
//#region src/components/motion/table/table-header.tsx
|
|
14
14
|
/** Column insert / delete menu items shared by the header cell and the portal handle. */
|
|
@@ -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 { Moon, Sun } from "lucide-react";
|
|
8
7
|
import { jsx } from "react/jsx-runtime";
|
|
9
8
|
import { useReducedMotion } from "motion/react";
|
|
9
|
+
import { Moon, Sun } from "lucide-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 = `
|
|
@@ -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?: "default" | "
|
|
4
|
+
variant?: "default" | "info" | "success" | "warning" | "destructive" | "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 { cva } from "class-variance-authority";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
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";
|
|
4
5
|
import { ChevronsUpDownIcon, XIcon } from "lucide-react";
|
|
5
6
|
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,8 +2,8 @@ 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?: "
|
|
6
|
-
size?: "
|
|
5
|
+
variant?: "default" | "outline" | "secondary" | "info" | "success" | "warning" | "destructive" | "focus" | "invert" | "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
|
+
size?: "sm" | "default" | "lg" | "xs" | "xl" | null | undefined;
|
|
7
7
|
radius?: "default" | "full" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends useRender.ComponentProps<"span"> {
|
|
@@ -5,8 +5,8 @@ import { CASCADER_LIST_HEIGHT_CLASS, CASCADER_LIST_PAD_CLASS, CASCADER_ROWS_CLAS
|
|
|
5
5
|
import { CascaderItem, getCascaderMoreProps } from "./cascader-item.js";
|
|
6
6
|
import * as React$1 from "react";
|
|
7
7
|
import { cn } from "@kumix/utils";
|
|
8
|
-
import { LoaderCircleIcon } from "lucide-react";
|
|
9
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { LoaderCircleIcon } from "lucide-react";
|
|
10
10
|
import { Combobox } from "@base-ui/react";
|
|
11
11
|
//#region src/components/reui/cascader/cascader-columns.tsx
|
|
12
12
|
/**
|
|
@@ -4,8 +4,8 @@ import { CASCADER_LIST_PAD_CLASS, getCascaderFooterStops, isCascaderRtl } from "
|
|
|
4
4
|
import { CASCADER_ACTION_CLASS, CascaderGroup, CascaderLabel } from "./cascader-item.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
|
-
import { ChevronRightIcon } from "lucide-react";
|
|
8
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronRightIcon } from "lucide-react";
|
|
9
9
|
import { Popover } from "@base-ui/react";
|
|
10
10
|
import { useDirection } from "@base-ui/react/direction-provider";
|
|
11
11
|
//#region src/components/reui/cascader/cascader-footer.tsx
|
|
@@ -4,8 +4,8 @@ import { useCascaderActions, useCascaderRender, useCascaderState } from "./casca
|
|
|
4
4
|
import { getCascaderCount, getCascaderMoreParent, getCascaderPath, isCascaderMoreNode } from "./cascader-lib.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
|
-
import { CheckIcon, ChevronRightIcon, LoaderCircleIcon, MinusIcon, RotateCwIcon } from "lucide-react";
|
|
8
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { CheckIcon, ChevronRightIcon, LoaderCircleIcon, MinusIcon, RotateCwIcon } from "lucide-react";
|
|
9
9
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
10
10
|
import { useRender } from "@base-ui/react/use-render";
|
|
11
11
|
import { Combobox } from "@base-ui/react";
|
|
@@ -4,8 +4,8 @@ import { collapseCascaderPath, getCascaderFooterStops, getCascaderPath, isCascad
|
|
|
4
4
|
import { resolveCascaderSearchLabel } from "./cascader-i18n.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
|
-
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
8
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
9
9
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
10
10
|
import { useRender } from "@base-ui/react/use-render";
|
|
11
11
|
import { Combobox } from "@base-ui/react";
|
|
@@ -6,8 +6,8 @@ import { useCascaderLoadState, useCascaderLoader } from "./cascader-async.js";
|
|
|
6
6
|
import { resolveCascaderLabels } from "./cascader-i18n.js";
|
|
7
7
|
import * as React$1 from "react";
|
|
8
8
|
import { cn } from "@kumix/utils";
|
|
9
|
-
import { ChevronDownIcon, XIcon } from "lucide-react";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { ChevronDownIcon, XIcon } from "lucide-react";
|
|
11
11
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
12
12
|
import { useRender } from "@base-ui/react/use-render";
|
|
13
13
|
import { Combobox } from "@base-ui/react";
|
|
@@ -7,8 +7,8 @@ import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
|
7
7
|
import { useDataGrid } from "./data-grid.js";
|
|
8
8
|
import { useMemo, useState } from "react";
|
|
9
9
|
import { cn } from "@kumix/utils";
|
|
10
|
-
import { CheckIcon, CirclePlusIcon } from "lucide-react";
|
|
11
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { CheckIcon, CirclePlusIcon } from "lucide-react";
|
|
12
12
|
//#region src/components/reui/data-grid/data-grid-column-filter.tsx
|
|
13
13
|
function DataGridColumnFilter({ column, title, options }) {
|
|
14
14
|
const { i18n } = useDataGrid();
|
|
@@ -4,8 +4,8 @@ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe
|
|
|
4
4
|
import { getColumnHeaderLabel, useDataGrid } from "./data-grid.js";
|
|
5
5
|
import { memo, useMemo } from "react";
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
|
-
import { ArrowDownIcon, ArrowLeftIcon, ArrowLeftToLineIcon, ArrowRightIcon, ArrowRightToLineIcon, ArrowUpIcon, CheckIcon, ChevronsUpDownIcon, PinOffIcon, Settings2Icon } from "lucide-react";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ArrowDownIcon, ArrowLeftIcon, ArrowLeftToLineIcon, ArrowRightIcon, ArrowRightToLineIcon, ArrowUpIcon, CheckIcon, ChevronsUpDownIcon, PinOffIcon, Settings2Icon } from "lucide-react";
|
|
9
9
|
import { Subscribe } from "@tanstack/react-table";
|
|
10
10
|
//#region src/components/reui/data-grid/data-grid-column-header.tsx
|
|
11
11
|
function DataGridColumnHeaderInner({ column, title, icon, className, filter, visibility = false }) {
|