@yewdiel21/motion-kit 0.14.0 → 0.15.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 +174 -155
- package/bin/motion-kit.mjs +3 -3
- package/dist/auto/index.d.ts +6 -3
- package/dist/auto/index.js +8 -2
- package/dist/auto/index.js.map +1 -1
- package/dist/{chunk-EY4BJKC4.js → chunk-6IRJYXJU.js} +2 -2
- package/dist/{chunk-CU6SXW3E.js → chunk-A6QQCF6V.js} +1309 -310
- package/dist/chunk-A6QQCF6V.js.map +1 -0
- package/dist/chunk-JXRS3OEA.js +3638 -0
- package/dist/chunk-JXRS3OEA.js.map +1 -0
- package/dist/css/components/add-to-cart.css +72 -0
- package/dist/css/components/bidirectional-slider.css +168 -0
- package/dist/css/components/data-table.css +121 -26
- package/dist/css/components/filter-builder.css +10 -15
- package/dist/css/components/heatmap-chart.css +391 -0
- package/dist/css/components/hover-card.css +8 -2
- package/dist/css/components/image-preview.css +90 -2
- package/dist/css/components/json-viewer.css +33 -1
- package/dist/css/components/nav.css +102 -102
- package/dist/css/components/orbit-menu.css +130 -0
- package/dist/css/components/pagination.css +10 -5
- package/dist/css/components/pie-chart.css +390 -0
- package/dist/css/components/pill-button.css +135 -0
- package/dist/css/components/radar-chart.css +370 -0
- package/dist/css/components/radial-chart.css +398 -0
- package/dist/css/components/sankey-chart.css +358 -0
- package/dist/css/components/scroll-island.css +111 -0
- package/dist/css/components/select.css +136 -0
- package/dist/css/components/toolbar.css +122 -0
- package/dist/css/components/tree-view.css +79 -0
- package/dist/css/components/voice-dots.css +70 -0
- package/dist/elements/index.d.ts +180 -7
- package/dist/elements/index.js +287 -6
- package/dist/elements/index.js.map +1 -1
- package/dist/{engine-Cn6IhE3z.d.ts → engine-5zRIssTO.d.ts} +11 -1
- package/dist/index.css +1832 -168
- package/dist/index.d.ts +4 -4
- package/dist/index.js +33 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.ts +117 -11
- package/dist/react/index.js +314 -13
- package/dist/react/index.js.map +1 -1
- package/dist/{reduced-BBUusld6.d.ts → reduced-6X_bns60.d.ts} +1 -1
- package/dist/{reveal-DEvp6U6T.d.ts → reveal-BfyKKsw4.d.ts} +97 -4
- package/dist/store-CA2Qcun_.d.ts +453 -0
- package/package.json +9 -16
- package/registry.json +1096 -948
- package/src/auto/auto-init.ts +6 -0
- package/src/components/add-to-cart/README.md +34 -0
- package/src/components/add-to-cart/add-to-cart.css +71 -0
- package/src/components/add-to-cart/element.ts +20 -0
- package/src/components/add-to-cart/engine.ts +206 -0
- package/src/components/add-to-cart/react.tsx +29 -0
- package/src/components/bidirectional-slider/README.md +46 -0
- package/src/components/bidirectional-slider/bidirectional-slider.css +167 -0
- package/src/components/bidirectional-slider/element.ts +42 -0
- package/src/components/bidirectional-slider/engine.ts +289 -0
- package/src/components/bidirectional-slider/react.tsx +45 -0
- package/src/components/chart/README.md +10 -0
- package/src/components/chart/element.ts +2 -0
- package/src/components/chart/engine.ts +50 -23
- package/src/components/chart/parts.ts +237 -0
- package/src/components/chart/react.tsx +2 -2
- package/src/components/chart/use-chart.ts +55 -0
- package/src/components/data-table/README.md +3 -3
- package/src/components/data-table/data-table.css +121 -26
- package/src/components/data-table/engine.ts +81 -29
- package/src/components/editable-table/engine.ts +67 -11
- package/src/components/filter-builder/engine.ts +33 -2
- package/src/components/filter-builder/filter-builder.css +10 -15
- package/src/components/heatmap-chart/README.md +48 -0
- package/src/components/heatmap-chart/element.ts +21 -0
- package/src/components/heatmap-chart/engine.ts +281 -0
- package/src/components/heatmap-chart/heatmap-chart.css +93 -0
- package/src/components/heatmap-chart/react.tsx +14 -0
- package/src/components/hover-card/engine.ts +30 -1
- package/src/components/hover-card/hover-card.css +8 -2
- package/src/components/image-preview/element.ts +1 -1
- package/src/components/image-preview/engine.ts +95 -15
- package/src/components/image-preview/image-preview.css +90 -2
- package/src/components/image-preview/react.tsx +3 -3
- package/src/components/json-viewer/engine.ts +11 -2
- package/src/components/json-viewer/json-viewer.css +33 -1
- package/src/components/nav/README.md +12 -10
- package/src/components/nav/element.ts +5 -5
- package/src/components/nav/engine.ts +21 -14
- package/src/components/nav/nav.css +102 -102
- package/src/components/nav/react.tsx +4 -4
- package/src/components/orbit-menu/README.md +46 -0
- package/src/components/orbit-menu/element.ts +27 -0
- package/src/components/orbit-menu/engine.ts +179 -0
- package/src/components/orbit-menu/orbit-menu.css +129 -0
- package/src/components/orbit-menu/react.tsx +44 -0
- package/src/components/pagination/README.md +1 -1
- package/src/components/pagination/engine.ts +50 -4
- package/src/components/pagination/pagination.css +10 -5
- package/src/components/pie-chart/README.md +48 -0
- package/src/components/pie-chart/element.ts +30 -0
- package/src/components/pie-chart/engine.ts +283 -0
- package/src/components/pie-chart/pie-chart.css +92 -0
- package/src/components/pie-chart/react.tsx +14 -0
- package/src/components/pill-button/README.md +46 -0
- package/src/components/pill-button/element.ts +16 -0
- package/src/components/pill-button/engine.ts +77 -0
- package/src/components/pill-button/pill-button.css +134 -0
- package/src/components/pill-button/react.tsx +32 -0
- package/src/components/radar-chart/README.md +48 -0
- package/src/components/radar-chart/element.ts +30 -0
- package/src/components/radar-chart/engine.ts +327 -0
- package/src/components/radar-chart/radar-chart.css +72 -0
- package/src/components/radar-chart/react.tsx +14 -0
- package/src/components/radial-chart/README.md +48 -0
- package/src/components/radial-chart/element.ts +30 -0
- package/src/components/radial-chart/engine.ts +290 -0
- package/src/components/radial-chart/radial-chart.css +100 -0
- package/src/components/radial-chart/react.tsx +14 -0
- package/src/components/sankey-chart/README.md +48 -0
- package/src/components/sankey-chart/element.ts +31 -0
- package/src/components/sankey-chart/engine.ts +401 -0
- package/src/components/sankey-chart/react.tsx +14 -0
- package/src/components/sankey-chart/sankey-chart.css +60 -0
- package/src/components/scroll-island/README.md +34 -0
- package/src/components/scroll-island/element.ts +16 -0
- package/src/components/scroll-island/engine.ts +252 -0
- package/src/components/scroll-island/react.tsx +26 -0
- package/src/components/scroll-island/scroll-island.css +110 -0
- package/src/components/select/README.md +34 -0
- package/src/components/select/element.ts +26 -0
- package/src/components/select/engine.ts +267 -0
- package/src/components/select/react.tsx +33 -0
- package/src/components/select/select.css +135 -0
- package/src/components/toolbar/README.md +46 -0
- package/src/components/toolbar/element.ts +30 -0
- package/src/components/toolbar/engine.ts +230 -0
- package/src/components/toolbar/react.tsx +34 -0
- package/src/components/toolbar/toolbar.css +121 -0
- package/src/components/tree-view/element.ts +1 -1
- package/src/components/tree-view/engine.ts +174 -0
- package/src/components/tree-view/react.tsx +7 -3
- package/src/components/tree-view/tree-view.css +79 -0
- package/src/components/voice-dots/README.md +48 -0
- package/src/components/voice-dots/element.ts +45 -0
- package/src/components/voice-dots/engine.ts +243 -0
- package/src/components/voice-dots/react.tsx +52 -0
- package/src/components/voice-dots/voice-dots.css +69 -0
- package/src/elements/index.ts +39 -0
- package/src/index.ts +16 -0
- package/src/motion/liquid.ts +14 -4
- package/src/react/index.ts +14 -1
- package/dist/chunk-6P4P7NU6.js +0 -1401
- package/dist/chunk-6P4P7NU6.js.map +0 -1
- package/dist/chunk-CU6SXW3E.js.map +0 -1
- package/dist/store-DjkTBX7f.d.ts +0 -195
- /package/dist/{chunk-EY4BJKC4.js.map → chunk-6IRJYXJU.js.map} +0 -0
package/dist/react/index.js
CHANGED
|
@@ -55,26 +55,40 @@ import {
|
|
|
55
55
|
pileLayers,
|
|
56
56
|
pileStyle,
|
|
57
57
|
reflowLayout
|
|
58
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-6IRJYXJU.js";
|
|
59
59
|
import {
|
|
60
60
|
ICON_PATHS,
|
|
61
61
|
NAV_STYLES,
|
|
62
|
+
NAV_STYLE_ALIASES,
|
|
62
63
|
PENDING_ID,
|
|
64
|
+
PILL_ARROW,
|
|
63
65
|
capturePending,
|
|
64
66
|
clearToasts,
|
|
67
|
+
createBidirectionalSlider,
|
|
65
68
|
createChat,
|
|
66
69
|
createCursor,
|
|
70
|
+
createHeatmapChart,
|
|
67
71
|
createIsland,
|
|
72
|
+
createOrbitMenu,
|
|
73
|
+
createPieChart,
|
|
74
|
+
createPillButton,
|
|
75
|
+
createRadarChart,
|
|
76
|
+
createRadialChart,
|
|
77
|
+
createSankeyChart,
|
|
68
78
|
createThemePicker,
|
|
69
79
|
createToaster,
|
|
80
|
+
createToolbar,
|
|
81
|
+
createVoiceDots,
|
|
70
82
|
dismissToast,
|
|
71
83
|
morphPendingToReply,
|
|
72
84
|
revealShell,
|
|
85
|
+
toNavStyle,
|
|
73
86
|
toast
|
|
74
|
-
} from "../chunk-
|
|
87
|
+
} from "../chunk-JXRS3OEA.js";
|
|
75
88
|
import {
|
|
76
89
|
confetti,
|
|
77
90
|
createActivityFeed,
|
|
91
|
+
createAddToCart,
|
|
78
92
|
createAttachment,
|
|
79
93
|
createBreadcrumb,
|
|
80
94
|
createCalendar,
|
|
@@ -119,6 +133,8 @@ import {
|
|
|
119
133
|
createResizablePanel,
|
|
120
134
|
createRichTextEditor,
|
|
121
135
|
createScratchCard,
|
|
136
|
+
createScrollIsland,
|
|
137
|
+
createSelect,
|
|
122
138
|
createSkeleton,
|
|
123
139
|
createSlotPicker,
|
|
124
140
|
createSplitView,
|
|
@@ -149,7 +165,7 @@ import {
|
|
|
149
165
|
tokenLines,
|
|
150
166
|
tokenize,
|
|
151
167
|
tweenNumber
|
|
152
|
-
} from "../chunk-
|
|
168
|
+
} from "../chunk-A6QQCF6V.js";
|
|
153
169
|
import {
|
|
154
170
|
DEFAULT_THEME,
|
|
155
171
|
MK_THEME_HEAD_SCRIPT,
|
|
@@ -787,7 +803,7 @@ function Nav({
|
|
|
787
803
|
items,
|
|
788
804
|
active,
|
|
789
805
|
onSelect,
|
|
790
|
-
navStyle = "
|
|
806
|
+
navStyle = "pills",
|
|
791
807
|
accent = false,
|
|
792
808
|
reveal = false,
|
|
793
809
|
first,
|
|
@@ -801,7 +817,7 @@ function Nav({
|
|
|
801
817
|
const handle = revealShell(ref.current);
|
|
802
818
|
return () => handle?.cancel();
|
|
803
819
|
}, []);
|
|
804
|
-
const classes = ["mk-nav", `mk-nav--${navStyle}`, accent && "mk-nav--accent", className].filter(Boolean).join(" ");
|
|
820
|
+
const classes = ["mk-nav", `mk-nav--${toNavStyle(navStyle) ?? "pills"}`, accent && "mk-nav--accent", className].filter(Boolean).join(" ");
|
|
805
821
|
return /* @__PURE__ */ jsxs3("nav", { ref, "aria-label": "Principal", ...props, className: classes, children: [
|
|
806
822
|
first,
|
|
807
823
|
/* @__PURE__ */ jsx11("div", { className: "mk-nav__buttons", children: items.map((item) => {
|
|
@@ -1698,13 +1714,13 @@ function RangeSlider({ min, max, step, value, defaultValue, disabled, name, labe
|
|
|
1698
1714
|
// src/components/chart/react.tsx
|
|
1699
1715
|
import { useRef as useRef30 } from "react";
|
|
1700
1716
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1701
|
-
function Chart({ type, labels, series, points, stacked, formatValue, label, height, emptyLabel, legend, tooltip, onSelect, instanceRef, className, ...props }) {
|
|
1717
|
+
function Chart({ type, labels, series, points, stacked, formatValue, label, height, emptyLabel, legend, tooltip, axis, endLabel, onSelect, instanceRef, className, ...props }) {
|
|
1702
1718
|
const ref = useRef30(null);
|
|
1703
1719
|
const instance = useRef30(null);
|
|
1704
1720
|
const format = useLatest(formatValue);
|
|
1705
1721
|
const select = useLatest(onSelect);
|
|
1706
1722
|
const formatted = formatValue !== void 0;
|
|
1707
|
-
const data = { type, labels, series, points, stacked, label, height, emptyLabel, legend, tooltip };
|
|
1723
|
+
const data = { type, labels, series, points, stacked, label, height, emptyLabel, legend, tooltip, axis, endLabel };
|
|
1708
1724
|
const key = JSON.stringify(data);
|
|
1709
1725
|
const latest = useLatest(data);
|
|
1710
1726
|
const options = () => ({
|
|
@@ -1812,19 +1828,19 @@ function HoldConfirm({ duration, resetAfter, holdingLabel, doneLabel, hint, disa
|
|
|
1812
1828
|
// src/components/image-preview/react.tsx
|
|
1813
1829
|
import { useRef as useRef34 } from "react";
|
|
1814
1830
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1815
|
-
function ImagePreview({ images, labels, loop, onChange, onOpenChange, instanceRef, className, ...props }) {
|
|
1831
|
+
function ImagePreview({ images, labels, loop, strip, onChange, onOpenChange, instanceRef, className, ...props }) {
|
|
1816
1832
|
const ref = useRef34(null);
|
|
1817
1833
|
const change = useLatest(onChange);
|
|
1818
1834
|
const openChange = useLatest(onOpenChange);
|
|
1819
1835
|
const key = JSON.stringify(labels ?? {});
|
|
1820
1836
|
useIsomorphicLayoutEffect(() => {
|
|
1821
|
-
const created = createImagePreview(ref.current, { labels, loop, onChange: (i) => change.current?.(i), onOpenChange: (open) => openChange.current?.(open) });
|
|
1837
|
+
const created = createImagePreview(ref.current, { labels, loop, strip, onChange: (i) => change.current?.(i), onOpenChange: (open) => openChange.current?.(open) });
|
|
1822
1838
|
if (instanceRef) instanceRef.current = created;
|
|
1823
1839
|
return () => {
|
|
1824
1840
|
created.destroy();
|
|
1825
1841
|
if (instanceRef) instanceRef.current = null;
|
|
1826
1842
|
};
|
|
1827
|
-
}, [key, loop]);
|
|
1843
|
+
}, [key, loop, strip]);
|
|
1828
1844
|
return /* @__PURE__ */ jsx37("div", { ...props, ref, className: ["mk-image-preview", className].filter(Boolean).join(" "), children: images.map((image, i) => /* @__PURE__ */ jsx37("button", { type: "button", "data-mk-image": "", "data-mk-src": image.src, "data-mk-caption": image.caption, "aria-label": `Ver ${image.alt}`, children: /* @__PURE__ */ jsx37("img", { src: image.thumb ?? image.src, alt: image.alt, loading: "lazy", decoding: "async" }) }, `${image.src}-${i}`)) });
|
|
1829
1845
|
}
|
|
1830
1846
|
|
|
@@ -2656,7 +2672,7 @@ var ActivityFeed = forwardRef2(function ActivityFeed2({ items, locale, label, em
|
|
|
2656
2672
|
// src/components/tree-view/react.tsx
|
|
2657
2673
|
import { forwardRef as forwardRef3, useImperativeHandle as useImperativeHandle3, useRef as useRef61 } from "react";
|
|
2658
2674
|
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
2659
|
-
var TreeView = forwardRef3(function TreeView2({ nodes, checkable, checked, expanded, selected, search, label, loadChildren, renderLabel, searchText, onSelect, onCheck, onExpand, className, ...props }, handle) {
|
|
2675
|
+
var TreeView = forwardRef3(function TreeView2({ nodes, checkable, checked, expanded, selected, search, label, loadChildren, renderLabel, searchText, icons, draggable, onSelect, onCheck, onExpand, onMove, className, ...props }, handle) {
|
|
2660
2676
|
const ref = useRef61(null);
|
|
2661
2677
|
const instance = useRef61(null);
|
|
2662
2678
|
const select = useLatest(onSelect);
|
|
@@ -2665,6 +2681,7 @@ var TreeView = forwardRef3(function TreeView2({ nodes, checkable, checked, expan
|
|
|
2665
2681
|
const load = useLatest(loadChildren);
|
|
2666
2682
|
const draw = useLatest(renderLabel);
|
|
2667
2683
|
const text = useLatest(searchText);
|
|
2684
|
+
const moved = useLatest(onMove);
|
|
2668
2685
|
useImperativeHandle3(
|
|
2669
2686
|
handle,
|
|
2670
2687
|
() => ({
|
|
@@ -2692,14 +2709,17 @@ var TreeView = forwardRef3(function TreeView2({ nodes, checkable, checked, expan
|
|
|
2692
2709
|
searchText: searchText ? (node) => text.current?.(node) ?? node.label : void 0,
|
|
2693
2710
|
onSelect: (node) => select.current?.(node),
|
|
2694
2711
|
onCheck: (ids) => check.current?.(ids),
|
|
2695
|
-
onExpand: (node, open) => expand.current?.(node, open)
|
|
2712
|
+
onExpand: (node, open) => expand.current?.(node, open),
|
|
2713
|
+
icons,
|
|
2714
|
+
draggable,
|
|
2715
|
+
onMove: (node, into) => moved.current?.(node, into)
|
|
2696
2716
|
});
|
|
2697
2717
|
instance.current = created;
|
|
2698
2718
|
return () => {
|
|
2699
2719
|
created.destroy();
|
|
2700
2720
|
instance.current = null;
|
|
2701
2721
|
};
|
|
2702
|
-
}, [checkable, String(search), label, Boolean(loadChildren), Boolean(renderLabel), Boolean(searchText)]);
|
|
2722
|
+
}, [checkable, String(search), label, Boolean(loadChildren), Boolean(renderLabel), Boolean(searchText), icons, draggable]);
|
|
2703
2723
|
const first = useRef61(true);
|
|
2704
2724
|
useIsomorphicLayoutEffect(() => {
|
|
2705
2725
|
if (first.current) {
|
|
@@ -3199,11 +3219,279 @@ var RichTextEditor = forwardRef11(function RichTextEditor2({ value, placeholder,
|
|
|
3199
3219
|
}, [value]);
|
|
3200
3220
|
return /* @__PURE__ */ jsx71("div", { ...props, ref, className: ["mk-rich-text-editor", className].filter(Boolean).join(" ") });
|
|
3201
3221
|
});
|
|
3222
|
+
|
|
3223
|
+
// src/components/select/react.tsx
|
|
3224
|
+
import { useRef as useRef70 } from "react";
|
|
3225
|
+
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
3226
|
+
function Select({ options, value, defaultValue, name, label, placeholder, disabled, onChange, className, ...props }) {
|
|
3227
|
+
const ref = useRef70(null);
|
|
3228
|
+
const instance = useRef70(null);
|
|
3229
|
+
const change = useLatest(onChange);
|
|
3230
|
+
const start = useRef70(value ?? defaultValue);
|
|
3231
|
+
const key = JSON.stringify(options ?? null);
|
|
3232
|
+
useIsomorphicLayoutEffect(() => {
|
|
3233
|
+
const created = createSelect(ref.current, { options, value: value ?? start.current, name, label, placeholder, disabled, onChange: (next) => change.current?.(next) });
|
|
3234
|
+
instance.current = created;
|
|
3235
|
+
return () => {
|
|
3236
|
+
start.current = created.value;
|
|
3237
|
+
created.destroy();
|
|
3238
|
+
instance.current = null;
|
|
3239
|
+
};
|
|
3240
|
+
}, [key, name, label, placeholder, disabled]);
|
|
3241
|
+
useIsomorphicLayoutEffect(() => {
|
|
3242
|
+
if (value !== void 0 && instance.current && instance.current.value !== value) instance.current.setValue(value, false);
|
|
3243
|
+
}, [value]);
|
|
3244
|
+
return /* @__PURE__ */ jsx72("div", { ...props, ref, className: ["mk-select", className].filter(Boolean).join(" ") });
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
// src/components/add-to-cart/react.tsx
|
|
3248
|
+
import { useRef as useRef71 } from "react";
|
|
3249
|
+
import { jsx as jsx73 } from "react/jsx-runtime";
|
|
3250
|
+
function AddToCart({ target, image, quantity, count, label, onAdd, onLand, instanceRef, className, children, ...props }) {
|
|
3251
|
+
const ref = useRef71(null);
|
|
3252
|
+
const add = useLatest(onAdd);
|
|
3253
|
+
const landed = useLatest(onLand);
|
|
3254
|
+
useIsomorphicLayoutEffect(() => {
|
|
3255
|
+
const created = createAddToCart(ref.current, { target, image, quantity, count, label, onAdd: (n) => add.current?.(n), onLand: (n) => landed.current?.(n) });
|
|
3256
|
+
if (instanceRef) instanceRef.current = created;
|
|
3257
|
+
return () => {
|
|
3258
|
+
created.destroy();
|
|
3259
|
+
if (instanceRef) instanceRef.current = null;
|
|
3260
|
+
};
|
|
3261
|
+
}, [typeof target === "string" ? target : null, typeof image === "string" ? image : null, quantity, label]);
|
|
3262
|
+
return /* @__PURE__ */ jsx73("div", { ...props, ref, className: ["mk-add-to-cart", className].filter(Boolean).join(" "), children });
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
// src/components/scroll-island/react.tsx
|
|
3266
|
+
import { useRef as useRef72 } from "react";
|
|
3267
|
+
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
3268
|
+
function ScrollIsland({ sections, reach, idle, page, onSection, className, children, ...props }) {
|
|
3269
|
+
const ref = useRef72(null);
|
|
3270
|
+
const section = useLatest(onSection);
|
|
3271
|
+
useIsomorphicLayoutEffect(() => {
|
|
3272
|
+
const created = createScrollIsland(page ? document.documentElement : ref.current, { sections, reach, idle, page, onSection: (name) => section.current?.(name) });
|
|
3273
|
+
return () => created.destroy();
|
|
3274
|
+
}, [sections, reach, idle, page]);
|
|
3275
|
+
if (page) return null;
|
|
3276
|
+
return /* @__PURE__ */ jsx74("div", { ...props, ref, className: ["mk-scroll-island", className].filter(Boolean).join(" "), children });
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
// src/components/pill-button/react.tsx
|
|
3280
|
+
import { useRef as useRef73 } from "react";
|
|
3281
|
+
import { jsx as jsx75, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3282
|
+
function PillButton({ expand, icon, className, children, type = "button", ...props }) {
|
|
3283
|
+
const ref = useRef73(null);
|
|
3284
|
+
useIsomorphicLayoutEffect(() => {
|
|
3285
|
+
const instance = createPillButton(ref.current, { expand });
|
|
3286
|
+
return () => instance.destroy();
|
|
3287
|
+
}, [expand]);
|
|
3288
|
+
return /* @__PURE__ */ jsxs22("button", { ...props, type, ref, className: ["mk-pill-button", className].filter(Boolean).join(" "), children: [
|
|
3289
|
+
/* @__PURE__ */ jsx75("span", { "data-mk-pill-label": "", children }),
|
|
3290
|
+
icon ? /* @__PURE__ */ jsx75("span", { "data-mk-pill-icon": "", "aria-hidden": "true", children: icon }) : /* @__PURE__ */ jsx75("span", { "data-mk-pill-icon": "", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: PILL_ARROW } })
|
|
3291
|
+
] });
|
|
3292
|
+
}
|
|
3293
|
+
|
|
3294
|
+
// src/components/toolbar/react.tsx
|
|
3295
|
+
import { useRef as useRef74 } from "react";
|
|
3296
|
+
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
3297
|
+
function Toolbar({ value, orientation, tips, onChange, instanceRef, className, children, ...props }) {
|
|
3298
|
+
const ref = useRef74(null);
|
|
3299
|
+
const changed = useLatest(onChange);
|
|
3300
|
+
const instance = useRef74(null);
|
|
3301
|
+
useIsomorphicLayoutEffect(() => {
|
|
3302
|
+
const created = createToolbar(ref.current, { value, orientation, tips, onChange: (next) => changed.current?.(next) });
|
|
3303
|
+
instance.current = created;
|
|
3304
|
+
if (instanceRef) instanceRef.current = created;
|
|
3305
|
+
return () => {
|
|
3306
|
+
created.destroy();
|
|
3307
|
+
instance.current = null;
|
|
3308
|
+
if (instanceRef) instanceRef.current = null;
|
|
3309
|
+
};
|
|
3310
|
+
}, [orientation, tips]);
|
|
3311
|
+
useIsomorphicLayoutEffect(() => {
|
|
3312
|
+
if (value !== void 0 && instance.current && instance.current.value !== value) instance.current.setValue(value);
|
|
3313
|
+
}, [value]);
|
|
3314
|
+
return /* @__PURE__ */ jsx76("div", { ...props, ref, className: ["mk-toolbar", className].filter(Boolean).join(" "), children });
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
// src/components/bidirectional-slider/react.tsx
|
|
3318
|
+
import { useRef as useRef75 } from "react";
|
|
3319
|
+
import { jsx as jsx77 } from "react/jsx-runtime";
|
|
3320
|
+
function BidirectionalSlider({ min, max, origin, step, value, disabled, name, label, icons, formatValue, onInput, onChange, instanceRef, className, ...props }) {
|
|
3321
|
+
const ref = useRef75(null);
|
|
3322
|
+
const input = useLatest(onInput);
|
|
3323
|
+
const change = useLatest(onChange);
|
|
3324
|
+
const format = useLatest(formatValue);
|
|
3325
|
+
const instance = useRef75(null);
|
|
3326
|
+
useIsomorphicLayoutEffect(() => {
|
|
3327
|
+
const created = createBidirectionalSlider(ref.current, {
|
|
3328
|
+
min,
|
|
3329
|
+
max,
|
|
3330
|
+
origin,
|
|
3331
|
+
step,
|
|
3332
|
+
value,
|
|
3333
|
+
disabled,
|
|
3334
|
+
name,
|
|
3335
|
+
label,
|
|
3336
|
+
icons,
|
|
3337
|
+
formatValue: formatValue ? (n) => format.current(n) : void 0,
|
|
3338
|
+
onInput: (n) => input.current?.(n),
|
|
3339
|
+
onChange: (n) => change.current?.(n)
|
|
3340
|
+
});
|
|
3341
|
+
instance.current = created;
|
|
3342
|
+
if (instanceRef) instanceRef.current = created;
|
|
3343
|
+
return () => {
|
|
3344
|
+
created.destroy();
|
|
3345
|
+
instance.current = null;
|
|
3346
|
+
if (instanceRef) instanceRef.current = null;
|
|
3347
|
+
};
|
|
3348
|
+
}, [min, max, origin, step, disabled, name, label, icons]);
|
|
3349
|
+
useIsomorphicLayoutEffect(() => {
|
|
3350
|
+
if (value !== void 0 && instance.current && instance.current.value !== value) instance.current.setValue(value);
|
|
3351
|
+
}, [value]);
|
|
3352
|
+
return /* @__PURE__ */ jsx77("div", { ...props, ref, className: ["mk-bidirectional-slider", className].filter(Boolean).join(" ") });
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
// src/components/voice-dots/react.tsx
|
|
3356
|
+
import { useRef as useRef76 } from "react";
|
|
3357
|
+
import { jsx as jsx78 } from "react/jsx-runtime";
|
|
3358
|
+
function VoiceDots({ state = "idle", count, colorful, size, labels, source, level, instanceRef, className, ...props }) {
|
|
3359
|
+
const ref = useRef76(null);
|
|
3360
|
+
const instance = useRef76(null);
|
|
3361
|
+
useIsomorphicLayoutEffect(() => {
|
|
3362
|
+
const created = createVoiceDots(ref.current, { state, count, colorful, size, labels });
|
|
3363
|
+
instance.current = created;
|
|
3364
|
+
if (instanceRef) instanceRef.current = created;
|
|
3365
|
+
return () => {
|
|
3366
|
+
created.destroy();
|
|
3367
|
+
instance.current = null;
|
|
3368
|
+
if (instanceRef) instanceRef.current = null;
|
|
3369
|
+
};
|
|
3370
|
+
}, [count, colorful, size]);
|
|
3371
|
+
useIsomorphicLayoutEffect(() => {
|
|
3372
|
+
if (instance.current && instance.current.state !== state) instance.current.setState(state);
|
|
3373
|
+
}, [state]);
|
|
3374
|
+
useIsomorphicLayoutEffect(() => {
|
|
3375
|
+
const dots = instance.current;
|
|
3376
|
+
if (!dots || !source) return;
|
|
3377
|
+
let stop = null;
|
|
3378
|
+
let gone = false;
|
|
3379
|
+
void dots.listen(source).then((done) => {
|
|
3380
|
+
if (gone) done();
|
|
3381
|
+
else stop = done;
|
|
3382
|
+
}).catch((error) => {
|
|
3383
|
+
if (!gone) ref.current?.dispatchEvent(new CustomEvent("mk:error", { bubbles: true, detail: { error } }));
|
|
3384
|
+
});
|
|
3385
|
+
return () => {
|
|
3386
|
+
gone = true;
|
|
3387
|
+
stop?.();
|
|
3388
|
+
};
|
|
3389
|
+
}, [source, count, colorful, size]);
|
|
3390
|
+
useIsomorphicLayoutEffect(() => {
|
|
3391
|
+
if (level !== void 0) instance.current?.setLevel(level);
|
|
3392
|
+
}, [level]);
|
|
3393
|
+
return /* @__PURE__ */ jsx78("div", { ...props, ref, className: ["mk-voice-dots", className].filter(Boolean).join(" ") });
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
// src/components/chart/use-chart.ts
|
|
3397
|
+
import { useRef as useRef77 } from "react";
|
|
3398
|
+
function useChart(create, data, callbacks, instanceRef) {
|
|
3399
|
+
const ref = useRef77(null);
|
|
3400
|
+
const instance = useRef77(null);
|
|
3401
|
+
const format = useLatest(callbacks.formatValue);
|
|
3402
|
+
const select = useLatest(callbacks.onSelect);
|
|
3403
|
+
const formatted = callbacks.formatValue !== void 0;
|
|
3404
|
+
const key = JSON.stringify(data);
|
|
3405
|
+
const latest = useLatest(data);
|
|
3406
|
+
const options = () => ({
|
|
3407
|
+
...latest.current,
|
|
3408
|
+
formatValue: formatted ? (value) => format.current?.(value) ?? String(value) : void 0,
|
|
3409
|
+
onSelect: (...args) => select.current?.(...args)
|
|
3410
|
+
});
|
|
3411
|
+
useIsomorphicLayoutEffect(() => {
|
|
3412
|
+
const created = create(ref.current, options());
|
|
3413
|
+
instance.current = created;
|
|
3414
|
+
if (instanceRef) instanceRef.current = created;
|
|
3415
|
+
return () => {
|
|
3416
|
+
created.destroy();
|
|
3417
|
+
instance.current = null;
|
|
3418
|
+
if (instanceRef) instanceRef.current = null;
|
|
3419
|
+
};
|
|
3420
|
+
}, []);
|
|
3421
|
+
const first = useRef77(true);
|
|
3422
|
+
useIsomorphicLayoutEffect(() => {
|
|
3423
|
+
if (first.current) {
|
|
3424
|
+
first.current = false;
|
|
3425
|
+
return;
|
|
3426
|
+
}
|
|
3427
|
+
instance.current?.update(options());
|
|
3428
|
+
}, [key, formatted]);
|
|
3429
|
+
return ref;
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3432
|
+
// src/components/pie-chart/react.tsx
|
|
3433
|
+
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
3434
|
+
function PieChart({ data, donut, gap, size, label, totalLabel, legend, emptyLabel, formatValue, onSelect, instanceRef, className, ...props }) {
|
|
3435
|
+
const ref = useChart(createPieChart, { data, donut, gap, size, label, totalLabel, legend, emptyLabel }, { formatValue, onSelect }, instanceRef);
|
|
3436
|
+
return /* @__PURE__ */ jsx79("div", { ...props, ref, className: ["mk-chart mk-pie-chart", className].filter(Boolean).join(" ") });
|
|
3437
|
+
}
|
|
3438
|
+
|
|
3439
|
+
// src/components/radar-chart/react.tsx
|
|
3440
|
+
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
3441
|
+
function RadarChart({ axes, series, max, levels, grid, size, label, legend, emptyLabel, formatValue, onSelect, instanceRef, className, ...props }) {
|
|
3442
|
+
const ref = useChart(createRadarChart, { axes, series, max, levels, grid, size, label, legend, emptyLabel }, { formatValue, onSelect }, instanceRef);
|
|
3443
|
+
return /* @__PURE__ */ jsx80("div", { ...props, ref, className: ["mk-chart mk-radar-chart", className].filter(Boolean).join(" ") });
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3446
|
+
// src/components/radial-chart/react.tsx
|
|
3447
|
+
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);
|
|
3450
|
+
return /* @__PURE__ */ jsx81("div", { ...props, ref, className: ["mk-chart mk-radial-chart", className].filter(Boolean).join(" ") });
|
|
3451
|
+
}
|
|
3452
|
+
|
|
3453
|
+
// src/components/sankey-chart/react.tsx
|
|
3454
|
+
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
3455
|
+
function SankeyChart({ nodes, links, height, nodeWidth, nodePadding, label, emptyLabel, formatValue, onSelect, instanceRef, className, ...props }) {
|
|
3456
|
+
const ref = useChart(createSankeyChart, { nodes, links, height, nodeWidth, nodePadding, label, emptyLabel }, { formatValue, onSelect }, instanceRef);
|
|
3457
|
+
return /* @__PURE__ */ jsx82("div", { ...props, ref, className: ["mk-chart mk-sankey-chart", className].filter(Boolean).join(" ") });
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
// src/components/heatmap-chart/react.tsx
|
|
3461
|
+
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
3462
|
+
function HeatmapChart({ data, end, weeks, firstDay, locale, levels, color, unit, label, legend, formatValue, emptyLabel, onSelect, instanceRef, className, ...props }) {
|
|
3463
|
+
const ref = useChart(createHeatmapChart, { data, end, weeks, firstDay, locale, levels, color, unit, label, legend, emptyLabel }, { formatValue, onSelect }, instanceRef);
|
|
3464
|
+
return /* @__PURE__ */ jsx83("div", { ...props, ref, className: ["mk-heatmap-chart", className].filter(Boolean).join(" ") });
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3467
|
+
// src/components/orbit-menu/react.tsx
|
|
3468
|
+
import { useRef as useRef78 } from "react";
|
|
3469
|
+
import { jsx as jsx84, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3470
|
+
function OrbitMenu({ items, label = "Men\xFA", radius, start, closeOnSelect, onToggle, onSelect, instanceRef, className, ...props }) {
|
|
3471
|
+
const ref = useRef78(null);
|
|
3472
|
+
const toggled = useLatest(onToggle);
|
|
3473
|
+
const selected = useLatest(onSelect);
|
|
3474
|
+
const keys = items.map((item) => item.value).join("\0");
|
|
3475
|
+
useIsomorphicLayoutEffect(() => {
|
|
3476
|
+
const created = createOrbitMenu(ref.current, { radius, start, closeOnSelect, onToggle: (open) => toggled.current?.(open), onSelect: (value) => selected.current?.(value) });
|
|
3477
|
+
if (instanceRef) instanceRef.current = created;
|
|
3478
|
+
return () => {
|
|
3479
|
+
created.destroy();
|
|
3480
|
+
if (instanceRef) instanceRef.current = null;
|
|
3481
|
+
};
|
|
3482
|
+
}, [keys, radius, start, closeOnSelect]);
|
|
3483
|
+
return /* @__PURE__ */ jsxs23("div", { ...props, ref, className: ["mk-orbit-menu", className].filter(Boolean).join(" "), children: [
|
|
3484
|
+
/* @__PURE__ */ jsx84("button", { type: "button", "data-mk-orbit-toggle": "", "aria-label": label }),
|
|
3485
|
+
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
|
+
] });
|
|
3487
|
+
}
|
|
3202
3488
|
export {
|
|
3203
3489
|
ANIMATIONS,
|
|
3204
3490
|
ActivityFeed,
|
|
3491
|
+
AddToCart,
|
|
3205
3492
|
AnimatedNumber,
|
|
3206
3493
|
Attachment,
|
|
3494
|
+
BidirectionalSlider,
|
|
3207
3495
|
Breadcrumb,
|
|
3208
3496
|
Calendar,
|
|
3209
3497
|
Chart,
|
|
@@ -3230,6 +3518,7 @@ export {
|
|
|
3230
3518
|
FilterBuilder,
|
|
3231
3519
|
FlipGroup,
|
|
3232
3520
|
Frost,
|
|
3521
|
+
HeatmapChart,
|
|
3233
3522
|
HoldConfirm,
|
|
3234
3523
|
HoverCard,
|
|
3235
3524
|
ImagePreview,
|
|
@@ -3246,19 +3535,28 @@ export {
|
|
|
3246
3535
|
MkIcon,
|
|
3247
3536
|
MultiSelect,
|
|
3248
3537
|
NAV_STYLES,
|
|
3538
|
+
NAV_STYLE_ALIASES,
|
|
3249
3539
|
Nav,
|
|
3250
3540
|
NotificationBell,
|
|
3541
|
+
OrbitMenu,
|
|
3251
3542
|
Pagination,
|
|
3252
3543
|
PasswordStrength,
|
|
3544
|
+
PieChart,
|
|
3545
|
+
PillButton,
|
|
3253
3546
|
Popover,
|
|
3254
3547
|
Progress,
|
|
3255
3548
|
Quantity,
|
|
3256
3549
|
Questionnaire,
|
|
3550
|
+
RadarChart,
|
|
3551
|
+
RadialChart,
|
|
3257
3552
|
RangeCalendar,
|
|
3258
3553
|
RangeSlider,
|
|
3259
3554
|
ResizablePanel,
|
|
3260
3555
|
RichTextEditor,
|
|
3556
|
+
SankeyChart,
|
|
3261
3557
|
ScratchCard,
|
|
3558
|
+
ScrollIsland,
|
|
3559
|
+
Select,
|
|
3262
3560
|
Skeleton,
|
|
3263
3561
|
SlotPicker,
|
|
3264
3562
|
SlotText,
|
|
@@ -3274,10 +3572,12 @@ export {
|
|
|
3274
3572
|
TimeField,
|
|
3275
3573
|
Timeline,
|
|
3276
3574
|
Toaster,
|
|
3575
|
+
Toolbar,
|
|
3277
3576
|
Tooltip,
|
|
3278
3577
|
Trailer,
|
|
3279
3578
|
TreeView,
|
|
3280
3579
|
VirtualList,
|
|
3580
|
+
VoiceDots,
|
|
3281
3581
|
animate,
|
|
3282
3582
|
clearToasts,
|
|
3283
3583
|
confetti,
|
|
@@ -3287,6 +3587,7 @@ export {
|
|
|
3287
3587
|
pileLayers,
|
|
3288
3588
|
pileStyle,
|
|
3289
3589
|
themeHeadScript,
|
|
3590
|
+
toNavStyle,
|
|
3290
3591
|
toast,
|
|
3291
3592
|
useActionButton,
|
|
3292
3593
|
useCardDock,
|