@reopt-ai/opt-ui 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENT_CATALOG.md +177 -66
- package/README.md +21 -5
- package/dist/core/index.cjs +10 -8
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +3 -3
- package/dist/docs/02-components/01-core.md +92 -41
- package/dist/docs/02-components/02-visuals.md +1 -1
- package/dist/docs/02-components/03-shells.md +96 -26
- package/dist/docs/02-components/04-surfaces.md +1 -1
- package/dist/docs/02-components/index.md +5 -5
- package/dist/{field-sidebar-DWfJAJlx.d.ts → field-sidebar-B5SQC35J.d.cts} +214 -3
- package/dist/field-sidebar-B5SQC35J.d.cts.map +1 -0
- package/dist/{field-sidebar-BXjvV7Cz.js → field-sidebar-BXl5RJ3q.js} +589 -40
- package/dist/field-sidebar-BXl5RJ3q.js.map +1 -0
- package/dist/{field-sidebar-nwcE9LC4.d.cts → field-sidebar-CBeWE8xX.d.ts} +214 -3
- package/dist/field-sidebar-CBeWE8xX.d.ts.map +1 -0
- package/dist/{field-sidebar-B6Ndr8HE.cjs → field-sidebar-DAuN4jPV.cjs} +605 -38
- package/dist/id-registry.cjs +46 -6
- package/dist/id-registry.d.cts.map +1 -1
- package/dist/id-registry.d.ts.map +1 -1
- package/dist/id-registry.js +46 -6
- package/dist/id-registry.js.map +1 -1
- package/dist/id-registry.json +97 -12
- package/dist/index.cjs +39 -33
- package/dist/index.d.cts +10 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -19
- package/dist/index.js.map +1 -1
- package/dist/{key-pad-menu-DfZbeXhG.d.cts → key-pad-menu-BxTy_u0Q.d.cts} +152 -7
- package/dist/key-pad-menu-BxTy_u0Q.d.cts.map +1 -0
- package/dist/{key-pad-menu-D5mQcS5v.cjs → key-pad-menu-Cg6rZBie.cjs} +490 -609
- package/dist/{key-pad-menu-BsgJMjD4.d.ts → key-pad-menu-u5GTJl9B.d.ts} +152 -7
- package/dist/key-pad-menu-u5GTJl9B.d.ts.map +1 -0
- package/dist/{key-pad-menu-BQunU20e.js → key-pad-menu-wXkWn1I1.js} +387 -458
- package/dist/key-pad-menu-wXkWn1I1.js.map +1 -0
- package/dist/meta.cjs +486 -9
- package/dist/meta.d.cts.map +1 -1
- package/dist/meta.d.ts.map +1 -1
- package/dist/meta.js +486 -9
- package/dist/meta.js.map +1 -1
- package/dist/shells/index.cjs +4 -1
- package/dist/shells/index.d.cts +2 -2
- package/dist/shells/index.d.ts +2 -2
- package/dist/shells/index.js +2 -2
- package/dist/{text-truncate-CxdzAnhS.cjs → text-truncate-BZdL1k5Z.cjs} +474 -83
- package/dist/{text-truncate-j6X3z7Pv.js → text-truncate-C17HHCR-.js} +405 -86
- package/dist/text-truncate-C17HHCR-.js.map +1 -0
- package/dist/{text-truncate-BGr7bB_8.d.ts → text-truncate-DW78lg4S.d.cts} +18 -3
- package/dist/text-truncate-DW78lg4S.d.cts.map +1 -0
- package/dist/{text-truncate-BGr7bB_8.d.cts → text-truncate-DW78lg4S.d.ts} +18 -3
- package/dist/text-truncate-DW78lg4S.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/field-sidebar-BXjvV7Cz.js.map +0 -1
- package/dist/field-sidebar-DWfJAJlx.d.ts.map +0 -1
- package/dist/field-sidebar-nwcE9LC4.d.cts.map +0 -1
- package/dist/key-pad-menu-BQunU20e.js.map +0 -1
- package/dist/key-pad-menu-BsgJMjD4.d.ts.map +0 -1
- package/dist/key-pad-menu-DfZbeXhG.d.cts.map +0 -1
- package/dist/text-truncate-BGr7bB_8.d.cts.map +0 -1
- package/dist/text-truncate-BGr7bB_8.d.ts.map +0 -1
- package/dist/text-truncate-j6X3z7Pv.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const require_text_truncate = require("./text-truncate-
|
|
2
|
+
const require_text_truncate = require("./text-truncate-BZdL1k5Z.cjs");
|
|
3
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_text_truncate.__toESM(react, 1);
|
|
@@ -9,7 +9,7 @@ let react_resizable_panels = require("react-resizable-panels");
|
|
|
9
9
|
let ogl = require("ogl");
|
|
10
10
|
let _reopt_ai_opt_palette = require("@reopt-ai/opt-palette");
|
|
11
11
|
//#region src/core/text.tsx
|
|
12
|
-
const _excluded$
|
|
12
|
+
const _excluded$15 = [
|
|
13
13
|
"as",
|
|
14
14
|
"variant",
|
|
15
15
|
"tone",
|
|
@@ -25,7 +25,7 @@ const toneStyles$1 = {
|
|
|
25
25
|
};
|
|
26
26
|
/** Semantic body text whose visual role is controlled by foundation tokens. */
|
|
27
27
|
function Text(_ref) {
|
|
28
|
-
let { as, variant = "body", tone = "primary", truncate = false, className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$
|
|
28
|
+
let { as, variant = "body", tone = "primary", truncate = false, className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$15);
|
|
29
29
|
const Component = as !== null && as !== void 0 ? as : "span";
|
|
30
30
|
const elementProps = require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({}, props), {}, {
|
|
31
31
|
className: require_text_truncate.cn(`opt-type-${variant}`, toneStyles$1[tone], truncate && "truncate", className),
|
|
@@ -40,7 +40,7 @@ function Text(_ref) {
|
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/core/heading.tsx
|
|
43
|
-
const _excluded$
|
|
43
|
+
const _excluded$14 = [
|
|
44
44
|
"level",
|
|
45
45
|
"variant",
|
|
46
46
|
"className",
|
|
@@ -48,7 +48,7 @@ const _excluded$16 = [
|
|
|
48
48
|
];
|
|
49
49
|
/** Semantic heading with independently selectable visual hierarchy. */
|
|
50
50
|
function Heading(_ref) {
|
|
51
|
-
let { level = 2, variant = `heading-${level}`, className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$
|
|
51
|
+
let { level = 2, variant = `heading-${level}`, className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$14);
|
|
52
52
|
const Component = {
|
|
53
53
|
1: "h1",
|
|
54
54
|
2: "h2",
|
|
@@ -267,25 +267,25 @@ function OtpField({ length = 6, value: controlledValue, defaultValue = "", onCha
|
|
|
267
267
|
OtpField.displayName = "OtpField";
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region src/core/toggle.tsx
|
|
270
|
-
const _excluded$
|
|
270
|
+
const _excluded$13 = [
|
|
271
271
|
"size",
|
|
272
272
|
"className",
|
|
273
273
|
"children"
|
|
274
274
|
];
|
|
275
|
-
const _excluded2$
|
|
275
|
+
const _excluded2$7 = [
|
|
276
276
|
"className",
|
|
277
277
|
"children",
|
|
278
278
|
"orientation"
|
|
279
279
|
];
|
|
280
|
-
const sizeStyles$
|
|
280
|
+
const sizeStyles$7 = {
|
|
281
281
|
sm: "h-8 min-w-8 px-2 text-xs gap-1.5",
|
|
282
282
|
md: "h-10 min-w-10 px-3 text-sm gap-2"
|
|
283
283
|
};
|
|
284
284
|
const toggleBase = require_text_truncate.cn("inline-flex cursor-pointer items-center justify-center rounded-md border border-border bg-surface font-medium text-text-secondary", "hover:bg-bg-subtle hover:text-text-primary", "data-[pressed]:border-accent data-[pressed]:bg-accent-subtle data-[pressed]:text-accent", "disabled:pointer-events-none disabled:opacity-40", require_text_truncate.OPT_FOCUS_VISIBLE);
|
|
285
285
|
/** A two-state (pressed) button. Use standalone or inside `ToggleGroup`. */
|
|
286
286
|
function Toggle(_ref) {
|
|
287
|
-
let { size = "md", className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$
|
|
288
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Toggle, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(toggleBase, sizeStyles$
|
|
287
|
+
let { size = "md", className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$13);
|
|
288
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Toggle, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(toggleBase, sizeStyles$7[size], className) }, props), {}, {
|
|
289
289
|
"data-opt-id": "GFCMY",
|
|
290
290
|
"data-opt-slug": "toggle.Toggle",
|
|
291
291
|
children
|
|
@@ -294,7 +294,7 @@ function Toggle(_ref) {
|
|
|
294
294
|
Toggle.displayName = "Toggle";
|
|
295
295
|
/** A set of related toggles with shared selection and keyboard navigation. */
|
|
296
296
|
function ToggleGroup(_ref2) {
|
|
297
|
-
let { className, children, orientation = "horizontal" } = _ref2, props = require_text_truncate._objectWithoutProperties(_ref2, _excluded2$
|
|
297
|
+
let { className, children, orientation = "horizontal" } = _ref2, props = require_text_truncate._objectWithoutProperties(_ref2, _excluded2$7);
|
|
298
298
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ToggleGroup, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({
|
|
299
299
|
orientation,
|
|
300
300
|
"aria-orientation": orientation,
|
|
@@ -308,15 +308,15 @@ function ToggleGroup(_ref2) {
|
|
|
308
308
|
ToggleGroup.displayName = "ToggleGroup";
|
|
309
309
|
//#endregion
|
|
310
310
|
//#region src/core/accordion.tsx
|
|
311
|
-
const _excluded$
|
|
312
|
-
const _excluded2$
|
|
313
|
-
const _excluded3$
|
|
314
|
-
const _excluded4$
|
|
311
|
+
const _excluded$12 = ["className"];
|
|
312
|
+
const _excluded2$6 = ["className"];
|
|
313
|
+
const _excluded3$3 = ["className", "children"];
|
|
314
|
+
const _excluded4$2 = ["className", "children"];
|
|
315
315
|
const triggerClass = `group/acc-trigger flex w-full cursor-pointer items-center justify-between gap-2 py-4 text-left text-sm font-medium text-text-primary transition-colors hover:text-text-secondary ${require_text_truncate.OPT_FOCUS} disabled:cursor-not-allowed disabled:opacity-50`;
|
|
316
316
|
const contentClass = `overflow-hidden text-sm text-text-secondary ${require_text_truncate.OPT_ANIMATE_ENTER_EXIT}`;
|
|
317
317
|
/** A vertically stacked set of expandable panels (single or multiple open). */
|
|
318
318
|
function AccordionRoot(_ref) {
|
|
319
|
-
let { className } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$
|
|
319
|
+
let { className } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$12);
|
|
320
320
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
321
321
|
className: require_text_truncate.cn("border-border border-y", className),
|
|
322
322
|
"data-opt-id": "CSBA9",
|
|
@@ -327,7 +327,7 @@ function AccordionRoot(_ref) {
|
|
|
327
327
|
AccordionRoot.displayName = "AccordionRoot";
|
|
328
328
|
/** A single accordion entry, identified by its `value`. */
|
|
329
329
|
function AccordionItem(_ref2) {
|
|
330
|
-
let { className } = _ref2, props = require_text_truncate._objectWithoutProperties(_ref2, _excluded2$
|
|
330
|
+
let { className } = _ref2, props = require_text_truncate._objectWithoutProperties(_ref2, _excluded2$6);
|
|
331
331
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.AccordionItem, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn("border-border border-b last:border-b-0", className) }, props), {}, {
|
|
332
332
|
"data-opt-id": "JTY9M",
|
|
333
333
|
"data-opt-slug": "accordion.AccordionItem"
|
|
@@ -336,7 +336,7 @@ function AccordionItem(_ref2) {
|
|
|
336
336
|
AccordionItem.displayName = "AccordionItem";
|
|
337
337
|
/** The clickable header that expands/collapses its panel. */
|
|
338
338
|
function AccordionTrigger(_ref3) {
|
|
339
|
-
let { className, children } = _ref3, props = require_text_truncate._objectWithoutProperties(_ref3, _excluded3$
|
|
339
|
+
let { className, children } = _ref3, props = require_text_truncate._objectWithoutProperties(_ref3, _excluded3$3);
|
|
340
340
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_reopt_ai_opt_ui_primitives.AccordionTrigger, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(triggerClass, className) }, props), {}, {
|
|
341
341
|
"data-opt-id": "CWJZZ",
|
|
342
342
|
"data-opt-slug": "accordion.AccordionTrigger",
|
|
@@ -352,7 +352,7 @@ function AccordionTrigger(_ref3) {
|
|
|
352
352
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
353
353
|
/** The collapsible panel body associated with a trigger. */
|
|
354
354
|
function AccordionContent(_ref4) {
|
|
355
|
-
let { className, children } = _ref4, props = require_text_truncate._objectWithoutProperties(_ref4, _excluded4$
|
|
355
|
+
let { className, children } = _ref4, props = require_text_truncate._objectWithoutProperties(_ref4, _excluded4$2);
|
|
356
356
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.AccordionContent, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(contentClass, className) }, props), {}, {
|
|
357
357
|
"data-opt-id": "J98AG",
|
|
358
358
|
"data-opt-slug": "accordion.AccordionContent",
|
|
@@ -410,427 +410,111 @@ function Breadcrumb({ items, separator = "/", className, onNavigate, "aria-label
|
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
//#endregion
|
|
413
|
-
//#region src/core/
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
"
|
|
417
|
-
"
|
|
418
|
-
"selectable",
|
|
419
|
-
"selected",
|
|
420
|
-
"onSelectedChange",
|
|
421
|
-
"className",
|
|
422
|
-
"children",
|
|
423
|
-
"onClick",
|
|
424
|
-
"onKeyDown",
|
|
425
|
-
"role",
|
|
426
|
-
"tabIndex"
|
|
427
|
-
];
|
|
428
|
-
const _excluded2$6 = [
|
|
429
|
-
"gap",
|
|
430
|
-
"className",
|
|
431
|
-
"children"
|
|
432
|
-
];
|
|
433
|
-
const _excluded3$3 = [
|
|
434
|
-
"as",
|
|
435
|
-
"className",
|
|
436
|
-
"children"
|
|
437
|
-
];
|
|
438
|
-
const _excluded4$2 = ["className", "children"];
|
|
439
|
-
const _excluded5 = [
|
|
440
|
-
"spacing",
|
|
441
|
-
"className",
|
|
442
|
-
"children"
|
|
443
|
-
];
|
|
444
|
-
const _excluded6 = [
|
|
445
|
-
"divider",
|
|
446
|
-
"className",
|
|
447
|
-
"children"
|
|
448
|
-
];
|
|
449
|
-
/** Renders the card component. */
|
|
450
|
-
function Card(_ref) {
|
|
451
|
-
let { variant = "default", padding = "md", shadow = true, selectable = false, selected = false, onSelectedChange, className, children, onClick, onKeyDown, role, tabIndex } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$13);
|
|
452
|
-
const isInteractive = selectable || !!onClick;
|
|
453
|
-
const handleClick = selectable ? (e) => {
|
|
454
|
-
onSelectedChange === null || onSelectedChange === void 0 || onSelectedChange(!selected);
|
|
455
|
-
onClick === null || onClick === void 0 || onClick(e);
|
|
456
|
-
} : onClick;
|
|
457
|
-
const handleKeyDown = selectable ? (e) => {
|
|
458
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
459
|
-
e.preventDefault();
|
|
460
|
-
onSelectedChange === null || onSelectedChange === void 0 || onSelectedChange(!selected);
|
|
461
|
-
}
|
|
462
|
-
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
|
|
463
|
-
} : isInteractive ? (e) => {
|
|
464
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
465
|
-
e.preventDefault();
|
|
466
|
-
e.currentTarget.click();
|
|
467
|
-
}
|
|
468
|
-
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
|
|
469
|
-
} : onKeyDown;
|
|
470
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({}, props), {}, { className: require_text_truncate.cn("rounded-xl", variant === "default" && require_text_truncate.cn(`border border-border bg-surface`, shadow && "shadow-sm"), variant === "outline" && "border-border border-2 bg-transparent", variant === "ghost" && "bg-bg-subtle", padding === "none" && "p-0", padding === "sm" && "p-3", padding === "md" && "p-5", padding === "lg" && "p-8", selectable && "cursor-pointer transition-colors", selectable && selected && "ring-accent border-accent ring-2 ring-offset-1", selectable && !selected && "hover:border-accent/50", className) }, isInteractive ? {
|
|
471
|
-
role: selectable ? "option" : "button",
|
|
472
|
-
tabIndex: 0,
|
|
473
|
-
"aria-selected": selectable ? selected : void 0,
|
|
474
|
-
onClick: handleClick,
|
|
475
|
-
onKeyDown: handleKeyDown
|
|
476
|
-
} : {
|
|
477
|
-
role,
|
|
478
|
-
tabIndex,
|
|
479
|
-
"aria-selected": selectable ? selected : void 0,
|
|
480
|
-
onKeyDown
|
|
481
|
-
}), {}, {
|
|
482
|
-
"data-opt-id": "0A18R",
|
|
483
|
-
"data-opt-slug": "card.Card",
|
|
484
|
-
children
|
|
485
|
-
}));
|
|
486
|
-
}
|
|
487
|
-
const headerGapClasses = {
|
|
488
|
-
sm: "gap-1",
|
|
489
|
-
md: "gap-1.5",
|
|
490
|
-
lg: "gap-2"
|
|
413
|
+
//#region src/core/description-list.tsx
|
|
414
|
+
const defaultLabels$3 = {
|
|
415
|
+
copy: (term) => `Copy ${term}`,
|
|
416
|
+
copied: "Copied",
|
|
417
|
+
empty: "—"
|
|
491
418
|
};
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
"data-opt-slug": "card.CardHeader",
|
|
498
|
-
children
|
|
499
|
-
}));
|
|
500
|
-
}
|
|
501
|
-
/** Renders the card title component. */
|
|
502
|
-
function CardTitle(_ref3) {
|
|
503
|
-
let { as: Tag = "h3", className, children } = _ref3, props = require_text_truncate._objectWithoutProperties(_ref3, _excluded3$3);
|
|
504
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(`text-lg font-semibold ${require_text_truncate.OPT_TEXT_PRIMARY}`, className) }, props), {}, {
|
|
505
|
-
"data-opt-id": "V15TX",
|
|
506
|
-
"data-opt-slug": "card.CardTitle",
|
|
507
|
-
children
|
|
508
|
-
}));
|
|
509
|
-
}
|
|
510
|
-
/** Renders the card description component. */
|
|
511
|
-
function CardDescription(_ref4) {
|
|
512
|
-
let { className, children } = _ref4, props = require_text_truncate._objectWithoutProperties(_ref4, _excluded4$2);
|
|
513
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(`text-sm ${require_text_truncate.OPT_TEXT_SECONDARY}`, className) }, props), {}, {
|
|
514
|
-
"data-opt-id": "YB1RN",
|
|
515
|
-
"data-opt-slug": "card.CardDescription",
|
|
516
|
-
children
|
|
517
|
-
}));
|
|
518
|
-
}
|
|
519
|
-
const contentSpacingClasses = {
|
|
520
|
-
none: "",
|
|
521
|
-
sm: "mt-2",
|
|
522
|
-
md: "mt-4",
|
|
523
|
-
lg: "mt-6"
|
|
419
|
+
const columnsClass = {
|
|
420
|
+
1: "grid-cols-1",
|
|
421
|
+
2: "grid-cols-1 sm:grid-cols-2",
|
|
422
|
+
3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
|
423
|
+
4: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-4"
|
|
524
424
|
};
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
"
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
425
|
+
function CopyButton({ value, label, copiedLabel }) {
|
|
426
|
+
const [copied, setCopied] = (0, react.useState)(false);
|
|
427
|
+
const handleCopy = (0, react.useCallback)(() => {
|
|
428
|
+
var _navigator$clipboard;
|
|
429
|
+
(_navigator$clipboard = navigator.clipboard) === null || _navigator$clipboard === void 0 || _navigator$clipboard.writeText(value).then(() => {
|
|
430
|
+
setCopied(true);
|
|
431
|
+
window.setTimeout(() => setCopied(false), 1500);
|
|
432
|
+
});
|
|
433
|
+
}, [value]);
|
|
434
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
435
|
+
type: "button",
|
|
436
|
+
onClick: handleCopy,
|
|
437
|
+
"aria-label": copied ? copiedLabel : label,
|
|
438
|
+
className: require_text_truncate.cn(require_text_truncate.OPT_FOCUS_VISIBLE, require_text_truncate.OPT_TEXT_TERTIARY, "hover:text-text-primary shrink-0 rounded p-0.5 transition-colors"),
|
|
439
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
|
|
440
|
+
className: "size-3.5",
|
|
441
|
+
"aria-hidden": "true"
|
|
442
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, {
|
|
443
|
+
className: "size-3.5",
|
|
444
|
+
"aria-hidden": "true"
|
|
445
|
+
})
|
|
446
|
+
});
|
|
542
447
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
};
|
|
579
|
-
const Switch = (0, react.forwardRef)((_ref, ref) => {
|
|
580
|
-
var _useInputId;
|
|
581
|
-
let { label, required, error, hint, description, checked: controlledChecked, defaultChecked = false, onChange, size = "md", disabled, className, id, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$12);
|
|
582
|
-
const fallbackId = (0, react.useId)();
|
|
583
|
-
const switchId = (_useInputId = require_text_truncate.useInputId(id, label, "switch")) !== null && _useInputId !== void 0 ? _useInputId : `switch-${fallbackId}`;
|
|
584
|
-
const hintText = hint !== null && hint !== void 0 ? hint : description;
|
|
585
|
-
const hasError = Boolean(error);
|
|
586
|
-
const styles = sizeStyles$7[size];
|
|
587
|
-
const labelId = label ? `${switchId}-label` : void 0;
|
|
588
|
-
const switchLabelledBy = ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : ariaLabel ? void 0 : labelId;
|
|
589
|
-
const switchAriaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : switchLabelledBy ? void 0 : "Switch";
|
|
590
|
-
const isControlled = controlledChecked !== void 0;
|
|
591
|
-
const [internalChecked, setInternalChecked] = (0, react.useState)(defaultChecked);
|
|
592
|
-
const checked = isControlled ? controlledChecked : internalChecked;
|
|
593
|
-
const handleClick = (0, react.useCallback)((e) => {
|
|
594
|
-
const next = !checked;
|
|
595
|
-
if (!isControlled) setInternalChecked(next);
|
|
596
|
-
onChange === null || onChange === void 0 || onChange(next);
|
|
597
|
-
onClick === null || onClick === void 0 || onClick(e);
|
|
598
|
-
}, [
|
|
599
|
-
checked,
|
|
600
|
-
isControlled,
|
|
601
|
-
onChange,
|
|
602
|
-
onClick
|
|
603
|
-
]);
|
|
604
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
605
|
-
className: require_text_truncate.cn("flex flex-col gap-1.5", className),
|
|
606
|
-
"data-opt-id": "51Z9R",
|
|
607
|
-
"data-opt-slug": "switch.Switch",
|
|
608
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
609
|
-
className: "flex items-start gap-3",
|
|
610
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({
|
|
611
|
-
ref,
|
|
612
|
-
type: "button",
|
|
613
|
-
role: "switch",
|
|
614
|
-
id: switchId,
|
|
615
|
-
"aria-checked": checked,
|
|
616
|
-
"aria-label": switchAriaLabel,
|
|
617
|
-
"aria-labelledby": switchLabelledBy,
|
|
618
|
-
disabled,
|
|
619
|
-
className: require_text_truncate.cn("group relative inline-flex shrink-0 cursor-pointer rounded-full p-0.5 transition-colors", styles.track, "bg-bg-muted", "aria-[checked=true]:bg-accent", "disabled:cursor-not-allowed disabled:opacity-50", require_text_truncate.OPT_FOCUS_VISIBLE),
|
|
620
|
-
"aria-invalid": hasError,
|
|
621
|
-
"aria-required": required,
|
|
622
|
-
"aria-describedby": require_text_truncate.getDescribedBy(switchId, error, hintText),
|
|
623
|
-
onClick: handleClick
|
|
624
|
-
}, props), {}, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_text_truncate.cn("pointer-events-none inline-block transform rounded-full bg-white shadow-sm ring-0 transition-transform", styles.thumb, "translate-x-0", size === "sm" && "group-aria-[checked=true]:translate-x-4", size === "md" && "group-aria-[checked=true]:translate-x-5", size === "lg" && "group-aria-[checked=true]:translate-x-7") }) })), (label || hintText) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
625
|
-
className: "flex flex-col",
|
|
626
|
-
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
627
|
-
id: labelId,
|
|
628
|
-
className: require_text_truncate.cn("text-text-primary text-sm font-medium", disabled && "opacity-50"),
|
|
629
|
-
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_truncate.RequiredMark, {})]
|
|
630
|
-
}), hintText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
631
|
-
id: `${switchId}-hint`,
|
|
632
|
-
className: require_text_truncate.cn("text-text-tertiary text-sm", disabled && "opacity-50"),
|
|
633
|
-
children: hintText
|
|
634
|
-
})]
|
|
448
|
+
/**
|
|
449
|
+
* DescriptionList — the labelled facts about one thing.
|
|
450
|
+
*
|
|
451
|
+
* Detail views collect a dozen short fields that each mean nothing without
|
|
452
|
+
* their label, and hand-rolling them as a `<div>` grid loses the term/value
|
|
453
|
+
* association that assistive tech needs. This keeps the pairs in a real `<dl>`
|
|
454
|
+
* while still laying them out as boxed cells.
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```tsx
|
|
458
|
+
* <DescriptionList
|
|
459
|
+
* layout="grid"
|
|
460
|
+
* columns={2}
|
|
461
|
+
* items={[
|
|
462
|
+
* { id: "id", term: "Session ID", description: session.id, copyValue: session.id },
|
|
463
|
+
* { id: "entry", term: "Entry path", description: session.entryPath },
|
|
464
|
+
* ]}
|
|
465
|
+
* />
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
468
|
+
function DescriptionList({ items, layout = "grid", columns = 2, compressed = false, labels: customLabels, className }) {
|
|
469
|
+
const labels = require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({}, defaultLabels$3), customLabels);
|
|
470
|
+
if (layout === "inline") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dl", {
|
|
471
|
+
className: require_text_truncate.cn("flex flex-wrap items-baseline gap-x-6 gap-y-2", className),
|
|
472
|
+
"data-opt-id": "1NPD2",
|
|
473
|
+
"data-opt-slug": "description-list.DescriptionList",
|
|
474
|
+
children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
475
|
+
className: "flex items-baseline gap-2",
|
|
476
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
|
|
477
|
+
className: require_text_truncate.cn(require_text_truncate.OPT_TEXT_TERTIARY, "text-xs"),
|
|
478
|
+
title: item.hint,
|
|
479
|
+
children: item.term
|
|
480
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", {
|
|
481
|
+
className: require_text_truncate.cn(require_text_truncate.OPT_TEXT_PRIMARY, "text-sm font-medium"),
|
|
482
|
+
children: item.description || labels.empty
|
|
635
483
|
})]
|
|
636
|
-
}
|
|
637
|
-
id: switchId,
|
|
638
|
-
error
|
|
639
|
-
})]
|
|
484
|
+
}, item.id))
|
|
640
485
|
});
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
width: typeof width === "number" ? `${width}px` : width,
|
|
668
|
-
height: typeof height === "number" ? `${height}px` : height
|
|
669
|
-
}, style);
|
|
670
|
-
if (variant === "text" && lines > 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
671
|
-
className: "gap-element flex flex-col",
|
|
672
|
-
role: "status",
|
|
673
|
-
"aria-label": "Loading",
|
|
674
|
-
"data-opt-id": "EJT87",
|
|
675
|
-
"data-opt-slug": "skeleton.Skeleton",
|
|
676
|
-
children: [Array.from({ length: lines }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_text_truncate._objectSpread2({
|
|
677
|
-
className: require_text_truncate.cn(baseClass, i === lines - 1 && "w-4/5"),
|
|
678
|
-
style: i === lines - 1 ? void 0 : computedStyle
|
|
679
|
-
}, props), i)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
680
|
-
className: "sr-only",
|
|
681
|
-
children: "Loading..."
|
|
682
|
-
})]
|
|
683
|
-
});
|
|
684
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({
|
|
685
|
-
className: baseClass,
|
|
686
|
-
style: computedStyle,
|
|
687
|
-
role: "status",
|
|
688
|
-
"aria-label": "Loading"
|
|
689
|
-
}, props), {}, {
|
|
690
|
-
"data-opt-id": "EJT87",
|
|
691
|
-
"data-opt-slug": "skeleton.Skeleton",
|
|
692
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
693
|
-
className: "sr-only",
|
|
694
|
-
children: "Loading..."
|
|
695
|
-
})
|
|
696
|
-
}));
|
|
697
|
-
}
|
|
698
|
-
/** Renders the skeleton text component. */
|
|
699
|
-
function SkeletonText(_ref2) {
|
|
700
|
-
let { lines = 3, className } = _ref2, props = require_text_truncate._objectWithoutProperties(_ref2, _excluded2$5);
|
|
701
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({
|
|
702
|
-
variant: "text",
|
|
703
|
-
lines,
|
|
704
|
-
className
|
|
705
|
-
}, props), {}, {
|
|
706
|
-
"data-opt-id": "MX3D5",
|
|
707
|
-
"data-opt-slug": "skeleton.SkeletonText"
|
|
708
|
-
}));
|
|
709
|
-
}
|
|
710
|
-
/** Renders the skeleton avatar component. */
|
|
711
|
-
function SkeletonAvatar(_ref3) {
|
|
712
|
-
let { size = 40, className } = _ref3, props = require_text_truncate._objectWithoutProperties(_ref3, _excluded3$2);
|
|
713
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({
|
|
714
|
-
variant: "circular",
|
|
715
|
-
width: size,
|
|
716
|
-
height: size,
|
|
717
|
-
className
|
|
718
|
-
}, props), {}, {
|
|
719
|
-
"data-opt-id": "MP0HZ",
|
|
720
|
-
"data-opt-slug": "skeleton.SkeletonAvatar"
|
|
721
|
-
}));
|
|
722
|
-
}
|
|
723
|
-
/** Renders the skeleton card component. */
|
|
724
|
-
function SkeletonCard(_ref4) {
|
|
725
|
-
let { className } = _ref4, props = require_text_truncate._objectWithoutProperties(_ref4, _excluded4$1);
|
|
726
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn("gap-group flex flex-col", className) }, props), {}, {
|
|
727
|
-
"data-opt-id": "34V5D",
|
|
728
|
-
"data-opt-slug": "skeleton.SkeletonCard",
|
|
729
|
-
children: [
|
|
730
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
|
|
731
|
-
variant: "rectangular",
|
|
732
|
-
height: 120
|
|
733
|
-
}),
|
|
734
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
|
|
735
|
-
variant: "text",
|
|
736
|
-
width: "60%"
|
|
737
|
-
}),
|
|
738
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
|
|
739
|
-
variant: "text",
|
|
740
|
-
lines: 2
|
|
741
|
-
})
|
|
742
|
-
]
|
|
743
|
-
}));
|
|
744
|
-
}
|
|
745
|
-
/** Renders the skeleton table component. */
|
|
746
|
-
function SkeletonTable({ rows = 5, columns = 4, className }) {
|
|
747
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
748
|
-
className: require_text_truncate.cn("gap-element flex flex-col", className),
|
|
749
|
-
role: "status",
|
|
750
|
-
"aria-label": "Loading table",
|
|
751
|
-
"data-opt-id": "3KEDN",
|
|
752
|
-
"data-opt-slug": "skeleton.SkeletonTable",
|
|
753
|
-
children: [
|
|
754
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
755
|
-
className: "border-border-subtle gap-group flex border-b pb-2",
|
|
756
|
-
children: Array.from({ length: columns }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
|
|
757
|
-
variant: "text",
|
|
758
|
-
className: "flex-1",
|
|
759
|
-
height: 16
|
|
760
|
-
}, i))
|
|
761
|
-
}),
|
|
762
|
-
Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
763
|
-
className: "gap-group flex py-2",
|
|
764
|
-
children: Array.from({ length: columns }).map((_, colIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
|
|
765
|
-
variant: "text",
|
|
766
|
-
className: "flex-1",
|
|
767
|
-
height: 14
|
|
768
|
-
}, colIndex))
|
|
769
|
-
}, rowIndex)),
|
|
770
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
771
|
-
className: "sr-only",
|
|
772
|
-
children: "Loading..."
|
|
773
|
-
})
|
|
774
|
-
]
|
|
486
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dl", {
|
|
487
|
+
className: require_text_truncate.cn("grid", compressed ? "gap-element" : "gap-group", columnsClass[columns], className),
|
|
488
|
+
"data-opt-id": "1NPD2",
|
|
489
|
+
"data-opt-slug": "description-list.DescriptionList",
|
|
490
|
+
children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
491
|
+
className: require_text_truncate.cn("flex min-w-0 flex-col gap-1", layout === "grid" && [
|
|
492
|
+
"border border-border",
|
|
493
|
+
"bg-bg-subtle rounded-lg",
|
|
494
|
+
compressed ? "px-2.5 py-1.5" : "px-3 py-2"
|
|
495
|
+
]),
|
|
496
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
|
|
497
|
+
className: require_text_truncate.cn(require_text_truncate.OPT_TEXT_TERTIARY, "text-xs"),
|
|
498
|
+
title: item.hint,
|
|
499
|
+
children: item.term
|
|
500
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
|
|
501
|
+
className: require_text_truncate.cn(require_text_truncate.OPT_TEXT_PRIMARY, "flex min-w-0 items-center gap-1.5 text-sm"),
|
|
502
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
503
|
+
className: require_text_truncate.cn("min-w-0", item.wrap ? "break-all" : "truncate", !item.description && "text-text-secondary"),
|
|
504
|
+
children: item.description || labels.empty
|
|
505
|
+
}), item.copyValue && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyButton, {
|
|
506
|
+
value: item.copyValue,
|
|
507
|
+
label: labels.copy(typeof item.term === "string" ? item.term : item.id),
|
|
508
|
+
copiedLabel: labels.copied
|
|
509
|
+
})]
|
|
510
|
+
})]
|
|
511
|
+
}, item.id))
|
|
775
512
|
});
|
|
776
513
|
}
|
|
777
|
-
|
|
778
|
-
//#region src/core/textarea.tsx
|
|
779
|
-
const _excluded$10 = [
|
|
780
|
-
"label",
|
|
781
|
-
"error",
|
|
782
|
-
"hint",
|
|
783
|
-
"fullWidth",
|
|
784
|
-
"required",
|
|
785
|
-
"resize",
|
|
786
|
-
"size",
|
|
787
|
-
"className",
|
|
788
|
-
"id",
|
|
789
|
-
"rows"
|
|
790
|
-
];
|
|
791
|
-
const textareaSizeStyles = require_text_truncate.OPT_TEXTAREA_SIZE;
|
|
792
|
-
const resizeStyles = {
|
|
793
|
-
none: "resize-none",
|
|
794
|
-
vertical: "resize-y",
|
|
795
|
-
horizontal: "resize-x",
|
|
796
|
-
both: "resize"
|
|
797
|
-
};
|
|
798
|
-
const Textarea = (0, react.forwardRef)((_ref, ref) => {
|
|
799
|
-
var _useInputId;
|
|
800
|
-
let { label, error, hint, fullWidth = false, required, resize = "vertical", size = "md", className, id, rows = 4 } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$10);
|
|
801
|
-
const fallbackId = (0, react.useId)().replace(/:/g, "");
|
|
802
|
-
const textareaId = (_useInputId = require_text_truncate.useInputId(id, label, "textarea")) !== null && _useInputId !== void 0 ? _useInputId : `textarea-${fallbackId}`;
|
|
803
|
-
const hasError = Boolean(error);
|
|
804
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
805
|
-
className: require_text_truncate.cn("flex flex-col gap-1.5", fullWidth && "w-full"),
|
|
806
|
-
"data-opt-id": "6T58H",
|
|
807
|
-
"data-opt-slug": "textarea.Textarea",
|
|
808
|
-
children: [
|
|
809
|
-
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
810
|
-
htmlFor: textareaId,
|
|
811
|
-
className: "text-text-primary text-sm font-medium",
|
|
812
|
-
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_truncate.RequiredMark, {})]
|
|
813
|
-
}),
|
|
814
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", require_text_truncate._objectSpread2({
|
|
815
|
-
ref,
|
|
816
|
-
id: textareaId,
|
|
817
|
-
rows,
|
|
818
|
-
className: require_text_truncate.cn("border-border bg-surface text-text-primary placeholder:text-text-tertiary w-full rounded-lg border px-4 py-3 text-sm outline-transparent", require_text_truncate.OPT_FOCUS_VISIBLE, textareaSizeStyles[size], resizeStyles[resize], hasError && "border-danger focus-visible:outline-danger", !fullWidth && "w-auto", className),
|
|
819
|
-
"aria-invalid": hasError,
|
|
820
|
-
"aria-describedby": require_text_truncate.getDescribedBy(textareaId, error, hint)
|
|
821
|
-
}, props)),
|
|
822
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_truncate.FieldMessages, {
|
|
823
|
-
id: textareaId,
|
|
824
|
-
error,
|
|
825
|
-
hint
|
|
826
|
-
})
|
|
827
|
-
]
|
|
828
|
-
});
|
|
829
|
-
});
|
|
830
|
-
Textarea.displayName = "Textarea";
|
|
514
|
+
DescriptionList.displayName = "DescriptionList";
|
|
831
515
|
//#endregion
|
|
832
516
|
//#region src/core/avatar.tsx
|
|
833
|
-
const _excluded$
|
|
517
|
+
const _excluded$11 = [
|
|
834
518
|
"src",
|
|
835
519
|
"srcSet",
|
|
836
520
|
"sizes",
|
|
@@ -844,7 +528,7 @@ const _excluded$9 = [
|
|
|
844
528
|
"className",
|
|
845
529
|
"onLoadingStatusChange"
|
|
846
530
|
];
|
|
847
|
-
const _excluded2$
|
|
531
|
+
const _excluded2$5 = [
|
|
848
532
|
"max",
|
|
849
533
|
"size",
|
|
850
534
|
"children",
|
|
@@ -932,7 +616,7 @@ function getColorFromName(name) {
|
|
|
932
616
|
/** Renders the avatar component. */
|
|
933
617
|
function Avatar(_ref) {
|
|
934
618
|
var _ref2, _ref3;
|
|
935
|
-
let { src, srcSet, sizes, crossOrigin, referrerPolicy, alt, name, size = "md", fallback, status, className, onLoadingStatusChange } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$
|
|
619
|
+
let { src, srcSet, sizes, crossOrigin, referrerPolicy, alt, name, size = "md", fallback, status, className, onLoadingStatusChange } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$11);
|
|
936
620
|
const loadingStatus = useImageLoadingStatus(src, {
|
|
937
621
|
srcSet,
|
|
938
622
|
sizes,
|
|
@@ -985,7 +669,7 @@ function Avatar(_ref) {
|
|
|
985
669
|
}
|
|
986
670
|
/** Renders the avatar group component. */
|
|
987
671
|
function AvatarGroup(_ref5) {
|
|
988
|
-
let { max = 4, size = "md", children, className } = _ref5, props = require_text_truncate._objectWithoutProperties(_ref5, _excluded2$
|
|
672
|
+
let { max = 4, size = "md", children, className } = _ref5, props = require_text_truncate._objectWithoutProperties(_ref5, _excluded2$5);
|
|
989
673
|
const avatars = Array.isArray(children) ? children : [children];
|
|
990
674
|
const visibleAvatars = avatars.slice(0, max);
|
|
991
675
|
const remainingCount = avatars.length - max;
|
|
@@ -1002,8 +686,361 @@ function AvatarGroup(_ref5) {
|
|
|
1002
686
|
}));
|
|
1003
687
|
}
|
|
1004
688
|
//#endregion
|
|
1005
|
-
//#region src/core/
|
|
689
|
+
//#region src/core/identity.tsx
|
|
690
|
+
const defaultLabels$2 = {
|
|
691
|
+
identified: "Identified",
|
|
692
|
+
anonymous: "Anonymous"
|
|
693
|
+
};
|
|
694
|
+
/** Picks the display name, degrading through the identifiers we do have. */
|
|
695
|
+
function resolveDisplay(name, secondary, id) {
|
|
696
|
+
const trimmedName = name === null || name === void 0 ? void 0 : name.trim();
|
|
697
|
+
const trimmedSecondary = secondary === null || secondary === void 0 ? void 0 : secondary.trim();
|
|
698
|
+
if (trimmedName) return {
|
|
699
|
+
primary: trimmedName,
|
|
700
|
+
sub: trimmedSecondary || null
|
|
701
|
+
};
|
|
702
|
+
if (trimmedSecondary) return {
|
|
703
|
+
primary: trimmedSecondary,
|
|
704
|
+
sub: null
|
|
705
|
+
};
|
|
706
|
+
return {
|
|
707
|
+
primary: id !== null && id !== void 0 ? id : "—",
|
|
708
|
+
sub: null
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Identity — one person (or one anonymous device) as a table cell.
|
|
713
|
+
*
|
|
714
|
+
* Every analytics surface renders the same fallback chain — name, then email,
|
|
715
|
+
* then an opaque id — and every hand-rolled copy of it drifts. Centralising it
|
|
716
|
+
* also centralises the anonymity marker, which is the part readers most often
|
|
717
|
+
* lose track of when a table mixes profiles and devices.
|
|
718
|
+
*/
|
|
719
|
+
function Identity({ name, secondary, id, avatarSrc, state, badge, size = "md", hideAvatar = false, labels: customLabels, className }) {
|
|
720
|
+
const labels = require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({}, defaultLabels$2), customLabels);
|
|
721
|
+
const { primary, sub } = resolveDisplay(name, secondary, id);
|
|
722
|
+
const anonymous = state === "anonymous";
|
|
723
|
+
const badgeContent = badge !== null && badge !== void 0 ? badge : state ? anonymous ? labels.anonymous : labels.identified : null;
|
|
724
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
725
|
+
className: require_text_truncate.cn("flex min-w-0 items-center gap-2", className),
|
|
726
|
+
title: id,
|
|
727
|
+
"data-opt-id": "BRGG2",
|
|
728
|
+
"data-opt-slug": "identity.Identity",
|
|
729
|
+
children: [!hideAvatar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Avatar, {
|
|
730
|
+
src: avatarSrc !== null && avatarSrc !== void 0 ? avatarSrc : void 0,
|
|
731
|
+
name: anonymous ? void 0 : primary,
|
|
732
|
+
size: size === "sm" ? "xs" : "sm",
|
|
733
|
+
alt: "",
|
|
734
|
+
className: "shrink-0"
|
|
735
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
736
|
+
className: "flex min-w-0 flex-col",
|
|
737
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
738
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
739
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
740
|
+
className: require_text_truncate.cn("truncate text-sm font-medium", anonymous && !name ? require_text_truncate.OPT_TEXT_SECONDARY : require_text_truncate.OPT_TEXT_PRIMARY),
|
|
741
|
+
children: primary
|
|
742
|
+
}), badgeContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_truncate.Badge, {
|
|
743
|
+
size: "sm",
|
|
744
|
+
variant: anonymous ? "default" : "info",
|
|
745
|
+
className: "shrink-0",
|
|
746
|
+
children: badgeContent
|
|
747
|
+
})]
|
|
748
|
+
}), sub && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
749
|
+
className: require_text_truncate.cn("text-text-tertiary", "truncate text-xs"),
|
|
750
|
+
children: sub
|
|
751
|
+
})]
|
|
752
|
+
})]
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
Identity.displayName = "Identity";
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region src/core/card.tsx
|
|
758
|
+
const _excluded$10 = [
|
|
759
|
+
"variant",
|
|
760
|
+
"padding",
|
|
761
|
+
"shadow",
|
|
762
|
+
"selectable",
|
|
763
|
+
"selected",
|
|
764
|
+
"onSelectedChange",
|
|
765
|
+
"className",
|
|
766
|
+
"children",
|
|
767
|
+
"onClick",
|
|
768
|
+
"onKeyDown",
|
|
769
|
+
"role",
|
|
770
|
+
"tabIndex"
|
|
771
|
+
];
|
|
772
|
+
const _excluded2$4 = [
|
|
773
|
+
"gap",
|
|
774
|
+
"className",
|
|
775
|
+
"children"
|
|
776
|
+
];
|
|
777
|
+
const _excluded3$2 = [
|
|
778
|
+
"as",
|
|
779
|
+
"className",
|
|
780
|
+
"children"
|
|
781
|
+
];
|
|
782
|
+
const _excluded4$1 = ["className", "children"];
|
|
783
|
+
const _excluded5 = [
|
|
784
|
+
"spacing",
|
|
785
|
+
"className",
|
|
786
|
+
"children"
|
|
787
|
+
];
|
|
788
|
+
const _excluded6 = [
|
|
789
|
+
"divider",
|
|
790
|
+
"className",
|
|
791
|
+
"children"
|
|
792
|
+
];
|
|
793
|
+
/** Renders the card component. */
|
|
794
|
+
function Card(_ref) {
|
|
795
|
+
let { variant = "default", padding = "md", shadow = true, selectable = false, selected = false, onSelectedChange, className, children, onClick, onKeyDown, role, tabIndex } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$10);
|
|
796
|
+
const isInteractive = selectable || !!onClick;
|
|
797
|
+
const handleClick = selectable ? (e) => {
|
|
798
|
+
onSelectedChange === null || onSelectedChange === void 0 || onSelectedChange(!selected);
|
|
799
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
800
|
+
} : onClick;
|
|
801
|
+
const handleKeyDown = selectable ? (e) => {
|
|
802
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
803
|
+
e.preventDefault();
|
|
804
|
+
onSelectedChange === null || onSelectedChange === void 0 || onSelectedChange(!selected);
|
|
805
|
+
}
|
|
806
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
|
|
807
|
+
} : isInteractive ? (e) => {
|
|
808
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
809
|
+
e.preventDefault();
|
|
810
|
+
e.currentTarget.click();
|
|
811
|
+
}
|
|
812
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
|
|
813
|
+
} : onKeyDown;
|
|
814
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({}, props), {}, { className: require_text_truncate.cn("rounded-xl", variant === "default" && require_text_truncate.cn(`border border-border bg-surface`, shadow && "shadow-sm"), variant === "outline" && "border-border border-2 bg-transparent", variant === "ghost" && "bg-bg-subtle", padding === "none" && "p-0", padding === "sm" && "p-3", padding === "md" && "p-5", padding === "lg" && "p-8", selectable && "cursor-pointer transition-colors", selectable && selected && "ring-accent border-accent ring-2 ring-offset-1", selectable && !selected && "hover:border-accent/50", className) }, isInteractive ? {
|
|
815
|
+
role: selectable ? "option" : "button",
|
|
816
|
+
tabIndex: 0,
|
|
817
|
+
"aria-selected": selectable ? selected : void 0,
|
|
818
|
+
onClick: handleClick,
|
|
819
|
+
onKeyDown: handleKeyDown
|
|
820
|
+
} : {
|
|
821
|
+
role,
|
|
822
|
+
tabIndex,
|
|
823
|
+
"aria-selected": selectable ? selected : void 0,
|
|
824
|
+
onKeyDown
|
|
825
|
+
}), {}, {
|
|
826
|
+
"data-opt-id": "0A18R",
|
|
827
|
+
"data-opt-slug": "card.Card",
|
|
828
|
+
children
|
|
829
|
+
}));
|
|
830
|
+
}
|
|
831
|
+
const headerGapClasses = {
|
|
832
|
+
sm: "gap-1",
|
|
833
|
+
md: "gap-1.5",
|
|
834
|
+
lg: "gap-2"
|
|
835
|
+
};
|
|
836
|
+
/** Renders the card header component. */
|
|
837
|
+
function CardHeader(_ref2) {
|
|
838
|
+
let { gap = "sm", className, children } = _ref2, props = require_text_truncate._objectWithoutProperties(_ref2, _excluded2$4);
|
|
839
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn("flex flex-col", headerGapClasses[gap], className) }, props), {}, {
|
|
840
|
+
"data-opt-id": "JST3J",
|
|
841
|
+
"data-opt-slug": "card.CardHeader",
|
|
842
|
+
children
|
|
843
|
+
}));
|
|
844
|
+
}
|
|
845
|
+
/** Renders the card title component. */
|
|
846
|
+
function CardTitle(_ref3) {
|
|
847
|
+
let { as: Tag = "h3", className, children } = _ref3, props = require_text_truncate._objectWithoutProperties(_ref3, _excluded3$2);
|
|
848
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(`text-lg font-semibold ${require_text_truncate.OPT_TEXT_PRIMARY}`, className) }, props), {}, {
|
|
849
|
+
"data-opt-id": "V15TX",
|
|
850
|
+
"data-opt-slug": "card.CardTitle",
|
|
851
|
+
children
|
|
852
|
+
}));
|
|
853
|
+
}
|
|
854
|
+
/** Renders the card description component. */
|
|
855
|
+
function CardDescription(_ref4) {
|
|
856
|
+
let { className, children } = _ref4, props = require_text_truncate._objectWithoutProperties(_ref4, _excluded4$1);
|
|
857
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(`text-sm ${require_text_truncate.OPT_TEXT_SECONDARY}`, className) }, props), {}, {
|
|
858
|
+
"data-opt-id": "YB1RN",
|
|
859
|
+
"data-opt-slug": "card.CardDescription",
|
|
860
|
+
children
|
|
861
|
+
}));
|
|
862
|
+
}
|
|
863
|
+
const contentSpacingClasses = {
|
|
864
|
+
none: "",
|
|
865
|
+
sm: "mt-2",
|
|
866
|
+
md: "mt-4",
|
|
867
|
+
lg: "mt-6"
|
|
868
|
+
};
|
|
869
|
+
/** Renders the card content component. */
|
|
870
|
+
function CardContent(_ref5) {
|
|
871
|
+
let { spacing = "md", className, children } = _ref5, props = require_text_truncate._objectWithoutProperties(_ref5, _excluded5);
|
|
872
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(contentSpacingClasses[spacing], className) }, props), {}, {
|
|
873
|
+
"data-opt-id": "9Y68R",
|
|
874
|
+
"data-opt-slug": "card.CardContent",
|
|
875
|
+
children
|
|
876
|
+
}));
|
|
877
|
+
}
|
|
878
|
+
/** Renders the card footer component. */
|
|
879
|
+
function CardFooter(_ref6) {
|
|
880
|
+
let { divider = true, className, children } = _ref6, props = require_text_truncate._objectWithoutProperties(_ref6, _excluded6);
|
|
881
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn("mt-4 flex items-center justify-end gap-2 pt-4", divider && `border-t border border-border`, className) }, props), {}, {
|
|
882
|
+
"data-opt-id": "GRNTR",
|
|
883
|
+
"data-opt-slug": "card.CardFooter",
|
|
884
|
+
children
|
|
885
|
+
}));
|
|
886
|
+
}
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region src/core/switch.tsx
|
|
889
|
+
const _excluded$9 = [
|
|
890
|
+
"label",
|
|
891
|
+
"required",
|
|
892
|
+
"error",
|
|
893
|
+
"hint",
|
|
894
|
+
"description",
|
|
895
|
+
"checked",
|
|
896
|
+
"defaultChecked",
|
|
897
|
+
"onChange",
|
|
898
|
+
"size",
|
|
899
|
+
"disabled",
|
|
900
|
+
"className",
|
|
901
|
+
"id",
|
|
902
|
+
"onClick",
|
|
903
|
+
"aria-label",
|
|
904
|
+
"aria-labelledby"
|
|
905
|
+
];
|
|
906
|
+
const sizeStyles$5 = {
|
|
907
|
+
sm: {
|
|
908
|
+
track: "h-5 w-9",
|
|
909
|
+
thumb: "h-4 w-4",
|
|
910
|
+
translate: "translate-x-4"
|
|
911
|
+
},
|
|
912
|
+
md: {
|
|
913
|
+
track: "h-6 w-11",
|
|
914
|
+
thumb: "h-5 w-5",
|
|
915
|
+
translate: "translate-x-5"
|
|
916
|
+
},
|
|
917
|
+
lg: {
|
|
918
|
+
track: "h-7 w-14",
|
|
919
|
+
thumb: "h-6 w-6",
|
|
920
|
+
translate: "translate-x-7"
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
const Switch = (0, react.forwardRef)((_ref, ref) => {
|
|
924
|
+
var _useInputId;
|
|
925
|
+
let { label, required, error, hint, description, checked: controlledChecked, defaultChecked = false, onChange, size = "md", disabled, className, id, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$9);
|
|
926
|
+
const fallbackId = (0, react.useId)();
|
|
927
|
+
const switchId = (_useInputId = require_text_truncate.useInputId(id, label, "switch")) !== null && _useInputId !== void 0 ? _useInputId : `switch-${fallbackId}`;
|
|
928
|
+
const hintText = hint !== null && hint !== void 0 ? hint : description;
|
|
929
|
+
const hasError = Boolean(error);
|
|
930
|
+
const styles = sizeStyles$5[size];
|
|
931
|
+
const labelId = label ? `${switchId}-label` : void 0;
|
|
932
|
+
const switchLabelledBy = ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : ariaLabel ? void 0 : labelId;
|
|
933
|
+
const switchAriaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : switchLabelledBy ? void 0 : "Switch";
|
|
934
|
+
const isControlled = controlledChecked !== void 0;
|
|
935
|
+
const [internalChecked, setInternalChecked] = (0, react.useState)(defaultChecked);
|
|
936
|
+
const checked = isControlled ? controlledChecked : internalChecked;
|
|
937
|
+
const handleClick = (0, react.useCallback)((e) => {
|
|
938
|
+
const next = !checked;
|
|
939
|
+
if (!isControlled) setInternalChecked(next);
|
|
940
|
+
onChange === null || onChange === void 0 || onChange(next);
|
|
941
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
942
|
+
}, [
|
|
943
|
+
checked,
|
|
944
|
+
isControlled,
|
|
945
|
+
onChange,
|
|
946
|
+
onClick
|
|
947
|
+
]);
|
|
948
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
949
|
+
className: require_text_truncate.cn("flex flex-col gap-1.5", className),
|
|
950
|
+
"data-opt-id": "51Z9R",
|
|
951
|
+
"data-opt-slug": "switch.Switch",
|
|
952
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
953
|
+
className: "flex items-start gap-3",
|
|
954
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({
|
|
955
|
+
ref,
|
|
956
|
+
type: "button",
|
|
957
|
+
role: "switch",
|
|
958
|
+
id: switchId,
|
|
959
|
+
"aria-checked": checked,
|
|
960
|
+
"aria-label": switchAriaLabel,
|
|
961
|
+
"aria-labelledby": switchLabelledBy,
|
|
962
|
+
disabled,
|
|
963
|
+
className: require_text_truncate.cn("group relative inline-flex shrink-0 cursor-pointer rounded-full p-0.5 transition-colors", styles.track, "bg-bg-muted", "aria-[checked=true]:bg-accent", "disabled:cursor-not-allowed disabled:opacity-50", require_text_truncate.OPT_FOCUS_VISIBLE),
|
|
964
|
+
"aria-invalid": hasError,
|
|
965
|
+
"aria-required": required,
|
|
966
|
+
"aria-describedby": require_text_truncate.getDescribedBy(switchId, error, hintText),
|
|
967
|
+
onClick: handleClick
|
|
968
|
+
}, props), {}, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_text_truncate.cn("pointer-events-none inline-block transform rounded-full bg-white shadow-sm ring-0 transition-transform", styles.thumb, "translate-x-0", size === "sm" && "group-aria-[checked=true]:translate-x-4", size === "md" && "group-aria-[checked=true]:translate-x-5", size === "lg" && "group-aria-[checked=true]:translate-x-7") }) })), (label || hintText) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
969
|
+
className: "flex flex-col",
|
|
970
|
+
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
971
|
+
id: labelId,
|
|
972
|
+
className: require_text_truncate.cn("text-text-primary text-sm font-medium", disabled && "opacity-50"),
|
|
973
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_truncate.RequiredMark, {})]
|
|
974
|
+
}), hintText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
975
|
+
id: `${switchId}-hint`,
|
|
976
|
+
className: require_text_truncate.cn("text-text-tertiary text-sm", disabled && "opacity-50"),
|
|
977
|
+
children: hintText
|
|
978
|
+
})]
|
|
979
|
+
})]
|
|
980
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_truncate.FieldMessages, {
|
|
981
|
+
id: switchId,
|
|
982
|
+
error
|
|
983
|
+
})]
|
|
984
|
+
});
|
|
985
|
+
});
|
|
986
|
+
Switch.displayName = "Switch";
|
|
987
|
+
//#endregion
|
|
988
|
+
//#region src/core/textarea.tsx
|
|
1006
989
|
const _excluded$8 = [
|
|
990
|
+
"label",
|
|
991
|
+
"error",
|
|
992
|
+
"hint",
|
|
993
|
+
"fullWidth",
|
|
994
|
+
"required",
|
|
995
|
+
"resize",
|
|
996
|
+
"size",
|
|
997
|
+
"className",
|
|
998
|
+
"id",
|
|
999
|
+
"rows"
|
|
1000
|
+
];
|
|
1001
|
+
const textareaSizeStyles = require_text_truncate.OPT_TEXTAREA_SIZE;
|
|
1002
|
+
const resizeStyles = {
|
|
1003
|
+
none: "resize-none",
|
|
1004
|
+
vertical: "resize-y",
|
|
1005
|
+
horizontal: "resize-x",
|
|
1006
|
+
both: "resize"
|
|
1007
|
+
};
|
|
1008
|
+
const Textarea = (0, react.forwardRef)((_ref, ref) => {
|
|
1009
|
+
var _useInputId;
|
|
1010
|
+
let { label, error, hint, fullWidth = false, required, resize = "vertical", size = "md", className, id, rows = 4 } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$8);
|
|
1011
|
+
const fallbackId = (0, react.useId)().replace(/:/g, "");
|
|
1012
|
+
const textareaId = (_useInputId = require_text_truncate.useInputId(id, label, "textarea")) !== null && _useInputId !== void 0 ? _useInputId : `textarea-${fallbackId}`;
|
|
1013
|
+
const hasError = Boolean(error);
|
|
1014
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1015
|
+
className: require_text_truncate.cn("flex flex-col gap-1.5", fullWidth && "w-full"),
|
|
1016
|
+
"data-opt-id": "6T58H",
|
|
1017
|
+
"data-opt-slug": "textarea.Textarea",
|
|
1018
|
+
children: [
|
|
1019
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
1020
|
+
htmlFor: textareaId,
|
|
1021
|
+
className: "text-text-primary text-sm font-medium",
|
|
1022
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_truncate.RequiredMark, {})]
|
|
1023
|
+
}),
|
|
1024
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", require_text_truncate._objectSpread2({
|
|
1025
|
+
ref,
|
|
1026
|
+
id: textareaId,
|
|
1027
|
+
rows,
|
|
1028
|
+
className: require_text_truncate.cn("border-border bg-surface text-text-primary placeholder:text-text-tertiary w-full rounded-lg border px-4 py-3 text-sm outline-transparent", require_text_truncate.OPT_FOCUS_VISIBLE, textareaSizeStyles[size], resizeStyles[resize], hasError && "border-danger focus-visible:outline-danger", !fullWidth && "w-auto", className),
|
|
1029
|
+
"aria-invalid": hasError,
|
|
1030
|
+
"aria-describedby": require_text_truncate.getDescribedBy(textareaId, error, hint)
|
|
1031
|
+
}, props)),
|
|
1032
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_truncate.FieldMessages, {
|
|
1033
|
+
id: textareaId,
|
|
1034
|
+
error,
|
|
1035
|
+
hint
|
|
1036
|
+
})
|
|
1037
|
+
]
|
|
1038
|
+
});
|
|
1039
|
+
});
|
|
1040
|
+
Textarea.displayName = "Textarea";
|
|
1041
|
+
//#endregion
|
|
1042
|
+
//#region src/core/progress.tsx
|
|
1043
|
+
const _excluded$7 = [
|
|
1007
1044
|
"value",
|
|
1008
1045
|
"max",
|
|
1009
1046
|
"size",
|
|
@@ -1025,12 +1062,12 @@ const _excluded2$3 = [
|
|
|
1025
1062
|
"indeterminate",
|
|
1026
1063
|
"className"
|
|
1027
1064
|
];
|
|
1028
|
-
const sizeStyles$
|
|
1065
|
+
const sizeStyles$4 = {
|
|
1029
1066
|
sm: "h-1",
|
|
1030
1067
|
md: "h-2",
|
|
1031
1068
|
lg: "h-3"
|
|
1032
1069
|
};
|
|
1033
|
-
const variantStyles
|
|
1070
|
+
const variantStyles = {
|
|
1034
1071
|
default: "bg-accent",
|
|
1035
1072
|
success: "bg-success",
|
|
1036
1073
|
warning: "bg-warning",
|
|
@@ -1049,7 +1086,7 @@ function getProgressValue(value, max) {
|
|
|
1049
1086
|
}
|
|
1050
1087
|
/** Renders the progress component. */
|
|
1051
1088
|
function Progress(_ref) {
|
|
1052
|
-
let { value, max = 100, size = "md", variant = "default", showLabel = false, label, animated = true, indeterminate = false, className } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$
|
|
1089
|
+
let { value, max = 100, size = "md", variant = "default", showLabel = false, label, animated = true, indeterminate = false, className } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$7);
|
|
1053
1090
|
const progress = indeterminate || value === void 0 ? null : getProgressValue(value, max);
|
|
1054
1091
|
const shouldRenderHeader = Boolean(label) || showLabel && progress;
|
|
1055
1092
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn("w-full", className) }, props), {}, {
|
|
@@ -1065,7 +1102,7 @@ function Progress(_ref) {
|
|
|
1065
1102
|
children: progress.valueText
|
|
1066
1103
|
})]
|
|
1067
1104
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1068
|
-
className: require_text_truncate.cn("bg-bg-subtle w-full overflow-hidden rounded-full", sizeStyles$
|
|
1105
|
+
className: require_text_truncate.cn("bg-bg-subtle w-full overflow-hidden rounded-full", sizeStyles$4[size]),
|
|
1069
1106
|
role: "progressbar",
|
|
1070
1107
|
"aria-valuenow": progress === null || progress === void 0 ? void 0 : progress.clampedValue,
|
|
1071
1108
|
"aria-valuemin": progress ? 0 : void 0,
|
|
@@ -1073,7 +1110,7 @@ function Progress(_ref) {
|
|
|
1073
1110
|
"aria-valuetext": progress === null || progress === void 0 ? void 0 : progress.valueText,
|
|
1074
1111
|
"aria-label": label !== null && label !== void 0 ? label : progress ? `${progress.valueText} complete` : "Loading",
|
|
1075
1112
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1076
|
-
className: require_text_truncate.cn("h-full rounded-full", variantStyles
|
|
1113
|
+
className: require_text_truncate.cn("h-full rounded-full", variantStyles[variant], !progress && "w-1/3 animate-pulse", animated && (progress ? "transition-all duration-300 ease-out" : "transition-opacity duration-700 ease-in-out")),
|
|
1077
1114
|
style: progress ? { width: `${progress.percentage}%` } : void 0
|
|
1078
1115
|
})
|
|
1079
1116
|
})]
|
|
@@ -1146,65 +1183,6 @@ function CircularProgress(_ref2) {
|
|
|
1146
1183
|
});
|
|
1147
1184
|
}
|
|
1148
1185
|
//#endregion
|
|
1149
|
-
//#region src/core/meter.tsx
|
|
1150
|
-
const _excluded$7 = [
|
|
1151
|
-
"value",
|
|
1152
|
-
"min",
|
|
1153
|
-
"max",
|
|
1154
|
-
"size",
|
|
1155
|
-
"variant",
|
|
1156
|
-
"showValue",
|
|
1157
|
-
"label",
|
|
1158
|
-
"getValueLabel",
|
|
1159
|
-
"className"
|
|
1160
|
-
];
|
|
1161
|
-
const sizeStyles$4 = {
|
|
1162
|
-
sm: "h-1",
|
|
1163
|
-
md: "h-2",
|
|
1164
|
-
lg: "h-3"
|
|
1165
|
-
};
|
|
1166
|
-
const variantStyles = {
|
|
1167
|
-
default: "bg-accent",
|
|
1168
|
-
success: "bg-success",
|
|
1169
|
-
warning: "bg-warning",
|
|
1170
|
-
error: "bg-danger"
|
|
1171
|
-
};
|
|
1172
|
-
/**
|
|
1173
|
-
* A scalar measurement within a known range (disk usage, score, capacity) —
|
|
1174
|
-
* `role="meter"`, distinct from Progress (task completion). Built on the
|
|
1175
|
-
* opt-ui-primitives Meter primitive, which owns the role/aria/valuetext.
|
|
1176
|
-
*/
|
|
1177
|
-
function Meter(_ref) {
|
|
1178
|
-
let { value, min = 0, max = 100, size = "md", variant = "default", showValue = false, label, getValueLabel, className } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$7);
|
|
1179
|
-
const clamped = Math.min(Math.max(value, min), max);
|
|
1180
|
-
const percentage = max === min ? 0 : (clamped - min) / (max - min) * 100;
|
|
1181
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn("w-full", className) }, props), {}, {
|
|
1182
|
-
"data-opt-id": "G01TE",
|
|
1183
|
-
"data-opt-slug": "meter.Meter",
|
|
1184
|
-
children: [(showValue || label) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1185
|
-
className: "mb-1.5 flex items-center justify-between text-sm",
|
|
1186
|
-
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1187
|
-
className: "text-text-primary font-medium",
|
|
1188
|
-
children: label
|
|
1189
|
-
}), showValue && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1190
|
-
className: "text-text-tertiary",
|
|
1191
|
-
children: [Math.round(percentage), "%"]
|
|
1192
|
-
})]
|
|
1193
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Meter, {
|
|
1194
|
-
value: clamped,
|
|
1195
|
-
min,
|
|
1196
|
-
max,
|
|
1197
|
-
getValueLabel,
|
|
1198
|
-
"aria-label": label !== null && label !== void 0 ? label : `${Math.round(percentage)}%`,
|
|
1199
|
-
className: require_text_truncate.cn("bg-bg-subtle w-full overflow-hidden rounded-full", sizeStyles$4[size]),
|
|
1200
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1201
|
-
className: require_text_truncate.cn("h-full rounded-full transition-all duration-300 ease-out", variantStyles[variant]),
|
|
1202
|
-
style: { width: `${percentage}%` }
|
|
1203
|
-
})
|
|
1204
|
-
})]
|
|
1205
|
-
}));
|
|
1206
|
-
}
|
|
1207
|
-
//#endregion
|
|
1208
1186
|
//#region src/core/step-builder.tsx
|
|
1209
1187
|
/** Renders the step builder component. */
|
|
1210
1188
|
function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps, className, "aria-label": ariaLabel }) {
|
|
@@ -1363,55 +1341,6 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1363
1341
|
}
|
|
1364
1342
|
StepBuilder.displayName = "StepBuilder";
|
|
1365
1343
|
//#endregion
|
|
1366
|
-
//#region src/lib/formatters.ts
|
|
1367
|
-
const OPT_UI_DEFAULT_LOCALE = "ko-KR";
|
|
1368
|
-
const KST_OFFSET_MS = 324e5;
|
|
1369
|
-
function getKstDateParts(input) {
|
|
1370
|
-
const date = input instanceof Date ? input : new Date(input);
|
|
1371
|
-
if (Number.isNaN(date.getTime())) return null;
|
|
1372
|
-
const kstDate = new Date(date.getTime() + KST_OFFSET_MS);
|
|
1373
|
-
return {
|
|
1374
|
-
year: kstDate.getUTCFullYear(),
|
|
1375
|
-
month: kstDate.getUTCMonth() + 1,
|
|
1376
|
-
day: kstDate.getUTCDate(),
|
|
1377
|
-
hour: kstDate.getUTCHours(),
|
|
1378
|
-
minute: kstDate.getUTCMinutes(),
|
|
1379
|
-
second: kstDate.getUTCSeconds()
|
|
1380
|
-
};
|
|
1381
|
-
}
|
|
1382
|
-
function pad2(value) {
|
|
1383
|
-
return String(value).padStart(2, "0");
|
|
1384
|
-
}
|
|
1385
|
-
function meridiem(hour) {
|
|
1386
|
-
return hour < 12 ? "오전" : "오후";
|
|
1387
|
-
}
|
|
1388
|
-
function hour12(hour) {
|
|
1389
|
-
const normalized = hour % 12;
|
|
1390
|
-
return normalized === 0 ? 12 : normalized;
|
|
1391
|
-
}
|
|
1392
|
-
/** Formats a date as Korean short date text in the opt-ui default timezone. */
|
|
1393
|
-
function formatOptShortDate(input) {
|
|
1394
|
-
const parts = getKstDateParts(input);
|
|
1395
|
-
if (!parts) return "-";
|
|
1396
|
-
return `${parts.month}월 ${parts.day}일`;
|
|
1397
|
-
}
|
|
1398
|
-
/** Formats a date as Korean clock time in the opt-ui default timezone. */
|
|
1399
|
-
function formatOptTime(input) {
|
|
1400
|
-
const parts = getKstDateParts(input);
|
|
1401
|
-
if (!parts) return "-";
|
|
1402
|
-
return `${meridiem(parts.hour)} ${pad2(hour12(parts.hour))}:${pad2(parts.minute)}`;
|
|
1403
|
-
}
|
|
1404
|
-
/** Formats a date as Korean date-time text in the opt-ui default timezone. */
|
|
1405
|
-
function formatOptDateTime(input) {
|
|
1406
|
-
const parts = getKstDateParts(input);
|
|
1407
|
-
if (!parts) return "-";
|
|
1408
|
-
return `${parts.year}. ${parts.month}. ${parts.day}. ${meridiem(parts.hour)} ${hour12(parts.hour)}:${pad2(parts.minute)}:${pad2(parts.second)}`;
|
|
1409
|
-
}
|
|
1410
|
-
/** Formats numbers without depending on the runtime default locale. */
|
|
1411
|
-
function formatOptNumber(value) {
|
|
1412
|
-
return new Intl.NumberFormat(OPT_UI_DEFAULT_LOCALE).format(value);
|
|
1413
|
-
}
|
|
1414
|
-
//#endregion
|
|
1415
1344
|
//#region src/core/condition-builder.tsx
|
|
1416
1345
|
const OPERATOR_LABELS = {
|
|
1417
1346
|
equals: "equals",
|
|
@@ -1734,7 +1663,7 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1734
1663
|
children: ["+ ", addGroupLabel]
|
|
1735
1664
|
}), previewCount != null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1736
1665
|
className: require_text_truncate.cn("text-text-secondary", "text-sm"),
|
|
1737
|
-
children: [formatOptNumber(previewCount), " matches"]
|
|
1666
|
+
children: [require_text_truncate.formatOptNumber(previewCount), " matches"]
|
|
1738
1667
|
})]
|
|
1739
1668
|
})
|
|
1740
1669
|
]
|
|
@@ -4471,6 +4400,12 @@ Object.defineProperty(exports, "Container", {
|
|
|
4471
4400
|
return Container;
|
|
4472
4401
|
}
|
|
4473
4402
|
});
|
|
4403
|
+
Object.defineProperty(exports, "DescriptionList", {
|
|
4404
|
+
enumerable: true,
|
|
4405
|
+
get: function() {
|
|
4406
|
+
return DescriptionList;
|
|
4407
|
+
}
|
|
4408
|
+
});
|
|
4474
4409
|
Object.defineProperty(exports, "DrawerClose", {
|
|
4475
4410
|
enumerable: true,
|
|
4476
4411
|
get: function() {
|
|
@@ -4549,6 +4484,12 @@ Object.defineProperty(exports, "Heading", {
|
|
|
4549
4484
|
return Heading;
|
|
4550
4485
|
}
|
|
4551
4486
|
});
|
|
4487
|
+
Object.defineProperty(exports, "Identity", {
|
|
4488
|
+
enumerable: true,
|
|
4489
|
+
get: function() {
|
|
4490
|
+
return Identity;
|
|
4491
|
+
}
|
|
4492
|
+
});
|
|
4552
4493
|
Object.defineProperty(exports, "InlineEdit", {
|
|
4553
4494
|
enumerable: true,
|
|
4554
4495
|
get: function() {
|
|
@@ -4579,12 +4520,6 @@ Object.defineProperty(exports, "Logo", {
|
|
|
4579
4520
|
return Logo;
|
|
4580
4521
|
}
|
|
4581
4522
|
});
|
|
4582
|
-
Object.defineProperty(exports, "Meter", {
|
|
4583
|
-
enumerable: true,
|
|
4584
|
-
get: function() {
|
|
4585
|
-
return Meter;
|
|
4586
|
-
}
|
|
4587
|
-
});
|
|
4588
4523
|
Object.defineProperty(exports, "OtpField", {
|
|
4589
4524
|
enumerable: true,
|
|
4590
4525
|
get: function() {
|
|
@@ -4687,36 +4622,6 @@ Object.defineProperty(exports, "ShaderSurface", {
|
|
|
4687
4622
|
return ShaderSurface;
|
|
4688
4623
|
}
|
|
4689
4624
|
});
|
|
4690
|
-
Object.defineProperty(exports, "Skeleton", {
|
|
4691
|
-
enumerable: true,
|
|
4692
|
-
get: function() {
|
|
4693
|
-
return Skeleton;
|
|
4694
|
-
}
|
|
4695
|
-
});
|
|
4696
|
-
Object.defineProperty(exports, "SkeletonAvatar", {
|
|
4697
|
-
enumerable: true,
|
|
4698
|
-
get: function() {
|
|
4699
|
-
return SkeletonAvatar;
|
|
4700
|
-
}
|
|
4701
|
-
});
|
|
4702
|
-
Object.defineProperty(exports, "SkeletonCard", {
|
|
4703
|
-
enumerable: true,
|
|
4704
|
-
get: function() {
|
|
4705
|
-
return SkeletonCard;
|
|
4706
|
-
}
|
|
4707
|
-
});
|
|
4708
|
-
Object.defineProperty(exports, "SkeletonTable", {
|
|
4709
|
-
enumerable: true,
|
|
4710
|
-
get: function() {
|
|
4711
|
-
return SkeletonTable;
|
|
4712
|
-
}
|
|
4713
|
-
});
|
|
4714
|
-
Object.defineProperty(exports, "SkeletonText", {
|
|
4715
|
-
enumerable: true,
|
|
4716
|
-
get: function() {
|
|
4717
|
-
return SkeletonText;
|
|
4718
|
-
}
|
|
4719
|
-
});
|
|
4720
4625
|
Object.defineProperty(exports, "StepBuilder", {
|
|
4721
4626
|
enumerable: true,
|
|
4722
4627
|
get: function() {
|
|
@@ -4771,30 +4676,6 @@ Object.defineProperty(exports, "createBlock", {
|
|
|
4771
4676
|
return createBlock;
|
|
4772
4677
|
}
|
|
4773
4678
|
});
|
|
4774
|
-
Object.defineProperty(exports, "formatOptDateTime", {
|
|
4775
|
-
enumerable: true,
|
|
4776
|
-
get: function() {
|
|
4777
|
-
return formatOptDateTime;
|
|
4778
|
-
}
|
|
4779
|
-
});
|
|
4780
|
-
Object.defineProperty(exports, "formatOptNumber", {
|
|
4781
|
-
enumerable: true,
|
|
4782
|
-
get: function() {
|
|
4783
|
-
return formatOptNumber;
|
|
4784
|
-
}
|
|
4785
|
-
});
|
|
4786
|
-
Object.defineProperty(exports, "formatOptShortDate", {
|
|
4787
|
-
enumerable: true,
|
|
4788
|
-
get: function() {
|
|
4789
|
-
return formatOptShortDate;
|
|
4790
|
-
}
|
|
4791
|
-
});
|
|
4792
|
-
Object.defineProperty(exports, "formatOptTime", {
|
|
4793
|
-
enumerable: true,
|
|
4794
|
-
get: function() {
|
|
4795
|
-
return formatOptTime;
|
|
4796
|
-
}
|
|
4797
|
-
});
|
|
4798
4679
|
Object.defineProperty(exports, "getShaderFragment", {
|
|
4799
4680
|
enumerable: true,
|
|
4800
4681
|
get: function() {
|