@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.
Files changed (64) hide show
  1. package/COMPONENT_CATALOG.md +177 -66
  2. package/README.md +21 -5
  3. package/dist/core/index.cjs +10 -8
  4. package/dist/core/index.d.cts +3 -3
  5. package/dist/core/index.d.ts +3 -3
  6. package/dist/core/index.js +3 -3
  7. package/dist/docs/02-components/01-core.md +92 -41
  8. package/dist/docs/02-components/02-visuals.md +1 -1
  9. package/dist/docs/02-components/03-shells.md +96 -26
  10. package/dist/docs/02-components/04-surfaces.md +1 -1
  11. package/dist/docs/02-components/index.md +5 -5
  12. package/dist/{field-sidebar-DWfJAJlx.d.ts → field-sidebar-B5SQC35J.d.cts} +214 -3
  13. package/dist/field-sidebar-B5SQC35J.d.cts.map +1 -0
  14. package/dist/{field-sidebar-BXjvV7Cz.js → field-sidebar-BXl5RJ3q.js} +589 -40
  15. package/dist/field-sidebar-BXl5RJ3q.js.map +1 -0
  16. package/dist/{field-sidebar-nwcE9LC4.d.cts → field-sidebar-CBeWE8xX.d.ts} +214 -3
  17. package/dist/field-sidebar-CBeWE8xX.d.ts.map +1 -0
  18. package/dist/{field-sidebar-B6Ndr8HE.cjs → field-sidebar-DAuN4jPV.cjs} +605 -38
  19. package/dist/id-registry.cjs +46 -6
  20. package/dist/id-registry.d.cts.map +1 -1
  21. package/dist/id-registry.d.ts.map +1 -1
  22. package/dist/id-registry.js +46 -6
  23. package/dist/id-registry.js.map +1 -1
  24. package/dist/id-registry.json +97 -12
  25. package/dist/index.cjs +39 -33
  26. package/dist/index.d.cts +10 -6
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.ts +10 -6
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +20 -19
  31. package/dist/index.js.map +1 -1
  32. package/dist/{key-pad-menu-DfZbeXhG.d.cts → key-pad-menu-BxTy_u0Q.d.cts} +152 -7
  33. package/dist/key-pad-menu-BxTy_u0Q.d.cts.map +1 -0
  34. package/dist/{key-pad-menu-D5mQcS5v.cjs → key-pad-menu-Cg6rZBie.cjs} +490 -609
  35. package/dist/{key-pad-menu-BsgJMjD4.d.ts → key-pad-menu-u5GTJl9B.d.ts} +152 -7
  36. package/dist/key-pad-menu-u5GTJl9B.d.ts.map +1 -0
  37. package/dist/{key-pad-menu-BQunU20e.js → key-pad-menu-wXkWn1I1.js} +387 -458
  38. package/dist/key-pad-menu-wXkWn1I1.js.map +1 -0
  39. package/dist/meta.cjs +486 -9
  40. package/dist/meta.d.cts.map +1 -1
  41. package/dist/meta.d.ts.map +1 -1
  42. package/dist/meta.js +486 -9
  43. package/dist/meta.js.map +1 -1
  44. package/dist/shells/index.cjs +4 -1
  45. package/dist/shells/index.d.cts +2 -2
  46. package/dist/shells/index.d.ts +2 -2
  47. package/dist/shells/index.js +2 -2
  48. package/dist/{text-truncate-CxdzAnhS.cjs → text-truncate-BZdL1k5Z.cjs} +474 -83
  49. package/dist/{text-truncate-j6X3z7Pv.js → text-truncate-C17HHCR-.js} +405 -86
  50. package/dist/text-truncate-C17HHCR-.js.map +1 -0
  51. package/dist/{text-truncate-BGr7bB_8.d.ts → text-truncate-DW78lg4S.d.cts} +18 -3
  52. package/dist/text-truncate-DW78lg4S.d.cts.map +1 -0
  53. package/dist/{text-truncate-BGr7bB_8.d.cts → text-truncate-DW78lg4S.d.ts} +18 -3
  54. package/dist/text-truncate-DW78lg4S.d.ts.map +1 -0
  55. package/package.json +1 -1
  56. package/dist/field-sidebar-BXjvV7Cz.js.map +0 -1
  57. package/dist/field-sidebar-DWfJAJlx.d.ts.map +0 -1
  58. package/dist/field-sidebar-nwcE9LC4.d.cts.map +0 -1
  59. package/dist/key-pad-menu-BQunU20e.js.map +0 -1
  60. package/dist/key-pad-menu-BsgJMjD4.d.ts.map +0 -1
  61. package/dist/key-pad-menu-DfZbeXhG.d.cts.map +0 -1
  62. package/dist/text-truncate-BGr7bB_8.d.cts.map +0 -1
  63. package/dist/text-truncate-BGr7bB_8.d.ts.map +0 -1
  64. package/dist/text-truncate-j6X3z7Pv.js.map +0 -1
@@ -1,15 +1,15 @@
1
1
  "use client";
2
- import { Ft as SelectPopover$1, Gn as _objectSpread2, Hn as OPT_TEXT_SECONDARY, It as SelectRoot$1, Jn as cn, Kn as _objectWithoutProperties, Lt as SelectTrigger$1, Nt as SelectItem$1, On as OPT_FOCUS, Pn as OPT_SURFACE, Qt as useInputId, Un as OPT_TEXT_TERTIARY, Vn as OPT_TEXT_PRIMARY, bn as OPT_BORDER, cn as useControlledState, dn as getDescribedBy, dt as MenuRoot$1, en as Spinner, ft as MenuSeparator$1, in as koBreadcrumbLabels, jn as OPT_INPUT, kn as OPT_FOCUS_VISIBLE, ln as FieldMessages, mn as OPT_ANIMATE_ENTER_EXIT, pn as OPT_ANIMATE_DRAWER, pt as MenuTrigger$1, rn as Button, st as MenuItem$1, un as RequiredMark, ut as MenuPopover$1, zn as OPT_TEXTAREA_SIZE } from "./text-truncate-j6X3z7Pv.js";
2
+ import { $n as OPT_TEXT_PRIMARY, Bn as OPT_FOCUS_VISIBLE, Bt as SelectPopover$1, Gn as OPT_SURFACE, Hn as OPT_INPUT, Ht as SelectTrigger$1, Rt as SelectItem$1, Sn as getDescribedBy, Tn as OPT_ANIMATE_ENTER_EXIT, Vt as SelectRoot$1, Zn as OPT_TEXTAREA_SIZE, _t as MenuSeparator$1, bn as FieldMessages, d as formatOptNumber, er as OPT_TEXT_SECONDARY, ft as MenuItem$1, gt as MenuRoot$1, ht as MenuPopover$1, in as useInputId, ir as _objectWithoutProperties, jn as OPT_BORDER, ln as Button, on as Spinner, or as cn, rr as _objectSpread2, sn as Badge, tr as OPT_TEXT_TERTIARY, un as koBreadcrumbLabels, vt as MenuTrigger$1, wn as OPT_ANIMATE_DRAWER, xn as RequiredMark, yn as useControlledState, zn as OPT_FOCUS } from "./text-truncate-C17HHCR-.js";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  import * as React from "react";
5
5
  import { createContext, createElement, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
6
- import { AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, DialogDismiss, DialogPanel, DialogRoot, Meter, RadioGroupRoot, Separator, Toggle, ToggleGroup, useDialogClose, useRadioGroupContext } from "@reopt-ai/opt-ui-primitives";
7
- import { Check, ChevronDown, GripVertical, Pencil, X } from "lucide-react";
6
+ import { AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, DialogDismiss, DialogPanel, DialogRoot, RadioGroupRoot, Separator, Toggle, ToggleGroup, useDialogClose, useRadioGroupContext } from "@reopt-ai/opt-ui-primitives";
7
+ import { Check, ChevronDown, Copy, GripVertical, Pencil, X } from "lucide-react";
8
8
  import { Group, Panel, Separator as Separator$1 } from "react-resizable-panels";
9
9
  import { Mesh, Program, Renderer, Triangle } from "ogl";
10
10
  import { hexToSrgb } from "@reopt-ai/opt-palette";
11
11
  //#region src/core/text.tsx
12
- const _excluded$17 = [
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 = _objectWithoutProperties(_ref, _excluded$17);
28
+ let { as, variant = "body", tone = "primary", truncate = false, className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$15);
29
29
  const Component = as !== null && as !== void 0 ? as : "span";
30
30
  const elementProps = _objectSpread2(_objectSpread2({}, props), {}, {
31
31
  className: 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$16 = [
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 = _objectWithoutProperties(_ref, _excluded$16);
51
+ let { level = 2, variant = `heading-${level}`, className, children } = _ref, props = _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$15 = [
270
+ const _excluded$13 = [
271
271
  "size",
272
272
  "className",
273
273
  "children"
274
274
  ];
275
- const _excluded2$8 = [
275
+ const _excluded2$7 = [
276
276
  "className",
277
277
  "children",
278
278
  "orientation"
279
279
  ];
280
- const sizeStyles$8 = {
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 = 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", OPT_FOCUS_VISIBLE);
285
285
  /** A two-state (pressed) button. Use standalone or inside `ToggleGroup`. */
286
286
  function Toggle$1(_ref) {
287
- let { size = "md", className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$15);
288
- return /* @__PURE__ */ jsx(Toggle, _objectSpread2(_objectSpread2({ className: cn(toggleBase, sizeStyles$8[size], className) }, props), {}, {
287
+ let { size = "md", className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$13);
288
+ return /* @__PURE__ */ jsx(Toggle, _objectSpread2(_objectSpread2({ className: 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$1(_ref) {
294
294
  Toggle$1.displayName = "Toggle";
295
295
  /** A set of related toggles with shared selection and keyboard navigation. */
296
296
  function ToggleGroup$1(_ref2) {
297
- let { className, children, orientation = "horizontal" } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$8);
297
+ let { className, children, orientation = "horizontal" } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$7);
298
298
  return /* @__PURE__ */ jsx(ToggleGroup, _objectSpread2(_objectSpread2({
299
299
  orientation,
300
300
  "aria-orientation": orientation,
@@ -308,15 +308,15 @@ function ToggleGroup$1(_ref2) {
308
308
  ToggleGroup$1.displayName = "ToggleGroup";
309
309
  //#endregion
310
310
  //#region src/core/accordion.tsx
311
- const _excluded$14 = ["className"];
312
- const _excluded2$7 = ["className"];
313
- const _excluded3$4 = ["className", "children"];
314
- const _excluded4$3 = ["className", "children"];
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 ${OPT_FOCUS} disabled:cursor-not-allowed disabled:opacity-50`;
316
316
  const contentClass = `overflow-hidden text-sm text-text-secondary ${OPT_ANIMATE_ENTER_EXIT}`;
317
317
  /** A vertically stacked set of expandable panels (single or multiple open). */
318
318
  function AccordionRoot$1(_ref) {
319
- let { className } = _ref, props = _objectWithoutProperties(_ref, _excluded$14);
319
+ let { className } = _ref, props = _objectWithoutProperties(_ref, _excluded$12);
320
320
  return /* @__PURE__ */ jsx("div", {
321
321
  className: cn("border-border border-y", className),
322
322
  "data-opt-id": "CSBA9",
@@ -327,7 +327,7 @@ function AccordionRoot$1(_ref) {
327
327
  AccordionRoot$1.displayName = "AccordionRoot";
328
328
  /** A single accordion entry, identified by its `value`. */
329
329
  function AccordionItem$1(_ref2) {
330
- let { className } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$7);
330
+ let { className } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$6);
331
331
  return /* @__PURE__ */ jsx(AccordionItem, _objectSpread2(_objectSpread2({ className: 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$1(_ref2) {
336
336
  AccordionItem$1.displayName = "AccordionItem";
337
337
  /** The clickable header that expands/collapses its panel. */
338
338
  function AccordionTrigger$1(_ref3) {
339
- let { className, children } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$4);
339
+ let { className, children } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$3);
340
340
  return /* @__PURE__ */ jsxs(AccordionTrigger, _objectSpread2(_objectSpread2({ className: cn(triggerClass, className) }, props), {}, {
341
341
  "data-opt-id": "CWJZZ",
342
342
  "data-opt-slug": "accordion.AccordionTrigger",
@@ -352,7 +352,7 @@ function AccordionTrigger$1(_ref3) {
352
352
  AccordionTrigger$1.displayName = "AccordionTrigger";
353
353
  /** The collapsible panel body associated with a trigger. */
354
354
  function AccordionContent$1(_ref4) {
355
- let { className, children } = _ref4, props = _objectWithoutProperties(_ref4, _excluded4$3);
355
+ let { className, children } = _ref4, props = _objectWithoutProperties(_ref4, _excluded4$2);
356
356
  return /* @__PURE__ */ jsx(AccordionContent, _objectSpread2(_objectSpread2({ className: cn(contentClass, className) }, props), {}, {
357
357
  "data-opt-id": "J98AG",
358
358
  "data-opt-slug": "accordion.AccordionContent",
@@ -410,8 +410,352 @@ function Breadcrumb({ items, separator = "/", className, onNavigate, "aria-label
410
410
  });
411
411
  }
412
412
  //#endregion
413
+ //#region src/core/description-list.tsx
414
+ const defaultLabels$3 = {
415
+ copy: (term) => `Copy ${term}`,
416
+ copied: "Copied",
417
+ empty: "—"
418
+ };
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"
424
+ };
425
+ function CopyButton({ value, label, copiedLabel }) {
426
+ const [copied, setCopied] = useState(false);
427
+ const handleCopy = 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__ */ jsx("button", {
435
+ type: "button",
436
+ onClick: handleCopy,
437
+ "aria-label": copied ? copiedLabel : label,
438
+ className: cn(OPT_FOCUS_VISIBLE, OPT_TEXT_TERTIARY, "hover:text-text-primary shrink-0 rounded p-0.5 transition-colors"),
439
+ children: copied ? /* @__PURE__ */ jsx(Check, {
440
+ className: "size-3.5",
441
+ "aria-hidden": "true"
442
+ }) : /* @__PURE__ */ jsx(Copy, {
443
+ className: "size-3.5",
444
+ "aria-hidden": "true"
445
+ })
446
+ });
447
+ }
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 = _objectSpread2(_objectSpread2({}, defaultLabels$3), customLabels);
470
+ if (layout === "inline") return /* @__PURE__ */ jsx("dl", {
471
+ className: 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__ */ jsxs("div", {
475
+ className: "flex items-baseline gap-2",
476
+ children: [/* @__PURE__ */ jsx("dt", {
477
+ className: cn(OPT_TEXT_TERTIARY, "text-xs"),
478
+ title: item.hint,
479
+ children: item.term
480
+ }), /* @__PURE__ */ jsx("dd", {
481
+ className: cn(OPT_TEXT_PRIMARY, "text-sm font-medium"),
482
+ children: item.description || labels.empty
483
+ })]
484
+ }, item.id))
485
+ });
486
+ return /* @__PURE__ */ jsx("dl", {
487
+ className: 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__ */ jsxs("div", {
491
+ className: 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__ */ jsx("dt", {
497
+ className: cn(OPT_TEXT_TERTIARY, "text-xs"),
498
+ title: item.hint,
499
+ children: item.term
500
+ }), /* @__PURE__ */ jsxs("dd", {
501
+ className: cn(OPT_TEXT_PRIMARY, "flex min-w-0 items-center gap-1.5 text-sm"),
502
+ children: [/* @__PURE__ */ jsx("span", {
503
+ className: cn("min-w-0", item.wrap ? "break-all" : "truncate", !item.description && "text-text-secondary"),
504
+ children: item.description || labels.empty
505
+ }), item.copyValue && /* @__PURE__ */ 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))
512
+ });
513
+ }
514
+ DescriptionList.displayName = "DescriptionList";
515
+ //#endregion
516
+ //#region src/core/avatar.tsx
517
+ const _excluded$11 = [
518
+ "src",
519
+ "srcSet",
520
+ "sizes",
521
+ "crossOrigin",
522
+ "referrerPolicy",
523
+ "alt",
524
+ "name",
525
+ "size",
526
+ "fallback",
527
+ "status",
528
+ "className",
529
+ "onLoadingStatusChange"
530
+ ];
531
+ const _excluded2$5 = [
532
+ "max",
533
+ "size",
534
+ "children",
535
+ "className"
536
+ ];
537
+ const useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
538
+ /**
539
+ * Tracks an image's loading status by preloading it off-DOM, so the avatar can
540
+ * show its fallback until the image is actually decoded (no broken-image flash)
541
+ * and recover from late `error`/`load` events. Supports responsive `srcSet`/`sizes`.
542
+ */
543
+ function useImageLoadingStatus(src, { srcSet, sizes, crossOrigin, referrerPolicy }) {
544
+ const [status, setStatus] = useState("idle");
545
+ useIsoLayoutEffect(() => {
546
+ if (!src && !srcSet) {
547
+ setStatus("error");
548
+ return;
549
+ }
550
+ let isMounted = true;
551
+ const image = new window.Image();
552
+ const update = (next) => () => {
553
+ if (isMounted) setStatus(next);
554
+ };
555
+ setStatus("loading");
556
+ image.onload = update("loaded");
557
+ image.onerror = update("error");
558
+ if (referrerPolicy) image.referrerPolicy = referrerPolicy;
559
+ image.crossOrigin = crossOrigin !== null && crossOrigin !== void 0 ? crossOrigin : null;
560
+ if (sizes) image.sizes = sizes;
561
+ if (srcSet) image.srcset = srcSet;
562
+ if (src) image.src = src;
563
+ if (image.complete) setStatus(image.naturalWidth > 0 ? "loaded" : "error");
564
+ return () => {
565
+ isMounted = false;
566
+ };
567
+ }, [
568
+ src,
569
+ srcSet,
570
+ sizes,
571
+ crossOrigin,
572
+ referrerPolicy
573
+ ]);
574
+ return status;
575
+ }
576
+ const sizeStyles$6 = {
577
+ xs: "h-6 w-6 text-[10px]",
578
+ sm: "h-8 w-8 text-xs",
579
+ md: "h-10 w-10 text-sm",
580
+ lg: "h-12 w-12 text-base",
581
+ xl: "h-16 w-16 text-lg"
582
+ };
583
+ const statusStyles = {
584
+ online: "bg-success",
585
+ offline: "bg-bg-muted",
586
+ busy: "bg-danger",
587
+ away: "bg-warning"
588
+ };
589
+ const statusSizeStyles = {
590
+ xs: "h-1.5 w-1.5 border",
591
+ sm: "h-2 w-2 border",
592
+ md: "h-2.5 w-2.5 border-2",
593
+ lg: "h-3 w-3 border-2",
594
+ xl: "h-4 w-4 border-2"
595
+ };
596
+ function getInitials(name) {
597
+ const parts = name.trim().split(/\s+/);
598
+ if (parts.length === 1) return parts[0].charAt(0).toUpperCase();
599
+ return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
600
+ }
601
+ const bgColors = [
602
+ "bg-blue-500",
603
+ "bg-emerald-500",
604
+ "bg-amber-500",
605
+ "bg-rose-500",
606
+ "bg-purple-500",
607
+ "bg-cyan-500",
608
+ "bg-orange-500",
609
+ "bg-indigo-500"
610
+ ];
611
+ function getColorFromName(name) {
612
+ let hash = 0;
613
+ for (let i = 0; i < name.length; i++) hash = name.charCodeAt(i) + ((hash << 5) - hash);
614
+ return bgColors[Math.abs(hash) % bgColors.length];
615
+ }
616
+ /** Renders the avatar component. */
617
+ function Avatar(_ref) {
618
+ var _ref2, _ref3;
619
+ let { src, srcSet, sizes, crossOrigin, referrerPolicy, alt, name, size = "md", fallback, status, className, onLoadingStatusChange } = _ref, props = _objectWithoutProperties(_ref, _excluded$11);
620
+ const loadingStatus = useImageLoadingStatus(src, {
621
+ srcSet,
622
+ sizes,
623
+ crossOrigin,
624
+ referrerPolicy
625
+ });
626
+ useEffect(() => {
627
+ onLoadingStatusChange === null || onLoadingStatusChange === void 0 || onLoadingStatusChange(loadingStatus);
628
+ }, [loadingStatus, onLoadingStatusChange]);
629
+ const showImage = (Boolean(src) || Boolean(srcSet)) && loadingStatus === "loaded";
630
+ const initials = name ? getInitials(name) : null;
631
+ const bgColor = name ? getColorFromName(name) : "bg-bg-subtle";
632
+ const avatarLabel = status ? `${(_ref2 = name !== null && name !== void 0 ? name : alt) !== null && _ref2 !== void 0 ? _ref2 : "Avatar"} (${status})` : (_ref3 = name !== null && name !== void 0 ? name : alt) !== null && _ref3 !== void 0 ? _ref3 : "Avatar";
633
+ let avatarContent;
634
+ if (showImage) {
635
+ var _ref4;
636
+ avatarContent = /* @__PURE__ */ jsx("img", {
637
+ src,
638
+ srcSet,
639
+ sizes,
640
+ crossOrigin,
641
+ referrerPolicy,
642
+ alt: (_ref4 = alt !== null && alt !== void 0 ? alt : name) !== null && _ref4 !== void 0 ? _ref4 : "Avatar",
643
+ className: "h-full w-full object-cover"
644
+ });
645
+ } else if (fallback) avatarContent = fallback;
646
+ else if (initials) avatarContent = /* @__PURE__ */ jsx("span", {
647
+ className: "font-medium text-white",
648
+ children: initials
649
+ });
650
+ else avatarContent = /* @__PURE__ */ jsx("svg", {
651
+ className: "text-text-tertiary h-3/5 w-3/5",
652
+ fill: "currentColor",
653
+ viewBox: "0 0 24 24",
654
+ "aria-hidden": "true",
655
+ children: /* @__PURE__ */ jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" })
656
+ });
657
+ return /* @__PURE__ */ jsxs("span", _objectSpread2(_objectSpread2({
658
+ role: "img",
659
+ "aria-label": avatarLabel,
660
+ className: cn("relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full", sizeStyles$6[size], !showImage && bgColor, className)
661
+ }, props), {}, {
662
+ "data-opt-id": "SCMM0",
663
+ "data-opt-slug": "avatar.Avatar",
664
+ children: [avatarContent, status && /* @__PURE__ */ jsx("span", {
665
+ className: cn("border-surface absolute right-0 bottom-0 rounded-full", statusStyles[status], statusSizeStyles[size]),
666
+ "aria-hidden": "true"
667
+ })]
668
+ }));
669
+ }
670
+ /** Renders the avatar group component. */
671
+ function AvatarGroup(_ref5) {
672
+ let { max = 4, size = "md", children, className } = _ref5, props = _objectWithoutProperties(_ref5, _excluded2$5);
673
+ const avatars = Array.isArray(children) ? children : [children];
674
+ const visibleAvatars = avatars.slice(0, max);
675
+ const remainingCount = avatars.length - max;
676
+ return /* @__PURE__ */ jsxs("div", _objectSpread2(_objectSpread2({ className: cn("flex", className) }, props), {}, {
677
+ "data-opt-id": "MVB53",
678
+ "data-opt-slug": "avatar.AvatarGroup",
679
+ children: [visibleAvatars.map((child, index) => /* @__PURE__ */ jsx("span", {
680
+ className: "ring-surface relative -ml-2 inline-block rounded-full ring-2 first:ml-0",
681
+ children: child
682
+ }, index)), remainingCount > 0 && /* @__PURE__ */ jsxs("span", {
683
+ className: cn("bg-bg-subtle text-text-secondary ring-surface relative inline-flex items-center justify-center rounded-full font-medium ring-2", sizeStyles$6[size]),
684
+ children: ["+", remainingCount]
685
+ })]
686
+ }));
687
+ }
688
+ //#endregion
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 = _objectSpread2(_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__ */ jsxs("span", {
725
+ className: 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__ */ 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__ */ jsxs("span", {
736
+ className: "flex min-w-0 flex-col",
737
+ children: [/* @__PURE__ */ jsxs("span", {
738
+ className: "flex min-w-0 items-center gap-1.5",
739
+ children: [/* @__PURE__ */ jsx("span", {
740
+ className: cn("truncate text-sm font-medium", anonymous && !name ? OPT_TEXT_SECONDARY : OPT_TEXT_PRIMARY),
741
+ children: primary
742
+ }), badgeContent && /* @__PURE__ */ jsx(Badge, {
743
+ size: "sm",
744
+ variant: anonymous ? "default" : "info",
745
+ className: "shrink-0",
746
+ children: badgeContent
747
+ })]
748
+ }), sub && /* @__PURE__ */ jsx("span", {
749
+ className: cn("text-text-tertiary", "truncate text-xs"),
750
+ children: sub
751
+ })]
752
+ })]
753
+ });
754
+ }
755
+ Identity.displayName = "Identity";
756
+ //#endregion
413
757
  //#region src/core/card.tsx
414
- const _excluded$13 = [
758
+ const _excluded$10 = [
415
759
  "variant",
416
760
  "padding",
417
761
  "shadow",
@@ -425,17 +769,17 @@ const _excluded$13 = [
425
769
  "role",
426
770
  "tabIndex"
427
771
  ];
428
- const _excluded2$6 = [
772
+ const _excluded2$4 = [
429
773
  "gap",
430
774
  "className",
431
775
  "children"
432
776
  ];
433
- const _excluded3$3 = [
777
+ const _excluded3$2 = [
434
778
  "as",
435
779
  "className",
436
780
  "children"
437
781
  ];
438
- const _excluded4$2 = ["className", "children"];
782
+ const _excluded4$1 = ["className", "children"];
439
783
  const _excluded5 = [
440
784
  "spacing",
441
785
  "className",
@@ -448,7 +792,7 @@ const _excluded6 = [
448
792
  ];
449
793
  /** Renders the card component. */
450
794
  function Card(_ref) {
451
- let { variant = "default", padding = "md", shadow = true, selectable = false, selected = false, onSelectedChange, className, children, onClick, onKeyDown, role, tabIndex } = _ref, props = _objectWithoutProperties(_ref, _excluded$13);
795
+ let { variant = "default", padding = "md", shadow = true, selectable = false, selected = false, onSelectedChange, className, children, onClick, onKeyDown, role, tabIndex } = _ref, props = _objectWithoutProperties(_ref, _excluded$10);
452
796
  const isInteractive = selectable || !!onClick;
453
797
  const handleClick = selectable ? (e) => {
454
798
  onSelectedChange === null || onSelectedChange === void 0 || onSelectedChange(!selected);
@@ -491,7 +835,7 @@ const headerGapClasses = {
491
835
  };
492
836
  /** Renders the card header component. */
493
837
  function CardHeader(_ref2) {
494
- let { gap = "sm", className, children } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$6);
838
+ let { gap = "sm", className, children } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$4);
495
839
  return /* @__PURE__ */ jsx("div", _objectSpread2(_objectSpread2({ className: cn("flex flex-col", headerGapClasses[gap], className) }, props), {}, {
496
840
  "data-opt-id": "JST3J",
497
841
  "data-opt-slug": "card.CardHeader",
@@ -500,7 +844,7 @@ function CardHeader(_ref2) {
500
844
  }
501
845
  /** Renders the card title component. */
502
846
  function CardTitle(_ref3) {
503
- let { as: Tag = "h3", className, children } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$3);
847
+ let { as: Tag = "h3", className, children } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$2);
504
848
  return /* @__PURE__ */ jsx(Tag, _objectSpread2(_objectSpread2({ className: cn(`text-lg font-semibold ${OPT_TEXT_PRIMARY}`, className) }, props), {}, {
505
849
  "data-opt-id": "V15TX",
506
850
  "data-opt-slug": "card.CardTitle",
@@ -509,7 +853,7 @@ function CardTitle(_ref3) {
509
853
  }
510
854
  /** Renders the card description component. */
511
855
  function CardDescription(_ref4) {
512
- let { className, children } = _ref4, props = _objectWithoutProperties(_ref4, _excluded4$2);
856
+ let { className, children } = _ref4, props = _objectWithoutProperties(_ref4, _excluded4$1);
513
857
  return /* @__PURE__ */ jsx("p", _objectSpread2(_objectSpread2({ className: cn(`text-sm ${OPT_TEXT_SECONDARY}`, className) }, props), {}, {
514
858
  "data-opt-id": "YB1RN",
515
859
  "data-opt-slug": "card.CardDescription",
@@ -542,7 +886,7 @@ function CardFooter(_ref6) {
542
886
  }
543
887
  //#endregion
544
888
  //#region src/core/switch.tsx
545
- const _excluded$12 = [
889
+ const _excluded$9 = [
546
890
  "label",
547
891
  "required",
548
892
  "error",
@@ -559,7 +903,7 @@ const _excluded$12 = [
559
903
  "aria-label",
560
904
  "aria-labelledby"
561
905
  ];
562
- const sizeStyles$7 = {
906
+ const sizeStyles$5 = {
563
907
  sm: {
564
908
  track: "h-5 w-9",
565
909
  thumb: "h-4 w-4",
@@ -578,12 +922,12 @@ const sizeStyles$7 = {
578
922
  };
579
923
  const Switch = forwardRef((_ref, ref) => {
580
924
  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 = _objectWithoutProperties(_ref, _excluded$12);
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 = _objectWithoutProperties(_ref, _excluded$9);
582
926
  const fallbackId = useId();
583
927
  const switchId = (_useInputId = useInputId(id, label, "switch")) !== null && _useInputId !== void 0 ? _useInputId : `switch-${fallbackId}`;
584
928
  const hintText = hint !== null && hint !== void 0 ? hint : description;
585
929
  const hasError = Boolean(error);
586
- const styles = sizeStyles$7[size];
930
+ const styles = sizeStyles$5[size];
587
931
  const labelId = label ? `${switchId}-label` : void 0;
588
932
  const switchLabelledBy = ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : ariaLabel ? void 0 : labelId;
589
933
  const switchAriaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : switchLabelledBy ? void 0 : "Switch";
@@ -641,142 +985,8 @@ const Switch = forwardRef((_ref, ref) => {
641
985
  });
642
986
  Switch.displayName = "Switch";
643
987
  //#endregion
644
- //#region src/core/skeleton.tsx
645
- const _excluded$11 = [
646
- "variant",
647
- "width",
648
- "height",
649
- "lines",
650
- "animated",
651
- "className",
652
- "style"
653
- ];
654
- const _excluded2$5 = ["lines", "className"];
655
- const _excluded3$2 = ["size", "className"];
656
- const _excluded4$1 = ["className"];
657
- const variantStyles$2 = {
658
- text: "rounded h-4",
659
- circular: "rounded-full",
660
- rectangular: "rounded-lg"
661
- };
662
- /** Renders the skeleton component. */
663
- function Skeleton(_ref) {
664
- let { variant = "text", width, height, lines = 1, animated = true, className, style } = _ref, props = _objectWithoutProperties(_ref, _excluded$11);
665
- const baseClass = cn("bg-bg-subtle", animated && "animate-pulse", variantStyles$2[variant], className);
666
- const computedStyle = _objectSpread2({
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__ */ 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__ */ jsx("div", _objectSpread2({
677
- className: cn(baseClass, i === lines - 1 && "w-4/5"),
678
- style: i === lines - 1 ? void 0 : computedStyle
679
- }, props), i)), /* @__PURE__ */ jsx("span", {
680
- className: "sr-only",
681
- children: "Loading..."
682
- })]
683
- });
684
- return /* @__PURE__ */ jsx("div", _objectSpread2(_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__ */ 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 = _objectWithoutProperties(_ref2, _excluded2$5);
701
- return /* @__PURE__ */ jsx(Skeleton, _objectSpread2(_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 = _objectWithoutProperties(_ref3, _excluded3$2);
713
- return /* @__PURE__ */ jsx(Skeleton, _objectSpread2(_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 = _objectWithoutProperties(_ref4, _excluded4$1);
726
- return /* @__PURE__ */ jsxs("div", _objectSpread2(_objectSpread2({ className: cn("gap-group flex flex-col", className) }, props), {}, {
727
- "data-opt-id": "34V5D",
728
- "data-opt-slug": "skeleton.SkeletonCard",
729
- children: [
730
- /* @__PURE__ */ jsx(Skeleton, {
731
- variant: "rectangular",
732
- height: 120
733
- }),
734
- /* @__PURE__ */ jsx(Skeleton, {
735
- variant: "text",
736
- width: "60%"
737
- }),
738
- /* @__PURE__ */ 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__ */ jsxs("div", {
748
- className: 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__ */ jsx("div", {
755
- className: "border-border-subtle gap-group flex border-b pb-2",
756
- children: Array.from({ length: columns }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, {
757
- variant: "text",
758
- className: "flex-1",
759
- height: 16
760
- }, i))
761
- }),
762
- Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ jsx("div", {
763
- className: "gap-group flex py-2",
764
- children: Array.from({ length: columns }).map((_, colIndex) => /* @__PURE__ */ jsx(Skeleton, {
765
- variant: "text",
766
- className: "flex-1",
767
- height: 14
768
- }, colIndex))
769
- }, rowIndex)),
770
- /* @__PURE__ */ jsx("span", {
771
- className: "sr-only",
772
- children: "Loading..."
773
- })
774
- ]
775
- });
776
- }
777
- //#endregion
778
988
  //#region src/core/textarea.tsx
779
- const _excluded$10 = [
989
+ const _excluded$8 = [
780
990
  "label",
781
991
  "error",
782
992
  "hint",
@@ -797,7 +1007,7 @@ const resizeStyles = {
797
1007
  };
798
1008
  const Textarea = forwardRef((_ref, ref) => {
799
1009
  var _useInputId;
800
- let { label, error, hint, fullWidth = false, required, resize = "vertical", size = "md", className, id, rows = 4 } = _ref, props = _objectWithoutProperties(_ref, _excluded$10);
1010
+ let { label, error, hint, fullWidth = false, required, resize = "vertical", size = "md", className, id, rows = 4 } = _ref, props = _objectWithoutProperties(_ref, _excluded$8);
801
1011
  const fallbackId = useId().replace(/:/g, "");
802
1012
  const textareaId = (_useInputId = useInputId(id, label, "textarea")) !== null && _useInputId !== void 0 ? _useInputId : `textarea-${fallbackId}`;
803
1013
  const hasError = Boolean(error);
@@ -829,181 +1039,8 @@ const Textarea = forwardRef((_ref, ref) => {
829
1039
  });
830
1040
  Textarea.displayName = "Textarea";
831
1041
  //#endregion
832
- //#region src/core/avatar.tsx
833
- const _excluded$9 = [
834
- "src",
835
- "srcSet",
836
- "sizes",
837
- "crossOrigin",
838
- "referrerPolicy",
839
- "alt",
840
- "name",
841
- "size",
842
- "fallback",
843
- "status",
844
- "className",
845
- "onLoadingStatusChange"
846
- ];
847
- const _excluded2$4 = [
848
- "max",
849
- "size",
850
- "children",
851
- "className"
852
- ];
853
- const useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
854
- /**
855
- * Tracks an image's loading status by preloading it off-DOM, so the avatar can
856
- * show its fallback until the image is actually decoded (no broken-image flash)
857
- * and recover from late `error`/`load` events. Supports responsive `srcSet`/`sizes`.
858
- */
859
- function useImageLoadingStatus(src, { srcSet, sizes, crossOrigin, referrerPolicy }) {
860
- const [status, setStatus] = useState("idle");
861
- useIsoLayoutEffect(() => {
862
- if (!src && !srcSet) {
863
- setStatus("error");
864
- return;
865
- }
866
- let isMounted = true;
867
- const image = new window.Image();
868
- const update = (next) => () => {
869
- if (isMounted) setStatus(next);
870
- };
871
- setStatus("loading");
872
- image.onload = update("loaded");
873
- image.onerror = update("error");
874
- if (referrerPolicy) image.referrerPolicy = referrerPolicy;
875
- image.crossOrigin = crossOrigin !== null && crossOrigin !== void 0 ? crossOrigin : null;
876
- if (sizes) image.sizes = sizes;
877
- if (srcSet) image.srcset = srcSet;
878
- if (src) image.src = src;
879
- if (image.complete) setStatus(image.naturalWidth > 0 ? "loaded" : "error");
880
- return () => {
881
- isMounted = false;
882
- };
883
- }, [
884
- src,
885
- srcSet,
886
- sizes,
887
- crossOrigin,
888
- referrerPolicy
889
- ]);
890
- return status;
891
- }
892
- const sizeStyles$6 = {
893
- xs: "h-6 w-6 text-[10px]",
894
- sm: "h-8 w-8 text-xs",
895
- md: "h-10 w-10 text-sm",
896
- lg: "h-12 w-12 text-base",
897
- xl: "h-16 w-16 text-lg"
898
- };
899
- const statusStyles = {
900
- online: "bg-success",
901
- offline: "bg-bg-muted",
902
- busy: "bg-danger",
903
- away: "bg-warning"
904
- };
905
- const statusSizeStyles = {
906
- xs: "h-1.5 w-1.5 border",
907
- sm: "h-2 w-2 border",
908
- md: "h-2.5 w-2.5 border-2",
909
- lg: "h-3 w-3 border-2",
910
- xl: "h-4 w-4 border-2"
911
- };
912
- function getInitials(name) {
913
- const parts = name.trim().split(/\s+/);
914
- if (parts.length === 1) return parts[0].charAt(0).toUpperCase();
915
- return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
916
- }
917
- const bgColors = [
918
- "bg-blue-500",
919
- "bg-emerald-500",
920
- "bg-amber-500",
921
- "bg-rose-500",
922
- "bg-purple-500",
923
- "bg-cyan-500",
924
- "bg-orange-500",
925
- "bg-indigo-500"
926
- ];
927
- function getColorFromName(name) {
928
- let hash = 0;
929
- for (let i = 0; i < name.length; i++) hash = name.charCodeAt(i) + ((hash << 5) - hash);
930
- return bgColors[Math.abs(hash) % bgColors.length];
931
- }
932
- /** Renders the avatar component. */
933
- function Avatar(_ref) {
934
- var _ref2, _ref3;
935
- let { src, srcSet, sizes, crossOrigin, referrerPolicy, alt, name, size = "md", fallback, status, className, onLoadingStatusChange } = _ref, props = _objectWithoutProperties(_ref, _excluded$9);
936
- const loadingStatus = useImageLoadingStatus(src, {
937
- srcSet,
938
- sizes,
939
- crossOrigin,
940
- referrerPolicy
941
- });
942
- useEffect(() => {
943
- onLoadingStatusChange === null || onLoadingStatusChange === void 0 || onLoadingStatusChange(loadingStatus);
944
- }, [loadingStatus, onLoadingStatusChange]);
945
- const showImage = (Boolean(src) || Boolean(srcSet)) && loadingStatus === "loaded";
946
- const initials = name ? getInitials(name) : null;
947
- const bgColor = name ? getColorFromName(name) : "bg-bg-subtle";
948
- const avatarLabel = status ? `${(_ref2 = name !== null && name !== void 0 ? name : alt) !== null && _ref2 !== void 0 ? _ref2 : "Avatar"} (${status})` : (_ref3 = name !== null && name !== void 0 ? name : alt) !== null && _ref3 !== void 0 ? _ref3 : "Avatar";
949
- let avatarContent;
950
- if (showImage) {
951
- var _ref4;
952
- avatarContent = /* @__PURE__ */ jsx("img", {
953
- src,
954
- srcSet,
955
- sizes,
956
- crossOrigin,
957
- referrerPolicy,
958
- alt: (_ref4 = alt !== null && alt !== void 0 ? alt : name) !== null && _ref4 !== void 0 ? _ref4 : "Avatar",
959
- className: "h-full w-full object-cover"
960
- });
961
- } else if (fallback) avatarContent = fallback;
962
- else if (initials) avatarContent = /* @__PURE__ */ jsx("span", {
963
- className: "font-medium text-white",
964
- children: initials
965
- });
966
- else avatarContent = /* @__PURE__ */ jsx("svg", {
967
- className: "text-text-tertiary h-3/5 w-3/5",
968
- fill: "currentColor",
969
- viewBox: "0 0 24 24",
970
- "aria-hidden": "true",
971
- children: /* @__PURE__ */ jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" })
972
- });
973
- return /* @__PURE__ */ jsxs("span", _objectSpread2(_objectSpread2({
974
- role: "img",
975
- "aria-label": avatarLabel,
976
- className: cn("relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full", sizeStyles$6[size], !showImage && bgColor, className)
977
- }, props), {}, {
978
- "data-opt-id": "SCMM0",
979
- "data-opt-slug": "avatar.Avatar",
980
- children: [avatarContent, status && /* @__PURE__ */ jsx("span", {
981
- className: cn("border-surface absolute right-0 bottom-0 rounded-full", statusStyles[status], statusSizeStyles[size]),
982
- "aria-hidden": "true"
983
- })]
984
- }));
985
- }
986
- /** Renders the avatar group component. */
987
- function AvatarGroup(_ref5) {
988
- let { max = 4, size = "md", children, className } = _ref5, props = _objectWithoutProperties(_ref5, _excluded2$4);
989
- const avatars = Array.isArray(children) ? children : [children];
990
- const visibleAvatars = avatars.slice(0, max);
991
- const remainingCount = avatars.length - max;
992
- return /* @__PURE__ */ jsxs("div", _objectSpread2(_objectSpread2({ className: cn("flex", className) }, props), {}, {
993
- "data-opt-id": "MVB53",
994
- "data-opt-slug": "avatar.AvatarGroup",
995
- children: [visibleAvatars.map((child, index) => /* @__PURE__ */ jsx("span", {
996
- className: "ring-surface relative -ml-2 inline-block rounded-full ring-2 first:ml-0",
997
- children: child
998
- }, index)), remainingCount > 0 && /* @__PURE__ */ jsxs("span", {
999
- className: cn("bg-bg-subtle text-text-secondary ring-surface relative inline-flex items-center justify-center rounded-full font-medium ring-2", sizeStyles$6[size]),
1000
- children: ["+", remainingCount]
1001
- })]
1002
- }));
1003
- }
1004
- //#endregion
1005
1042
  //#region src/core/progress.tsx
1006
- const _excluded$8 = [
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$5 = {
1065
+ const sizeStyles$4 = {
1029
1066
  sm: "h-1",
1030
1067
  md: "h-2",
1031
1068
  lg: "h-3"
1032
1069
  };
1033
- const variantStyles$1 = {
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 = _objectWithoutProperties(_ref, _excluded$8);
1089
+ let { value, max = 100, size = "md", variant = "default", showLabel = false, label, animated = true, indeterminate = false, className } = _ref, props = _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__ */ jsxs("div", _objectSpread2(_objectSpread2({ className: cn("w-full", className) }, props), {}, {
@@ -1065,7 +1102,7 @@ function Progress(_ref) {
1065
1102
  children: progress.valueText
1066
1103
  })]
1067
1104
  }), /* @__PURE__ */ jsx("div", {
1068
- className: cn("bg-bg-subtle w-full overflow-hidden rounded-full", sizeStyles$5[size]),
1105
+ className: 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__ */ jsx("div", {
1076
- className: cn("h-full rounded-full", variantStyles$1[variant], !progress && "w-1/3 animate-pulse", animated && (progress ? "transition-all duration-300 ease-out" : "transition-opacity duration-700 ease-in-out")),
1113
+ className: 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$1(_ref) {
1178
- let { value, min = 0, max = 100, size = "md", variant = "default", showValue = false, label, getValueLabel, className } = _ref, props = _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__ */ jsxs("div", _objectSpread2(_objectSpread2({ className: cn("w-full", className) }, props), {}, {
1182
- "data-opt-id": "G01TE",
1183
- "data-opt-slug": "meter.Meter",
1184
- children: [(showValue || label) && /* @__PURE__ */ jsxs("div", {
1185
- className: "mb-1.5 flex items-center justify-between text-sm",
1186
- children: [label && /* @__PURE__ */ jsx("span", {
1187
- className: "text-text-primary font-medium",
1188
- children: label
1189
- }), showValue && /* @__PURE__ */ jsxs("span", {
1190
- className: "text-text-tertiary",
1191
- children: [Math.round(percentage), "%"]
1192
- })]
1193
- }), /* @__PURE__ */ jsx(Meter, {
1194
- value: clamped,
1195
- min,
1196
- max,
1197
- getValueLabel,
1198
- "aria-label": label !== null && label !== void 0 ? label : `${Math.round(percentage)}%`,
1199
- className: cn("bg-bg-subtle w-full overflow-hidden rounded-full", sizeStyles$4[size]),
1200
- children: /* @__PURE__ */ jsx("div", {
1201
- className: 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",
@@ -4357,6 +4286,6 @@ function KeyPadMenu({ items, label, selection = "single", value, onValueChange,
4357
4286
  });
4358
4287
  }
4359
4288
  //#endregion
4360
- export { Skeleton as $, PageHeader as A, DropdownTrigger as B, Logo as C, Section as D, ResizablePanelGroup as E, RadioGroup as F, formatOptTime as G, formatOptDateTime as H, DropdownContent as I, CircularProgress as J, StepBuilder as K, DropdownItem as L, BlockLayout as M, LoadingOverlay as N, Container as O, Radio as P, Textarea as Q, DropdownMenu as R, DrawerRoot as S, ResizablePanel as T, formatOptNumber as U, ConditionBuilder as V, formatOptShortDate as W, Avatar as X, Progress as Y, AvatarGroup as Z, getShaderFragment as _, ToggleGroup$1 as _t, THEME_PALETTES as a, Card as at, DrawerClose as b, Heading as bt, ExpressionGroup as c, CardFooter as ct, ShaderSurface as d, Breadcrumb as dt, SkeletonAvatar as et, SHADER_OVERLAY_PARAM_KEYS as f, AccordionContent$1 as ft, SHADER_PRESET_IDS as g, Toggle$1 as gt, SHADER_PRESETS as h, AccordionTrigger$1 as ht, ColorPalettePicker as i, Switch as it, createBlock as j, ScrollArea as k, Facet as l, CardHeader as lt, SHADER_PARAM_KEYS as m, AccordionRoot$1 as mt, InlineEdit as n, SkeletonTable as nt, LiveRegion as o, CardContent as ot, SHADER_PARAM_FALLBACK as p, AccordionItem$1 as pt, Meter$1 as q, ColorPaletteDisplay as r, SkeletonText as rt, Expression as s, CardDescription as st, KeyPadMenu as t, SkeletonCard as tt, FacetGroup as u, CardTitle as ut, getShaderPreset as v, OtpField as vt, ResizableHandle as w, DrawerPanel as x, Text as xt, VirtualList as y, Separator$2 as yt, DropdownSeparator as z };
4289
+ export { Identity as $, PageHeader as A, DropdownTrigger as B, Logo as C, Section as D, ResizablePanelGroup as E, RadioGroup as F, Textarea as G, StepBuilder as H, DropdownContent as I, CardContent as J, Switch as K, DropdownItem as L, BlockLayout as M, LoadingOverlay as N, Container as O, Radio as P, CardTitle as Q, DropdownMenu as R, DrawerRoot as S, ResizablePanel as T, CircularProgress as U, ConditionBuilder as V, Progress as W, CardFooter as X, CardDescription as Y, CardHeader as Z, getShaderFragment as _, THEME_PALETTES as a, AccordionItem$1 as at, DrawerClose as b, ExpressionGroup as c, Toggle$1 as ct, ShaderSurface as d, Separator$2 as dt, Avatar as et, SHADER_OVERLAY_PARAM_KEYS as f, Heading as ft, SHADER_PRESET_IDS as g, SHADER_PRESETS as h, ColorPalettePicker as i, AccordionContent$1 as it, createBlock as j, ScrollArea as k, Facet as l, ToggleGroup$1 as lt, SHADER_PARAM_KEYS as m, InlineEdit as n, DescriptionList as nt, LiveRegion as o, AccordionRoot$1 as ot, SHADER_PARAM_FALLBACK as p, Text as pt, Card as q, ColorPaletteDisplay as r, Breadcrumb as rt, Expression as s, AccordionTrigger$1 as st, KeyPadMenu as t, AvatarGroup as tt, FacetGroup as u, OtpField as ut, getShaderPreset as v, ResizableHandle as w, DrawerPanel as x, VirtualList as y, DropdownSeparator as z };
4361
4290
 
4362
- //# sourceMappingURL=key-pad-menu-BQunU20e.js.map
4291
+ //# sourceMappingURL=key-pad-menu-wXkWn1I1.js.map