@yewdiel21/motion-kit 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/auto/index.d.ts +8 -3
- package/dist/auto/index.js +13 -3
- package/dist/auto/index.js.map +1 -1
- package/dist/{chunk-A6QQCF6V.js → chunk-7IQTMF7Y.js} +1542 -54
- package/dist/chunk-7IQTMF7Y.js.map +1 -0
- package/dist/{chunk-6IRJYXJU.js → chunk-BZLMCHUD.js} +2 -2
- package/dist/{chunk-JXRS3OEA.js → chunk-VJFPTLAK.js} +29 -7
- package/dist/chunk-VJFPTLAK.js.map +1 -0
- package/dist/css/components/chart.css +7 -0
- package/dist/css/components/drilldown-menu.css +130 -0
- package/dist/css/components/heatmap-chart.css +7 -0
- package/dist/css/components/pie-chart.css +7 -0
- package/dist/css/components/radar-chart.css +7 -0
- package/dist/css/components/radial-chart.css +16 -2
- package/dist/css/components/sankey-chart.css +7 -0
- package/dist/css/components/scroll-island.css +3 -0
- package/dist/css/components/signature-pad.css +104 -0
- package/dist/css/components/voice-message-bubble.css +50 -0
- package/dist/css/components/waveform-player.css +36 -0
- package/dist/css/components/wheel-picker.css +17 -0
- package/dist/elements/index.d.ts +90 -4
- package/dist/elements/index.js +290 -8
- package/dist/elements/index.js.map +1 -1
- package/dist/{reveal-BfyKKsw4.d.ts → engine-Bn6hC87X.d.ts} +206 -1
- package/dist/index.css +324 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.ts +48 -10
- package/dist/react/index.js +240 -10
- package/dist/react/index.js.map +1 -1
- package/dist/{reduced-6X_bns60.d.ts → reduced-YS6TZjpa.d.ts} +1 -1
- package/dist/{store-CA2Qcun_.d.ts → store-CZ6vdtIE.d.ts} +5 -1
- package/package.json +110 -110
- package/registry.json +64 -0
- package/src/auto/auto-init.ts +308 -293
- package/src/components/add-to-cart/README.md +49 -34
- package/src/components/add-to-cart/react.tsx +4 -0
- package/src/components/chart/README.md +49 -34
- package/src/components/chart/chart.css +7 -0
- package/src/components/chart/element.ts +2 -1
- package/src/components/chart/engine.ts +105 -13
- package/src/components/chart/react.tsx +2 -2
- package/src/components/drilldown-menu/README.md +163 -0
- package/src/components/drilldown-menu/drilldown-menu.css +129 -0
- package/src/components/drilldown-menu/element.ts +59 -0
- package/src/components/drilldown-menu/engine.ts +338 -0
- package/src/components/drilldown-menu/react.tsx +76 -0
- package/src/components/radial-chart/README.md +10 -0
- package/src/components/radial-chart/element.ts +2 -2
- package/src/components/radial-chart/engine.ts +33 -6
- package/src/components/radial-chart/radial-chart.css +9 -2
- package/src/components/radial-chart/react.tsx +2 -2
- package/src/components/scroll-island/README.md +44 -34
- package/src/components/scroll-island/element.ts +1 -1
- package/src/components/scroll-island/engine.ts +25 -3
- package/src/components/scroll-island/react.tsx +3 -3
- package/src/components/scroll-island/scroll-island.css +3 -0
- package/src/components/signature-pad/README.md +97 -0
- package/src/components/signature-pad/element.ts +57 -0
- package/src/components/signature-pad/engine.ts +437 -0
- package/src/components/signature-pad/react.tsx +56 -0
- package/src/components/signature-pad/signature-pad.css +103 -0
- package/src/components/voice-message-bubble/README.md +31 -0
- package/src/components/voice-message-bubble/element.ts +20 -0
- package/src/components/voice-message-bubble/engine.ts +68 -0
- package/src/components/voice-message-bubble/react.tsx +27 -0
- package/src/components/voice-message-bubble/voice-message-bubble.css +12 -0
- package/src/components/waveform-player/README.md +30 -0
- package/src/components/waveform-player/element.ts +21 -0
- package/src/components/waveform-player/engine.ts +261 -0
- package/src/components/waveform-player/react.tsx +27 -0
- package/src/components/waveform-player/waveform-player.css +35 -0
- package/src/components/wheel-picker/README.md +33 -0
- package/src/components/wheel-picker/element.ts +18 -0
- package/src/components/wheel-picker/engine.ts +210 -0
- package/src/components/wheel-picker/react.tsx +32 -0
- package/src/components/wheel-picker/wheel-picker.css +16 -0
- package/src/elements/index.ts +273 -258
- package/src/index.ts +295 -290
- package/src/react/index.ts +176 -171
- package/dist/chunk-A6QQCF6V.js.map +0 -1
- package/dist/chunk-JXRS3OEA.js.map +0 -1
- /package/dist/{chunk-6IRJYXJU.js.map → chunk-BZLMCHUD.js.map} +0 -0
package/dist/react/index.js
CHANGED
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
pileLayers,
|
|
56
56
|
pileStyle,
|
|
57
57
|
reflowLayout
|
|
58
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-BZLMCHUD.js";
|
|
59
59
|
import {
|
|
60
60
|
ICON_PATHS,
|
|
61
61
|
NAV_STYLES,
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
revealShell,
|
|
85
85
|
toNavStyle,
|
|
86
86
|
toast
|
|
87
|
-
} from "../chunk-
|
|
87
|
+
} from "../chunk-VJFPTLAK.js";
|
|
88
88
|
import {
|
|
89
89
|
confetti,
|
|
90
90
|
createActivityFeed,
|
|
@@ -108,6 +108,7 @@ import {
|
|
|
108
108
|
createDateTimePicker,
|
|
109
109
|
createDialog,
|
|
110
110
|
createDrawer,
|
|
111
|
+
createDrilldownMenu,
|
|
111
112
|
createEditableTable,
|
|
112
113
|
createEmptyState,
|
|
113
114
|
createFileExplorer,
|
|
@@ -135,6 +136,7 @@ import {
|
|
|
135
136
|
createScratchCard,
|
|
136
137
|
createScrollIsland,
|
|
137
138
|
createSelect,
|
|
139
|
+
createSignaturePad,
|
|
138
140
|
createSkeleton,
|
|
139
141
|
createSlotPicker,
|
|
140
142
|
createSplitView,
|
|
@@ -150,6 +152,9 @@ import {
|
|
|
150
152
|
createTrailer,
|
|
151
153
|
createTreeView,
|
|
152
154
|
createVirtualList,
|
|
155
|
+
createVoiceMessageBubble,
|
|
156
|
+
createWaveformPlayer,
|
|
157
|
+
createWheelPicker,
|
|
153
158
|
dateTimeKey,
|
|
154
159
|
flowLines,
|
|
155
160
|
languageFamily,
|
|
@@ -165,7 +170,7 @@ import {
|
|
|
165
170
|
tokenLines,
|
|
166
171
|
tokenize,
|
|
167
172
|
tweenNumber
|
|
168
|
-
} from "../chunk-
|
|
173
|
+
} from "../chunk-7IQTMF7Y.js";
|
|
169
174
|
import {
|
|
170
175
|
DEFAULT_THEME,
|
|
171
176
|
MK_THEME_HEAD_SCRIPT,
|
|
@@ -1714,13 +1719,13 @@ function RangeSlider({ min, max, step, value, defaultValue, disabled, name, labe
|
|
|
1714
1719
|
// src/components/chart/react.tsx
|
|
1715
1720
|
import { useRef as useRef30 } from "react";
|
|
1716
1721
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1717
|
-
function Chart({ type, labels, series, points, stacked, formatValue, label, height, emptyLabel, legend, tooltip, axis, endLabel, onSelect, instanceRef, className, ...props }) {
|
|
1722
|
+
function Chart({ type, labels, series, points, stacked, barStyle, barTrack, barFill, barWidth, curve, formatValue, label, height, emptyLabel, legend, tooltip, axis, endLabel, onSelect, instanceRef, className, ...props }) {
|
|
1718
1723
|
const ref = useRef30(null);
|
|
1719
1724
|
const instance = useRef30(null);
|
|
1720
1725
|
const format = useLatest(formatValue);
|
|
1721
1726
|
const select = useLatest(onSelect);
|
|
1722
1727
|
const formatted = formatValue !== void 0;
|
|
1723
|
-
const data = { type, labels, series, points, stacked, label, height, emptyLabel, legend, tooltip, axis, endLabel };
|
|
1728
|
+
const data = { type, labels, series, points, stacked, barStyle, barTrack, barFill, barWidth, curve, label, height, emptyLabel, legend, tooltip, axis, endLabel };
|
|
1724
1729
|
const key = JSON.stringify(data);
|
|
1725
1730
|
const latest = useLatest(data);
|
|
1726
1731
|
const options = () => ({
|
|
@@ -3251,27 +3256,33 @@ function AddToCart({ target, image, quantity, count, label, onAdd, onLand, insta
|
|
|
3251
3256
|
const ref = useRef71(null);
|
|
3252
3257
|
const add = useLatest(onAdd);
|
|
3253
3258
|
const landed = useLatest(onLand);
|
|
3259
|
+
const instance = useRef71(null);
|
|
3254
3260
|
useIsomorphicLayoutEffect(() => {
|
|
3255
3261
|
const created = createAddToCart(ref.current, { target, image, quantity, count, label, onAdd: (n) => add.current?.(n), onLand: (n) => landed.current?.(n) });
|
|
3262
|
+
instance.current = created;
|
|
3256
3263
|
if (instanceRef) instanceRef.current = created;
|
|
3257
3264
|
return () => {
|
|
3258
3265
|
created.destroy();
|
|
3266
|
+
instance.current = null;
|
|
3259
3267
|
if (instanceRef) instanceRef.current = null;
|
|
3260
3268
|
};
|
|
3261
3269
|
}, [typeof target === "string" ? target : null, typeof image === "string" ? image : null, quantity, label]);
|
|
3270
|
+
useIsomorphicLayoutEffect(() => {
|
|
3271
|
+
if (count !== void 0) instance.current?.setCount(count);
|
|
3272
|
+
}, [count]);
|
|
3262
3273
|
return /* @__PURE__ */ jsx73("div", { ...props, ref, className: ["mk-add-to-cart", className].filter(Boolean).join(" "), children });
|
|
3263
3274
|
}
|
|
3264
3275
|
|
|
3265
3276
|
// src/components/scroll-island/react.tsx
|
|
3266
3277
|
import { useRef as useRef72 } from "react";
|
|
3267
3278
|
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
3268
|
-
function ScrollIsland({ sections, reach, idle, page, onSection, className, children, ...props }) {
|
|
3279
|
+
function ScrollIsland({ sections, reach, idle, persistent, page, onSection, className, children, ...props }) {
|
|
3269
3280
|
const ref = useRef72(null);
|
|
3270
3281
|
const section = useLatest(onSection);
|
|
3271
3282
|
useIsomorphicLayoutEffect(() => {
|
|
3272
|
-
const created = createScrollIsland(page ? document.documentElement : ref.current, { sections, reach, idle, page, onSection: (name) => section.current?.(name) });
|
|
3283
|
+
const created = createScrollIsland(page ? document.documentElement : ref.current, { sections, reach, idle, persistent, page, onSection: (name) => section.current?.(name) });
|
|
3273
3284
|
return () => created.destroy();
|
|
3274
|
-
}, [sections, reach, idle, page]);
|
|
3285
|
+
}, [sections, reach, idle, persistent, page]);
|
|
3275
3286
|
if (page) return null;
|
|
3276
3287
|
return /* @__PURE__ */ jsx74("div", { ...props, ref, className: ["mk-scroll-island", className].filter(Boolean).join(" "), children });
|
|
3277
3288
|
}
|
|
@@ -3445,8 +3456,8 @@ function RadarChart({ axes, series, max, levels, grid, size, label, legend, empt
|
|
|
3445
3456
|
|
|
3446
3457
|
// src/components/radial-chart/react.tsx
|
|
3447
3458
|
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
3448
|
-
function RadialChart({ data, max, sweep, size, thickness, label, totalLabel, legend, emptyLabel, formatValue, onSelect, instanceRef, className, ...props }) {
|
|
3449
|
-
const ref = useChart(createRadialChart, { data, max, sweep, size, thickness, label, totalLabel, legend, emptyLabel }, { formatValue, onSelect }, instanceRef);
|
|
3459
|
+
function RadialChart({ data, max, sweep, size, thickness, segments, center, label, totalLabel, legend, emptyLabel, formatValue, onSelect, instanceRef, className, ...props }) {
|
|
3460
|
+
const ref = useChart(createRadialChart, { data, max, sweep, size, thickness, segments, center, label, totalLabel, legend, emptyLabel }, { formatValue, onSelect }, instanceRef);
|
|
3450
3461
|
return /* @__PURE__ */ jsx81("div", { ...props, ref, className: ["mk-chart mk-radial-chart", className].filter(Boolean).join(" ") });
|
|
3451
3462
|
}
|
|
3452
3463
|
|
|
@@ -3485,6 +3496,220 @@ function OrbitMenu({ items, label = "Men\xFA", radius, start, closeOnSelect, onT
|
|
|
3485
3496
|
items.map((item) => /* @__PURE__ */ jsx84("button", { type: "button", "data-mk-orbit-item": "", "data-mk-value": item.value, "aria-label": item.label, children: item.icon }, item.value))
|
|
3486
3497
|
] });
|
|
3487
3498
|
}
|
|
3499
|
+
|
|
3500
|
+
// src/components/signature-pad/react.tsx
|
|
3501
|
+
import { useReducer, useRef as useRef79 } from "react";
|
|
3502
|
+
import { jsx as jsx85 } from "react/jsx-runtime";
|
|
3503
|
+
function SignaturePad({ value, defaultValue, label, hint, placeholder, color, width, disabled, readOnly, toolbar, name, historyLimit, onChange, instanceRef, className, ...props }) {
|
|
3504
|
+
const { children: _children, dangerouslySetInnerHTML: _html, ...rootProps } = props;
|
|
3505
|
+
const ref = useRef79(null);
|
|
3506
|
+
const instance = useRef79(null);
|
|
3507
|
+
const edited = useRef79(value ?? defaultValue);
|
|
3508
|
+
const current = useLatest(value);
|
|
3509
|
+
const change = useLatest(onChange);
|
|
3510
|
+
const [, refresh] = useReducer((revision) => revision + 1, 0);
|
|
3511
|
+
useIsomorphicLayoutEffect(() => {
|
|
3512
|
+
const created = createSignaturePad(ref.current, {
|
|
3513
|
+
data: current.current ?? edited.current,
|
|
3514
|
+
label,
|
|
3515
|
+
hint,
|
|
3516
|
+
placeholder,
|
|
3517
|
+
color,
|
|
3518
|
+
width,
|
|
3519
|
+
disabled,
|
|
3520
|
+
readOnly,
|
|
3521
|
+
toolbar,
|
|
3522
|
+
name,
|
|
3523
|
+
historyLimit,
|
|
3524
|
+
onChange: (data, detail) => {
|
|
3525
|
+
edited.current = data;
|
|
3526
|
+
change.current?.(data, detail);
|
|
3527
|
+
if (current.current !== void 0) refresh();
|
|
3528
|
+
}
|
|
3529
|
+
});
|
|
3530
|
+
instance.current = created;
|
|
3531
|
+
return () => {
|
|
3532
|
+
edited.current = created.exportData();
|
|
3533
|
+
created.destroy();
|
|
3534
|
+
instance.current = null;
|
|
3535
|
+
};
|
|
3536
|
+
}, [label, hint, placeholder, color, width, toolbar, name, historyLimit]);
|
|
3537
|
+
useIsomorphicLayoutEffect(() => {
|
|
3538
|
+
const created = instance.current;
|
|
3539
|
+
if (!created) return;
|
|
3540
|
+
created.setDisabled(Boolean(disabled));
|
|
3541
|
+
created.setReadOnly(Boolean(readOnly));
|
|
3542
|
+
}, [disabled, readOnly]);
|
|
3543
|
+
useIsomorphicLayoutEffect(() => {
|
|
3544
|
+
if (value !== void 0) instance.current?.importData(value, false);
|
|
3545
|
+
});
|
|
3546
|
+
useIsomorphicLayoutEffect(() => {
|
|
3547
|
+
if (instanceRef) instanceRef.current = instance.current;
|
|
3548
|
+
return () => {
|
|
3549
|
+
if (instanceRef) instanceRef.current = null;
|
|
3550
|
+
};
|
|
3551
|
+
}, [instanceRef, label, hint, placeholder, color, width, toolbar, name, historyLimit]);
|
|
3552
|
+
return /* @__PURE__ */ jsx85("div", { ...rootProps, ref, className: ["mk-signature-pad", className].filter(Boolean).join(" ") });
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
// src/components/waveform-player/react.tsx
|
|
3556
|
+
import { useRef as useRef80 } from "react";
|
|
3557
|
+
import { jsx as jsx86 } from "react/jsx-runtime";
|
|
3558
|
+
function WaveformPlayer({ src, peaks, label, disabled, playbackRates, onStateChange, onTimeUpdate, onPlay, onPause, onEnded, onError, instanceRef, className, ...props }) {
|
|
3559
|
+
const { children: _children, dangerouslySetInnerHTML: _html, ...rootProps } = props;
|
|
3560
|
+
const root = useRef80(null);
|
|
3561
|
+
const instance = useRef80(null);
|
|
3562
|
+
useIsomorphicLayoutEffect(() => {
|
|
3563
|
+
const created = createWaveformPlayer(root.current);
|
|
3564
|
+
instance.current = created;
|
|
3565
|
+
return () => {
|
|
3566
|
+
created.destroy();
|
|
3567
|
+
instance.current = null;
|
|
3568
|
+
};
|
|
3569
|
+
}, []);
|
|
3570
|
+
useIsomorphicLayoutEffect(() => {
|
|
3571
|
+
instance.current?.update({ src, peaks, label, disabled, playbackRates, onStateChange, onTimeUpdate, onPlay, onPause, onEnded, onError });
|
|
3572
|
+
});
|
|
3573
|
+
useIsomorphicLayoutEffect(() => {
|
|
3574
|
+
if (instanceRef) instanceRef.current = instance.current;
|
|
3575
|
+
return () => {
|
|
3576
|
+
if (instanceRef) instanceRef.current = null;
|
|
3577
|
+
};
|
|
3578
|
+
}, [instanceRef]);
|
|
3579
|
+
return /* @__PURE__ */ jsx86("div", { ...rootProps, ref: root, className: ["mk-waveform-player", className].filter(Boolean).join(" ") });
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
// src/components/voice-message-bubble/react.tsx
|
|
3583
|
+
import { useRef as useRef81 } from "react";
|
|
3584
|
+
import { jsx as jsx87 } from "react/jsx-runtime";
|
|
3585
|
+
function VoiceMessageBubble({ src, peaks, label, disabled, playbackRates, onStateChange, onTimeUpdate, onPlay, onPause, onEnded, onError, direction, author, timestamp, dateTime, status, instanceRef, className, ...props }) {
|
|
3586
|
+
const { children: _children, dangerouslySetInnerHTML: _html, ...rootProps } = props;
|
|
3587
|
+
const root = useRef81(null);
|
|
3588
|
+
const instance = useRef81(null);
|
|
3589
|
+
useIsomorphicLayoutEffect(() => {
|
|
3590
|
+
const created = createVoiceMessageBubble(root.current);
|
|
3591
|
+
instance.current = created;
|
|
3592
|
+
return () => {
|
|
3593
|
+
created.destroy();
|
|
3594
|
+
instance.current = null;
|
|
3595
|
+
};
|
|
3596
|
+
}, []);
|
|
3597
|
+
useIsomorphicLayoutEffect(() => {
|
|
3598
|
+
instance.current?.update({ src, peaks, label, disabled, playbackRates, onStateChange, onTimeUpdate, onPlay, onPause, onEnded, onError, direction, author, timestamp, dateTime, status });
|
|
3599
|
+
});
|
|
3600
|
+
useIsomorphicLayoutEffect(() => {
|
|
3601
|
+
if (instanceRef) instanceRef.current = instance.current;
|
|
3602
|
+
return () => {
|
|
3603
|
+
if (instanceRef) instanceRef.current = null;
|
|
3604
|
+
};
|
|
3605
|
+
}, [instanceRef]);
|
|
3606
|
+
return /* @__PURE__ */ jsx87("div", { ...rootProps, ref: root, className: ["mk-voice-message-bubble", className].filter(Boolean).join(" ") });
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
// src/components/drilldown-menu/react.tsx
|
|
3610
|
+
import { forwardRef as forwardRef12, useImperativeHandle as useImperativeHandle12, useReducer as useReducer2, useRef as useRef82 } from "react";
|
|
3611
|
+
import { jsx as jsx88 } from "react/jsx-runtime";
|
|
3612
|
+
var DrilldownMenu = forwardRef12(function DrilldownMenu2({ items, path, defaultPath, label, backLabel, emptyText, onSelect, onPathChange, className, ...props }, handle) {
|
|
3613
|
+
const { children: _children, dangerouslySetInnerHTML: _html, ...rootProps } = props;
|
|
3614
|
+
const ref = useRef82(null);
|
|
3615
|
+
const instance = useRef82(null);
|
|
3616
|
+
const select = useLatest(onSelect);
|
|
3617
|
+
const changed = useLatest(onPathChange);
|
|
3618
|
+
const controlled = useLatest(path);
|
|
3619
|
+
const [, refresh] = useReducer2((value) => value + 1, 0);
|
|
3620
|
+
useImperativeHandle12(handle, () => ({
|
|
3621
|
+
open: (id) => instance.current?.open(id) ?? false,
|
|
3622
|
+
back: () => instance.current?.back() ?? false,
|
|
3623
|
+
root: () => instance.current?.root(),
|
|
3624
|
+
reset: () => instance.current?.reset(),
|
|
3625
|
+
setPath: (next, notify) => {
|
|
3626
|
+
instance.current?.setPath(next, notify);
|
|
3627
|
+
if (controlled.current !== void 0) refresh();
|
|
3628
|
+
},
|
|
3629
|
+
focusItem: (id) => instance.current?.focusItem(id)
|
|
3630
|
+
}), []);
|
|
3631
|
+
const itemsKey = JSON.stringify(items);
|
|
3632
|
+
useIsomorphicLayoutEffect(() => {
|
|
3633
|
+
const created = createDrilldownMenu(ref.current, {
|
|
3634
|
+
items,
|
|
3635
|
+
path: path ?? defaultPath,
|
|
3636
|
+
label,
|
|
3637
|
+
backLabel,
|
|
3638
|
+
emptyText,
|
|
3639
|
+
onSelect: (item, selectedPath) => select.current?.(item, selectedPath),
|
|
3640
|
+
onPathChange: (next) => {
|
|
3641
|
+
changed.current?.(next);
|
|
3642
|
+
if (controlled.current !== void 0) refresh();
|
|
3643
|
+
}
|
|
3644
|
+
});
|
|
3645
|
+
instance.current = created;
|
|
3646
|
+
return () => {
|
|
3647
|
+
created.destroy();
|
|
3648
|
+
instance.current = null;
|
|
3649
|
+
};
|
|
3650
|
+
}, []);
|
|
3651
|
+
useIsomorphicLayoutEffect(() => {
|
|
3652
|
+
instance.current?.update({ items, label, backLabel, emptyText, ...path !== void 0 ? { path } : {} });
|
|
3653
|
+
}, [itemsKey, label, backLabel, emptyText]);
|
|
3654
|
+
useIsomorphicLayoutEffect(() => {
|
|
3655
|
+
if (path !== void 0) instance.current?.setPath(path);
|
|
3656
|
+
});
|
|
3657
|
+
return /* @__PURE__ */ jsx88("div", { ...rootProps, ref, className: ["mk-drilldown-menu", className].filter(Boolean).join(" ") });
|
|
3658
|
+
});
|
|
3659
|
+
|
|
3660
|
+
// src/components/wheel-picker/react.tsx
|
|
3661
|
+
import { useReducer as useReducer3, useRef as useRef83 } from "react";
|
|
3662
|
+
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
3663
|
+
function WheelPicker({ items, value, defaultValue, name, label, disabled, visibleItems, itemHeight, onInput, onChange, instanceRef, className, ...props }) {
|
|
3664
|
+
const ref = useRef83(null), instance = useRef83(null);
|
|
3665
|
+
const changed = useLatest(onChange), input = useLatest(onInput), latestItems = useLatest(items);
|
|
3666
|
+
const controlled = useLatest(value);
|
|
3667
|
+
const [, refresh] = useReducer3((revision) => revision + 1, 0);
|
|
3668
|
+
const last = useRef83(value ?? defaultValue);
|
|
3669
|
+
useIsomorphicLayoutEffect(() => {
|
|
3670
|
+
const created = createWheelPicker(ref.current, {
|
|
3671
|
+
items: latestItems.current,
|
|
3672
|
+
value: value ?? last.current,
|
|
3673
|
+
name,
|
|
3674
|
+
label,
|
|
3675
|
+
disabled,
|
|
3676
|
+
visibleItems,
|
|
3677
|
+
itemHeight,
|
|
3678
|
+
onInput: (next) => {
|
|
3679
|
+
last.current = next;
|
|
3680
|
+
input.current?.(next);
|
|
3681
|
+
},
|
|
3682
|
+
onChange: (next) => {
|
|
3683
|
+
last.current = next;
|
|
3684
|
+
changed.current?.(next);
|
|
3685
|
+
if (controlled.current !== void 0) refresh();
|
|
3686
|
+
}
|
|
3687
|
+
});
|
|
3688
|
+
instance.current = created;
|
|
3689
|
+
return () => {
|
|
3690
|
+
last.current = created.value;
|
|
3691
|
+
created.destroy();
|
|
3692
|
+
instance.current = null;
|
|
3693
|
+
};
|
|
3694
|
+
}, [name, label, disabled, visibleItems, itemHeight]);
|
|
3695
|
+
const key = JSON.stringify(items ?? []);
|
|
3696
|
+
useIsomorphicLayoutEffect(() => {
|
|
3697
|
+
instance.current?.setItems(items ?? []);
|
|
3698
|
+
}, [key]);
|
|
3699
|
+
useIsomorphicLayoutEffect(() => {
|
|
3700
|
+
if (value !== void 0) instance.current?.setValue(value);
|
|
3701
|
+
});
|
|
3702
|
+
useIsomorphicLayoutEffect(() => {
|
|
3703
|
+
if (instanceRef) instanceRef.current = instance.current;
|
|
3704
|
+
return () => {
|
|
3705
|
+
if (instanceRef) instanceRef.current = null;
|
|
3706
|
+
};
|
|
3707
|
+
}, [instanceRef, name, label, disabled, visibleItems, itemHeight]);
|
|
3708
|
+
const domProps = { ...props };
|
|
3709
|
+
delete domProps.children;
|
|
3710
|
+
delete domProps.dangerouslySetInnerHTML;
|
|
3711
|
+
return /* @__PURE__ */ jsx89("div", { ...domProps, ref, className: ["mk-wheel-picker", className].filter(Boolean).join(" ") });
|
|
3712
|
+
}
|
|
3488
3713
|
export {
|
|
3489
3714
|
ANIMATIONS,
|
|
3490
3715
|
ActivityFeed,
|
|
@@ -3512,6 +3737,7 @@ export {
|
|
|
3512
3737
|
DateTimePicker,
|
|
3513
3738
|
Dialog,
|
|
3514
3739
|
Drawer,
|
|
3740
|
+
DrilldownMenu,
|
|
3515
3741
|
EditableTable,
|
|
3516
3742
|
EmptyState,
|
|
3517
3743
|
FileExplorer,
|
|
@@ -3557,6 +3783,7 @@ export {
|
|
|
3557
3783
|
ScratchCard,
|
|
3558
3784
|
ScrollIsland,
|
|
3559
3785
|
Select,
|
|
3786
|
+
SignaturePad,
|
|
3560
3787
|
Skeleton,
|
|
3561
3788
|
SlotPicker,
|
|
3562
3789
|
SlotText,
|
|
@@ -3578,6 +3805,9 @@ export {
|
|
|
3578
3805
|
TreeView,
|
|
3579
3806
|
VirtualList,
|
|
3580
3807
|
VoiceDots,
|
|
3808
|
+
VoiceMessageBubble,
|
|
3809
|
+
WaveformPlayer,
|
|
3810
|
+
WheelPicker,
|
|
3581
3811
|
animate,
|
|
3582
3812
|
clearToasts,
|
|
3583
3813
|
confetti,
|