@serendie/ui 3.2.1 → 3.2.2-dev.202604270058

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.
Files changed (42) hide show
  1. package/dist/client.js +35 -32
  2. package/dist/components/BottomNavigation/BottomNavigation.js +12 -11
  3. package/dist/components/DataTable/table/BodyCell.js +3 -2
  4. package/dist/components/DataTable/table/HeaderCell.js +13 -12
  5. package/dist/components/DataTable/table/Root.js +5 -4
  6. package/dist/components/Slider/Slider.d.ts +47 -0
  7. package/dist/components/Slider/Slider.js +232 -0
  8. package/dist/components/Slider/index.d.ts +1 -0
  9. package/dist/components/Slider/index.js +5 -0
  10. package/dist/components/Tabs/TabItem.js +12 -11
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +39 -36
  13. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-context.js +5 -0
  14. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-control.js +16 -0
  15. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-dragging-indicator.js +18 -0
  16. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-hidden-input.js +17 -0
  17. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-label.js +16 -0
  18. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-marker-group.js +16 -0
  19. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-marker.js +17 -0
  20. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-range.js +16 -0
  21. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-root-provider.js +20 -0
  22. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-root.js +46 -0
  23. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-thumb.js +21 -0
  24. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-track.js +16 -0
  25. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-value-text.js +17 -0
  26. package/dist/node_modules/@ark-ui/react/dist/components/slider/slider.js +32 -0
  27. package/dist/node_modules/@ark-ui/react/dist/components/slider/use-slider-context.js +10 -0
  28. package/dist/node_modules/@ark-ui/react/dist/components/slider/use-slider-thumb-props-context.js +10 -0
  29. package/dist/node_modules/@ark-ui/react/dist/components/slider/use-slider.js +19 -0
  30. package/dist/node_modules/@zag-js/dom-query/dist/event.js +36 -31
  31. package/dist/node_modules/@zag-js/dom-query/dist/form.js +31 -21
  32. package/dist/node_modules/@zag-js/dom-query/dist/pointer-move.js +29 -0
  33. package/dist/node_modules/@zag-js/slider/dist/slider.anatomy.js +17 -0
  34. package/dist/node_modules/@zag-js/slider/dist/slider.connect.js +272 -0
  35. package/dist/node_modules/@zag-js/slider/dist/slider.dom.js +88 -0
  36. package/dist/node_modules/@zag-js/slider/dist/slider.machine.js +309 -0
  37. package/dist/node_modules/@zag-js/slider/dist/slider.style.js +119 -0
  38. package/dist/node_modules/@zag-js/slider/dist/slider.utils.js +105 -0
  39. package/dist/node_modules/@zag-js/utils/dist/number.js +63 -8
  40. package/dist/node_modules/@zag-js/utils/dist/object.js +17 -8
  41. package/dist/styles.css +1 -1
  42. package/package.json +1 -1
@@ -0,0 +1,309 @@
1
+ import { getThumbEl as h, getPointValue as c, getHiddenInputEl as g, dispatchChangeEvent as f, getThumbEls as v, getRootEl as T, getOffsetRect as x } from "./slider.dom.js";
2
+ import { normalizeValues as b, constrainValue as I, getRangeAtIndex as d, increment as E, decrement as V, resolveThumbCollision as O, selectMovableThumb as C, getClosestIndex as D } from "./slider.utils.js";
3
+ import { createMachine as S } from "../../core/dist/create-machine.js";
4
+ import { setValueAtIndex as r, getValuePercent as A, getValueRanges as P, snapValueToStep as R, clampValue as N, isValueWithinRange as k } from "../../utils/dist/number.js";
5
+ import { raf as M } from "../../dom-query/dist/raf.js";
6
+ import { setElementValue as z, trackFormControl as p } from "../../dom-query/dist/form.js";
7
+ import { resizeObserverBorderBox as F } from "../../dom-query/dist/resize-observer.js";
8
+ import { callAll as _ } from "../../utils/dist/functions.js";
9
+ import { trackPointerMove as w } from "../../dom-query/dist/pointer-move.js";
10
+ import { memo as B } from "../../core/dist/memo.js";
11
+ import { isEqual as y } from "../../utils/dist/equal.js";
12
+ import { pick as U } from "../../utils/dist/object.js";
13
+ var W = (e, t) => (e == null ? void 0 : e.width) === (t == null ? void 0 : t.width) && (e == null ? void 0 : e.height) === (t == null ? void 0 : t.height), m = (e, t, n, a, s) => P(e, t, n, s * a).map((o) => {
14
+ const l = R(o.value, o.min, o.max, a), i = N(l, o.min, o.max);
15
+ if (!k(i, t, n))
16
+ throw new Error(
17
+ "[zag-js/slider] The configured `min`, `max`, `step` or `minStepsBetweenThumbs` values are invalid"
18
+ );
19
+ return i;
20
+ }), ee = S({
21
+ props({ props: e }) {
22
+ const t = e.min ?? 0, n = e.max ?? 100, a = e.step ?? 1, s = e.defaultValue ?? [t], u = e.minStepsBetweenThumbs ?? 0;
23
+ return {
24
+ dir: "ltr",
25
+ thumbAlignment: "contain",
26
+ origin: "start",
27
+ orientation: "horizontal",
28
+ thumbCollisionBehavior: "none",
29
+ minStepsBetweenThumbs: u,
30
+ ...e,
31
+ defaultValue: m(s, t, n, a, u),
32
+ value: e.value ? m(e.value, t, n, a, u) : void 0,
33
+ max: n,
34
+ step: a,
35
+ min: t
36
+ };
37
+ },
38
+ initialState() {
39
+ return "idle";
40
+ },
41
+ context({ prop: e, bindable: t, getContext: n }) {
42
+ return {
43
+ thumbSize: t(() => ({
44
+ defaultValue: e("thumbSize") || null
45
+ })),
46
+ value: t(() => ({
47
+ defaultValue: e("defaultValue"),
48
+ value: e("value"),
49
+ isEqual: y,
50
+ hash(a) {
51
+ return a.join(",");
52
+ },
53
+ onChange(a) {
54
+ var s;
55
+ (s = e("onValueChange")) == null || s({ value: a });
56
+ }
57
+ })),
58
+ focusedIndex: t(() => ({
59
+ defaultValue: -1,
60
+ onChange(a) {
61
+ var u;
62
+ const s = n();
63
+ (u = e("onFocusChange")) == null || u({ focusedIndex: a, value: s.get("value") });
64
+ }
65
+ })),
66
+ fieldsetDisabled: t(() => ({
67
+ defaultValue: !1
68
+ }))
69
+ };
70
+ },
71
+ refs() {
72
+ return {
73
+ thumbDragOffset: null,
74
+ thumbDragStartValue: null
75
+ };
76
+ },
77
+ computed: {
78
+ isHorizontal: ({ prop: e }) => e("orientation") === "horizontal",
79
+ isVertical: ({ prop: e }) => e("orientation") === "vertical",
80
+ isRtl: ({ prop: e }) => e("orientation") === "horizontal" && e("dir") === "rtl",
81
+ isDisabled: ({ context: e, prop: t }) => !!t("disabled") || e.get("fieldsetDisabled"),
82
+ isInteractive: ({ prop: e, computed: t }) => !(e("readOnly") || t("isDisabled")),
83
+ hasMeasuredThumbSize: ({ context: e }) => e.get("thumbSize") != null,
84
+ valuePercent: B(
85
+ ({ context: e, prop: t }) => [e.get("value"), t("min"), t("max")],
86
+ ([e, t, n]) => e.map((a) => 100 * A(a, t, n))
87
+ )
88
+ },
89
+ watch({ track: e, action: t, context: n, computed: a, send: s }) {
90
+ e([() => n.hash("value")], () => {
91
+ t(["syncInputElements", "dispatchChangeEvent"]);
92
+ }), e([() => a("isDisabled")], () => {
93
+ a("isDisabled") && s({ type: "POINTER_CANCEL" });
94
+ });
95
+ },
96
+ effects: ["trackFormControlState", "trackThumbSize"],
97
+ on: {
98
+ SET_VALUE: [
99
+ {
100
+ guard: "hasIndex",
101
+ actions: ["setValueAtIndex", "invokeOnChangeEnd"]
102
+ },
103
+ {
104
+ actions: ["setValue", "invokeOnChangeEnd"]
105
+ }
106
+ ],
107
+ INCREMENT: {
108
+ actions: ["incrementThumbAtIndex", "invokeOnChangeEnd"]
109
+ },
110
+ DECREMENT: {
111
+ actions: ["decrementThumbAtIndex", "invokeOnChangeEnd"]
112
+ }
113
+ },
114
+ states: {
115
+ idle: {
116
+ on: {
117
+ POINTER_DOWN: {
118
+ target: "dragging",
119
+ actions: ["setClosestThumbIndex", "setThumbDragStartValue", "setPointerValue", "focusActiveThumb"]
120
+ },
121
+ FOCUS: {
122
+ target: "focus",
123
+ actions: ["setFocusedIndex"]
124
+ },
125
+ THUMB_POINTER_DOWN: {
126
+ target: "dragging",
127
+ actions: ["setFocusedIndex", "setThumbDragOffset", "setThumbDragStartValue", "focusActiveThumb"]
128
+ }
129
+ }
130
+ },
131
+ focus: {
132
+ entry: ["focusActiveThumb"],
133
+ on: {
134
+ POINTER_DOWN: {
135
+ target: "dragging",
136
+ actions: ["setClosestThumbIndex", "setThumbDragStartValue", "setPointerValue", "focusActiveThumb"]
137
+ },
138
+ THUMB_POINTER_DOWN: {
139
+ target: "dragging",
140
+ actions: ["setFocusedIndex", "setThumbDragOffset", "setThumbDragStartValue", "focusActiveThumb"]
141
+ },
142
+ ARROW_DEC: {
143
+ actions: ["decrementThumbAtIndex", "invokeOnChangeEnd"]
144
+ },
145
+ ARROW_INC: {
146
+ actions: ["incrementThumbAtIndex", "invokeOnChangeEnd"]
147
+ },
148
+ HOME: {
149
+ actions: ["setFocusedThumbToMin", "invokeOnChangeEnd"]
150
+ },
151
+ END: {
152
+ actions: ["setFocusedThumbToMax", "invokeOnChangeEnd"]
153
+ },
154
+ BLUR: {
155
+ target: "idle",
156
+ actions: ["clearFocusedIndex"]
157
+ }
158
+ }
159
+ },
160
+ dragging: {
161
+ entry: ["focusActiveThumb"],
162
+ effects: ["trackPointerMove"],
163
+ on: {
164
+ POINTER_UP: {
165
+ target: "focus",
166
+ actions: ["invokeOnChangeEnd", "clearThumbDragOffset", "clearThumbDragStartValue"]
167
+ },
168
+ POINTER_MOVE: {
169
+ actions: ["setPointerValue"]
170
+ },
171
+ POINTER_CANCEL: {
172
+ target: "idle",
173
+ actions: ["clearFocusedIndex", "clearThumbDragOffset", "clearThumbDragStartValue"]
174
+ }
175
+ }
176
+ }
177
+ },
178
+ implementations: {
179
+ guards: {
180
+ hasIndex: ({ event: e }) => e.index != null
181
+ },
182
+ effects: {
183
+ trackFormControlState({ context: e, scope: t }) {
184
+ return p(T(t), {
185
+ onFieldsetDisabledChange(n) {
186
+ e.set("fieldsetDisabled", n);
187
+ },
188
+ onFormReset() {
189
+ e.set("value", e.initial("value"));
190
+ }
191
+ });
192
+ },
193
+ trackPointerMove({ scope: e, send: t }) {
194
+ return w(e.getDoc(), {
195
+ onPointerMove(n) {
196
+ t({ type: "POINTER_MOVE", point: n.point });
197
+ },
198
+ onPointerUp() {
199
+ t({ type: "POINTER_UP" });
200
+ }
201
+ });
202
+ },
203
+ trackThumbSize({ context: e, scope: t, prop: n }) {
204
+ if (n("thumbAlignment") !== "contain" || n("thumbSize")) return;
205
+ const a = (o) => {
206
+ const l = x(o), i = U(l, ["width", "height"]);
207
+ W(e.get("thumbSize"), i) || e.set("thumbSize", i);
208
+ }, s = v(t);
209
+ s.forEach(a);
210
+ const u = s.map((o) => F.observe(o, () => a(o)));
211
+ return _(...u);
212
+ }
213
+ },
214
+ actions: {
215
+ dispatchChangeEvent({ context: e, scope: t }) {
216
+ f(t, e.get("value"));
217
+ },
218
+ syncInputElements({ context: e, scope: t }) {
219
+ e.get("value").forEach((n, a) => {
220
+ const s = g(t, a);
221
+ z(s, n.toString());
222
+ });
223
+ },
224
+ invokeOnChangeEnd({ prop: e, context: t }) {
225
+ queueMicrotask(() => {
226
+ var n;
227
+ (n = e("onValueChangeEnd")) == null || n({ value: t.get("value") });
228
+ });
229
+ },
230
+ setClosestThumbIndex(e) {
231
+ const { context: t, event: n } = e, a = c(e, n.point);
232
+ if (a == null) return;
233
+ const s = D(e, a);
234
+ t.set("focusedIndex", s);
235
+ },
236
+ setFocusedIndex(e) {
237
+ const { context: t, event: n } = e, a = C(e, n.index);
238
+ t.set("focusedIndex", a);
239
+ },
240
+ clearFocusedIndex({ context: e }) {
241
+ e.set("focusedIndex", -1);
242
+ },
243
+ setThumbDragOffset(e) {
244
+ const { refs: t, event: n } = e;
245
+ t.set("thumbDragOffset", n.offset ?? null);
246
+ },
247
+ clearThumbDragOffset({ refs: e }) {
248
+ e.set("thumbDragOffset", null);
249
+ },
250
+ setThumbDragStartValue({ refs: e, context: t }) {
251
+ e.set("thumbDragStartValue", t.get("value").slice());
252
+ },
253
+ clearThumbDragStartValue({ refs: e }) {
254
+ e.set("thumbDragStartValue", null);
255
+ },
256
+ setPointerValue(e) {
257
+ queueMicrotask(() => {
258
+ const { context: t, event: n, prop: a, refs: s } = e, u = c(e, n.point);
259
+ if (u == null) return;
260
+ const o = t.get("focusedIndex"), l = s.get("thumbDragStartValue"), i = O(
261
+ a("thumbCollisionBehavior"),
262
+ o,
263
+ u,
264
+ t.get("value"),
265
+ a("min"),
266
+ a("max"),
267
+ a("step"),
268
+ a("minStepsBetweenThumbs"),
269
+ l == null ? void 0 : l[o]
270
+ );
271
+ i.swapped && t.set("focusedIndex", i.index), t.set("value", i.values);
272
+ });
273
+ },
274
+ focusActiveThumb({ scope: e, context: t }) {
275
+ M(() => {
276
+ const n = h(e, t.get("focusedIndex"));
277
+ n == null || n.focus({ preventScroll: !0 });
278
+ });
279
+ },
280
+ decrementThumbAtIndex(e) {
281
+ const { context: t, event: n } = e, a = V(e, n.index, n.step);
282
+ t.set("value", a);
283
+ },
284
+ incrementThumbAtIndex(e) {
285
+ const { context: t, event: n } = e, a = E(e, n.index, n.step);
286
+ t.set("value", a);
287
+ },
288
+ setFocusedThumbToMin(e) {
289
+ const { context: t } = e, n = t.get("focusedIndex"), { min: a } = d(e, n);
290
+ t.set("value", (s) => r(s, n, a));
291
+ },
292
+ setFocusedThumbToMax(e) {
293
+ const { context: t } = e, n = t.get("focusedIndex"), { max: a } = d(e, n);
294
+ t.set("value", (s) => r(s, n, a));
295
+ },
296
+ setValueAtIndex(e) {
297
+ const { context: t, event: n } = e, a = I(e, n.value, n.index);
298
+ t.set("value", (s) => r(s, n.index, a));
299
+ },
300
+ setValue(e) {
301
+ const { context: t, event: n } = e, a = b(e, n.value);
302
+ t.set("value", a);
303
+ }
304
+ }
305
+ }
306
+ });
307
+ export {
308
+ ee as machine
309
+ };
@@ -0,0 +1,119 @@
1
+ import { toPx as a, getValuePercent as p, getValueTransformer as u } from "../../utils/dist/number.js";
2
+ function b(t) {
3
+ const e = t[0], o = t[t.length - 1];
4
+ return [e, o];
5
+ }
6
+ function x(t) {
7
+ const { prop: e, computed: o } = t, n = o("valuePercent"), [r, i] = b(n);
8
+ if (n.length === 1) {
9
+ if (e("origin") === "center") {
10
+ const s = n[0] < 50, l = s ? `${n[0]}%` : "50%", c = s ? "50%" : `${100 - n[0]}%`;
11
+ return { start: l, end: c };
12
+ }
13
+ return e("origin") === "end" ? { start: `${i}%`, end: "0%" } : { start: "0%", end: `${100 - i}%` };
14
+ }
15
+ return { start: `${r}%`, end: `${100 - i}%` };
16
+ }
17
+ function R(t) {
18
+ const { computed: e } = t, o = e("isVertical"), n = e("isRtl");
19
+ return o ? {
20
+ position: "absolute",
21
+ bottom: "var(--slider-range-start)",
22
+ top: "var(--slider-range-end)"
23
+ } : {
24
+ position: "absolute",
25
+ [n ? "right" : "left"]: "var(--slider-range-start)",
26
+ [n ? "left" : "right"]: "var(--slider-range-end)"
27
+ };
28
+ }
29
+ function v(t, e) {
30
+ const { context: o, prop: n } = t, { height: r = 0 } = o.get("thumbSize") ?? {}, i = u([n("min"), n("max")], [-r / 2, r / 2]);
31
+ return parseFloat(i(e).toFixed(2));
32
+ }
33
+ function S(t, e) {
34
+ const { computed: o, context: n, prop: r } = t, { width: i = 0 } = n.get("thumbSize") ?? {};
35
+ if (o("isRtl")) {
36
+ const c = u([r("max"), r("min")], [-i / 2, i / 2]);
37
+ return -1 * parseFloat(c(e).toFixed(2));
38
+ }
39
+ const l = u([r("min"), r("max")], [-i / 2, i / 2]);
40
+ return parseFloat(l(e).toFixed(2));
41
+ }
42
+ function y(t, e, o) {
43
+ const { computed: n, prop: r } = t;
44
+ if (r("thumbAlignment") === "center") return `${e}%`;
45
+ const i = n("isVertical") ? v(t, o) : S(t, o);
46
+ return `calc(${e}% - ${i}px)`;
47
+ }
48
+ function f(t, e) {
49
+ const { prop: o } = t, n = p(e, o("min"), o("max")) * 100;
50
+ return y(t, n, e);
51
+ }
52
+ function d(t) {
53
+ const { computed: e, prop: o } = t;
54
+ let n = "visible";
55
+ return o("thumbAlignment") === "contain" && !e("hasMeasuredThumbSize") && (n = "hidden"), n;
56
+ }
57
+ function $(t, e) {
58
+ const { computed: o, context: n } = t, r = o("isVertical") ? "bottom" : "insetInlineStart", i = n.get("focusedIndex");
59
+ return {
60
+ visibility: d(t),
61
+ position: "absolute",
62
+ transform: "var(--slider-thumb-transform)",
63
+ [r]: `var(--slider-thumb-offset-${e})`,
64
+ zIndex: i === e ? 1 : void 0
65
+ };
66
+ }
67
+ function P() {
68
+ return {
69
+ touchAction: "none",
70
+ userSelect: "none",
71
+ WebkitUserSelect: "none",
72
+ position: "relative"
73
+ };
74
+ }
75
+ function T(t) {
76
+ const { context: e, computed: o } = t, n = o("isVertical"), r = o("isRtl"), i = x(t), s = e.get("thumbSize");
77
+ return {
78
+ ...e.get("value").reduce((c, g, m) => {
79
+ const h = f(t, g);
80
+ return { ...c, [`--slider-thumb-offset-${m}`]: h };
81
+ }, {}),
82
+ "--slider-thumb-width": a(s == null ? void 0 : s.width),
83
+ "--slider-thumb-height": a(s == null ? void 0 : s.height),
84
+ "--slider-thumb-transform": n ? "translateY(50%)" : r ? "translateX(50%)" : "translateX(-50%)",
85
+ "--slider-range-start": i.start,
86
+ "--slider-range-end": i.end
87
+ };
88
+ }
89
+ function F(t, e) {
90
+ const { computed: o } = t, n = o("isHorizontal"), r = o("isRtl");
91
+ return {
92
+ visibility: d(t),
93
+ position: "absolute",
94
+ pointerEvents: "none",
95
+ [n ? "insetInlineStart" : "bottom"]: f(t, e),
96
+ translate: "var(--translate-x) var(--translate-y)",
97
+ "--translate-x": n ? r ? "50%" : "-50%" : "0%",
98
+ "--translate-y": n ? "0%" : "50%"
99
+ };
100
+ }
101
+ function z() {
102
+ return {
103
+ userSelect: "none",
104
+ WebkitUserSelect: "none",
105
+ pointerEvents: "none",
106
+ position: "relative"
107
+ };
108
+ }
109
+ export {
110
+ P as getControlStyle,
111
+ z as getMarkerGroupStyle,
112
+ F as getMarkerStyle,
113
+ x as getRangeOffsets,
114
+ R as getRangeStyle,
115
+ T as getRootStyle,
116
+ f as getThumbOffset,
117
+ $ as getThumbStyle,
118
+ d as getVisibility
119
+ };
@@ -0,0 +1,105 @@
1
+ import { snapValueToStep as b, clampValue as x, getValueRanges as w, getNextStepValue as V, getPreviousStepValue as T } from "../../utils/dist/number.js";
2
+ function g(t) {
3
+ const { index: n, values: s, min: e, max: c, gap: o } = t, a = s[n - 1], u = s[n + 1];
4
+ return {
5
+ min: a != null ? a + o : e,
6
+ max: u != null ? u - o : c
7
+ };
8
+ }
9
+ function i(t) {
10
+ return Math.round(t * 1e10) / 1e10;
11
+ }
12
+ function h(t) {
13
+ const { index: n, value: s, values: e } = t, c = g(t), o = e.slice();
14
+ return o[n] = i(x(s, c.min, c.max)), { values: o, index: n, swapped: !1 };
15
+ }
16
+ function I(t) {
17
+ const { index: n, value: s, values: e, min: c, max: o, gap: a } = t, u = e.slice(), p = c + n * a, m = o - (e.length - 1 - n) * a;
18
+ u[n] = i(x(s, p, m));
19
+ for (let l = n + 1; l < e.length; l++) {
20
+ const r = u[l - 1] + a;
21
+ u[l] < r && (u[l] = i(r));
22
+ }
23
+ for (let l = n - 1; l >= 0; l--) {
24
+ const r = u[l + 1] - a;
25
+ u[l] > r && (u[l] = i(r));
26
+ }
27
+ return { values: u, index: n, swapped: !1 };
28
+ }
29
+ function M(t, n) {
30
+ const { index: s, value: e, values: c, gap: o } = t, a = c[s - 1], u = c[s + 1], p = u != null && e >= u && e > n, m = a != null && e <= a && e < n;
31
+ if (!p && !m)
32
+ return h(t);
33
+ const l = p ? s + 1 : s - 1, r = c.slice(), v = { ...t, index: l }, f = g(v);
34
+ return r[l] = i(x(e, f.min, f.max)), r[s] = c[l], p && r[s] > r[l] - o ? r[s] = i(r[l] - o) : m && r[s] < r[l] + o && (r[s] = i(r[l] + o)), { values: r, index: l, swapped: !0 };
35
+ }
36
+ function N(t, n, s, e, c, o, a, u, p) {
37
+ if (e.length === 1)
38
+ return { values: [i(x(s, c, o))], index: 0, swapped: !1 };
39
+ const m = a * u, l = { behavior: t, index: n, value: s, values: e, min: c, max: o, gap: m };
40
+ switch (t) {
41
+ case "push":
42
+ return I(l);
43
+ case "swap":
44
+ return M(l, p ?? e[n]);
45
+ case "none":
46
+ default:
47
+ return h(l);
48
+ }
49
+ }
50
+ function P(t, n) {
51
+ return n.map((s, e) => S(t, s, e));
52
+ }
53
+ function d(t, n) {
54
+ const { context: s, prop: e } = t, c = e("step") * e("minStepsBetweenThumbs");
55
+ return w(s.get("value"), e("min"), e("max"), c)[n];
56
+ }
57
+ function S(t, n, s) {
58
+ const { prop: e } = t, c = d(t, s), o = b(n, e("min"), e("max"), e("step"));
59
+ return x(o, c.min, c.max);
60
+ }
61
+ function B(t, n, s) {
62
+ const { context: e, prop: c } = t, o = n ?? e.get("focusedIndex"), a = d(t, o), u = T(o, {
63
+ ...a,
64
+ step: s ?? c("step"),
65
+ values: e.get("value")
66
+ });
67
+ return u[o] = x(u[o], a.min, a.max), u;
68
+ }
69
+ function R(t, n, s) {
70
+ const { context: e, prop: c } = t, o = n ?? e.get("focusedIndex"), a = d(t, o), u = V(o, {
71
+ ...a,
72
+ step: s ?? c("step"),
73
+ values: e.get("value")
74
+ });
75
+ return u[o] = x(u[o], a.min, a.max), u;
76
+ }
77
+ function z(t, n) {
78
+ const { context: s } = t, e = s.get("value");
79
+ let c = 0, o = Math.abs(e[0] - n);
80
+ for (let a = 1; a < e.length; a++) {
81
+ const u = Math.abs(e[a] - n);
82
+ u <= o && (c = a, o = u);
83
+ }
84
+ return A(t, c);
85
+ }
86
+ function A(t, n) {
87
+ const { context: s, prop: e } = t, c = s.get("value"), o = e("max");
88
+ if (c[n] === o) {
89
+ let u = n;
90
+ for (; u > 0 && c[u - 1] === o; )
91
+ u -= 1;
92
+ return u;
93
+ }
94
+ return n;
95
+ }
96
+ export {
97
+ S as constrainValue,
98
+ B as decrement,
99
+ z as getClosestIndex,
100
+ d as getRangeAtIndex,
101
+ R as increment,
102
+ P as normalizeValues,
103
+ N as resolveThumbCollision,
104
+ A as selectMovableThumb
105
+ };
@@ -1,11 +1,66 @@
1
- var { min: c, max: i } = Math, o = (a) => Number.isNaN(a), t = (a) => o(a) ? 0 : a, s = (a, n, e) => {
2
- const r = t(a), l = n == null || r >= n, u = e == null || r <= e;
3
- return l && u;
4
- }, m = (a, n, e) => c(i(t(a), n), e), N = (a) => typeof a == "number" ? `${a}px` : a;
1
+ var { floor: N, abs: p, round: f, min: h, max: I, pow: S, sign: b } = Math, V = (e) => Number.isNaN(e), s = (e) => V(e) ? 0 : e, x = (e, t, a) => e === 0 ? a : t[e - 1], A = (e, t, a) => e === t.length - 1 ? a : t[e + 1], R = (e, t, a) => {
2
+ const r = s(e), n = t == null || r >= t, l = a == null || r <= a;
3
+ return n && l;
4
+ }, P = (e, t, a) => f((s(e) - t) / a) * a + t, m = (e, t, a) => h(I(s(e), t), a), T = (e) => m(e, 0, 1), k = (e, t, a) => (s(e) - t) / (a - t), w = (e, t, a, r) => m(P(e * (a - t) + t, t, r), t, a), i = (e, t) => {
5
+ let a = e, r = t.toString(), n = r.indexOf("."), l = n >= 0 ? r.length - n : 0;
6
+ if (l > 0) {
7
+ let u = S(10, l);
8
+ a = f(a * u) / u;
9
+ }
10
+ return a;
11
+ }, v = (e, t, a, r) => {
12
+ const n = t != null ? Number(t) : 0, l = Number(a), u = (e - n) % r;
13
+ let o = p(u) * 2 >= r ? e + b(u) * (r - p(u)) : e - u;
14
+ if (o = i(o, r), !V(n) && o < n)
15
+ o = n;
16
+ else if (!V(l) && o > l) {
17
+ const c = N((l - n) / r), g = n + c * r;
18
+ o = c <= 0 || g < n ? l : g;
19
+ }
20
+ return i(o, r);
21
+ }, M = (e, t, a) => e[t] === a ? e : [...e.slice(0, t), a, ...e.slice(t + 1)];
22
+ function d(e, t) {
23
+ const a = x(e, t.values, t.min), r = A(e, t.values, t.max);
24
+ let n = t.values.slice();
25
+ return function(u) {
26
+ let o = v(u, a, r, t.step);
27
+ return n = M(n, e, u), n[e] = o, n;
28
+ };
29
+ }
30
+ function C(e, t) {
31
+ const a = t.values[e] + t.step;
32
+ return d(e, t)(a);
33
+ }
34
+ function y(e, t) {
35
+ const a = t.values[e] - t.step;
36
+ return d(e, t)(a);
37
+ }
38
+ var O = (e, t, a, r) => e.map((n, l) => ({
39
+ min: l === 0 ? t : e[l - 1] + r,
40
+ max: l === e.length - 1 ? a : e[l + 1] - r,
41
+ value: n
42
+ })), W = (e, t) => {
43
+ const [a, r] = e, [n, l] = t;
44
+ return (u) => a === r || n === l ? n : n + (l - n) / (r - a) * (u - a);
45
+ }, $ = (e) => typeof e == "number" ? `${e}px` : e;
5
46
  export {
47
+ T as clampPercent,
6
48
  m as clampValue,
7
- o as isNaN,
8
- s as isValueWithinRange,
9
- t as nan,
10
- N as toPx
49
+ A as getMaxValueAtIndex,
50
+ x as getMinValueAtIndex,
51
+ C as getNextStepValue,
52
+ w as getPercentValue,
53
+ y as getPreviousStepValue,
54
+ k as getValuePercent,
55
+ O as getValueRanges,
56
+ d as getValueSetterAtIndex,
57
+ W as getValueTransformer,
58
+ V as isNaN,
59
+ R as isValueWithinRange,
60
+ s as nan,
61
+ i as roundToStepPrecision,
62
+ P as roundValue,
63
+ M as setValueAtIndex,
64
+ v as snapValueToStep,
65
+ $ as toPx
11
66
  };
@@ -1,13 +1,22 @@
1
- import { isPlainObject as r } from "./guard.js";
2
- function f(t) {
3
- if (!r(t) || t === void 0) return t;
4
- const o = Reflect.ownKeys(t).filter((e) => typeof e == "string"), i = {};
5
- for (const e of o) {
1
+ import { isPlainObject as f } from "./guard.js";
2
+ function r(t) {
3
+ if (!f(t) || t === void 0) return t;
4
+ const i = Reflect.ownKeys(t).filter((e) => typeof e == "string"), o = {};
5
+ for (const e of i) {
6
6
  const n = t[e];
7
- n !== void 0 && (i[e] = f(n));
7
+ n !== void 0 && (o[e] = r(n));
8
8
  }
9
- return i;
9
+ return o;
10
+ }
11
+ function s(t, i) {
12
+ const o = {};
13
+ for (const e of i) {
14
+ const n = t[e];
15
+ n !== void 0 && (o[e] = n);
16
+ }
17
+ return o;
10
18
  }
11
19
  export {
12
- f as compact
20
+ r as compact,
21
+ s as pick
13
22
  };