@konstructio/ui 0.0.2
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/LICENSE.md +21 -0
- package/README.md +19 -0
- package/dist/AlertDialogTrigger-BIbxXexQ.js +553 -0
- package/dist/Combination-Cmu9JRkv.js +479 -0
- package/dist/Modal-CO0_SnXD.js +909 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/chevron-up-Cmu1oXfj.js +54 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts +3 -0
- package/dist/components/AlertDialog/AlertDialog.js +54 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +13 -0
- package/dist/components/AlertDialog/AlertDialog.types.js +1 -0
- package/dist/components/AlertDialog/AlertDialog.variants.d.ts +3 -0
- package/dist/components/AlertDialog/AlertDialog.variants.js +16 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.d.ts +3 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +10 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.types.d.ts +6 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.types.js +1 -0
- package/dist/components/AlertDialog/components/index.d.ts +1 -0
- package/dist/components/AlertDialog/components/index.js +4 -0
- package/dist/components/AlertDialog/hooks/index.d.ts +1 -0
- package/dist/components/AlertDialog/hooks/index.js +4 -0
- package/dist/components/AlertDialog/hooks/useAlertDialog.d.ts +7 -0
- package/dist/components/AlertDialog/hooks/useAlertDialog.js +10 -0
- package/dist/components/Autocomplete/Autocomplete.d.ts +3 -0
- package/dist/components/Autocomplete/Autocomplete.js +84 -0
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +18 -0
- package/dist/components/Autocomplete/Autocomplete.types.js +1 -0
- package/dist/components/Autocomplete/Autocomplete.variants.d.ts +8 -0
- package/dist/components/Autocomplete/Autocomplete.variants.js +61 -0
- package/dist/components/Autocomplete/components/List.d.ts +3 -0
- package/dist/components/Autocomplete/components/List.js +57 -0
- package/dist/components/Autocomplete/components/List.types.d.ts +13 -0
- package/dist/components/Autocomplete/components/List.types.js +1 -0
- package/dist/components/Autocomplete/components/List.variants.d.ts +16 -0
- package/dist/components/Autocomplete/components/List.variants.js +81 -0
- package/dist/components/Autocomplete/hooks/index.d.ts +2 -0
- package/dist/components/Autocomplete/hooks/index.js +6 -0
- package/dist/components/Autocomplete/hooks/useAutocomplete.d.ts +17 -0
- package/dist/components/Autocomplete/hooks/useAutocomplete.js +81 -0
- package/dist/components/Autocomplete/hooks/useNavigationList.d.ts +10 -0
- package/dist/components/Autocomplete/hooks/useNavigationList.js +78 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +460 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts +11 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.variants.d.ts +12 -0
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +61 -0
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +5 -0
- package/dist/components/Button/Button.d.ts +4 -0
- package/dist/components/Button/Button.js +42 -0
- package/dist/components/Button/Button.types.d.ts +7 -0
- package/dist/components/Button/Button.types.js +1 -0
- package/dist/components/Button/Button.variants.d.ts +6 -0
- package/dist/components/Button/Button.variants.js +102 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.js +233 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.types.js +1 -0
- package/dist/components/Checkbox/Checkbox.variants.d.ts +9 -0
- package/dist/components/Checkbox/Checkbox.variants.js +82 -0
- package/dist/components/Dropdown/Dropdown.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.js +10 -0
- package/dist/components/Dropdown/Dropdown.types.d.ts +15 -0
- package/dist/components/Dropdown/Dropdown.types.js +1 -0
- package/dist/components/Dropdown/Dropdown.variants.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.variants.js +45 -0
- package/dist/components/Dropdown/components/EmptyList.d.ts +2 -0
- package/dist/components/Dropdown/components/EmptyList.js +5 -0
- package/dist/components/Dropdown/components/List/List.d.ts +3 -0
- package/dist/components/Dropdown/components/List/List.js +25 -0
- package/dist/components/Dropdown/components/List/List.types.d.ts +8 -0
- package/dist/components/Dropdown/components/List/List.types.js +1 -0
- package/dist/components/Dropdown/components/List/List.variants.d.ts +3 -0
- package/dist/components/Dropdown/components/List/List.variants.js +34 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.d.ts +3 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.js +29 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.types.d.ts +4 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.types.js +1 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.d.ts +3 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +19 -0
- package/dist/components/Dropdown/components/Wrapper.d.ts +3 -0
- package/dist/components/Dropdown/components/Wrapper.js +90 -0
- package/dist/components/Dropdown/components/index.d.ts +3 -0
- package/dist/components/Dropdown/components/index.js +8 -0
- package/dist/components/Dropdown/contexts/dropdown.context.d.ts +8 -0
- package/dist/components/Dropdown/contexts/dropdown.context.js +14 -0
- package/dist/components/Dropdown/contexts/dropdown.hook.d.ts +2 -0
- package/dist/components/Dropdown/contexts/dropdown.hook.js +11 -0
- package/dist/components/Dropdown/contexts/dropdown.provider.d.ts +2 -0
- package/dist/components/Dropdown/contexts/dropdown.provider.js +11 -0
- package/dist/components/Dropdown/contexts/index.d.ts +2 -0
- package/dist/components/Dropdown/contexts/index.js +6 -0
- package/dist/components/Dropdown/hooks/useDropdown.d.ts +11 -0
- package/dist/components/Dropdown/hooks/useDropdown.js +65 -0
- package/dist/components/Dropdown/hooks/useNavigationList.d.ts +8 -0
- package/dist/components/Dropdown/hooks/useNavigationList.js +66 -0
- package/dist/components/Input/Input.d.ts +3 -0
- package/dist/components/Input/Input.js +178 -0
- package/dist/components/Input/Input.types.d.ts +9 -0
- package/dist/components/Input/Input.types.js +1 -0
- package/dist/components/Input/Input.variants.d.ts +4 -0
- package/dist/components/Input/Input.variants.js +43 -0
- package/dist/components/Modal/Modal.d.ts +8 -0
- package/dist/components/Modal/Modal.js +10 -0
- package/dist/components/Modal/Modal.types.d.ts +12 -0
- package/dist/components/Modal/Modal.types.js +1 -0
- package/dist/components/Modal/components/Body/Body.d.ts +3 -0
- package/dist/components/Modal/components/Body/Body.js +7 -0
- package/dist/components/Modal/components/Body/Body.types.d.ts +5 -0
- package/dist/components/Modal/components/Body/Body.types.js +1 -0
- package/dist/components/Modal/components/Footer/Footer.d.ts +3 -0
- package/dist/components/Modal/components/Footer/Footer.js +6 -0
- package/dist/components/Modal/components/Footer/Footer.types.d.ts +5 -0
- package/dist/components/Modal/components/Footer/Footer.types.js +1 -0
- package/dist/components/Modal/components/Header/Header.d.ts +3 -0
- package/dist/components/Modal/components/Header/Header.js +6 -0
- package/dist/components/Modal/components/Header/Header.types.d.ts +5 -0
- package/dist/components/Modal/components/Header/Header.types.js +1 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.d.ts +3 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.js +13 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.types.d.ts +7 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.types.js +1 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.d.ts +6 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +48 -0
- package/dist/components/Modal/components/index.d.ts +4 -0
- package/dist/components/Modal/components/index.js +10 -0
- package/dist/components/Modal/contexts/Modal.context.d.ts +2 -0
- package/dist/components/Modal/contexts/Modal.context.js +20 -0
- package/dist/components/Modal/contexts/Modal.provider.d.ts +4 -0
- package/dist/components/Modal/contexts/Modal.provider.js +26 -0
- package/dist/components/Modal/contexts/Modal.types.d.ts +9 -0
- package/dist/components/Modal/contexts/Modal.types.js +1 -0
- package/dist/components/Modal/contexts/index.d.ts +1 -0
- package/dist/components/Modal/contexts/index.js +4 -0
- package/dist/components/Modal/hooks/index.d.ts +1 -0
- package/dist/components/Modal/hooks/index.js +4 -0
- package/dist/components/Modal/hooks/useModal.d.ts +9 -0
- package/dist/components/Modal/hooks/useModal.js +27 -0
- package/dist/components/NumberInput/NumberInput.d.ts +3 -0
- package/dist/components/NumberInput/NumberInput.js +181 -0
- package/dist/components/NumberInput/NumberInput.types.d.ts +11 -0
- package/dist/components/NumberInput/NumberInput.types.js +1 -0
- package/dist/components/NumberInput/NumberInput.variants.d.ts +11 -0
- package/dist/components/NumberInput/NumberInput.variants.js +78 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +3 -0
- package/dist/components/ProgressBar/ProgressBar.js +37 -0
- package/dist/components/ProgressBar/ProgressBar.types.d.ts +8 -0
- package/dist/components/ProgressBar/ProgressBar.types.js +1 -0
- package/dist/components/ProgressBar/ProgressBar.variants.d.ts +7 -0
- package/dist/components/ProgressBar/ProgressBar.variants.js +62 -0
- package/dist/components/Radio/Radio.d.ts +3 -0
- package/dist/components/Radio/Radio.js +58 -0
- package/dist/components/Radio/Radio.types.d.ts +12 -0
- package/dist/components/Radio/Radio.types.js +1 -0
- package/dist/components/Radio/Radio.variants.d.ts +3 -0
- package/dist/components/Radio/Radio.variants.js +49 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/components/RadioGroup/RadioGroup.js +37 -0
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +11 -0
- package/dist/components/RadioGroup/RadioGroup.types.js +1 -0
- package/dist/components/Range/Range.d.ts +3 -0
- package/dist/components/Range/Range.js +70 -0
- package/dist/components/Range/Range.types.d.ts +13 -0
- package/dist/components/Range/Range.types.js +1 -0
- package/dist/components/Range/Range.variants.d.ts +14 -0
- package/dist/components/Range/Range.variants.js +93 -0
- package/dist/components/Slider/Slider.d.ts +3 -0
- package/dist/components/Slider/Slider.js +52 -0
- package/dist/components/Slider/Slider.types.d.ts +13 -0
- package/dist/components/Slider/Slider.types.js +1 -0
- package/dist/components/Slider/Slider.variants.d.ts +11 -0
- package/dist/components/Slider/Slider.variants.js +69 -0
- package/dist/components/Switch/Switch.d.ts +3 -0
- package/dist/components/Switch/Switch.js +176 -0
- package/dist/components/Switch/Switch.types.d.ts +10 -0
- package/dist/components/Switch/Switch.types.js +1 -0
- package/dist/components/Switch/Switch.variants.d.ts +6 -0
- package/dist/components/Switch/Switch.variants.js +58 -0
- package/dist/components/Tag/Tag.d.ts +3 -0
- package/dist/components/Tag/Tag.js +6 -0
- package/dist/components/Tag/Tag.types.d.ts +4 -0
- package/dist/components/Tag/Tag.types.js +1 -0
- package/dist/components/Tag/Tag.variants.d.ts +3 -0
- package/dist/components/Tag/Tag.variants.js +31 -0
- package/dist/components/TagSelect/TagSelect.d.ts +3 -0
- package/dist/components/TagSelect/TagSelect.js +75 -0
- package/dist/components/TagSelect/TagSelect.types.d.ts +9 -0
- package/dist/components/TagSelect/TagSelect.types.js +1 -0
- package/dist/components/TagSelect/TagSelect.variants.d.ts +9 -0
- package/dist/components/TagSelect/TagSelect.variants.js +83 -0
- package/dist/components/TagSelect/hooks/useTagSelect.d.ts +9 -0
- package/dist/components/TagSelect/hooks/useTagSelect.js +39 -0
- package/dist/components/TextArea/TextArea.d.ts +3 -0
- package/dist/components/TextArea/TextArea.js +34 -0
- package/dist/components/TextArea/TextArea.types.d.ts +10 -0
- package/dist/components/TextArea/TextArea.types.js +1 -0
- package/dist/components/TextArea/TextArea.variants.d.ts +3 -0
- package/dist/components/TextArea/TextArea.variants.js +34 -0
- package/dist/components/Toast/Toast.d.ts +3 -0
- package/dist/components/Toast/Toast.js +471 -0
- package/dist/components/Toast/Toast.types.d.ts +12 -0
- package/dist/components/Toast/Toast.types.js +1 -0
- package/dist/components/Toast/Toast.variants.d.ts +9 -0
- package/dist/components/Toast/Toast.variants.js +74 -0
- package/dist/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.js +42 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.types.js +1 -0
- package/dist/components/Tooltip/Tooltip.variants.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.variants.js +93 -0
- package/dist/components/Tooltip/hooks/useTooltip.d.ts +4 -0
- package/dist/components/Tooltip/hooks/useTooltip.js +25 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.js +40 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/index.js +8 -0
- package/dist/contexts/theme.context.d.ts +6 -0
- package/dist/contexts/theme.context.js +10 -0
- package/dist/contexts/theme.hook.d.ts +7 -0
- package/dist/contexts/theme.hook.js +9 -0
- package/dist/contexts/theme.provider.d.ts +7 -0
- package/dist/contexts/theme.provider.js +17 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/useToggle.d.ts +1 -0
- package/dist/hooks/useToggle.js +11 -0
- package/dist/index-2K8qjK4R.js +145 -0
- package/dist/index-2hJuj4UN.js +19069 -0
- package/dist/index-4qm4jAkj.js +92 -0
- package/dist/index-8vgf-x5i.js +118 -0
- package/dist/index-BJ7FQg17.js +35 -0
- package/dist/index-B_GWswUP.js +71 -0
- package/dist/index-BqM_XclQ.js +94 -0
- package/dist/index-BwYCDOHZ.js +44 -0
- package/dist/index-BxeV34ij.js +32 -0
- package/dist/index-CCavb-1K.js +57 -0
- package/dist/index-DFbnnPzA.js +423 -0
- package/dist/index-DQMInta3.js +663 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +50 -0
- package/dist/js.cookie-OLEfuq_g.js +74 -0
- package/dist/package.json +118 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/konstruct.d.ts +4 -0
- package/dist/plugins/konstruct.js +104 -0
- package/dist/plugins/utils/colors.d.ts +206 -0
- package/dist/plugins/utils/colors.js +626 -0
- package/dist/styles.css +1 -0
- package/dist/styles.d.ts +0 -0
- package/dist/styles.js +1 -0
- package/dist/useBreadcrumb-BSMnc4Fu.js +341 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +2278 -0
- package/package.json +118 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { c as ae, a as ce, d as _ } from "./index-8vgf-x5i.js";
|
|
3
|
+
import { u as K } from "./index-CCavb-1K.js";
|
|
4
|
+
import { jsx as g, jsxs as le } from "react/jsx-runtime";
|
|
5
|
+
import { a as de, u as ue } from "./index-BxeV34ij.js";
|
|
6
|
+
import { P as T } from "./index-BJ7FQg17.js";
|
|
7
|
+
import { c as fe } from "./index-BqM_XclQ.js";
|
|
8
|
+
function $(e, [t, n]) {
|
|
9
|
+
return Math.min(n, Math.max(t, e));
|
|
10
|
+
}
|
|
11
|
+
var me = d.createContext(void 0);
|
|
12
|
+
function pe(e) {
|
|
13
|
+
const t = d.useContext(me);
|
|
14
|
+
return e || t || "ltr";
|
|
15
|
+
}
|
|
16
|
+
var j = ["PageUp", "PageDown"], X = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], G = {
|
|
17
|
+
"from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
18
|
+
"from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
|
|
19
|
+
"from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
20
|
+
"from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
|
|
21
|
+
}, M = "Slider", [N, he, Se] = fe(M), [W, ke] = ae(M, [
|
|
22
|
+
Se
|
|
23
|
+
]), [ge, B] = W(M), q = d.forwardRef(
|
|
24
|
+
(e, t) => {
|
|
25
|
+
const {
|
|
26
|
+
name: n,
|
|
27
|
+
min: o = 0,
|
|
28
|
+
max: i = 100,
|
|
29
|
+
step: c = 1,
|
|
30
|
+
orientation: r = "horizontal",
|
|
31
|
+
disabled: a = !1,
|
|
32
|
+
minStepsBetweenThumbs: l = 0,
|
|
33
|
+
defaultValue: m = [o],
|
|
34
|
+
value: x,
|
|
35
|
+
onValueChange: s = () => {
|
|
36
|
+
},
|
|
37
|
+
onValueCommit: u = () => {
|
|
38
|
+
},
|
|
39
|
+
inverted: v = !1,
|
|
40
|
+
form: P,
|
|
41
|
+
...S
|
|
42
|
+
} = e, p = d.useRef(/* @__PURE__ */ new Set()), f = d.useRef(0), w = r === "horizontal" ? ve : we, [h = [], A] = ce({
|
|
43
|
+
prop: x,
|
|
44
|
+
defaultProp: m,
|
|
45
|
+
onChange: (b) => {
|
|
46
|
+
var C;
|
|
47
|
+
(C = [...p.current][f.current]) == null || C.focus(), s(b);
|
|
48
|
+
}
|
|
49
|
+
}), k = d.useRef(h);
|
|
50
|
+
function H(b) {
|
|
51
|
+
const R = ye(h, b);
|
|
52
|
+
I(b, R);
|
|
53
|
+
}
|
|
54
|
+
function ie(b) {
|
|
55
|
+
I(b, f.current);
|
|
56
|
+
}
|
|
57
|
+
function se() {
|
|
58
|
+
const b = k.current[f.current];
|
|
59
|
+
h[f.current] !== b && u(h);
|
|
60
|
+
}
|
|
61
|
+
function I(b, R, { commit: C } = { commit: !1 }) {
|
|
62
|
+
const U = _e(c), z = Me(Math.round((b - o) / c) * c + o, U), V = $(z, [o, i]);
|
|
63
|
+
A((E = []) => {
|
|
64
|
+
const y = Pe(E, V, R);
|
|
65
|
+
if (Ee(y, l * c)) {
|
|
66
|
+
f.current = y.indexOf(V);
|
|
67
|
+
const Y = String(y) !== String(E);
|
|
68
|
+
return Y && C && u(y), Y ? y : E;
|
|
69
|
+
} else
|
|
70
|
+
return E;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return /* @__PURE__ */ g(
|
|
74
|
+
ge,
|
|
75
|
+
{
|
|
76
|
+
scope: e.__scopeSlider,
|
|
77
|
+
name: n,
|
|
78
|
+
disabled: a,
|
|
79
|
+
min: o,
|
|
80
|
+
max: i,
|
|
81
|
+
valueIndexToChangeRef: f,
|
|
82
|
+
thumbs: p.current,
|
|
83
|
+
values: h,
|
|
84
|
+
orientation: r,
|
|
85
|
+
form: P,
|
|
86
|
+
children: /* @__PURE__ */ g(N.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ g(N.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ g(
|
|
87
|
+
w,
|
|
88
|
+
{
|
|
89
|
+
"aria-disabled": a,
|
|
90
|
+
"data-disabled": a ? "" : void 0,
|
|
91
|
+
...S,
|
|
92
|
+
ref: t,
|
|
93
|
+
onPointerDown: _(S.onPointerDown, () => {
|
|
94
|
+
a || (k.current = h);
|
|
95
|
+
}),
|
|
96
|
+
min: o,
|
|
97
|
+
max: i,
|
|
98
|
+
inverted: v,
|
|
99
|
+
onSlideStart: a ? void 0 : H,
|
|
100
|
+
onSlideMove: a ? void 0 : ie,
|
|
101
|
+
onSlideEnd: a ? void 0 : se,
|
|
102
|
+
onHomeKeyDown: () => !a && I(o, 0, { commit: !0 }),
|
|
103
|
+
onEndKeyDown: () => !a && I(i, h.length - 1, { commit: !0 }),
|
|
104
|
+
onStepKeyDown: ({ event: b, direction: R }) => {
|
|
105
|
+
if (!a) {
|
|
106
|
+
const z = j.includes(b.key) || b.shiftKey && X.includes(b.key) ? 10 : 1, V = f.current, E = h[V], y = c * z * R;
|
|
107
|
+
I(E + y, V, { commit: !0 });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
) }) })
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
q.displayName = M;
|
|
117
|
+
var [J, Q] = W(M, {
|
|
118
|
+
startEdge: "left",
|
|
119
|
+
endEdge: "right",
|
|
120
|
+
size: "width",
|
|
121
|
+
direction: 1
|
|
122
|
+
}), ve = d.forwardRef(
|
|
123
|
+
(e, t) => {
|
|
124
|
+
const {
|
|
125
|
+
min: n,
|
|
126
|
+
max: o,
|
|
127
|
+
dir: i,
|
|
128
|
+
inverted: c,
|
|
129
|
+
onSlideStart: r,
|
|
130
|
+
onSlideMove: a,
|
|
131
|
+
onSlideEnd: l,
|
|
132
|
+
onStepKeyDown: m,
|
|
133
|
+
...x
|
|
134
|
+
} = e, [s, u] = d.useState(null), v = K(t, (w) => u(w)), P = d.useRef(), S = pe(i), p = S === "ltr", f = p && !c || !p && c;
|
|
135
|
+
function D(w) {
|
|
136
|
+
const h = P.current || s.getBoundingClientRect(), A = [0, h.width], H = F(A, f ? [n, o] : [o, n]);
|
|
137
|
+
return P.current = h, H(w - h.left);
|
|
138
|
+
}
|
|
139
|
+
return /* @__PURE__ */ g(
|
|
140
|
+
J,
|
|
141
|
+
{
|
|
142
|
+
scope: e.__scopeSlider,
|
|
143
|
+
startEdge: f ? "left" : "right",
|
|
144
|
+
endEdge: f ? "right" : "left",
|
|
145
|
+
direction: f ? 1 : -1,
|
|
146
|
+
size: "width",
|
|
147
|
+
children: /* @__PURE__ */ g(
|
|
148
|
+
Z,
|
|
149
|
+
{
|
|
150
|
+
dir: S,
|
|
151
|
+
"data-orientation": "horizontal",
|
|
152
|
+
...x,
|
|
153
|
+
ref: v,
|
|
154
|
+
style: {
|
|
155
|
+
...x.style,
|
|
156
|
+
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
157
|
+
},
|
|
158
|
+
onSlideStart: (w) => {
|
|
159
|
+
const h = D(w.clientX);
|
|
160
|
+
r == null || r(h);
|
|
161
|
+
},
|
|
162
|
+
onSlideMove: (w) => {
|
|
163
|
+
const h = D(w.clientX);
|
|
164
|
+
a == null || a(h);
|
|
165
|
+
},
|
|
166
|
+
onSlideEnd: () => {
|
|
167
|
+
P.current = void 0, l == null || l();
|
|
168
|
+
},
|
|
169
|
+
onStepKeyDown: (w) => {
|
|
170
|
+
const A = G[f ? "from-left" : "from-right"].includes(w.key);
|
|
171
|
+
m == null || m({ event: w, direction: A ? -1 : 1 });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
), we = d.forwardRef(
|
|
179
|
+
(e, t) => {
|
|
180
|
+
const {
|
|
181
|
+
min: n,
|
|
182
|
+
max: o,
|
|
183
|
+
inverted: i,
|
|
184
|
+
onSlideStart: c,
|
|
185
|
+
onSlideMove: r,
|
|
186
|
+
onSlideEnd: a,
|
|
187
|
+
onStepKeyDown: l,
|
|
188
|
+
...m
|
|
189
|
+
} = e, x = d.useRef(null), s = K(t, x), u = d.useRef(), v = !i;
|
|
190
|
+
function P(S) {
|
|
191
|
+
const p = u.current || x.current.getBoundingClientRect(), f = [0, p.height], w = F(f, v ? [o, n] : [n, o]);
|
|
192
|
+
return u.current = p, w(S - p.top);
|
|
193
|
+
}
|
|
194
|
+
return /* @__PURE__ */ g(
|
|
195
|
+
J,
|
|
196
|
+
{
|
|
197
|
+
scope: e.__scopeSlider,
|
|
198
|
+
startEdge: v ? "bottom" : "top",
|
|
199
|
+
endEdge: v ? "top" : "bottom",
|
|
200
|
+
size: "height",
|
|
201
|
+
direction: v ? 1 : -1,
|
|
202
|
+
children: /* @__PURE__ */ g(
|
|
203
|
+
Z,
|
|
204
|
+
{
|
|
205
|
+
"data-orientation": "vertical",
|
|
206
|
+
...m,
|
|
207
|
+
ref: s,
|
|
208
|
+
style: {
|
|
209
|
+
...m.style,
|
|
210
|
+
"--radix-slider-thumb-transform": "translateY(50%)"
|
|
211
|
+
},
|
|
212
|
+
onSlideStart: (S) => {
|
|
213
|
+
const p = P(S.clientY);
|
|
214
|
+
c == null || c(p);
|
|
215
|
+
},
|
|
216
|
+
onSlideMove: (S) => {
|
|
217
|
+
const p = P(S.clientY);
|
|
218
|
+
r == null || r(p);
|
|
219
|
+
},
|
|
220
|
+
onSlideEnd: () => {
|
|
221
|
+
u.current = void 0, a == null || a();
|
|
222
|
+
},
|
|
223
|
+
onStepKeyDown: (S) => {
|
|
224
|
+
const f = G[v ? "from-bottom" : "from-top"].includes(S.key);
|
|
225
|
+
l == null || l({ event: S, direction: f ? -1 : 1 });
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
), Z = d.forwardRef(
|
|
233
|
+
(e, t) => {
|
|
234
|
+
const {
|
|
235
|
+
__scopeSlider: n,
|
|
236
|
+
onSlideStart: o,
|
|
237
|
+
onSlideMove: i,
|
|
238
|
+
onSlideEnd: c,
|
|
239
|
+
onHomeKeyDown: r,
|
|
240
|
+
onEndKeyDown: a,
|
|
241
|
+
onStepKeyDown: l,
|
|
242
|
+
...m
|
|
243
|
+
} = e, x = B(M, n);
|
|
244
|
+
return /* @__PURE__ */ g(
|
|
245
|
+
T.span,
|
|
246
|
+
{
|
|
247
|
+
...m,
|
|
248
|
+
ref: t,
|
|
249
|
+
onKeyDown: _(e.onKeyDown, (s) => {
|
|
250
|
+
s.key === "Home" ? (r(s), s.preventDefault()) : s.key === "End" ? (a(s), s.preventDefault()) : j.concat(X).includes(s.key) && (l(s), s.preventDefault());
|
|
251
|
+
}),
|
|
252
|
+
onPointerDown: _(e.onPointerDown, (s) => {
|
|
253
|
+
const u = s.target;
|
|
254
|
+
u.setPointerCapture(s.pointerId), s.preventDefault(), x.thumbs.has(u) ? u.focus() : o(s);
|
|
255
|
+
}),
|
|
256
|
+
onPointerMove: _(e.onPointerMove, (s) => {
|
|
257
|
+
s.target.hasPointerCapture(s.pointerId) && i(s);
|
|
258
|
+
}),
|
|
259
|
+
onPointerUp: _(e.onPointerUp, (s) => {
|
|
260
|
+
const u = s.target;
|
|
261
|
+
u.hasPointerCapture(s.pointerId) && (u.releasePointerCapture(s.pointerId), c(s));
|
|
262
|
+
})
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
), ee = "SliderTrack", te = d.forwardRef(
|
|
267
|
+
(e, t) => {
|
|
268
|
+
const { __scopeSlider: n, ...o } = e, i = B(ee, n);
|
|
269
|
+
return /* @__PURE__ */ g(
|
|
270
|
+
T.span,
|
|
271
|
+
{
|
|
272
|
+
"data-disabled": i.disabled ? "" : void 0,
|
|
273
|
+
"data-orientation": i.orientation,
|
|
274
|
+
...o,
|
|
275
|
+
ref: t
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
te.displayName = ee;
|
|
281
|
+
var O = "SliderRange", ne = d.forwardRef(
|
|
282
|
+
(e, t) => {
|
|
283
|
+
const { __scopeSlider: n, ...o } = e, i = B(O, n), c = Q(O, n), r = d.useRef(null), a = K(t, r), l = i.values.length, m = i.values.map(
|
|
284
|
+
(u) => re(u, i.min, i.max)
|
|
285
|
+
), x = l > 1 ? Math.min(...m) : 0, s = 100 - Math.max(...m);
|
|
286
|
+
return /* @__PURE__ */ g(
|
|
287
|
+
T.span,
|
|
288
|
+
{
|
|
289
|
+
"data-orientation": i.orientation,
|
|
290
|
+
"data-disabled": i.disabled ? "" : void 0,
|
|
291
|
+
...o,
|
|
292
|
+
ref: a,
|
|
293
|
+
style: {
|
|
294
|
+
...e.style,
|
|
295
|
+
[c.startEdge]: x + "%",
|
|
296
|
+
[c.endEdge]: s + "%"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
ne.displayName = O;
|
|
303
|
+
var L = "SliderThumb", oe = d.forwardRef(
|
|
304
|
+
(e, t) => {
|
|
305
|
+
const n = he(e.__scopeSlider), [o, i] = d.useState(null), c = K(t, (a) => i(a)), r = d.useMemo(
|
|
306
|
+
() => o ? n().findIndex((a) => a.ref.current === o) : -1,
|
|
307
|
+
[n, o]
|
|
308
|
+
);
|
|
309
|
+
return /* @__PURE__ */ g(be, { ...e, ref: c, index: r });
|
|
310
|
+
}
|
|
311
|
+
), be = d.forwardRef(
|
|
312
|
+
(e, t) => {
|
|
313
|
+
const { __scopeSlider: n, index: o, name: i, ...c } = e, r = B(L, n), a = Q(L, n), [l, m] = d.useState(null), x = K(t, (D) => m(D)), s = l ? r.form || !!l.closest("form") : !0, u = de(l), v = r.values[o], P = v === void 0 ? 0 : re(v, r.min, r.max), S = Re(o, r.values.length), p = u == null ? void 0 : u[a.size], f = p ? De(p, P, a.direction) : 0;
|
|
314
|
+
return d.useEffect(() => {
|
|
315
|
+
if (l)
|
|
316
|
+
return r.thumbs.add(l), () => {
|
|
317
|
+
r.thumbs.delete(l);
|
|
318
|
+
};
|
|
319
|
+
}, [l, r.thumbs]), /* @__PURE__ */ le(
|
|
320
|
+
"span",
|
|
321
|
+
{
|
|
322
|
+
style: {
|
|
323
|
+
transform: "var(--radix-slider-thumb-transform)",
|
|
324
|
+
position: "absolute",
|
|
325
|
+
[a.startEdge]: `calc(${P}% + ${f}px)`
|
|
326
|
+
},
|
|
327
|
+
children: [
|
|
328
|
+
/* @__PURE__ */ g(N.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ g(
|
|
329
|
+
T.span,
|
|
330
|
+
{
|
|
331
|
+
role: "slider",
|
|
332
|
+
"aria-label": e["aria-label"] || S,
|
|
333
|
+
"aria-valuemin": r.min,
|
|
334
|
+
"aria-valuenow": v,
|
|
335
|
+
"aria-valuemax": r.max,
|
|
336
|
+
"aria-orientation": r.orientation,
|
|
337
|
+
"data-orientation": r.orientation,
|
|
338
|
+
"data-disabled": r.disabled ? "" : void 0,
|
|
339
|
+
tabIndex: r.disabled ? void 0 : 0,
|
|
340
|
+
...c,
|
|
341
|
+
ref: x,
|
|
342
|
+
style: v === void 0 ? { display: "none" } : e.style,
|
|
343
|
+
onFocus: _(e.onFocus, () => {
|
|
344
|
+
r.valueIndexToChangeRef.current = o;
|
|
345
|
+
})
|
|
346
|
+
}
|
|
347
|
+
) }),
|
|
348
|
+
s && /* @__PURE__ */ g(
|
|
349
|
+
xe,
|
|
350
|
+
{
|
|
351
|
+
name: i ?? (r.name ? r.name + (r.values.length > 1 ? "[]" : "") : void 0),
|
|
352
|
+
form: r.form,
|
|
353
|
+
value: v
|
|
354
|
+
},
|
|
355
|
+
o
|
|
356
|
+
)
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
oe.displayName = L;
|
|
363
|
+
var xe = (e) => {
|
|
364
|
+
const { value: t, ...n } = e, o = d.useRef(null), i = ue(t);
|
|
365
|
+
return d.useEffect(() => {
|
|
366
|
+
const c = o.current, r = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(r, "value").set;
|
|
367
|
+
if (i !== t && l) {
|
|
368
|
+
const m = new Event("input", { bubbles: !0 });
|
|
369
|
+
l.call(c, t), c.dispatchEvent(m);
|
|
370
|
+
}
|
|
371
|
+
}, [i, t]), /* @__PURE__ */ g("input", { style: { display: "none" }, ...n, ref: o, defaultValue: t });
|
|
372
|
+
};
|
|
373
|
+
function Pe(e = [], t, n) {
|
|
374
|
+
const o = [...e];
|
|
375
|
+
return o[n] = t, o.sort((i, c) => i - c);
|
|
376
|
+
}
|
|
377
|
+
function re(e, t, n) {
|
|
378
|
+
const c = 100 / (n - t) * (e - t);
|
|
379
|
+
return $(c, [0, 100]);
|
|
380
|
+
}
|
|
381
|
+
function Re(e, t) {
|
|
382
|
+
return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
|
|
383
|
+
}
|
|
384
|
+
function ye(e, t) {
|
|
385
|
+
if (e.length === 1) return 0;
|
|
386
|
+
const n = e.map((i) => Math.abs(i - t)), o = Math.min(...n);
|
|
387
|
+
return n.indexOf(o);
|
|
388
|
+
}
|
|
389
|
+
function De(e, t, n) {
|
|
390
|
+
const o = e / 2, c = F([0, 50], [0, o]);
|
|
391
|
+
return (o - c(t) * n) * n;
|
|
392
|
+
}
|
|
393
|
+
function Ce(e) {
|
|
394
|
+
return e.slice(0, -1).map((t, n) => e[n + 1] - t);
|
|
395
|
+
}
|
|
396
|
+
function Ee(e, t) {
|
|
397
|
+
if (t > 0) {
|
|
398
|
+
const n = Ce(e);
|
|
399
|
+
return Math.min(...n) >= t;
|
|
400
|
+
}
|
|
401
|
+
return !0;
|
|
402
|
+
}
|
|
403
|
+
function F(e, t) {
|
|
404
|
+
return (n) => {
|
|
405
|
+
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
406
|
+
const o = (t[1] - t[0]) / (e[1] - e[0]);
|
|
407
|
+
return t[0] + o * (n - e[0]);
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function _e(e) {
|
|
411
|
+
return (String(e).split(".")[1] || "").length;
|
|
412
|
+
}
|
|
413
|
+
function Me(e, t) {
|
|
414
|
+
const n = Math.pow(10, t);
|
|
415
|
+
return Math.round(e * n) / n;
|
|
416
|
+
}
|
|
417
|
+
var He = q, ze = te, Ne = ne, Oe = oe;
|
|
418
|
+
export {
|
|
419
|
+
He as R,
|
|
420
|
+
ze as T,
|
|
421
|
+
Ne as a,
|
|
422
|
+
Oe as b
|
|
423
|
+
};
|