prime-ui-kit 0.13.1 → 0.14.0
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 +7 -6
- package/dist/chunks/{chunk-XNOJEX55.js → chunk-P6ZO37JM.js} +1 -1
- package/dist/chunks/{chunk-JV2KB5JZ.js → chunk-SYEX7OVT.js} +3572 -2865
- package/dist/chunks/{chunk-PK2GC77E.js → chunk-WXKRUVSE.js} +164 -140
- package/dist/color-picker.js +2 -2
- package/dist/components/banner/Banner.d.ts +5 -2
- package/dist/components/chart-frame/ChartFrame.d.ts +19 -6
- package/dist/components/chat/Chat.d.ts +2 -2
- package/dist/components/chat/ChatPinned.d.ts +2 -2
- package/dist/components/chat/MessageList.d.ts +1 -1
- package/dist/components/chat/chatContext.d.ts +1 -1
- package/dist/components/field-list/FieldList.d.ts +90 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/input/Input.d.ts +2 -2
- package/dist/components/kanban/Kanban.d.ts +6 -3
- package/dist/components/page-content/PageContent.d.ts +55 -4
- package/dist/components/sparkline/Sparkline.d.ts +64 -15
- package/dist/components/sparkline/geometry.d.ts +26 -0
- package/dist/components/tooltip/Tooltip.d.ts +5 -2
- package/dist/hooks/usePosition.d.ts +15 -4
- package/dist/index.css +1 -1
- package/dist/index.js +4 -2
- package/dist/internal/ChartTooltip.d.ts +26 -0
- package/dist/internal/FieldAction.d.ts +6 -7
- package/dist/internal/fieldCell.d.ts +21 -0
- package/dist/internal/messageList.d.ts +2 -2
- package/dist/internal/palette.d.ts +7 -0
- package/dist/skill/SKILL.md +24 -14
- package/dist/skill/anti-slop.md +77 -4
- package/dist/skill/cheatsheet.md +24 -5
- package/dist/skill/checklist.md +19 -1
- package/dist/skill/choosing.md +10 -5
- package/dist/skill/components.md +4 -3
- package/dist/skill/composition.md +28 -15
- package/dist/skill/foundations.md +8 -6
- package/dist/skill/layouts.md +6 -6
- package/dist/skill/patterns/app-shell.module.css +1 -8
- package/dist/skill/patterns/app-shell.tsx +11 -9
- package/dist/skill/patterns/chat.tsx +23 -5
- package/dist/skill/patterns/dashboard.module.css +1 -31
- package/dist/skill/patterns/dashboard.tsx +150 -136
- package/dist/skill/patterns/detail-page.module.css +0 -3
- package/dist/skill/patterns/detail-page.tsx +4 -7
- package/dist/skill/patterns/form-drawer.tsx +2 -2
- package/dist/skill/patterns/kanban-board.tsx +4 -2
- package/dist/skill/patterns/list-page.tsx +2 -2
- package/dist/skill/patterns/media-library.module.css +0 -22
- package/dist/skill/patterns/media-library.tsx +17 -18
- package/dist/skill/patterns/record-editor.module.css +18 -0
- package/dist/skill/patterns/record-editor.tsx +356 -0
- package/dist/skill/patterns/screen-states.module.css +3 -17
- package/dist/skill/patterns/screen-states.tsx +70 -69
- package/dist/skill/patterns/settings-page.module.css +1 -21
- package/dist/skill/patterns/settings-page.tsx +58 -79
- package/dist/skill/reference/components/avatar/COMPONENT.md +4 -4
- package/dist/skill/reference/components/avatar/examples/presence.tsx +1 -1
- package/dist/skill/reference/components/avatar/examples/states.tsx +1 -1
- package/dist/skill/reference/components/banner/COMPONENT.md +6 -6
- package/dist/skill/reference/components/banner/examples/dismissible.tsx +22 -11
- package/dist/skill/reference/components/banner/examples/examples.module.css +3 -3
- package/dist/skill/reference/components/banner/examples/narrow.tsx +1 -1
- package/dist/skill/reference/components/breadcrumb/COMPONENT.md +1 -1
- package/dist/skill/reference/components/breadcrumb/examples/overflow.tsx +1 -1
- package/dist/skill/reference/components/card/COMPONENT.md +5 -4
- package/dist/skill/reference/components/card/examples/examples.module.css +0 -28
- package/dist/skill/reference/components/card/examples/kpi-media.tsx +13 -11
- package/dist/skill/reference/components/card/examples/narrow.tsx +1 -1
- package/dist/skill/reference/components/card/examples/panel-chart.tsx +45 -22
- package/dist/skill/reference/components/chart-frame/COMPONENT.md +10 -7
- package/dist/skill/reference/components/chart-frame/examples/tooltip.tsx +20 -24
- package/dist/skill/reference/components/chat/COMPONENT.md +3 -3
- package/dist/skill/reference/components/chat/examples/search.tsx +1 -1
- package/dist/skill/reference/components/chat-list/COMPONENT.md +1 -1
- package/dist/skill/reference/components/checkbox/examples/indicator.tsx +24 -2
- package/dist/skill/reference/components/color-picker/COMPONENT.md +2 -2
- package/dist/skill/reference/components/color-swatches/COMPONENT.md +1 -0
- package/dist/skill/reference/components/datepicker/COMPONENT.md +1 -0
- package/dist/skill/reference/components/dnd/COMPONENT.md +3 -3
- package/dist/skill/reference/components/field-list/COMPONENT.md +164 -0
- package/dist/skill/reference/components/field-list/examples/base-row.tsx +76 -0
- package/dist/skill/reference/components/field-list/examples/controlled.tsx +72 -0
- package/dist/skill/reference/components/field-list/examples/errors.tsx +85 -0
- package/dist/skill/reference/components/field-list/examples/examples.module.css +34 -0
- package/dist/skill/reference/components/field-list/examples/limits.tsx +55 -0
- package/dist/skill/reference/components/field-list/examples/locked.tsx +139 -0
- package/dist/skill/reference/components/field-list/examples/narrow.tsx +68 -0
- package/dist/skill/reference/components/field-list/examples/overview.tsx +66 -0
- package/dist/skill/reference/components/field-list/examples/reorder.tsx +42 -0
- package/dist/skill/reference/components/field-list/examples/sizes.tsx +42 -0
- package/dist/skill/reference/components/field-list/examples/states.tsx +51 -0
- package/dist/skill/reference/components/input/examples/examples.module.css +2 -7
- package/dist/skill/reference/components/kanban/COMPONENT.md +13 -9
- package/dist/skill/reference/components/kanban/examples/limits.tsx +2 -1
- package/dist/skill/reference/components/kanban/examples/variants.tsx +16 -8
- package/dist/skill/reference/components/list/COMPONENT.md +1 -1
- package/dist/skill/reference/components/media-viewer/COMPONENT.md +2 -2
- package/dist/skill/reference/components/message/COMPONENT.md +2 -2
- package/dist/skill/reference/components/notification/COMPONENT.md +1 -0
- package/dist/skill/reference/components/page-content/COMPONENT.md +70 -14
- package/dist/skill/reference/components/page-content/examples/grid.tsx +107 -0
- package/dist/skill/reference/components/page-content/examples/overview.tsx +2 -2
- package/dist/skill/reference/components/page-content/examples/sections.tsx +81 -0
- package/dist/skill/reference/components/page-toolbar/COMPONENT.md +1 -1
- package/dist/skill/reference/components/segmented-control/COMPONENT.md +1 -0
- package/dist/skill/reference/components/select/COMPONENT.md +4 -2
- package/dist/skill/reference/components/select/examples/icon-only.tsx +38 -0
- package/dist/skill/reference/components/sparkline/COMPONENT.md +83 -30
- package/dist/skill/reference/components/sparkline/examples/compact.tsx +1 -1
- package/dist/skill/reference/components/sparkline/examples/curve.tsx +28 -0
- package/dist/skill/reference/components/sparkline/examples/gaps.tsx +33 -0
- package/dist/skill/reference/components/sparkline/examples/overview.tsx +11 -2
- package/dist/skill/reference/components/sparkline/examples/period.tsx +7 -2
- package/dist/skill/reference/components/sparkline/examples/reference.tsx +37 -0
- package/dist/skill/reference/components/sparkline/examples/variants.tsx +2 -2
- package/dist/skill/reference/components/tabs/examples/examples.module.css +0 -6
- package/dist/skill/reference/components/tabs/examples/in-drawer.tsx +11 -13
- package/dist/skill/reference/components/timeline/examples/examples.module.css +0 -8
- package/dist/skill/reference/components/timeline/examples/narrow.tsx +2 -2
- package/dist/skill/reference/components/timeline/examples/sizes.tsx +3 -3
- package/dist/skill/reference/components/timeline/examples/variants.tsx +4 -4
- package/dist/skill/reference/components/tooltip/COMPONENT.md +6 -4
- package/dist/skill/reference/components/tooltip/examples/placement.tsx +2 -1
- package/dist/skill/reference/components/video-note/COMPONENT.md +1 -1
- package/dist/skill/reference/components/voice-player/COMPONENT.md +1 -1
- package/dist/skill/reference/layout/app-header/examples/in-app-shell.tsx +2 -2
- package/dist/skill/reference/layout/app-shell/COMPONENT.md +1 -1
- package/dist/skill/reference/layout/app-shell/examples/footer.tsx +2 -2
- package/dist/skill/reference/layout/app-shell/examples/overview.tsx +2 -2
- package/dist/skill/reference/layout/app-shell/examples/template.tsx +2 -2
- package/dist/skill/reference/layout/bottom-nav/examples/floating-action.tsx +2 -2
- package/dist/skill/reference/layout/bottom-nav/examples/floating.tsx +2 -2
- package/dist/skill/reference/layout/bottom-nav/examples/in-app-shell.tsx +2 -2
- package/dist/skill/responsive.md +5 -3
- package/dist/skill/ux.md +145 -0
- package/dist/tokens/semantic.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/avatar/COMPONENT.md +4 -4
- package/src/components/avatar/examples/presence.tsx +1 -1
- package/src/components/avatar/examples/states.tsx +1 -1
- package/src/components/banner/COMPONENT.md +6 -6
- package/src/components/banner/examples/dismissible.tsx +22 -11
- package/src/components/banner/examples/examples.module.css +3 -3
- package/src/components/banner/examples/narrow.tsx +1 -1
- package/src/components/breadcrumb/COMPONENT.md +1 -1
- package/src/components/breadcrumb/examples/overflow.tsx +1 -1
- package/src/components/card/COMPONENT.md +5 -4
- package/src/components/card/examples/examples.module.css +0 -28
- package/src/components/card/examples/kpi-media.tsx +13 -11
- package/src/components/card/examples/narrow.tsx +1 -1
- package/src/components/card/examples/panel-chart.tsx +45 -22
- package/src/components/chart-frame/COMPONENT.md +10 -7
- package/src/components/chart-frame/examples/tooltip.tsx +20 -24
- package/src/components/chat/COMPONENT.md +3 -3
- package/src/components/chat/examples/search.tsx +1 -1
- package/src/components/chat-list/COMPONENT.md +1 -1
- package/src/components/checkbox/examples/indicator.tsx +24 -2
- package/src/components/color-picker/COMPONENT.md +2 -2
- package/src/components/color-swatches/COMPONENT.md +1 -0
- package/src/components/datepicker/COMPONENT.md +1 -0
- package/src/components/dnd/COMPONENT.md +3 -3
- package/src/components/field-list/COMPONENT.md +164 -0
- package/src/components/field-list/examples/base-row.tsx +76 -0
- package/src/components/field-list/examples/controlled.tsx +72 -0
- package/src/components/field-list/examples/errors.tsx +85 -0
- package/src/components/field-list/examples/examples.module.css +34 -0
- package/src/components/field-list/examples/limits.tsx +55 -0
- package/src/components/field-list/examples/locked.tsx +139 -0
- package/src/components/field-list/examples/narrow.tsx +68 -0
- package/src/components/field-list/examples/overview.tsx +66 -0
- package/src/components/field-list/examples/reorder.tsx +42 -0
- package/src/components/field-list/examples/sizes.tsx +42 -0
- package/src/components/field-list/examples/states.tsx +51 -0
- package/src/components/input/examples/examples.module.css +2 -7
- package/src/components/kanban/COMPONENT.md +13 -9
- package/src/components/kanban/examples/limits.tsx +2 -1
- package/src/components/kanban/examples/variants.tsx +16 -8
- package/src/components/list/COMPONENT.md +1 -1
- package/src/components/media-viewer/COMPONENT.md +2 -2
- package/src/components/message/COMPONENT.md +2 -2
- package/src/components/notification/COMPONENT.md +1 -0
- package/src/components/page-content/COMPONENT.md +70 -14
- package/src/components/page-content/examples/grid.tsx +107 -0
- package/src/components/page-content/examples/overview.tsx +2 -2
- package/src/components/page-content/examples/sections.tsx +81 -0
- package/src/components/page-toolbar/COMPONENT.md +1 -1
- package/src/components/segmented-control/COMPONENT.md +1 -0
- package/src/components/select/COMPONENT.md +4 -2
- package/src/components/select/examples/icon-only.tsx +38 -0
- package/src/components/sparkline/COMPONENT.md +83 -30
- package/src/components/sparkline/examples/compact.tsx +1 -1
- package/src/components/sparkline/examples/curve.tsx +28 -0
- package/src/components/sparkline/examples/gaps.tsx +33 -0
- package/src/components/sparkline/examples/overview.tsx +11 -2
- package/src/components/sparkline/examples/period.tsx +7 -2
- package/src/components/sparkline/examples/reference.tsx +37 -0
- package/src/components/sparkline/examples/variants.tsx +2 -2
- package/src/components/tabs/examples/examples.module.css +0 -6
- package/src/components/tabs/examples/in-drawer.tsx +11 -13
- package/src/components/timeline/examples/examples.module.css +0 -8
- package/src/components/timeline/examples/narrow.tsx +2 -2
- package/src/components/timeline/examples/sizes.tsx +3 -3
- package/src/components/timeline/examples/variants.tsx +4 -4
- package/src/components/tooltip/COMPONENT.md +6 -4
- package/src/components/tooltip/examples/placement.tsx +2 -1
- package/src/components/video-note/COMPONENT.md +1 -1
- package/src/components/voice-player/COMPONENT.md +1 -1
- package/src/layout/app-header/examples/in-app-shell.tsx +2 -2
- package/src/layout/app-shell/COMPONENT.md +1 -1
- package/src/layout/app-shell/examples/footer.tsx +2 -2
- package/src/layout/app-shell/examples/overview.tsx +2 -2
- package/src/layout/app-shell/examples/template.tsx +2 -2
- package/src/layout/bottom-nav/examples/floating-action.tsx +2 -2
- package/src/layout/bottom-nav/examples/floating.tsx +2 -2
- package/src/layout/bottom-nav/examples/in-app-shell.tsx +2 -2
- package/src/styles/theme-light.css +1 -0
|
@@ -567,16 +567,16 @@ function MorphText({ children: text, className }) {
|
|
|
567
567
|
React6.useLayoutEffect(() => {
|
|
568
568
|
if (!morph) return;
|
|
569
569
|
const root = rootRef.current;
|
|
570
|
-
const
|
|
570
|
+
const segment2 = segmentRef.current;
|
|
571
571
|
const sizer = sizerRef.current;
|
|
572
|
-
if (!root || !
|
|
572
|
+
if (!root || !segment2 || !sizer) return;
|
|
573
573
|
const target = sizer.getBoundingClientRect().width;
|
|
574
574
|
const still = root.getBoundingClientRect().width - target;
|
|
575
575
|
const from = Math.max(0, morph.width - still);
|
|
576
576
|
if (target !== from) {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
577
|
+
segment2.style.width = `${from}px`;
|
|
578
|
+
segment2.getBoundingClientRect();
|
|
579
|
+
segment2.style.width = `${target}px`;
|
|
580
580
|
}
|
|
581
581
|
const changed = splitChange(morph.from, morph.to);
|
|
582
582
|
const longest = changed.in.length > changed.out.length ? changed.in : changed.out;
|
|
@@ -1272,6 +1272,9 @@ function readCssLengthPx(name, fallbackPx) {
|
|
|
1272
1272
|
function getViewportPadPx() {
|
|
1273
1273
|
return readCssLengthPx("--prime-space-2", FALLBACK_VIEWPORT_PAD_PX);
|
|
1274
1274
|
}
|
|
1275
|
+
function pointRect(x, y) {
|
|
1276
|
+
return { left: x, right: x, top: y, bottom: y, width: 0, height: 0 };
|
|
1277
|
+
}
|
|
1275
1278
|
var clamp = (value, min, max) => Math.max(min, Math.min(value, Math.max(min, max)));
|
|
1276
1279
|
function computeFloatingPosition(anchor, contentW, contentH, vw, vh, opts) {
|
|
1277
1280
|
const { align, offset, flip, matchAnchorWidth, arrowInset: arrowInset2, boundary } = opts;
|
|
@@ -1346,13 +1349,16 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
1346
1349
|
align = DEFAULT_ALIGN,
|
|
1347
1350
|
matchAnchorWidth = false,
|
|
1348
1351
|
offsetToken = "--prime-panel-offset",
|
|
1349
|
-
arrowInset: arrowInset2
|
|
1352
|
+
arrowInset: arrowInset2,
|
|
1353
|
+
anchorPoint = null
|
|
1350
1354
|
} = {}) {
|
|
1351
1355
|
const [attached, setAttached] = React12.useState(false);
|
|
1352
1356
|
const [resolvedSide, setResolvedSide] = React12.useState(preferredSide);
|
|
1353
1357
|
const resolveAnchorRect = useAnchorRectResolver();
|
|
1354
1358
|
const resolveBoundary = useFloatingBoundaryResolver();
|
|
1355
1359
|
const metricsRef = React12.useRef(null);
|
|
1360
|
+
const pointRef = React12.useRef(anchorPoint);
|
|
1361
|
+
pointRef.current = anchorPoint;
|
|
1356
1362
|
const update = React12.useCallback(
|
|
1357
1363
|
(remeasure) => {
|
|
1358
1364
|
const anchor = anchorRef.current;
|
|
@@ -1367,7 +1373,8 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
1367
1373
|
}
|
|
1368
1374
|
const { offset, pad, arrow } = metricsRef.current;
|
|
1369
1375
|
const rawRect = anchor.getBoundingClientRect();
|
|
1370
|
-
const
|
|
1376
|
+
const point = pointRef.current;
|
|
1377
|
+
const rect = point ? pointRect(rawRect.left + point.x, rawRect.top + point.y) : resolveAnchorRect ? resolveAnchorRect(anchor, rawRect) : rawRect;
|
|
1371
1378
|
const boundary = resolveBoundary?.(anchor) ?? void 0;
|
|
1372
1379
|
const compute = (width2, height2) => computeFloatingPosition(rect, width2, height2, window.innerWidth, window.innerHeight, {
|
|
1373
1380
|
side: preferredSide,
|
|
@@ -1432,6 +1439,11 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
1432
1439
|
React12.useLayoutEffect(() => {
|
|
1433
1440
|
if (active2) update(true);
|
|
1434
1441
|
}, [active2, update]);
|
|
1442
|
+
const pointX = anchorPoint?.x;
|
|
1443
|
+
const pointY = anchorPoint?.y;
|
|
1444
|
+
React12.useLayoutEffect(() => {
|
|
1445
|
+
if (active2 && pointX !== void 0 && pointY !== void 0) updateRef.current(false);
|
|
1446
|
+
}, [active2, pointX, pointY]);
|
|
1435
1447
|
React12.useLayoutEffect(() => {
|
|
1436
1448
|
if (!active2) return;
|
|
1437
1449
|
let frame2 = 0;
|
|
@@ -3930,8 +3942,8 @@ function resolveValue(value, max) {
|
|
|
3930
3942
|
percent: Math.round(clamped / top * 100)
|
|
3931
3943
|
};
|
|
3932
3944
|
}
|
|
3933
|
-
function segmentFill(
|
|
3934
|
-
return
|
|
3945
|
+
function segmentFill(segment2) {
|
|
3946
|
+
return segment2.color ? { tone: void 0, color: segment2.color } : { tone: segment2.tone ?? "accent", color: void 0 };
|
|
3935
3947
|
}
|
|
3936
3948
|
function resolveRows(input, scale, max) {
|
|
3937
3949
|
const segments = input.map((s) => ({ ...s, value: nonNegative(s.value) }));
|
|
@@ -3941,10 +3953,10 @@ function resolveRows(input, scale, max) {
|
|
|
3941
3953
|
const first = segments[0]?.value ?? 0;
|
|
3942
3954
|
const lengthBase = scale === "max" ? largest : scale === "first" ? first : sum;
|
|
3943
3955
|
const shareBase = scale === "first" ? first : sum;
|
|
3944
|
-
return segments.map((
|
|
3945
|
-
segment,
|
|
3946
|
-
ratio: lengthBase > 0 ? Math.min(1,
|
|
3947
|
-
percent: shareBase > 0 ? Math.round(
|
|
3956
|
+
return segments.map((segment2) => ({
|
|
3957
|
+
segment: segment2,
|
|
3958
|
+
ratio: lengthBase > 0 ? Math.min(1, segment2.value / lengthBase) : 0,
|
|
3959
|
+
percent: shareBase > 0 ? Math.round(segment2.value / shareBase * 100) : 0
|
|
3948
3960
|
}));
|
|
3949
3961
|
}
|
|
3950
3962
|
var NUMBER = new Intl.NumberFormat("ru-RU");
|
|
@@ -3989,9 +4001,9 @@ function ProgressLegend({
|
|
|
3989
4001
|
className
|
|
3990
4002
|
}) {
|
|
3991
4003
|
if (segments.length === 0) return null;
|
|
3992
|
-
return /* @__PURE__ */ jsx23("ul", { id, className: cx(ProgressLegend_default.legend, className), "data-size": size, children: segments.map((
|
|
3993
|
-
const { tone, color } = segmentFill(
|
|
3994
|
-
const share = scale > 0 ? Math.round(
|
|
4004
|
+
return /* @__PURE__ */ jsx23("ul", { id, className: cx(ProgressLegend_default.legend, className), "data-size": size, children: segments.map((segment2, index) => {
|
|
4005
|
+
const { tone, color } = segmentFill(segment2);
|
|
4006
|
+
const share = scale > 0 ? Math.round(segment2.value / scale * 100) : 0;
|
|
3995
4007
|
return (
|
|
3996
4008
|
// biome-ignore lint/suspicious/noArrayIndexKey: parts in source order, like the bar
|
|
3997
4009
|
/* @__PURE__ */ jsxs11("li", { className: ProgressLegend_default.item, children: [
|
|
@@ -4003,8 +4015,8 @@ function ProgressLegend({
|
|
|
4003
4015
|
...toDataAttributes({ tone, color })
|
|
4004
4016
|
}
|
|
4005
4017
|
),
|
|
4006
|
-
/* @__PURE__ */ jsx23("span", { className: ProgressLegend_default.name, children:
|
|
4007
|
-
/* @__PURE__ */ jsx23("span", { className: ProgressLegend_default.value, children: formatValue(
|
|
4018
|
+
/* @__PURE__ */ jsx23("span", { className: ProgressLegend_default.name, children: segment2.label }),
|
|
4019
|
+
/* @__PURE__ */ jsx23("span", { className: ProgressLegend_default.value, children: formatValue(segment2.value) }),
|
|
4008
4020
|
/* @__PURE__ */ jsxs11("span", { className: ProgressLegend_default.share, children: [
|
|
4009
4021
|
share,
|
|
4010
4022
|
"%"
|
|
@@ -4126,12 +4138,12 @@ function ProgressBar(props) {
|
|
|
4126
4138
|
/* @__PURE__ */ jsx24(ProgressLegendSkeleton, { rows: 1, size, className: ProgressBar_default.rowSkeletonText }),
|
|
4127
4139
|
barSkeleton
|
|
4128
4140
|
] }, i)
|
|
4129
|
-
)) }, "loading") : /* @__PURE__ */ jsx24("ol", { className: cx(ProgressBar_default.rows, swapClass), ...nameProps, children: rows.map(({ segment, ratio, percent: share }, i) => (
|
|
4141
|
+
)) }, "loading") : /* @__PURE__ */ jsx24("ol", { className: cx(ProgressBar_default.rows, swapClass), ...nameProps, children: rows.map(({ segment: segment2, ratio, percent: share }, i) => (
|
|
4130
4142
|
// biome-ignore lint/suspicious/noArrayIndexKey: rows in source order
|
|
4131
4143
|
/* @__PURE__ */ jsxs12("li", { className: ProgressBar_default.row, children: [
|
|
4132
4144
|
/* @__PURE__ */ jsxs12("div", { className: ProgressBar_default.rowHeader, children: [
|
|
4133
|
-
/* @__PURE__ */ jsx24("span", { className: ProgressBar_default.rowLabel, children:
|
|
4134
|
-
/* @__PURE__ */ jsx24("span", { className: ProgressBar_default.rowValue, children: formatValue(
|
|
4145
|
+
/* @__PURE__ */ jsx24("span", { className: ProgressBar_default.rowLabel, children: segment2.label }),
|
|
4146
|
+
/* @__PURE__ */ jsx24("span", { className: ProgressBar_default.rowValue, children: formatValue(segment2.value) }),
|
|
4135
4147
|
/* @__PURE__ */ jsxs12("span", { className: ProgressBar_default.rowShare, children: [
|
|
4136
4148
|
share,
|
|
4137
4149
|
"%"
|
|
@@ -4142,7 +4154,7 @@ function ProgressBar(props) {
|
|
|
4142
4154
|
{
|
|
4143
4155
|
className: cx(palette_default.hue, ProgressBar_default.fill),
|
|
4144
4156
|
style: { "--pb-ratio": ratio },
|
|
4145
|
-
...toDataAttributes(segmentFill(
|
|
4157
|
+
...toDataAttributes(segmentFill(segment2))
|
|
4146
4158
|
}
|
|
4147
4159
|
) })
|
|
4148
4160
|
] }, i)
|
|
@@ -4252,7 +4264,7 @@ function getPasswordStrength(value) {
|
|
|
4252
4264
|
}
|
|
4253
4265
|
|
|
4254
4266
|
// src/components/input/Input.tsx
|
|
4255
|
-
import * as
|
|
4267
|
+
import * as React42 from "react";
|
|
4256
4268
|
|
|
4257
4269
|
// src/internal/FieldAction.tsx
|
|
4258
4270
|
import * as React38 from "react";
|
|
@@ -4266,7 +4278,7 @@ var FieldAction_default = {
|
|
|
4266
4278
|
// src/internal/FieldAction.tsx
|
|
4267
4279
|
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4268
4280
|
var fieldActionClass = cx(FieldAction_default.action, touchTargetBlockClass);
|
|
4269
|
-
function
|
|
4281
|
+
function segment({
|
|
4270
4282
|
label,
|
|
4271
4283
|
asChild = false,
|
|
4272
4284
|
className,
|
|
@@ -4282,17 +4294,15 @@ function FieldActionButton({
|
|
|
4282
4294
|
"aria-label": label,
|
|
4283
4295
|
"data-field-action": ""
|
|
4284
4296
|
};
|
|
4297
|
+
return asChild ? /* @__PURE__ */ jsx25(Slot, { ...shared, ref, "aria-disabled": disabled || void 0, children }) : /* @__PURE__ */ jsx25("button", { ...shared, ref, type, disabled, children });
|
|
4298
|
+
}
|
|
4299
|
+
function FieldActionSegment(props) {
|
|
4300
|
+
return segment(props);
|
|
4301
|
+
}
|
|
4302
|
+
function FieldActionButton(props) {
|
|
4285
4303
|
return /* @__PURE__ */ jsxs13(Tooltip.Root, { children: [
|
|
4286
|
-
/* @__PURE__ */ jsx25(Tooltip.Trigger, { children:
|
|
4287
|
-
|
|
4288
|
-
{
|
|
4289
|
-
...shared,
|
|
4290
|
-
ref,
|
|
4291
|
-
"aria-disabled": disabled || void 0,
|
|
4292
|
-
children
|
|
4293
|
-
}
|
|
4294
|
-
) : /* @__PURE__ */ jsx25("button", { ...shared, ref, type, disabled, children }) }),
|
|
4295
|
-
/* @__PURE__ */ jsx25(Tooltip.Content, { children: label })
|
|
4304
|
+
/* @__PURE__ */ jsx25(Tooltip.Trigger, { children: segment(props) }),
|
|
4305
|
+
/* @__PURE__ */ jsx25(Tooltip.Content, { children: props.label })
|
|
4296
4306
|
] });
|
|
4297
4307
|
}
|
|
4298
4308
|
var COPY_FEEDBACK_MS = 1600;
|
|
@@ -4456,7 +4466,14 @@ function FieldCommitStatus({
|
|
|
4456
4466
|
}
|
|
4457
4467
|
|
|
4458
4468
|
// src/internal/FieldFrame.tsx
|
|
4469
|
+
import * as React41 from "react";
|
|
4470
|
+
|
|
4471
|
+
// src/internal/fieldCell.ts
|
|
4459
4472
|
import * as React40 from "react";
|
|
4473
|
+
var FieldCellContext = React40.createContext(null);
|
|
4474
|
+
function useFieldCell() {
|
|
4475
|
+
return React40.useContext(FieldCellContext);
|
|
4476
|
+
}
|
|
4460
4477
|
|
|
4461
4478
|
// src/internal/formatLabel.ts
|
|
4462
4479
|
function formatLabel(template, values) {
|
|
@@ -4470,6 +4487,8 @@ function formatLabel(template, values) {
|
|
|
4470
4487
|
var FieldFrame_default = {
|
|
4471
4488
|
root: "FieldFrame_root",
|
|
4472
4489
|
label: "FieldFrame_label",
|
|
4490
|
+
cellLabel: "FieldFrame_cellLabel",
|
|
4491
|
+
"prime-field-list": "FieldFrame_prime-field-list",
|
|
4473
4492
|
labelRow: "FieldFrame_labelRow",
|
|
4474
4493
|
labelEnd: "FieldFrame_labelEnd",
|
|
4475
4494
|
body: "FieldFrame_body",
|
|
@@ -4494,7 +4513,8 @@ function useFieldFrame(explicitId, {
|
|
|
4494
4513
|
error,
|
|
4495
4514
|
invalid
|
|
4496
4515
|
}, ariaDescribedBy) {
|
|
4497
|
-
const generated =
|
|
4516
|
+
const generated = React41.useId();
|
|
4517
|
+
const cell = useFieldCell();
|
|
4498
4518
|
const controlId = explicitId ?? generated;
|
|
4499
4519
|
const labelId = `${controlId}-label`;
|
|
4500
4520
|
const hintId = `${controlId}-hint`;
|
|
@@ -4508,7 +4528,8 @@ function useFieldFrame(explicitId, {
|
|
|
4508
4528
|
hintId,
|
|
4509
4529
|
errorId,
|
|
4510
4530
|
describedBy,
|
|
4511
|
-
|
|
4531
|
+
// In a FieldList cell the frame renders the column heading as the label when there is none.
|
|
4532
|
+
labelledBy: hasContent(label) || cell ? labelId : void 0,
|
|
4512
4533
|
showHint,
|
|
4513
4534
|
showError,
|
|
4514
4535
|
invalid: Boolean(invalid) || showError
|
|
@@ -4516,9 +4537,9 @@ function useFieldFrame(explicitId, {
|
|
|
4516
4537
|
}
|
|
4517
4538
|
function useErrorShake(invalid, error) {
|
|
4518
4539
|
const key = !invalid ? null : typeof error === "string" || typeof error === "number" ? String(error) : "invalid";
|
|
4519
|
-
const previous =
|
|
4520
|
-
const [count, setCount] =
|
|
4521
|
-
|
|
4540
|
+
const previous = React41.useRef(key);
|
|
4541
|
+
const [count, setCount] = React41.useState(0);
|
|
4542
|
+
React41.useEffect(() => {
|
|
4522
4543
|
if (key !== null && key !== previous.current) setCount((n) => n + 1);
|
|
4523
4544
|
previous.current = key;
|
|
4524
4545
|
}, [key]);
|
|
@@ -4526,7 +4547,7 @@ function useErrorShake(invalid, error) {
|
|
|
4526
4547
|
return count % 2 ? "odd" : "even";
|
|
4527
4548
|
}
|
|
4528
4549
|
function useLeavingError(showError, error) {
|
|
4529
|
-
const last =
|
|
4550
|
+
const last = React41.useRef(error);
|
|
4530
4551
|
if (showError) last.current = error;
|
|
4531
4552
|
const presence = usePresence(showError, { exitDuration: "fast" });
|
|
4532
4553
|
if (showError || !presence.mounted) return null;
|
|
@@ -4555,7 +4576,9 @@ function FieldFrame({
|
|
|
4555
4576
|
const leaving = useLeavingError(showError, error);
|
|
4556
4577
|
const showSupport = showError || showHint || leaving != null || counter != null || reserveSupportRow;
|
|
4557
4578
|
const shake = useErrorShake(ids.invalid, error);
|
|
4558
|
-
const
|
|
4579
|
+
const cell = useFieldCell();
|
|
4580
|
+
const shownLabel = hasContent(label) ? label : cell?.label;
|
|
4581
|
+
const labelNode = hasContent(shownLabel) ? /* @__PURE__ */ jsx27(
|
|
4559
4582
|
Label.Root,
|
|
4560
4583
|
{
|
|
4561
4584
|
id: ids.labelId,
|
|
@@ -4565,8 +4588,12 @@ function FieldFrame({
|
|
|
4565
4588
|
optional,
|
|
4566
4589
|
disabled,
|
|
4567
4590
|
labels: { optional: optionalLabel },
|
|
4568
|
-
className:
|
|
4569
|
-
|
|
4591
|
+
className: cx(
|
|
4592
|
+
FieldFrame_default.label,
|
|
4593
|
+
cell && visuallyHiddenClass,
|
|
4594
|
+
cell?.hidden === "wide" && FieldFrame_default.cellLabel
|
|
4595
|
+
),
|
|
4596
|
+
children: shownLabel
|
|
4570
4597
|
}
|
|
4571
4598
|
) : null;
|
|
4572
4599
|
return /* @__PURE__ */ jsxs15(
|
|
@@ -4701,17 +4728,17 @@ function InputRoot({
|
|
|
4701
4728
|
className,
|
|
4702
4729
|
...rest
|
|
4703
4730
|
}) {
|
|
4704
|
-
const [strengthValue, setStrengthValue] =
|
|
4731
|
+
const [strengthValue, setStrengthValue] = React42.useState("");
|
|
4705
4732
|
const size = useControlSize(sizeProp);
|
|
4706
4733
|
const ids = useFieldFrame(id, { label, hint, error, invalid });
|
|
4707
|
-
const labels =
|
|
4734
|
+
const labels = React42.useMemo(() => ({ ...INPUT_LABELS, ...labelsProp }), [labelsProp]);
|
|
4708
4735
|
const { invalid: isInvalid, controlId: inputId, describedBy } = ids;
|
|
4709
|
-
const inputRef =
|
|
4736
|
+
const inputRef = React42.useRef(null);
|
|
4710
4737
|
const commit = useFieldCommit(inputRef, onCommit);
|
|
4711
4738
|
const hasCommit = onCommit !== void 0;
|
|
4712
|
-
const [revealed, setRevealed] =
|
|
4713
|
-
const selectionRef =
|
|
4714
|
-
const contextValue =
|
|
4739
|
+
const [revealed, setRevealed] = React42.useState(false);
|
|
4740
|
+
const selectionRef = React42.useRef(null);
|
|
4741
|
+
const contextValue = React42.useMemo(
|
|
4715
4742
|
() => ({
|
|
4716
4743
|
size,
|
|
4717
4744
|
invalid: isInvalid,
|
|
@@ -4839,7 +4866,7 @@ function InputField({
|
|
|
4839
4866
|
} = useInputContext();
|
|
4840
4867
|
const setRefs = useMergedRefs(inputRef, ref);
|
|
4841
4868
|
const disabled = useInheritedDisabled(disabledProp);
|
|
4842
|
-
|
|
4869
|
+
React42.useLayoutEffect(() => {
|
|
4843
4870
|
const selection = selectionRef.current;
|
|
4844
4871
|
const input = inputRef.current;
|
|
4845
4872
|
if (!selection || !input) return;
|
|
@@ -4847,7 +4874,7 @@ function InputField({
|
|
|
4847
4874
|
input.setSelectionRange(selection[0], selection[1]);
|
|
4848
4875
|
}, [revealed, selectionRef, inputRef]);
|
|
4849
4876
|
const controlled = rest.value;
|
|
4850
|
-
|
|
4877
|
+
React42.useEffect(() => {
|
|
4851
4878
|
if (!reportValue) return;
|
|
4852
4879
|
if (controlled !== void 0) reportValue(String(controlled));
|
|
4853
4880
|
else if (inputRef.current) reportValue(inputRef.current.value);
|
|
@@ -4910,17 +4937,14 @@ function InputInlineAffix({ side, children, className, ...rest }) {
|
|
|
4910
4937
|
);
|
|
4911
4938
|
}
|
|
4912
4939
|
InputInlineAffix.displayName = "Input.InlineAffix";
|
|
4913
|
-
function InputClearButton({
|
|
4940
|
+
function InputClearButton({ onClick: onClick2, ref, ...rest }) {
|
|
4914
4941
|
const { inputId, inputRef, labels } = useInputContext();
|
|
4915
4942
|
return /* @__PURE__ */ jsx28(
|
|
4916
|
-
|
|
4943
|
+
FieldActionSegment,
|
|
4917
4944
|
{
|
|
4918
4945
|
...rest,
|
|
4919
4946
|
ref,
|
|
4920
|
-
|
|
4921
|
-
className: cx(fieldActionClass, className),
|
|
4922
|
-
"data-field-action": "",
|
|
4923
|
-
"aria-label": labels.clear,
|
|
4947
|
+
label: labels.clear,
|
|
4924
4948
|
"aria-controls": inputId,
|
|
4925
4949
|
onClick: (event) => {
|
|
4926
4950
|
onClick2?.(event);
|
|
@@ -4947,23 +4971,14 @@ function InputCopyButton({ value, ...rest }) {
|
|
|
4947
4971
|
);
|
|
4948
4972
|
}
|
|
4949
4973
|
InputCopyButton.displayName = "Input.CopyButton";
|
|
4950
|
-
function InputRevealButton({
|
|
4951
|
-
className,
|
|
4952
|
-
onClick: onClick2,
|
|
4953
|
-
onMouseDown,
|
|
4954
|
-
ref,
|
|
4955
|
-
...rest
|
|
4956
|
-
}) {
|
|
4974
|
+
function InputRevealButton({ onClick: onClick2, onMouseDown, ref, ...rest }) {
|
|
4957
4975
|
const { inputId, inputRef, labels, revealed, setRevealed, selectionRef } = useInputContext();
|
|
4958
4976
|
return /* @__PURE__ */ jsx28(
|
|
4959
|
-
|
|
4977
|
+
FieldActionSegment,
|
|
4960
4978
|
{
|
|
4961
4979
|
...rest,
|
|
4962
4980
|
ref,
|
|
4963
|
-
|
|
4964
|
-
className: cx(fieldActionClass, className),
|
|
4965
|
-
"data-field-action": "",
|
|
4966
|
-
"aria-label": labels.reveal,
|
|
4981
|
+
label: labels.reveal,
|
|
4967
4982
|
"aria-pressed": revealed,
|
|
4968
4983
|
"aria-controls": inputId,
|
|
4969
4984
|
onMouseDown: (event) => {
|
|
@@ -5006,7 +5021,7 @@ var Input = {
|
|
|
5006
5021
|
};
|
|
5007
5022
|
|
|
5008
5023
|
// src/components/checkbox/Checkbox.tsx
|
|
5009
|
-
import * as
|
|
5024
|
+
import * as React43 from "react";
|
|
5010
5025
|
|
|
5011
5026
|
// src/internal/CheckMark.module.css
|
|
5012
5027
|
var CheckMark_default = {
|
|
@@ -5145,9 +5160,9 @@ function CheckboxRoot({
|
|
|
5145
5160
|
defaultValue: defaultChecked,
|
|
5146
5161
|
onChange: onCheckedChange
|
|
5147
5162
|
});
|
|
5148
|
-
const internalRef =
|
|
5163
|
+
const internalRef = React43.useRef(null);
|
|
5149
5164
|
const mergedRef = useMergedRefs(internalRef, ref);
|
|
5150
|
-
|
|
5165
|
+
React43.useEffect(() => {
|
|
5151
5166
|
if (internalRef.current) internalRef.current.indeterminate = indeterminate;
|
|
5152
5167
|
}, [indeterminate]);
|
|
5153
5168
|
return /* @__PURE__ */ jsx31(
|
|
@@ -5244,7 +5259,7 @@ var Checkbox = {
|
|
|
5244
5259
|
};
|
|
5245
5260
|
|
|
5246
5261
|
// src/components/thumbnail/Thumbnail.tsx
|
|
5247
|
-
import * as
|
|
5262
|
+
import * as React45 from "react";
|
|
5248
5263
|
|
|
5249
5264
|
// src/internal/formatClock.ts
|
|
5250
5265
|
function formatClock(seconds) {
|
|
@@ -5273,7 +5288,7 @@ function firstFrame(src) {
|
|
|
5273
5288
|
}
|
|
5274
5289
|
|
|
5275
5290
|
// src/internal/mediaSession.ts
|
|
5276
|
-
import * as
|
|
5291
|
+
import * as React44 from "react";
|
|
5277
5292
|
var active = null;
|
|
5278
5293
|
var audible = (media) => !media.muted && media.volume > 0;
|
|
5279
5294
|
function claimPlayback(media) {
|
|
@@ -5285,7 +5300,7 @@ function releasePlayback(media) {
|
|
|
5285
5300
|
if (active === media) active = null;
|
|
5286
5301
|
}
|
|
5287
5302
|
function useMediaSession(ref) {
|
|
5288
|
-
|
|
5303
|
+
React44.useEffect(() => {
|
|
5289
5304
|
const media = ref.current;
|
|
5290
5305
|
if (!media) return;
|
|
5291
5306
|
const claim = () => claimPlayback(media);
|
|
@@ -5415,22 +5430,22 @@ function ThumbnailVideoInner({
|
|
|
5415
5430
|
...rest
|
|
5416
5431
|
}) {
|
|
5417
5432
|
const report = slot2.useReportStatus();
|
|
5418
|
-
const mute =
|
|
5433
|
+
const mute = React45.useCallback(
|
|
5419
5434
|
(node) => {
|
|
5420
5435
|
if (node) node.muted = autoPlay && !controls;
|
|
5421
5436
|
},
|
|
5422
5437
|
[autoPlay, controls]
|
|
5423
5438
|
);
|
|
5424
|
-
const sessionRef =
|
|
5439
|
+
const sessionRef = React45.useRef(null);
|
|
5425
5440
|
useMediaSession(sessionRef);
|
|
5426
5441
|
const videoRef = useMergedRefs(mute, sessionRef, ref);
|
|
5427
5442
|
const media = useImageStatus(report, {
|
|
5428
5443
|
onLoad: onLoadedData,
|
|
5429
5444
|
onError
|
|
5430
5445
|
});
|
|
5431
|
-
const [duration, setDuration] =
|
|
5432
|
-
const [playing, setPlaying] =
|
|
5433
|
-
const [still] =
|
|
5446
|
+
const [duration, setDuration] = React45.useState(null);
|
|
5447
|
+
const [playing, setPlaying] = React45.useState(false);
|
|
5448
|
+
const [still] = React45.useState(prefersReducedMotion);
|
|
5434
5449
|
const loops = autoPlay && !still && !controls;
|
|
5435
5450
|
return /* @__PURE__ */ jsxs20(Fragment9, { children: [
|
|
5436
5451
|
/* @__PURE__ */ jsx33(
|
|
@@ -5481,7 +5496,7 @@ var Thumbnail = {
|
|
|
5481
5496
|
};
|
|
5482
5497
|
|
|
5483
5498
|
// src/internal/swatch.tsx
|
|
5484
|
-
import * as
|
|
5499
|
+
import * as React46 from "react";
|
|
5485
5500
|
|
|
5486
5501
|
// src/internal/swatch.module.css
|
|
5487
5502
|
var swatch_default = {
|
|
@@ -5514,7 +5529,7 @@ var COLOR_PRESETS = [
|
|
|
5514
5529
|
{ value: "#be185d", label: "\u0422\u0451\u043C\u043D\u043E-\u0440\u043E\u0437\u043E\u0432\u044B\u0439" }
|
|
5515
5530
|
];
|
|
5516
5531
|
function useSwatchOptions(presets, allowEmpty, emptyLabel) {
|
|
5517
|
-
return
|
|
5532
|
+
return React46.useMemo(
|
|
5518
5533
|
() => [
|
|
5519
5534
|
...presets.map((preset) => ({ ...preset, contrast: markContrast(preset.value) })),
|
|
5520
5535
|
...allowEmpty ? [{ value: null, label: emptyLabel, contrast: "dark" }] : []
|
|
@@ -5579,7 +5594,7 @@ function markContrast(value) {
|
|
|
5579
5594
|
}
|
|
5580
5595
|
|
|
5581
5596
|
// src/components/color-swatches/ColorSwatches.tsx
|
|
5582
|
-
import * as
|
|
5597
|
+
import * as React47 from "react";
|
|
5583
5598
|
|
|
5584
5599
|
// src/internal/rovingFocus.ts
|
|
5585
5600
|
var PREV = {
|
|
@@ -5646,8 +5661,8 @@ function balancedColumns(count, width, cell, gap) {
|
|
|
5646
5661
|
return Math.ceil(count / rows);
|
|
5647
5662
|
}
|
|
5648
5663
|
function useBalancedColumns(gridRef, count) {
|
|
5649
|
-
const [columns, setColumns] =
|
|
5650
|
-
|
|
5664
|
+
const [columns, setColumns] = React47.useState();
|
|
5665
|
+
React47.useLayoutEffect(() => {
|
|
5651
5666
|
const grid = gridRef.current;
|
|
5652
5667
|
if (!grid || typeof ResizeObserver === "undefined") return;
|
|
5653
5668
|
const measure = () => {
|
|
@@ -5698,8 +5713,8 @@ function ColorSwatches({
|
|
|
5698
5713
|
const options = useSwatchOptions(presets, allowEmpty, labels.empty);
|
|
5699
5714
|
const selectedIndex = options.findIndex((option) => sameColor(option.value, value));
|
|
5700
5715
|
const focusIndex = Math.max(0, selectedIndex);
|
|
5701
|
-
const itemRefs =
|
|
5702
|
-
const gridRef =
|
|
5716
|
+
const itemRefs = React47.useRef([]);
|
|
5717
|
+
const gridRef = React47.useRef(null);
|
|
5703
5718
|
const columns = useBalancedColumns(gridRef, options.length);
|
|
5704
5719
|
const labelledBy = ariaLabelledBy ?? ids.labelledBy;
|
|
5705
5720
|
const onKeyDown2 = (event) => {
|
|
@@ -5791,10 +5806,10 @@ function ColorSwatches({
|
|
|
5791
5806
|
}
|
|
5792
5807
|
|
|
5793
5808
|
// src/components/select/Select.tsx
|
|
5794
|
-
import * as
|
|
5809
|
+
import * as React52 from "react";
|
|
5795
5810
|
|
|
5796
5811
|
// src/internal/listbox.ts
|
|
5797
|
-
import * as
|
|
5812
|
+
import * as React48 from "react";
|
|
5798
5813
|
var optionDomId = (listboxId, value) => `${listboxId}-opt-${value.replace(/\s+/g, "_")}`;
|
|
5799
5814
|
function enabledOptions(container) {
|
|
5800
5815
|
if (!container) return [];
|
|
@@ -5819,11 +5834,11 @@ function createStore(initial) {
|
|
|
5819
5834
|
};
|
|
5820
5835
|
}
|
|
5821
5836
|
function useCreateStore(initial) {
|
|
5822
|
-
return
|
|
5837
|
+
return React48.useState(() => createStore(initial))[0];
|
|
5823
5838
|
}
|
|
5824
5839
|
function useStoreSlice(store, select) {
|
|
5825
5840
|
const read = () => select(store.get());
|
|
5826
|
-
return
|
|
5841
|
+
return React48.useSyncExternalStore(store.subscribe, read, read);
|
|
5827
5842
|
}
|
|
5828
5843
|
function handleListboxKeyDown(event, { items, highlight, onSelect }) {
|
|
5829
5844
|
if (items.length === 0) return;
|
|
@@ -5845,10 +5860,10 @@ function handleListboxKeyDown(event, { items, highlight, onSelect }) {
|
|
|
5845
5860
|
}
|
|
5846
5861
|
var TYPEAHEAD_RESET_MS = 500;
|
|
5847
5862
|
function useTypeahead() {
|
|
5848
|
-
const state =
|
|
5849
|
-
|
|
5850
|
-
const isTyping =
|
|
5851
|
-
const find =
|
|
5863
|
+
const state = React48.useRef({ buffer: "", timer: 0 });
|
|
5864
|
+
React48.useEffect(() => () => window.clearTimeout(state.current.timer), []);
|
|
5865
|
+
const isTyping = React48.useCallback(() => state.current.buffer !== "", []);
|
|
5866
|
+
const find = React48.useCallback(
|
|
5852
5867
|
(key, items, highlighted) => {
|
|
5853
5868
|
const s = state.current;
|
|
5854
5869
|
window.clearTimeout(s.timer);
|
|
@@ -5870,19 +5885,19 @@ function useTypeahead() {
|
|
|
5870
5885
|
}
|
|
5871
5886
|
var LOAD_MORE_ROOT_MARGIN = "0px 0px 48px 0px";
|
|
5872
5887
|
function useLoadMore({ enabled, onLoadMore, scrollRef, rearm }) {
|
|
5873
|
-
const sentinelRef =
|
|
5874
|
-
const handlerRef =
|
|
5888
|
+
const sentinelRef = React48.useRef(null);
|
|
5889
|
+
const handlerRef = React48.useRef(onLoadMore);
|
|
5875
5890
|
handlerRef.current = onLoadMore;
|
|
5876
|
-
const askedRef =
|
|
5877
|
-
|
|
5891
|
+
const askedRef = React48.useRef(false);
|
|
5892
|
+
React48.useLayoutEffect(() => {
|
|
5878
5893
|
askedRef.current = false;
|
|
5879
5894
|
}, [enabled, rearm]);
|
|
5880
|
-
const request =
|
|
5895
|
+
const request = React48.useCallback(() => {
|
|
5881
5896
|
if (!enabled || askedRef.current) return;
|
|
5882
5897
|
askedRef.current = true;
|
|
5883
5898
|
void handlerRef.current?.();
|
|
5884
5899
|
}, [enabled]);
|
|
5885
|
-
|
|
5900
|
+
React48.useEffect(() => {
|
|
5886
5901
|
const root = scrollRef.current;
|
|
5887
5902
|
const target = sentinelRef.current;
|
|
5888
5903
|
if (!enabled || !root || !target || typeof IntersectionObserver === "undefined") return;
|
|
@@ -5899,7 +5914,7 @@ function useLoadMore({ enabled, onLoadMore, scrollRef, rearm }) {
|
|
|
5899
5914
|
}
|
|
5900
5915
|
|
|
5901
5916
|
// src/internal/MenuGroup.tsx
|
|
5902
|
-
import * as
|
|
5917
|
+
import * as React49 from "react";
|
|
5903
5918
|
|
|
5904
5919
|
// src/internal/menu.module.css
|
|
5905
5920
|
var menu_default = {
|
|
@@ -5921,7 +5936,7 @@ var menu_default = {
|
|
|
5921
5936
|
// src/internal/MenuGroup.tsx
|
|
5922
5937
|
import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5923
5938
|
function MenuGroup({ label, className, children, ...rest }) {
|
|
5924
|
-
const labelId =
|
|
5939
|
+
const labelId = React49.useId();
|
|
5925
5940
|
return (
|
|
5926
5941
|
// biome-ignore lint/a11y/useSemanticElements: role="group" inside a menu / listbox; <fieldset> is not allowed there
|
|
5927
5942
|
/* @__PURE__ */ jsxs23(
|
|
@@ -5964,10 +5979,10 @@ var Select_default = {
|
|
|
5964
5979
|
};
|
|
5965
5980
|
|
|
5966
5981
|
// src/components/select/SelectItem.tsx
|
|
5967
|
-
import * as
|
|
5982
|
+
import * as React51 from "react";
|
|
5968
5983
|
|
|
5969
5984
|
// src/internal/HighlightMatch.tsx
|
|
5970
|
-
import * as
|
|
5985
|
+
import * as React50 from "react";
|
|
5971
5986
|
|
|
5972
5987
|
// src/internal/HighlightMatch.module.css
|
|
5973
5988
|
var HighlightMatch_default = {
|
|
@@ -6011,7 +6026,7 @@ function HighlightMatch({
|
|
|
6011
6026
|
}
|
|
6012
6027
|
function highlightChildren(children, query) {
|
|
6013
6028
|
if (!query.trim()) return children;
|
|
6014
|
-
return
|
|
6029
|
+
return React50.Children.map(
|
|
6015
6030
|
children,
|
|
6016
6031
|
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */ jsx37(HighlightMatch, { text: String(child), query }) : child
|
|
6017
6032
|
);
|
|
@@ -6053,7 +6068,7 @@ function textOf(node) {
|
|
|
6053
6068
|
if (node == null || typeof node === "boolean") return "";
|
|
6054
6069
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
6055
6070
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
6056
|
-
if (
|
|
6071
|
+
if (React51.isValidElement(node))
|
|
6057
6072
|
return textOf(node.props.children);
|
|
6058
6073
|
return "";
|
|
6059
6074
|
}
|
|
@@ -6061,9 +6076,9 @@ function SelectItemIcon({ className, ...rest }) {
|
|
|
6061
6076
|
return /* @__PURE__ */ jsx38("span", { "aria-hidden": "true", className: cx(menu_default.itemIcon, className), ...rest });
|
|
6062
6077
|
}
|
|
6063
6078
|
SelectItemIcon.displayName = "Select.ItemIcon";
|
|
6064
|
-
var OptionQueryContext =
|
|
6079
|
+
var OptionQueryContext = React51.createContext("");
|
|
6065
6080
|
function SelectItemText({ children, className, ...rest }) {
|
|
6066
|
-
const query =
|
|
6081
|
+
const query = React51.useContext(OptionQueryContext);
|
|
6067
6082
|
return /* @__PURE__ */ jsx38("span", { ...rest, className: cx(Select_default.itemTitle, className), children: highlightChildren(children, query) });
|
|
6068
6083
|
}
|
|
6069
6084
|
SelectItemText.displayName = "Select.ItemText";
|
|
@@ -6072,7 +6087,7 @@ function SelectItemDescription({
|
|
|
6072
6087
|
className,
|
|
6073
6088
|
...rest
|
|
6074
6089
|
}) {
|
|
6075
|
-
const query =
|
|
6090
|
+
const query = React51.useContext(OptionQueryContext);
|
|
6076
6091
|
return /* @__PURE__ */ jsx38("span", { ...rest, className: cx(Select_default.itemDescription, className), children: highlightChildren(children, query) });
|
|
6077
6092
|
}
|
|
6078
6093
|
SelectItemDescription.displayName = "Select.ItemDescription";
|
|
@@ -6090,11 +6105,11 @@ function splitItemChildren(children) {
|
|
|
6090
6105
|
description: ""
|
|
6091
6106
|
};
|
|
6092
6107
|
let plain = "";
|
|
6093
|
-
for (const child of
|
|
6094
|
-
if (!
|
|
6108
|
+
for (const child of React51.Children.toArray(children)) {
|
|
6109
|
+
if (!React51.isValidElement(child)) {
|
|
6095
6110
|
plain += textOf(child);
|
|
6096
6111
|
parts.body.push(child);
|
|
6097
|
-
} else if (child.type ===
|
|
6112
|
+
} else if (child.type === React51.Fragment) {
|
|
6098
6113
|
const inner = splitItemChildren(child.props.children);
|
|
6099
6114
|
parts.leading.push(...inner.leading);
|
|
6100
6115
|
parts.body.push(...inner.body);
|
|
@@ -6124,7 +6139,7 @@ function splitItemChildren(children) {
|
|
|
6124
6139
|
}
|
|
6125
6140
|
function sizeMedia(leading, size) {
|
|
6126
6141
|
return leading.map(
|
|
6127
|
-
(node) =>
|
|
6142
|
+
(node) => React51.isValidElement(node) && (node.type === Thumbnail.Root || node.type === Avatar.Root) ? React51.cloneElement(node, {
|
|
6128
6143
|
size: node.props.size ?? MEDIA_SIZE[size],
|
|
6129
6144
|
className: cx(Select_default.media, node.props.className),
|
|
6130
6145
|
"aria-hidden": true
|
|
@@ -6146,7 +6161,7 @@ function SelectItem({
|
|
|
6146
6161
|
const haystack = normalize(`${resolvedLabel} ${parts.description} ${keywords ?? ""}`);
|
|
6147
6162
|
const isSelected = selected.includes(value);
|
|
6148
6163
|
const isHighlighted = useStoreSlice(highlight, (current) => current === value);
|
|
6149
|
-
|
|
6164
|
+
React51.useLayoutEffect(
|
|
6150
6165
|
() => registry.register(value, resolvedLabel, haystack),
|
|
6151
6166
|
[registry, value, resolvedLabel, haystack]
|
|
6152
6167
|
);
|
|
@@ -6203,7 +6218,7 @@ function SelectAction({
|
|
|
6203
6218
|
...rest
|
|
6204
6219
|
}) {
|
|
6205
6220
|
const { highlight, listboxId, setOpen, size } = useSelectContext();
|
|
6206
|
-
const value = `${ACTION_PREFIX}${
|
|
6221
|
+
const value = `${ACTION_PREFIX}${React51.useId()}`;
|
|
6207
6222
|
const isHighlighted = useStoreSlice(highlight, (current) => current === value);
|
|
6208
6223
|
const parts = splitItemChildren(children);
|
|
6209
6224
|
return (
|
|
@@ -6295,7 +6310,7 @@ function SelectRoot(props) {
|
|
|
6295
6310
|
} = props;
|
|
6296
6311
|
const multiple = props.multiple === true;
|
|
6297
6312
|
const disabled = useInheritedDisabled(disabledProp);
|
|
6298
|
-
const labels =
|
|
6313
|
+
const labels = React52.useMemo(() => ({ ...SELECT_LABELS, ...labelsProp }), [labelsProp]);
|
|
6299
6314
|
const ids = useFieldFrame(id, { hint, error, invalid });
|
|
6300
6315
|
const [stored, setStored] = useControllableState({
|
|
6301
6316
|
value: props.value,
|
|
@@ -6304,7 +6319,7 @@ function SelectRoot(props) {
|
|
|
6304
6319
|
const changes = usePendingChanges(stored, takeNext);
|
|
6305
6320
|
const value = changes.shown;
|
|
6306
6321
|
const saving = changes.pending.length > 0;
|
|
6307
|
-
const [announcement, setAnnouncement] =
|
|
6322
|
+
const [announcement, setAnnouncement] = React52.useState("");
|
|
6308
6323
|
const onValueChange = props.onValueChange;
|
|
6309
6324
|
const commit = (next) => {
|
|
6310
6325
|
if (saving || Object.is(next, value)) return;
|
|
@@ -6319,9 +6334,9 @@ function SelectRoot(props) {
|
|
|
6319
6334
|
onReject: () => setAnnouncement(labels.changeFailed)
|
|
6320
6335
|
});
|
|
6321
6336
|
};
|
|
6322
|
-
const commitRef =
|
|
6337
|
+
const commitRef = React52.useRef(commit);
|
|
6323
6338
|
commitRef.current = commit;
|
|
6324
|
-
const selected =
|
|
6339
|
+
const selected = React52.useMemo(
|
|
6325
6340
|
() => Array.isArray(value) ? value : value ? [value] : [],
|
|
6326
6341
|
[value]
|
|
6327
6342
|
);
|
|
@@ -6331,19 +6346,19 @@ function SelectRoot(props) {
|
|
|
6331
6346
|
onChange: onOpenChange
|
|
6332
6347
|
});
|
|
6333
6348
|
const highlight = useCreateStore(void 0);
|
|
6334
|
-
const [registry] =
|
|
6349
|
+
const [registry] = React52.useState(createItemRegistry);
|
|
6335
6350
|
const [query, setQuery] = useControllableState({
|
|
6336
6351
|
value: search,
|
|
6337
6352
|
defaultValue: defaultSearch,
|
|
6338
6353
|
onChange: onSearchChange
|
|
6339
6354
|
});
|
|
6340
|
-
const triggerRef =
|
|
6341
|
-
const wasOpenRef =
|
|
6342
|
-
|
|
6355
|
+
const triggerRef = React52.useRef(null);
|
|
6356
|
+
const wasOpenRef = React52.useRef(isOpen);
|
|
6357
|
+
React52.useEffect(() => {
|
|
6343
6358
|
if (wasOpenRef.current && !isOpen) setQuery("");
|
|
6344
6359
|
wasOpenRef.current = isOpen;
|
|
6345
6360
|
}, [isOpen, setQuery]);
|
|
6346
|
-
const pick =
|
|
6361
|
+
const pick = React52.useCallback(
|
|
6347
6362
|
(optionValue) => {
|
|
6348
6363
|
if (multiple) {
|
|
6349
6364
|
const list = Array.isArray(value) ? value : [];
|
|
@@ -6357,8 +6372,8 @@ function SelectRoot(props) {
|
|
|
6357
6372
|
},
|
|
6358
6373
|
[multiple, value, setOpen]
|
|
6359
6374
|
);
|
|
6360
|
-
const clear =
|
|
6361
|
-
const context =
|
|
6375
|
+
const clear = React52.useCallback(() => commitRef.current(multiple ? [] : ""), [multiple]);
|
|
6376
|
+
const context = React52.useMemo(
|
|
6362
6377
|
() => ({
|
|
6363
6378
|
size,
|
|
6364
6379
|
invalid: ids.invalid,
|
|
@@ -6475,6 +6490,8 @@ function SelectTrigger({
|
|
|
6475
6490
|
labels
|
|
6476
6491
|
} = useSelectContext();
|
|
6477
6492
|
const mergedRef = useMergedRefs(triggerRef, ref);
|
|
6493
|
+
const parts = React52.Children.toArray(children);
|
|
6494
|
+
const iconOnly = parts.some((node) => React52.isValidElement(node) && node.type === SelectTriggerIcon) && !parts.some((node) => React52.isValidElement(node) && node.type === SelectValue);
|
|
6478
6495
|
const busy = loading || saving;
|
|
6479
6496
|
const showClear = clearable && selected.length > 0 && !disabled && !busy;
|
|
6480
6497
|
return /* @__PURE__ */ jsxs26(
|
|
@@ -6515,17 +6532,22 @@ function SelectTrigger({
|
|
|
6515
6532
|
invalid: invalid || void 0,
|
|
6516
6533
|
loading: busy || void 0,
|
|
6517
6534
|
disabled: disabled || void 0,
|
|
6518
|
-
"focus-ring": focusRing ? void 0 : false
|
|
6535
|
+
"focus-ring": focusRing ? void 0 : false,
|
|
6536
|
+
"icon-only": iconOnly || void 0
|
|
6519
6537
|
}),
|
|
6520
6538
|
children: [
|
|
6521
|
-
/* @__PURE__ */
|
|
6539
|
+
/* @__PURE__ */ jsxs26("span", { className: Select_default.triggerMain, children: [
|
|
6540
|
+
children,
|
|
6541
|
+
iconOnly ? /* @__PURE__ */ jsx39(SelectValue, { className: visuallyHiddenClass }) : null
|
|
6542
|
+
] }),
|
|
6522
6543
|
showClear ? (
|
|
6523
6544
|
// A segment, not a button: interactive content inside a <button> is invalid. The keyboard
|
|
6524
|
-
// clears with Delete / Backspace on the trigger.
|
|
6545
|
+
// clears with Delete / Backspace on the trigger. A touch target in height, like the clear
|
|
6546
|
+
// segment of a field (`FieldAction`).
|
|
6525
6547
|
/* @__PURE__ */ jsx39(
|
|
6526
6548
|
"span",
|
|
6527
6549
|
{
|
|
6528
|
-
className: Select_default.clear,
|
|
6550
|
+
className: cx(Select_default.clear, touchTargetBlockClass),
|
|
6529
6551
|
"aria-hidden": "true",
|
|
6530
6552
|
title: labels.clear,
|
|
6531
6553
|
"data-select-clear": "",
|
|
@@ -6621,11 +6643,11 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
6621
6643
|
labels,
|
|
6622
6644
|
registry
|
|
6623
6645
|
} = useSelectContext();
|
|
6624
|
-
const listboxRef =
|
|
6646
|
+
const listboxRef = React52.useRef(null);
|
|
6625
6647
|
const items = [];
|
|
6626
6648
|
const actions = [];
|
|
6627
|
-
for (const child of
|
|
6628
|
-
(
|
|
6649
|
+
for (const child of React52.Children.toArray(children)) {
|
|
6650
|
+
(React52.isValidElement(child) && child.type === SelectAction ? actions : items).push(child);
|
|
6629
6651
|
}
|
|
6630
6652
|
const actionsId = `${listboxId}-actions`;
|
|
6631
6653
|
const floating = useFloatingLayer({
|
|
@@ -6650,12 +6672,12 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
6650
6672
|
scrollRef: listboxRef,
|
|
6651
6673
|
rearm: version
|
|
6652
6674
|
});
|
|
6653
|
-
|
|
6675
|
+
React52.useEffect(() => {
|
|
6654
6676
|
if (highlighted === void 0) return;
|
|
6655
6677
|
if (enabledOptions(listboxRef.current).at(-1)?.dataset.value === highlighted) requestMore();
|
|
6656
6678
|
}, [highlighted, requestMore]);
|
|
6657
6679
|
const panelRef = floating.contentRef;
|
|
6658
|
-
|
|
6680
|
+
React52.useEffect(() => {
|
|
6659
6681
|
const panel = panelRef.current;
|
|
6660
6682
|
if (isOpen && swapped && panel && !panel.contains(document.activeElement)) focusInto(panel);
|
|
6661
6683
|
}, [region, swapped, isOpen, panelRef]);
|
|
@@ -6778,10 +6800,10 @@ function HighlightOnOpen({
|
|
|
6778
6800
|
highlight
|
|
6779
6801
|
}) {
|
|
6780
6802
|
const { isOpen, query, selected, registry } = useSelectContext();
|
|
6781
|
-
const selectedRef =
|
|
6803
|
+
const selectedRef = React52.useRef(selected);
|
|
6782
6804
|
selectedRef.current = selected;
|
|
6783
6805
|
const version = useStoreSlice(registry.version, (value) => value);
|
|
6784
|
-
|
|
6806
|
+
React52.useLayoutEffect(() => {
|
|
6785
6807
|
if (!isOpen) return;
|
|
6786
6808
|
const options = enabledOptions(listboxRef.current);
|
|
6787
6809
|
const first = options.find((item) => selectedRef.current.includes(item.dataset.value ?? ""));
|
|
@@ -6789,10 +6811,10 @@ function HighlightOnOpen({
|
|
|
6789
6811
|
first?.scrollIntoView?.({ block: "nearest" });
|
|
6790
6812
|
return () => highlight.set(void 0);
|
|
6791
6813
|
}, [isOpen, listboxRef, highlight]);
|
|
6792
|
-
|
|
6814
|
+
React52.useLayoutEffect(() => {
|
|
6793
6815
|
if (query !== "") highlight.set(enabledOptions(panelRef.current)[0]?.dataset.value);
|
|
6794
6816
|
}, [query, panelRef, highlight]);
|
|
6795
|
-
|
|
6817
|
+
React52.useLayoutEffect(() => {
|
|
6796
6818
|
if (query === "") return;
|
|
6797
6819
|
const options = enabledOptions(listboxRef.current);
|
|
6798
6820
|
if (!options.some((item) => item.dataset.value === highlight.get())) {
|
|
@@ -6909,6 +6931,8 @@ export {
|
|
|
6909
6931
|
enterMotion_default,
|
|
6910
6932
|
Hint,
|
|
6911
6933
|
Label,
|
|
6934
|
+
FieldCellContext,
|
|
6935
|
+
useFieldCell,
|
|
6912
6936
|
formatLabel,
|
|
6913
6937
|
useFieldFrame,
|
|
6914
6938
|
FieldFrame,
|