prime-ui-kit 0.21.2 → 0.21.4
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 +2 -2
- package/THIRD_PARTY_NOTICES +13 -0
- package/dist/chunks/{chunk-T7IEJSTH.js → chunk-HMLQCKRL.js} +36 -0
- package/dist/chunks/{chunk-7JYPFRZ3.js → chunk-PFASPQSJ.js} +393 -354
- package/dist/chunks/{chunk-SQGPQOUO.js → chunk-SUGCIPD7.js} +1 -1
- package/dist/chunks/{chunk-ME4VEAQ5.js → chunk-UNNQITFE.js} +2132 -1619
- package/dist/chunks/{chunk-VQ3UCVDV.js → chunk-WGXXPJDR.js} +5 -2
- package/dist/color-picker.js +3 -3
- package/dist/components/chat-list/ChatList.d.ts +4 -3
- package/dist/components/command-menu/CommandMenu.d.ts +1 -4
- package/dist/components/composer/Composer.d.ts +1 -1
- package/dist/components/data-table/DataTable.d.ts +9 -7
- package/dist/components/data-table/Footer.d.ts +7 -3
- package/dist/components/datepicker/DatepickerPanel.d.ts +2 -2
- package/dist/components/dnd/labels.d.ts +2 -0
- package/dist/components/field-list/FieldList.d.ts +2 -4
- package/dist/components/file-upload/FileUpload.d.ts +1 -9
- package/dist/components/index.d.ts +2 -2
- package/dist/components/input/Input.d.ts +1 -1
- package/dist/components/kanban/Kanban.d.ts +0 -2
- package/dist/components/list/List.d.ts +7 -1
- package/dist/components/login-form/LoginForm.d.ts +5 -1
- package/dist/components/message/Message.d.ts +5 -1
- package/dist/components/message/MessageParts.d.ts +7 -2
- package/dist/components/rich-text/RichText.d.ts +12 -4
- package/dist/components/select/selectContext.d.ts +0 -2
- package/dist/components/smart-filter/SmartFilter.d.ts +1 -5
- package/dist/components/sparkline/Sparkline.d.ts +50 -8
- package/dist/components/tag-select/TagSelect.d.ts +0 -2
- package/dist/components/textarea/Textarea.d.ts +2 -2
- package/dist/icon-set.d.ts +5 -1
- package/dist/icon-set.js +8 -2
- package/dist/icons/glyph.d.ts +12 -1
- package/dist/icons/glyphs/telegram.d.ts +2 -0
- package/dist/icons/glyphs/vk.d.ts +2 -0
- package/dist/icons/glyphs/whatsapp.d.ts +2 -0
- package/dist/icons/registry.d.ts +8 -1
- package/dist/index.css +1 -1
- package/dist/index.js +7 -3
- package/dist/internal/ToolRow.d.ts +3 -1
- package/dist/internal/autofill.d.ts +30 -0
- package/dist/internal/barPlan.d.ts +7 -1
- package/dist/internal/blockStack.d.ts +7 -0
- package/dist/internal/overlay/DialogParts.d.ts +8 -6
- package/dist/internal/richText.d.ts +32 -1
- package/dist/internal/textFormatting.d.ts +2 -2
- package/dist/layout/page/Page.d.ts +2 -1
- package/dist/skill/SKILL.md +3 -2
- package/dist/skill/api-contract.md +2 -1
- package/dist/skill/cheatsheet.md +1 -1
- package/dist/skill/checklist.md +8 -1
- package/dist/skill/choosing.md +76 -5
- package/dist/skill/components.md +2 -2
- package/dist/skill/composition.md +108 -20
- package/dist/skill/foundations.md +1 -1
- package/dist/skill/layouts.md +4 -4
- package/dist/skill/reference/components/button/examples/in-form.tsx +0 -1
- package/dist/skill/reference/components/card/COMPONENT.md +1 -1
- package/dist/skill/reference/components/card/examples/screen.tsx +9 -11
- package/dist/skill/reference/components/chat-list/COMPONENT.md +6 -5
- package/dist/skill/reference/components/chat-list/examples/structure.tsx +4 -4
- package/dist/skill/reference/components/command-menu/COMPONENT.md +1 -2
- package/dist/skill/reference/components/command-menu/examples/states.tsx +1 -1
- package/dist/skill/reference/components/composer/COMPONENT.md +5 -4
- package/dist/skill/reference/components/composer/examples/formatting.tsx +1 -1
- package/dist/skill/reference/components/data-table/COMPONENT.md +17 -16
- package/dist/skill/reference/components/data-table/examples/server.tsx +2 -1
- package/dist/skill/reference/components/datepicker/COMPONENT.md +2 -2
- package/dist/skill/reference/components/dnd/COMPONENT.md +2 -1
- package/dist/skill/reference/components/drawer/COMPONENT.md +9 -6
- package/dist/skill/reference/components/drawer/examples/screen.tsx +1 -5
- package/dist/skill/reference/components/drawer/examples/tab-switcher.tsx +158 -0
- package/dist/skill/reference/components/field-list/COMPONENT.md +7 -7
- package/dist/skill/reference/components/field-list/examples/limits.tsx +2 -2
- package/dist/skill/reference/components/file-upload/COMPONENT.md +8 -12
- package/dist/skill/reference/components/file-upload/examples/gallery.tsx +2 -2
- package/dist/skill/reference/components/file-upload/examples/in-form.tsx +2 -4
- package/dist/skill/reference/components/file-upload/examples/narrow.tsx +1 -0
- package/dist/skill/reference/components/file-upload/examples/overview.tsx +1 -5
- package/dist/skill/reference/components/file-upload/examples/sizes.tsx +1 -1
- package/dist/skill/reference/components/file-upload/examples/states.tsx +4 -5
- package/dist/skill/reference/components/file-upload/examples/validation.tsx +2 -7
- package/dist/skill/reference/components/input/COMPONENT.md +3 -0
- package/dist/skill/reference/components/input/examples/in-form.tsx +0 -1
- package/dist/skill/reference/components/input/examples/validation.tsx +1 -1
- package/dist/skill/reference/components/kanban/COMPONENT.md +1 -2
- package/dist/skill/reference/components/list/COMPONENT.md +11 -6
- package/dist/skill/reference/components/list/examples/reorder.tsx +30 -3
- package/dist/skill/reference/components/login-form/COMPONENT.md +2 -2
- package/dist/skill/reference/components/login-form/examples/sizes.tsx +6 -2
- package/dist/skill/reference/components/message/COMPONENT.md +12 -7
- package/dist/skill/reference/components/message/examples/status.tsx +2 -1
- package/dist/skill/reference/components/message/examples/text-formatting.tsx +13 -3
- package/dist/skill/reference/components/modal/COMPONENT.md +5 -4
- package/dist/skill/reference/components/rich-text/COMPONENT.md +45 -7
- package/dist/skill/reference/components/rich-text/examples/entities.tsx +20 -0
- package/dist/skill/reference/components/select/COMPONENT.md +1 -2
- package/dist/skill/reference/components/sheet/COMPONENT.md +5 -4
- package/dist/skill/reference/components/smart-filter/COMPONENT.md +3 -5
- package/dist/skill/reference/components/sparkline/COMPONENT.md +40 -12
- package/dist/skill/reference/components/sparkline/examples/lower-is-better.tsx +46 -0
- package/dist/skill/reference/components/sparkline/examples/own-value.tsx +41 -0
- package/dist/skill/reference/components/sparkline/examples/reference.tsx +2 -1
- package/dist/skill/reference/components/tabs/COMPONENT.md +1 -1
- package/dist/skill/reference/components/tabs/examples/orientation.tsx +1 -1
- package/dist/skill/reference/components/tag-select/COMPONENT.md +0 -2
- package/dist/skill/reference/components/tag-select/examples/overview.tsx +0 -1
- package/dist/skill/reference/components/tag-select/examples/sizes.tsx +0 -1
- package/dist/skill/reference/components/textarea/COMPONENT.md +6 -3
- package/dist/skill/reference/icon-set.ts +5 -1
- package/dist/skill/reference/layout/page/COMPONENT.md +13 -12
- package/dist/skill/reference/layout/page/examples/collapse.tsx +45 -31
- package/dist/skill/reference/layout/page/examples/router.tsx +47 -14
- package/dist/skill/ux.md +98 -4
- package/package.json +1 -1
- package/src/components/button/examples/in-form.tsx +0 -1
- package/src/components/card/COMPONENT.md +1 -1
- package/src/components/card/examples/screen.tsx +9 -11
- package/src/components/chat-list/COMPONENT.md +6 -5
- package/src/components/chat-list/examples/structure.tsx +4 -4
- package/src/components/command-menu/COMPONENT.md +1 -2
- package/src/components/command-menu/examples/states.tsx +1 -1
- package/src/components/composer/COMPONENT.md +5 -4
- package/src/components/composer/examples/formatting.tsx +1 -1
- package/src/components/data-table/COMPONENT.md +17 -16
- package/src/components/data-table/examples/server.tsx +2 -1
- package/src/components/datepicker/COMPONENT.md +2 -2
- package/src/components/dnd/COMPONENT.md +2 -1
- package/src/components/drawer/COMPONENT.md +9 -6
- package/src/components/drawer/examples/screen.tsx +1 -5
- package/src/components/drawer/examples/tab-switcher.tsx +158 -0
- package/src/components/field-list/COMPONENT.md +7 -7
- package/src/components/field-list/examples/limits.tsx +2 -2
- package/src/components/file-upload/COMPONENT.md +8 -12
- package/src/components/file-upload/examples/gallery.tsx +2 -2
- package/src/components/file-upload/examples/in-form.tsx +2 -4
- package/src/components/file-upload/examples/narrow.tsx +1 -0
- package/src/components/file-upload/examples/overview.tsx +1 -5
- package/src/components/file-upload/examples/sizes.tsx +1 -1
- package/src/components/file-upload/examples/states.tsx +4 -5
- package/src/components/file-upload/examples/validation.tsx +2 -7
- package/src/components/input/COMPONENT.md +3 -0
- package/src/components/input/examples/in-form.tsx +0 -1
- package/src/components/input/examples/validation.tsx +1 -1
- package/src/components/kanban/COMPONENT.md +1 -2
- package/src/components/list/COMPONENT.md +11 -6
- package/src/components/list/examples/reorder.tsx +30 -3
- package/src/components/login-form/COMPONENT.md +2 -2
- package/src/components/login-form/examples/sizes.tsx +6 -2
- package/src/components/message/COMPONENT.md +12 -7
- package/src/components/message/examples/status.tsx +2 -1
- package/src/components/message/examples/text-formatting.tsx +13 -3
- package/src/components/modal/COMPONENT.md +5 -4
- package/src/components/rich-text/COMPONENT.md +45 -7
- package/src/components/rich-text/examples/entities.tsx +20 -0
- package/src/components/select/COMPONENT.md +1 -2
- package/src/components/sheet/COMPONENT.md +5 -4
- package/src/components/smart-filter/COMPONENT.md +3 -5
- package/src/components/sparkline/COMPONENT.md +40 -12
- package/src/components/sparkline/examples/lower-is-better.tsx +46 -0
- package/src/components/sparkline/examples/own-value.tsx +41 -0
- package/src/components/sparkline/examples/reference.tsx +2 -1
- package/src/components/tabs/COMPONENT.md +1 -1
- package/src/components/tabs/examples/orientation.tsx +1 -1
- package/src/components/tag-select/COMPONENT.md +0 -2
- package/src/components/tag-select/examples/overview.tsx +0 -1
- package/src/components/tag-select/examples/sizes.tsx +0 -1
- package/src/components/textarea/COMPONENT.md +6 -3
- package/src/layout/page/COMPONENT.md +13 -12
- package/src/layout/page/examples/collapse.tsx +45 -31
- package/src/layout/page/examples/router.tsx +47 -14
|
@@ -104,6 +104,7 @@ import {
|
|
|
104
104
|
Sun,
|
|
105
105
|
TOKEN_DEFAULTS,
|
|
106
106
|
Tablet,
|
|
107
|
+
Telegram,
|
|
107
108
|
TextQuote,
|
|
108
109
|
Trash2,
|
|
109
110
|
TriangleAlert,
|
|
@@ -114,9 +115,11 @@ import {
|
|
|
114
115
|
UserRound,
|
|
115
116
|
Users,
|
|
116
117
|
Video,
|
|
118
|
+
Vk,
|
|
117
119
|
Volume2,
|
|
118
120
|
VolumeX,
|
|
119
121
|
Wallet,
|
|
122
|
+
Whatsapp,
|
|
120
123
|
X,
|
|
121
124
|
ZoomIn,
|
|
122
125
|
ZoomOut,
|
|
@@ -140,7 +143,7 @@ import {
|
|
|
140
143
|
useIconRoot,
|
|
141
144
|
useOptionalControlSize,
|
|
142
145
|
usePresence
|
|
143
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-HMLQCKRL.js";
|
|
144
147
|
|
|
145
148
|
// src/components/scroll-container/ScrollContainer.tsx
|
|
146
149
|
import * as React9 from "react";
|
|
@@ -510,24 +513,30 @@ function useEdgeOverflow(ref, axis, depth = false) {
|
|
|
510
513
|
// src/hooks/useMergedRefs.ts
|
|
511
514
|
import * as React4 from "react";
|
|
512
515
|
function assignRef(ref, value) {
|
|
513
|
-
if (typeof ref === "function")
|
|
514
|
-
|
|
516
|
+
if (typeof ref === "function") {
|
|
517
|
+
const cleanup = ref(value);
|
|
518
|
+
return typeof cleanup === "function" ? cleanup : void 0;
|
|
519
|
+
}
|
|
520
|
+
if (ref) ref.current = value;
|
|
521
|
+
return void 0;
|
|
515
522
|
}
|
|
516
|
-
function releaseRef(ref, node) {
|
|
517
|
-
if (typeof ref === "function")
|
|
518
|
-
|
|
523
|
+
function releaseRef(ref, node, cleanup) {
|
|
524
|
+
if (typeof ref === "function") {
|
|
525
|
+
if (cleanup) cleanup();
|
|
526
|
+
else ref(null);
|
|
527
|
+
} else if (ref && ref.current === node) ref.current = null;
|
|
519
528
|
}
|
|
520
529
|
function useMergedRefs(a, b, c) {
|
|
521
530
|
return React4.useCallback(
|
|
522
531
|
(value) => {
|
|
523
|
-
assignRef(a, value);
|
|
524
|
-
assignRef(b, value);
|
|
525
|
-
assignRef(c, value);
|
|
526
532
|
if (value === null) return;
|
|
533
|
+
const cleanupA = assignRef(a, value);
|
|
534
|
+
const cleanupB = assignRef(b, value);
|
|
535
|
+
const cleanupC = assignRef(c, value);
|
|
527
536
|
return () => {
|
|
528
|
-
releaseRef(a, value);
|
|
529
|
-
releaseRef(b, value);
|
|
530
|
-
releaseRef(c, value);
|
|
537
|
+
releaseRef(a, value, cleanupA);
|
|
538
|
+
releaseRef(b, value, cleanupB);
|
|
539
|
+
releaseRef(c, value, cleanupC);
|
|
531
540
|
};
|
|
532
541
|
},
|
|
533
542
|
[a, b, c]
|
|
@@ -2929,7 +2938,13 @@ var iconRegistry = {
|
|
|
2929
2938
|
"view.preview": Eye,
|
|
2930
2939
|
"viewport.desktop": Monitor,
|
|
2931
2940
|
"viewport.mobile": Smartphone,
|
|
2932
|
-
"viewport.tablet": Tablet
|
|
2941
|
+
"viewport.tablet": Tablet,
|
|
2942
|
+
/** A channel or account on Telegram (a filter, a connect choice). */
|
|
2943
|
+
"brand.telegram": Telegram,
|
|
2944
|
+
/** A channel or account on VK. */
|
|
2945
|
+
"brand.vk": Vk,
|
|
2946
|
+
/** A channel or account on WhatsApp. */
|
|
2947
|
+
"brand.whatsapp": Whatsapp
|
|
2933
2948
|
};
|
|
2934
2949
|
|
|
2935
2950
|
// src/icons/Icon.tsx
|
|
@@ -5268,10 +5283,31 @@ function getPasswordStrength(value) {
|
|
|
5268
5283
|
}
|
|
5269
5284
|
|
|
5270
5285
|
// src/components/input/Input.tsx
|
|
5271
|
-
import * as
|
|
5286
|
+
import * as React52 from "react";
|
|
5272
5287
|
|
|
5273
|
-
// src/internal/
|
|
5288
|
+
// src/internal/autofill.tsx
|
|
5274
5289
|
import * as React44 from "react";
|
|
5290
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5291
|
+
var AUTOFILL_OFF = {
|
|
5292
|
+
autoComplete: "off",
|
|
5293
|
+
"data-1p-ignore": "true",
|
|
5294
|
+
"data-lpignore": "true",
|
|
5295
|
+
"data-bwignore": "true",
|
|
5296
|
+
"data-form-type": "other"
|
|
5297
|
+
};
|
|
5298
|
+
var AutofillContext = React44.createContext(false);
|
|
5299
|
+
function AutofillScope({ children }) {
|
|
5300
|
+
return /* @__PURE__ */ jsx24(AutofillContext.Provider, { value: true, children });
|
|
5301
|
+
}
|
|
5302
|
+
function useAutofill(autoComplete) {
|
|
5303
|
+
const scoped = React44.useContext(AutofillContext);
|
|
5304
|
+
if (autoComplete && autoComplete !== "off") return { autoComplete };
|
|
5305
|
+
if (scoped && !autoComplete) return {};
|
|
5306
|
+
return AUTOFILL_OFF;
|
|
5307
|
+
}
|
|
5308
|
+
|
|
5309
|
+
// src/internal/FieldAction.tsx
|
|
5310
|
+
import * as React45 from "react";
|
|
5275
5311
|
|
|
5276
5312
|
// src/internal/FieldAction.module.css
|
|
5277
5313
|
var FieldAction_default = {
|
|
@@ -5279,7 +5315,7 @@ var FieldAction_default = {
|
|
|
5279
5315
|
};
|
|
5280
5316
|
|
|
5281
5317
|
// src/internal/FieldAction.tsx
|
|
5282
|
-
import { Fragment as Fragment7, jsx as
|
|
5318
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5283
5319
|
var fieldActionClass = cx(FieldAction_default.action, touchTargetBlockClass);
|
|
5284
5320
|
function FieldActionButton({
|
|
5285
5321
|
label,
|
|
@@ -5298,17 +5334,17 @@ function FieldActionButton({
|
|
|
5298
5334
|
"aria-label": label,
|
|
5299
5335
|
"data-field-action": ""
|
|
5300
5336
|
};
|
|
5301
|
-
const segment = asChild ? /* @__PURE__ */
|
|
5337
|
+
const segment = asChild ? /* @__PURE__ */ jsx25(Slot, { ...shared, ref, "aria-disabled": disabled || void 0, children }) : /* @__PURE__ */ jsx25("button", { ...shared, ref, type, disabled, children: /* @__PURE__ */ jsx25(GlyphSwap, { children }) });
|
|
5302
5338
|
if (!tooltip) return segment;
|
|
5303
5339
|
return /* @__PURE__ */ jsxs13(Tooltip.Root, { children: [
|
|
5304
|
-
/* @__PURE__ */
|
|
5305
|
-
/* @__PURE__ */
|
|
5340
|
+
/* @__PURE__ */ jsx25(Tooltip.Trigger, { children: segment }),
|
|
5341
|
+
/* @__PURE__ */ jsx25(Tooltip.Content, { children: label })
|
|
5306
5342
|
] });
|
|
5307
5343
|
}
|
|
5308
5344
|
var COPY_FEEDBACK_MS = 1600;
|
|
5309
5345
|
function FieldCopyButton({ getText, labels, onClick: onClick2, ...rest }) {
|
|
5310
|
-
const [state, setState] =
|
|
5311
|
-
|
|
5346
|
+
const [state, setState] = React45.useState("idle");
|
|
5347
|
+
React45.useEffect(() => {
|
|
5312
5348
|
if (state === "idle") return;
|
|
5313
5349
|
const timer = window.setTimeout(() => setState("idle"), COPY_FEEDBACK_MS);
|
|
5314
5350
|
return () => window.clearTimeout(timer);
|
|
@@ -5316,7 +5352,7 @@ function FieldCopyButton({ getText, labels, onClick: onClick2, ...rest }) {
|
|
|
5316
5352
|
const label = state === "copied" ? labels.copied : state === "error" ? labels.copyError : labels.copy;
|
|
5317
5353
|
const glyph = state === "copied" ? "action.check" : "action.copy";
|
|
5318
5354
|
return /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
5319
|
-
/* @__PURE__ */
|
|
5355
|
+
/* @__PURE__ */ jsx25(
|
|
5320
5356
|
FieldActionButton,
|
|
5321
5357
|
{
|
|
5322
5358
|
...rest,
|
|
@@ -5332,15 +5368,15 @@ function FieldCopyButton({ getText, labels, onClick: onClick2, ...rest }) {
|
|
|
5332
5368
|
setState("error");
|
|
5333
5369
|
}
|
|
5334
5370
|
},
|
|
5335
|
-
children: /* @__PURE__ */
|
|
5371
|
+
children: /* @__PURE__ */ jsx25(Icon, { name: glyph })
|
|
5336
5372
|
}
|
|
5337
5373
|
),
|
|
5338
|
-
/* @__PURE__ */
|
|
5374
|
+
/* @__PURE__ */ jsx25(VisuallyHidden, { live: "polite", children: state === "idle" ? "" : label })
|
|
5339
5375
|
] });
|
|
5340
5376
|
}
|
|
5341
5377
|
|
|
5342
5378
|
// src/internal/FieldCommit.tsx
|
|
5343
|
-
import * as
|
|
5379
|
+
import * as React46 from "react";
|
|
5344
5380
|
|
|
5345
5381
|
// src/internal/controlValue.ts
|
|
5346
5382
|
function setControlValue(control, value) {
|
|
@@ -5355,36 +5391,36 @@ var FieldCommit_default = {
|
|
|
5355
5391
|
};
|
|
5356
5392
|
|
|
5357
5393
|
// src/internal/FieldCommit.tsx
|
|
5358
|
-
import { Fragment as Fragment8, jsx as
|
|
5394
|
+
import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5359
5395
|
var SAVED_MS = 1600;
|
|
5360
5396
|
function useFieldCommit(controlRef, onCommit) {
|
|
5361
|
-
const [state, setState] =
|
|
5362
|
-
const committed =
|
|
5363
|
-
const started =
|
|
5364
|
-
const settled =
|
|
5365
|
-
const pending2 =
|
|
5366
|
-
const onCommitRef =
|
|
5397
|
+
const [state, setState] = React46.useState("idle");
|
|
5398
|
+
const committed = React46.useRef(null);
|
|
5399
|
+
const started = React46.useRef(0);
|
|
5400
|
+
const settled = React46.useRef(0);
|
|
5401
|
+
const pending2 = React46.useRef(0);
|
|
5402
|
+
const onCommitRef = React46.useRef(onCommit);
|
|
5367
5403
|
onCommitRef.current = onCommit;
|
|
5368
|
-
|
|
5404
|
+
React46.useLayoutEffect(() => {
|
|
5369
5405
|
if (committed.current === null && controlRef.current) {
|
|
5370
5406
|
committed.current = controlRef.current.value;
|
|
5371
5407
|
}
|
|
5372
5408
|
}, [controlRef]);
|
|
5373
|
-
|
|
5409
|
+
React46.useEffect(() => {
|
|
5374
5410
|
if (state !== "saved") return;
|
|
5375
5411
|
const timer = window.setTimeout(() => setState("idle"), SAVED_MS);
|
|
5376
5412
|
return () => window.clearTimeout(timer);
|
|
5377
5413
|
}, [state]);
|
|
5378
|
-
const sync =
|
|
5414
|
+
const sync = React46.useCallback(() => {
|
|
5379
5415
|
if (pending2.current === 0 && controlRef.current) committed.current = controlRef.current.value;
|
|
5380
5416
|
}, [controlRef]);
|
|
5381
|
-
const revert =
|
|
5417
|
+
const revert = React46.useCallback(() => {
|
|
5382
5418
|
const control = controlRef.current;
|
|
5383
5419
|
if (!control || committed.current === null || control.value === committed.current) return false;
|
|
5384
5420
|
setControlValue(control, committed.current);
|
|
5385
5421
|
return true;
|
|
5386
5422
|
}, [controlRef]);
|
|
5387
|
-
const commit =
|
|
5423
|
+
const commit = React46.useCallback(() => {
|
|
5388
5424
|
const control = controlRef.current;
|
|
5389
5425
|
const handler = onCommitRef.current;
|
|
5390
5426
|
if (!control || !handler) return;
|
|
@@ -5438,11 +5474,11 @@ function FieldCommitStatus({
|
|
|
5438
5474
|
}) {
|
|
5439
5475
|
const shown = state !== "idle";
|
|
5440
5476
|
const presence = usePresence(shown, { exitDuration: "fast" });
|
|
5441
|
-
const last =
|
|
5477
|
+
const last = React46.useRef(state);
|
|
5442
5478
|
if (shown) last.current = state;
|
|
5443
5479
|
const glyph = shown ? state : last.current;
|
|
5444
5480
|
return /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5445
|
-
presence.mounted ? /* @__PURE__ */
|
|
5481
|
+
presence.mounted ? /* @__PURE__ */ jsx26(
|
|
5446
5482
|
"span",
|
|
5447
5483
|
{
|
|
5448
5484
|
className: cx(
|
|
@@ -5453,21 +5489,21 @@ function FieldCommitStatus({
|
|
|
5453
5489
|
"data-commit": glyph,
|
|
5454
5490
|
"aria-hidden": "true",
|
|
5455
5491
|
onAnimationEnd: presence.onExitEnd,
|
|
5456
|
-
children: /* @__PURE__ */
|
|
5492
|
+
children: /* @__PURE__ */ jsx26(GlyphSwap, { children: glyph === "saved" ? /* @__PURE__ */ jsx26(Icon, { name: "action.check" }) : /* @__PURE__ */ jsx26(Spinner, { "aria-hidden": "true" }) })
|
|
5457
5493
|
}
|
|
5458
5494
|
) : null,
|
|
5459
|
-
/* @__PURE__ */
|
|
5495
|
+
/* @__PURE__ */ jsx26(VisuallyHidden, { live: "polite", children: state === "pending" ? labels.saving : state === "saved" ? labels.saved : "" })
|
|
5460
5496
|
] });
|
|
5461
5497
|
}
|
|
5462
5498
|
|
|
5463
5499
|
// src/internal/FieldFrame.tsx
|
|
5464
|
-
import * as
|
|
5500
|
+
import * as React48 from "react";
|
|
5465
5501
|
|
|
5466
5502
|
// src/internal/fieldCell.ts
|
|
5467
|
-
import * as
|
|
5468
|
-
var FieldCellContext =
|
|
5503
|
+
import * as React47 from "react";
|
|
5504
|
+
var FieldCellContext = React47.createContext(null);
|
|
5469
5505
|
function useFieldCell() {
|
|
5470
|
-
return
|
|
5506
|
+
return React47.useContext(FieldCellContext);
|
|
5471
5507
|
}
|
|
5472
5508
|
|
|
5473
5509
|
// src/internal/FieldFrame.module.css
|
|
@@ -5485,7 +5521,7 @@ var FieldFrame_default = {
|
|
|
5485
5521
|
};
|
|
5486
5522
|
|
|
5487
5523
|
// src/internal/FieldFrame.tsx
|
|
5488
|
-
import { jsx as
|
|
5524
|
+
import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5489
5525
|
var REQUIRED_ROLES = /* @__PURE__ */ new Set([
|
|
5490
5526
|
"checkbox",
|
|
5491
5527
|
"combobox",
|
|
@@ -5504,7 +5540,7 @@ function useFieldFrame(explicitId, {
|
|
|
5504
5540
|
invalid,
|
|
5505
5541
|
required
|
|
5506
5542
|
}, ariaDescribedBy) {
|
|
5507
|
-
const generated =
|
|
5543
|
+
const generated = React48.useId();
|
|
5508
5544
|
const cell = useFieldCell();
|
|
5509
5545
|
const controlId = explicitId ?? generated;
|
|
5510
5546
|
const labelId = `${controlId}-label`;
|
|
@@ -5544,9 +5580,9 @@ function useFieldFrame(explicitId, {
|
|
|
5544
5580
|
}
|
|
5545
5581
|
function useErrorShake(invalid, error) {
|
|
5546
5582
|
const key = !invalid ? null : typeof error === "string" || typeof error === "number" ? String(error) : "invalid";
|
|
5547
|
-
const previous =
|
|
5548
|
-
const [count, setCount] =
|
|
5549
|
-
|
|
5583
|
+
const previous = React48.useRef(key);
|
|
5584
|
+
const [count, setCount] = React48.useState(0);
|
|
5585
|
+
React48.useEffect(() => {
|
|
5550
5586
|
if (key !== null && key !== previous.current) setCount((n) => n + 1);
|
|
5551
5587
|
previous.current = key;
|
|
5552
5588
|
}, [key]);
|
|
@@ -5554,7 +5590,7 @@ function useErrorShake(invalid, error) {
|
|
|
5554
5590
|
return count % 2 ? "odd" : "even";
|
|
5555
5591
|
}
|
|
5556
5592
|
function useLeavingError(showError, error) {
|
|
5557
|
-
const last =
|
|
5593
|
+
const last = React48.useRef(error);
|
|
5558
5594
|
if (showError) last.current = error;
|
|
5559
5595
|
const presence = usePresence(showError, { exitDuration: "fast" });
|
|
5560
5596
|
if (showError || !presence.mounted) return null;
|
|
@@ -5574,9 +5610,9 @@ function FieldSupport({
|
|
|
5574
5610
|
}) {
|
|
5575
5611
|
let text = null;
|
|
5576
5612
|
if (ids.showError) {
|
|
5577
|
-
text = /* @__PURE__ */
|
|
5613
|
+
text = /* @__PURE__ */ jsx27(Hint.Root, { id: ids.errorId, size, invalid: true, className: textClassName, children: error });
|
|
5578
5614
|
} else if (leaving) {
|
|
5579
|
-
text = /* @__PURE__ */
|
|
5615
|
+
text = /* @__PURE__ */ jsx27(
|
|
5580
5616
|
Hint.Root,
|
|
5581
5617
|
{
|
|
5582
5618
|
size,
|
|
@@ -5588,7 +5624,7 @@ function FieldSupport({
|
|
|
5588
5624
|
}
|
|
5589
5625
|
);
|
|
5590
5626
|
} else if (ids.showHint) {
|
|
5591
|
-
text = /* @__PURE__ */
|
|
5627
|
+
text = /* @__PURE__ */ jsx27(
|
|
5592
5628
|
Hint.Root,
|
|
5593
5629
|
{
|
|
5594
5630
|
id: ids.hintId,
|
|
@@ -5600,7 +5636,7 @@ function FieldSupport({
|
|
|
5600
5636
|
}
|
|
5601
5637
|
);
|
|
5602
5638
|
}
|
|
5603
|
-
return /* @__PURE__ */
|
|
5639
|
+
return /* @__PURE__ */ jsx27("div", { className, "aria-live": live ? "polite" : void 0, children: text });
|
|
5604
5640
|
}
|
|
5605
5641
|
function FieldFrame({
|
|
5606
5642
|
size,
|
|
@@ -5627,7 +5663,7 @@ function FieldFrame({
|
|
|
5627
5663
|
const shake = useErrorShake(ids.invalid, error);
|
|
5628
5664
|
const cell = useFieldCell();
|
|
5629
5665
|
const shownLabel = hasContent(label) ? label : cell?.label;
|
|
5630
|
-
const labelNode = hasContent(shownLabel) ? /* @__PURE__ */
|
|
5666
|
+
const labelNode = hasContent(shownLabel) ? /* @__PURE__ */ jsx27(
|
|
5631
5667
|
Label.Root,
|
|
5632
5668
|
{
|
|
5633
5669
|
id: ids.labelId,
|
|
@@ -5659,7 +5695,7 @@ function FieldFrame({
|
|
|
5659
5695
|
children: [
|
|
5660
5696
|
labelEnd != null ? /* @__PURE__ */ jsxs15("div", { className: FieldFrame_default.labelRow, children: [
|
|
5661
5697
|
labelNode,
|
|
5662
|
-
/* @__PURE__ */
|
|
5698
|
+
/* @__PURE__ */ jsx27("span", { className: FieldFrame_default.labelEnd, children: labelEnd })
|
|
5663
5699
|
] }) : labelNode,
|
|
5664
5700
|
/* @__PURE__ */ jsxs15("div", { className: cx(FieldFrame_default.body, enterMotion_default.shakeParts), "data-shake": shake, children: [
|
|
5665
5701
|
children,
|
|
@@ -5674,7 +5710,7 @@ function FieldFrame({
|
|
|
5674
5710
|
empty: !showSupport || void 0
|
|
5675
5711
|
}),
|
|
5676
5712
|
children: [
|
|
5677
|
-
/* @__PURE__ */
|
|
5713
|
+
/* @__PURE__ */ jsx27(
|
|
5678
5714
|
FieldSupport,
|
|
5679
5715
|
{
|
|
5680
5716
|
ids,
|
|
@@ -5693,7 +5729,7 @@ function FieldFrame({
|
|
|
5693
5729
|
}
|
|
5694
5730
|
)
|
|
5695
5731
|
] }),
|
|
5696
|
-
requiredLabel && ids.required ? /* @__PURE__ */
|
|
5732
|
+
requiredLabel && ids.required ? /* @__PURE__ */ jsx27(VisuallyHidden, { id: ids.requiredId, children: requiredLabel }) : null
|
|
5697
5733
|
]
|
|
5698
5734
|
}
|
|
5699
5735
|
);
|
|
@@ -5708,18 +5744,18 @@ function FieldCounter({ current, max, size, label, className, ...rest }) {
|
|
|
5708
5744
|
"data-invalid": current > max || void 0,
|
|
5709
5745
|
children: [
|
|
5710
5746
|
/* @__PURE__ */ jsxs15("span", { "aria-hidden": "true", children: [
|
|
5711
|
-
/* @__PURE__ */
|
|
5747
|
+
/* @__PURE__ */ jsx27(RollingNumber, { children: current }),
|
|
5712
5748
|
"/",
|
|
5713
5749
|
max
|
|
5714
5750
|
] }),
|
|
5715
|
-
/* @__PURE__ */
|
|
5751
|
+
/* @__PURE__ */ jsx27(VisuallyHidden, { live: "polite", children: formatLabel(label, { current, max }) })
|
|
5716
5752
|
]
|
|
5717
5753
|
}
|
|
5718
5754
|
);
|
|
5719
5755
|
}
|
|
5720
5756
|
|
|
5721
5757
|
// src/internal/listbox.ts
|
|
5722
|
-
import * as
|
|
5758
|
+
import * as React49 from "react";
|
|
5723
5759
|
|
|
5724
5760
|
// src/internal/rovingFocus.ts
|
|
5725
5761
|
var PREV = {
|
|
@@ -5787,11 +5823,11 @@ function createStore(initial) {
|
|
|
5787
5823
|
};
|
|
5788
5824
|
}
|
|
5789
5825
|
function useCreateStore(initial) {
|
|
5790
|
-
return
|
|
5826
|
+
return React49.useState(() => createStore(initial))[0];
|
|
5791
5827
|
}
|
|
5792
5828
|
function useStoreSlice(store, select) {
|
|
5793
5829
|
const read = () => select(store.get());
|
|
5794
|
-
return
|
|
5830
|
+
return React49.useSyncExternalStore(store.subscribe, read, read);
|
|
5795
5831
|
}
|
|
5796
5832
|
function createListboxRegistry() {
|
|
5797
5833
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -5848,19 +5884,19 @@ function createListboxRegistry() {
|
|
|
5848
5884
|
};
|
|
5849
5885
|
}
|
|
5850
5886
|
function useListboxRegistry() {
|
|
5851
|
-
return
|
|
5887
|
+
return React49.useState(createListboxRegistry)[0];
|
|
5852
5888
|
}
|
|
5853
5889
|
function useListboxView(registry, query = "", filter = true) {
|
|
5854
5890
|
const read = () => registry.view(query, filter);
|
|
5855
|
-
return
|
|
5891
|
+
return React49.useSyncExternalStore(registry.subscribe, read, read);
|
|
5856
5892
|
}
|
|
5857
5893
|
function useListboxItem(registry, id, item, nodeRef) {
|
|
5858
|
-
const activateRef =
|
|
5859
|
-
|
|
5894
|
+
const activateRef = React49.useRef(item.onActivate);
|
|
5895
|
+
React49.useLayoutEffect(() => {
|
|
5860
5896
|
activateRef.current = item.onActivate;
|
|
5861
5897
|
});
|
|
5862
5898
|
const { label, haystack, disabled = false, persistent = false } = item;
|
|
5863
|
-
|
|
5899
|
+
React49.useLayoutEffect(
|
|
5864
5900
|
() => registry.register(
|
|
5865
5901
|
id,
|
|
5866
5902
|
{ label, haystack, disabled, persistent, onActivate: () => activateRef.current() },
|
|
@@ -5893,10 +5929,10 @@ function handleListboxKeyDown(event, { ids, highlight, activate }) {
|
|
|
5893
5929
|
}
|
|
5894
5930
|
var TYPEAHEAD_RESET_MS = 500;
|
|
5895
5931
|
function useTypeahead() {
|
|
5896
|
-
const state =
|
|
5897
|
-
|
|
5898
|
-
const isTyping =
|
|
5899
|
-
const find =
|
|
5932
|
+
const state = React49.useRef({ buffer: "", timer: 0 });
|
|
5933
|
+
React49.useEffect(() => () => window.clearTimeout(state.current.timer), []);
|
|
5934
|
+
const isTyping = React49.useCallback(() => state.current.buffer !== "", []);
|
|
5935
|
+
const find = React49.useCallback(
|
|
5900
5936
|
(key, ids, highlighted, labelOf) => {
|
|
5901
5937
|
const s = state.current;
|
|
5902
5938
|
window.clearTimeout(s.timer);
|
|
@@ -5931,10 +5967,10 @@ var Input_default = {
|
|
|
5931
5967
|
};
|
|
5932
5968
|
|
|
5933
5969
|
// src/components/input/inputSuggestions.tsx
|
|
5934
|
-
import * as
|
|
5970
|
+
import * as React51 from "react";
|
|
5935
5971
|
|
|
5936
5972
|
// src/internal/HighlightMatch.tsx
|
|
5937
|
-
import * as
|
|
5973
|
+
import * as React50 from "react";
|
|
5938
5974
|
|
|
5939
5975
|
// src/internal/HighlightMatch.module.css
|
|
5940
5976
|
var HighlightMatch_default = {
|
|
@@ -5942,7 +5978,7 @@ var HighlightMatch_default = {
|
|
|
5942
5978
|
};
|
|
5943
5979
|
|
|
5944
5980
|
// src/internal/HighlightMatch.tsx
|
|
5945
|
-
import { Fragment as Fragment9, jsx as
|
|
5981
|
+
import { Fragment as Fragment9, jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5946
5982
|
function matchIndex(text, query) {
|
|
5947
5983
|
if (!query) return -1;
|
|
5948
5984
|
return text.toLowerCase().indexOf(query.toLowerCase());
|
|
@@ -5954,11 +5990,11 @@ function HighlightMatch({
|
|
|
5954
5990
|
}) {
|
|
5955
5991
|
const q = query.trim();
|
|
5956
5992
|
const at = matchIndex(text, q);
|
|
5957
|
-
if (at < 0) return /* @__PURE__ */
|
|
5993
|
+
if (at < 0) return /* @__PURE__ */ jsx28(Fragment9, { children: text });
|
|
5958
5994
|
if (!all) {
|
|
5959
5995
|
return /* @__PURE__ */ jsxs16("span", { children: [
|
|
5960
5996
|
text.slice(0, at),
|
|
5961
|
-
/* @__PURE__ */
|
|
5997
|
+
/* @__PURE__ */ jsx28("mark", { className: HighlightMatch_default.match, children: text.slice(at, at + q.length) }),
|
|
5962
5998
|
text.slice(at + q.length)
|
|
5963
5999
|
] });
|
|
5964
6000
|
}
|
|
@@ -5969,18 +6005,18 @@ function HighlightMatch({
|
|
|
5969
6005
|
for (let found = at; found >= 0; found = lower.indexOf(needle, from)) {
|
|
5970
6006
|
if (found > from) pieces.push(text.slice(from, found));
|
|
5971
6007
|
pieces.push(
|
|
5972
|
-
/* @__PURE__ */
|
|
6008
|
+
/* @__PURE__ */ jsx28("mark", { className: HighlightMatch_default.match, children: text.slice(found, found + q.length) }, found)
|
|
5973
6009
|
);
|
|
5974
6010
|
from = found + q.length;
|
|
5975
6011
|
}
|
|
5976
6012
|
if (from < text.length) pieces.push(text.slice(from));
|
|
5977
|
-
return /* @__PURE__ */
|
|
6013
|
+
return /* @__PURE__ */ jsx28("span", { children: pieces });
|
|
5978
6014
|
}
|
|
5979
6015
|
function highlightChildren(children, query) {
|
|
5980
6016
|
if (!query.trim()) return children;
|
|
5981
|
-
return
|
|
6017
|
+
return React50.Children.map(
|
|
5982
6018
|
children,
|
|
5983
|
-
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */
|
|
6019
|
+
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */ jsx28(HighlightMatch, { text: String(child), query }) : child
|
|
5984
6020
|
);
|
|
5985
6021
|
}
|
|
5986
6022
|
|
|
@@ -6006,26 +6042,26 @@ var menu_default = {
|
|
|
6006
6042
|
};
|
|
6007
6043
|
|
|
6008
6044
|
// src/components/input/inputSuggestions.tsx
|
|
6009
|
-
import { jsx as
|
|
6045
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
6010
6046
|
function matchesOf(items, text) {
|
|
6011
6047
|
const query = text.trim().toLocaleLowerCase();
|
|
6012
6048
|
const found = items.filter((item) => item.toLocaleLowerCase().includes(query));
|
|
6013
6049
|
return found.length === 1 && found[0]?.toLocaleLowerCase() === query ? [] : found;
|
|
6014
6050
|
}
|
|
6015
6051
|
function useInputSuggestions(items, inputRef, listboxId, labelledBy, { closeOnEscape, closeOnOutsideClick }) {
|
|
6016
|
-
const [open, setOpen] =
|
|
6017
|
-
const [query, setQuery] =
|
|
6052
|
+
const [open, setOpen] = React51.useState(false);
|
|
6053
|
+
const [query, setQuery] = React51.useState("");
|
|
6018
6054
|
const highlight = useCreateStore(void 0);
|
|
6019
|
-
const anchorRef =
|
|
6020
|
-
const pickingRef =
|
|
6055
|
+
const anchorRef = React51.useRef(null);
|
|
6056
|
+
const pickingRef = React51.useRef(false);
|
|
6021
6057
|
const list = items ?? [];
|
|
6022
|
-
const matches =
|
|
6058
|
+
const matches = React51.useMemo(() => items ? matchesOf(items, query) : [], [items, query]);
|
|
6023
6059
|
const shown = open && matches.length > 0;
|
|
6024
|
-
|
|
6060
|
+
React51.useEffect(() => {
|
|
6025
6061
|
const current = highlight.get();
|
|
6026
6062
|
if (current !== void 0 && !matches.includes(current)) highlight.set(void 0);
|
|
6027
6063
|
}, [matches, highlight]);
|
|
6028
|
-
const close =
|
|
6064
|
+
const close = React51.useCallback(() => {
|
|
6029
6065
|
setOpen(false);
|
|
6030
6066
|
highlight.set(void 0);
|
|
6031
6067
|
}, [highlight]);
|
|
@@ -6117,7 +6153,7 @@ function InputSuggestionList({
|
|
|
6117
6153
|
closeOnOutsideClick: suggest.closeOnOutsideClick,
|
|
6118
6154
|
matchAnchorWidth: true
|
|
6119
6155
|
});
|
|
6120
|
-
return /* @__PURE__ */
|
|
6156
|
+
return /* @__PURE__ */ jsx29(
|
|
6121
6157
|
FloatingPanel,
|
|
6122
6158
|
{
|
|
6123
6159
|
floating,
|
|
@@ -6125,7 +6161,7 @@ function InputSuggestionList({
|
|
|
6125
6161
|
scroll: true,
|
|
6126
6162
|
width: "trigger",
|
|
6127
6163
|
className: cx(fieldTierClass, menu_default.tier, menu_default.menu),
|
|
6128
|
-
children: /* @__PURE__ */
|
|
6164
|
+
children: /* @__PURE__ */ jsx29("div", { id: suggest.listboxId, role: "listbox", "aria-labelledby": suggest.labelledBy, children: suggest.matches.map((item) => /* @__PURE__ */ jsx29(SuggestionOption, { item, suggest }, item)) })
|
|
6129
6165
|
}
|
|
6130
6166
|
);
|
|
6131
6167
|
}
|
|
@@ -6133,7 +6169,7 @@ function SuggestionOption({ item, suggest }) {
|
|
|
6133
6169
|
const highlighted = useStoreSlice(suggest.highlight, (value) => value === item);
|
|
6134
6170
|
return (
|
|
6135
6171
|
// biome-ignore lint/a11y/useKeyWithClickEvents: the keyboard stays in the field (`aria-activedescendant`)
|
|
6136
|
-
/* @__PURE__ */
|
|
6172
|
+
/* @__PURE__ */ jsx29(
|
|
6137
6173
|
"div",
|
|
6138
6174
|
{
|
|
6139
6175
|
id: optionDomId(suggest.listboxId, item),
|
|
@@ -6147,14 +6183,14 @@ function SuggestionOption({ item, suggest }) {
|
|
|
6147
6183
|
if (!highlighted) suggest.highlight.set(item);
|
|
6148
6184
|
},
|
|
6149
6185
|
onClick: () => suggest.pick(item),
|
|
6150
|
-
children: /* @__PURE__ */
|
|
6186
|
+
children: /* @__PURE__ */ jsx29(HighlightMatch, { text: item, query: suggest.query })
|
|
6151
6187
|
}
|
|
6152
6188
|
)
|
|
6153
6189
|
);
|
|
6154
6190
|
}
|
|
6155
6191
|
|
|
6156
6192
|
// src/components/input/Input.tsx
|
|
6157
|
-
import { Fragment as Fragment10, jsx as
|
|
6193
|
+
import { Fragment as Fragment10, jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6158
6194
|
var INPUT_LABELS = {
|
|
6159
6195
|
optional: "\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E",
|
|
6160
6196
|
clear: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
|
|
@@ -6180,7 +6216,7 @@ var STRENGTH_TONES = {
|
|
|
6180
6216
|
4: "success"
|
|
6181
6217
|
};
|
|
6182
6218
|
var [InputProvider, useInputContext] = createComponentContext("Input");
|
|
6183
|
-
var InputSegmentContext =
|
|
6219
|
+
var InputSegmentContext = React52.createContext(false);
|
|
6184
6220
|
var NO_HIGHLIGHT = createStore(void 0);
|
|
6185
6221
|
function InputRoot({
|
|
6186
6222
|
size: sizeProp,
|
|
@@ -6208,18 +6244,18 @@ function InputRoot({
|
|
|
6208
6244
|
className,
|
|
6209
6245
|
...rest
|
|
6210
6246
|
}) {
|
|
6211
|
-
const [strengthValue, setStrengthValue] =
|
|
6247
|
+
const [strengthValue, setStrengthValue] = React52.useState("");
|
|
6212
6248
|
const tier = useHostTier(sizeProp);
|
|
6213
6249
|
const { size } = tier;
|
|
6214
6250
|
const labels = useLabels(INPUT_LABELS, labelsProp);
|
|
6215
6251
|
const level = strength ? getStrength(strengthValue) : 0;
|
|
6216
6252
|
const tooWeak = level > 0 && minStrength !== void 0 && level < minStrength;
|
|
6217
|
-
const [weakReported, setWeakReported] =
|
|
6218
|
-
const reportInvalid =
|
|
6253
|
+
const [weakReported, setWeakReported] = React52.useState(false);
|
|
6254
|
+
const reportInvalid = React52.useCallback(() => setWeakReported(true), []);
|
|
6219
6255
|
const shownError = error ?? (weakReported && tooWeak ? labels.strengthTooWeak : void 0);
|
|
6220
6256
|
const ids = useFieldFrame(id, { label, hint, error: shownError, invalid, required });
|
|
6221
6257
|
const { invalid: isInvalid, controlId: inputId, describedBy, required: isRequired } = ids;
|
|
6222
|
-
const inputRef =
|
|
6258
|
+
const inputRef = React52.useRef(null);
|
|
6223
6259
|
const suggest = useInputSuggestions(
|
|
6224
6260
|
suggestions,
|
|
6225
6261
|
inputRef,
|
|
@@ -6229,14 +6265,14 @@ function InputRoot({
|
|
|
6229
6265
|
);
|
|
6230
6266
|
const commit = useFieldCommit(inputRef, onCommit);
|
|
6231
6267
|
const hasCommit = onCommit !== void 0;
|
|
6232
|
-
const [revealed, setRevealed] =
|
|
6233
|
-
const selectionRef =
|
|
6234
|
-
const mountedRef =
|
|
6235
|
-
|
|
6268
|
+
const [revealed, setRevealed] = React52.useState(false);
|
|
6269
|
+
const selectionRef = React52.useRef(null);
|
|
6270
|
+
const mountedRef = React52.useRef(false);
|
|
6271
|
+
React52.useEffect(() => {
|
|
6236
6272
|
mountedRef.current = true;
|
|
6237
6273
|
}, []);
|
|
6238
|
-
const [affixes, setAffixes] =
|
|
6239
|
-
const addAffix =
|
|
6274
|
+
const [affixes, setAffixes] = React52.useState([]);
|
|
6275
|
+
const addAffix = React52.useCallback((affixId) => {
|
|
6240
6276
|
setAffixes((current) => [...current, affixId]);
|
|
6241
6277
|
return () => setAffixes((current) => current.filter((item) => item !== affixId));
|
|
6242
6278
|
}, []);
|
|
@@ -6244,7 +6280,7 @@ function InputRoot({
|
|
|
6244
6280
|
const isValid = Boolean(valid) && !isInvalid;
|
|
6245
6281
|
const validId = valid === void 0 ? "" : `${inputId}-valid`;
|
|
6246
6282
|
const customValidity = minStrength === void 0 ? null : tooWeak ? labels.strengthTooWeak : "";
|
|
6247
|
-
const contextValue =
|
|
6283
|
+
const contextValue = React52.useMemo(
|
|
6248
6284
|
() => ({
|
|
6249
6285
|
size,
|
|
6250
6286
|
invalid: isInvalid,
|
|
@@ -6292,7 +6328,7 @@ function InputRoot({
|
|
|
6292
6328
|
);
|
|
6293
6329
|
const levelTone = tooWeak ? "danger" : level ? STRENGTH_TONES[level] : void 0;
|
|
6294
6330
|
const levelWord = level ? [labels.strengthWeak, labels.strengthEasy, labels.strengthMedium, labels.strengthHard][level - 1] : "";
|
|
6295
|
-
return /* @__PURE__ */
|
|
6331
|
+
return /* @__PURE__ */ jsx30(InputProvider, { value: contextValue, children: tier.provide(
|
|
6296
6332
|
/* @__PURE__ */ jsxs17(
|
|
6297
6333
|
FieldFrame,
|
|
6298
6334
|
{
|
|
@@ -6306,15 +6342,15 @@ function InputRoot({
|
|
|
6306
6342
|
hintTone,
|
|
6307
6343
|
error: shownError,
|
|
6308
6344
|
counter: strength ? /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
6309
|
-
/* @__PURE__ */
|
|
6345
|
+
/* @__PURE__ */ jsx30(
|
|
6310
6346
|
"span",
|
|
6311
6347
|
{
|
|
6312
6348
|
className: cx(textTone_default.tone, Input_default.strengthWord),
|
|
6313
6349
|
"data-tone": levelTone,
|
|
6314
6350
|
"aria-live": "polite",
|
|
6315
6351
|
children: levelWord ? /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
6316
|
-
/* @__PURE__ */
|
|
6317
|
-
/* @__PURE__ */
|
|
6352
|
+
/* @__PURE__ */ jsx30(VisuallyHidden, { children: `${labels.strength}: ` }),
|
|
6353
|
+
/* @__PURE__ */ jsx30(MorphText, { children: levelWord })
|
|
6318
6354
|
] }) : null
|
|
6319
6355
|
}
|
|
6320
6356
|
),
|
|
@@ -6325,7 +6361,7 @@ function InputRoot({
|
|
|
6325
6361
|
className: cx(fieldTierClass, Input_default.root, className),
|
|
6326
6362
|
children: [
|
|
6327
6363
|
children,
|
|
6328
|
-
strength ? /* @__PURE__ */
|
|
6364
|
+
strength ? /* @__PURE__ */ jsx30(
|
|
6329
6365
|
ProgressBar,
|
|
6330
6366
|
{
|
|
6331
6367
|
steps: true,
|
|
@@ -6358,11 +6394,11 @@ function InputWrapper({ children, className, ref, ...rest }) {
|
|
|
6358
6394
|
"focus-ring": focusRing
|
|
6359
6395
|
}),
|
|
6360
6396
|
children: [
|
|
6361
|
-
/* @__PURE__ */
|
|
6362
|
-
valid ? /* @__PURE__ */
|
|
6363
|
-
validId ? /* @__PURE__ */
|
|
6364
|
-
hasCommit ? /* @__PURE__ */
|
|
6365
|
-
suggest ? /* @__PURE__ */
|
|
6397
|
+
/* @__PURE__ */ jsx30(InputSegmentContext, { value: true, children }),
|
|
6398
|
+
valid ? /* @__PURE__ */ jsx30(InputValidMark, {}) : null,
|
|
6399
|
+
validId ? /* @__PURE__ */ jsx30(VisuallyHidden, { id: validId, live: "polite", children: valid ? labels.valid : "" }) : null,
|
|
6400
|
+
hasCommit ? /* @__PURE__ */ jsx30(FieldCommitStatus, { state: commit.state, labels, className: Input_default.status }) : null,
|
|
6401
|
+
suggest ? /* @__PURE__ */ jsx30(InputSuggestionList, { suggest, size }) : null
|
|
6366
6402
|
]
|
|
6367
6403
|
}
|
|
6368
6404
|
);
|
|
@@ -6370,21 +6406,21 @@ function InputWrapper({ children, className, ref, ...rest }) {
|
|
|
6370
6406
|
InputWrapper.displayName = "Input.Wrapper";
|
|
6371
6407
|
function InputValidMark() {
|
|
6372
6408
|
const { mountedRef } = useInputContext();
|
|
6373
|
-
const [arrived] =
|
|
6374
|
-
const [drawn, setDrawn] =
|
|
6375
|
-
|
|
6409
|
+
const [arrived] = React52.useState(() => mountedRef.current);
|
|
6410
|
+
const [drawn, setDrawn] = React52.useState(!arrived);
|
|
6411
|
+
React52.useEffect(() => {
|
|
6376
6412
|
if (drawn) return;
|
|
6377
6413
|
const frame2 = requestAnimationFrame(() => setDrawn(true));
|
|
6378
6414
|
return () => cancelAnimationFrame(frame2);
|
|
6379
6415
|
}, [drawn]);
|
|
6380
6416
|
const presence = usePartPresence({ axis: "inline" });
|
|
6381
|
-
return /* @__PURE__ */
|
|
6417
|
+
return /* @__PURE__ */ jsx30(
|
|
6382
6418
|
"span",
|
|
6383
6419
|
{
|
|
6384
6420
|
ref: presence.ref,
|
|
6385
6421
|
className: cx(iconSlotClass, Input_default.validMark, arrived && enterMotion_default.enter),
|
|
6386
6422
|
"aria-hidden": "true",
|
|
6387
|
-
children: /* @__PURE__ */
|
|
6423
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: "action.check", drawn })
|
|
6388
6424
|
}
|
|
6389
6425
|
);
|
|
6390
6426
|
}
|
|
@@ -6394,6 +6430,7 @@ function InputField({
|
|
|
6394
6430
|
required,
|
|
6395
6431
|
disabled: disabledProp,
|
|
6396
6432
|
type,
|
|
6433
|
+
autoComplete,
|
|
6397
6434
|
onChange,
|
|
6398
6435
|
onValueChange,
|
|
6399
6436
|
onFocus,
|
|
@@ -6425,8 +6462,9 @@ function InputField({
|
|
|
6425
6462
|
const setRefs = useMergedRefs(inputRef, ref);
|
|
6426
6463
|
const highlighted = useStoreSlice(suggest?.highlight ?? NO_HIGHLIGHT, (value) => value);
|
|
6427
6464
|
const disabled = useInheritedDisabled(disabledProp);
|
|
6465
|
+
const autofill = useAutofill(autoComplete);
|
|
6428
6466
|
const fieldType = type === "password" && revealed ? "text" : type;
|
|
6429
|
-
|
|
6467
|
+
React52.useLayoutEffect(() => {
|
|
6430
6468
|
const selection = selectionRef.current;
|
|
6431
6469
|
const input = inputRef.current;
|
|
6432
6470
|
if (!selection || !input || input.type !== (fieldType ?? "text")) return;
|
|
@@ -6434,16 +6472,16 @@ function InputField({
|
|
|
6434
6472
|
input.setSelectionRange(selection[0], selection[1]);
|
|
6435
6473
|
}, [fieldType, selectionRef, inputRef]);
|
|
6436
6474
|
const controlled = rest.value;
|
|
6437
|
-
|
|
6475
|
+
React52.useEffect(() => {
|
|
6438
6476
|
if (!reportValue) return;
|
|
6439
6477
|
if (controlled !== void 0) reportValue(String(controlled));
|
|
6440
6478
|
else if (inputRef.current) reportValue(inputRef.current.value);
|
|
6441
6479
|
}, [reportValue, controlled, inputRef]);
|
|
6442
|
-
|
|
6480
|
+
React52.useEffect(() => {
|
|
6443
6481
|
if (customValidity !== null) inputRef.current?.setCustomValidity(customValidity);
|
|
6444
6482
|
}, [customValidity, inputRef]);
|
|
6445
6483
|
const resolvedDescribedBy = [ariaDescribedBy, affixIds, describedBy, valid ? validId : void 0].filter(Boolean).join(" ") || void 0;
|
|
6446
|
-
return /* @__PURE__ */
|
|
6484
|
+
return /* @__PURE__ */ jsx30(
|
|
6447
6485
|
"input",
|
|
6448
6486
|
{
|
|
6449
6487
|
...rest,
|
|
@@ -6456,9 +6494,11 @@ function InputField({
|
|
|
6456
6494
|
required: required ?? (requiredCtx || void 0),
|
|
6457
6495
|
type: fieldType,
|
|
6458
6496
|
"aria-busy": commit.state === "pending" || void 0,
|
|
6497
|
+
...autofill,
|
|
6459
6498
|
...suggest ? {
|
|
6499
|
+
// The kit's own list: no browser or password-manager list on top of it.
|
|
6500
|
+
...AUTOFILL_OFF,
|
|
6460
6501
|
role: "combobox",
|
|
6461
|
-
autoComplete: "off",
|
|
6462
6502
|
"aria-autocomplete": "list",
|
|
6463
6503
|
"aria-expanded": suggest.shown,
|
|
6464
6504
|
"aria-controls": suggest.shown ? suggest.listboxId : void 0,
|
|
@@ -6499,7 +6539,7 @@ function InputField({
|
|
|
6499
6539
|
}
|
|
6500
6540
|
InputField.displayName = "Input.Field";
|
|
6501
6541
|
function InputIcon({ side, children, className, ...rest }) {
|
|
6502
|
-
return /* @__PURE__ */
|
|
6542
|
+
return /* @__PURE__ */ jsx30(
|
|
6503
6543
|
"span",
|
|
6504
6544
|
{
|
|
6505
6545
|
...rest,
|
|
@@ -6513,12 +6553,12 @@ function InputIcon({ side, children, className, ...rest }) {
|
|
|
6513
6553
|
InputIcon.displayName = "Input.Icon";
|
|
6514
6554
|
function useAffixDescription(id, spokenText) {
|
|
6515
6555
|
const { addAffix } = useInputContext();
|
|
6516
|
-
const generated =
|
|
6556
|
+
const generated = React52.useId();
|
|
6517
6557
|
const target = spokenText ? generated : id ?? generated;
|
|
6518
|
-
|
|
6558
|
+
React52.useLayoutEffect(() => addAffix(target), [addAffix, target]);
|
|
6519
6559
|
return spokenText ? {
|
|
6520
6560
|
id,
|
|
6521
|
-
spoken: /* @__PURE__ */
|
|
6561
|
+
spoken: /* @__PURE__ */ jsx30("span", { id: generated, hidden: true, children: spokenText })
|
|
6522
6562
|
} : { id: target, spoken: null };
|
|
6523
6563
|
}
|
|
6524
6564
|
function InputAffix({
|
|
@@ -6573,10 +6613,10 @@ function InputInlineAffix({
|
|
|
6573
6613
|
InputInlineAffix.displayName = "Input.InlineAffix";
|
|
6574
6614
|
function InputClearButton({ onClick: onClick2, className, ref, ...rest }) {
|
|
6575
6615
|
const { inputId, inputRef, labels, mountedRef } = useInputContext();
|
|
6576
|
-
const [arrived] =
|
|
6616
|
+
const [arrived] = React52.useState(() => mountedRef.current);
|
|
6577
6617
|
const presence = usePartPresence({ axis: "inline" });
|
|
6578
6618
|
const setRefs = useMergedRefs(presence.ref, ref);
|
|
6579
|
-
return /* @__PURE__ */
|
|
6619
|
+
return /* @__PURE__ */ jsx30(
|
|
6580
6620
|
FieldActionButton,
|
|
6581
6621
|
{
|
|
6582
6622
|
tooltip: false,
|
|
@@ -6589,18 +6629,18 @@ function InputClearButton({ onClick: onClick2, className, ref, ...rest }) {
|
|
|
6589
6629
|
onClick2?.(event);
|
|
6590
6630
|
if (!event.defaultPrevented) inputRef.current?.focus();
|
|
6591
6631
|
},
|
|
6592
|
-
children: /* @__PURE__ */
|
|
6632
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: "action.close" })
|
|
6593
6633
|
}
|
|
6594
6634
|
);
|
|
6595
6635
|
}
|
|
6596
6636
|
InputClearButton.displayName = "Input.ClearButton";
|
|
6597
6637
|
function InputAction(props) {
|
|
6598
|
-
return /* @__PURE__ */
|
|
6638
|
+
return /* @__PURE__ */ jsx30(FieldActionButton, { ...props });
|
|
6599
6639
|
}
|
|
6600
6640
|
InputAction.displayName = "Input.Action";
|
|
6601
6641
|
function InputCopyButton({ value, ...rest }) {
|
|
6602
6642
|
const { inputRef, labels } = useInputContext();
|
|
6603
|
-
return /* @__PURE__ */
|
|
6643
|
+
return /* @__PURE__ */ jsx30(
|
|
6604
6644
|
FieldCopyButton,
|
|
6605
6645
|
{
|
|
6606
6646
|
...rest,
|
|
@@ -6613,7 +6653,7 @@ InputCopyButton.displayName = "Input.CopyButton";
|
|
|
6613
6653
|
function InputRevealButton({ onClick: onClick2, onMouseDown, ref, ...rest }) {
|
|
6614
6654
|
const { inputId, inputRef, labels, revealed, setRevealed, selectionRef } = useInputContext();
|
|
6615
6655
|
const glyph = revealed ? "field.password.hide" : "field.password.show";
|
|
6616
|
-
return /* @__PURE__ */
|
|
6656
|
+
return /* @__PURE__ */ jsx30(
|
|
6617
6657
|
FieldActionButton,
|
|
6618
6658
|
{
|
|
6619
6659
|
tooltip: false,
|
|
@@ -6637,14 +6677,14 @@ function InputRevealButton({ onClick: onClick2, onMouseDown, ref, ...rest }) {
|
|
|
6637
6677
|
}
|
|
6638
6678
|
setRevealed((shown) => !shown);
|
|
6639
6679
|
},
|
|
6640
|
-
children: /* @__PURE__ */
|
|
6680
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: glyph })
|
|
6641
6681
|
}
|
|
6642
6682
|
);
|
|
6643
6683
|
}
|
|
6644
6684
|
InputRevealButton.displayName = "Input.RevealButton";
|
|
6645
6685
|
function InputCounter(props) {
|
|
6646
6686
|
const { size, labels } = useInputContext();
|
|
6647
|
-
return /* @__PURE__ */
|
|
6687
|
+
return /* @__PURE__ */ jsx30(FieldCounter, { ...props, size, label: labels.counter });
|
|
6648
6688
|
}
|
|
6649
6689
|
InputCounter.displayName = "Input.Counter";
|
|
6650
6690
|
var Input = {
|
|
@@ -6662,7 +6702,7 @@ var Input = {
|
|
|
6662
6702
|
};
|
|
6663
6703
|
|
|
6664
6704
|
// src/components/empty-page/EmptyPage.tsx
|
|
6665
|
-
import * as
|
|
6705
|
+
import * as React53 from "react";
|
|
6666
6706
|
|
|
6667
6707
|
// src/components/empty-page/EmptyPage.module.css
|
|
6668
6708
|
var EmptyPage_default = {
|
|
@@ -6674,7 +6714,7 @@ var EmptyPage_default = {
|
|
|
6674
6714
|
};
|
|
6675
6715
|
|
|
6676
6716
|
// src/components/empty-page/EmptyPage.tsx
|
|
6677
|
-
import { jsx as
|
|
6717
|
+
import { jsx as jsx31, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6678
6718
|
var EMPTY_PAGE_LABELS = { retry: "\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C" };
|
|
6679
6719
|
var TITLE_ROLE = {
|
|
6680
6720
|
xs: textRole_default.titleS,
|
|
@@ -6690,7 +6730,7 @@ var DESCRIPTION_ROLE = {
|
|
|
6690
6730
|
l: textRole_default.bodyM,
|
|
6691
6731
|
xl: textRole_default.bodyL
|
|
6692
6732
|
};
|
|
6693
|
-
var EmptyPageContext =
|
|
6733
|
+
var EmptyPageContext = React53.createContext({
|
|
6694
6734
|
tone: "neutral",
|
|
6695
6735
|
size: "m",
|
|
6696
6736
|
compact: false,
|
|
@@ -6717,7 +6757,7 @@ function EmptyPageRoot({
|
|
|
6717
6757
|
labels: mergedLabels
|
|
6718
6758
|
};
|
|
6719
6759
|
return provide(
|
|
6720
|
-
/* @__PURE__ */
|
|
6760
|
+
/* @__PURE__ */ jsx31(
|
|
6721
6761
|
"div",
|
|
6722
6762
|
{
|
|
6723
6763
|
className: cx(EmptyPage_default.root, appear.entering && enterMotion_default.enterBaseChildren, className),
|
|
@@ -6729,17 +6769,17 @@ function EmptyPageRoot({
|
|
|
6729
6769
|
layout: layout === "default" ? void 0 : layout,
|
|
6730
6770
|
tone: tone === "neutral" ? void 0 : tone
|
|
6731
6771
|
}),
|
|
6732
|
-
children: /* @__PURE__ */
|
|
6772
|
+
children: /* @__PURE__ */ jsx31(EmptyPageContext.Provider, { value: context, children })
|
|
6733
6773
|
}
|
|
6734
6774
|
)
|
|
6735
6775
|
);
|
|
6736
6776
|
}
|
|
6737
6777
|
EmptyPageRoot.displayName = "EmptyPage.Root";
|
|
6738
6778
|
function EmptyPageIcon({ tone: toneProp, className, ...rest }) {
|
|
6739
|
-
const { tone: rootTone, size, compact } =
|
|
6779
|
+
const { tone: rootTone, size, compact } = React53.useContext(EmptyPageContext);
|
|
6740
6780
|
return (
|
|
6741
6781
|
// The tile is decorative: the title says what the state is.
|
|
6742
|
-
/* @__PURE__ */
|
|
6782
|
+
/* @__PURE__ */ jsx31(
|
|
6743
6783
|
"div",
|
|
6744
6784
|
{
|
|
6745
6785
|
"aria-hidden": "true",
|
|
@@ -6753,8 +6793,8 @@ function EmptyPageIcon({ tone: toneProp, className, ...rest }) {
|
|
|
6753
6793
|
}
|
|
6754
6794
|
EmptyPageIcon.displayName = "EmptyPage.Icon";
|
|
6755
6795
|
function EmptyPageTitle({ as: Tag = "h2", className, ref, ...rest }) {
|
|
6756
|
-
const { size, compact } =
|
|
6757
|
-
return /* @__PURE__ */
|
|
6796
|
+
const { size, compact } = React53.useContext(EmptyPageContext);
|
|
6797
|
+
return /* @__PURE__ */ jsx31(
|
|
6758
6798
|
Tag,
|
|
6759
6799
|
{
|
|
6760
6800
|
ref,
|
|
@@ -6765,8 +6805,8 @@ function EmptyPageTitle({ as: Tag = "h2", className, ref, ...rest }) {
|
|
|
6765
6805
|
}
|
|
6766
6806
|
EmptyPageTitle.displayName = "EmptyPage.Title";
|
|
6767
6807
|
function EmptyPageDescription({ className, ...rest }) {
|
|
6768
|
-
const { size, compact } =
|
|
6769
|
-
return /* @__PURE__ */
|
|
6808
|
+
const { size, compact } = React53.useContext(EmptyPageContext);
|
|
6809
|
+
return /* @__PURE__ */ jsx31(
|
|
6770
6810
|
"p",
|
|
6771
6811
|
{
|
|
6772
6812
|
className: cx(
|
|
@@ -6780,11 +6820,11 @@ function EmptyPageDescription({ className, ...rest }) {
|
|
|
6780
6820
|
}
|
|
6781
6821
|
EmptyPageDescription.displayName = "EmptyPage.Description";
|
|
6782
6822
|
function EmptyPageActions({ className, ...rest }) {
|
|
6783
|
-
return /* @__PURE__ */
|
|
6823
|
+
return /* @__PURE__ */ jsx31("div", { className: cx(EmptyPage_default.actions, className), ...rest });
|
|
6784
6824
|
}
|
|
6785
6825
|
EmptyPageActions.displayName = "EmptyPage.Actions";
|
|
6786
6826
|
function EmptyPageRetryButton({ onRetry, children, disabled, ...rest }) {
|
|
6787
|
-
const { labels } =
|
|
6827
|
+
const { labels } = React53.useContext(EmptyPageContext);
|
|
6788
6828
|
const retry = usePendingAction(onRetry);
|
|
6789
6829
|
return /* @__PURE__ */ jsxs18(
|
|
6790
6830
|
Button.Root,
|
|
@@ -6796,7 +6836,7 @@ function EmptyPageRetryButton({ onRetry, children, disabled, ...rest }) {
|
|
|
6796
6836
|
disabled,
|
|
6797
6837
|
onClick: () => retry.run?.(),
|
|
6798
6838
|
children: [
|
|
6799
|
-
/* @__PURE__ */
|
|
6839
|
+
/* @__PURE__ */ jsx31(Button.Icon, { children: /* @__PURE__ */ jsx31(Icon, { name: "action.refresh" }) }),
|
|
6800
6840
|
children ?? labels.retry
|
|
6801
6841
|
]
|
|
6802
6842
|
}
|
|
@@ -6813,21 +6853,21 @@ var EmptyPage = {
|
|
|
6813
6853
|
};
|
|
6814
6854
|
|
|
6815
6855
|
// src/components/avatar/Avatar.tsx
|
|
6816
|
-
import * as
|
|
6856
|
+
import * as React57 from "react";
|
|
6817
6857
|
|
|
6818
6858
|
// src/internal/imageSlot.tsx
|
|
6819
|
-
import * as
|
|
6859
|
+
import * as React55 from "react";
|
|
6820
6860
|
|
|
6821
6861
|
// src/hooks/useImageStatus.ts
|
|
6822
|
-
import * as
|
|
6862
|
+
import * as React54 from "react";
|
|
6823
6863
|
function useImageStatus(report, { onLoad, onError, decode = false } = {}) {
|
|
6824
|
-
const [status, setStatus] =
|
|
6825
|
-
const settled =
|
|
6826
|
-
|
|
6864
|
+
const [status, setStatus] = React54.useState("loading");
|
|
6865
|
+
const settled = React54.useRef(false);
|
|
6866
|
+
React54.useLayoutEffect(() => {
|
|
6827
6867
|
report("loading");
|
|
6828
6868
|
return () => report("idle");
|
|
6829
6869
|
}, [report]);
|
|
6830
|
-
const loaded =
|
|
6870
|
+
const loaded = React54.useCallback(
|
|
6831
6871
|
(element, event) => {
|
|
6832
6872
|
const settle2 = () => {
|
|
6833
6873
|
if (decode && (settled.current || !element.isConnected)) return;
|
|
@@ -6844,11 +6884,11 @@ function useImageStatus(report, { onLoad, onError, decode = false } = {}) {
|
|
|
6844
6884
|
},
|
|
6845
6885
|
[decode, onLoad, report]
|
|
6846
6886
|
);
|
|
6847
|
-
const handleLoad =
|
|
6887
|
+
const handleLoad = React54.useCallback(
|
|
6848
6888
|
(event) => loaded(event.currentTarget, event),
|
|
6849
6889
|
[loaded]
|
|
6850
6890
|
);
|
|
6851
|
-
const handleError =
|
|
6891
|
+
const handleError = React54.useCallback(
|
|
6852
6892
|
(event) => {
|
|
6853
6893
|
setStatus("error");
|
|
6854
6894
|
report("error");
|
|
@@ -6856,7 +6896,7 @@ function useImageStatus(report, { onLoad, onError, decode = false } = {}) {
|
|
|
6856
6896
|
},
|
|
6857
6897
|
[onError, report]
|
|
6858
6898
|
);
|
|
6859
|
-
const ref =
|
|
6899
|
+
const ref = React54.useCallback(
|
|
6860
6900
|
(element) => {
|
|
6861
6901
|
if (decode && element instanceof HTMLImageElement && element.complete && element.naturalWidth > 0) {
|
|
6862
6902
|
loaded(element, null);
|
|
@@ -6868,18 +6908,18 @@ function useImageStatus(report, { onLoad, onError, decode = false } = {}) {
|
|
|
6868
6908
|
}
|
|
6869
6909
|
|
|
6870
6910
|
// src/internal/imageSlot.tsx
|
|
6871
|
-
import { Fragment as Fragment11, jsx as
|
|
6911
|
+
import { Fragment as Fragment11, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6872
6912
|
function createImageSlot(name, classNames) {
|
|
6873
6913
|
const [Provider, useSlotContext] = createComponentContext(name);
|
|
6874
6914
|
function ImageSlotProvider({ children }) {
|
|
6875
|
-
const [imageStatus, setImageStatus] =
|
|
6876
|
-
const value =
|
|
6877
|
-
return /* @__PURE__ */
|
|
6915
|
+
const [imageStatus, setImageStatus] = React55.useState("idle");
|
|
6916
|
+
const value = React55.useMemo(() => ({ imageStatus, setImageStatus }), [imageStatus]);
|
|
6917
|
+
return /* @__PURE__ */ jsx32(Provider, { value, children });
|
|
6878
6918
|
}
|
|
6879
6919
|
function ImageInner({ src, alt = "", className, onLoad, onError, ...rest }) {
|
|
6880
6920
|
const { setImageStatus } = useSlotContext();
|
|
6881
6921
|
const image = useImageStatus(setImageStatus, { onLoad, onError });
|
|
6882
|
-
return /* @__PURE__ */
|
|
6922
|
+
return /* @__PURE__ */ jsx32(
|
|
6883
6923
|
"img",
|
|
6884
6924
|
{
|
|
6885
6925
|
loading: "lazy",
|
|
@@ -6896,7 +6936,7 @@ function createImageSlot(name, classNames) {
|
|
|
6896
6936
|
}
|
|
6897
6937
|
function LeavingImage({ image }) {
|
|
6898
6938
|
const { ref: _ref, src, alt: _alt, className, ...rest } = image;
|
|
6899
|
-
return /* @__PURE__ */
|
|
6939
|
+
return /* @__PURE__ */ jsx32(
|
|
6900
6940
|
"img",
|
|
6901
6941
|
{
|
|
6902
6942
|
...rest,
|
|
@@ -6910,23 +6950,23 @@ function createImageSlot(name, classNames) {
|
|
|
6910
6950
|
);
|
|
6911
6951
|
}
|
|
6912
6952
|
function Image2({ onLoad, onError, onTransitionEnd, ...props }) {
|
|
6913
|
-
const [shown, setShown] =
|
|
6914
|
-
const [leaving, setLeaving] =
|
|
6915
|
-
const [src, setSrc] =
|
|
6953
|
+
const [shown, setShown] = React55.useState(null);
|
|
6954
|
+
const [leaving, setLeaving] = React55.useState(null);
|
|
6955
|
+
const [src, setSrc] = React55.useState(props.src);
|
|
6916
6956
|
if (props.src !== src) {
|
|
6917
6957
|
setSrc(props.src);
|
|
6918
6958
|
setLeaving(shown && !prefersReducedMotion() ? shown : null);
|
|
6919
6959
|
setShown(null);
|
|
6920
6960
|
}
|
|
6921
6961
|
const leavingSrc = leaving?.src;
|
|
6922
|
-
|
|
6962
|
+
React55.useEffect(() => {
|
|
6923
6963
|
if (!leavingSrc || !shown) return;
|
|
6924
6964
|
const timer = window.setTimeout(() => setLeaving(null), exitTimeoutMs("slow"));
|
|
6925
6965
|
return () => window.clearTimeout(timer);
|
|
6926
6966
|
}, [leavingSrc, shown]);
|
|
6927
6967
|
return /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
6928
|
-
leaving ? /* @__PURE__ */
|
|
6929
|
-
/* @__PURE__ */
|
|
6968
|
+
leaving ? /* @__PURE__ */ jsx32(LeavingImage, { image: leaving }) : null,
|
|
6969
|
+
/* @__PURE__ */ jsx32(
|
|
6930
6970
|
ImageInner,
|
|
6931
6971
|
{
|
|
6932
6972
|
...props,
|
|
@@ -6950,7 +6990,7 @@ function createImageSlot(name, classNames) {
|
|
|
6950
6990
|
Image2.displayName = `${name}.Image`;
|
|
6951
6991
|
function Fallback({ className, ...rest }) {
|
|
6952
6992
|
const { imageStatus } = useSlotContext();
|
|
6953
|
-
return /* @__PURE__ */
|
|
6993
|
+
return /* @__PURE__ */ jsx32(
|
|
6954
6994
|
"span",
|
|
6955
6995
|
{
|
|
6956
6996
|
className: cx(classNames.fallback, className),
|
|
@@ -6970,22 +7010,22 @@ function createImageSlot(name, classNames) {
|
|
|
6970
7010
|
}
|
|
6971
7011
|
|
|
6972
7012
|
// src/internal/mediaSlot.tsx
|
|
6973
|
-
import * as
|
|
6974
|
-
import { jsx as
|
|
6975
|
-
var MediaSlotContext =
|
|
7013
|
+
import * as React56 from "react";
|
|
7014
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
7015
|
+
var MediaSlotContext = React56.createContext(null);
|
|
6976
7016
|
var MEDIA_SLOT_SIZE = { avatar: "l", thumbnail: "m" };
|
|
6977
7017
|
function useMediaSlotHost() {
|
|
6978
|
-
const [count, setCount] =
|
|
6979
|
-
const value =
|
|
7018
|
+
const [count, setCount] = React56.useState(0);
|
|
7019
|
+
const value = React56.useMemo(
|
|
6980
7020
|
() => ({ report: (present) => setCount((n) => Math.max(0, n + (present ? 1 : -1))) }),
|
|
6981
7021
|
[]
|
|
6982
7022
|
);
|
|
6983
|
-
const provide = (children) => /* @__PURE__ */
|
|
7023
|
+
const provide = (children) => /* @__PURE__ */ jsx33(MediaSlotContext.Provider, { value, children });
|
|
6984
7024
|
return { media: count > 0, provide };
|
|
6985
7025
|
}
|
|
6986
7026
|
function useMediaSlotSize(kind) {
|
|
6987
|
-
const slot3 =
|
|
6988
|
-
|
|
7027
|
+
const slot3 = React56.useContext(MediaSlotContext);
|
|
7028
|
+
React56.useLayoutEffect(() => {
|
|
6989
7029
|
if (!slot3) return;
|
|
6990
7030
|
slot3.report(true);
|
|
6991
7031
|
return () => slot3.report(false);
|
|
@@ -7004,16 +7044,16 @@ var Avatar_default = {
|
|
|
7004
7044
|
};
|
|
7005
7045
|
|
|
7006
7046
|
// src/components/avatar/Avatar.tsx
|
|
7007
|
-
import { jsx as
|
|
7047
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
7008
7048
|
var slot = createImageSlot("Avatar", {
|
|
7009
7049
|
image: Avatar_default.image,
|
|
7010
7050
|
fallback: cx(Avatar_default.fallback, iconSlotClass)
|
|
7011
7051
|
});
|
|
7012
|
-
var AvatarGroupSizeContext =
|
|
7052
|
+
var AvatarGroupSizeContext = React57.createContext(void 0);
|
|
7013
7053
|
function AvatarRoot({ size, color = "gray", className, children, ...rest }) {
|
|
7014
|
-
const groupSize =
|
|
7054
|
+
const groupSize = React57.useContext(AvatarGroupSizeContext);
|
|
7015
7055
|
const slotSize = useMediaSlotSize("avatar");
|
|
7016
|
-
return /* @__PURE__ */
|
|
7056
|
+
return /* @__PURE__ */ jsx34(slot.ImageSlotProvider, { children: /* @__PURE__ */ jsx34(
|
|
7017
7057
|
"div",
|
|
7018
7058
|
{
|
|
7019
7059
|
role: namedRole(rest, "img"),
|
|
@@ -7035,7 +7075,7 @@ var AVATAR_STATUS_LABELS = {
|
|
|
7035
7075
|
};
|
|
7036
7076
|
function AvatarStatus({ status, labels, className, ...rest }) {
|
|
7037
7077
|
slot.useImageSlot();
|
|
7038
|
-
return /* @__PURE__ */
|
|
7078
|
+
return /* @__PURE__ */ jsx34(
|
|
7039
7079
|
"span",
|
|
7040
7080
|
{
|
|
7041
7081
|
role: "img",
|
|
@@ -7048,7 +7088,7 @@ function AvatarStatus({ status, labels, className, ...rest }) {
|
|
|
7048
7088
|
}
|
|
7049
7089
|
AvatarStatus.displayName = "Avatar.Status";
|
|
7050
7090
|
function AvatarGroup({ size, className, role = "group", ...rest }) {
|
|
7051
|
-
return /* @__PURE__ */
|
|
7091
|
+
return /* @__PURE__ */ jsx34(AvatarGroupSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx34(
|
|
7052
7092
|
"div",
|
|
7053
7093
|
{
|
|
7054
7094
|
role,
|
|
@@ -7060,8 +7100,8 @@ function AvatarGroup({ size, className, role = "group", ...rest }) {
|
|
|
7060
7100
|
}
|
|
7061
7101
|
AvatarGroup.displayName = "Avatar.Group";
|
|
7062
7102
|
function AvatarOverflow({ size, className, ...rest }) {
|
|
7063
|
-
const groupSize =
|
|
7064
|
-
return /* @__PURE__ */
|
|
7103
|
+
const groupSize = React57.useContext(AvatarGroupSizeContext);
|
|
7104
|
+
return /* @__PURE__ */ jsx34(
|
|
7065
7105
|
"div",
|
|
7066
7106
|
{
|
|
7067
7107
|
role: namedRole(rest, "img"),
|
|
@@ -7082,7 +7122,7 @@ var Avatar = {
|
|
|
7082
7122
|
};
|
|
7083
7123
|
|
|
7084
7124
|
// src/components/checkbox/Checkbox.tsx
|
|
7085
|
-
import * as
|
|
7125
|
+
import * as React59 from "react";
|
|
7086
7126
|
|
|
7087
7127
|
// src/internal/CheckMark.module.css
|
|
7088
7128
|
var CheckMark_default = {
|
|
@@ -7092,7 +7132,7 @@ var CheckMark_default = {
|
|
|
7092
7132
|
};
|
|
7093
7133
|
|
|
7094
7134
|
// src/internal/CheckMark.tsx
|
|
7095
|
-
import { jsx as
|
|
7135
|
+
import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7096
7136
|
function CheckMark({ state, className }) {
|
|
7097
7137
|
return /* @__PURE__ */ jsxs20(
|
|
7098
7138
|
"svg",
|
|
@@ -7103,15 +7143,15 @@ function CheckMark({ state, className }) {
|
|
|
7103
7143
|
"aria-hidden": "true",
|
|
7104
7144
|
focusable: "false",
|
|
7105
7145
|
children: [
|
|
7106
|
-
/* @__PURE__ */
|
|
7107
|
-
/* @__PURE__ */
|
|
7146
|
+
/* @__PURE__ */ jsx35("path", { d: "M5.5 12.5l4.25 4.25L18.5 8", pathLength: 1, className: CheckMark_default.check }),
|
|
7147
|
+
/* @__PURE__ */ jsx35("path", { d: "M7 12h10", pathLength: 1, className: CheckMark_default.bar })
|
|
7108
7148
|
]
|
|
7109
7149
|
}
|
|
7110
7150
|
);
|
|
7111
7151
|
}
|
|
7112
7152
|
|
|
7113
7153
|
// src/internal/ChoiceField.tsx
|
|
7114
|
-
import * as
|
|
7154
|
+
import * as React58 from "react";
|
|
7115
7155
|
|
|
7116
7156
|
// src/internal/ChoiceField.module.css
|
|
7117
7157
|
var ChoiceField_default = {
|
|
@@ -7127,12 +7167,12 @@ var ChoiceField_default = {
|
|
|
7127
7167
|
};
|
|
7128
7168
|
|
|
7129
7169
|
// src/internal/ChoiceField.tsx
|
|
7130
|
-
import { Fragment as Fragment12, jsx as
|
|
7170
|
+
import { Fragment as Fragment12, jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7131
7171
|
var choiceInputClass = ChoiceField_default.input;
|
|
7132
7172
|
var choiceVisualClass = cx(ChoiceField_default.visual, press_default.pressPartCompact);
|
|
7133
7173
|
var choiceBoxClass = ChoiceField_default.box;
|
|
7134
7174
|
var choiceTrackClass = ChoiceField_default.track;
|
|
7135
|
-
var ChoiceMarksContext =
|
|
7175
|
+
var ChoiceMarksContext = React58.createContext(null);
|
|
7136
7176
|
function ChoiceField({
|
|
7137
7177
|
ids,
|
|
7138
7178
|
size,
|
|
@@ -7153,11 +7193,11 @@ function ChoiceField({
|
|
|
7153
7193
|
}) {
|
|
7154
7194
|
const shake = useErrorShake(!groupOption && ids.invalid, error);
|
|
7155
7195
|
const leaving = useLeavingError(ids.showError, error);
|
|
7156
|
-
const marks =
|
|
7196
|
+
const marks = React58.useMemo(
|
|
7157
7197
|
() => ({ required, optional, optionalLabel, disabled }),
|
|
7158
7198
|
[required, optional, optionalLabel, disabled]
|
|
7159
7199
|
);
|
|
7160
|
-
return /* @__PURE__ */
|
|
7200
|
+
return /* @__PURE__ */ jsx36(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsxs21(
|
|
7161
7201
|
"div",
|
|
7162
7202
|
{
|
|
7163
7203
|
className: cx(fieldTierClass, ChoiceField_default.field, className),
|
|
@@ -7176,7 +7216,7 @@ function ChoiceField({
|
|
|
7176
7216
|
className: cx(ChoiceField_default.row, press_default.pressHost),
|
|
7177
7217
|
"data-loading": busy || void 0,
|
|
7178
7218
|
children: [
|
|
7179
|
-
/* @__PURE__ */
|
|
7219
|
+
/* @__PURE__ */ jsx36(
|
|
7180
7220
|
"span",
|
|
7181
7221
|
{
|
|
7182
7222
|
className: cx(ChoiceField_default.controlCell, enterMotion_default.shake, touchTargetClass),
|
|
@@ -7184,11 +7224,11 @@ function ChoiceField({
|
|
|
7184
7224
|
children: control
|
|
7185
7225
|
}
|
|
7186
7226
|
),
|
|
7187
|
-
/* @__PURE__ */
|
|
7227
|
+
/* @__PURE__ */ jsx36(ChoiceMarksContext, { value: marks, children })
|
|
7188
7228
|
]
|
|
7189
7229
|
}
|
|
7190
7230
|
),
|
|
7191
|
-
/* @__PURE__ */
|
|
7231
|
+
/* @__PURE__ */ jsx36(
|
|
7192
7232
|
FieldSupport,
|
|
7193
7233
|
{
|
|
7194
7234
|
ids,
|
|
@@ -7207,13 +7247,13 @@ function ChoiceField({
|
|
|
7207
7247
|
) });
|
|
7208
7248
|
}
|
|
7209
7249
|
function ChoiceLabel({ className, children, ...rest }) {
|
|
7210
|
-
const marks =
|
|
7250
|
+
const marks = React58.use(ChoiceMarksContext);
|
|
7211
7251
|
const marked = marks && (marks.required || marks.optional);
|
|
7212
7252
|
return /* @__PURE__ */ jsxs21("span", { className: cx(ChoiceField_default.text, className), ...rest, children: [
|
|
7213
7253
|
children,
|
|
7214
7254
|
marked ? /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
7215
7255
|
" ",
|
|
7216
|
-
/* @__PURE__ */
|
|
7256
|
+
/* @__PURE__ */ jsx36(
|
|
7217
7257
|
LabelMarks,
|
|
7218
7258
|
{
|
|
7219
7259
|
required: marks.required,
|
|
@@ -7234,7 +7274,7 @@ var Checkbox_default = {
|
|
|
7234
7274
|
};
|
|
7235
7275
|
|
|
7236
7276
|
// src/components/checkbox/Checkbox.tsx
|
|
7237
|
-
import { Fragment as Fragment13, jsx as
|
|
7277
|
+
import { Fragment as Fragment13, jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7238
7278
|
var CHECKBOX_LABELS = { optional: "\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E" };
|
|
7239
7279
|
function CheckboxRoot({
|
|
7240
7280
|
id,
|
|
@@ -7267,12 +7307,12 @@ function CheckboxRoot({
|
|
|
7267
7307
|
defaultValue: defaultChecked,
|
|
7268
7308
|
onChange: onCheckedChange
|
|
7269
7309
|
});
|
|
7270
|
-
const internalRef =
|
|
7310
|
+
const internalRef = React59.useRef(null);
|
|
7271
7311
|
const mergedRef = useMergedRefs(internalRef, ref);
|
|
7272
|
-
|
|
7312
|
+
React59.useLayoutEffect(() => {
|
|
7273
7313
|
if (internalRef.current) internalRef.current.indeterminate = indeterminate;
|
|
7274
7314
|
});
|
|
7275
|
-
return /* @__PURE__ */
|
|
7315
|
+
return /* @__PURE__ */ jsx37(
|
|
7276
7316
|
ChoiceField,
|
|
7277
7317
|
{
|
|
7278
7318
|
ids,
|
|
@@ -7288,7 +7328,7 @@ function CheckboxRoot({
|
|
|
7288
7328
|
error,
|
|
7289
7329
|
className: cx(Checkbox_default.root, className),
|
|
7290
7330
|
control: /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
7291
|
-
/* @__PURE__ */
|
|
7331
|
+
/* @__PURE__ */ jsx37(
|
|
7292
7332
|
"input",
|
|
7293
7333
|
{
|
|
7294
7334
|
...inputRest,
|
|
@@ -7307,13 +7347,13 @@ function CheckboxRoot({
|
|
|
7307
7347
|
"aria-describedby": ids.describedBy
|
|
7308
7348
|
}
|
|
7309
7349
|
),
|
|
7310
|
-
/* @__PURE__ */
|
|
7350
|
+
/* @__PURE__ */ jsx37(
|
|
7311
7351
|
"span",
|
|
7312
7352
|
{
|
|
7313
7353
|
className: cx(choiceVisualClass, choiceBoxClass, Checkbox_default.control),
|
|
7314
7354
|
"data-shape": shape,
|
|
7315
7355
|
"aria-hidden": "true",
|
|
7316
|
-
children: /* @__PURE__ */
|
|
7356
|
+
children: /* @__PURE__ */ jsx37(
|
|
7317
7357
|
CheckMark,
|
|
7318
7358
|
{
|
|
7319
7359
|
state: indeterminate ? "indeterminate" : checked ? "checked" : "unchecked"
|
|
@@ -7328,7 +7368,7 @@ function CheckboxRoot({
|
|
|
7328
7368
|
}
|
|
7329
7369
|
CheckboxRoot.displayName = "Checkbox.Root";
|
|
7330
7370
|
function CheckboxLabel(props) {
|
|
7331
|
-
return /* @__PURE__ */
|
|
7371
|
+
return /* @__PURE__ */ jsx37(ChoiceLabel, { ...props });
|
|
7332
7372
|
}
|
|
7333
7373
|
CheckboxLabel.displayName = "Checkbox.Label";
|
|
7334
7374
|
function CheckboxIndicator({
|
|
@@ -7341,7 +7381,7 @@ function CheckboxIndicator({
|
|
|
7341
7381
|
...rest
|
|
7342
7382
|
}) {
|
|
7343
7383
|
const size = useControlSize(sizeProp);
|
|
7344
|
-
return /* @__PURE__ */
|
|
7384
|
+
return /* @__PURE__ */ jsx37(
|
|
7345
7385
|
"span",
|
|
7346
7386
|
{
|
|
7347
7387
|
"aria-hidden": "true",
|
|
@@ -7360,7 +7400,7 @@ function CheckboxIndicator({
|
|
|
7360
7400
|
disabled: disabled || void 0
|
|
7361
7401
|
}),
|
|
7362
7402
|
...rest,
|
|
7363
|
-
children: /* @__PURE__ */
|
|
7403
|
+
children: /* @__PURE__ */ jsx37(CheckMark, { state: indeterminate ? "indeterminate" : checked ? "checked" : "unchecked" })
|
|
7364
7404
|
}
|
|
7365
7405
|
);
|
|
7366
7406
|
}
|
|
@@ -7372,7 +7412,7 @@ var Checkbox = {
|
|
|
7372
7412
|
};
|
|
7373
7413
|
|
|
7374
7414
|
// src/components/thumbnail/Thumbnail.tsx
|
|
7375
|
-
import * as
|
|
7415
|
+
import * as React61 from "react";
|
|
7376
7416
|
|
|
7377
7417
|
// src/internal/formatClock.ts
|
|
7378
7418
|
var pad = (value) => String(value).padStart(2, "0");
|
|
@@ -7444,20 +7484,20 @@ var mediaDisk_default = {
|
|
|
7444
7484
|
};
|
|
7445
7485
|
|
|
7446
7486
|
// src/internal/mediaDisk.tsx
|
|
7447
|
-
import { jsx as
|
|
7487
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
7448
7488
|
var mediaDiskClass = cx(fieldTierClass, mediaPill_default.ink, mediaDisk_default.disk);
|
|
7449
7489
|
function MediaPlayMark({
|
|
7450
7490
|
shown = true,
|
|
7451
7491
|
className
|
|
7452
7492
|
}) {
|
|
7453
|
-
return /* @__PURE__ */
|
|
7493
|
+
return /* @__PURE__ */ jsx38(
|
|
7454
7494
|
"span",
|
|
7455
7495
|
{
|
|
7456
7496
|
className: cx(mediaDiskClass, className),
|
|
7457
7497
|
"data-size": "l",
|
|
7458
7498
|
"data-shown": shown,
|
|
7459
7499
|
"aria-hidden": "true",
|
|
7460
|
-
children: /* @__PURE__ */
|
|
7500
|
+
children: /* @__PURE__ */ jsx38(Icon, { name: "action.play", fill: "currentColor" })
|
|
7461
7501
|
}
|
|
7462
7502
|
);
|
|
7463
7503
|
}
|
|
@@ -7468,7 +7508,7 @@ function firstFrame(src) {
|
|
|
7468
7508
|
}
|
|
7469
7509
|
|
|
7470
7510
|
// src/internal/mediaSession.ts
|
|
7471
|
-
import * as
|
|
7511
|
+
import * as React60 from "react";
|
|
7472
7512
|
var active = null;
|
|
7473
7513
|
var audible = (media) => !media.muted && media.volume > 0;
|
|
7474
7514
|
function claimPlayback(media) {
|
|
@@ -7480,7 +7520,7 @@ function releasePlayback(media) {
|
|
|
7480
7520
|
if (active === media) active = null;
|
|
7481
7521
|
}
|
|
7482
7522
|
function useMediaSession(ref) {
|
|
7483
|
-
|
|
7523
|
+
React60.useEffect(() => {
|
|
7484
7524
|
const media = ref.current;
|
|
7485
7525
|
if (!media) return;
|
|
7486
7526
|
const claim = () => claimPlayback(media);
|
|
@@ -7517,7 +7557,7 @@ var Thumbnail_default = {
|
|
|
7517
7557
|
};
|
|
7518
7558
|
|
|
7519
7559
|
// src/components/thumbnail/Thumbnail.tsx
|
|
7520
|
-
import { Fragment as Fragment14, jsx as
|
|
7560
|
+
import { Fragment as Fragment14, jsx as jsx39, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7521
7561
|
var slot2 = createImageSlot("Thumbnail", { image: Thumbnail_default.image, fallback: Thumbnail_default.fallback });
|
|
7522
7562
|
function ThumbnailRoot({
|
|
7523
7563
|
size: sizeProp,
|
|
@@ -7559,7 +7599,7 @@ function ThumbnailRoot({
|
|
|
7559
7599
|
if (selectable) {
|
|
7560
7600
|
const { onClick: onClick2 } = rest;
|
|
7561
7601
|
return provide(
|
|
7562
|
-
/* @__PURE__ */
|
|
7602
|
+
/* @__PURE__ */ jsx39(slot2.ImageSlotProvider, { children: /* @__PURE__ */ jsxs23(
|
|
7563
7603
|
"button",
|
|
7564
7604
|
{
|
|
7565
7605
|
...rest,
|
|
@@ -7574,7 +7614,7 @@ function ThumbnailRoot({
|
|
|
7574
7614
|
},
|
|
7575
7615
|
children: [
|
|
7576
7616
|
children,
|
|
7577
|
-
/* @__PURE__ */
|
|
7617
|
+
/* @__PURE__ */ jsx39("span", { className: cx(Thumbnail_default.check, mediaPill_default.choice), "aria-hidden": "true", children: /* @__PURE__ */ jsx39(Checkbox.Indicator, { checked, size: fullWidth ? "s" : compactTier(size) }) })
|
|
7578
7618
|
]
|
|
7579
7619
|
}
|
|
7580
7620
|
) })
|
|
@@ -7582,16 +7622,16 @@ function ThumbnailRoot({
|
|
|
7582
7622
|
}
|
|
7583
7623
|
if (asChild) {
|
|
7584
7624
|
return provide(
|
|
7585
|
-
/* @__PURE__ */
|
|
7625
|
+
/* @__PURE__ */ jsx39(slot2.ImageSlotProvider, { children: /* @__PURE__ */ jsx39(Slot, { ...rest, ...frame2, ref, children }) })
|
|
7586
7626
|
);
|
|
7587
7627
|
}
|
|
7588
7628
|
return provide(
|
|
7589
|
-
/* @__PURE__ */
|
|
7629
|
+
/* @__PURE__ */ jsx39(slot2.ImageSlotProvider, { children: /* @__PURE__ */ jsx39("div", { ref, ...frame2, ...rest, children }) })
|
|
7590
7630
|
);
|
|
7591
7631
|
}
|
|
7592
7632
|
ThumbnailRoot.displayName = "Thumbnail.Root";
|
|
7593
7633
|
function ThumbnailImage({ fit = "cover", ...rest }) {
|
|
7594
|
-
return /* @__PURE__ */
|
|
7634
|
+
return /* @__PURE__ */ jsx39(slot2.Image, { ...rest, "data-fit": fit });
|
|
7595
7635
|
}
|
|
7596
7636
|
ThumbnailImage.displayName = "Thumbnail.Image";
|
|
7597
7637
|
function ThumbnailVideoInner({
|
|
@@ -7611,22 +7651,22 @@ function ThumbnailVideoInner({
|
|
|
7611
7651
|
...rest
|
|
7612
7652
|
}) {
|
|
7613
7653
|
const report = slot2.useReportStatus();
|
|
7614
|
-
const mute =
|
|
7654
|
+
const mute = React61.useCallback(
|
|
7615
7655
|
(node) => {
|
|
7616
7656
|
if (node) node.muted = autoPlay && !controls;
|
|
7617
7657
|
},
|
|
7618
7658
|
[autoPlay, controls]
|
|
7619
7659
|
);
|
|
7620
|
-
const sessionRef =
|
|
7660
|
+
const sessionRef = React61.useRef(null);
|
|
7621
7661
|
useMediaSession(sessionRef);
|
|
7622
7662
|
const videoRef = useMergedRefs(mute, sessionRef, ref);
|
|
7623
7663
|
const media = useImageStatus(report, { onError });
|
|
7624
|
-
const [duration, setDuration] =
|
|
7625
|
-
const [playing, setPlaying] =
|
|
7626
|
-
const [still] =
|
|
7664
|
+
const [duration, setDuration] = React61.useState(null);
|
|
7665
|
+
const [playing, setPlaying] = React61.useState(false);
|
|
7666
|
+
const [still] = React61.useState(prefersReducedMotion);
|
|
7627
7667
|
const loops = autoPlay && !still && !controls;
|
|
7628
7668
|
return /* @__PURE__ */ jsxs23(Fragment14, { children: [
|
|
7629
|
-
/* @__PURE__ */
|
|
7669
|
+
/* @__PURE__ */ jsx39(
|
|
7630
7670
|
"video",
|
|
7631
7671
|
{
|
|
7632
7672
|
...rest,
|
|
@@ -7661,12 +7701,12 @@ function ThumbnailVideoInner({
|
|
|
7661
7701
|
}
|
|
7662
7702
|
}
|
|
7663
7703
|
),
|
|
7664
|
-
!controls && !loops ? /* @__PURE__ */
|
|
7665
|
-
!controls && duration !== null ? /* @__PURE__ */
|
|
7704
|
+
!controls && !loops ? /* @__PURE__ */ jsx39(MediaPlayMark, { shown: !playing, className: Thumbnail_default.play }) : null,
|
|
7705
|
+
!controls && duration !== null ? /* @__PURE__ */ jsx39("span", { className: cx(textRole_default.caption, mediaPill_default.pill, Thumbnail_default.duration), children: formatDuration(duration) }) : null
|
|
7666
7706
|
] });
|
|
7667
7707
|
}
|
|
7668
7708
|
function ThumbnailVideo(props) {
|
|
7669
|
-
return /* @__PURE__ */
|
|
7709
|
+
return /* @__PURE__ */ jsx39(ThumbnailVideoInner, { ...props }, props.src);
|
|
7670
7710
|
}
|
|
7671
7711
|
ThumbnailVideo.displayName = "Thumbnail.Video";
|
|
7672
7712
|
var ThumbnailFallback = slot2.Fallback;
|
|
@@ -7678,10 +7718,10 @@ var Thumbnail = {
|
|
|
7678
7718
|
};
|
|
7679
7719
|
|
|
7680
7720
|
// src/components/select/Select.tsx
|
|
7681
|
-
import * as
|
|
7721
|
+
import * as React65 from "react";
|
|
7682
7722
|
|
|
7683
7723
|
// src/hooks/useLoadMore.ts
|
|
7684
|
-
import * as
|
|
7724
|
+
import * as React62 from "react";
|
|
7685
7725
|
var LIST_ROOT_MARGIN = "0px 0px 48px 0px";
|
|
7686
7726
|
var NONE2 = /* @__PURE__ */ Symbol("none");
|
|
7687
7727
|
function useLoadMore({
|
|
@@ -7691,19 +7731,19 @@ function useLoadMore({
|
|
|
7691
7731
|
round,
|
|
7692
7732
|
rootMargin = LIST_ROOT_MARGIN
|
|
7693
7733
|
}) {
|
|
7694
|
-
const sentinelRef =
|
|
7695
|
-
const handlerRef =
|
|
7734
|
+
const sentinelRef = React62.useRef(null);
|
|
7735
|
+
const handlerRef = React62.useRef(onLoadMore);
|
|
7696
7736
|
handlerRef.current = onLoadMore;
|
|
7697
|
-
const askedIn =
|
|
7698
|
-
|
|
7737
|
+
const askedIn = React62.useRef(NONE2);
|
|
7738
|
+
React62.useLayoutEffect(() => {
|
|
7699
7739
|
if (!enabled) askedIn.current = NONE2;
|
|
7700
7740
|
}, [enabled]);
|
|
7701
|
-
const request =
|
|
7741
|
+
const request = React62.useCallback(() => {
|
|
7702
7742
|
if (!enabled || Object.is(askedIn.current, round)) return;
|
|
7703
7743
|
askedIn.current = round;
|
|
7704
7744
|
void handlerRef.current?.();
|
|
7705
7745
|
}, [enabled, round]);
|
|
7706
|
-
|
|
7746
|
+
React62.useEffect(() => {
|
|
7707
7747
|
const root = scrollRef.current;
|
|
7708
7748
|
const target = sentinelRef.current;
|
|
7709
7749
|
if (!enabled || !root || !target || typeof IntersectionObserver === "undefined") return;
|
|
@@ -7720,10 +7760,10 @@ function useLoadMore({
|
|
|
7720
7760
|
}
|
|
7721
7761
|
|
|
7722
7762
|
// src/internal/MenuGroup.tsx
|
|
7723
|
-
import * as
|
|
7724
|
-
import { jsx as
|
|
7763
|
+
import * as React63 from "react";
|
|
7764
|
+
import { jsx as jsx40, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7725
7765
|
function MenuGroup({ label, className, children, ...rest }) {
|
|
7726
|
-
const labelId =
|
|
7766
|
+
const labelId = React63.useId();
|
|
7727
7767
|
return (
|
|
7728
7768
|
// biome-ignore lint/a11y/useSemanticElements: role="group" inside a menu / listbox; <fieldset> is not allowed there
|
|
7729
7769
|
/* @__PURE__ */ jsxs24(
|
|
@@ -7734,7 +7774,7 @@ function MenuGroup({ label, className, children, ...rest }) {
|
|
|
7734
7774
|
"aria-labelledby": label != null ? labelId : void 0,
|
|
7735
7775
|
className: cx(menu_default.group, className),
|
|
7736
7776
|
children: [
|
|
7737
|
-
label != null ? /* @__PURE__ */
|
|
7777
|
+
label != null ? /* @__PURE__ */ jsx40("div", { id: labelId, role: "presentation", className: cx(textRole_default.caption, menu_default.groupLabel), children: label }) : null,
|
|
7738
7778
|
children
|
|
7739
7779
|
]
|
|
7740
7780
|
}
|
|
@@ -7768,22 +7808,22 @@ var Select_default = {
|
|
|
7768
7808
|
};
|
|
7769
7809
|
|
|
7770
7810
|
// src/components/select/SelectItem.tsx
|
|
7771
|
-
import * as
|
|
7811
|
+
import * as React64 from "react";
|
|
7772
7812
|
|
|
7773
7813
|
// src/components/select/selectContext.ts
|
|
7774
7814
|
var normalize = (text) => text.trim().toLocaleLowerCase();
|
|
7775
7815
|
var [SelectProvider, useSelectContext] = createComponentContext("Select");
|
|
7776
7816
|
|
|
7777
7817
|
// src/components/select/SelectItem.tsx
|
|
7778
|
-
import { jsx as
|
|
7818
|
+
import { jsx as jsx41, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7779
7819
|
function SelectItemIcon({ className, ...rest }) {
|
|
7780
|
-
return /* @__PURE__ */
|
|
7820
|
+
return /* @__PURE__ */ jsx41("span", { "aria-hidden": "true", className: cx(menu_default.itemIcon, iconSlotClass, className), ...rest });
|
|
7781
7821
|
}
|
|
7782
7822
|
SelectItemIcon.displayName = "Select.ItemIcon";
|
|
7783
|
-
var OptionQueryContext =
|
|
7823
|
+
var OptionQueryContext = React64.createContext("");
|
|
7784
7824
|
function SelectItemText({ children, className, ...rest }) {
|
|
7785
|
-
const query =
|
|
7786
|
-
return /* @__PURE__ */
|
|
7825
|
+
const query = React64.useContext(OptionQueryContext);
|
|
7826
|
+
return /* @__PURE__ */ jsx41("span", { ...rest, className: cx(Select_default.itemTitle, className), children: highlightChildren(children, query) });
|
|
7787
7827
|
}
|
|
7788
7828
|
SelectItemText.displayName = "Select.ItemText";
|
|
7789
7829
|
function SelectItemDescription({
|
|
@@ -7791,12 +7831,12 @@ function SelectItemDescription({
|
|
|
7791
7831
|
className,
|
|
7792
7832
|
...rest
|
|
7793
7833
|
}) {
|
|
7794
|
-
const query =
|
|
7795
|
-
return /* @__PURE__ */
|
|
7834
|
+
const query = React64.useContext(OptionQueryContext);
|
|
7835
|
+
return /* @__PURE__ */ jsx41("span", { ...rest, className: cx(Select_default.itemDescription, className), children: highlightChildren(children, query) });
|
|
7796
7836
|
}
|
|
7797
7837
|
SelectItemDescription.displayName = "Select.ItemDescription";
|
|
7798
7838
|
function SelectItemMeta({ children, className, ...rest }) {
|
|
7799
|
-
return /* @__PURE__ */
|
|
7839
|
+
return /* @__PURE__ */ jsx41("span", { ...rest, className: cx(Select_default.itemMeta, className), children });
|
|
7800
7840
|
}
|
|
7801
7841
|
SelectItemMeta.displayName = "Select.ItemMeta";
|
|
7802
7842
|
function splitItemChildren(children) {
|
|
@@ -7809,11 +7849,11 @@ function splitItemChildren(children) {
|
|
|
7809
7849
|
description: ""
|
|
7810
7850
|
};
|
|
7811
7851
|
let plain = "";
|
|
7812
|
-
for (const child of
|
|
7813
|
-
if (!
|
|
7852
|
+
for (const child of React64.Children.toArray(children)) {
|
|
7853
|
+
if (!React64.isValidElement(child)) {
|
|
7814
7854
|
plain += nodeText(child);
|
|
7815
7855
|
parts.body.push(child);
|
|
7816
|
-
} else if (child.type ===
|
|
7856
|
+
} else if (child.type === React64.Fragment) {
|
|
7817
7857
|
const inner = splitItemChildren(child.props.children);
|
|
7818
7858
|
parts.leading.push(...inner.leading);
|
|
7819
7859
|
parts.body.push(...inner.body);
|
|
@@ -7843,7 +7883,7 @@ function splitItemChildren(children) {
|
|
|
7843
7883
|
}
|
|
7844
7884
|
function sizeMedia(leading, size) {
|
|
7845
7885
|
return leading.map(
|
|
7846
|
-
(node) =>
|
|
7886
|
+
(node) => React64.isValidElement(node) && (node.type === Thumbnail.Root || node.type === Avatar.Root) ? React64.cloneElement(node, {
|
|
7847
7887
|
size: node.props.size ?? tierMappings.rowMedia[size],
|
|
7848
7888
|
className: cx(Select_default.media, node.props.className),
|
|
7849
7889
|
"aria-hidden": true
|
|
@@ -7868,7 +7908,7 @@ function SelectItem({
|
|
|
7868
7908
|
const haystack = normalize(`${resolvedLabel} ${parts.description} ${keywords ?? ""}`);
|
|
7869
7909
|
const isSelected = selected.includes(value);
|
|
7870
7910
|
const isHighlighted = useStoreSlice(highlight, (current) => current === value);
|
|
7871
|
-
const nodeRef =
|
|
7911
|
+
const nodeRef = React64.useRef(null);
|
|
7872
7912
|
const setRefs = useMergedRefs(nodeRef, ref);
|
|
7873
7913
|
useListboxItem(
|
|
7874
7914
|
registry,
|
|
@@ -7907,11 +7947,11 @@ function SelectItem({
|
|
|
7907
7947
|
rich: parts.rich || void 0
|
|
7908
7948
|
}),
|
|
7909
7949
|
children: [
|
|
7910
|
-
multiple ? /* @__PURE__ */
|
|
7950
|
+
multiple ? /* @__PURE__ */ jsx41(Checkbox.Indicator, { checked: isSelected, disabled, size: stepDown(size) }) : null,
|
|
7911
7951
|
sizeMedia(parts.leading, size),
|
|
7912
|
-
/* @__PURE__ */
|
|
7952
|
+
/* @__PURE__ */ jsx41("span", { className: Select_default.itemText, children: /* @__PURE__ */ jsx41(OptionQueryContext.Provider, { value: query, children: highlightChildren(parts.body, query) }) }),
|
|
7913
7953
|
parts.meta,
|
|
7914
|
-
multiple ? null : /* @__PURE__ */
|
|
7954
|
+
multiple ? null : /* @__PURE__ */ jsx41("span", { className: menu_default.check, "aria-hidden": "true", children: isSelected ? /* @__PURE__ */ jsx41(Icon, { name: "action.check" }) : null })
|
|
7915
7955
|
]
|
|
7916
7956
|
}
|
|
7917
7957
|
)
|
|
@@ -7931,10 +7971,10 @@ function SelectAction({
|
|
|
7931
7971
|
...rest
|
|
7932
7972
|
}) {
|
|
7933
7973
|
const { highlight, listboxId, setOpen, size, registry } = useSelectContext();
|
|
7934
|
-
const value = `${ACTION_PREFIX}${
|
|
7974
|
+
const value = `${ACTION_PREFIX}${React64.useId()}`;
|
|
7935
7975
|
const isHighlighted = useStoreSlice(highlight, (current) => current === value);
|
|
7936
7976
|
const parts = splitItemChildren(children);
|
|
7937
|
-
const nodeRef =
|
|
7977
|
+
const nodeRef = React64.useRef(null);
|
|
7938
7978
|
const setRefs = useMergedRefs(nodeRef, ref);
|
|
7939
7979
|
useListboxItem(
|
|
7940
7980
|
registry,
|
|
@@ -7979,7 +8019,7 @@ function SelectAction({
|
|
|
7979
8019
|
}),
|
|
7980
8020
|
children: [
|
|
7981
8021
|
sizeMedia(parts.leading, size),
|
|
7982
|
-
/* @__PURE__ */
|
|
8022
|
+
/* @__PURE__ */ jsx41("span", { className: Select_default.itemText, children: parts.body })
|
|
7983
8023
|
]
|
|
7984
8024
|
}
|
|
7985
8025
|
)
|
|
@@ -7988,11 +8028,10 @@ function SelectAction({
|
|
|
7988
8028
|
SelectAction.displayName = "Select.Action";
|
|
7989
8029
|
|
|
7990
8030
|
// src/components/select/Select.tsx
|
|
7991
|
-
import { Fragment as Fragment16, jsx as
|
|
8031
|
+
import { Fragment as Fragment16, jsx as jsx42, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7992
8032
|
var SELECT_LABELS = {
|
|
7993
8033
|
search: "\u041F\u043E\u0438\u0441\u043A",
|
|
7994
8034
|
empty: "\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",
|
|
7995
|
-
emptyHint: "\u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441",
|
|
7996
8035
|
loading: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",
|
|
7997
8036
|
retry: "\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",
|
|
7998
8037
|
clear: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
|
|
@@ -8053,7 +8092,7 @@ function SelectRoot(props) {
|
|
|
8053
8092
|
const changes = usePendingChanges(stored, takeNext);
|
|
8054
8093
|
const value = changes.shown;
|
|
8055
8094
|
const saving = changes.pending.length > 0;
|
|
8056
|
-
const [announcement, setAnnouncement] =
|
|
8095
|
+
const [announcement, setAnnouncement] = React65.useState("");
|
|
8057
8096
|
const onValueChange = props.onValueChange;
|
|
8058
8097
|
const commit = (next) => {
|
|
8059
8098
|
if (saving || Object.is(next, value)) return;
|
|
@@ -8068,9 +8107,9 @@ function SelectRoot(props) {
|
|
|
8068
8107
|
onReject: () => setAnnouncement(labels.changeFailed)
|
|
8069
8108
|
});
|
|
8070
8109
|
};
|
|
8071
|
-
const commitRef =
|
|
8110
|
+
const commitRef = React65.useRef(commit);
|
|
8072
8111
|
commitRef.current = commit;
|
|
8073
|
-
const selected =
|
|
8112
|
+
const selected = React65.useMemo(
|
|
8074
8113
|
() => Array.isArray(value) ? value : value ? [value] : [],
|
|
8075
8114
|
[value]
|
|
8076
8115
|
);
|
|
@@ -8082,18 +8121,18 @@ function SelectRoot(props) {
|
|
|
8082
8121
|
defaultValue: defaultSearch,
|
|
8083
8122
|
onChange: onSearchChange
|
|
8084
8123
|
});
|
|
8085
|
-
const triggerRef =
|
|
8086
|
-
const inSegment =
|
|
8087
|
-
const segment =
|
|
8124
|
+
const triggerRef = React65.useRef(null);
|
|
8125
|
+
const inSegment = React65.useContext(InputSegmentContext);
|
|
8126
|
+
const segment = React65.useMemo(
|
|
8088
8127
|
() => inSegment ? { label: ariaLabel } : null,
|
|
8089
8128
|
[inSegment, ariaLabel]
|
|
8090
8129
|
);
|
|
8091
|
-
const wasOpenRef =
|
|
8092
|
-
|
|
8130
|
+
const wasOpenRef = React65.useRef(isOpen);
|
|
8131
|
+
React65.useEffect(() => {
|
|
8093
8132
|
if (wasOpenRef.current && !isOpen) setQuery("");
|
|
8094
8133
|
wasOpenRef.current = isOpen;
|
|
8095
8134
|
}, [isOpen, setQuery]);
|
|
8096
|
-
const pick =
|
|
8135
|
+
const pick = React65.useCallback(
|
|
8097
8136
|
(optionValue) => {
|
|
8098
8137
|
if (multiple) {
|
|
8099
8138
|
const list = Array.isArray(value) ? value : [];
|
|
@@ -8107,8 +8146,8 @@ function SelectRoot(props) {
|
|
|
8107
8146
|
},
|
|
8108
8147
|
[multiple, value, setOpen]
|
|
8109
8148
|
);
|
|
8110
|
-
const clear =
|
|
8111
|
-
const context =
|
|
8149
|
+
const clear = React65.useCallback(() => commitRef.current(multiple ? [] : ""), [multiple]);
|
|
8150
|
+
const context = React65.useMemo(
|
|
8112
8151
|
() => ({
|
|
8113
8152
|
size,
|
|
8114
8153
|
invalid: ids.invalid,
|
|
@@ -8179,13 +8218,13 @@ function SelectRoot(props) {
|
|
|
8179
8218
|
]
|
|
8180
8219
|
);
|
|
8181
8220
|
const body = /* @__PURE__ */ jsxs26(Fragment16, { children: [
|
|
8182
|
-
/* @__PURE__ */
|
|
8183
|
-
name ? (selected.length > 0 || multiple ? selected : [""]).map((item) => /* @__PURE__ */
|
|
8184
|
-
/* @__PURE__ */
|
|
8221
|
+
/* @__PURE__ */ jsx42(SelectProvider, { value: context, children }),
|
|
8222
|
+
name ? (selected.length > 0 || multiple ? selected : [""]).map((item) => /* @__PURE__ */ jsx42("input", { type: "hidden", name, value: item, disabled }, item)) : null,
|
|
8223
|
+
/* @__PURE__ */ jsx42(VisuallyHidden, { live: "polite", children: announcement })
|
|
8185
8224
|
] });
|
|
8186
8225
|
if (segment) {
|
|
8187
8226
|
return tier.provide(
|
|
8188
|
-
/* @__PURE__ */
|
|
8227
|
+
/* @__PURE__ */ jsx42(
|
|
8189
8228
|
"div",
|
|
8190
8229
|
{
|
|
8191
8230
|
...rest,
|
|
@@ -8198,7 +8237,7 @@ function SelectRoot(props) {
|
|
|
8198
8237
|
);
|
|
8199
8238
|
}
|
|
8200
8239
|
return tier.provide(
|
|
8201
|
-
/* @__PURE__ */
|
|
8240
|
+
/* @__PURE__ */ jsx42(
|
|
8202
8241
|
FieldFrame,
|
|
8203
8242
|
{
|
|
8204
8243
|
...rest,
|
|
@@ -8255,8 +8294,8 @@ function SelectTrigger({
|
|
|
8255
8294
|
useListboxView(registry);
|
|
8256
8295
|
const valueText = selected.map(registry.labelOf).join(", ");
|
|
8257
8296
|
const segmentName = segment?.label ? valueText ? `${segment.label}: ${valueText}` : segment.label : void 0;
|
|
8258
|
-
const parts =
|
|
8259
|
-
const iconOnly = parts.some((node) =>
|
|
8297
|
+
const parts = React65.Children.toArray(children);
|
|
8298
|
+
const iconOnly = parts.some((node) => React65.isValidElement(node) && node.type === SelectTriggerIcon) && !parts.some((node) => React65.isValidElement(node) && node.type === SelectValue);
|
|
8260
8299
|
const busy = loading || saving;
|
|
8261
8300
|
const showClear = clearable && selected.length > 0 && !disabled && !busy;
|
|
8262
8301
|
const clearPresence = usePartPresence({ present: showClear, axis: "inline" });
|
|
@@ -8312,13 +8351,13 @@ function SelectTrigger({
|
|
|
8312
8351
|
children: [
|
|
8313
8352
|
/* @__PURE__ */ jsxs26("span", { className: Select_default.triggerMain, children: [
|
|
8314
8353
|
children,
|
|
8315
|
-
iconOnly ? /* @__PURE__ */
|
|
8354
|
+
iconOnly ? /* @__PURE__ */ jsx42(SelectValue, { className: visuallyHiddenClass }) : null
|
|
8316
8355
|
] }),
|
|
8317
8356
|
showClear ? (
|
|
8318
8357
|
// A segment, not a button: interactive content inside a <button> is invalid. The keyboard
|
|
8319
8358
|
// clears with Delete / Backspace on the trigger. A touch target in height, like the clear
|
|
8320
8359
|
// segment of a field (`FieldAction`).
|
|
8321
|
-
/* @__PURE__ */
|
|
8360
|
+
/* @__PURE__ */ jsx42(
|
|
8322
8361
|
"span",
|
|
8323
8362
|
{
|
|
8324
8363
|
ref: clearPresence.ref,
|
|
@@ -8331,11 +8370,11 @@ function SelectTrigger({
|
|
|
8331
8370
|
event.stopPropagation();
|
|
8332
8371
|
clear();
|
|
8333
8372
|
},
|
|
8334
|
-
children: /* @__PURE__ */
|
|
8373
|
+
children: /* @__PURE__ */ jsx42(Icon, { name: "action.close" })
|
|
8335
8374
|
}
|
|
8336
8375
|
)
|
|
8337
8376
|
) : null,
|
|
8338
|
-
/* @__PURE__ */
|
|
8377
|
+
/* @__PURE__ */ jsx42("span", { className: Select_default.chevron, "aria-hidden": "true", children: /* @__PURE__ */ jsx42(GlyphSwap, { children: busy ? /* @__PURE__ */ jsx42(Spinner, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx42(Icon, { name: "nav.chevronDown" }) }) })
|
|
8339
8378
|
]
|
|
8340
8379
|
}
|
|
8341
8380
|
);
|
|
@@ -8359,13 +8398,13 @@ function SelectValue({ renderValue, className, ...rest }) {
|
|
|
8359
8398
|
}),
|
|
8360
8399
|
children: [
|
|
8361
8400
|
sizeMedia(parts.leading, size),
|
|
8362
|
-
/* @__PURE__ */
|
|
8401
|
+
/* @__PURE__ */ jsx42("span", { className: Select_default.valueBody, children: parts.body }),
|
|
8363
8402
|
parts.meta
|
|
8364
8403
|
]
|
|
8365
8404
|
}
|
|
8366
8405
|
);
|
|
8367
8406
|
}
|
|
8368
|
-
return /* @__PURE__ */
|
|
8407
|
+
return /* @__PURE__ */ jsx42(
|
|
8369
8408
|
"span",
|
|
8370
8409
|
{
|
|
8371
8410
|
...rest,
|
|
@@ -8377,19 +8416,19 @@ function SelectValue({ renderValue, className, ...rest }) {
|
|
|
8377
8416
|
}
|
|
8378
8417
|
SelectValue.displayName = "Select.Value";
|
|
8379
8418
|
function SelectTriggerIcon({ className, ...rest }) {
|
|
8380
|
-
return /* @__PURE__ */
|
|
8419
|
+
return /* @__PURE__ */ jsx42("span", { "aria-hidden": "true", className: cx(Select_default.triggerIcon, className), ...rest });
|
|
8381
8420
|
}
|
|
8382
8421
|
SelectTriggerIcon.displayName = "Select.TriggerIcon";
|
|
8383
8422
|
var LOADING_ROWS2 = 4;
|
|
8384
8423
|
var LOADING_MORE_ROWS = 2;
|
|
8385
8424
|
function SkeletonRows({ count }) {
|
|
8386
|
-
return Array.from({ length: count }, (_, index) => /* @__PURE__ */
|
|
8425
|
+
return Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsx42(
|
|
8387
8426
|
"div",
|
|
8388
8427
|
{
|
|
8389
8428
|
"aria-hidden": "true",
|
|
8390
8429
|
className: cx(menu_default.item, menu_default.skeletonRow),
|
|
8391
8430
|
"data-skeleton": "",
|
|
8392
|
-
children: /* @__PURE__ */
|
|
8431
|
+
children: /* @__PURE__ */ jsx42(Skeleton, {})
|
|
8393
8432
|
},
|
|
8394
8433
|
index
|
|
8395
8434
|
));
|
|
@@ -8419,12 +8458,12 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
8419
8458
|
labels,
|
|
8420
8459
|
registry
|
|
8421
8460
|
} = useSelectContext();
|
|
8422
|
-
const listboxRef =
|
|
8461
|
+
const listboxRef = React65.useRef(null);
|
|
8423
8462
|
const setListboxRef = useMergedRefs(listboxRef);
|
|
8424
8463
|
const items = [];
|
|
8425
8464
|
const actions = [];
|
|
8426
|
-
for (const child of
|
|
8427
|
-
(
|
|
8465
|
+
for (const child of React65.Children.toArray(children)) {
|
|
8466
|
+
(React65.isValidElement(child) && child.type === SelectAction ? actions : items).push(child);
|
|
8428
8467
|
}
|
|
8429
8468
|
const actionsId = `${listboxId}-actions`;
|
|
8430
8469
|
const floating = useFloatingLayer({
|
|
@@ -8451,7 +8490,7 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
8451
8490
|
});
|
|
8452
8491
|
const setSentinelRef = useMergedRefs(sentinelRef);
|
|
8453
8492
|
const lastOption = view.navigable.filter((id) => !isActionValue(id)).at(-1);
|
|
8454
|
-
|
|
8493
|
+
React65.useEffect(() => {
|
|
8455
8494
|
if (highlighted !== void 0 && highlighted === lastOption) requestMore();
|
|
8456
8495
|
}, [highlighted, lastOption, requestMore]);
|
|
8457
8496
|
const handleKeyDown = (event) => {
|
|
@@ -8482,7 +8521,7 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
8482
8521
|
});
|
|
8483
8522
|
if (moved !== null) revealHighlighted(registry.nodeOf(moved));
|
|
8484
8523
|
};
|
|
8485
|
-
if (!floating.mounted) return /* @__PURE__ */
|
|
8524
|
+
if (!floating.mounted) return /* @__PURE__ */ jsx42("div", { hidden: true, children: items });
|
|
8486
8525
|
const activeDescendant = isOpen && highlighted !== void 0 ? optionDomId(listboxId, highlighted) : void 0;
|
|
8487
8526
|
return /* @__PURE__ */ jsxs26(
|
|
8488
8527
|
FloatingPanel,
|
|
@@ -8497,11 +8536,11 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
8497
8536
|
searchable ? (
|
|
8498
8537
|
// The permanent focus of the panel: no ring, the caret is the indicator (foundation §7).
|
|
8499
8538
|
/* @__PURE__ */ jsxs26("div", { className: cx(menu_default.searchRow, Select_default.search), children: [
|
|
8500
|
-
/* @__PURE__ */
|
|
8501
|
-
/* @__PURE__ */
|
|
8539
|
+
/* @__PURE__ */ jsx42(Icon, { name: "action.search", size: "s" }),
|
|
8540
|
+
/* @__PURE__ */ jsx42(
|
|
8502
8541
|
"input",
|
|
8503
8542
|
{
|
|
8504
|
-
type: "
|
|
8543
|
+
type: "search",
|
|
8505
8544
|
className: menu_default.searchInput,
|
|
8506
8545
|
value: query,
|
|
8507
8546
|
placeholder: labels.search,
|
|
@@ -8509,7 +8548,7 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
8509
8548
|
"aria-controls": region === "error" ? void 0 : listboxId,
|
|
8510
8549
|
"aria-activedescendant": activeDescendant,
|
|
8511
8550
|
"aria-autocomplete": "list",
|
|
8512
|
-
|
|
8551
|
+
...AUTOFILL_OFF,
|
|
8513
8552
|
spellCheck: false,
|
|
8514
8553
|
"data-autofocus": "",
|
|
8515
8554
|
onChange: (event) => setQuery(event.target.value)
|
|
@@ -8517,10 +8556,10 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
8517
8556
|
)
|
|
8518
8557
|
] })
|
|
8519
8558
|
) : null,
|
|
8520
|
-
/* @__PURE__ */
|
|
8521
|
-
/* @__PURE__ */
|
|
8522
|
-
onRetry ? /* @__PURE__ */
|
|
8523
|
-
/* @__PURE__ */
|
|
8559
|
+
/* @__PURE__ */ jsx42(RegionSwap, { state: region, fill: true, children: region === "error" ? /* @__PURE__ */ jsxs26(EmptyPage.Root, { layout: "compact", size, role: "alert", children: [
|
|
8560
|
+
/* @__PURE__ */ jsx42(EmptyPage.Title, { as: "p", children: loadError }),
|
|
8561
|
+
onRetry ? /* @__PURE__ */ jsx42(EmptyPage.Actions, { children: /* @__PURE__ */ jsxs26(Button.Root, { variant: "soft", tone: "neutral", onClick: onRetry, children: [
|
|
8562
|
+
/* @__PURE__ */ jsx42(Button.Icon, { children: /* @__PURE__ */ jsx42(Icon, { name: "action.refresh" }) }),
|
|
8524
8563
|
labels.retry
|
|
8525
8564
|
] }) }) : null
|
|
8526
8565
|
] }) : /* @__PURE__ */ jsxs26(Fragment16, { children: [
|
|
@@ -8540,25 +8579,22 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
8540
8579
|
className: Select_default.listbox,
|
|
8541
8580
|
children: [
|
|
8542
8581
|
items,
|
|
8543
|
-
region === "loading" ? /* @__PURE__ */
|
|
8544
|
-
region === "ready" && hasMore ? /* @__PURE__ */
|
|
8545
|
-
region === "ready" && loadingMore ? /* @__PURE__ */
|
|
8582
|
+
region === "loading" ? /* @__PURE__ */ jsx42(SkeletonRows, { count: LOADING_ROWS2 }) : null,
|
|
8583
|
+
region === "ready" && hasMore ? /* @__PURE__ */ jsx42("div", { ref: setSentinelRef, "aria-hidden": "true", className: menu_default.loadSentinel }) : null,
|
|
8584
|
+
region === "ready" && loadingMore ? /* @__PURE__ */ jsx42(SkeletonRows, { count: LOADING_MORE_ROWS }) : null
|
|
8546
8585
|
]
|
|
8547
8586
|
}
|
|
8548
8587
|
),
|
|
8549
|
-
region === "ready" && isEmpty ? /* @__PURE__ */
|
|
8550
|
-
/* @__PURE__ */ jsx41(EmptyPage.Title, { as: "p", children: labels.empty }),
|
|
8551
|
-
query !== "" && labels.emptyHint ? /* @__PURE__ */ jsx41(EmptyPage.Description, { children: labels.emptyHint }) : null
|
|
8552
|
-
] }) : null,
|
|
8588
|
+
region === "ready" && isEmpty ? /* @__PURE__ */ jsx42(EmptyPage.Root, { layout: "compact", size, role: "status", children: /* @__PURE__ */ jsx42(EmptyPage.Title, { as: "p", children: labels.empty }) }) : null,
|
|
8553
8589
|
actions.length > 0 ? (
|
|
8554
8590
|
// Owned by the listbox (`aria-owns`): its options for assistive tech, pinned under
|
|
8555
8591
|
// the scroller and the empty state for the eye.
|
|
8556
8592
|
// biome-ignore lint/a11y/useSemanticElements: a group of options inside a listbox, not a form fieldset
|
|
8557
|
-
/* @__PURE__ */
|
|
8593
|
+
/* @__PURE__ */ jsx42("div", { id: actionsId, role: "group", className: Select_default.actions, children: actions })
|
|
8558
8594
|
) : null
|
|
8559
8595
|
] }) }),
|
|
8560
|
-
/* @__PURE__ */
|
|
8561
|
-
/* @__PURE__ */
|
|
8596
|
+
/* @__PURE__ */ jsx42(VisuallyHidden, { live: "polite", children: loading || loadingMore ? labels.loading : "" }),
|
|
8597
|
+
/* @__PURE__ */ jsx42(HighlightOnOpen, {})
|
|
8562
8598
|
]
|
|
8563
8599
|
}
|
|
8564
8600
|
);
|
|
@@ -8567,9 +8603,9 @@ SelectContent.displayName = "Select.Content";
|
|
|
8567
8603
|
function HighlightOnOpen() {
|
|
8568
8604
|
const { isOpen, query, filter, selected, registry, highlight } = useSelectContext();
|
|
8569
8605
|
const view = useListboxView(registry, query, filter);
|
|
8570
|
-
const latest =
|
|
8606
|
+
const latest = React65.useRef({ query, filter, selected });
|
|
8571
8607
|
latest.current = { query, filter, selected };
|
|
8572
|
-
|
|
8608
|
+
React65.useLayoutEffect(() => {
|
|
8573
8609
|
if (!isOpen) return;
|
|
8574
8610
|
const { query: text, filter: filtered, selected: picked } = latest.current;
|
|
8575
8611
|
const first = registry.view(text, filtered).navigable.find((id) => picked.includes(id));
|
|
@@ -8577,12 +8613,12 @@ function HighlightOnOpen() {
|
|
|
8577
8613
|
if (first !== void 0) revealHighlighted(registry.nodeOf(first));
|
|
8578
8614
|
return () => highlight.set(void 0);
|
|
8579
8615
|
}, [isOpen, registry, highlight]);
|
|
8580
|
-
const latestView =
|
|
8616
|
+
const latestView = React65.useRef(view);
|
|
8581
8617
|
latestView.current = view;
|
|
8582
|
-
|
|
8618
|
+
React65.useLayoutEffect(() => {
|
|
8583
8619
|
if (query !== "") highlight.set(latestView.current.navigable[0]);
|
|
8584
8620
|
}, [query, highlight]);
|
|
8585
|
-
|
|
8621
|
+
React65.useLayoutEffect(() => {
|
|
8586
8622
|
if (query === "") return;
|
|
8587
8623
|
const current = highlight.get();
|
|
8588
8624
|
if (current === void 0 || isActionValue(current) || !view.navigable.includes(current)) {
|
|
@@ -8592,11 +8628,11 @@ function HighlightOnOpen() {
|
|
|
8592
8628
|
return null;
|
|
8593
8629
|
}
|
|
8594
8630
|
function SelectGroup({ className, ...rest }) {
|
|
8595
|
-
return /* @__PURE__ */
|
|
8631
|
+
return /* @__PURE__ */ jsx42(MenuGroup, { ...rest, className: cx(Select_default.group, className) });
|
|
8596
8632
|
}
|
|
8597
8633
|
SelectGroup.displayName = "Select.Group";
|
|
8598
8634
|
function SelectSeparator({ className, ...rest }) {
|
|
8599
|
-
return /* @__PURE__ */
|
|
8635
|
+
return /* @__PURE__ */ jsx42(Divider, { ...rest, className: cx(menu_default.separator, Select_default.separator, className) });
|
|
8600
8636
|
}
|
|
8601
8637
|
SelectSeparator.displayName = "Select.Separator";
|
|
8602
8638
|
var Select = {
|
|
@@ -8616,7 +8652,7 @@ var Select = {
|
|
|
8616
8652
|
};
|
|
8617
8653
|
|
|
8618
8654
|
// src/internal/swatch.tsx
|
|
8619
|
-
import * as
|
|
8655
|
+
import * as React66 from "react";
|
|
8620
8656
|
|
|
8621
8657
|
// src/internal/swatch.module.css
|
|
8622
8658
|
var swatch_default = {
|
|
@@ -8633,7 +8669,7 @@ var swatch_default = {
|
|
|
8633
8669
|
};
|
|
8634
8670
|
|
|
8635
8671
|
// src/internal/swatch.tsx
|
|
8636
|
-
import { Fragment as Fragment17, jsx as
|
|
8672
|
+
import { Fragment as Fragment17, jsx as jsx43, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
8637
8673
|
var COLOR_PRESETS = [
|
|
8638
8674
|
{ value: "#ef4444", label: "\u041A\u0440\u0430\u0441\u043D\u044B\u0439" },
|
|
8639
8675
|
{ value: "#f97316", label: "\u041E\u0440\u0430\u043D\u0436\u0435\u0432\u044B\u0439" },
|
|
@@ -8666,7 +8702,7 @@ var PALETTE_COLOR_NAMES = {
|
|
|
8666
8702
|
};
|
|
8667
8703
|
var PALETTE_ORDER = Object.keys(PALETTE_COLOR_NAMES);
|
|
8668
8704
|
function useSwatchOptions(presets, allowEmpty, emptyLabel) {
|
|
8669
|
-
return
|
|
8705
|
+
return React66.useMemo(
|
|
8670
8706
|
() => [
|
|
8671
8707
|
...presets.map((preset) => ({ ...preset, contrast: markContrast(preset.value) })),
|
|
8672
8708
|
...allowEmpty ? [{ value: null, label: emptyLabel, contrast: "surface" }] : []
|
|
@@ -8675,7 +8711,7 @@ function useSwatchOptions(presets, allowEmpty, emptyLabel) {
|
|
|
8675
8711
|
);
|
|
8676
8712
|
}
|
|
8677
8713
|
function usePaletteOptions(palette, allowEmpty, emptyLabel, names) {
|
|
8678
|
-
return
|
|
8714
|
+
return React66.useMemo(
|
|
8679
8715
|
() => [
|
|
8680
8716
|
...palette.map((hue) => ({ value: hue, label: names[hue], contrast: "hue" })),
|
|
8681
8717
|
...allowEmpty ? [{ value: null, label: emptyLabel, contrast: "surface" }] : []
|
|
@@ -8689,9 +8725,9 @@ var swatchTierClass = cx(fieldTierClass, swatch_default.tier);
|
|
|
8689
8725
|
var swatchGridClass = swatch_default.grid;
|
|
8690
8726
|
var checkerboardClass = swatch_default.checkerboard;
|
|
8691
8727
|
function SwatchFill({ value, hue = false }) {
|
|
8692
|
-
if (value == null) return /* @__PURE__ */
|
|
8693
|
-
if (hue) return /* @__PURE__ */
|
|
8694
|
-
return /* @__PURE__ */
|
|
8728
|
+
if (value == null) return /* @__PURE__ */ jsx43("span", { "aria-hidden": true, className: swatch_default.checker });
|
|
8729
|
+
if (hue) return /* @__PURE__ */ jsx43("span", { "aria-hidden": true, className: cx(swatch_default.fill, swatch_default.hueFill) });
|
|
8730
|
+
return /* @__PURE__ */ jsx43("svg", { className: swatch_default.fill, "aria-hidden": "true", viewBox: "0 0 1 1", preserveAspectRatio: "none", children: /* @__PURE__ */ jsx43("rect", { width: "1", height: "1", fill: value }) });
|
|
8695
8731
|
}
|
|
8696
8732
|
function SwatchContent({
|
|
8697
8733
|
value,
|
|
@@ -8699,12 +8735,12 @@ function SwatchContent({
|
|
|
8699
8735
|
hue = false
|
|
8700
8736
|
}) {
|
|
8701
8737
|
return /* @__PURE__ */ jsxs27(Fragment17, { children: [
|
|
8702
|
-
/* @__PURE__ */
|
|
8703
|
-
/* @__PURE__ */
|
|
8738
|
+
/* @__PURE__ */ jsx43(SwatchFill, { value, hue }),
|
|
8739
|
+
/* @__PURE__ */ jsx43(CheckMark, { state: selected ? "checked" : "unchecked", className: swatch_default.check })
|
|
8704
8740
|
] });
|
|
8705
8741
|
}
|
|
8706
8742
|
function SwatchChip({ value, className, ...rest }) {
|
|
8707
|
-
return /* @__PURE__ */
|
|
8743
|
+
return /* @__PURE__ */ jsx43("span", { ...rest, "aria-hidden": true, className: cx(swatch_default.chip, className), children: /* @__PURE__ */ jsx43(SwatchFill, { value }) });
|
|
8708
8744
|
}
|
|
8709
8745
|
function parseHexColor(text) {
|
|
8710
8746
|
const hex = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(text.trim())?.[1]?.toLowerCase();
|
|
@@ -8758,15 +8794,15 @@ function balancedColumns(count, width, cell, gap) {
|
|
|
8758
8794
|
return Math.ceil(count / rows);
|
|
8759
8795
|
}
|
|
8760
8796
|
function useBalancedColumns(gridRef, count, cellSelector) {
|
|
8761
|
-
const [columns, setColumns] =
|
|
8762
|
-
const measure =
|
|
8797
|
+
const [columns, setColumns] = React66.useState();
|
|
8798
|
+
const measure = React66.useCallback(() => {
|
|
8763
8799
|
const grid = gridRef.current;
|
|
8764
8800
|
if (!grid) return;
|
|
8765
8801
|
const cell = grid.querySelector(cellSelector)?.offsetHeight ?? 0;
|
|
8766
8802
|
const gap = Number.parseFloat(getComputedStyle(grid).columnGap) || 0;
|
|
8767
8803
|
setColumns(cell > 0 ? balancedColumns(count, grid.clientWidth, cell, gap) : void 0);
|
|
8768
8804
|
}, [gridRef, count, cellSelector]);
|
|
8769
|
-
|
|
8805
|
+
React66.useLayoutEffect(measure, [measure]);
|
|
8770
8806
|
useResizeEffect(gridRef, measure);
|
|
8771
8807
|
return columns;
|
|
8772
8808
|
}
|
|
@@ -8776,14 +8812,14 @@ function firstRowLength(items) {
|
|
|
8776
8812
|
return Math.max(1, count === -1 ? items.length : count);
|
|
8777
8813
|
}
|
|
8778
8814
|
function useSwatchGrid(count) {
|
|
8779
|
-
const items =
|
|
8780
|
-
const itemRef =
|
|
8815
|
+
const items = React66.useRef([]);
|
|
8816
|
+
const itemRef = React66.useCallback(
|
|
8781
8817
|
(index) => (node) => {
|
|
8782
8818
|
items.current[index] = node;
|
|
8783
8819
|
},
|
|
8784
8820
|
[]
|
|
8785
8821
|
);
|
|
8786
|
-
const move =
|
|
8822
|
+
const move = React66.useCallback(
|
|
8787
8823
|
(event, from, columns) => {
|
|
8788
8824
|
const focused = document.activeElement;
|
|
8789
8825
|
const current = focused instanceof HTMLElement ? items.current.indexOf(focused) : -1;
|
|
@@ -8800,14 +8836,14 @@ function useSwatchGrid(count) {
|
|
|
8800
8836
|
},
|
|
8801
8837
|
[count]
|
|
8802
8838
|
);
|
|
8803
|
-
const focus =
|
|
8839
|
+
const focus = React66.useCallback((index) => {
|
|
8804
8840
|
items.current[index]?.focus({ preventScroll: true });
|
|
8805
8841
|
}, []);
|
|
8806
8842
|
return { itemRef, move, focus };
|
|
8807
8843
|
}
|
|
8808
8844
|
|
|
8809
8845
|
// src/components/color-swatches/ColorSwatches.tsx
|
|
8810
|
-
import * as
|
|
8846
|
+
import * as React67 from "react";
|
|
8811
8847
|
|
|
8812
8848
|
// src/components/color-swatches/ColorSwatches.module.css
|
|
8813
8849
|
var ColorSwatches_default = {
|
|
@@ -8815,7 +8851,7 @@ var ColorSwatches_default = {
|
|
|
8815
8851
|
};
|
|
8816
8852
|
|
|
8817
8853
|
// src/components/color-swatches/ColorSwatches.tsx
|
|
8818
|
-
import { jsx as
|
|
8854
|
+
import { jsx as jsx44, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8819
8855
|
var COLOR_SWATCHES_LABELS = {
|
|
8820
8856
|
group: "\u0426\u0432\u0435\u0442",
|
|
8821
8857
|
empty: "\u0411\u0435\u0437 \u0446\u0432\u0435\u0442\u0430",
|
|
@@ -8832,7 +8868,7 @@ function ColorSwatches(props) {
|
|
|
8832
8868
|
palette = PALETTE_ORDER,
|
|
8833
8869
|
...rest
|
|
8834
8870
|
} = props;
|
|
8835
|
-
return /* @__PURE__ */
|
|
8871
|
+
return /* @__PURE__ */ jsx44(
|
|
8836
8872
|
SwatchGrid,
|
|
8837
8873
|
{
|
|
8838
8874
|
...rest,
|
|
@@ -8875,7 +8911,7 @@ function SwatchGrid({
|
|
|
8875
8911
|
const disabled = useInheritedDisabled(disabledProp);
|
|
8876
8912
|
const frameSize = useControlSize(void 0);
|
|
8877
8913
|
const merged = useLabels(COLOR_SWATCHES_LABELS, labelsProp);
|
|
8878
|
-
const labels =
|
|
8914
|
+
const labels = React67.useMemo(
|
|
8879
8915
|
() => ({
|
|
8880
8916
|
...merged,
|
|
8881
8917
|
colorNames: { ...COLOR_SWATCHES_LABELS.colorNames, ...labelsProp?.colorNames }
|
|
@@ -8894,14 +8930,14 @@ function SwatchGrid({
|
|
|
8894
8930
|
const selectedIndex = options.findIndex((option) => sameColor(option.value, value));
|
|
8895
8931
|
const focusIndex = Math.max(0, selectedIndex);
|
|
8896
8932
|
const grid = useSwatchGrid(options.length);
|
|
8897
|
-
const gridRef =
|
|
8933
|
+
const gridRef = React67.useRef(null);
|
|
8898
8934
|
const columns = useBalancedColumns(gridRef, options.length, "[role='radio']");
|
|
8899
8935
|
const labelledBy = ariaLabelledBy ?? ids.labelledBy;
|
|
8900
8936
|
const onKeyDown2 = (event) => {
|
|
8901
8937
|
const next = grid.move(event, focusIndex);
|
|
8902
8938
|
if (next !== null) setValue(options[next]?.value ?? null);
|
|
8903
8939
|
};
|
|
8904
|
-
return /* @__PURE__ */
|
|
8940
|
+
return /* @__PURE__ */ jsx44(
|
|
8905
8941
|
FieldFrame,
|
|
8906
8942
|
{
|
|
8907
8943
|
...rest,
|
|
@@ -8946,7 +8982,7 @@ function SwatchGrid({
|
|
|
8946
8982
|
const selected = index === selectedIndex;
|
|
8947
8983
|
return (
|
|
8948
8984
|
// 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
|
|
8949
|
-
/* @__PURE__ */
|
|
8985
|
+
/* @__PURE__ */ jsx44(
|
|
8950
8986
|
"button",
|
|
8951
8987
|
{
|
|
8952
8988
|
ref: grid.itemRef(index),
|
|
@@ -8964,13 +9000,13 @@ function SwatchGrid({
|
|
|
8964
9000
|
color: hues ? option.value ?? void 0 : void 0
|
|
8965
9001
|
}),
|
|
8966
9002
|
onClick: () => setValue(option.value),
|
|
8967
|
-
children: /* @__PURE__ */
|
|
9003
|
+
children: /* @__PURE__ */ jsx44(SwatchContent, { value: option.value, selected, hue: hues })
|
|
8968
9004
|
},
|
|
8969
9005
|
option.value ?? "empty"
|
|
8970
9006
|
)
|
|
8971
9007
|
);
|
|
8972
9008
|
}),
|
|
8973
|
-
name ? /* @__PURE__ */
|
|
9009
|
+
name ? /* @__PURE__ */ jsx44("input", { type: "hidden", name, value: value ?? "" }) : null
|
|
8974
9010
|
]
|
|
8975
9011
|
}
|
|
8976
9012
|
)
|
|
@@ -9107,6 +9143,9 @@ export {
|
|
|
9107
9143
|
useFieldFrame,
|
|
9108
9144
|
FieldFrame,
|
|
9109
9145
|
FieldCounter,
|
|
9146
|
+
AUTOFILL_OFF,
|
|
9147
|
+
AutofillScope,
|
|
9148
|
+
useAutofill,
|
|
9110
9149
|
FieldActionButton,
|
|
9111
9150
|
FieldCopyButton,
|
|
9112
9151
|
setControlValue,
|