prime-ui-kit 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/dist/chunks/{chunk-ZEFCDEEQ.js → chunk-6JTZOA5I.js} +878 -331
- package/dist/chunks/{chunk-LXGRKN34.js → chunk-OAE4IQX2.js} +769 -479
- package/dist/chunks/{chunk-IQELQNMR.js → chunk-U5SR2LZR.js} +17 -4
- package/dist/color-picker.js +2 -2
- package/dist/components/button/Button.d.ts +19 -2
- package/dist/components/card/Card.d.ts +1 -1
- package/dist/components/code-block/CodeBlock.d.ts +1 -1
- package/dist/components/color-picker/ColorPicker.d.ts +1 -1
- package/dist/components/data-table/Row.d.ts +3 -1
- package/dist/components/data-table/rows.d.ts +4 -0
- package/dist/components/digit-input/DigitInput.d.ts +6 -1
- package/dist/components/index.d.ts +4 -1
- package/dist/components/input/Input.d.ts +16 -1
- package/dist/components/input/passwordStrength.d.ts +9 -0
- package/dist/components/progress-bar/ProgressBar.d.ts +16 -1
- package/dist/components/sparkline/Sparkline.d.ts +26 -0
- package/dist/hooks/useEdgeOverflow.d.ts +4 -0
- package/dist/icons/registry.d.ts +2 -0
- package/dist/index.css +830 -267
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -3
- package/dist/internal/CheckMark.d.ts +12 -0
- package/dist/internal/MorphText.d.ts +12 -0
- package/dist/internal/RollingNumber.d.ts +14 -0
- package/dist/internal/surfaceDepth.d.ts +25 -0
- package/dist/internal/swatch.d.ts +4 -1
- package/dist/layout/app-shell/AppShell.d.ts +2 -2
- package/dist/motion/celebrate.d.ts +18 -0
- package/dist/tokens/layers.d.ts +37 -0
- package/dist/tokens/naming.d.ts +1 -1
- package/dist/tokens/semantic.d.ts +66 -56
- package/dist/tokens/themes/dark.d.ts +6 -14
- package/package.json +1 -1
- package/src/components/accordion/COMPONENT.md +4 -4
- package/src/components/avatar/COMPONENT.md +1 -1
- package/src/components/button/COMPONENT.md +26 -5
- package/src/components/button/examples/download.tsx +45 -0
- package/src/components/button/examples/hold-to-confirm.tsx +23 -0
- package/src/components/button/examples/label-morph.tsx +33 -0
- package/src/components/card/COMPONENT.md +4 -2
- package/src/components/card/examples/narrow.tsx +2 -2
- package/src/components/card/examples/panel-chart.tsx +1 -1
- package/src/components/card/examples/variants.tsx +1 -1
- package/src/components/checkbox/examples/examples.module.css +1 -1
- package/src/components/code-block/COMPONENT.md +6 -6
- package/src/components/code-block/examples/overview.tsx +1 -1
- package/src/components/code-block/examples/variants.tsx +1 -1
- package/src/components/color-picker/COMPONENT.md +1 -1
- package/src/components/color-swatches/COMPONENT.md +5 -5
- package/src/components/command-menu/COMPONENT.md +1 -1
- package/src/components/crossfade/examples/overview.tsx +3 -3
- package/src/components/data-table/COMPONENT.md +5 -4
- package/src/components/digit-input/COMPONENT.md +5 -3
- package/src/components/digit-input/examples/on-complete.tsx +7 -6
- package/src/components/dnd/COMPONENT.md +1 -1
- package/src/components/dnd/examples/examples.module.css +4 -4
- package/src/components/dropdown/COMPONENT.md +1 -1
- package/src/components/dropdown/examples/examples.module.css +1 -1
- package/src/components/empty-page/examples/examples.module.css +1 -1
- package/src/components/example-frame/COMPONENT.md +1 -1
- package/src/components/input/COMPONENT.md +10 -1
- package/src/components/input/examples/password-strength.tsx +12 -0
- package/src/components/kanban/COMPONENT.md +4 -4
- package/src/components/login-form/COMPONENT.md +4 -4
- package/src/components/login-form/examples/register.tsx +2 -2
- package/src/components/login-form/examples/reset-password.tsx +2 -2
- package/src/components/modal/COMPONENT.md +2 -2
- package/src/components/modal/examples/examples.module.css +2 -2
- package/src/components/page-content/examples/examples.module.css +1 -1
- package/src/components/popover/COMPONENT.md +1 -1
- package/src/components/progress-bar/COMPONENT.md +5 -1
- package/src/components/progress-bar/examples/examples.module.css +7 -0
- package/src/components/progress-bar/examples/milestone.tsx +43 -0
- package/src/components/progress-bar/examples/steps.tsx +35 -0
- package/src/components/skeleton/examples/with-crossfade.tsx +3 -3
- package/src/components/sparkline/COMPONENT.md +98 -0
- package/src/components/sparkline/examples/examples.module.css +13 -0
- package/src/components/sparkline/examples/overview.tsx +27 -0
- package/src/components/sparkline/examples/period.tsx +46 -0
- package/src/components/tabs/COMPONENT.md +15 -16
- package/src/components/tabs/examples/examples.module.css +14 -0
- package/src/components/tabs/examples/orientation.tsx +87 -33
- package/src/components/tooltip/COMPONENT.md +8 -6
- package/src/components/tooltip/examples/examples.module.css +2 -2
- package/src/layout/app-header/COMPONENT.md +1 -1
- package/src/layout/app-header/examples/examples.module.css +4 -4
- package/src/layout/app-shell/COMPONENT.md +8 -8
- package/src/layout/app-shell/examples/examples.module.css +3 -3
- package/src/layout/bottom-nav/COMPONENT.md +1 -1
- package/src/layout/bottom-nav/examples/examples.module.css +1 -1
- package/src/layout/sidebar/COMPONENT.md +4 -4
- package/src/layout/sidebar/examples/examples.module.css +5 -5
- package/src/styles/globals.css +125 -2
- package/src/styles/theme-dark.css +36 -13
- package/src/styles/theme-light.css +60 -16
|
@@ -106,6 +106,9 @@ function Spinner({
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
// src/components/button/Button.tsx
|
|
110
|
+
import * as React8 from "react";
|
|
111
|
+
|
|
109
112
|
// src/internal/fieldSurface.module.css
|
|
110
113
|
var fieldSurface_default = {
|
|
111
114
|
surface: "fieldSurface_surface"
|
|
@@ -141,11 +144,152 @@ function iconLayout(children, iconType) {
|
|
|
141
144
|
};
|
|
142
145
|
}
|
|
143
146
|
|
|
144
|
-
// src/internal/
|
|
147
|
+
// src/internal/MorphText.tsx
|
|
145
148
|
import * as React5 from "react";
|
|
146
149
|
|
|
147
|
-
// src/hooks/
|
|
150
|
+
// src/hooks/usePresence.ts
|
|
148
151
|
import * as React4 from "react";
|
|
152
|
+
var DURATION_FALLBACK_MS = {
|
|
153
|
+
fast: 230,
|
|
154
|
+
base: 380,
|
|
155
|
+
slow: 570
|
|
156
|
+
};
|
|
157
|
+
var TIMEOUT_SLACK_MS = 50;
|
|
158
|
+
function prefersReducedMotion() {
|
|
159
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
160
|
+
}
|
|
161
|
+
function parseDurationMs(raw) {
|
|
162
|
+
const value = raw.trim();
|
|
163
|
+
if (value === "") return null;
|
|
164
|
+
const n = Number.parseFloat(value);
|
|
165
|
+
if (Number.isNaN(n)) return null;
|
|
166
|
+
if (value.endsWith("ms")) return n;
|
|
167
|
+
if (value.endsWith("s")) return n * 1e3;
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
function motionDurationMs(token) {
|
|
171
|
+
if (typeof document === "undefined") return DURATION_FALLBACK_MS[token];
|
|
172
|
+
const raw = getComputedStyle(document.documentElement).getPropertyValue(
|
|
173
|
+
`--prime-motion-duration-${token}`
|
|
174
|
+
);
|
|
175
|
+
return parseDurationMs(raw) ?? DURATION_FALLBACK_MS[token];
|
|
176
|
+
}
|
|
177
|
+
function exitTimeoutMs(token) {
|
|
178
|
+
return motionDurationMs(token) + TIMEOUT_SLACK_MS;
|
|
179
|
+
}
|
|
180
|
+
function usePresence(open, options = {}) {
|
|
181
|
+
const { exitDuration = "base" } = options;
|
|
182
|
+
const [mounted, setMounted] = React4.useState(open);
|
|
183
|
+
if (open && !mounted) setMounted(true);
|
|
184
|
+
if (!open && mounted && prefersReducedMotion()) setMounted(false);
|
|
185
|
+
const openRef = React4.useRef(open);
|
|
186
|
+
openRef.current = open;
|
|
187
|
+
React4.useEffect(() => {
|
|
188
|
+
if (open || !mounted) return;
|
|
189
|
+
const id = window.setTimeout(() => setMounted(false), exitTimeoutMs(exitDuration));
|
|
190
|
+
return () => window.clearTimeout(id);
|
|
191
|
+
}, [open, mounted, exitDuration]);
|
|
192
|
+
const onExitEnd = React4.useCallback((event) => {
|
|
193
|
+
if (event.target !== event.currentTarget) return;
|
|
194
|
+
if (!openRef.current) setMounted(false);
|
|
195
|
+
}, []);
|
|
196
|
+
return { mounted: open || mounted, state: open ? "open" : "closed", onExitEnd };
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/internal/MorphText.module.css
|
|
200
|
+
var MorphText_default = {
|
|
201
|
+
root: "MorphText_root",
|
|
202
|
+
morphing: "MorphText_morphing",
|
|
203
|
+
sizer: "MorphText_sizer",
|
|
204
|
+
layer: "MorphText_layer",
|
|
205
|
+
letter: "MorphText_letter",
|
|
206
|
+
letterOut: "MorphText_letterOut",
|
|
207
|
+
primeMorphOut: "MorphText_primeMorphOut",
|
|
208
|
+
letterIn: "MorphText_letterIn",
|
|
209
|
+
primeMorphIn: "MorphText_primeMorphIn"
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/internal/MorphText.tsx
|
|
213
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
214
|
+
function digitsOnly(a, b) {
|
|
215
|
+
return a.replace(/\d/g, "") === b.replace(/\d/g, "");
|
|
216
|
+
}
|
|
217
|
+
function letters(text, kind) {
|
|
218
|
+
return [...text].map((char, i) => /* @__PURE__ */ jsx4(
|
|
219
|
+
"span",
|
|
220
|
+
{
|
|
221
|
+
className: cx(MorphText_default.letter, kind === "in" ? MorphText_default.letterIn : MorphText_default.letterOut),
|
|
222
|
+
style: { "--morph-i": i },
|
|
223
|
+
children: char
|
|
224
|
+
},
|
|
225
|
+
i
|
|
226
|
+
));
|
|
227
|
+
}
|
|
228
|
+
function settleMs(text, root) {
|
|
229
|
+
const css = getComputedStyle(root);
|
|
230
|
+
const read = (name) => Number.parseFloat(css.getPropertyValue(name)) || 0;
|
|
231
|
+
const base = read("--prime-motion-duration-base");
|
|
232
|
+
const step = read("--prime-motion-stagger") / 6;
|
|
233
|
+
return base + step * text.length + 50;
|
|
234
|
+
}
|
|
235
|
+
function MorphText({ children: text, className }) {
|
|
236
|
+
const rootRef = React5.useRef(null);
|
|
237
|
+
const sizerRef = React5.useRef(null);
|
|
238
|
+
const prevText = React5.useRef(null);
|
|
239
|
+
const restWidth = React5.useRef(0);
|
|
240
|
+
const nextId = React5.useRef(0);
|
|
241
|
+
const [morph, setMorph] = React5.useState(null);
|
|
242
|
+
const morphRef = React5.useRef(morph);
|
|
243
|
+
morphRef.current = morph;
|
|
244
|
+
React5.useLayoutEffect(() => {
|
|
245
|
+
const root = rootRef.current;
|
|
246
|
+
const prev = prevText.current;
|
|
247
|
+
prevText.current = text;
|
|
248
|
+
if (!root || prev === null || prev === text) return;
|
|
249
|
+
if (prefersReducedMotion() || digitsOnly(prev, text)) {
|
|
250
|
+
setMorph(null);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const running = morphRef.current;
|
|
254
|
+
const width = running ? root.getBoundingClientRect().width : restWidth.current;
|
|
255
|
+
nextId.current += 1;
|
|
256
|
+
setMorph({ id: nextId.current, from: running ? running.to : prev, to: text, width });
|
|
257
|
+
}, [text]);
|
|
258
|
+
React5.useLayoutEffect(() => {
|
|
259
|
+
if (!morph) return;
|
|
260
|
+
const root = rootRef.current;
|
|
261
|
+
const sizer = sizerRef.current;
|
|
262
|
+
if (!root || !sizer) return;
|
|
263
|
+
const target = sizer.getBoundingClientRect().width;
|
|
264
|
+
if (target !== morph.width) {
|
|
265
|
+
root.style.width = `${morph.width}px`;
|
|
266
|
+
root.getBoundingClientRect();
|
|
267
|
+
root.style.width = `${target}px`;
|
|
268
|
+
}
|
|
269
|
+
const timer = window.setTimeout(() => setMorph(null), settleMs(morph.to, root));
|
|
270
|
+
return () => window.clearTimeout(timer);
|
|
271
|
+
}, [morph]);
|
|
272
|
+
React5.useLayoutEffect(() => {
|
|
273
|
+
if (morph || !rootRef.current) return;
|
|
274
|
+
rootRef.current.style.width = "";
|
|
275
|
+
restWidth.current = rootRef.current.getBoundingClientRect().width;
|
|
276
|
+
});
|
|
277
|
+
if (!morph) {
|
|
278
|
+
return /* @__PURE__ */ jsx4("span", { ref: rootRef, className: cx(MorphText_default.root, className), children: text });
|
|
279
|
+
}
|
|
280
|
+
return /* @__PURE__ */ jsxs2("span", { ref: rootRef, className: cx(MorphText_default.root, MorphText_default.morphing, className), children: [
|
|
281
|
+
/* @__PURE__ */ jsx4("span", { ref: sizerRef, className: MorphText_default.sizer, "aria-hidden": "true", children: morph.to }),
|
|
282
|
+
/* @__PURE__ */ jsx4("span", { className: MorphText_default.layer, "aria-hidden": "true", children: letters(morph.from, "out") }, `out-${morph.id}`),
|
|
283
|
+
/* @__PURE__ */ jsx4("span", { className: MorphText_default.layer, "aria-hidden": "true", children: letters(morph.to, "in") }, `in-${morph.id}`),
|
|
284
|
+
/* @__PURE__ */ jsx4(VisuallyHidden, { children: morph.to })
|
|
285
|
+
] });
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// src/internal/slot.tsx
|
|
289
|
+
import * as React7 from "react";
|
|
290
|
+
|
|
291
|
+
// src/hooks/useMergedRefs.ts
|
|
292
|
+
import * as React6 from "react";
|
|
149
293
|
|
|
150
294
|
// src/internal/mergeRefs.ts
|
|
151
295
|
function mergeRefs(...refs) {
|
|
@@ -163,11 +307,11 @@ function mergeRefs(...refs) {
|
|
|
163
307
|
|
|
164
308
|
// src/hooks/useMergedRefs.ts
|
|
165
309
|
function useMergedRefs(...refs) {
|
|
166
|
-
return
|
|
310
|
+
return React6.useMemo(() => mergeRefs(...refs), refs);
|
|
167
311
|
}
|
|
168
312
|
|
|
169
313
|
// src/internal/slot.tsx
|
|
170
|
-
import { Fragment, jsx as
|
|
314
|
+
import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
|
|
171
315
|
var isPrevented = (event) => typeof event === "object" && event !== null && event.defaultPrevented === true;
|
|
172
316
|
function mergeProps(slotProps, childProps) {
|
|
173
317
|
const merged = { ...slotProps };
|
|
@@ -206,14 +350,14 @@ function blockDisabledClick(event) {
|
|
|
206
350
|
event.stopPropagation();
|
|
207
351
|
}
|
|
208
352
|
function Slot({ children, ref, ...slotProps }) {
|
|
209
|
-
const child =
|
|
353
|
+
const child = React7.isValidElement(children) ? children : null;
|
|
210
354
|
const childRef = child?.props.ref ?? void 0;
|
|
211
355
|
const composedRef = useMergedRefs(ref, childRef);
|
|
212
|
-
if (!child) return /* @__PURE__ */
|
|
356
|
+
if (!child) return /* @__PURE__ */ jsx5(Fragment, { children });
|
|
213
357
|
const merged = mergeProps(slotProps, child.props);
|
|
214
358
|
const disabled = slotProps["aria-disabled"] === true || slotProps["aria-disabled"] === "true";
|
|
215
359
|
if (disabled) merged.onClickCapture = blockDisabledClick;
|
|
216
|
-
return
|
|
360
|
+
return React7.cloneElement(child, { ...merged, ref: composedRef });
|
|
217
361
|
}
|
|
218
362
|
Slot.displayName = "Slot";
|
|
219
363
|
|
|
@@ -231,11 +375,57 @@ var touchTargetBlockClass = touchTarget_default.targetBlock;
|
|
|
231
375
|
var Button_default = {
|
|
232
376
|
root: "Button_root",
|
|
233
377
|
icon: "Button_icon",
|
|
234
|
-
spinner: "Button_spinner"
|
|
378
|
+
spinner: "Button_spinner",
|
|
379
|
+
fillTrack: "Button_fillTrack",
|
|
380
|
+
fill: "Button_fill"
|
|
235
381
|
};
|
|
236
382
|
|
|
237
383
|
// src/components/button/Button.tsx
|
|
238
|
-
import { jsx as
|
|
384
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
385
|
+
var BUTTON_LABELS = { holdHint: "\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0439\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C" };
|
|
386
|
+
var HOLD_MS = 1200;
|
|
387
|
+
function useHoldToConfirm(enabled, onConfirm) {
|
|
388
|
+
const [phase, setPhase] = React8.useState("idle");
|
|
389
|
+
const timer = React8.useRef(void 0);
|
|
390
|
+
const confirm = React8.useRef(onConfirm);
|
|
391
|
+
confirm.current = onConfirm;
|
|
392
|
+
React8.useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
393
|
+
const start = () => {
|
|
394
|
+
if (!enabled || phase === "holding" || phase === "done") return;
|
|
395
|
+
setPhase("holding");
|
|
396
|
+
timer.current = window.setTimeout(() => {
|
|
397
|
+
setPhase("done");
|
|
398
|
+
confirm.current?.();
|
|
399
|
+
}, HOLD_MS);
|
|
400
|
+
};
|
|
401
|
+
const stop = () => {
|
|
402
|
+
window.clearTimeout(timer.current);
|
|
403
|
+
setPhase(
|
|
404
|
+
(current) => current === "holding" ? "cancel" : current === "done" ? "idle" : current
|
|
405
|
+
);
|
|
406
|
+
};
|
|
407
|
+
return { phase, start, stop };
|
|
408
|
+
}
|
|
409
|
+
function morphLabels(children) {
|
|
410
|
+
const out = [];
|
|
411
|
+
let run = null;
|
|
412
|
+
const flush = () => {
|
|
413
|
+
if (run !== null && run !== "") {
|
|
414
|
+
out.push(/* @__PURE__ */ jsx6(MorphText, { children: run }, `label-${out.length}`));
|
|
415
|
+
}
|
|
416
|
+
run = null;
|
|
417
|
+
};
|
|
418
|
+
for (const child of React8.Children.toArray(children)) {
|
|
419
|
+
if (typeof child === "string" || typeof child === "number") {
|
|
420
|
+
run = (run ?? "") + String(child);
|
|
421
|
+
} else {
|
|
422
|
+
flush();
|
|
423
|
+
out.push(child);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
flush();
|
|
427
|
+
return out;
|
|
428
|
+
}
|
|
239
429
|
function ButtonRoot({
|
|
240
430
|
children,
|
|
241
431
|
className,
|
|
@@ -245,6 +435,10 @@ function ButtonRoot({
|
|
|
245
435
|
fullWidth,
|
|
246
436
|
type = "button",
|
|
247
437
|
loading = false,
|
|
438
|
+
progress,
|
|
439
|
+
holdToConfirm = false,
|
|
440
|
+
onConfirm,
|
|
441
|
+
labels,
|
|
248
442
|
disabled,
|
|
249
443
|
asChild = false,
|
|
250
444
|
onClick: onClick2,
|
|
@@ -254,6 +448,11 @@ function ButtonRoot({
|
|
|
254
448
|
const size = useControlSize(sizeProp);
|
|
255
449
|
const isDisabled = disabled || loading;
|
|
256
450
|
const layout = iconLayout(children, ButtonIcon);
|
|
451
|
+
const hold = useHoldToConfirm(holdToConfirm && !isDisabled, onConfirm);
|
|
452
|
+
const hintId = React8.useId();
|
|
453
|
+
const inProgress = progress !== void 0;
|
|
454
|
+
const [fillUsed, setFillUsed] = React8.useState(false);
|
|
455
|
+
if ((inProgress || holdToConfirm) && !fillUsed) setFillUsed(true);
|
|
257
456
|
const dataAttrs = toDataAttributes({
|
|
258
457
|
variant,
|
|
259
458
|
tone,
|
|
@@ -266,11 +465,13 @@ function ButtonRoot({
|
|
|
266
465
|
"leading-icon": layout.leadingIcon || void 0,
|
|
267
466
|
"trailing-icon": layout.trailingIcon || void 0,
|
|
268
467
|
// Without a leading icon the spinner is centered over the hidden label: width stays put.
|
|
269
|
-
"loading-overlay": loading && !asChild && !layout.leadingIcon && !layout.iconOnly || void 0
|
|
468
|
+
"loading-overlay": loading && !asChild && !layout.leadingIcon && !layout.iconOnly || void 0,
|
|
469
|
+
progress: inProgress || void 0,
|
|
470
|
+
hold: holdToConfirm ? hold.phase : void 0
|
|
270
471
|
});
|
|
271
472
|
const classes = cx(fieldTierClass, touchTargetClass, Button_default.root, className);
|
|
272
473
|
if (asChild) {
|
|
273
|
-
return /* @__PURE__ */
|
|
474
|
+
return /* @__PURE__ */ jsx6(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsx6(
|
|
274
475
|
Slot,
|
|
275
476
|
{
|
|
276
477
|
...rest,
|
|
@@ -284,27 +485,89 @@ function ButtonRoot({
|
|
|
284
485
|
}
|
|
285
486
|
) });
|
|
286
487
|
}
|
|
287
|
-
|
|
488
|
+
const {
|
|
489
|
+
onPointerDown: onPointerDown2,
|
|
490
|
+
onPointerUp,
|
|
491
|
+
onPointerLeave,
|
|
492
|
+
onPointerCancel,
|
|
493
|
+
onKeyDown: onKeyDown2,
|
|
494
|
+
onKeyUp,
|
|
495
|
+
onBlur
|
|
496
|
+
} = rest;
|
|
497
|
+
const holdHandlers = holdToConfirm ? {
|
|
498
|
+
onPointerDown: (event) => {
|
|
499
|
+
onPointerDown2?.(event);
|
|
500
|
+
if (event.button === 0) hold.start();
|
|
501
|
+
},
|
|
502
|
+
onPointerUp: (event) => {
|
|
503
|
+
onPointerUp?.(event);
|
|
504
|
+
hold.stop();
|
|
505
|
+
},
|
|
506
|
+
onPointerLeave: (event) => {
|
|
507
|
+
onPointerLeave?.(event);
|
|
508
|
+
hold.stop();
|
|
509
|
+
},
|
|
510
|
+
onPointerCancel: (event) => {
|
|
511
|
+
onPointerCancel?.(event);
|
|
512
|
+
hold.stop();
|
|
513
|
+
},
|
|
514
|
+
onKeyDown: (event) => {
|
|
515
|
+
onKeyDown2?.(event);
|
|
516
|
+
if ((event.key === " " || event.key === "Enter") && !event.repeat) {
|
|
517
|
+
event.preventDefault();
|
|
518
|
+
hold.start();
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
onKeyUp: (event) => {
|
|
522
|
+
onKeyUp?.(event);
|
|
523
|
+
if (event.key === " " || event.key === "Enter") hold.stop();
|
|
524
|
+
},
|
|
525
|
+
onBlur: (event) => {
|
|
526
|
+
onBlur?.(event);
|
|
527
|
+
hold.stop();
|
|
528
|
+
},
|
|
529
|
+
onContextMenu: (event) => {
|
|
530
|
+
rest.onContextMenu?.(event);
|
|
531
|
+
if (hold.phase === "holding" || hold.phase === "done") event.preventDefault();
|
|
532
|
+
}
|
|
533
|
+
} : null;
|
|
534
|
+
const describedBy = holdToConfirm ? cx(rest["aria-describedby"], hintId) || void 0 : rest["aria-describedby"];
|
|
535
|
+
const button = /* @__PURE__ */ jsxs3(
|
|
288
536
|
"button",
|
|
289
537
|
{
|
|
290
538
|
...rest,
|
|
539
|
+
...holdHandlers,
|
|
291
540
|
ref,
|
|
292
541
|
type,
|
|
293
542
|
className: classes,
|
|
294
543
|
disabled: isDisabled,
|
|
295
|
-
"aria-busy": loading || void 0,
|
|
544
|
+
"aria-busy": loading || inProgress || void 0,
|
|
545
|
+
"aria-describedby": describedBy,
|
|
296
546
|
onClick: onClick2,
|
|
547
|
+
style: inProgress || holdToConfirm ? {
|
|
548
|
+
...rest.style,
|
|
549
|
+
"--btn-progress": inProgress ? Math.min(1, Math.max(0, progress)) : void 0,
|
|
550
|
+
"--btn-hold-duration": holdToConfirm ? `${HOLD_MS}ms` : void 0
|
|
551
|
+
} : rest.style,
|
|
297
552
|
...dataAttrs,
|
|
298
|
-
children:
|
|
299
|
-
|
|
300
|
-
children
|
|
301
|
-
|
|
553
|
+
children: [
|
|
554
|
+
fillUsed ? /* @__PURE__ */ jsx6("span", { className: Button_default.fillTrack, "aria-hidden": "true", children: /* @__PURE__ */ jsx6("span", { className: Button_default.fill }) }) : null,
|
|
555
|
+
/* @__PURE__ */ jsxs3(ControlSizeProvider, { value: size, children: [
|
|
556
|
+
loading ? /* @__PURE__ */ jsx6(Spinner, { className: Button_default.spinner, "aria-hidden": "true" }) : null,
|
|
557
|
+
morphLabels(children)
|
|
558
|
+
] })
|
|
559
|
+
]
|
|
302
560
|
}
|
|
303
561
|
);
|
|
562
|
+
if (!holdToConfirm) return button;
|
|
563
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
564
|
+
button,
|
|
565
|
+
/* @__PURE__ */ jsx6(VisuallyHidden, { id: hintId, children: { ...BUTTON_LABELS, ...labels }.holdHint })
|
|
566
|
+
] });
|
|
304
567
|
}
|
|
305
568
|
ButtonRoot.displayName = "Button.Root";
|
|
306
569
|
function ButtonIcon({ children, className, ...rest }) {
|
|
307
|
-
return /* @__PURE__ */
|
|
570
|
+
return /* @__PURE__ */ jsx6("span", { className: cx(Button_default.icon, className), "aria-hidden": "true", ...rest, children });
|
|
308
571
|
}
|
|
309
572
|
ButtonIcon.displayName = "Button.Icon";
|
|
310
573
|
var Button = { Root: ButtonRoot, Icon: ButtonIcon };
|
|
@@ -316,7 +579,7 @@ var Divider_default = {
|
|
|
316
579
|
};
|
|
317
580
|
|
|
318
581
|
// src/components/divider/Divider.tsx
|
|
319
|
-
import { jsx as
|
|
582
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
320
583
|
function Divider({
|
|
321
584
|
orientation = "horizontal",
|
|
322
585
|
align = "center",
|
|
@@ -326,7 +589,7 @@ function Divider({
|
|
|
326
589
|
role = "separator",
|
|
327
590
|
...rest
|
|
328
591
|
}) {
|
|
329
|
-
return /* @__PURE__ */
|
|
592
|
+
return /* @__PURE__ */ jsx7(
|
|
330
593
|
"div",
|
|
331
594
|
{
|
|
332
595
|
...rest,
|
|
@@ -334,7 +597,7 @@ function Divider({
|
|
|
334
597
|
role,
|
|
335
598
|
...orientation === "vertical" ? { "aria-orientation": "vertical" } : {},
|
|
336
599
|
...toDataAttributes({ orientation, align, size }),
|
|
337
|
-
children: children != null ? /* @__PURE__ */
|
|
600
|
+
children: children != null ? /* @__PURE__ */ jsx7(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsx7("span", { className: Divider_default.content, children }) }) : null
|
|
338
601
|
}
|
|
339
602
|
);
|
|
340
603
|
}
|
|
@@ -493,6 +756,8 @@ var iconRegistry = {
|
|
|
493
756
|
"status.locked": Lock,
|
|
494
757
|
"status.offline": CloudOff,
|
|
495
758
|
"status.success": CheckCircle2,
|
|
759
|
+
/** A rising trend; a falling one is the same arrow turned half a turn (it rotates between them). */
|
|
760
|
+
"status.trendUp": ArrowUp,
|
|
496
761
|
"status.warning": AlertTriangle,
|
|
497
762
|
"theme.dark": Moon,
|
|
498
763
|
"theme.light": Sun,
|
|
@@ -504,7 +769,7 @@ var iconRegistry = {
|
|
|
504
769
|
};
|
|
505
770
|
|
|
506
771
|
// src/icons/Icon.tsx
|
|
507
|
-
import { jsx as
|
|
772
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
508
773
|
function IconSvg({
|
|
509
774
|
glyph: GlyphSvg,
|
|
510
775
|
className,
|
|
@@ -514,7 +779,7 @@ function IconSvg({
|
|
|
514
779
|
...rest
|
|
515
780
|
}) {
|
|
516
781
|
const tier = useOptionalControlSize();
|
|
517
|
-
return /* @__PURE__ */
|
|
782
|
+
return /* @__PURE__ */ jsx8(
|
|
518
783
|
GlyphSvg,
|
|
519
784
|
{
|
|
520
785
|
className: cx(Icon_default.root, iconBoxClass(size, tier), textTone_default.tone, className),
|
|
@@ -526,25 +791,25 @@ function IconSvg({
|
|
|
526
791
|
);
|
|
527
792
|
}
|
|
528
793
|
function Icon({ name, ...rest }) {
|
|
529
|
-
return /* @__PURE__ */
|
|
794
|
+
return /* @__PURE__ */ jsx8(IconSvg, { glyph: iconRegistry[name], ...rest });
|
|
530
795
|
}
|
|
531
796
|
function createIcon(glyph) {
|
|
532
797
|
function DomainIcon(props) {
|
|
533
|
-
return /* @__PURE__ */
|
|
798
|
+
return /* @__PURE__ */ jsx8(IconSvg, { glyph, ...props });
|
|
534
799
|
}
|
|
535
800
|
DomainIcon.displayName = `Icon(${glyph.displayName ?? "Glyph"})`;
|
|
536
801
|
return DomainIcon;
|
|
537
802
|
}
|
|
538
803
|
|
|
539
804
|
// src/components/scroll-container/ScrollContainer.tsx
|
|
540
|
-
import * as
|
|
805
|
+
import * as React10 from "react";
|
|
541
806
|
|
|
542
807
|
// src/hooks/useEdgeOverflow.ts
|
|
543
|
-
import * as
|
|
808
|
+
import * as React9 from "react";
|
|
544
809
|
var NONE = { start: false, end: false };
|
|
545
810
|
function useEdgeOverflow(ref, enabled, horizontal) {
|
|
546
|
-
const [overflow, setOverflow] =
|
|
547
|
-
|
|
811
|
+
const [overflow, setOverflow] = React9.useState(NONE);
|
|
812
|
+
React9.useLayoutEffect(() => {
|
|
548
813
|
const node = ref.current;
|
|
549
814
|
if (!enabled || !node) return;
|
|
550
815
|
const update = () => {
|
|
@@ -552,6 +817,8 @@ function useEdgeOverflow(ref, enabled, horizontal) {
|
|
|
552
817
|
const max = horizontal ? node.scrollWidth - node.clientWidth : node.scrollHeight - node.clientHeight;
|
|
553
818
|
const start = position > 1;
|
|
554
819
|
const end = max - position > 1;
|
|
820
|
+
node.style.setProperty("--edge-start", `${Math.max(0, position)}px`);
|
|
821
|
+
node.style.setProperty("--edge-end", `${Math.max(0, max - position)}px`);
|
|
555
822
|
setOverflow((prev) => prev.start === start && prev.end === end ? prev : { start, end });
|
|
556
823
|
};
|
|
557
824
|
let frame = 0;
|
|
@@ -597,7 +864,7 @@ var ScrollContainer_default = {
|
|
|
597
864
|
};
|
|
598
865
|
|
|
599
866
|
// src/components/scroll-container/ScrollContainer.tsx
|
|
600
|
-
import { jsx as
|
|
867
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
601
868
|
var axisClass = {
|
|
602
869
|
vertical: ScrollContainer_default.vertical,
|
|
603
870
|
horizontal: ScrollContainer_default.horizontal,
|
|
@@ -613,11 +880,11 @@ function ScrollContainer({
|
|
|
613
880
|
ref,
|
|
614
881
|
...rest
|
|
615
882
|
}) {
|
|
616
|
-
const innerRef =
|
|
883
|
+
const innerRef = React10.useRef(null);
|
|
617
884
|
const mergedRef = useMergedRefs(innerRef, ref);
|
|
618
885
|
const horizontal = axis === "horizontal";
|
|
619
886
|
const overflow = useEdgeOverflow(innerRef, fade, horizontal);
|
|
620
|
-
return /* @__PURE__ */
|
|
887
|
+
return /* @__PURE__ */ jsx9(
|
|
621
888
|
Component,
|
|
622
889
|
{
|
|
623
890
|
ref: mergedRef,
|
|
@@ -692,9 +959,9 @@ var Hint_default = {
|
|
|
692
959
|
};
|
|
693
960
|
|
|
694
961
|
// src/components/hint/Hint.tsx
|
|
695
|
-
import { jsx as
|
|
962
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
696
963
|
function HintRoot({ className, size = "m", invalid, disabled, children, ...rest }) {
|
|
697
|
-
return /* @__PURE__ */
|
|
964
|
+
return /* @__PURE__ */ jsx10(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsx10(
|
|
698
965
|
"p",
|
|
699
966
|
{
|
|
700
967
|
...rest,
|
|
@@ -710,7 +977,7 @@ function HintRoot({ className, size = "m", invalid, disabled, children, ...rest
|
|
|
710
977
|
}
|
|
711
978
|
HintRoot.displayName = "Hint.Root";
|
|
712
979
|
function HintIcon({ className, ...rest }) {
|
|
713
|
-
return /* @__PURE__ */
|
|
980
|
+
return /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: cx(Hint_default.icon, className), ...rest });
|
|
714
981
|
}
|
|
715
982
|
HintIcon.displayName = "Hint.Icon";
|
|
716
983
|
var Hint = { Root: HintRoot, Icon: HintIcon };
|
|
@@ -725,7 +992,7 @@ var Label_default = {
|
|
|
725
992
|
};
|
|
726
993
|
|
|
727
994
|
// src/components/label/Label.tsx
|
|
728
|
-
import { jsx as
|
|
995
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
729
996
|
var LABEL_LABELS = { optional: "\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E" };
|
|
730
997
|
function LabelRoot({
|
|
731
998
|
className,
|
|
@@ -741,7 +1008,7 @@ function LabelRoot({
|
|
|
741
1008
|
const size = useControlSize(sizeProp);
|
|
742
1009
|
return (
|
|
743
1010
|
// biome-ignore lint/a11y/noLabelWithoutControl: field label primitive; association via htmlFor or wrapping control is caller responsibility
|
|
744
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ jsx11(
|
|
745
1012
|
"label",
|
|
746
1013
|
{
|
|
747
1014
|
ref,
|
|
@@ -749,10 +1016,10 @@ function LabelRoot({
|
|
|
749
1016
|
"aria-disabled": disabled || void 0,
|
|
750
1017
|
...rest,
|
|
751
1018
|
...toDataAttributes({ disabled: disabled || void 0, size }),
|
|
752
|
-
children: /* @__PURE__ */
|
|
1019
|
+
children: /* @__PURE__ */ jsxs4(ControlSizeProvider, { value: size, children: [
|
|
753
1020
|
children,
|
|
754
|
-
required ? /* @__PURE__ */
|
|
755
|
-
optional ? /* @__PURE__ */
|
|
1021
|
+
required ? /* @__PURE__ */ jsx11("span", { className: Label_default.asterisk, "aria-hidden": "true", children: "*" }) : null,
|
|
1022
|
+
optional ? /* @__PURE__ */ jsx11("span", { className: Label_default.optional, children: labels?.optional ?? LABEL_LABELS.optional }) : null
|
|
756
1023
|
] })
|
|
757
1024
|
}
|
|
758
1025
|
)
|
|
@@ -760,11 +1027,11 @@ function LabelRoot({
|
|
|
760
1027
|
}
|
|
761
1028
|
LabelRoot.displayName = "Label.Root";
|
|
762
1029
|
function LabelIcon({ className, ...rest }) {
|
|
763
|
-
return /* @__PURE__ */
|
|
1030
|
+
return /* @__PURE__ */ jsx11("span", { className: cx(Label_default.icon, className), "aria-hidden": "true", ...rest });
|
|
764
1031
|
}
|
|
765
1032
|
LabelIcon.displayName = "Label.Icon";
|
|
766
1033
|
function LabelDescription({ className, ...rest }) {
|
|
767
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ jsx11("span", { className: cx(Label_default.description, className), ...rest });
|
|
768
1035
|
}
|
|
769
1036
|
LabelDescription.displayName = "Label.Description";
|
|
770
1037
|
var Label = {
|
|
@@ -774,21 +1041,21 @@ var Label = {
|
|
|
774
1041
|
};
|
|
775
1042
|
|
|
776
1043
|
// src/components/checkbox/Checkbox.tsx
|
|
777
|
-
import * as
|
|
1044
|
+
import * as React13 from "react";
|
|
778
1045
|
|
|
779
1046
|
// src/hooks/useControllableState.ts
|
|
780
|
-
import * as
|
|
1047
|
+
import * as React11 from "react";
|
|
781
1048
|
function useControllableState({
|
|
782
1049
|
value,
|
|
783
1050
|
defaultValue,
|
|
784
1051
|
onChange
|
|
785
1052
|
}) {
|
|
786
|
-
const [internalValue, setInternalValue] =
|
|
1053
|
+
const [internalValue, setInternalValue] = React11.useState(defaultValue);
|
|
787
1054
|
const isControlled = value !== void 0;
|
|
788
1055
|
const currentValue = isControlled ? value : internalValue;
|
|
789
|
-
const currentValueRef =
|
|
1056
|
+
const currentValueRef = React11.useRef(currentValue);
|
|
790
1057
|
currentValueRef.current = currentValue;
|
|
791
|
-
const setValue =
|
|
1058
|
+
const setValue = React11.useCallback(
|
|
792
1059
|
(nextValue) => {
|
|
793
1060
|
const previousValue = currentValueRef.current;
|
|
794
1061
|
const computedValue = typeof nextValue === "function" ? nextValue(previousValue) : nextValue;
|
|
@@ -806,6 +1073,32 @@ function useControllableState({
|
|
|
806
1073
|
return [currentValue, setValue];
|
|
807
1074
|
}
|
|
808
1075
|
|
|
1076
|
+
// src/internal/CheckMark.module.css
|
|
1077
|
+
var CheckMark_default = {
|
|
1078
|
+
svg: "CheckMark_svg",
|
|
1079
|
+
check: "CheckMark_check",
|
|
1080
|
+
bar: "CheckMark_bar"
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
// src/internal/CheckMark.tsx
|
|
1084
|
+
import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1085
|
+
function CheckMark({ state, className }) {
|
|
1086
|
+
return /* @__PURE__ */ jsxs5(
|
|
1087
|
+
"svg",
|
|
1088
|
+
{
|
|
1089
|
+
viewBox: "0 0 24 24",
|
|
1090
|
+
className: cx(CheckMark_default.svg, className),
|
|
1091
|
+
"data-state": state,
|
|
1092
|
+
"aria-hidden": "true",
|
|
1093
|
+
focusable: "false",
|
|
1094
|
+
children: [
|
|
1095
|
+
/* @__PURE__ */ jsx12("path", { d: "M5.5 12.5l4.25 4.25L18.5 8", pathLength: 1, className: CheckMark_default.check }),
|
|
1096
|
+
/* @__PURE__ */ jsx12("path", { d: "M7 12h10", pathLength: 1, className: CheckMark_default.bar })
|
|
1097
|
+
]
|
|
1098
|
+
}
|
|
1099
|
+
);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
809
1102
|
// src/internal/ChoiceField.module.css
|
|
810
1103
|
var ChoiceField_default = {
|
|
811
1104
|
tier: "ChoiceField_tier",
|
|
@@ -819,7 +1112,7 @@ var ChoiceField_default = {
|
|
|
819
1112
|
};
|
|
820
1113
|
|
|
821
1114
|
// src/internal/ChoiceField.tsx
|
|
822
|
-
import { jsx as
|
|
1115
|
+
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
823
1116
|
var choiceInputClass = ChoiceField_default.input;
|
|
824
1117
|
var choiceVisualClass = ChoiceField_default.visual;
|
|
825
1118
|
var choiceTierClass = ChoiceField_default.tier;
|
|
@@ -835,7 +1128,7 @@ function ChoiceField({
|
|
|
835
1128
|
className,
|
|
836
1129
|
children
|
|
837
1130
|
}) {
|
|
838
|
-
return /* @__PURE__ */
|
|
1131
|
+
return /* @__PURE__ */ jsx13(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsxs6(
|
|
839
1132
|
"div",
|
|
840
1133
|
{
|
|
841
1134
|
className: cx(ChoiceField_default.tier, ChoiceField_default.field, className),
|
|
@@ -847,21 +1140,21 @@ function ChoiceField({
|
|
|
847
1140
|
readonly: readOnly || void 0
|
|
848
1141
|
}),
|
|
849
1142
|
children: [
|
|
850
|
-
/* @__PURE__ */
|
|
851
|
-
/* @__PURE__ */
|
|
1143
|
+
/* @__PURE__ */ jsxs6("label", { htmlFor: ids.controlId, className: ChoiceField_default.row, children: [
|
|
1144
|
+
/* @__PURE__ */ jsx13("span", { className: cx(ChoiceField_default.controlCell, touchTargetClass), children: control }),
|
|
852
1145
|
children
|
|
853
1146
|
] }),
|
|
854
|
-
ids.showError ? /* @__PURE__ */
|
|
1147
|
+
ids.showError ? /* @__PURE__ */ jsx13(Hint.Root, { id: ids.errorId, size, invalid: true, className: ChoiceField_default.support, children: error }) : ids.showHint ? /* @__PURE__ */ jsx13(Hint.Root, { id: ids.hintId, size, disabled, className: ChoiceField_default.support, children: hint }) : null
|
|
855
1148
|
]
|
|
856
1149
|
}
|
|
857
1150
|
) });
|
|
858
1151
|
}
|
|
859
1152
|
function ChoiceLabel({ className, ...rest }) {
|
|
860
|
-
return /* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ jsx13("span", { className: cx(ChoiceField_default.text, className), ...rest });
|
|
861
1154
|
}
|
|
862
1155
|
|
|
863
1156
|
// src/internal/FieldFrame.tsx
|
|
864
|
-
import * as
|
|
1157
|
+
import * as React12 from "react";
|
|
865
1158
|
|
|
866
1159
|
// src/internal/formatLabel.ts
|
|
867
1160
|
function formatLabel(template, values) {
|
|
@@ -871,6 +1164,31 @@ function formatLabel(template, values) {
|
|
|
871
1164
|
).trim();
|
|
872
1165
|
}
|
|
873
1166
|
|
|
1167
|
+
// src/internal/RollingNumber.module.css
|
|
1168
|
+
var RollingNumber_default = {
|
|
1169
|
+
root: "RollingNumber_root",
|
|
1170
|
+
digit: "RollingNumber_digit",
|
|
1171
|
+
char: "RollingNumber_char"
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
// src/internal/RollingNumber.tsx
|
|
1175
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1176
|
+
function RollingNumber({ children, className }) {
|
|
1177
|
+
const chars = [...String(children)];
|
|
1178
|
+
return /* @__PURE__ */ jsx14("span", { className: cx(RollingNumber_default.root, className), children: chars.map((char, i) => {
|
|
1179
|
+
const key = chars.length - i;
|
|
1180
|
+
return /\d/.test(char) ? /* @__PURE__ */ jsx14(
|
|
1181
|
+
"span",
|
|
1182
|
+
{
|
|
1183
|
+
className: RollingNumber_default.digit,
|
|
1184
|
+
style: { "--rolling-n": char },
|
|
1185
|
+
children: char
|
|
1186
|
+
},
|
|
1187
|
+
`d${key}`
|
|
1188
|
+
) : /* @__PURE__ */ jsx14("span", { className: RollingNumber_default.char, children: char }, `c${key}`);
|
|
1189
|
+
}) });
|
|
1190
|
+
}
|
|
1191
|
+
|
|
874
1192
|
// src/internal/FieldFrame.module.css
|
|
875
1193
|
var FieldFrame_default = {
|
|
876
1194
|
root: "FieldFrame_root",
|
|
@@ -884,7 +1202,7 @@ var FieldFrame_default = {
|
|
|
884
1202
|
};
|
|
885
1203
|
|
|
886
1204
|
// src/internal/FieldFrame.tsx
|
|
887
|
-
import { jsx as
|
|
1205
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
888
1206
|
function hasContent(node) {
|
|
889
1207
|
return node != null && node !== false && node !== "";
|
|
890
1208
|
}
|
|
@@ -894,7 +1212,7 @@ function useFieldFrame(explicitId, {
|
|
|
894
1212
|
error,
|
|
895
1213
|
invalid
|
|
896
1214
|
}, ariaDescribedBy) {
|
|
897
|
-
const generated =
|
|
1215
|
+
const generated = React12.useId();
|
|
898
1216
|
const controlId = explicitId ?? generated;
|
|
899
1217
|
const labelId = `${controlId}-label`;
|
|
900
1218
|
const hintId = `${controlId}-hint`;
|
|
@@ -934,7 +1252,7 @@ function FieldFrame({
|
|
|
934
1252
|
}) {
|
|
935
1253
|
const { showError, showHint } = ids;
|
|
936
1254
|
const showSupport = showError || showHint || counter != null || reserveSupportRow;
|
|
937
|
-
const labelNode = hasContent(label) ? /* @__PURE__ */
|
|
1255
|
+
const labelNode = hasContent(label) ? /* @__PURE__ */ jsx15(
|
|
938
1256
|
Label.Root,
|
|
939
1257
|
{
|
|
940
1258
|
id: ids.labelId,
|
|
@@ -948,7 +1266,7 @@ function FieldFrame({
|
|
|
948
1266
|
children: label
|
|
949
1267
|
}
|
|
950
1268
|
) : null;
|
|
951
|
-
return /* @__PURE__ */
|
|
1269
|
+
return /* @__PURE__ */ jsxs7(
|
|
952
1270
|
"div",
|
|
953
1271
|
{
|
|
954
1272
|
...rest,
|
|
@@ -959,19 +1277,19 @@ function FieldFrame({
|
|
|
959
1277
|
disabled: disabled || void 0
|
|
960
1278
|
}),
|
|
961
1279
|
children: [
|
|
962
|
-
labelEnd != null ? /* @__PURE__ */
|
|
1280
|
+
labelEnd != null ? /* @__PURE__ */ jsxs7("div", { className: FieldFrame_default.labelRow, children: [
|
|
963
1281
|
labelNode,
|
|
964
|
-
/* @__PURE__ */
|
|
1282
|
+
/* @__PURE__ */ jsx15("span", { className: FieldFrame_default.labelEnd, children: labelEnd })
|
|
965
1283
|
] }) : labelNode,
|
|
966
|
-
/* @__PURE__ */
|
|
1284
|
+
/* @__PURE__ */ jsxs7("div", { className: FieldFrame_default.body, children: [
|
|
967
1285
|
children,
|
|
968
|
-
showSupport ? /* @__PURE__ */
|
|
1286
|
+
showSupport ? /* @__PURE__ */ jsxs7(
|
|
969
1287
|
"div",
|
|
970
1288
|
{
|
|
971
1289
|
className: FieldFrame_default.support,
|
|
972
1290
|
...toDataAttributes({ size, reserve: reserveSupportRow || void 0 }),
|
|
973
1291
|
children: [
|
|
974
|
-
showError ? /* @__PURE__ */
|
|
1292
|
+
showError ? /* @__PURE__ */ jsx15(Hint.Root, { id: ids.errorId, size, invalid: true, className: FieldFrame_default.supportText, children: error }) : showHint ? /* @__PURE__ */ jsx15(
|
|
975
1293
|
Hint.Root,
|
|
976
1294
|
{
|
|
977
1295
|
id: ids.hintId,
|
|
@@ -980,7 +1298,7 @@ function FieldFrame({
|
|
|
980
1298
|
className: FieldFrame_default.supportText,
|
|
981
1299
|
children: hint
|
|
982
1300
|
}
|
|
983
|
-
) : /* @__PURE__ */
|
|
1301
|
+
) : /* @__PURE__ */ jsx15("span", { className: FieldFrame_default.supportText }),
|
|
984
1302
|
counter
|
|
985
1303
|
]
|
|
986
1304
|
}
|
|
@@ -991,7 +1309,7 @@ function FieldFrame({
|
|
|
991
1309
|
);
|
|
992
1310
|
}
|
|
993
1311
|
function FieldCounter({ current, max, size, label, className, ...rest }) {
|
|
994
|
-
return /* @__PURE__ */
|
|
1312
|
+
return /* @__PURE__ */ jsxs7(
|
|
995
1313
|
"span",
|
|
996
1314
|
{
|
|
997
1315
|
...rest,
|
|
@@ -1000,12 +1318,12 @@ function FieldCounter({ current, max, size, label, className, ...rest }) {
|
|
|
1000
1318
|
"data-invalid": current > max || void 0,
|
|
1001
1319
|
"aria-live": "polite",
|
|
1002
1320
|
children: [
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
current,
|
|
1321
|
+
/* @__PURE__ */ jsxs7("span", { "aria-hidden": "true", children: [
|
|
1322
|
+
/* @__PURE__ */ jsx15(RollingNumber, { children: current }),
|
|
1005
1323
|
"/",
|
|
1006
1324
|
max
|
|
1007
1325
|
] }),
|
|
1008
|
-
/* @__PURE__ */
|
|
1326
|
+
/* @__PURE__ */ jsx15(VisuallyHidden, { children: formatLabel(label, { current, max }) })
|
|
1009
1327
|
]
|
|
1010
1328
|
}
|
|
1011
1329
|
);
|
|
@@ -1015,20 +1333,11 @@ function FieldCounter({ current, max, size, label, className, ...rest }) {
|
|
|
1015
1333
|
var Checkbox_default = {
|
|
1016
1334
|
root: "Checkbox_root",
|
|
1017
1335
|
indicator: "Checkbox_indicator",
|
|
1018
|
-
control: "Checkbox_control"
|
|
1019
|
-
svg: "Checkbox_svg",
|
|
1020
|
-
checkPath: "Checkbox_checkPath",
|
|
1021
|
-
indeterminateLine: "Checkbox_indeterminateLine"
|
|
1336
|
+
control: "Checkbox_control"
|
|
1022
1337
|
};
|
|
1023
1338
|
|
|
1024
1339
|
// src/components/checkbox/Checkbox.tsx
|
|
1025
|
-
import { Fragment as
|
|
1026
|
-
function CheckboxMark() {
|
|
1027
|
-
return /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 24 24", className: Checkbox_default.svg, "aria-hidden": "true", focusable: "false", children: [
|
|
1028
|
-
/* @__PURE__ */ jsx13("path", { d: "M5.5 12.5l4.25 4.25L18.5 8", pathLength: 1, className: Checkbox_default.checkPath }),
|
|
1029
|
-
/* @__PURE__ */ jsx13("path", { d: "M7 12h10", pathLength: 1, className: Checkbox_default.indeterminateLine })
|
|
1030
|
-
] });
|
|
1031
|
-
}
|
|
1340
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1032
1341
|
function CheckboxRoot({
|
|
1033
1342
|
id,
|
|
1034
1343
|
checked: checkedProp,
|
|
@@ -1054,12 +1363,12 @@ function CheckboxRoot({
|
|
|
1054
1363
|
defaultValue: defaultChecked,
|
|
1055
1364
|
onChange: onCheckedChange
|
|
1056
1365
|
});
|
|
1057
|
-
const internalRef =
|
|
1366
|
+
const internalRef = React13.useRef(null);
|
|
1058
1367
|
const mergedRef = useMergedRefs(internalRef, ref);
|
|
1059
|
-
|
|
1368
|
+
React13.useEffect(() => {
|
|
1060
1369
|
if (internalRef.current) internalRef.current.indeterminate = indeterminate;
|
|
1061
1370
|
}, [indeterminate]);
|
|
1062
|
-
return /* @__PURE__ */
|
|
1371
|
+
return /* @__PURE__ */ jsx16(
|
|
1063
1372
|
ChoiceField,
|
|
1064
1373
|
{
|
|
1065
1374
|
ids,
|
|
@@ -1070,8 +1379,8 @@ function CheckboxRoot({
|
|
|
1070
1379
|
hint,
|
|
1071
1380
|
error,
|
|
1072
1381
|
className: cx(Checkbox_default.root, className),
|
|
1073
|
-
control: /* @__PURE__ */
|
|
1074
|
-
/* @__PURE__ */
|
|
1382
|
+
control: /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1383
|
+
/* @__PURE__ */ jsx16(
|
|
1075
1384
|
"input",
|
|
1076
1385
|
{
|
|
1077
1386
|
...inputRest,
|
|
@@ -1089,7 +1398,12 @@ function CheckboxRoot({
|
|
|
1089
1398
|
"aria-describedby": ids.describedBy
|
|
1090
1399
|
}
|
|
1091
1400
|
),
|
|
1092
|
-
/* @__PURE__ */
|
|
1401
|
+
/* @__PURE__ */ jsx16("span", { className: cx(choiceVisualClass, Checkbox_default.control), "aria-hidden": "true", children: /* @__PURE__ */ jsx16(
|
|
1402
|
+
CheckMark,
|
|
1403
|
+
{
|
|
1404
|
+
state: indeterminate ? "indeterminate" : checked ? "checked" : "unchecked"
|
|
1405
|
+
}
|
|
1406
|
+
) })
|
|
1093
1407
|
] }),
|
|
1094
1408
|
children
|
|
1095
1409
|
}
|
|
@@ -1097,7 +1411,7 @@ function CheckboxRoot({
|
|
|
1097
1411
|
}
|
|
1098
1412
|
CheckboxRoot.displayName = "Checkbox.Root";
|
|
1099
1413
|
function CheckboxLabel(props) {
|
|
1100
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ jsx16(ChoiceLabel, { ...props });
|
|
1101
1415
|
}
|
|
1102
1416
|
CheckboxLabel.displayName = "Checkbox.Label";
|
|
1103
1417
|
function CheckboxIndicator({
|
|
@@ -1109,7 +1423,7 @@ function CheckboxIndicator({
|
|
|
1109
1423
|
...rest
|
|
1110
1424
|
}) {
|
|
1111
1425
|
const size = useControlSize(sizeProp);
|
|
1112
|
-
return /* @__PURE__ */
|
|
1426
|
+
return /* @__PURE__ */ jsx16(
|
|
1113
1427
|
"span",
|
|
1114
1428
|
{
|
|
1115
1429
|
"aria-hidden": "true",
|
|
@@ -1126,7 +1440,7 @@ function CheckboxIndicator({
|
|
|
1126
1440
|
disabled: disabled || void 0
|
|
1127
1441
|
}),
|
|
1128
1442
|
...rest,
|
|
1129
|
-
children: /* @__PURE__ */
|
|
1443
|
+
children: /* @__PURE__ */ jsx16(CheckMark, { state: indeterminate ? "indeterminate" : checked ? "checked" : "unchecked" })
|
|
1130
1444
|
}
|
|
1131
1445
|
);
|
|
1132
1446
|
}
|
|
@@ -1138,7 +1452,7 @@ var Checkbox = {
|
|
|
1138
1452
|
};
|
|
1139
1453
|
|
|
1140
1454
|
// src/internal/swatch.tsx
|
|
1141
|
-
import * as
|
|
1455
|
+
import * as React14 from "react";
|
|
1142
1456
|
|
|
1143
1457
|
// src/internal/swatch.module.css
|
|
1144
1458
|
var swatch_default = {
|
|
@@ -1151,7 +1465,7 @@ var swatch_default = {
|
|
|
1151
1465
|
};
|
|
1152
1466
|
|
|
1153
1467
|
// src/internal/swatch.tsx
|
|
1154
|
-
import { Fragment as
|
|
1468
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1155
1469
|
var COLOR_PRESETS = [
|
|
1156
1470
|
{ value: "#ef4444", label: "\u041A\u0440\u0430\u0441\u043D\u044B\u0439" },
|
|
1157
1471
|
{ value: "#f97316", label: "\u041E\u0440\u0430\u043D\u0436\u0435\u0432\u044B\u0439" },
|
|
@@ -1171,7 +1485,7 @@ var COLOR_PRESETS = [
|
|
|
1171
1485
|
{ value: "#be185d", label: "\u0422\u0451\u043C\u043D\u043E-\u0440\u043E\u0437\u043E\u0432\u044B\u0439" }
|
|
1172
1486
|
];
|
|
1173
1487
|
function useSwatchOptions(presets, allowEmpty, emptyLabel) {
|
|
1174
|
-
return
|
|
1488
|
+
return React14.useMemo(
|
|
1175
1489
|
() => [
|
|
1176
1490
|
...presets.map((preset) => ({ ...preset, contrast: markContrast(preset.value) })),
|
|
1177
1491
|
...allowEmpty ? [{ value: null, label: emptyLabel, contrast: "dark" }] : []
|
|
@@ -1182,17 +1496,17 @@ function useSwatchOptions(presets, allowEmpty, emptyLabel) {
|
|
|
1182
1496
|
var swatchClass = swatch_default.swatch;
|
|
1183
1497
|
var swatchTierClass = swatch_default.tier;
|
|
1184
1498
|
function SwatchFill({ value }) {
|
|
1185
|
-
if (value == null) return /* @__PURE__ */
|
|
1186
|
-
return /* @__PURE__ */
|
|
1499
|
+
if (value == null) return /* @__PURE__ */ jsx17("span", { "aria-hidden": true, className: swatch_default.checker });
|
|
1500
|
+
return /* @__PURE__ */ jsx17("svg", { className: swatch_default.fill, "aria-hidden": "true", viewBox: "0 0 1 1", preserveAspectRatio: "none", children: /* @__PURE__ */ jsx17("rect", { width: "1", height: "1", fill: value }) });
|
|
1187
1501
|
}
|
|
1188
1502
|
function SwatchContent({ value, selected }) {
|
|
1189
|
-
return /* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
|
|
1503
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1504
|
+
/* @__PURE__ */ jsx17(SwatchFill, { value }),
|
|
1505
|
+
/* @__PURE__ */ jsx17(CheckMark, { state: selected ? "checked" : "unchecked", className: swatch_default.check })
|
|
1192
1506
|
] });
|
|
1193
1507
|
}
|
|
1194
1508
|
function SwatchChip({ value, className, ...rest }) {
|
|
1195
|
-
return /* @__PURE__ */
|
|
1509
|
+
return /* @__PURE__ */ jsx17("span", { ...rest, "aria-hidden": true, className: cx(swatch_default.chip, className), children: /* @__PURE__ */ jsx17(SwatchFill, { value }) });
|
|
1196
1510
|
}
|
|
1197
1511
|
function sameColor(a, b) {
|
|
1198
1512
|
return (a ?? "").trim().toLowerCase() === (b ?? "").trim().toLowerCase();
|
|
@@ -1236,7 +1550,7 @@ function markContrast(value) {
|
|
|
1236
1550
|
}
|
|
1237
1551
|
|
|
1238
1552
|
// src/components/color-swatches/ColorSwatches.tsx
|
|
1239
|
-
import * as
|
|
1553
|
+
import * as React15 from "react";
|
|
1240
1554
|
|
|
1241
1555
|
// src/internal/rovingFocus.ts
|
|
1242
1556
|
var PREV = {
|
|
@@ -1285,7 +1599,7 @@ var ColorSwatches_default = {
|
|
|
1285
1599
|
};
|
|
1286
1600
|
|
|
1287
1601
|
// src/components/color-swatches/ColorSwatches.tsx
|
|
1288
|
-
import { jsx as
|
|
1602
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1289
1603
|
var COLOR_SWATCHES_LABELS = {
|
|
1290
1604
|
group: "\u0426\u0432\u0435\u0442",
|
|
1291
1605
|
empty: "\u0411\u0435\u0437 \u0446\u0432\u0435\u0442\u0430",
|
|
@@ -1330,7 +1644,7 @@ function ColorSwatches({
|
|
|
1330
1644
|
const options = useSwatchOptions(presets, allowEmpty, labels.empty);
|
|
1331
1645
|
const selectedIndex = options.findIndex((option) => sameColor(option.value, value));
|
|
1332
1646
|
const focusIndex = Math.max(0, selectedIndex);
|
|
1333
|
-
const itemRefs =
|
|
1647
|
+
const itemRefs = React15.useRef([]);
|
|
1334
1648
|
const labelledBy = ariaLabelledBy ?? ids.labelledBy;
|
|
1335
1649
|
const onKeyDown2 = (event) => {
|
|
1336
1650
|
const current = itemRefs.current.indexOf(document.activeElement);
|
|
@@ -1345,7 +1659,7 @@ function ColorSwatches({
|
|
|
1345
1659
|
setValue(options[next].value);
|
|
1346
1660
|
itemRefs.current[next]?.focus();
|
|
1347
1661
|
};
|
|
1348
|
-
return /* @__PURE__ */
|
|
1662
|
+
return /* @__PURE__ */ jsx18(
|
|
1349
1663
|
FieldFrame,
|
|
1350
1664
|
{
|
|
1351
1665
|
...rest,
|
|
@@ -1360,7 +1674,7 @@ function ColorSwatches({
|
|
|
1360
1674
|
optionalLabel: labels.optional,
|
|
1361
1675
|
group: true,
|
|
1362
1676
|
className,
|
|
1363
|
-
children: /* @__PURE__ */
|
|
1677
|
+
children: /* @__PURE__ */ jsxs10(
|
|
1364
1678
|
"div",
|
|
1365
1679
|
{
|
|
1366
1680
|
id: ids.controlId,
|
|
@@ -1382,7 +1696,7 @@ function ColorSwatches({
|
|
|
1382
1696
|
const selected = index === selectedIndex;
|
|
1383
1697
|
return (
|
|
1384
1698
|
// biome-ignore lint/a11y/useSemanticElements: a swatch is a styled button in a roving radiogroup; a native radio cannot carry the color fill and check mark
|
|
1385
|
-
/* @__PURE__ */
|
|
1699
|
+
/* @__PURE__ */ jsx18(
|
|
1386
1700
|
"button",
|
|
1387
1701
|
{
|
|
1388
1702
|
ref: (el) => {
|
|
@@ -1401,13 +1715,13 @@ function ColorSwatches({
|
|
|
1401
1715
|
contrast: option.contrast
|
|
1402
1716
|
}),
|
|
1403
1717
|
onClick: () => setValue(option.value),
|
|
1404
|
-
children: /* @__PURE__ */
|
|
1718
|
+
children: /* @__PURE__ */ jsx18(SwatchContent, { value: option.value, selected })
|
|
1405
1719
|
},
|
|
1406
1720
|
option.value ?? "empty"
|
|
1407
1721
|
)
|
|
1408
1722
|
);
|
|
1409
1723
|
}),
|
|
1410
|
-
name ? /* @__PURE__ */
|
|
1724
|
+
name ? /* @__PURE__ */ jsx18("input", { type: "hidden", name, value: value ?? "" }) : null
|
|
1411
1725
|
]
|
|
1412
1726
|
}
|
|
1413
1727
|
)
|
|
@@ -1425,7 +1739,7 @@ var EmptyPage_default = {
|
|
|
1425
1739
|
};
|
|
1426
1740
|
|
|
1427
1741
|
// src/components/empty-page/EmptyPage.tsx
|
|
1428
|
-
import { jsx as
|
|
1742
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1429
1743
|
function EmptyPageRoot({
|
|
1430
1744
|
size = "m",
|
|
1431
1745
|
layout = "default",
|
|
@@ -1433,31 +1747,31 @@ function EmptyPageRoot({
|
|
|
1433
1747
|
children,
|
|
1434
1748
|
...rest
|
|
1435
1749
|
}) {
|
|
1436
|
-
return /* @__PURE__ */
|
|
1750
|
+
return /* @__PURE__ */ jsx19(
|
|
1437
1751
|
"div",
|
|
1438
1752
|
{
|
|
1439
1753
|
className: cx(EmptyPage_default.root, layout !== "compact" && enterMotion_default.enterBaseChildren, className),
|
|
1440
1754
|
...rest,
|
|
1441
1755
|
...toDataAttributes({ size, layout: layout === "default" ? void 0 : layout }),
|
|
1442
|
-
children: /* @__PURE__ */
|
|
1756
|
+
children: /* @__PURE__ */ jsx19(ControlSizeProvider, { value: size, children })
|
|
1443
1757
|
}
|
|
1444
1758
|
);
|
|
1445
1759
|
}
|
|
1446
1760
|
EmptyPageRoot.displayName = "EmptyPage.Root";
|
|
1447
1761
|
function EmptyPageIcon({ tone = "neutral", className, ...rest }) {
|
|
1448
|
-
return /* @__PURE__ */
|
|
1762
|
+
return /* @__PURE__ */ jsx19("div", { className: cx(EmptyPage_default.iconWrap, className), "data-tone": tone, ...rest });
|
|
1449
1763
|
}
|
|
1450
1764
|
EmptyPageIcon.displayName = "EmptyPage.Icon";
|
|
1451
1765
|
function EmptyPageTitle({ as: Tag = "h2", className, ref, ...rest }) {
|
|
1452
|
-
return /* @__PURE__ */
|
|
1766
|
+
return /* @__PURE__ */ jsx19(Tag, { ref, className: cx(EmptyPage_default.title, className), ...rest });
|
|
1453
1767
|
}
|
|
1454
1768
|
EmptyPageTitle.displayName = "EmptyPage.Title";
|
|
1455
1769
|
function EmptyPageDescription({ className, ...rest }) {
|
|
1456
|
-
return /* @__PURE__ */
|
|
1770
|
+
return /* @__PURE__ */ jsx19("p", { className: cx(EmptyPage_default.description, className), ...rest });
|
|
1457
1771
|
}
|
|
1458
1772
|
EmptyPageDescription.displayName = "EmptyPage.Description";
|
|
1459
1773
|
function EmptyPageActions({ className, ...rest }) {
|
|
1460
|
-
return /* @__PURE__ */
|
|
1774
|
+
return /* @__PURE__ */ jsx19("div", { className: cx(EmptyPage_default.actions, className), ...rest });
|
|
1461
1775
|
}
|
|
1462
1776
|
EmptyPageActions.displayName = "EmptyPage.Actions";
|
|
1463
1777
|
var EmptyPage = {
|
|
@@ -1468,16 +1782,208 @@ var EmptyPage = {
|
|
|
1468
1782
|
Actions: EmptyPageActions
|
|
1469
1783
|
};
|
|
1470
1784
|
|
|
1785
|
+
// src/components/progress-bar/ProgressBar.tsx
|
|
1786
|
+
import * as React16 from "react";
|
|
1787
|
+
|
|
1788
|
+
// src/internal/progressSegments.ts
|
|
1789
|
+
function resolveValue(value, max) {
|
|
1790
|
+
const top = max !== void 0 && max > 0 ? max : 100;
|
|
1791
|
+
const clamped = Math.min(top, Math.max(Number.isFinite(value) ? value : 0, 0));
|
|
1792
|
+
return {
|
|
1793
|
+
value: clamped,
|
|
1794
|
+
max: top,
|
|
1795
|
+
ratio: clamped / top,
|
|
1796
|
+
percent: Math.round(clamped / top * 100)
|
|
1797
|
+
};
|
|
1798
|
+
}
|
|
1799
|
+
var DEFAULT_PROGRESS_SEGMENTS_LABELS = {
|
|
1800
|
+
empty: "\u041D\u0435\u0442 \u0441\u0435\u0433\u043C\u0435\u043D\u0442\u043E\u0432",
|
|
1801
|
+
allEmpty: "\u0412\u0441\u0435 \u0441\u0435\u0433\u043C\u0435\u043D\u0442\u044B \u043F\u0443\u0441\u0442\u044B"
|
|
1802
|
+
};
|
|
1803
|
+
function nonNegative(n) {
|
|
1804
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
1805
|
+
}
|
|
1806
|
+
function resolveSegments(input, max, labels) {
|
|
1807
|
+
const segments = input.map((s) => ({ ...s, value: nonNegative(s.value) }));
|
|
1808
|
+
const total = segments.reduce((acc, s) => acc + s.value, 0);
|
|
1809
|
+
const scale = max !== void 0 && max > 0 ? Math.max(max, total) : total;
|
|
1810
|
+
let text;
|
|
1811
|
+
if (segments.length === 0) text = labels.empty;
|
|
1812
|
+
else if (scale <= 0) text = labels.allEmpty;
|
|
1813
|
+
else
|
|
1814
|
+
text = segments.map((s) => {
|
|
1815
|
+
const pct = Math.round(s.value / scale * 100);
|
|
1816
|
+
return s.label ? `${s.label}: ${pct}%` : `${pct}%`;
|
|
1817
|
+
}).join(", ");
|
|
1818
|
+
return {
|
|
1819
|
+
segments,
|
|
1820
|
+
total,
|
|
1821
|
+
scale,
|
|
1822
|
+
rest: scale - total,
|
|
1823
|
+
percent: scale > 0 ? Math.round(total / scale * 100) : 0,
|
|
1824
|
+
text
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
// src/components/progress-bar/ProgressBar.module.css
|
|
1829
|
+
var ProgressBar_default = {
|
|
1830
|
+
root: "ProgressBar_root",
|
|
1831
|
+
segment: "ProgressBar_segment",
|
|
1832
|
+
header: "ProgressBar_header",
|
|
1833
|
+
label: "ProgressBar_label",
|
|
1834
|
+
value: "ProgressBar_value",
|
|
1835
|
+
native: "ProgressBar_native",
|
|
1836
|
+
bar: "ProgressBar_bar",
|
|
1837
|
+
fill: "ProgressBar_fill",
|
|
1838
|
+
segments: "ProgressBar_segments",
|
|
1839
|
+
rest: "ProgressBar_rest",
|
|
1840
|
+
step: "ProgressBar_step"
|
|
1841
|
+
};
|
|
1842
|
+
|
|
1843
|
+
// src/components/progress-bar/ProgressBar.tsx
|
|
1844
|
+
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1845
|
+
var MIN_STEPS = 2;
|
|
1846
|
+
var MAX_STEPS = 12;
|
|
1847
|
+
function useStepOrder(filled, count) {
|
|
1848
|
+
const prev = React16.useRef(filled);
|
|
1849
|
+
const from = prev.current;
|
|
1850
|
+
React16.useEffect(() => {
|
|
1851
|
+
prev.current = filled;
|
|
1852
|
+
}, [filled]);
|
|
1853
|
+
return Array.from(
|
|
1854
|
+
{ length: count },
|
|
1855
|
+
(_, i) => filled >= from ? Math.max(0, i - from) : Math.max(0, from - 1 - i)
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
function ProgressBar(props) {
|
|
1859
|
+
const {
|
|
1860
|
+
label,
|
|
1861
|
+
size = "m",
|
|
1862
|
+
showValue = false,
|
|
1863
|
+
className,
|
|
1864
|
+
value: valueProp,
|
|
1865
|
+
max: maxProp,
|
|
1866
|
+
tone: toneProp,
|
|
1867
|
+
segments: segmentsProp,
|
|
1868
|
+
segmentGap = "none",
|
|
1869
|
+
steps = false,
|
|
1870
|
+
labels,
|
|
1871
|
+
"aria-label": ariaLabel,
|
|
1872
|
+
...rest
|
|
1873
|
+
} = props;
|
|
1874
|
+
const labelId = React16.useId();
|
|
1875
|
+
const descriptionId = React16.useId();
|
|
1876
|
+
const stepResolved = !segmentsProp && steps ? resolveValue(valueProp ?? 0, maxProp) : null;
|
|
1877
|
+
const stepCount = stepResolved ? Math.min(MAX_STEPS, Math.max(MIN_STEPS, Math.round(stepResolved.max))) : 0;
|
|
1878
|
+
const stepFilled = stepResolved ? Math.round(stepResolved.value / stepResolved.max * stepCount) : 0;
|
|
1879
|
+
const stepOrder = useStepOrder(stepFilled, stepCount);
|
|
1880
|
+
let percent;
|
|
1881
|
+
let tone;
|
|
1882
|
+
let bar;
|
|
1883
|
+
if (segmentsProp) {
|
|
1884
|
+
const resolved = resolveSegments(segmentsProp, maxProp, {
|
|
1885
|
+
...DEFAULT_PROGRESS_SEGMENTS_LABELS,
|
|
1886
|
+
...labels
|
|
1887
|
+
});
|
|
1888
|
+
const { segments, total, rest: free, text } = resolved;
|
|
1889
|
+
percent = resolved.percent;
|
|
1890
|
+
const named = Boolean(label || ariaLabel);
|
|
1891
|
+
const a11y = named ? {
|
|
1892
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
1893
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
1894
|
+
"aria-describedby": descriptionId
|
|
1895
|
+
} : { "aria-label": text };
|
|
1896
|
+
bar = /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
1897
|
+
named ? /* @__PURE__ */ jsx20(VisuallyHidden, { id: descriptionId, children: text }) : null,
|
|
1898
|
+
/* @__PURE__ */ jsxs11(
|
|
1899
|
+
"div",
|
|
1900
|
+
{
|
|
1901
|
+
className: ProgressBar_default.bar,
|
|
1902
|
+
role: "group",
|
|
1903
|
+
...a11y,
|
|
1904
|
+
...toDataAttributes({ "segment-gap": segmentGap }),
|
|
1905
|
+
children: [
|
|
1906
|
+
total > 0 ? /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.segments, style: { flexGrow: total }, children: segments.map((seg, i) => /* @__PURE__ */ jsx20(
|
|
1907
|
+
"span",
|
|
1908
|
+
{
|
|
1909
|
+
className: ProgressBar_default.segment,
|
|
1910
|
+
style: { flexGrow: seg.value },
|
|
1911
|
+
title: seg.label,
|
|
1912
|
+
...toDataAttributes({ tone: seg.tone ?? "accent" })
|
|
1913
|
+
},
|
|
1914
|
+
i
|
|
1915
|
+
)) }) : null,
|
|
1916
|
+
free > 0 || total === 0 ? /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.rest, style: { flexGrow: free > 0 ? free : 1 } }) : null
|
|
1917
|
+
]
|
|
1918
|
+
}
|
|
1919
|
+
)
|
|
1920
|
+
] });
|
|
1921
|
+
} else {
|
|
1922
|
+
const resolved = resolveValue(valueProp ?? 0, maxProp);
|
|
1923
|
+
const { value, max } = resolved;
|
|
1924
|
+
percent = resolved.percent;
|
|
1925
|
+
tone = toneProp ?? "accent";
|
|
1926
|
+
bar = /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
1927
|
+
/* @__PURE__ */ jsx20(
|
|
1928
|
+
"progress",
|
|
1929
|
+
{
|
|
1930
|
+
value,
|
|
1931
|
+
max,
|
|
1932
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
1933
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
1934
|
+
className: ProgressBar_default.native
|
|
1935
|
+
}
|
|
1936
|
+
),
|
|
1937
|
+
steps ? /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.bar, "aria-hidden": "true", "data-steps": "true", children: stepOrder.map((order, i) => /* @__PURE__ */ jsx20(
|
|
1938
|
+
"span",
|
|
1939
|
+
{
|
|
1940
|
+
className: ProgressBar_default.step,
|
|
1941
|
+
"data-filled": i < stepFilled || void 0,
|
|
1942
|
+
style: { "--pb-step-order": order }
|
|
1943
|
+
},
|
|
1944
|
+
i
|
|
1945
|
+
)) }) : /* @__PURE__ */ jsx20(
|
|
1946
|
+
"span",
|
|
1947
|
+
{
|
|
1948
|
+
className: ProgressBar_default.bar,
|
|
1949
|
+
"aria-hidden": "true",
|
|
1950
|
+
style: { "--pb-ratio": resolved.ratio },
|
|
1951
|
+
children: /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.fill })
|
|
1952
|
+
}
|
|
1953
|
+
)
|
|
1954
|
+
] });
|
|
1955
|
+
}
|
|
1956
|
+
return /* @__PURE__ */ jsxs11("div", { className: cx(ProgressBar_default.root, className), ...rest, ...toDataAttributes({ size, tone }), children: [
|
|
1957
|
+
label || showValue ? /* @__PURE__ */ jsxs11("div", { className: ProgressBar_default.header, children: [
|
|
1958
|
+
label ? /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.label, id: labelId, children: label }) : null,
|
|
1959
|
+
showValue ? /* @__PURE__ */ jsxs11("span", { className: ProgressBar_default.value, "aria-hidden": "true", children: [
|
|
1960
|
+
percent,
|
|
1961
|
+
"%"
|
|
1962
|
+
] }) : null
|
|
1963
|
+
] }) : null,
|
|
1964
|
+
bar
|
|
1965
|
+
] });
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
// src/components/input/passwordStrength.ts
|
|
1969
|
+
var SHORT = 8;
|
|
1970
|
+
function getPasswordStrength(value) {
|
|
1971
|
+
if (value.length === 0) return 0;
|
|
1972
|
+
const points = Number(/\p{Ll}/u.test(value)) + Number(/\p{Lu}/u.test(value)) + Number(/\p{N}/u.test(value)) + Number(/[^\p{L}\p{N}\s]/u.test(value)) + Number(value.length >= 10) + Number(value.length >= 14);
|
|
1973
|
+
const level = points >= 5 ? 4 : points === 4 ? 3 : points === 3 ? 2 : 1;
|
|
1974
|
+
return value.length < SHORT ? Math.min(level, 2) : level;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1471
1977
|
// src/components/input/Input.tsx
|
|
1472
|
-
import * as
|
|
1978
|
+
import * as React18 from "react";
|
|
1473
1979
|
|
|
1474
1980
|
// src/internal/context.ts
|
|
1475
|
-
import * as
|
|
1981
|
+
import * as React17 from "react";
|
|
1476
1982
|
function createComponentContext(displayName) {
|
|
1477
|
-
const Ctx =
|
|
1983
|
+
const Ctx = React17.createContext(null);
|
|
1478
1984
|
Ctx.displayName = `${displayName}Context`;
|
|
1479
1985
|
function useComponentContext() {
|
|
1480
|
-
const value =
|
|
1986
|
+
const value = React17.useContext(Ctx);
|
|
1481
1987
|
if (value === null) {
|
|
1482
1988
|
throw new Error(
|
|
1483
1989
|
`[prime-ui-kit] \`${displayName}\` sub-component must be used inside \`${displayName}.Root\`.`
|
|
@@ -1496,15 +2002,27 @@ var Input_default = {
|
|
|
1496
2002
|
field: "Input_field",
|
|
1497
2003
|
inlineAffix: "Input_inlineAffix",
|
|
1498
2004
|
icon: "Input_icon",
|
|
1499
|
-
action: "Input_action"
|
|
2005
|
+
action: "Input_action",
|
|
2006
|
+
strengthWord: "Input_strengthWord"
|
|
1500
2007
|
};
|
|
1501
2008
|
|
|
1502
2009
|
// src/components/input/Input.tsx
|
|
1503
|
-
import { jsx as
|
|
2010
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1504
2011
|
var INPUT_LABELS = {
|
|
1505
2012
|
optional: "\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E",
|
|
1506
2013
|
clear: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
|
|
1507
|
-
counter: "{current} \u0438\u0437 {max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"
|
|
2014
|
+
counter: "{current} \u0438\u0437 {max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",
|
|
2015
|
+
strength: "\u041D\u0430\u0434\u0451\u0436\u043D\u043E\u0441\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044F",
|
|
2016
|
+
strengthWeak: "\u0421\u043B\u0430\u0431\u044B\u0439",
|
|
2017
|
+
strengthEasy: "\u041B\u0451\u0433\u043A\u0438\u0439",
|
|
2018
|
+
strengthMedium: "\u0421\u0440\u0435\u0434\u043D\u0438\u0439",
|
|
2019
|
+
strengthHard: "\u0421\u043B\u043E\u0436\u043D\u044B\u0439"
|
|
2020
|
+
};
|
|
2021
|
+
var STRENGTH_TONES = {
|
|
2022
|
+
1: "danger",
|
|
2023
|
+
2: "warning",
|
|
2024
|
+
3: "accent",
|
|
2025
|
+
4: "success"
|
|
1508
2026
|
};
|
|
1509
2027
|
var [InputProvider, useInputContext] = createComponentContext("Input");
|
|
1510
2028
|
function InputRoot({
|
|
@@ -1519,17 +2037,20 @@ function InputRoot({
|
|
|
1519
2037
|
counter,
|
|
1520
2038
|
reserveSupportRow = false,
|
|
1521
2039
|
id,
|
|
2040
|
+
strength = false,
|
|
2041
|
+
getStrength = getPasswordStrength,
|
|
1522
2042
|
labels: labelsProp,
|
|
1523
2043
|
children,
|
|
1524
2044
|
className,
|
|
1525
2045
|
...rest
|
|
1526
2046
|
}) {
|
|
2047
|
+
const [strengthValue, setStrengthValue] = React18.useState("");
|
|
1527
2048
|
const size = useControlSize(sizeProp);
|
|
1528
2049
|
const ids = useFieldFrame(id, { label, hint, error, invalid });
|
|
1529
|
-
const labels =
|
|
2050
|
+
const labels = React18.useMemo(() => ({ ...INPUT_LABELS, ...labelsProp }), [labelsProp]);
|
|
1530
2051
|
const { invalid: isInvalid, controlId: inputId, describedBy } = ids;
|
|
1531
|
-
const inputRef =
|
|
1532
|
-
const contextValue =
|
|
2052
|
+
const inputRef = React18.useRef(null);
|
|
2053
|
+
const contextValue = React18.useMemo(
|
|
1533
2054
|
() => ({
|
|
1534
2055
|
size,
|
|
1535
2056
|
invalid: isInvalid,
|
|
@@ -1538,11 +2059,14 @@ function InputRoot({
|
|
|
1538
2059
|
inputId,
|
|
1539
2060
|
inputRef,
|
|
1540
2061
|
describedBy,
|
|
1541
|
-
labels
|
|
2062
|
+
labels,
|
|
2063
|
+
reportValue: strength ? setStrengthValue : null
|
|
1542
2064
|
}),
|
|
1543
|
-
[size, isInvalid, focusRing, required, inputId, describedBy, labels]
|
|
2065
|
+
[size, isInvalid, focusRing, required, inputId, describedBy, labels, strength]
|
|
1544
2066
|
);
|
|
1545
|
-
|
|
2067
|
+
const level = strength ? getStrength(strengthValue) : 0;
|
|
2068
|
+
const levelWord = level ? [labels.strengthWeak, labels.strengthEasy, labels.strengthMedium, labels.strengthHard][level - 1] : "";
|
|
2069
|
+
return /* @__PURE__ */ jsx21(InputProvider, { value: contextValue, children: /* @__PURE__ */ jsx21(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsxs12(
|
|
1546
2070
|
FieldFrame,
|
|
1547
2071
|
{
|
|
1548
2072
|
...rest,
|
|
@@ -1553,18 +2077,45 @@ function InputRoot({
|
|
|
1553
2077
|
optional,
|
|
1554
2078
|
hint,
|
|
1555
2079
|
error,
|
|
1556
|
-
counter,
|
|
1557
|
-
|
|
2080
|
+
counter: strength ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2081
|
+
/* @__PURE__ */ jsx21(
|
|
2082
|
+
"span",
|
|
2083
|
+
{
|
|
2084
|
+
className: Input_default.strengthWord,
|
|
2085
|
+
"data-tone": level ? STRENGTH_TONES[level] : void 0,
|
|
2086
|
+
"aria-live": "polite",
|
|
2087
|
+
children: levelWord ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2088
|
+
/* @__PURE__ */ jsx21(VisuallyHidden, { children: `${labels.strength}: ` }),
|
|
2089
|
+
/* @__PURE__ */ jsx21(MorphText, { children: levelWord })
|
|
2090
|
+
] }) : null
|
|
2091
|
+
}
|
|
2092
|
+
),
|
|
2093
|
+
counter
|
|
2094
|
+
] }) : counter,
|
|
2095
|
+
reserveSupportRow: reserveSupportRow || strength,
|
|
1558
2096
|
optionalLabel: labels.optional,
|
|
1559
2097
|
className: cx(fieldTierClass, Input_default.root, className),
|
|
1560
|
-
children
|
|
2098
|
+
children: [
|
|
2099
|
+
children,
|
|
2100
|
+
strength ? /* @__PURE__ */ jsx21(
|
|
2101
|
+
ProgressBar,
|
|
2102
|
+
{
|
|
2103
|
+
steps: true,
|
|
2104
|
+
value: level,
|
|
2105
|
+
max: 4,
|
|
2106
|
+
tone: level ? STRENGTH_TONES[level] : "neutral",
|
|
2107
|
+
size: "xs",
|
|
2108
|
+
"aria-label": labels.strength
|
|
2109
|
+
}
|
|
2110
|
+
) : null
|
|
2111
|
+
]
|
|
1561
2112
|
}
|
|
1562
2113
|
) }) });
|
|
1563
2114
|
}
|
|
1564
2115
|
InputRoot.displayName = "Input.Root";
|
|
1565
2116
|
function InputWrapper({ children, className, ...rest }) {
|
|
1566
2117
|
const { size, invalid, focusRing } = useInputContext();
|
|
1567
|
-
return /* @__PURE__ */
|
|
2118
|
+
return /* @__PURE__ */ jsx21(
|
|
1568
2119
|
"div",
|
|
1569
2120
|
{
|
|
1570
2121
|
...rest,
|
|
@@ -1588,10 +2139,23 @@ function InputField({
|
|
|
1588
2139
|
ref,
|
|
1589
2140
|
...rest
|
|
1590
2141
|
}) {
|
|
1591
|
-
const {
|
|
2142
|
+
const {
|
|
2143
|
+
inputId,
|
|
2144
|
+
inputRef,
|
|
2145
|
+
invalid,
|
|
2146
|
+
required: requiredCtx,
|
|
2147
|
+
describedBy,
|
|
2148
|
+
reportValue
|
|
2149
|
+
} = useInputContext();
|
|
1592
2150
|
const setRefs = useMergedRefs(inputRef, ref);
|
|
2151
|
+
const controlled = rest.value;
|
|
2152
|
+
React18.useEffect(() => {
|
|
2153
|
+
if (!reportValue) return;
|
|
2154
|
+
if (controlled !== void 0) reportValue(String(controlled));
|
|
2155
|
+
else if (inputRef.current) reportValue(inputRef.current.value);
|
|
2156
|
+
}, [reportValue, controlled, inputRef]);
|
|
1593
2157
|
const resolvedDescribedBy = [ariaDescribedBy, describedBy].filter(Boolean).join(" ") || void 0;
|
|
1594
|
-
return /* @__PURE__ */
|
|
2158
|
+
return /* @__PURE__ */ jsx21(
|
|
1595
2159
|
"input",
|
|
1596
2160
|
{
|
|
1597
2161
|
...rest,
|
|
@@ -1604,21 +2168,22 @@ function InputField({
|
|
|
1604
2168
|
onChange: (event) => {
|
|
1605
2169
|
onChange?.(event);
|
|
1606
2170
|
onValueChange?.(event.target.value);
|
|
2171
|
+
reportValue?.(event.target.value);
|
|
1607
2172
|
}
|
|
1608
2173
|
}
|
|
1609
2174
|
);
|
|
1610
2175
|
}
|
|
1611
2176
|
InputField.displayName = "Input.Field";
|
|
1612
2177
|
function InputIcon({ side, children, className, ...rest }) {
|
|
1613
|
-
return /* @__PURE__ */
|
|
2178
|
+
return /* @__PURE__ */ jsx21("span", { ...rest, className: cx(Input_default.icon, className), "data-side": side, "aria-hidden": "true", children });
|
|
1614
2179
|
}
|
|
1615
2180
|
InputIcon.displayName = "Input.Icon";
|
|
1616
2181
|
function InputAffix({ side, children, className, ...rest }) {
|
|
1617
|
-
return /* @__PURE__ */
|
|
2182
|
+
return /* @__PURE__ */ jsx21("div", { ...rest, className: cx(Input_default.affix, className), "data-side": side, "aria-hidden": "true", children });
|
|
1618
2183
|
}
|
|
1619
2184
|
InputAffix.displayName = "Input.Affix";
|
|
1620
2185
|
function InputInlineAffix({ side, children, className, ...rest }) {
|
|
1621
|
-
return /* @__PURE__ */
|
|
2186
|
+
return /* @__PURE__ */ jsx21(
|
|
1622
2187
|
"span",
|
|
1623
2188
|
{
|
|
1624
2189
|
...rest,
|
|
@@ -1632,7 +2197,7 @@ function InputInlineAffix({ side, children, className, ...rest }) {
|
|
|
1632
2197
|
InputInlineAffix.displayName = "Input.InlineAffix";
|
|
1633
2198
|
function InputClearButton({ className, onClick: onClick2, ref, ...rest }) {
|
|
1634
2199
|
const { inputId, inputRef, labels } = useInputContext();
|
|
1635
|
-
return /* @__PURE__ */
|
|
2200
|
+
return /* @__PURE__ */ jsx21(
|
|
1636
2201
|
"button",
|
|
1637
2202
|
{
|
|
1638
2203
|
...rest,
|
|
@@ -1645,14 +2210,14 @@ function InputClearButton({ className, onClick: onClick2, ref, ...rest }) {
|
|
|
1645
2210
|
onClick2?.(event);
|
|
1646
2211
|
if (!event.defaultPrevented) inputRef.current?.focus();
|
|
1647
2212
|
},
|
|
1648
|
-
children: /* @__PURE__ */
|
|
2213
|
+
children: /* @__PURE__ */ jsx21(Icon, { name: "action.close" })
|
|
1649
2214
|
}
|
|
1650
2215
|
);
|
|
1651
2216
|
}
|
|
1652
2217
|
InputClearButton.displayName = "Input.ClearButton";
|
|
1653
2218
|
function InputCounter(props) {
|
|
1654
2219
|
const { size, labels } = useInputContext();
|
|
1655
|
-
return /* @__PURE__ */
|
|
2220
|
+
return /* @__PURE__ */ jsx21(FieldCounter, { ...props, size, label: labels.counter });
|
|
1656
2221
|
}
|
|
1657
2222
|
InputCounter.displayName = "Input.Counter";
|
|
1658
2223
|
var Input = {
|
|
@@ -1667,17 +2232,17 @@ var Input = {
|
|
|
1667
2232
|
};
|
|
1668
2233
|
|
|
1669
2234
|
// src/internal/imageSlot.tsx
|
|
1670
|
-
import * as
|
|
2235
|
+
import * as React20 from "react";
|
|
1671
2236
|
|
|
1672
2237
|
// src/hooks/useImageStatus.ts
|
|
1673
|
-
import * as
|
|
2238
|
+
import * as React19 from "react";
|
|
1674
2239
|
function useImageStatus(report, { onLoad, onError } = {}) {
|
|
1675
|
-
const [status, setStatus] =
|
|
1676
|
-
|
|
2240
|
+
const [status, setStatus] = React19.useState("loading");
|
|
2241
|
+
React19.useLayoutEffect(() => {
|
|
1677
2242
|
report("loading");
|
|
1678
2243
|
return () => report("idle");
|
|
1679
2244
|
}, [report]);
|
|
1680
|
-
const handleLoad =
|
|
2245
|
+
const handleLoad = React19.useCallback(
|
|
1681
2246
|
(event) => {
|
|
1682
2247
|
setStatus("loaded");
|
|
1683
2248
|
report("loaded");
|
|
@@ -1685,7 +2250,7 @@ function useImageStatus(report, { onLoad, onError } = {}) {
|
|
|
1685
2250
|
},
|
|
1686
2251
|
[onLoad, report]
|
|
1687
2252
|
);
|
|
1688
|
-
const handleError =
|
|
2253
|
+
const handleError = React19.useCallback(
|
|
1689
2254
|
(event) => {
|
|
1690
2255
|
setStatus("error");
|
|
1691
2256
|
report("error");
|
|
@@ -1697,18 +2262,18 @@ function useImageStatus(report, { onLoad, onError } = {}) {
|
|
|
1697
2262
|
}
|
|
1698
2263
|
|
|
1699
2264
|
// src/internal/imageSlot.tsx
|
|
1700
|
-
import { jsx as
|
|
2265
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1701
2266
|
function createImageSlot(name, classNames) {
|
|
1702
2267
|
const [Provider, useSlotContext] = createComponentContext(name);
|
|
1703
2268
|
function ImageSlotProvider({ children }) {
|
|
1704
|
-
const [imageStatus, setImageStatus] =
|
|
1705
|
-
const value =
|
|
1706
|
-
return /* @__PURE__ */
|
|
2269
|
+
const [imageStatus, setImageStatus] = React20.useState("idle");
|
|
2270
|
+
const value = React20.useMemo(() => ({ imageStatus, setImageStatus }), [imageStatus]);
|
|
2271
|
+
return /* @__PURE__ */ jsx22(Provider, { value, children });
|
|
1707
2272
|
}
|
|
1708
2273
|
function ImageInner({ src, alt = "", className, onLoad, onError, ...rest }) {
|
|
1709
2274
|
const { setImageStatus } = useSlotContext();
|
|
1710
2275
|
const image = useImageStatus(setImageStatus, { onLoad, onError });
|
|
1711
|
-
return /* @__PURE__ */
|
|
2276
|
+
return /* @__PURE__ */ jsx22(
|
|
1712
2277
|
"img",
|
|
1713
2278
|
{
|
|
1714
2279
|
src,
|
|
@@ -1722,12 +2287,12 @@ function createImageSlot(name, classNames) {
|
|
|
1722
2287
|
);
|
|
1723
2288
|
}
|
|
1724
2289
|
function Image2(props) {
|
|
1725
|
-
return /* @__PURE__ */
|
|
2290
|
+
return /* @__PURE__ */ jsx22(ImageInner, { ...props }, props.src);
|
|
1726
2291
|
}
|
|
1727
2292
|
Image2.displayName = `${name}.Image`;
|
|
1728
2293
|
function Fallback({ className, ...rest }) {
|
|
1729
2294
|
const { imageStatus } = useSlotContext();
|
|
1730
|
-
return /* @__PURE__ */
|
|
2295
|
+
return /* @__PURE__ */ jsx22(
|
|
1731
2296
|
"span",
|
|
1732
2297
|
{
|
|
1733
2298
|
className: cx(classNames.fallback, className),
|
|
@@ -1758,7 +2323,7 @@ var Thumbnail_default = {
|
|
|
1758
2323
|
};
|
|
1759
2324
|
|
|
1760
2325
|
// src/components/thumbnail/Thumbnail.tsx
|
|
1761
|
-
import { jsx as
|
|
2326
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1762
2327
|
var slot = createImageSlot("Thumbnail", { image: Thumbnail_default.image, fallback: Thumbnail_default.fallback });
|
|
1763
2328
|
function ThumbnailRoot({
|
|
1764
2329
|
size = "m",
|
|
@@ -1771,7 +2336,7 @@ function ThumbnailRoot({
|
|
|
1771
2336
|
children,
|
|
1772
2337
|
...rest
|
|
1773
2338
|
}) {
|
|
1774
|
-
return /* @__PURE__ */
|
|
2339
|
+
return /* @__PURE__ */ jsx23(slot.ImageSlotProvider, { children: /* @__PURE__ */ jsx23(
|
|
1775
2340
|
"div",
|
|
1776
2341
|
{
|
|
1777
2342
|
className: cx(Thumbnail_default.root, palette_default.hue, className),
|
|
@@ -1790,7 +2355,7 @@ function ThumbnailRoot({
|
|
|
1790
2355
|
}
|
|
1791
2356
|
ThumbnailRoot.displayName = "Thumbnail.Root";
|
|
1792
2357
|
function ThumbnailImage({ fit = "cover", ...rest }) {
|
|
1793
|
-
return /* @__PURE__ */
|
|
2358
|
+
return /* @__PURE__ */ jsx23(slot.Image, { ...rest, "data-fit": fit });
|
|
1794
2359
|
}
|
|
1795
2360
|
ThumbnailImage.displayName = "Thumbnail.Image";
|
|
1796
2361
|
var ThumbnailFallback = slot.Fallback;
|
|
@@ -1801,10 +2366,10 @@ var Thumbnail = {
|
|
|
1801
2366
|
};
|
|
1802
2367
|
|
|
1803
2368
|
// src/components/select/Select.tsx
|
|
1804
|
-
import * as
|
|
2369
|
+
import * as React34 from "react";
|
|
1805
2370
|
|
|
1806
2371
|
// src/internal/listbox.ts
|
|
1807
|
-
import * as
|
|
2372
|
+
import * as React21 from "react";
|
|
1808
2373
|
var optionDomId = (listboxId, value) => `${listboxId}-opt-${value.replace(/\s+/g, "_")}`;
|
|
1809
2374
|
function enabledOptions(container) {
|
|
1810
2375
|
if (!container) return [];
|
|
@@ -1829,11 +2394,11 @@ function createStore(initial) {
|
|
|
1829
2394
|
};
|
|
1830
2395
|
}
|
|
1831
2396
|
function useCreateStore(initial) {
|
|
1832
|
-
return
|
|
2397
|
+
return React21.useState(() => createStore(initial))[0];
|
|
1833
2398
|
}
|
|
1834
2399
|
function useStoreSlice(store, select) {
|
|
1835
2400
|
const read = () => select(store.get());
|
|
1836
|
-
return
|
|
2401
|
+
return React21.useSyncExternalStore(store.subscribe, read, read);
|
|
1837
2402
|
}
|
|
1838
2403
|
function handleListboxKeyDown(event, { items, highlight, onSelect }) {
|
|
1839
2404
|
if (items.length === 0) return;
|
|
@@ -1855,10 +2420,10 @@ function handleListboxKeyDown(event, { items, highlight, onSelect }) {
|
|
|
1855
2420
|
}
|
|
1856
2421
|
var TYPEAHEAD_RESET_MS = 500;
|
|
1857
2422
|
function useTypeahead() {
|
|
1858
|
-
const state =
|
|
1859
|
-
|
|
1860
|
-
const isTyping =
|
|
1861
|
-
const find =
|
|
2423
|
+
const state = React21.useRef({ buffer: "", timer: 0 });
|
|
2424
|
+
React21.useEffect(() => () => window.clearTimeout(state.current.timer), []);
|
|
2425
|
+
const isTyping = React21.useCallback(() => state.current.buffer !== "", []);
|
|
2426
|
+
const find = React21.useCallback(
|
|
1862
2427
|
(key, items, highlighted) => {
|
|
1863
2428
|
const s = state.current;
|
|
1864
2429
|
window.clearTimeout(s.timer);
|
|
@@ -1880,7 +2445,7 @@ function useTypeahead() {
|
|
|
1880
2445
|
}
|
|
1881
2446
|
|
|
1882
2447
|
// src/internal/MenuGroup.tsx
|
|
1883
|
-
import * as
|
|
2448
|
+
import * as React22 from "react";
|
|
1884
2449
|
|
|
1885
2450
|
// src/internal/menu.module.css
|
|
1886
2451
|
var menu_default = {
|
|
@@ -1898,12 +2463,12 @@ var menu_default = {
|
|
|
1898
2463
|
};
|
|
1899
2464
|
|
|
1900
2465
|
// src/internal/MenuGroup.tsx
|
|
1901
|
-
import { jsx as
|
|
2466
|
+
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1902
2467
|
function MenuGroup({ label, className, children, ...rest }) {
|
|
1903
|
-
const labelId =
|
|
2468
|
+
const labelId = React22.useId();
|
|
1904
2469
|
return (
|
|
1905
2470
|
// biome-ignore lint/a11y/useSemanticElements: role="group" inside a menu / listbox; <fieldset> is not allowed there
|
|
1906
|
-
/* @__PURE__ */
|
|
2471
|
+
/* @__PURE__ */ jsxs13(
|
|
1907
2472
|
"div",
|
|
1908
2473
|
{
|
|
1909
2474
|
...rest,
|
|
@@ -1911,7 +2476,7 @@ function MenuGroup({ label, className, children, ...rest }) {
|
|
|
1911
2476
|
"aria-labelledby": label != null ? labelId : void 0,
|
|
1912
2477
|
className: cx(menu_default.group, className),
|
|
1913
2478
|
children: [
|
|
1914
|
-
label != null ? /* @__PURE__ */
|
|
2479
|
+
label != null ? /* @__PURE__ */ jsx24("div", { id: labelId, role: "presentation", className: menu_default.groupLabel, children: label }) : null,
|
|
1915
2480
|
children
|
|
1916
2481
|
]
|
|
1917
2482
|
}
|
|
@@ -1948,11 +2513,11 @@ var overlayMotion_default = {
|
|
|
1948
2513
|
};
|
|
1949
2514
|
|
|
1950
2515
|
// src/internal/Portal.tsx
|
|
1951
|
-
import * as
|
|
2516
|
+
import * as React23 from "react";
|
|
1952
2517
|
import { createPortal } from "react-dom";
|
|
1953
2518
|
function Portal({ children, container }) {
|
|
1954
|
-
const [mounted, setMounted] =
|
|
1955
|
-
|
|
2519
|
+
const [mounted, setMounted] = React23.useState(false);
|
|
2520
|
+
React23.useLayoutEffect(() => {
|
|
1956
2521
|
setMounted(true);
|
|
1957
2522
|
return () => setMounted(false);
|
|
1958
2523
|
}, []);
|
|
@@ -1967,8 +2532,28 @@ var sheet_default = {
|
|
|
1967
2532
|
swipeX: "sheet_swipeX"
|
|
1968
2533
|
};
|
|
1969
2534
|
|
|
2535
|
+
// src/internal/surfaceDepth.tsx
|
|
2536
|
+
import * as React24 from "react";
|
|
2537
|
+
var SurfaceDepthContext = React24.createContext(0);
|
|
2538
|
+
SurfaceDepthContext.displayName = "SurfaceDepthContext";
|
|
2539
|
+
function nextSurfaceDepth(depth) {
|
|
2540
|
+
if (typeof depth === "number") return Math.min(depth + 1, 4);
|
|
2541
|
+
if (depth === "tinted") return 1;
|
|
2542
|
+
return depth === "floating" ? "floating-1" : "floating-2";
|
|
2543
|
+
}
|
|
2544
|
+
function useNestedSurfaceDepth() {
|
|
2545
|
+
return nextSurfaceDepth(React24.useContext(SurfaceDepthContext));
|
|
2546
|
+
}
|
|
2547
|
+
var SurfaceDepthProvider = SurfaceDepthContext.Provider;
|
|
2548
|
+
var StageDepthContext = React24.createContext(0);
|
|
2549
|
+
StageDepthContext.displayName = "StageDepthContext";
|
|
2550
|
+
var StageDepthProvider = StageDepthContext.Provider;
|
|
2551
|
+
function useStageDepth() {
|
|
2552
|
+
return React24.useContext(StageDepthContext);
|
|
2553
|
+
}
|
|
2554
|
+
|
|
1970
2555
|
// src/internal/overlay/layerStack.ts
|
|
1971
|
-
import * as
|
|
2556
|
+
import * as React25 from "react";
|
|
1972
2557
|
|
|
1973
2558
|
// src/internal/overlay/focus.ts
|
|
1974
2559
|
var FOCUSABLE = [
|
|
@@ -2089,22 +2674,22 @@ function push(entry) {
|
|
|
2089
2674
|
if (stack.length === 0) listen(false);
|
|
2090
2675
|
};
|
|
2091
2676
|
}
|
|
2092
|
-
var LayerContext =
|
|
2677
|
+
var LayerContext = React25.createContext(null);
|
|
2093
2678
|
var LayerProvider = LayerContext.Provider;
|
|
2094
2679
|
function useLayer(open, options) {
|
|
2095
|
-
const parent =
|
|
2096
|
-
const [entry] =
|
|
2680
|
+
const parent = React25.useContext(LayerContext);
|
|
2681
|
+
const [entry] = React25.useState(() => ({ parent, trap: false, ...options }));
|
|
2097
2682
|
entry.parent = parent;
|
|
2098
2683
|
entry.refs = options.refs;
|
|
2099
2684
|
entry.dismiss = options.dismiss;
|
|
2100
2685
|
entry.trap = options.trap ?? false;
|
|
2101
2686
|
entry.onDismiss = options.onDismiss;
|
|
2102
|
-
|
|
2687
|
+
React25.useLayoutEffect(() => open ? push(entry) : void 0, [open, entry]);
|
|
2103
2688
|
return entry;
|
|
2104
2689
|
}
|
|
2105
2690
|
|
|
2106
2691
|
// src/internal/overlay/FloatingPanel.tsx
|
|
2107
|
-
import { Fragment as
|
|
2692
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2108
2693
|
function FloatingPanel({
|
|
2109
2694
|
floating,
|
|
2110
2695
|
size,
|
|
@@ -2129,6 +2714,7 @@ function FloatingPanel({
|
|
|
2129
2714
|
className
|
|
2130
2715
|
),
|
|
2131
2716
|
"data-size": size,
|
|
2717
|
+
...surface && !sheet ? { "data-depth": "floating" } : null,
|
|
2132
2718
|
...sheet ? null : {
|
|
2133
2719
|
"data-state": presence.state,
|
|
2134
2720
|
"data-side": floating.side,
|
|
@@ -2139,9 +2725,9 @@ function FloatingPanel({
|
|
|
2139
2725
|
floating.onKeyDown(event);
|
|
2140
2726
|
}
|
|
2141
2727
|
};
|
|
2142
|
-
const panel = scroll ? /* @__PURE__ */
|
|
2143
|
-
return /* @__PURE__ */
|
|
2144
|
-
/* @__PURE__ */
|
|
2728
|
+
const panel = scroll ? /* @__PURE__ */ jsx25(ScrollContainer, { ...props, ref: panelRef, children }) : /* @__PURE__ */ jsx25("div", { ...props, ref: panelRef, children });
|
|
2729
|
+
return /* @__PURE__ */ jsx25(Portal, { children: /* @__PURE__ */ jsx25(LayerProvider, { value: floating.layer, children: /* @__PURE__ */ jsx25(SurfaceDepthProvider, { value: "floating", children: /* @__PURE__ */ jsx25(ControlSizeProvider, { value: size, children: sheet ? /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
2730
|
+
/* @__PURE__ */ jsx25(
|
|
2145
2731
|
"div",
|
|
2146
2732
|
{
|
|
2147
2733
|
role: "presentation",
|
|
@@ -2149,7 +2735,7 @@ function FloatingPanel({
|
|
|
2149
2735
|
"data-state": presence.state
|
|
2150
2736
|
}
|
|
2151
2737
|
),
|
|
2152
|
-
/* @__PURE__ */
|
|
2738
|
+
/* @__PURE__ */ jsxs14(
|
|
2153
2739
|
"div",
|
|
2154
2740
|
{
|
|
2155
2741
|
ref: floating.panelRef,
|
|
@@ -2159,29 +2745,30 @@ function FloatingPanel({
|
|
|
2159
2745
|
overlayMotion_default.sheet,
|
|
2160
2746
|
sheet_default.swipeY
|
|
2161
2747
|
),
|
|
2748
|
+
"data-depth": "floating",
|
|
2162
2749
|
"data-state": presence.state,
|
|
2163
2750
|
onAnimationEnd: presence.onExitEnd,
|
|
2164
2751
|
onPointerDown: floating.onSheetPointerDown,
|
|
2165
2752
|
children: [
|
|
2166
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ jsx25("div", { className: sheet_default.handle, "data-swipe-handle": "", "aria-hidden": "true" }),
|
|
2167
2754
|
panel
|
|
2168
2755
|
]
|
|
2169
2756
|
}
|
|
2170
2757
|
)
|
|
2171
|
-
] }) : panel }) }) });
|
|
2758
|
+
] }) : panel }) }) }) });
|
|
2172
2759
|
}
|
|
2173
2760
|
function FloatingTrigger({ triggerProps, children, ...forwarded }) {
|
|
2174
|
-
return /* @__PURE__ */
|
|
2761
|
+
return /* @__PURE__ */ jsx25(Slot, { ...forwarded, children: /* @__PURE__ */ jsx25(Slot, { ...triggerProps, children }) });
|
|
2175
2762
|
}
|
|
2176
2763
|
|
|
2177
2764
|
// src/internal/overlay/useFloatingLayer.ts
|
|
2178
|
-
import * as
|
|
2765
|
+
import * as React31 from "react";
|
|
2179
2766
|
|
|
2180
2767
|
// src/hooks/useMediaQuery.ts
|
|
2181
|
-
import * as
|
|
2768
|
+
import * as React26 from "react";
|
|
2182
2769
|
var COMPACT_QUERY = "(max-width: 639px)";
|
|
2183
2770
|
function useMediaQuery(query, enabled = true) {
|
|
2184
|
-
const subscribe =
|
|
2771
|
+
const subscribe = React26.useCallback(
|
|
2185
2772
|
(onChange) => {
|
|
2186
2773
|
if (!enabled || typeof window === "undefined" || !window.matchMedia) return () => {
|
|
2187
2774
|
};
|
|
@@ -2192,18 +2779,18 @@ function useMediaQuery(query, enabled = true) {
|
|
|
2192
2779
|
[enabled, query]
|
|
2193
2780
|
);
|
|
2194
2781
|
const getSnapshot = () => enabled && typeof window !== "undefined" && !!window.matchMedia ? window.matchMedia(query).matches : false;
|
|
2195
|
-
return
|
|
2782
|
+
return React26.useSyncExternalStore(subscribe, getSnapshot, () => false);
|
|
2196
2783
|
}
|
|
2197
2784
|
|
|
2198
2785
|
// src/hooks/usePosition.ts
|
|
2199
|
-
import * as
|
|
2786
|
+
import * as React28 from "react";
|
|
2200
2787
|
|
|
2201
2788
|
// src/internal/AnchorRectContext.tsx
|
|
2202
|
-
import * as
|
|
2203
|
-
var AnchorRectContext =
|
|
2789
|
+
import * as React27 from "react";
|
|
2790
|
+
var AnchorRectContext = React27.createContext(null);
|
|
2204
2791
|
var AnchorRectProvider = AnchorRectContext.Provider;
|
|
2205
2792
|
function useAnchorRectResolver() {
|
|
2206
|
-
return
|
|
2793
|
+
return React27.useContext(AnchorRectContext);
|
|
2207
2794
|
}
|
|
2208
2795
|
|
|
2209
2796
|
// src/internal/layoutPxFromPrimitives.ts
|
|
@@ -2328,11 +2915,11 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
2328
2915
|
offsetToken = "--prime-panel-offset",
|
|
2329
2916
|
arrowInset
|
|
2330
2917
|
} = {}) {
|
|
2331
|
-
const [attached, setAttached] =
|
|
2332
|
-
const [resolvedSide, setResolvedSide] =
|
|
2918
|
+
const [attached, setAttached] = React28.useState(false);
|
|
2919
|
+
const [resolvedSide, setResolvedSide] = React28.useState(preferredSide);
|
|
2333
2920
|
const resolveAnchorRect = useAnchorRectResolver();
|
|
2334
|
-
const metricsRef =
|
|
2335
|
-
const update =
|
|
2921
|
+
const metricsRef = React28.useRef(null);
|
|
2922
|
+
const update = React28.useCallback(
|
|
2336
2923
|
(remeasure) => {
|
|
2337
2924
|
const anchor = anchorRef.current;
|
|
2338
2925
|
const layer = layerRef.current;
|
|
@@ -2386,9 +2973,9 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
2386
2973
|
resolveAnchorRect
|
|
2387
2974
|
]
|
|
2388
2975
|
);
|
|
2389
|
-
const updateRef =
|
|
2976
|
+
const updateRef = React28.useRef(update);
|
|
2390
2977
|
updateRef.current = update;
|
|
2391
|
-
const attachLayer =
|
|
2978
|
+
const attachLayer = React28.useCallback(
|
|
2392
2979
|
(node) => {
|
|
2393
2980
|
layerRef.current = node;
|
|
2394
2981
|
setAttached(node !== null);
|
|
@@ -2396,10 +2983,10 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
2396
2983
|
[layerRef]
|
|
2397
2984
|
);
|
|
2398
2985
|
const active = enabled && attached;
|
|
2399
|
-
|
|
2986
|
+
React28.useLayoutEffect(() => {
|
|
2400
2987
|
if (active) update(true);
|
|
2401
2988
|
}, [active, update]);
|
|
2402
|
-
|
|
2989
|
+
React28.useLayoutEffect(() => {
|
|
2403
2990
|
if (!active) return;
|
|
2404
2991
|
let frame = 0;
|
|
2405
2992
|
let remeasure = false;
|
|
@@ -2433,57 +3020,8 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
2433
3020
|
return { side: resolvedSide, attachLayer };
|
|
2434
3021
|
}
|
|
2435
3022
|
|
|
2436
|
-
// src/hooks/usePresence.ts
|
|
2437
|
-
import * as React24 from "react";
|
|
2438
|
-
var DURATION_FALLBACK_MS = {
|
|
2439
|
-
fast: 230,
|
|
2440
|
-
base: 380,
|
|
2441
|
-
slow: 570
|
|
2442
|
-
};
|
|
2443
|
-
var TIMEOUT_SLACK_MS = 50;
|
|
2444
|
-
function prefersReducedMotion() {
|
|
2445
|
-
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2446
|
-
}
|
|
2447
|
-
function parseDurationMs(raw) {
|
|
2448
|
-
const value = raw.trim();
|
|
2449
|
-
if (value === "") return null;
|
|
2450
|
-
const n = Number.parseFloat(value);
|
|
2451
|
-
if (Number.isNaN(n)) return null;
|
|
2452
|
-
if (value.endsWith("ms")) return n;
|
|
2453
|
-
if (value.endsWith("s")) return n * 1e3;
|
|
2454
|
-
return null;
|
|
2455
|
-
}
|
|
2456
|
-
function motionDurationMs(token) {
|
|
2457
|
-
if (typeof document === "undefined") return DURATION_FALLBACK_MS[token];
|
|
2458
|
-
const raw = getComputedStyle(document.documentElement).getPropertyValue(
|
|
2459
|
-
`--prime-motion-duration-${token}`
|
|
2460
|
-
);
|
|
2461
|
-
return parseDurationMs(raw) ?? DURATION_FALLBACK_MS[token];
|
|
2462
|
-
}
|
|
2463
|
-
function exitTimeoutMs(token) {
|
|
2464
|
-
return motionDurationMs(token) + TIMEOUT_SLACK_MS;
|
|
2465
|
-
}
|
|
2466
|
-
function usePresence(open, options = {}) {
|
|
2467
|
-
const { exitDuration = "base" } = options;
|
|
2468
|
-
const [mounted, setMounted] = React24.useState(open);
|
|
2469
|
-
if (open && !mounted) setMounted(true);
|
|
2470
|
-
if (!open && mounted && prefersReducedMotion()) setMounted(false);
|
|
2471
|
-
const openRef = React24.useRef(open);
|
|
2472
|
-
openRef.current = open;
|
|
2473
|
-
React24.useEffect(() => {
|
|
2474
|
-
if (open || !mounted) return;
|
|
2475
|
-
const id = window.setTimeout(() => setMounted(false), exitTimeoutMs(exitDuration));
|
|
2476
|
-
return () => window.clearTimeout(id);
|
|
2477
|
-
}, [open, mounted, exitDuration]);
|
|
2478
|
-
const onExitEnd = React24.useCallback((event) => {
|
|
2479
|
-
if (event.target !== event.currentTarget) return;
|
|
2480
|
-
if (!openRef.current) setMounted(false);
|
|
2481
|
-
}, []);
|
|
2482
|
-
return { mounted: open || mounted, state: open ? "open" : "closed", onExitEnd };
|
|
2483
|
-
}
|
|
2484
|
-
|
|
2485
3023
|
// src/hooks/useScrollLock.ts
|
|
2486
|
-
import * as
|
|
3024
|
+
import * as React29 from "react";
|
|
2487
3025
|
var lockCount = 0;
|
|
2488
3026
|
var saved = null;
|
|
2489
3027
|
function lockScroll() {
|
|
@@ -2508,7 +3046,7 @@ function unlockScroll() {
|
|
|
2508
3046
|
}
|
|
2509
3047
|
}
|
|
2510
3048
|
function useScrollLock(enabled) {
|
|
2511
|
-
|
|
3049
|
+
React29.useEffect(() => {
|
|
2512
3050
|
if (!enabled) return;
|
|
2513
3051
|
lockScroll();
|
|
2514
3052
|
return unlockScroll;
|
|
@@ -2516,7 +3054,7 @@ function useScrollLock(enabled) {
|
|
|
2516
3054
|
}
|
|
2517
3055
|
|
|
2518
3056
|
// src/hooks/useSwipeDismiss.ts
|
|
2519
|
-
import * as
|
|
3057
|
+
import * as React30 from "react";
|
|
2520
3058
|
var SLOP_PX = 8;
|
|
2521
3059
|
var DISTANCE_RATIO = 0.3;
|
|
2522
3060
|
var FLICK_VELOCITY = 0.5;
|
|
@@ -2544,11 +3082,11 @@ function useSwipeDismiss({
|
|
|
2544
3082
|
touchAnywhere = false,
|
|
2545
3083
|
onProgress
|
|
2546
3084
|
}) {
|
|
2547
|
-
const optionsRef =
|
|
3085
|
+
const optionsRef = React30.useRef({ direction, onDismiss, handle, touchAnywhere, onProgress });
|
|
2548
3086
|
optionsRef.current = { direction, onDismiss, handle, touchAnywhere, onProgress };
|
|
2549
|
-
const cleanupRef =
|
|
2550
|
-
|
|
2551
|
-
const onPointerDown2 =
|
|
3087
|
+
const cleanupRef = React30.useRef(null);
|
|
3088
|
+
React30.useEffect(() => () => cleanupRef.current?.(), []);
|
|
3089
|
+
const onPointerDown2 = React30.useCallback(
|
|
2552
3090
|
(event) => {
|
|
2553
3091
|
if (!enabled || event.defaultPrevented || !event.isPrimary || event.button !== 0) return;
|
|
2554
3092
|
const { direction: direction2, handle: handle2, touchAnywhere: touchAnywhere2 } = optionsRef.current;
|
|
@@ -2655,24 +3193,24 @@ function useFloatingLayer({
|
|
|
2655
3193
|
const sheet = useMediaQuery(COMPACT_QUERY, sheetOption);
|
|
2656
3194
|
const presence = usePresence(open, { exitDuration: sheet ? "base" : exitDuration });
|
|
2657
3195
|
const mounted = presence.mounted && (open || !skipExit);
|
|
2658
|
-
const contentRef =
|
|
3196
|
+
const contentRef = React31.useRef(null);
|
|
2659
3197
|
const position = usePosition(mounted && !sheet, triggerRef, contentRef, positionOptions);
|
|
2660
3198
|
useScrollLock(open && sheet);
|
|
2661
|
-
const [panel, setPanel] =
|
|
3199
|
+
const [panel, setPanel] = React31.useState(null);
|
|
2662
3200
|
const { attachLayer } = position;
|
|
2663
|
-
const panelRef =
|
|
3201
|
+
const panelRef = React31.useCallback(
|
|
2664
3202
|
(node) => {
|
|
2665
3203
|
attachLayer(node);
|
|
2666
3204
|
setPanel(node);
|
|
2667
3205
|
},
|
|
2668
3206
|
[attachLayer]
|
|
2669
3207
|
);
|
|
2670
|
-
const outsideRef =
|
|
2671
|
-
const close =
|
|
3208
|
+
const outsideRef = React31.useRef(false);
|
|
3209
|
+
const close = React31.useCallback(() => {
|
|
2672
3210
|
outsideRef.current = false;
|
|
2673
3211
|
onOpenChange(false);
|
|
2674
3212
|
}, [onOpenChange]);
|
|
2675
|
-
const dismissOutside =
|
|
3213
|
+
const dismissOutside = React31.useCallback(() => {
|
|
2676
3214
|
outsideRef.current = true;
|
|
2677
3215
|
onOpenChange(false);
|
|
2678
3216
|
}, [onOpenChange]);
|
|
@@ -2696,7 +3234,7 @@ function useFloatingLayer({
|
|
|
2696
3234
|
onDismiss
|
|
2697
3235
|
});
|
|
2698
3236
|
const passive = dismiss === "none";
|
|
2699
|
-
|
|
3237
|
+
React31.useEffect(() => {
|
|
2700
3238
|
if (!open || !panel || passive) return;
|
|
2701
3239
|
outsideRef.current = false;
|
|
2702
3240
|
if (focusOnOpen) focusInto(panel);
|
|
@@ -2761,10 +3299,10 @@ var Select_default = {
|
|
|
2761
3299
|
};
|
|
2762
3300
|
|
|
2763
3301
|
// src/components/select/SelectItem.tsx
|
|
2764
|
-
import * as
|
|
3302
|
+
import * as React33 from "react";
|
|
2765
3303
|
|
|
2766
3304
|
// src/internal/HighlightMatch.tsx
|
|
2767
|
-
import * as
|
|
3305
|
+
import * as React32 from "react";
|
|
2768
3306
|
|
|
2769
3307
|
// src/internal/HighlightMatch.module.css
|
|
2770
3308
|
var HighlightMatch_default = {
|
|
@@ -2772,7 +3310,7 @@ var HighlightMatch_default = {
|
|
|
2772
3310
|
};
|
|
2773
3311
|
|
|
2774
3312
|
// src/internal/HighlightMatch.tsx
|
|
2775
|
-
import { Fragment as
|
|
3313
|
+
import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2776
3314
|
function matchIndex(text, query) {
|
|
2777
3315
|
if (!query) return -1;
|
|
2778
3316
|
return text.toLowerCase().indexOf(query.toLowerCase());
|
|
@@ -2780,18 +3318,18 @@ function matchIndex(text, query) {
|
|
|
2780
3318
|
function HighlightMatch({ text, query }) {
|
|
2781
3319
|
const q = query.trim();
|
|
2782
3320
|
const at = matchIndex(text, q);
|
|
2783
|
-
if (at < 0) return /* @__PURE__ */
|
|
2784
|
-
return /* @__PURE__ */
|
|
3321
|
+
if (at < 0) return /* @__PURE__ */ jsx26(Fragment8, { children: text });
|
|
3322
|
+
return /* @__PURE__ */ jsxs15("span", { children: [
|
|
2785
3323
|
text.slice(0, at),
|
|
2786
|
-
/* @__PURE__ */
|
|
3324
|
+
/* @__PURE__ */ jsx26("mark", { className: HighlightMatch_default.match, children: text.slice(at, at + q.length) }),
|
|
2787
3325
|
text.slice(at + q.length)
|
|
2788
3326
|
] });
|
|
2789
3327
|
}
|
|
2790
3328
|
function highlightChildren(children, query) {
|
|
2791
3329
|
if (!query.trim()) return children;
|
|
2792
|
-
return
|
|
3330
|
+
return React32.Children.map(
|
|
2793
3331
|
children,
|
|
2794
|
-
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */
|
|
3332
|
+
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */ jsx26(HighlightMatch, { text: String(child), query }) : child
|
|
2795
3333
|
);
|
|
2796
3334
|
}
|
|
2797
3335
|
|
|
@@ -2825,24 +3363,24 @@ function createItemRegistry() {
|
|
|
2825
3363
|
var [SelectProvider, useSelectContext] = createComponentContext("Select");
|
|
2826
3364
|
|
|
2827
3365
|
// src/components/select/SelectItem.tsx
|
|
2828
|
-
import { jsx as
|
|
3366
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2829
3367
|
var MEDIA_SIZE = { xs: "xs", s: "xs", m: "s", l: "s", xl: "m" };
|
|
2830
3368
|
function textOf(node) {
|
|
2831
3369
|
if (node == null || typeof node === "boolean") return "";
|
|
2832
3370
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
2833
3371
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
2834
|
-
if (
|
|
3372
|
+
if (React33.isValidElement(node))
|
|
2835
3373
|
return textOf(node.props.children);
|
|
2836
3374
|
return "";
|
|
2837
3375
|
}
|
|
2838
3376
|
function SelectItemIcon({ className, ...rest }) {
|
|
2839
|
-
return /* @__PURE__ */
|
|
3377
|
+
return /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: cx(menu_default.itemIcon, className), ...rest });
|
|
2840
3378
|
}
|
|
2841
3379
|
SelectItemIcon.displayName = "Select.ItemIcon";
|
|
2842
|
-
var OptionQueryContext =
|
|
3380
|
+
var OptionQueryContext = React33.createContext("");
|
|
2843
3381
|
function SelectItemText({ children, className, ...rest }) {
|
|
2844
|
-
const query =
|
|
2845
|
-
return /* @__PURE__ */
|
|
3382
|
+
const query = React33.useContext(OptionQueryContext);
|
|
3383
|
+
return /* @__PURE__ */ jsx27("span", { ...rest, className: cx(Select_default.itemTitle, className), children: highlightChildren(children, query) });
|
|
2846
3384
|
}
|
|
2847
3385
|
SelectItemText.displayName = "Select.ItemText";
|
|
2848
3386
|
function SelectItemDescription({
|
|
@@ -2850,12 +3388,12 @@ function SelectItemDescription({
|
|
|
2850
3388
|
className,
|
|
2851
3389
|
...rest
|
|
2852
3390
|
}) {
|
|
2853
|
-
const query =
|
|
2854
|
-
return /* @__PURE__ */
|
|
3391
|
+
const query = React33.useContext(OptionQueryContext);
|
|
3392
|
+
return /* @__PURE__ */ jsx27("span", { ...rest, className: cx(Select_default.itemDescription, className), children: highlightChildren(children, query) });
|
|
2855
3393
|
}
|
|
2856
3394
|
SelectItemDescription.displayName = "Select.ItemDescription";
|
|
2857
3395
|
function SelectItemMeta({ children, className, ...rest }) {
|
|
2858
|
-
return /* @__PURE__ */
|
|
3396
|
+
return /* @__PURE__ */ jsx27("span", { ...rest, className: cx(Select_default.itemMeta, className), children });
|
|
2859
3397
|
}
|
|
2860
3398
|
SelectItemMeta.displayName = "Select.ItemMeta";
|
|
2861
3399
|
function splitItemChildren(children) {
|
|
@@ -2868,11 +3406,11 @@ function splitItemChildren(children) {
|
|
|
2868
3406
|
description: ""
|
|
2869
3407
|
};
|
|
2870
3408
|
let plain = "";
|
|
2871
|
-
for (const child of
|
|
2872
|
-
if (!
|
|
3409
|
+
for (const child of React33.Children.toArray(children)) {
|
|
3410
|
+
if (!React33.isValidElement(child)) {
|
|
2873
3411
|
plain += textOf(child);
|
|
2874
3412
|
parts.body.push(child);
|
|
2875
|
-
} else if (child.type ===
|
|
3413
|
+
} else if (child.type === React33.Fragment) {
|
|
2876
3414
|
const inner = splitItemChildren(child.props.children);
|
|
2877
3415
|
parts.leading.push(...inner.leading);
|
|
2878
3416
|
parts.body.push(...inner.body);
|
|
@@ -2902,7 +3440,7 @@ function splitItemChildren(children) {
|
|
|
2902
3440
|
}
|
|
2903
3441
|
function sizeMedia(leading, size) {
|
|
2904
3442
|
return leading.map(
|
|
2905
|
-
(node) =>
|
|
3443
|
+
(node) => React33.isValidElement(node) && node.type === Thumbnail.Root ? React33.cloneElement(node, {
|
|
2906
3444
|
size: node.props.size ?? MEDIA_SIZE[size],
|
|
2907
3445
|
className: cx(Select_default.media, node.props.className),
|
|
2908
3446
|
"aria-hidden": true
|
|
@@ -2924,7 +3462,7 @@ function SelectItem({
|
|
|
2924
3462
|
const haystack = normalize(`${resolvedLabel} ${parts.description} ${keywords ?? ""}`);
|
|
2925
3463
|
const isSelected = selected.includes(value);
|
|
2926
3464
|
const isHighlighted = useStoreSlice(highlight, (current) => current === value);
|
|
2927
|
-
|
|
3465
|
+
React33.useLayoutEffect(
|
|
2928
3466
|
() => registry.register(value, resolvedLabel, haystack),
|
|
2929
3467
|
[registry, value, resolvedLabel, haystack]
|
|
2930
3468
|
);
|
|
@@ -2933,7 +3471,7 @@ function SelectItem({
|
|
|
2933
3471
|
return (
|
|
2934
3472
|
// biome-ignore lint/a11y/useFocusableInteractive: focus stays on the listbox / search (aria-activedescendant)
|
|
2935
3473
|
// biome-ignore lint/a11y/useKeyWithClickEvents: the keyboard is handled on the listbox
|
|
2936
|
-
/* @__PURE__ */
|
|
3474
|
+
/* @__PURE__ */ jsxs16(
|
|
2937
3475
|
"div",
|
|
2938
3476
|
{
|
|
2939
3477
|
ref,
|
|
@@ -2957,11 +3495,11 @@ function SelectItem({
|
|
|
2957
3495
|
rich: parts.rich || void 0
|
|
2958
3496
|
}),
|
|
2959
3497
|
children: [
|
|
2960
|
-
multiple ? /* @__PURE__ */
|
|
3498
|
+
multiple ? /* @__PURE__ */ jsx27(Checkbox.Indicator, { checked: isSelected, disabled, size: stepDown(size) }) : null,
|
|
2961
3499
|
sizeMedia(parts.leading, size),
|
|
2962
|
-
/* @__PURE__ */
|
|
3500
|
+
/* @__PURE__ */ jsx27("span", { className: Select_default.itemText, children: /* @__PURE__ */ jsx27(OptionQueryContext.Provider, { value: query, children: highlightChildren(parts.body, query) }) }),
|
|
2963
3501
|
parts.meta,
|
|
2964
|
-
multiple ? null : /* @__PURE__ */
|
|
3502
|
+
multiple ? null : /* @__PURE__ */ jsx27("span", { className: menu_default.check, "aria-hidden": "true", children: isSelected ? /* @__PURE__ */ jsx27(Icon, { name: "action.check" }) : null })
|
|
2965
3503
|
]
|
|
2966
3504
|
}
|
|
2967
3505
|
)
|
|
@@ -2970,7 +3508,7 @@ function SelectItem({
|
|
|
2970
3508
|
SelectItem.displayName = "Select.Item";
|
|
2971
3509
|
|
|
2972
3510
|
// src/components/select/Select.tsx
|
|
2973
|
-
import { jsx as
|
|
3511
|
+
import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2974
3512
|
var SELECT_LABELS = {
|
|
2975
3513
|
search: "\u041F\u043E\u0438\u0441\u043A",
|
|
2976
3514
|
empty: "\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",
|
|
@@ -3007,14 +3545,14 @@ function SelectRoot(props) {
|
|
|
3007
3545
|
...rest
|
|
3008
3546
|
} = props;
|
|
3009
3547
|
const multiple = props.multiple === true;
|
|
3010
|
-
const labels =
|
|
3548
|
+
const labels = React34.useMemo(() => ({ ...SELECT_LABELS, ...labelsProp }), [labelsProp]);
|
|
3011
3549
|
const ids = useFieldFrame(id, { hint, error, invalid });
|
|
3012
3550
|
const [value, setValue] = useControllableState({
|
|
3013
3551
|
value: props.value,
|
|
3014
3552
|
defaultValue: props.defaultValue ?? (multiple ? [] : void 0),
|
|
3015
3553
|
onChange: props.onValueChange
|
|
3016
3554
|
});
|
|
3017
|
-
const selected =
|
|
3555
|
+
const selected = React34.useMemo(
|
|
3018
3556
|
() => Array.isArray(value) ? value : value ? [value] : [],
|
|
3019
3557
|
[value]
|
|
3020
3558
|
);
|
|
@@ -3024,11 +3562,11 @@ function SelectRoot(props) {
|
|
|
3024
3562
|
onChange: onOpenChange
|
|
3025
3563
|
});
|
|
3026
3564
|
const highlight = useCreateStore(void 0);
|
|
3027
|
-
const [registry] =
|
|
3028
|
-
const [query, setQuery] =
|
|
3029
|
-
const triggerRef =
|
|
3565
|
+
const [registry] = React34.useState(createItemRegistry);
|
|
3566
|
+
const [query, setQuery] = React34.useState("");
|
|
3567
|
+
const triggerRef = React34.useRef(null);
|
|
3030
3568
|
if (!isOpen && query !== "") setQuery("");
|
|
3031
|
-
const pick =
|
|
3569
|
+
const pick = React34.useCallback(
|
|
3032
3570
|
(optionValue) => {
|
|
3033
3571
|
if (multiple) {
|
|
3034
3572
|
setValue((prev) => {
|
|
@@ -3042,8 +3580,8 @@ function SelectRoot(props) {
|
|
|
3042
3580
|
},
|
|
3043
3581
|
[multiple, setValue, setOpen]
|
|
3044
3582
|
);
|
|
3045
|
-
const clear =
|
|
3046
|
-
const context =
|
|
3583
|
+
const clear = React34.useCallback(() => setValue(multiple ? [] : ""), [multiple, setValue]);
|
|
3584
|
+
const context = React34.useMemo(
|
|
3047
3585
|
() => ({
|
|
3048
3586
|
size,
|
|
3049
3587
|
invalid: ids.invalid,
|
|
@@ -3092,7 +3630,7 @@ function SelectRoot(props) {
|
|
|
3092
3630
|
labels
|
|
3093
3631
|
]
|
|
3094
3632
|
);
|
|
3095
|
-
return /* @__PURE__ */
|
|
3633
|
+
return /* @__PURE__ */ jsx28(
|
|
3096
3634
|
FieldFrame,
|
|
3097
3635
|
{
|
|
3098
3636
|
...rest,
|
|
@@ -3106,7 +3644,7 @@ function SelectRoot(props) {
|
|
|
3106
3644
|
disabled,
|
|
3107
3645
|
optionalLabel: labels.optional,
|
|
3108
3646
|
className,
|
|
3109
|
-
children: /* @__PURE__ */
|
|
3647
|
+
children: /* @__PURE__ */ jsx28(SelectProvider, { value: context, children: /* @__PURE__ */ jsx28(ControlSizeProvider, { value: size, children }) })
|
|
3110
3648
|
}
|
|
3111
3649
|
);
|
|
3112
3650
|
}
|
|
@@ -3140,7 +3678,7 @@ function SelectTrigger({
|
|
|
3140
3678
|
} = useSelectContext();
|
|
3141
3679
|
const mergedRef = useMergedRefs(triggerRef, ref);
|
|
3142
3680
|
const showClear = clearable && selected.length > 0 && !disabled && !loading;
|
|
3143
|
-
return /* @__PURE__ */
|
|
3681
|
+
return /* @__PURE__ */ jsxs17(
|
|
3144
3682
|
"button",
|
|
3145
3683
|
{
|
|
3146
3684
|
...rest,
|
|
@@ -3181,11 +3719,11 @@ function SelectTrigger({
|
|
|
3181
3719
|
"focus-ring": focusRing ? void 0 : false
|
|
3182
3720
|
}),
|
|
3183
3721
|
children: [
|
|
3184
|
-
/* @__PURE__ */
|
|
3722
|
+
/* @__PURE__ */ jsx28("span", { className: Select_default.triggerMain, children }),
|
|
3185
3723
|
showClear ? (
|
|
3186
3724
|
// A segment, not a button: interactive content inside a <button> is invalid. The keyboard
|
|
3187
3725
|
// clears with Delete / Backspace on the trigger.
|
|
3188
|
-
/* @__PURE__ */
|
|
3726
|
+
/* @__PURE__ */ jsx28(
|
|
3189
3727
|
"span",
|
|
3190
3728
|
{
|
|
3191
3729
|
className: Select_default.clear,
|
|
@@ -3197,11 +3735,11 @@ function SelectTrigger({
|
|
|
3197
3735
|
event.stopPropagation();
|
|
3198
3736
|
clear();
|
|
3199
3737
|
},
|
|
3200
|
-
children: /* @__PURE__ */
|
|
3738
|
+
children: /* @__PURE__ */ jsx28(Icon, { name: "action.close" })
|
|
3201
3739
|
}
|
|
3202
3740
|
)
|
|
3203
3741
|
) : null,
|
|
3204
|
-
/* @__PURE__ */
|
|
3742
|
+
/* @__PURE__ */ jsx28("span", { className: Select_default.chevron, "aria-hidden": "true", children: loading ? /* @__PURE__ */ jsx28(Spinner, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx28(Icon, { name: "nav.chevronDown" }) })
|
|
3205
3743
|
]
|
|
3206
3744
|
}
|
|
3207
3745
|
);
|
|
@@ -3213,7 +3751,7 @@ function SelectValue({ renderValue, className, ...rest }) {
|
|
|
3213
3751
|
if (selected.length > 0 && renderValue && !multiple) {
|
|
3214
3752
|
const value = selected[0] ?? "";
|
|
3215
3753
|
const parts = splitItemChildren(renderValue({ value, label: text }));
|
|
3216
|
-
return /* @__PURE__ */
|
|
3754
|
+
return /* @__PURE__ */ jsxs17(
|
|
3217
3755
|
"span",
|
|
3218
3756
|
{
|
|
3219
3757
|
...rest,
|
|
@@ -3221,12 +3759,12 @@ function SelectValue({ renderValue, className, ...rest }) {
|
|
|
3221
3759
|
...toDataAttributes({ rich: parts.rich || void 0 }),
|
|
3222
3760
|
children: [
|
|
3223
3761
|
sizeMedia(parts.leading, size),
|
|
3224
|
-
/* @__PURE__ */
|
|
3762
|
+
/* @__PURE__ */ jsx28("span", { className: Select_default.valueBody, children: parts.body })
|
|
3225
3763
|
]
|
|
3226
3764
|
}
|
|
3227
3765
|
);
|
|
3228
3766
|
}
|
|
3229
|
-
return /* @__PURE__ */
|
|
3767
|
+
return /* @__PURE__ */ jsx28(
|
|
3230
3768
|
"span",
|
|
3231
3769
|
{
|
|
3232
3770
|
...rest,
|
|
@@ -3238,7 +3776,7 @@ function SelectValue({ renderValue, className, ...rest }) {
|
|
|
3238
3776
|
}
|
|
3239
3777
|
SelectValue.displayName = "Select.Value";
|
|
3240
3778
|
function SelectTriggerIcon({ className, ...rest }) {
|
|
3241
|
-
return /* @__PURE__ */
|
|
3779
|
+
return /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: cx(Select_default.triggerIcon, className), ...rest });
|
|
3242
3780
|
}
|
|
3243
3781
|
SelectTriggerIcon.displayName = "Select.TriggerIcon";
|
|
3244
3782
|
function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
@@ -3258,7 +3796,7 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3258
3796
|
labels,
|
|
3259
3797
|
registry
|
|
3260
3798
|
} = useSelectContext();
|
|
3261
|
-
const listboxRef =
|
|
3799
|
+
const listboxRef = React34.useRef(null);
|
|
3262
3800
|
const floating = useFloatingLayer({
|
|
3263
3801
|
open: isOpen,
|
|
3264
3802
|
onOpenChange: setOpen,
|
|
@@ -3289,9 +3827,9 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3289
3827
|
}
|
|
3290
3828
|
handleListboxKeyDown(event, { items, highlight, onSelect: pick });
|
|
3291
3829
|
};
|
|
3292
|
-
if (!floating.mounted) return /* @__PURE__ */
|
|
3830
|
+
if (!floating.mounted) return /* @__PURE__ */ jsx28("div", { hidden: true, children });
|
|
3293
3831
|
const activeDescendant = isOpen && highlighted !== void 0 ? optionDomId(listboxId, highlighted) : void 0;
|
|
3294
|
-
return /* @__PURE__ */
|
|
3832
|
+
return /* @__PURE__ */ jsxs17(
|
|
3295
3833
|
FloatingPanel,
|
|
3296
3834
|
{
|
|
3297
3835
|
...rest,
|
|
@@ -3303,9 +3841,9 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3303
3841
|
children: [
|
|
3304
3842
|
searchable ? (
|
|
3305
3843
|
// The permanent focus of the panel: no ring, the caret is the indicator (foundation §7).
|
|
3306
|
-
/* @__PURE__ */
|
|
3307
|
-
/* @__PURE__ */
|
|
3308
|
-
/* @__PURE__ */
|
|
3844
|
+
/* @__PURE__ */ jsxs17("div", { className: cx(menu_default.searchRow, Select_default.search), "data-focus-ring": "false", children: [
|
|
3845
|
+
/* @__PURE__ */ jsx28(Icon, { name: "action.search", size: "s" }),
|
|
3846
|
+
/* @__PURE__ */ jsx28(
|
|
3309
3847
|
"input",
|
|
3310
3848
|
{
|
|
3311
3849
|
type: "text",
|
|
@@ -3324,11 +3862,11 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3324
3862
|
)
|
|
3325
3863
|
] })
|
|
3326
3864
|
) : null,
|
|
3327
|
-
loading ? /* @__PURE__ */
|
|
3328
|
-
/* @__PURE__ */
|
|
3865
|
+
loading ? /* @__PURE__ */ jsxs17("div", { className: Select_default.status, role: "status", children: [
|
|
3866
|
+
/* @__PURE__ */ jsx28(Spinner, { "aria-hidden": "true" }),
|
|
3329
3867
|
labels.loading
|
|
3330
3868
|
] }) : null,
|
|
3331
|
-
/* @__PURE__ */
|
|
3869
|
+
/* @__PURE__ */ jsx28(
|
|
3332
3870
|
ScrollContainer,
|
|
3333
3871
|
{
|
|
3334
3872
|
ref: listboxRef,
|
|
@@ -3344,11 +3882,11 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3344
3882
|
children
|
|
3345
3883
|
}
|
|
3346
3884
|
),
|
|
3347
|
-
isEmpty && !loading ? /* @__PURE__ */
|
|
3348
|
-
/* @__PURE__ */
|
|
3349
|
-
query !== "" && labels.emptyHint ? /* @__PURE__ */
|
|
3885
|
+
isEmpty && !loading ? /* @__PURE__ */ jsxs17(EmptyPage.Root, { layout: "compact", role: "status", children: [
|
|
3886
|
+
/* @__PURE__ */ jsx28(EmptyPage.Title, { as: "p", children: labels.empty }),
|
|
3887
|
+
query !== "" && labels.emptyHint ? /* @__PURE__ */ jsx28(EmptyPage.Description, { children: labels.emptyHint }) : null
|
|
3350
3888
|
] }) : null,
|
|
3351
|
-
/* @__PURE__ */
|
|
3889
|
+
/* @__PURE__ */ jsx28(HighlightOnOpen, { listboxRef, highlight })
|
|
3352
3890
|
]
|
|
3353
3891
|
}
|
|
3354
3892
|
);
|
|
@@ -3359,9 +3897,9 @@ function HighlightOnOpen({
|
|
|
3359
3897
|
highlight
|
|
3360
3898
|
}) {
|
|
3361
3899
|
const { isOpen, query, selected } = useSelectContext();
|
|
3362
|
-
const selectedRef =
|
|
3900
|
+
const selectedRef = React34.useRef(selected);
|
|
3363
3901
|
selectedRef.current = selected;
|
|
3364
|
-
|
|
3902
|
+
React34.useLayoutEffect(() => {
|
|
3365
3903
|
if (!isOpen) return;
|
|
3366
3904
|
const options = enabledOptions(listboxRef.current);
|
|
3367
3905
|
const first = options.find((item) => selectedRef.current.includes(item.dataset.value ?? ""));
|
|
@@ -3369,17 +3907,17 @@ function HighlightOnOpen({
|
|
|
3369
3907
|
first?.scrollIntoView?.({ block: "nearest" });
|
|
3370
3908
|
return () => highlight.set(void 0);
|
|
3371
3909
|
}, [isOpen, listboxRef, highlight]);
|
|
3372
|
-
|
|
3910
|
+
React34.useLayoutEffect(() => {
|
|
3373
3911
|
if (query !== "") highlight.set(enabledOptions(listboxRef.current)[0]?.dataset.value);
|
|
3374
3912
|
}, [query, listboxRef, highlight]);
|
|
3375
3913
|
return null;
|
|
3376
3914
|
}
|
|
3377
3915
|
function SelectGroup({ className, ...rest }) {
|
|
3378
|
-
return /* @__PURE__ */
|
|
3916
|
+
return /* @__PURE__ */ jsx28(MenuGroup, { ...rest, className: cx(Select_default.group, className) });
|
|
3379
3917
|
}
|
|
3380
3918
|
SelectGroup.displayName = "Select.Group";
|
|
3381
3919
|
function SelectSeparator({ className, ...rest }) {
|
|
3382
|
-
return /* @__PURE__ */
|
|
3920
|
+
return /* @__PURE__ */ jsx28(Divider, { ...rest, className: cx(menu_default.separator, Select_default.separator, className) });
|
|
3383
3921
|
}
|
|
3384
3922
|
SelectSeparator.displayName = "Select.Separator";
|
|
3385
3923
|
var Select = {
|
|
@@ -3407,12 +3945,16 @@ export {
|
|
|
3407
3945
|
fieldTierClass,
|
|
3408
3946
|
fieldTriggerClass,
|
|
3409
3947
|
iconLayout,
|
|
3948
|
+
prefersReducedMotion,
|
|
3949
|
+
motionDurationMs,
|
|
3950
|
+
exitTimeoutMs,
|
|
3951
|
+
usePresence,
|
|
3952
|
+
visuallyHiddenClass,
|
|
3953
|
+
VisuallyHidden,
|
|
3410
3954
|
useMergedRefs,
|
|
3411
3955
|
Slot,
|
|
3412
3956
|
touchTargetBlockClass,
|
|
3413
3957
|
textTone_default,
|
|
3414
|
-
visuallyHiddenClass,
|
|
3415
|
-
VisuallyHidden,
|
|
3416
3958
|
Spinner,
|
|
3417
3959
|
Button,
|
|
3418
3960
|
Divider,
|
|
@@ -3421,12 +3963,16 @@ export {
|
|
|
3421
3963
|
useEdgeOverflow,
|
|
3422
3964
|
ScrollContainer,
|
|
3423
3965
|
palette_default,
|
|
3966
|
+
RollingNumber,
|
|
3424
3967
|
createComponentContext,
|
|
3425
3968
|
createImageSlot,
|
|
3426
3969
|
useControllableState,
|
|
3427
3970
|
overlayMotion_default,
|
|
3428
3971
|
Portal,
|
|
3429
3972
|
sheet_default,
|
|
3973
|
+
useNestedSurfaceDepth,
|
|
3974
|
+
SurfaceDepthProvider,
|
|
3975
|
+
useStageDepth,
|
|
3430
3976
|
focusInto,
|
|
3431
3977
|
focusBack,
|
|
3432
3978
|
activeElement,
|
|
@@ -3439,10 +3985,6 @@ export {
|
|
|
3439
3985
|
AnchorRectProvider,
|
|
3440
3986
|
readCssLengthPx,
|
|
3441
3987
|
getViewportPadPx,
|
|
3442
|
-
prefersReducedMotion,
|
|
3443
|
-
motionDurationMs,
|
|
3444
|
-
exitTimeoutMs,
|
|
3445
|
-
usePresence,
|
|
3446
3988
|
useScrollLock,
|
|
3447
3989
|
useSwipeDismiss,
|
|
3448
3990
|
useFloatingLayer,
|
|
@@ -3487,6 +4029,11 @@ export {
|
|
|
3487
4029
|
handleListboxKeyDown,
|
|
3488
4030
|
menu_default,
|
|
3489
4031
|
MenuGroup,
|
|
4032
|
+
resolveValue,
|
|
4033
|
+
DEFAULT_PROGRESS_SEGMENTS_LABELS,
|
|
4034
|
+
resolveSegments,
|
|
4035
|
+
ProgressBar,
|
|
4036
|
+
getPasswordStrength,
|
|
3490
4037
|
Input,
|
|
3491
4038
|
Thumbnail,
|
|
3492
4039
|
Select
|