@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.
- package/dist/client.js +35 -32
- package/dist/components/BottomNavigation/BottomNavigation.js +12 -11
- package/dist/components/DataTable/table/BodyCell.js +3 -2
- package/dist/components/DataTable/table/HeaderCell.js +13 -12
- package/dist/components/DataTable/table/Root.js +5 -4
- package/dist/components/Slider/Slider.d.ts +47 -0
- package/dist/components/Slider/Slider.js +232 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +5 -0
- package/dist/components/Tabs/TabItem.js +12 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -36
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-context.js +5 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-control.js +16 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-dragging-indicator.js +18 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-hidden-input.js +17 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-label.js +16 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-marker-group.js +16 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-marker.js +17 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-range.js +16 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-root-provider.js +20 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-root.js +46 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-thumb.js +21 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-track.js +16 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider-value-text.js +17 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/slider.js +32 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/use-slider-context.js +10 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/use-slider-thumb-props-context.js +10 -0
- package/dist/node_modules/@ark-ui/react/dist/components/slider/use-slider.js +19 -0
- package/dist/node_modules/@zag-js/dom-query/dist/event.js +36 -31
- package/dist/node_modules/@zag-js/dom-query/dist/form.js +31 -21
- package/dist/node_modules/@zag-js/dom-query/dist/pointer-move.js +29 -0
- package/dist/node_modules/@zag-js/slider/dist/slider.anatomy.js +17 -0
- package/dist/node_modules/@zag-js/slider/dist/slider.connect.js +272 -0
- package/dist/node_modules/@zag-js/slider/dist/slider.dom.js +88 -0
- package/dist/node_modules/@zag-js/slider/dist/slider.machine.js +309 -0
- package/dist/node_modules/@zag-js/slider/dist/slider.style.js +119 -0
- package/dist/node_modules/@zag-js/slider/dist/slider.utils.js +105 -0
- package/dist/node_modules/@zag-js/utils/dist/number.js +63 -8
- package/dist/node_modules/@zag-js/utils/dist/object.js +17 -8
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -3,42 +3,51 @@ function c(t, n) {
|
|
|
3
3
|
const { type: e = "HTMLInputElement", property: r = "value" } = n, o = i(t)[e].prototype;
|
|
4
4
|
return Object.getOwnPropertyDescriptor(o, r) ?? {};
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function f(t) {
|
|
7
7
|
if (t.localName === "input") return "HTMLInputElement";
|
|
8
8
|
if (t.localName === "textarea") return "HTMLTextAreaElement";
|
|
9
9
|
if (t.localName === "select") return "HTMLSelectElement";
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function p(t, n, e = "value") {
|
|
12
12
|
var o;
|
|
13
13
|
if (!t) return;
|
|
14
|
-
const r =
|
|
14
|
+
const r = f(t);
|
|
15
15
|
r && ((o = c(t, { type: r, property: e }).set) == null || o.call(t, n)), t.setAttribute(e, n);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function d(t, n) {
|
|
18
18
|
var r;
|
|
19
19
|
if (!t) return;
|
|
20
20
|
(r = c(t, { type: "HTMLInputElement", property: "checked" }).set) == null || r.call(t, n), n ? t.setAttribute("checked", "") : t.removeAttribute("checked");
|
|
21
21
|
}
|
|
22
22
|
function h(t, n) {
|
|
23
|
+
const { value: e, bubbles: r = !0 } = n;
|
|
24
|
+
if (!t) return;
|
|
25
|
+
const o = i(t);
|
|
26
|
+
if (!(t instanceof o.HTMLInputElement)) return;
|
|
27
|
+
p(t, `${e}`);
|
|
28
|
+
const s = new o.Event("input", { bubbles: r });
|
|
29
|
+
t.dispatchEvent(a(s));
|
|
30
|
+
}
|
|
31
|
+
function y(t, n) {
|
|
23
32
|
const { checked: e, bubbles: r = !0 } = n;
|
|
24
33
|
if (!t) return;
|
|
25
34
|
const o = i(t);
|
|
26
35
|
if (!(t instanceof o.HTMLInputElement)) return;
|
|
27
|
-
|
|
36
|
+
d(t, e);
|
|
28
37
|
const s = new o.Event("click", { bubbles: r });
|
|
29
|
-
t.dispatchEvent(
|
|
38
|
+
t.dispatchEvent(a(s));
|
|
30
39
|
}
|
|
31
|
-
function
|
|
40
|
+
function E(t) {
|
|
32
41
|
return t.matches("textarea, input, select, button");
|
|
33
42
|
}
|
|
34
|
-
function
|
|
43
|
+
function m(t, n) {
|
|
35
44
|
if (!t) return;
|
|
36
|
-
const e =
|
|
45
|
+
const e = E(t) ? t.form : t.closest("form"), r = (o) => {
|
|
37
46
|
o.defaultPrevented || n();
|
|
38
47
|
};
|
|
39
48
|
return e == null || e.addEventListener("reset", r, { passive: !0 }), () => e == null ? void 0 : e.removeEventListener("reset", r);
|
|
40
49
|
}
|
|
41
|
-
function
|
|
50
|
+
function b(t, n) {
|
|
42
51
|
const e = t == null ? void 0 : t.closest("fieldset");
|
|
43
52
|
if (!e) return;
|
|
44
53
|
n(e.disabled);
|
|
@@ -48,23 +57,24 @@ function m(t, n) {
|
|
|
48
57
|
attributeFilter: ["disabled"]
|
|
49
58
|
}), () => o.disconnect();
|
|
50
59
|
}
|
|
51
|
-
function
|
|
60
|
+
function T(t, n) {
|
|
52
61
|
if (!t) return;
|
|
53
|
-
const { onFieldsetDisabledChange: e, onFormReset: r } = n, o = [
|
|
62
|
+
const { onFieldsetDisabledChange: e, onFormReset: r } = n, o = [m(t, r), b(t, e)];
|
|
54
63
|
return () => o.forEach((s) => s == null ? void 0 : s());
|
|
55
64
|
}
|
|
56
65
|
var u = /* @__PURE__ */ Symbol.for("zag.changeEvent");
|
|
57
|
-
function
|
|
66
|
+
function l(t) {
|
|
58
67
|
return Object.prototype.hasOwnProperty.call(t, u);
|
|
59
68
|
}
|
|
60
|
-
function
|
|
61
|
-
return
|
|
69
|
+
function a(t) {
|
|
70
|
+
return l(t) || Object.defineProperty(t, u, { value: !0 }), t;
|
|
62
71
|
}
|
|
63
72
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
y as dispatchInputCheckedEvent,
|
|
74
|
+
h as dispatchInputValueEvent,
|
|
75
|
+
l as isInternalChangeEvent,
|
|
76
|
+
a as markAsInternalChangeEvent,
|
|
77
|
+
d as setElementChecked,
|
|
78
|
+
p as setElementValue,
|
|
79
|
+
T as trackFormControl
|
|
70
80
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { addDomEvent as r, getEventPoint as i } from "./event.js";
|
|
2
|
+
import { disableTextSelection as m } from "./text-selection.js";
|
|
3
|
+
function M(t, s) {
|
|
4
|
+
const { onPointerMove: p, onPointerUp: a } = s, c = (o) => {
|
|
5
|
+
const n = i(o), u = Math.sqrt(n.x ** 2 + n.y ** 2), l = o.pointerType === "touch" ? 10 : 5;
|
|
6
|
+
if (!(u < l)) {
|
|
7
|
+
if (o.pointerType === "mouse" && o.buttons === 0) {
|
|
8
|
+
e(o);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
p({ point: n, event: o });
|
|
12
|
+
}
|
|
13
|
+
}, e = (o) => {
|
|
14
|
+
const n = i(o);
|
|
15
|
+
a({ point: n, event: o });
|
|
16
|
+
}, f = [
|
|
17
|
+
r(t, "pointermove", c, !1),
|
|
18
|
+
r(t, "pointerup", e, !1),
|
|
19
|
+
r(t, "pointercancel", e, !1),
|
|
20
|
+
r(t, "contextmenu", e, !1),
|
|
21
|
+
m({ doc: t })
|
|
22
|
+
];
|
|
23
|
+
return () => {
|
|
24
|
+
f.forEach((o) => o());
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
M as trackPointerMove
|
|
29
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createAnatomy as r } from "../../anatomy/dist/create-anatomy.js";
|
|
2
|
+
var a = r("slider").parts(
|
|
3
|
+
"root",
|
|
4
|
+
"label",
|
|
5
|
+
"thumb",
|
|
6
|
+
"valueText",
|
|
7
|
+
"track",
|
|
8
|
+
"range",
|
|
9
|
+
"control",
|
|
10
|
+
"markerGroup",
|
|
11
|
+
"marker",
|
|
12
|
+
"draggingIndicator"
|
|
13
|
+
), o = a.build();
|
|
14
|
+
export {
|
|
15
|
+
a as anatomy,
|
|
16
|
+
o as parts
|
|
17
|
+
};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { isLeftClick as L, isModifierKey as H, getEventPoint as G, getEventStep as K, getEventKey as X } from "../../dom-query/dist/event.js";
|
|
2
|
+
import { dataAttr as r, ariaAttr as Y } from "../../dom-query/dist/shared.js";
|
|
3
|
+
import { parts as u } from "./slider.anatomy.js";
|
|
4
|
+
import { getMarkerId as j, getControlId as q, getRangeId as J, getHiddenInputId as M, getLabelId as O, getThumbId as Q, getTrackId as Z, getValueTextId as $, getRootId as z, getFirstThumbEl as tt } from "./slider.dom.js";
|
|
5
|
+
import { getThumbStyle as U, getMarkerStyle as et, getMarkerGroupStyle as at, getControlStyle as rt, getRangeStyle as nt, getRootStyle as it } from "./slider.style.js";
|
|
6
|
+
import { getRangeAtIndex as E } from "./slider.utils.js";
|
|
7
|
+
import { first as ot, last as dt } from "../../utils/dist/array.js";
|
|
8
|
+
import { getPercentValue as lt, getValuePercent as st } from "../../utils/dist/number.js";
|
|
9
|
+
function Pt(g, l) {
|
|
10
|
+
const { state: I, send: n, context: v, prop: e, computed: D, scope: o } = g, h = e("aria-label"), T = e("aria-labelledby"), c = v.get("value"), A = v.get("focusedIndex"), p = I.matches("focus"), f = I.matches("dragging"), s = D("isDisabled"), b = e("invalid"), m = D("isInteractive"), V = e("orientation") === "horizontal", w = e("orientation") === "vertical";
|
|
11
|
+
function k(t) {
|
|
12
|
+
return st(t, e("min"), e("max"));
|
|
13
|
+
}
|
|
14
|
+
function C(t) {
|
|
15
|
+
return lt(t, e("min"), e("max"), e("step"));
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
value: c,
|
|
19
|
+
dragging: f,
|
|
20
|
+
focused: p,
|
|
21
|
+
setValue(t) {
|
|
22
|
+
n({ type: "SET_VALUE", value: t });
|
|
23
|
+
},
|
|
24
|
+
getThumbValue(t) {
|
|
25
|
+
return c[t];
|
|
26
|
+
},
|
|
27
|
+
setThumbValue(t, a) {
|
|
28
|
+
n({ type: "SET_VALUE", index: t, value: a });
|
|
29
|
+
},
|
|
30
|
+
getValuePercent: k,
|
|
31
|
+
getPercentValue: C,
|
|
32
|
+
getThumbPercent(t) {
|
|
33
|
+
return k(c[t]);
|
|
34
|
+
},
|
|
35
|
+
setThumbPercent(t, a) {
|
|
36
|
+
const i = C(a);
|
|
37
|
+
n({ type: "SET_VALUE", index: t, value: i });
|
|
38
|
+
},
|
|
39
|
+
getThumbMin(t) {
|
|
40
|
+
return E(g, t).min;
|
|
41
|
+
},
|
|
42
|
+
getThumbMax(t) {
|
|
43
|
+
return E(g, t).max;
|
|
44
|
+
},
|
|
45
|
+
increment(t) {
|
|
46
|
+
n({ type: "INCREMENT", index: t });
|
|
47
|
+
},
|
|
48
|
+
decrement(t) {
|
|
49
|
+
n({ type: "DECREMENT", index: t });
|
|
50
|
+
},
|
|
51
|
+
focus() {
|
|
52
|
+
m && n({ type: "FOCUS", index: 0 });
|
|
53
|
+
},
|
|
54
|
+
getLabelProps() {
|
|
55
|
+
return l.label({
|
|
56
|
+
...u.label.attrs,
|
|
57
|
+
dir: e("dir"),
|
|
58
|
+
"data-disabled": r(s),
|
|
59
|
+
"data-orientation": e("orientation"),
|
|
60
|
+
"data-invalid": r(b),
|
|
61
|
+
"data-dragging": r(f),
|
|
62
|
+
"data-focus": r(p),
|
|
63
|
+
id: O(o),
|
|
64
|
+
htmlFor: M(o, 0),
|
|
65
|
+
onClick(t) {
|
|
66
|
+
var a;
|
|
67
|
+
m && (t.preventDefault(), (a = tt(o)) == null || a.focus());
|
|
68
|
+
},
|
|
69
|
+
style: {
|
|
70
|
+
userSelect: "none",
|
|
71
|
+
WebkitUserSelect: "none"
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
getRootProps() {
|
|
76
|
+
return l.element({
|
|
77
|
+
...u.root.attrs,
|
|
78
|
+
"data-disabled": r(s),
|
|
79
|
+
"data-orientation": e("orientation"),
|
|
80
|
+
"data-dragging": r(f),
|
|
81
|
+
"data-invalid": r(b),
|
|
82
|
+
"data-focus": r(p),
|
|
83
|
+
id: z(o),
|
|
84
|
+
dir: e("dir"),
|
|
85
|
+
style: it(g)
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
getValueTextProps() {
|
|
89
|
+
return l.element({
|
|
90
|
+
...u.valueText.attrs,
|
|
91
|
+
dir: e("dir"),
|
|
92
|
+
"data-disabled": r(s),
|
|
93
|
+
"data-orientation": e("orientation"),
|
|
94
|
+
"data-invalid": r(b),
|
|
95
|
+
"data-focus": r(p),
|
|
96
|
+
id: $(o)
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
getTrackProps() {
|
|
100
|
+
return l.element({
|
|
101
|
+
...u.track.attrs,
|
|
102
|
+
dir: e("dir"),
|
|
103
|
+
id: Z(o),
|
|
104
|
+
"data-disabled": r(s),
|
|
105
|
+
"data-invalid": r(b),
|
|
106
|
+
"data-dragging": r(f),
|
|
107
|
+
"data-orientation": e("orientation"),
|
|
108
|
+
"data-focus": r(p),
|
|
109
|
+
style: { position: "relative" }
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
getThumbProps(t) {
|
|
113
|
+
var _;
|
|
114
|
+
const { index: a = 0, name: i } = t, N = c[a], S = E(g, a), W = (_ = e("getAriaValueText")) == null ? void 0 : _({ value: N, index: a }), F = Array.isArray(h) ? h[a] : h, B = Array.isArray(T) ? T[a] : T;
|
|
115
|
+
return l.element({
|
|
116
|
+
...u.thumb.attrs,
|
|
117
|
+
dir: e("dir"),
|
|
118
|
+
"data-index": a,
|
|
119
|
+
"data-name": i,
|
|
120
|
+
id: Q(o, a),
|
|
121
|
+
"data-disabled": r(s),
|
|
122
|
+
"data-orientation": e("orientation"),
|
|
123
|
+
"data-focus": r(p && A === a),
|
|
124
|
+
"data-dragging": r(f && A === a),
|
|
125
|
+
draggable: !1,
|
|
126
|
+
"aria-disabled": Y(s),
|
|
127
|
+
"aria-label": F,
|
|
128
|
+
"aria-labelledby": B ?? O(o),
|
|
129
|
+
"aria-orientation": e("orientation"),
|
|
130
|
+
"aria-valuemax": S.max,
|
|
131
|
+
"aria-valuemin": S.min,
|
|
132
|
+
"aria-valuenow": c[a],
|
|
133
|
+
"aria-valuetext": W,
|
|
134
|
+
role: "slider",
|
|
135
|
+
tabIndex: s ? void 0 : 0,
|
|
136
|
+
style: U(g, a),
|
|
137
|
+
onPointerDown(d) {
|
|
138
|
+
if (!m || !L(d)) return;
|
|
139
|
+
const P = d.currentTarget.getBoundingClientRect(), x = {
|
|
140
|
+
x: P.left + P.width / 2,
|
|
141
|
+
y: P.top + P.height / 2
|
|
142
|
+
}, R = {
|
|
143
|
+
x: d.clientX - x.x,
|
|
144
|
+
y: d.clientY - x.y
|
|
145
|
+
};
|
|
146
|
+
n({ type: "THUMB_POINTER_DOWN", index: a, offset: R }), d.stopPropagation();
|
|
147
|
+
},
|
|
148
|
+
onBlur() {
|
|
149
|
+
m && n({ type: "BLUR" });
|
|
150
|
+
},
|
|
151
|
+
onFocus() {
|
|
152
|
+
m && n({ type: "FOCUS", index: a });
|
|
153
|
+
},
|
|
154
|
+
onKeyDown(d) {
|
|
155
|
+
if (d.defaultPrevented || !m) return;
|
|
156
|
+
const y = K(d) * e("step"), P = {
|
|
157
|
+
ArrowUp() {
|
|
158
|
+
V || n({ type: "ARROW_INC", step: y, src: "ArrowUp" });
|
|
159
|
+
},
|
|
160
|
+
ArrowDown() {
|
|
161
|
+
V || n({ type: "ARROW_DEC", step: y, src: "ArrowDown" });
|
|
162
|
+
},
|
|
163
|
+
ArrowLeft() {
|
|
164
|
+
w || n({ type: "ARROW_DEC", step: y, src: "ArrowLeft" });
|
|
165
|
+
},
|
|
166
|
+
ArrowRight() {
|
|
167
|
+
w || n({ type: "ARROW_INC", step: y, src: "ArrowRight" });
|
|
168
|
+
},
|
|
169
|
+
PageUp() {
|
|
170
|
+
n({ type: "ARROW_INC", step: y, src: "PageUp" });
|
|
171
|
+
},
|
|
172
|
+
PageDown() {
|
|
173
|
+
n({ type: "ARROW_DEC", step: y, src: "PageDown" });
|
|
174
|
+
},
|
|
175
|
+
Home() {
|
|
176
|
+
n({ type: "HOME" });
|
|
177
|
+
},
|
|
178
|
+
End() {
|
|
179
|
+
n({ type: "END" });
|
|
180
|
+
}
|
|
181
|
+
}, x = X(d, {
|
|
182
|
+
dir: e("dir"),
|
|
183
|
+
orientation: e("orientation")
|
|
184
|
+
}), R = P[x];
|
|
185
|
+
R && (R(d), d.preventDefault(), d.stopPropagation());
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
getHiddenInputProps(t) {
|
|
190
|
+
const { index: a = 0, name: i } = t;
|
|
191
|
+
return l.input({
|
|
192
|
+
name: i ?? (e("name") ? e("name") + (c.length > 1 ? "[]" : "") : void 0),
|
|
193
|
+
form: e("form"),
|
|
194
|
+
type: "text",
|
|
195
|
+
hidden: !0,
|
|
196
|
+
defaultValue: c[a],
|
|
197
|
+
id: M(o, a)
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
getRangeProps() {
|
|
201
|
+
return l.element({
|
|
202
|
+
id: J(o),
|
|
203
|
+
...u.range.attrs,
|
|
204
|
+
dir: e("dir"),
|
|
205
|
+
"data-dragging": r(f),
|
|
206
|
+
"data-focus": r(p),
|
|
207
|
+
"data-invalid": r(b),
|
|
208
|
+
"data-disabled": r(s),
|
|
209
|
+
"data-orientation": e("orientation"),
|
|
210
|
+
style: nt(g)
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
getControlProps() {
|
|
214
|
+
return l.element({
|
|
215
|
+
...u.control.attrs,
|
|
216
|
+
dir: e("dir"),
|
|
217
|
+
id: q(o),
|
|
218
|
+
"data-dragging": r(f),
|
|
219
|
+
"data-disabled": r(s),
|
|
220
|
+
"data-orientation": e("orientation"),
|
|
221
|
+
"data-invalid": r(b),
|
|
222
|
+
"data-focus": r(p),
|
|
223
|
+
style: rt(),
|
|
224
|
+
onPointerDown(t) {
|
|
225
|
+
if (!m || !L(t) || H(t)) return;
|
|
226
|
+
const a = G(t);
|
|
227
|
+
n({ type: "POINTER_DOWN", point: a }), t.preventDefault(), t.stopPropagation();
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
getMarkerGroupProps() {
|
|
232
|
+
return l.element({
|
|
233
|
+
...u.markerGroup.attrs,
|
|
234
|
+
role: "presentation",
|
|
235
|
+
dir: e("dir"),
|
|
236
|
+
"aria-hidden": !0,
|
|
237
|
+
"data-orientation": e("orientation"),
|
|
238
|
+
style: at()
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
getMarkerProps(t) {
|
|
242
|
+
const a = et(g, t.value);
|
|
243
|
+
let i;
|
|
244
|
+
return t.value < ot(c) ? i = "under-value" : t.value > dt(c) ? i = "over-value" : i = "at-value", l.element({
|
|
245
|
+
...u.marker.attrs,
|
|
246
|
+
id: j(o, t.value),
|
|
247
|
+
role: "presentation",
|
|
248
|
+
dir: e("dir"),
|
|
249
|
+
"data-orientation": e("orientation"),
|
|
250
|
+
"data-value": t.value,
|
|
251
|
+
"data-disabled": r(s),
|
|
252
|
+
"data-state": i,
|
|
253
|
+
style: a
|
|
254
|
+
});
|
|
255
|
+
},
|
|
256
|
+
getDraggingIndicatorProps(t) {
|
|
257
|
+
const { index: a = 0 } = t, i = a === A && f;
|
|
258
|
+
return l.element({
|
|
259
|
+
...u.draggingIndicator.attrs,
|
|
260
|
+
role: "presentation",
|
|
261
|
+
dir: e("dir"),
|
|
262
|
+
hidden: !i,
|
|
263
|
+
"data-orientation": e("orientation"),
|
|
264
|
+
"data-state": i ? "open" : "closed",
|
|
265
|
+
style: U(g, a)
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
export {
|
|
271
|
+
Pt as connect
|
|
272
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { getPercentValue as P, clampPercent as u } from "../../utils/dist/number.js";
|
|
2
|
+
import { dispatchInputValueEvent as T } from "../../dom-query/dist/form.js";
|
|
3
|
+
import { queryAll as V } from "../../dom-query/dist/query.js";
|
|
4
|
+
var b = (t) => {
|
|
5
|
+
var e;
|
|
6
|
+
return ((e = t.ids) == null ? void 0 : e.root) ?? `slider:${t.id}`;
|
|
7
|
+
}, k = (t, e) => {
|
|
8
|
+
var r, n;
|
|
9
|
+
return ((n = (r = t.ids) == null ? void 0 : r.thumb) == null ? void 0 : n.call(r, e)) ?? `slider:${t.id}:thumb:${e}`;
|
|
10
|
+
}, C = (t, e) => {
|
|
11
|
+
var r, n;
|
|
12
|
+
return ((n = (r = t.ids) == null ? void 0 : r.hiddenInput) == null ? void 0 : n.call(r, e)) ?? `slider:${t.id}:input:${e}`;
|
|
13
|
+
}, R = (t) => {
|
|
14
|
+
var e;
|
|
15
|
+
return ((e = t.ids) == null ? void 0 : e.control) ?? `slider:${t.id}:control`;
|
|
16
|
+
}, O = (t) => {
|
|
17
|
+
var e;
|
|
18
|
+
return ((e = t.ids) == null ? void 0 : e.track) ?? `slider:${t.id}:track`;
|
|
19
|
+
}, q = (t) => {
|
|
20
|
+
var e;
|
|
21
|
+
return ((e = t.ids) == null ? void 0 : e.range) ?? `slider:${t.id}:range`;
|
|
22
|
+
}, x = (t) => {
|
|
23
|
+
var e;
|
|
24
|
+
return ((e = t.ids) == null ? void 0 : e.label) ?? `slider:${t.id}:label`;
|
|
25
|
+
}, D = (t) => {
|
|
26
|
+
var e;
|
|
27
|
+
return ((e = t.ids) == null ? void 0 : e.valueText) ?? `slider:${t.id}:value-text`;
|
|
28
|
+
}, F = (t, e) => {
|
|
29
|
+
var r, n;
|
|
30
|
+
return ((n = (r = t.ids) == null ? void 0 : r.marker) == null ? void 0 : n.call(r, e)) ?? `slider:${t.id}:marker:${e}`;
|
|
31
|
+
}, M = (t) => t.getById(b(t)), X = (t, e) => t.getById(k(t, e)), B = (t) => V(h(t), "[role=slider]"), Y = (t) => B(t)[0], H = (t, e) => t.getById(C(t, e)), h = (t) => t.getById(R(t)), j = (t, e, r) => e === "contain" ? (r === "vertical" ? (t == null ? void 0 : t.height) ?? 0 : (t == null ? void 0 : t.width) ?? 0) / 2 : 0, G = (t, e) => {
|
|
32
|
+
const { context: r, prop: n, scope: o, refs: l } = t, g = h(o);
|
|
33
|
+
if (!g) return;
|
|
34
|
+
const i = l.get("thumbDragOffset"), c = {
|
|
35
|
+
x: e.x - ((i == null ? void 0 : i.x) ?? 0),
|
|
36
|
+
y: e.y - ((i == null ? void 0 : i.y) ?? 0)
|
|
37
|
+
}, v = j(r.get("thumbSize"), n("thumbAlignment"), n("orientation")), d = w(c, g, v).getPercentValue({
|
|
38
|
+
orientation: n("orientation"),
|
|
39
|
+
dir: n("dir"),
|
|
40
|
+
inverted: { y: !0 }
|
|
41
|
+
});
|
|
42
|
+
return P(d, n("min"), n("max"), n("step"));
|
|
43
|
+
};
|
|
44
|
+
function w(t, e, r) {
|
|
45
|
+
const { left: n, top: o, width: l, height: g } = e.getBoundingClientRect(), i = l - r * 2, c = g - r * 2, v = n + r, f = o + r, d = {
|
|
46
|
+
x: t.x - v,
|
|
47
|
+
y: t.y - f
|
|
48
|
+
}, s = {
|
|
49
|
+
x: i > 0 ? u(d.x / i) : 0,
|
|
50
|
+
y: c > 0 ? u(d.y / c) : 0
|
|
51
|
+
};
|
|
52
|
+
function p(I = {}) {
|
|
53
|
+
const { dir: y = "ltr", orientation: m = "horizontal", inverted: a } = I, $ = typeof a == "object" ? a.x : a, E = typeof a == "object" ? a.y : a;
|
|
54
|
+
return m === "horizontal" ? y === "rtl" || $ ? 1 - s.x : s.x : E ? 1 - s.y : s.y;
|
|
55
|
+
}
|
|
56
|
+
return { offset: d, percent: s, getPercentValue: p };
|
|
57
|
+
}
|
|
58
|
+
var J = (t, e) => {
|
|
59
|
+
e.forEach((r, n) => {
|
|
60
|
+
const o = H(t, n);
|
|
61
|
+
o && T(o, { value: r });
|
|
62
|
+
});
|
|
63
|
+
}, K = (t) => ({
|
|
64
|
+
left: (t == null ? void 0 : t.offsetLeft) ?? 0,
|
|
65
|
+
top: (t == null ? void 0 : t.offsetTop) ?? 0,
|
|
66
|
+
width: (t == null ? void 0 : t.offsetWidth) ?? 0,
|
|
67
|
+
height: (t == null ? void 0 : t.offsetHeight) ?? 0
|
|
68
|
+
});
|
|
69
|
+
export {
|
|
70
|
+
J as dispatchChangeEvent,
|
|
71
|
+
h as getControlEl,
|
|
72
|
+
R as getControlId,
|
|
73
|
+
Y as getFirstThumbEl,
|
|
74
|
+
H as getHiddenInputEl,
|
|
75
|
+
C as getHiddenInputId,
|
|
76
|
+
x as getLabelId,
|
|
77
|
+
F as getMarkerId,
|
|
78
|
+
K as getOffsetRect,
|
|
79
|
+
G as getPointValue,
|
|
80
|
+
q as getRangeId,
|
|
81
|
+
M as getRootEl,
|
|
82
|
+
b as getRootId,
|
|
83
|
+
X as getThumbEl,
|
|
84
|
+
B as getThumbEls,
|
|
85
|
+
k as getThumbId,
|
|
86
|
+
O as getTrackId,
|
|
87
|
+
D as getValueTextId
|
|
88
|
+
};
|