laif-ds 0.1.13 → 0.1.15
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/_virtual/index2.js +2 -5
- package/dist/_virtual/index3.js +5 -5
- package/dist/_virtual/index4.js +5 -2
- package/dist/_virtual/index5.js +5 -2
- package/dist/_virtual/index6.js +2 -5
- package/dist/components/ui/app-sidebar.js +29 -0
- package/dist/components/ui/async-select.js +1 -1
- package/dist/components/ui/badge.js +5 -5
- package/dist/components/ui/breadcrumb.js +2 -2
- package/dist/components/ui/button.js +8 -8
- package/dist/components/ui/chart.js +1 -1
- package/dist/components/ui/chat-message.js +4 -4
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/drawer.js +1 -1
- package/dist/components/ui/file-preview.js +1 -1
- package/dist/components/ui/gantt/components/Chart/Chart.js +1 -1
- package/dist/components/ui/input-selector.js +9 -9
- package/dist/components/ui/input.js +12 -12
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.js +476 -534
- package/dist/components/ui/slider.js +132 -0
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toaster.js +3 -3
- package/dist/dist/components/ui/table.js +1 -1
- package/dist/index.d.ts +77 -34
- package/dist/index.js +103 -99
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +439 -0
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-collection/dist/index.js +49 -0
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-primitive/dist/index.js +33 -0
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { clamp as $ } from "../../number/dist/index.js";
|
|
4
|
+
import { composeEventHandlers as C } from "../../primitive/dist/index.js";
|
|
5
|
+
import { useComposedRefs as M } from "../../react-compose-refs/dist/index.js";
|
|
6
|
+
import { createContextScope as ce } from "../../react-context/dist/index.js";
|
|
7
|
+
import { useControllableState as le } from "../node_modules/@radix-ui/react-use-controllable-state/dist/index.js";
|
|
8
|
+
import { useDirection as de } from "../../react-direction/dist/index.js";
|
|
9
|
+
import { usePrevious as ue } from "../../react-use-previous/dist/index.js";
|
|
10
|
+
import { useSize as fe } from "../../react-use-size/dist/index.js";
|
|
11
|
+
import { Primitive as K } from "../node_modules/@radix-ui/react-primitive/dist/index.js";
|
|
12
|
+
import { createCollection as me } from "../node_modules/@radix-ui/react-collection/dist/index.js";
|
|
13
|
+
import { jsx as v, jsxs as pe } from "react/jsx-runtime";
|
|
14
|
+
var j = ["PageUp", "PageDown"], X = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], G = {
|
|
15
|
+
"from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
16
|
+
"from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
|
|
17
|
+
"from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
18
|
+
"from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
|
|
19
|
+
}, I = "Slider", [z, he, Se] = me(I), [W, Oe] = ce(I, [
|
|
20
|
+
Se
|
|
21
|
+
]), [ge, T] = W(I), q = d.forwardRef(
|
|
22
|
+
(e, t) => {
|
|
23
|
+
const {
|
|
24
|
+
name: o,
|
|
25
|
+
min: n = 0,
|
|
26
|
+
max: a = 100,
|
|
27
|
+
step: c = 1,
|
|
28
|
+
orientation: r = "horizontal",
|
|
29
|
+
disabled: s = !1,
|
|
30
|
+
minStepsBetweenThumbs: l = 0,
|
|
31
|
+
defaultValue: h = [n],
|
|
32
|
+
value: S,
|
|
33
|
+
onValueChange: i = () => {
|
|
34
|
+
},
|
|
35
|
+
onValueCommit: u = () => {
|
|
36
|
+
},
|
|
37
|
+
inverted: w = !1,
|
|
38
|
+
form: P,
|
|
39
|
+
...g
|
|
40
|
+
} = e, m = d.useRef(/* @__PURE__ */ new Set()), f = d.useRef(0), b = r === "horizontal" ? ve : we, [p = [], A] = le({
|
|
41
|
+
prop: S,
|
|
42
|
+
defaultProp: h,
|
|
43
|
+
onChange: (R) => {
|
|
44
|
+
var E;
|
|
45
|
+
(E = [...m.current][f.current]) == null || E.focus(), i(R);
|
|
46
|
+
}
|
|
47
|
+
}), k = d.useRef(p);
|
|
48
|
+
function H(R) {
|
|
49
|
+
const x = ye(p, R);
|
|
50
|
+
V(R, x);
|
|
51
|
+
}
|
|
52
|
+
function se(R) {
|
|
53
|
+
V(R, f.current);
|
|
54
|
+
}
|
|
55
|
+
function ae() {
|
|
56
|
+
const R = k.current[f.current];
|
|
57
|
+
p[f.current] !== R && u(p);
|
|
58
|
+
}
|
|
59
|
+
function V(R, x, { commit: E } = { commit: !1 }) {
|
|
60
|
+
const F = Ce(c), N = Me(Math.round((R - n) / c) * c + n, F), B = $(N, [n, a]);
|
|
61
|
+
A((_ = []) => {
|
|
62
|
+
const y = Pe(_, B, x);
|
|
63
|
+
if (_e(y, l * c)) {
|
|
64
|
+
f.current = y.indexOf(B);
|
|
65
|
+
const Y = String(y) !== String(_);
|
|
66
|
+
return Y && E && u(y), Y ? y : _;
|
|
67
|
+
} else
|
|
68
|
+
return _;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return /* @__PURE__ */ v(
|
|
72
|
+
ge,
|
|
73
|
+
{
|
|
74
|
+
scope: e.__scopeSlider,
|
|
75
|
+
name: o,
|
|
76
|
+
disabled: s,
|
|
77
|
+
min: n,
|
|
78
|
+
max: a,
|
|
79
|
+
valueIndexToChangeRef: f,
|
|
80
|
+
thumbs: m.current,
|
|
81
|
+
values: p,
|
|
82
|
+
orientation: r,
|
|
83
|
+
form: P,
|
|
84
|
+
children: /* @__PURE__ */ v(z.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ v(z.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ v(
|
|
85
|
+
b,
|
|
86
|
+
{
|
|
87
|
+
"aria-disabled": s,
|
|
88
|
+
"data-disabled": s ? "" : void 0,
|
|
89
|
+
...g,
|
|
90
|
+
ref: t,
|
|
91
|
+
onPointerDown: C(g.onPointerDown, () => {
|
|
92
|
+
s || (k.current = p);
|
|
93
|
+
}),
|
|
94
|
+
min: n,
|
|
95
|
+
max: a,
|
|
96
|
+
inverted: w,
|
|
97
|
+
onSlideStart: s ? void 0 : H,
|
|
98
|
+
onSlideMove: s ? void 0 : se,
|
|
99
|
+
onSlideEnd: s ? void 0 : ae,
|
|
100
|
+
onHomeKeyDown: () => !s && V(n, 0, { commit: !0 }),
|
|
101
|
+
onEndKeyDown: () => !s && V(a, p.length - 1, { commit: !0 }),
|
|
102
|
+
onStepKeyDown: ({ event: R, direction: x }) => {
|
|
103
|
+
if (!s) {
|
|
104
|
+
const N = j.includes(R.key) || R.shiftKey && X.includes(R.key) ? 10 : 1, B = f.current, _ = p[B], y = c * N * x;
|
|
105
|
+
V(_ + y, B, { commit: !0 });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
) }) })
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
q.displayName = I;
|
|
115
|
+
var [J, Q] = W(I, {
|
|
116
|
+
startEdge: "left",
|
|
117
|
+
endEdge: "right",
|
|
118
|
+
size: "width",
|
|
119
|
+
direction: 1
|
|
120
|
+
}), ve = d.forwardRef(
|
|
121
|
+
(e, t) => {
|
|
122
|
+
const {
|
|
123
|
+
min: o,
|
|
124
|
+
max: n,
|
|
125
|
+
dir: a,
|
|
126
|
+
inverted: c,
|
|
127
|
+
onSlideStart: r,
|
|
128
|
+
onSlideMove: s,
|
|
129
|
+
onSlideEnd: l,
|
|
130
|
+
onStepKeyDown: h,
|
|
131
|
+
...S
|
|
132
|
+
} = e, [i, u] = d.useState(null), w = M(t, (b) => u(b)), P = d.useRef(void 0), g = de(a), m = g === "ltr", f = m && !c || !m && c;
|
|
133
|
+
function D(b) {
|
|
134
|
+
const p = P.current || i.getBoundingClientRect(), A = [0, p.width], H = U(A, f ? [o, n] : [n, o]);
|
|
135
|
+
return P.current = p, H(b - p.left);
|
|
136
|
+
}
|
|
137
|
+
return /* @__PURE__ */ v(
|
|
138
|
+
J,
|
|
139
|
+
{
|
|
140
|
+
scope: e.__scopeSlider,
|
|
141
|
+
startEdge: f ? "left" : "right",
|
|
142
|
+
endEdge: f ? "right" : "left",
|
|
143
|
+
direction: f ? 1 : -1,
|
|
144
|
+
size: "width",
|
|
145
|
+
children: /* @__PURE__ */ v(
|
|
146
|
+
Z,
|
|
147
|
+
{
|
|
148
|
+
dir: g,
|
|
149
|
+
"data-orientation": "horizontal",
|
|
150
|
+
...S,
|
|
151
|
+
ref: w,
|
|
152
|
+
style: {
|
|
153
|
+
...S.style,
|
|
154
|
+
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
155
|
+
},
|
|
156
|
+
onSlideStart: (b) => {
|
|
157
|
+
const p = D(b.clientX);
|
|
158
|
+
r == null || r(p);
|
|
159
|
+
},
|
|
160
|
+
onSlideMove: (b) => {
|
|
161
|
+
const p = D(b.clientX);
|
|
162
|
+
s == null || s(p);
|
|
163
|
+
},
|
|
164
|
+
onSlideEnd: () => {
|
|
165
|
+
P.current = void 0, l == null || l();
|
|
166
|
+
},
|
|
167
|
+
onStepKeyDown: (b) => {
|
|
168
|
+
const A = G[f ? "from-left" : "from-right"].includes(b.key);
|
|
169
|
+
h == null || h({ event: b, direction: A ? -1 : 1 });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
), we = d.forwardRef(
|
|
177
|
+
(e, t) => {
|
|
178
|
+
const {
|
|
179
|
+
min: o,
|
|
180
|
+
max: n,
|
|
181
|
+
inverted: a,
|
|
182
|
+
onSlideStart: c,
|
|
183
|
+
onSlideMove: r,
|
|
184
|
+
onSlideEnd: s,
|
|
185
|
+
onStepKeyDown: l,
|
|
186
|
+
...h
|
|
187
|
+
} = e, S = d.useRef(null), i = M(t, S), u = d.useRef(void 0), w = !a;
|
|
188
|
+
function P(g) {
|
|
189
|
+
const m = u.current || S.current.getBoundingClientRect(), f = [0, m.height], b = U(f, w ? [n, o] : [o, n]);
|
|
190
|
+
return u.current = m, b(g - m.top);
|
|
191
|
+
}
|
|
192
|
+
return /* @__PURE__ */ v(
|
|
193
|
+
J,
|
|
194
|
+
{
|
|
195
|
+
scope: e.__scopeSlider,
|
|
196
|
+
startEdge: w ? "bottom" : "top",
|
|
197
|
+
endEdge: w ? "top" : "bottom",
|
|
198
|
+
size: "height",
|
|
199
|
+
direction: w ? 1 : -1,
|
|
200
|
+
children: /* @__PURE__ */ v(
|
|
201
|
+
Z,
|
|
202
|
+
{
|
|
203
|
+
"data-orientation": "vertical",
|
|
204
|
+
...h,
|
|
205
|
+
ref: i,
|
|
206
|
+
style: {
|
|
207
|
+
...h.style,
|
|
208
|
+
"--radix-slider-thumb-transform": "translateY(50%)"
|
|
209
|
+
},
|
|
210
|
+
onSlideStart: (g) => {
|
|
211
|
+
const m = P(g.clientY);
|
|
212
|
+
c == null || c(m);
|
|
213
|
+
},
|
|
214
|
+
onSlideMove: (g) => {
|
|
215
|
+
const m = P(g.clientY);
|
|
216
|
+
r == null || r(m);
|
|
217
|
+
},
|
|
218
|
+
onSlideEnd: () => {
|
|
219
|
+
u.current = void 0, s == null || s();
|
|
220
|
+
},
|
|
221
|
+
onStepKeyDown: (g) => {
|
|
222
|
+
const f = G[w ? "from-bottom" : "from-top"].includes(g.key);
|
|
223
|
+
l == null || l({ event: g, direction: f ? -1 : 1 });
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
), Z = d.forwardRef(
|
|
231
|
+
(e, t) => {
|
|
232
|
+
const {
|
|
233
|
+
__scopeSlider: o,
|
|
234
|
+
onSlideStart: n,
|
|
235
|
+
onSlideMove: a,
|
|
236
|
+
onSlideEnd: c,
|
|
237
|
+
onHomeKeyDown: r,
|
|
238
|
+
onEndKeyDown: s,
|
|
239
|
+
onStepKeyDown: l,
|
|
240
|
+
...h
|
|
241
|
+
} = e, S = T(I, o);
|
|
242
|
+
return /* @__PURE__ */ v(
|
|
243
|
+
K.span,
|
|
244
|
+
{
|
|
245
|
+
...h,
|
|
246
|
+
ref: t,
|
|
247
|
+
onKeyDown: C(e.onKeyDown, (i) => {
|
|
248
|
+
i.key === "Home" ? (r(i), i.preventDefault()) : i.key === "End" ? (s(i), i.preventDefault()) : j.concat(X).includes(i.key) && (l(i), i.preventDefault());
|
|
249
|
+
}),
|
|
250
|
+
onPointerDown: C(e.onPointerDown, (i) => {
|
|
251
|
+
const u = i.target;
|
|
252
|
+
u.setPointerCapture(i.pointerId), i.preventDefault(), S.thumbs.has(u) ? u.focus() : n(i);
|
|
253
|
+
}),
|
|
254
|
+
onPointerMove: C(e.onPointerMove, (i) => {
|
|
255
|
+
i.target.hasPointerCapture(i.pointerId) && a(i);
|
|
256
|
+
}),
|
|
257
|
+
onPointerUp: C(e.onPointerUp, (i) => {
|
|
258
|
+
const u = i.target;
|
|
259
|
+
u.hasPointerCapture(i.pointerId) && (u.releasePointerCapture(i.pointerId), c(i));
|
|
260
|
+
})
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
), ee = "SliderTrack", te = d.forwardRef(
|
|
265
|
+
(e, t) => {
|
|
266
|
+
const { __scopeSlider: o, ...n } = e, a = T(ee, o);
|
|
267
|
+
return /* @__PURE__ */ v(
|
|
268
|
+
K.span,
|
|
269
|
+
{
|
|
270
|
+
"data-disabled": a.disabled ? "" : void 0,
|
|
271
|
+
"data-orientation": a.orientation,
|
|
272
|
+
...n,
|
|
273
|
+
ref: t
|
|
274
|
+
}
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
te.displayName = ee;
|
|
279
|
+
var L = "SliderRange", ne = d.forwardRef(
|
|
280
|
+
(e, t) => {
|
|
281
|
+
const { __scopeSlider: o, ...n } = e, a = T(L, o), c = Q(L, o), r = d.useRef(null), s = M(t, r), l = a.values.length, h = a.values.map(
|
|
282
|
+
(u) => ie(u, a.min, a.max)
|
|
283
|
+
), S = l > 1 ? Math.min(...h) : 0, i = 100 - Math.max(...h);
|
|
284
|
+
return /* @__PURE__ */ v(
|
|
285
|
+
K.span,
|
|
286
|
+
{
|
|
287
|
+
"data-orientation": a.orientation,
|
|
288
|
+
"data-disabled": a.disabled ? "" : void 0,
|
|
289
|
+
...n,
|
|
290
|
+
ref: s,
|
|
291
|
+
style: {
|
|
292
|
+
...e.style,
|
|
293
|
+
[c.startEdge]: S + "%",
|
|
294
|
+
[c.endEdge]: i + "%"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
ne.displayName = L;
|
|
301
|
+
var O = "SliderThumb", oe = d.forwardRef(
|
|
302
|
+
(e, t) => {
|
|
303
|
+
const o = he(e.__scopeSlider), [n, a] = d.useState(null), c = M(t, (s) => a(s)), r = d.useMemo(
|
|
304
|
+
() => n ? o().findIndex((s) => s.ref.current === n) : -1,
|
|
305
|
+
[o, n]
|
|
306
|
+
);
|
|
307
|
+
return /* @__PURE__ */ v(be, { ...e, ref: c, index: r });
|
|
308
|
+
}
|
|
309
|
+
), be = d.forwardRef(
|
|
310
|
+
(e, t) => {
|
|
311
|
+
const { __scopeSlider: o, index: n, name: a, ...c } = e, r = T(O, o), s = Q(O, o), [l, h] = d.useState(null), S = M(t, (D) => h(D)), i = l ? r.form || !!l.closest("form") : !0, u = fe(l), w = r.values[n], P = w === void 0 ? 0 : ie(w, r.min, r.max), g = xe(n, r.values.length), m = u == null ? void 0 : u[s.size], f = m ? De(m, P, s.direction) : 0;
|
|
312
|
+
return d.useEffect(() => {
|
|
313
|
+
if (l)
|
|
314
|
+
return r.thumbs.add(l), () => {
|
|
315
|
+
r.thumbs.delete(l);
|
|
316
|
+
};
|
|
317
|
+
}, [l, r.thumbs]), /* @__PURE__ */ pe(
|
|
318
|
+
"span",
|
|
319
|
+
{
|
|
320
|
+
style: {
|
|
321
|
+
transform: "var(--radix-slider-thumb-transform)",
|
|
322
|
+
position: "absolute",
|
|
323
|
+
[s.startEdge]: `calc(${P}% + ${f}px)`
|
|
324
|
+
},
|
|
325
|
+
children: [
|
|
326
|
+
/* @__PURE__ */ v(z.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ v(
|
|
327
|
+
K.span,
|
|
328
|
+
{
|
|
329
|
+
role: "slider",
|
|
330
|
+
"aria-label": e["aria-label"] || g,
|
|
331
|
+
"aria-valuemin": r.min,
|
|
332
|
+
"aria-valuenow": w,
|
|
333
|
+
"aria-valuemax": r.max,
|
|
334
|
+
"aria-orientation": r.orientation,
|
|
335
|
+
"data-orientation": r.orientation,
|
|
336
|
+
"data-disabled": r.disabled ? "" : void 0,
|
|
337
|
+
tabIndex: r.disabled ? void 0 : 0,
|
|
338
|
+
...c,
|
|
339
|
+
ref: S,
|
|
340
|
+
style: w === void 0 ? { display: "none" } : e.style,
|
|
341
|
+
onFocus: C(e.onFocus, () => {
|
|
342
|
+
r.valueIndexToChangeRef.current = n;
|
|
343
|
+
})
|
|
344
|
+
}
|
|
345
|
+
) }),
|
|
346
|
+
i && /* @__PURE__ */ v(
|
|
347
|
+
re,
|
|
348
|
+
{
|
|
349
|
+
name: a ?? (r.name ? r.name + (r.values.length > 1 ? "[]" : "") : void 0),
|
|
350
|
+
form: r.form,
|
|
351
|
+
value: w
|
|
352
|
+
},
|
|
353
|
+
n
|
|
354
|
+
)
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
oe.displayName = O;
|
|
361
|
+
var Re = "RadioBubbleInput", re = d.forwardRef(
|
|
362
|
+
({ __scopeSlider: e, value: t, ...o }, n) => {
|
|
363
|
+
const a = d.useRef(null), c = M(a, n), r = ue(t);
|
|
364
|
+
return d.useEffect(() => {
|
|
365
|
+
const s = a.current;
|
|
366
|
+
if (!s) return;
|
|
367
|
+
const l = window.HTMLInputElement.prototype, S = Object.getOwnPropertyDescriptor(l, "value").set;
|
|
368
|
+
if (r !== t && S) {
|
|
369
|
+
const i = new Event("input", { bubbles: !0 });
|
|
370
|
+
S.call(s, t), s.dispatchEvent(i);
|
|
371
|
+
}
|
|
372
|
+
}, [r, t]), /* @__PURE__ */ v(
|
|
373
|
+
K.input,
|
|
374
|
+
{
|
|
375
|
+
style: { display: "none" },
|
|
376
|
+
...o,
|
|
377
|
+
ref: c,
|
|
378
|
+
defaultValue: t
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
);
|
|
383
|
+
re.displayName = Re;
|
|
384
|
+
function Pe(e = [], t, o) {
|
|
385
|
+
const n = [...e];
|
|
386
|
+
return n[o] = t, n.sort((a, c) => a - c);
|
|
387
|
+
}
|
|
388
|
+
function ie(e, t, o) {
|
|
389
|
+
const c = 100 / (o - t) * (e - t);
|
|
390
|
+
return $(c, [0, 100]);
|
|
391
|
+
}
|
|
392
|
+
function xe(e, t) {
|
|
393
|
+
return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
|
|
394
|
+
}
|
|
395
|
+
function ye(e, t) {
|
|
396
|
+
if (e.length === 1) return 0;
|
|
397
|
+
const o = e.map((a) => Math.abs(a - t)), n = Math.min(...o);
|
|
398
|
+
return o.indexOf(n);
|
|
399
|
+
}
|
|
400
|
+
function De(e, t, o) {
|
|
401
|
+
const n = e / 2, c = U([0, 50], [0, n]);
|
|
402
|
+
return (n - c(t) * o) * o;
|
|
403
|
+
}
|
|
404
|
+
function Ee(e) {
|
|
405
|
+
return e.slice(0, -1).map((t, o) => e[o + 1] - t);
|
|
406
|
+
}
|
|
407
|
+
function _e(e, t) {
|
|
408
|
+
if (t > 0) {
|
|
409
|
+
const o = Ee(e);
|
|
410
|
+
return Math.min(...o) >= t;
|
|
411
|
+
}
|
|
412
|
+
return !0;
|
|
413
|
+
}
|
|
414
|
+
function U(e, t) {
|
|
415
|
+
return (o) => {
|
|
416
|
+
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
417
|
+
const n = (t[1] - t[0]) / (e[1] - e[0]);
|
|
418
|
+
return t[0] + n * (o - e[0]);
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function Ce(e) {
|
|
422
|
+
return (String(e).split(".")[1] || "").length;
|
|
423
|
+
}
|
|
424
|
+
function Me(e, t) {
|
|
425
|
+
const o = Math.pow(10, t);
|
|
426
|
+
return Math.round(e * o) / o;
|
|
427
|
+
}
|
|
428
|
+
var Ue = q, Fe = te, Ye = ne, $e = oe;
|
|
429
|
+
export {
|
|
430
|
+
Ye as Range,
|
|
431
|
+
Ue as Root,
|
|
432
|
+
q as Slider,
|
|
433
|
+
ne as SliderRange,
|
|
434
|
+
oe as SliderThumb,
|
|
435
|
+
te as SliderTrack,
|
|
436
|
+
$e as Thumb,
|
|
437
|
+
Fe as Track,
|
|
438
|
+
Oe as createSliderScope
|
|
439
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import r from "react";
|
|
3
|
+
import { createContextScope as y } from "../../../../../react-context/dist/index.js";
|
|
4
|
+
import { useComposedRefs as M } from "../../../../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { createSlot as x } from "../../../../../react-slot/dist/index.js";
|
|
6
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
7
|
+
function g(s) {
|
|
8
|
+
const m = s + "CollectionProvider", [A, N] = y(m), [_, f] = A(
|
|
9
|
+
m,
|
|
10
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
11
|
+
), p = (c) => {
|
|
12
|
+
const { scope: e, children: l } = c, o = r.useRef(null), t = r.useRef(/* @__PURE__ */ new Map()).current;
|
|
13
|
+
return /* @__PURE__ */ d(_, { scope: e, itemMap: t, collectionRef: o, children: l });
|
|
14
|
+
};
|
|
15
|
+
p.displayName = m;
|
|
16
|
+
const u = s + "CollectionSlot", E = x(u), C = r.forwardRef(
|
|
17
|
+
(c, e) => {
|
|
18
|
+
const { scope: l, children: o } = c, t = f(u, l), n = M(e, t.collectionRef);
|
|
19
|
+
return /* @__PURE__ */ d(E, { ref: n, children: o });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
C.displayName = u;
|
|
23
|
+
const a = s + "CollectionItemSlot", R = "data-radix-collection-item", T = x(a), I = r.forwardRef(
|
|
24
|
+
(c, e) => {
|
|
25
|
+
const { scope: l, children: o, ...t } = c, n = r.useRef(null), S = M(e, n), i = f(a, l);
|
|
26
|
+
return r.useEffect(() => (i.itemMap.set(n, { ref: n, ...t }), () => void i.itemMap.delete(n))), /* @__PURE__ */ d(T, { [R]: "", ref: S, children: o });
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
I.displayName = a;
|
|
30
|
+
function O(c) {
|
|
31
|
+
const e = f(s + "CollectionConsumer", c);
|
|
32
|
+
return r.useCallback(() => {
|
|
33
|
+
const o = e.collectionRef.current;
|
|
34
|
+
if (!o) return [];
|
|
35
|
+
const t = Array.from(o.querySelectorAll(`[${R}]`));
|
|
36
|
+
return Array.from(e.itemMap.values()).sort(
|
|
37
|
+
(i, v) => t.indexOf(i.ref.current) - t.indexOf(v.ref.current)
|
|
38
|
+
);
|
|
39
|
+
}, [e.collectionRef, e.itemMap]);
|
|
40
|
+
}
|
|
41
|
+
return [
|
|
42
|
+
{ Provider: p, Slot: C, ItemSlot: I },
|
|
43
|
+
O,
|
|
44
|
+
N
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
g as createCollection
|
|
49
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
import { createSlot as n } from "../../../../../react-slot/dist/index.js";
|
|
5
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
6
|
+
var u = [
|
|
7
|
+
"a",
|
|
8
|
+
"button",
|
|
9
|
+
"div",
|
|
10
|
+
"form",
|
|
11
|
+
"h2",
|
|
12
|
+
"h3",
|
|
13
|
+
"img",
|
|
14
|
+
"input",
|
|
15
|
+
"label",
|
|
16
|
+
"li",
|
|
17
|
+
"nav",
|
|
18
|
+
"ol",
|
|
19
|
+
"p",
|
|
20
|
+
"select",
|
|
21
|
+
"span",
|
|
22
|
+
"svg",
|
|
23
|
+
"ul"
|
|
24
|
+
], w = u.reduce((t, i) => {
|
|
25
|
+
const o = n(`Primitive.${i}`), r = l.forwardRef((e, m) => {
|
|
26
|
+
const { asChild: a, ...p } = e, s = a ? o : i;
|
|
27
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(s, { ...p, ref: m });
|
|
28
|
+
});
|
|
29
|
+
return r.displayName = `Primitive.${i}`, { ...t, [i]: r };
|
|
30
|
+
}, {});
|
|
31
|
+
export {
|
|
32
|
+
w as Primitive
|
|
33
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { useLayoutEffect as v } from "../../../../../react-use-layout-effect/dist/index.js";
|
|
4
|
+
var E = n[" useInsertionEffect ".trim().toString()] || v;
|
|
5
|
+
function y({
|
|
6
|
+
prop: t,
|
|
7
|
+
defaultProp: u,
|
|
8
|
+
onChange: e = () => {
|
|
9
|
+
},
|
|
10
|
+
caller: i
|
|
11
|
+
}) {
|
|
12
|
+
const [l, o, r] = w({
|
|
13
|
+
defaultProp: u,
|
|
14
|
+
onChange: e
|
|
15
|
+
}), c = t !== void 0, a = c ? t : l;
|
|
16
|
+
{
|
|
17
|
+
const s = n.useRef(t !== void 0);
|
|
18
|
+
n.useEffect(() => {
|
|
19
|
+
const f = s.current;
|
|
20
|
+
f !== c && console.warn(
|
|
21
|
+
`${i} is changing from ${f ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
22
|
+
), s.current = c;
|
|
23
|
+
}, [c, i]);
|
|
24
|
+
}
|
|
25
|
+
const m = n.useCallback(
|
|
26
|
+
(s) => {
|
|
27
|
+
var f;
|
|
28
|
+
if (c) {
|
|
29
|
+
const d = R(s) ? s(t) : s;
|
|
30
|
+
d !== t && ((f = r.current) == null || f.call(r, d));
|
|
31
|
+
} else
|
|
32
|
+
o(s);
|
|
33
|
+
},
|
|
34
|
+
[c, t, o, r]
|
|
35
|
+
);
|
|
36
|
+
return [a, m];
|
|
37
|
+
}
|
|
38
|
+
function w({
|
|
39
|
+
defaultProp: t,
|
|
40
|
+
onChange: u
|
|
41
|
+
}) {
|
|
42
|
+
const [e, i] = n.useState(t), l = n.useRef(e), o = n.useRef(u);
|
|
43
|
+
return E(() => {
|
|
44
|
+
o.current = u;
|
|
45
|
+
}, [u]), n.useEffect(() => {
|
|
46
|
+
var r;
|
|
47
|
+
l.current !== e && ((r = o.current) == null || r.call(o, e), l.current = e);
|
|
48
|
+
}, [e, l]), [e, i, o];
|
|
49
|
+
}
|
|
50
|
+
function R(t) {
|
|
51
|
+
return typeof t == "function";
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
y as useControllableState
|
|
55
|
+
};
|
|
@@ -3,7 +3,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
|
|
|
3
3
|
import { ok as u } from "../../devlop/lib/default.js";
|
|
4
4
|
import { svg as m, html as C } from "../../property-information/index.js";
|
|
5
5
|
import { stringify as N } from "../../space-separated-tokens/index.js";
|
|
6
|
-
import S from "../../../_virtual/
|
|
6
|
+
import S from "../../../_virtual/index3.js";
|
|
7
7
|
import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
|
|
8
8
|
import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
|
|
9
9
|
import { VFileMessage as h } from "../../vfile-message/lib/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { __module as e } from "../../_virtual/
|
|
2
|
+
import { __module as e } from "../../_virtual/index2.js";
|
|
3
3
|
import { __require as t } from "./cjs/react-is.production.min.js";
|
|
4
4
|
import { __require as o } from "./cjs/react-is.development.js";
|
|
5
5
|
var r;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { bail as P } from "../../bail/index.js";
|
|
3
|
-
import y from "../../../_virtual/
|
|
3
|
+
import y from "../../../_virtual/index4.js";
|
|
4
4
|
import z from "../../is-plain-obj/index.js";
|
|
5
5
|
import { CallableInstance as C } from "./callable-instance.js";
|
|
6
6
|
import { trough as A } from "../../trough/lib/index.js";
|