@epilot/zenith-react 0.1.0-next.1 → 0.1.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 (113) hide show
  1. package/README.md +45 -10
  2. package/dist/components/appearance-boundary/appearance-boundary.js +32 -34
  3. package/dist/components/appearance-boundary/appearance-boundary.js.map +1 -1
  4. package/dist/components/badge/badge.js +1 -1
  5. package/dist/components/badge/badge.js.map +1 -1
  6. package/dist/components/breadcrumb/breadcrumb.js +10 -10
  7. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  8. package/dist/components/button/button.js +28 -28
  9. package/dist/components/button/button.js.map +1 -1
  10. package/dist/components/callout/callout.js +13 -13
  11. package/dist/components/callout/callout.js.map +1 -1
  12. package/dist/components/checkbox/checkbox.js +13 -13
  13. package/dist/components/checkbox/checkbox.js.map +1 -1
  14. package/dist/components/code-block/code-block.js +6 -6
  15. package/dist/components/code-block/code-block.js.map +1 -1
  16. package/dist/components/code-editor/code-editor.js +1 -1
  17. package/dist/components/code-editor/code-editor.js.map +1 -1
  18. package/dist/components/command/command.js +6 -6
  19. package/dist/components/command/command.js.map +1 -1
  20. package/dist/components/data-table/data-table-body.js +120 -66
  21. package/dist/components/data-table/data-table-body.js.map +1 -1
  22. package/dist/components/data-table/data-table-column-header.js +7 -7
  23. package/dist/components/data-table/data-table-column-header.js.map +1 -1
  24. package/dist/components/data-table/data-table-column-order.js +277 -0
  25. package/dist/components/data-table/data-table-column-order.js.map +1 -0
  26. package/dist/components/data-table/data-table-content.js +72 -58
  27. package/dist/components/data-table/data-table-content.js.map +1 -1
  28. package/dist/components/data-table/data-table-context.js +8 -4
  29. package/dist/components/data-table/data-table-context.js.map +1 -1
  30. package/dist/components/data-table/data-table-footer.js +31 -0
  31. package/dist/components/data-table/data-table-footer.js.map +1 -0
  32. package/dist/components/data-table/data-table-header-draggable.js +151 -0
  33. package/dist/components/data-table/data-table-header-draggable.js.map +1 -0
  34. package/dist/components/data-table/data-table-header.js +130 -57
  35. package/dist/components/data-table/data-table-header.js.map +1 -1
  36. package/dist/components/data-table/data-table-resize-handle.js +137 -0
  37. package/dist/components/data-table/data-table-resize-handle.js.map +1 -0
  38. package/dist/components/data-table/data-table.js +184 -156
  39. package/dist/components/data-table/data-table.js.map +1 -1
  40. package/dist/components/data-table/hooks/use-data-table-virtualizer.js +9 -0
  41. package/dist/components/data-table/hooks/use-data-table-virtualizer.js.map +1 -0
  42. package/dist/components/date-range-picker/date-range-picker.js +194 -187
  43. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  44. package/dist/components/date-time-picker/calendar.js +29 -29
  45. package/dist/components/date-time-picker/calendar.js.map +1 -1
  46. package/dist/components/date-time-picker/time-picker.js +55 -55
  47. package/dist/components/date-time-picker/time-picker.js.map +1 -1
  48. package/dist/components/dialog/dialog.js +1 -1
  49. package/dist/components/dialog/dialog.js.map +1 -1
  50. package/dist/components/drawer/drawer.js +5 -5
  51. package/dist/components/drawer/drawer.js.map +1 -1
  52. package/dist/components/dropdown-menu/dropdown-menu.js +36 -36
  53. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
  54. package/dist/components/field/field-combobox.js +4 -4
  55. package/dist/components/field/field-combobox.js.map +1 -1
  56. package/dist/components/field/field.js +40 -40
  57. package/dist/components/field/field.js.map +1 -1
  58. package/dist/components/list/list.js +40 -40
  59. package/dist/components/list/list.js.map +1 -1
  60. package/dist/components/option-card/option-card.js +27 -25
  61. package/dist/components/option-card/option-card.js.map +1 -1
  62. package/dist/components/pill/pill.js +9 -9
  63. package/dist/components/pill/pill.js.map +1 -1
  64. package/dist/components/radio/radio.js +14 -14
  65. package/dist/components/radio/radio.js.map +1 -1
  66. package/dist/components/scroll-area/scroll-area.js +9 -9
  67. package/dist/components/scroll-area/scroll-area.js.map +1 -1
  68. package/dist/components/segmented-control/segmented-control.js +1 -1
  69. package/dist/components/segmented-control/segmented-control.js.map +1 -1
  70. package/dist/components/select/select.js +11 -11
  71. package/dist/components/select/select.js.map +1 -1
  72. package/dist/components/spinner/spinner.js.map +1 -1
  73. package/dist/components/switch/switch.js +11 -11
  74. package/dist/components/switch/switch.js.map +1 -1
  75. package/dist/components/table/table-pagination.js +1 -1
  76. package/dist/components/table/table-pagination.js.map +1 -1
  77. package/dist/components/table/table.js +15 -15
  78. package/dist/components/table/table.js.map +1 -1
  79. package/dist/components/text/text.js +10 -1
  80. package/dist/components/text/text.js.map +1 -1
  81. package/dist/components/toast/toast.js +26 -26
  82. package/dist/components/toast/toast.js.map +1 -1
  83. package/dist/components/toggle/toggle.js +20 -20
  84. package/dist/components/toggle/toggle.js.map +1 -1
  85. package/dist/index.d.ts +1930 -1867
  86. package/dist/index.js +133 -121
  87. package/dist/index.js.map +1 -1
  88. package/dist/packages/tokens/dist/generated/core.generated.js +13 -22
  89. package/dist/packages/tokens/dist/generated/core.generated.js.map +1 -1
  90. package/dist/packages/tokens/dist/generated/palette.generated.js +5 -5
  91. package/dist/packages/tokens/dist/generated/palette.generated.js.map +1 -1
  92. package/dist/packages/tokens/dist/install.js +5 -5
  93. package/dist/packages/tokens/dist/install.js.map +1 -1
  94. package/dist/tokens/core.meta.generated.js +2 -2
  95. package/dist/tokens/core.meta.generated.js.map +1 -1
  96. package/dist/tokens/index.d.ts +1029 -1104
  97. package/dist/tokens/index.js +1031 -1106
  98. package/dist/tokens/index.js.map +1 -1
  99. package/dist/tokens/palette.generated.js +2 -2
  100. package/dist/tokens/palette.generated.js.map +1 -1
  101. package/dist/tokens.json +605 -755
  102. package/dist/vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js +385 -340
  103. package/dist/vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js.map +1 -1
  104. package/dist/vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js +344 -229
  105. package/dist/vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js.map +1 -1
  106. package/dist/vendor/.bun/@dnd-kit_utilities@3.2.2_62547eec5a2188e3/vendor/@dnd-kit/utilities/dist/utilities.esm.js +1 -1
  107. package/dist/vendor/.bun/@tanstack_react-virtual@3.11.2_6f4b9a1cfb20c0ae/vendor/@tanstack/react-virtual/dist/esm/index.js +36 -0
  108. package/dist/vendor/.bun/@tanstack_react-virtual@3.11.2_6f4b9a1cfb20c0ae/vendor/@tanstack/react-virtual/dist/esm/index.js.map +1 -0
  109. package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/index.js +450 -0
  110. package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/index.js.map +1 -0
  111. package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/utils.js +50 -0
  112. package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/utils.js.map +1 -0
  113. package/package.json +5 -3
@@ -1,6 +1,6 @@
1
1
  import { jsx as n, jsxs as k } from "react/jsx-runtime";
2
2
  import * as a from "react";
3
- import { mergeClasses as m, SLOT_ATTR as C, shorthands as I } from "@epilot/zenith-runtime/v1";
3
+ import { mergeClasses as m, SLOT_ATTR as s, shorthands as I } from "@epilot/zenith-runtime/v1";
4
4
  import { makeZenithStyles as V } from "../../styles/make-styles.js";
5
5
  import { spacingGroup2 as w, spacingLayout1 as y, spacingElement2 as v, spacingLayout2 as E, leadingSm as S, textSm as R, fontWeightSemibold as N, leadingBase as $, textBase as j, spacingElement3 as c, spacingElement1 as z } from "../../tokens/index.js";
6
6
  import { ClearButton as G } from "../../lib/clear-button.js";
@@ -63,7 +63,7 @@ const A = a.forwardRef(
63
63
  ), x = a.createContext({
64
64
  variant: "info",
65
65
  hideIcon: !1
66
- }), u = "--zenith-callout-bg", d = "--zenith-callout-fg", l = (i, o) => `var(--zenith-${W}-sem-${i}-${o})`, P = {
66
+ }), u = "--zenith-callout-bg", d = "--zenith-callout-fg", l = (i, o) => `var(--zenith-${W}-${i}-${o})`, P = {
67
67
  info: () => ({
68
68
  [u]: l("accent", "soft"),
69
69
  [d]: l("accent", "default")
@@ -111,13 +111,13 @@ const A = a.forwardRef(
111
111
  // gap-x-3 — no token for 0.75rem.
112
112
  columnGap: c
113
113
  },
114
- [`&:has([${C}="callout-icon"])`]: {
114
+ [`&:has([${s}="callout-icon"])`]: {
115
115
  gridTemplateColumns: "1rem 1fr",
116
116
  columnGap: c
117
117
  }
118
118
  },
119
119
  // v1 `[&>[data-slot=callout-icon]]` — SLOT_ATTR, never data-slot (CONVENTIONS rule 4).
120
- [`& > [${C}="callout-icon"]`]: {
120
+ [`& > [${s}="callout-icon"]`]: {
121
121
  // size-5 — no token for 1.25rem.
122
122
  width: "1.25rem",
123
123
  height: "1.25rem",
@@ -191,7 +191,7 @@ const A = a.forwardRef(
191
191
  hideIcon: e = !1,
192
192
  customIcon: r,
193
193
  dismissible: f = !1,
194
- onDismiss: s,
194
+ onDismiss: C,
195
195
  style: p,
196
196
  children: L,
197
197
  ...T
@@ -200,7 +200,7 @@ const A = a.forwardRef(
200
200
  if (!M)
201
201
  return null;
202
202
  const B = () => {
203
- b(!1), s == null || s();
203
+ b(!1), C == null || C();
204
204
  };
205
205
  return /* @__PURE__ */ n(x.Provider, { value: { variant: t, hideIcon: e }, children: /* @__PURE__ */ k(
206
206
  "div",
@@ -211,7 +211,7 @@ const A = a.forwardRef(
211
211
  "data-hide-icon": e ? "true" : "false",
212
212
  "data-dismissible": f ? "true" : "false",
213
213
  role: "alert",
214
- [C]: "callout",
214
+ [s]: "callout",
215
215
  className: m(
216
216
  g.root,
217
217
  f && g.dismissible,
@@ -243,7 +243,7 @@ const A = a.forwardRef(
243
243
  {
244
244
  ref: e,
245
245
  "data-slot": "callout-title",
246
- [C]: "callout-title",
246
+ [s]: "callout-title",
247
247
  className: m(r.title, o),
248
248
  ...t
249
249
  }
@@ -256,21 +256,21 @@ const A = a.forwardRef(
256
256
  {
257
257
  ref: e,
258
258
  "data-slot": "callout-description",
259
- [C]: "callout-description",
259
+ [s]: "callout-description",
260
260
  className: m(r.description, o),
261
261
  ...t
262
262
  }
263
263
  );
264
264
  }), a1 = a.forwardRef(function({ className: o, align: t = "start", ...e }, r) {
265
- const { hideIcon: f } = a.useContext(x), s = h(), p = t === "end" ? s.actionEnd : f ? s.actionStart : s.actionStartIcon;
265
+ const { hideIcon: f } = a.useContext(x), C = h(), p = t === "end" ? C.actionEnd : f ? C.actionStart : C.actionStartIcon;
266
266
  return /* @__PURE__ */ n(
267
267
  "div",
268
268
  {
269
269
  ref: r,
270
270
  "data-slot": "callout-action",
271
271
  "data-align": t,
272
- [C]: "callout-action",
273
- className: m(s.action, p, o),
272
+ [s]: "callout-action",
273
+ className: m(C.action, p, o),
274
274
  ...e
275
275
  }
276
276
  );
@@ -296,7 +296,7 @@ const A = a.forwardRef(
296
296
  {
297
297
  ref: r,
298
298
  "data-slot": "callout-icon",
299
- [C]: "callout-icon",
299
+ [s]: "callout-icon",
300
300
  customIcon: t,
301
301
  className: o,
302
302
  ...e
@@ -1 +1 @@
1
- {"version":3,"file":"callout.js","sources":["../../../src/components/callout/callout.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { NS } from \"../../tokens\"\nimport * as tokens from \"../../tokens\"\nimport { ClearButton } from \"../../lib/clear-button\"\nimport { CloseIcon } from \"../../lib/icons\"\n\n/**\n * Callout — Badge's colour collapse applied to Card's compound pattern, in one makeZenithStyles\n * call. v1 hardcodes two variants per family as class strings (`bg-accent-soft text-accent-a12`,\n * ...).\n */\n\nconst InfoIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function InfoIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12.0003 16.75C12.2129 16.75 12.391 16.6781 12.5345 16.5343C12.6782 16.3906 12.75 16.2125 12.75 16V11.75C12.75 11.5375 12.6781 11.3593 12.5343 11.2155C12.3904 11.0718 12.2122 11 11.9997 11C11.7871 11 11.609 11.0718 11.4655 11.2155C11.3218 11.3593 11.25 11.5375 11.25 11.75V16C11.25 16.2125 11.3219 16.3906 11.4658 16.5343C11.6096 16.6781 11.7878 16.75 12.0003 16.75ZM12 9.2885C12.2288 9.2885 12.4207 9.21108 12.5755 9.05625C12.7303 8.90142 12.8077 8.70958 12.8077 8.48075C12.8077 8.25192 12.7303 8.06008 12.5755 7.90525C12.4207 7.75058 12.2288 7.67325 12 7.67325C11.7712 7.67325 11.5793 7.75058 11.4245 7.90525C11.2697 8.06008 11.1923 8.25192 11.1923 8.48075C11.1923 8.70958 11.2697 8.90142 11.4245 9.05625C11.5793 9.21108 11.7712 9.2885 12 9.2885ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nconst WarningIcon = React.forwardRef<\n SVGSVGElement,\n React.ComponentProps<\"svg\">\n>(function WarningIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M3.4255 20.5C3.256 20.5 3.10375 20.4586 2.96875 20.3757C2.83375 20.2929 2.72883 20.1837 2.654 20.048C2.576 19.9133 2.53308 19.7675 2.52525 19.6105C2.51742 19.4535 2.55975 19.298 2.65225 19.144L11.213 4.356C11.3057 4.202 11.4215 4.08817 11.5605 4.0145C11.6997 3.94083 11.8462 3.904 12 3.904C12.1538 3.904 12.3003 3.94083 12.4395 4.0145C12.5785 4.08817 12.6943 4.202 12.787 4.356L21.3477 19.144C21.4402 19.298 21.4826 19.4535 21.4747 19.6105C21.4669 19.7675 21.424 19.9133 21.346 20.048C21.2712 20.1837 21.1663 20.2929 21.0313 20.3757C20.8963 20.4586 20.744 20.5 20.5745 20.5H3.4255ZM12 17.8077C12.2288 17.8077 12.4207 17.7303 12.5755 17.5755C12.7303 17.4207 12.8078 17.2288 12.8078 17C12.8078 16.7712 12.7303 16.5793 12.5755 16.4245C12.4207 16.2697 12.2288 16.1923 12 16.1923C11.7712 16.1923 11.5793 16.2697 11.4245 16.4245C11.2697 16.5793 11.1923 16.7712 11.1923 17C11.1923 17.2288 11.2697 17.4207 11.4245 17.5755C11.5793 17.7303 11.7712 17.8077 12 17.8077ZM12.0003 15.1923C12.2129 15.1923 12.391 15.1204 12.5345 14.9768C12.6782 14.8329 12.75 14.6548 12.75 14.4423V10.9423C12.75 10.7298 12.6781 10.5517 12.5342 10.408C12.3904 10.2642 12.2122 10.1923 11.9997 10.1923C11.7871 10.1923 11.609 10.2642 11.4655 10.408C11.3218 10.5517 11.25 10.7298 11.25 10.9423V14.4423C11.25 14.6548 11.3219 14.8329 11.4658 14.9768C11.6096 15.1204 11.7878 15.1923 12.0003 15.1923Z\" />\n </svg>\n )\n})\n\nconst CheckIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M10.5808 14.1463L8.25775 11.823C8.11925 11.6847 7.94517 11.6138 7.7355 11.6105C7.526 11.6073 7.34875 11.6782 7.20375 11.823C7.05892 11.968 6.9865 12.1437 6.9865 12.35C6.9865 12.5563 7.05892 12.732 7.20375 12.877L9.948 15.6212C10.1288 15.8019 10.3398 15.8922 10.5808 15.8922C10.8218 15.8922 11.0327 15.8019 11.2135 15.6212L16.777 10.0577C16.9153 9.91925 16.9862 9.74517 16.9895 9.5355C16.9927 9.326 16.9218 9.14875 16.777 9.00375C16.632 8.85892 16.4563 8.7865 16.25 8.7865C16.0437 8.7865 15.868 8.85892 15.723 9.00375L10.5808 14.1463ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nconst ErrorIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function ErrorIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12 16.7307C12.2288 16.7307 12.4207 16.6533 12.5755 16.4985C12.7303 16.3437 12.8077 16.1518 12.8077 15.923C12.8077 15.6942 12.7303 15.5023 12.5755 15.3475C12.4207 15.1928 12.2288 15.1155 12 15.1155C11.7712 15.1155 11.5793 15.1928 11.4245 15.3475C11.2697 15.5023 11.1923 15.6942 11.1923 15.923C11.1923 16.1518 11.2697 16.3437 11.4245 16.4985C11.5793 16.6533 11.7712 16.7307 12 16.7307ZM12.0003 13.077C12.2129 13.077 12.391 13.0051 12.5345 12.8613C12.6782 12.7176 12.75 12.5395 12.75 12.327V7.827C12.75 7.6145 12.6781 7.43633 12.5343 7.2925C12.3904 7.14883 12.2122 7.077 11.9997 7.077C11.7871 7.077 11.609 7.14883 11.4655 7.2925C11.3218 7.43633 11.25 7.6145 11.25 7.827V12.327C11.25 12.5395 11.3219 12.7176 11.4658 12.8613C11.6096 13.0051 11.7878 13.077 12.0003 13.077ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nexport type CalloutVariant =\n \"info\" | \"gray\" | \"success\" | \"warning\" | \"destructive\"\n\ntype CalloutContextValue = {\n variant: CalloutVariant\n hideIcon: boolean\n}\n\nconst CalloutContext = React.createContext<CalloutContextValue>({\n variant: \"info\",\n hideIcon: false,\n})\n\n/**\n * The two slots a variant paints. Set inline; read by the root's atoms. Every variant is the same\n * style shape (soft background, default-graded text), so the five entries are data about five\n * families, not five class strings.\n */\nconst BG = \"--zenith-callout-bg\"\nconst FG = \"--zenith-callout-fg\"\n\nconst semantic = (family: string, slot: string): string =>\n `var(--zenith-${NS}-sem-${family}-${slot})`\n\nconst VARIANT_SLOTS: Record<CalloutVariant, () => Record<string, string>> = {\n info: () => ({\n [BG]: semantic(\"accent\", \"soft\"),\n [FG]: semantic(\"accent\", \"default\"),\n }),\n gray: () => ({\n [BG]: semantic(\"gray\", \"soft\"),\n [FG]: semantic(\"gray\", \"default\"),\n }),\n success: () => ({\n [BG]: semantic(\"success\", \"soft\"),\n [FG]: semantic(\"success\", \"default\"),\n }),\n warning: () => ({\n [BG]: semantic(\"warning\", \"soft\"),\n [FG]: semantic(\"warning\", \"default\"),\n }),\n destructive: () => ({\n [BG]: semantic(\"error\", \"soft\"),\n [FG]: semantic(\"error\", \"default\"),\n }),\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n position: \"relative\",\n width: \"100%\",\n // p-3 — no token for 0.75rem.\n paddingTop: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n paddingBottom: tokens.spacingElement3,\n paddingLeft: tokens.spacingElement3,\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n backgroundColor: `var(${BG})`,\n color: `var(${FG})`,\n // `items-center`: present in every state, like v1's base string.\n alignItems: \"center\",\n // v1's `data-[hide-icon=false]:` block — the icon grid kicks in only when an icon renders.\n \"&[data-hide-icon='false']\": {\n display: \"grid\",\n gridTemplateColumns: \"0 1fr auto\",\n // gap-y-0.5 — no token for 0.125rem.\n rowGap: \"0.125rem\",\n // `has-[>svg]` and `has-data-[slot=callout-icon]` collapse to the same re-laid-out grid.\n \"&:has(>svg)\": {\n gridTemplateColumns: \"1rem 1fr\",\n // gap-x-3 — no token for 0.75rem.\n columnGap: tokens.spacingElement3,\n },\n [`&:has([${SLOT_ATTR}=\"callout-icon\"])`]: {\n gridTemplateColumns: \"1rem 1fr\",\n columnGap: tokens.spacingElement3,\n },\n },\n // v1 `[&>[data-slot=callout-icon]]` — SLOT_ATTR, never data-slot (CONVENTIONS rule 4).\n [`& > [${SLOT_ATTR}=\"callout-icon\"]`]: {\n // size-5 — no token for 1.25rem.\n width: \"1.25rem\",\n height: \"1.25rem\",\n flexShrink: 0,\n },\n },\n dismissible: {\n // pr-10 — no token for 2.5rem.\n paddingRight: \"2.5rem\",\n },\n title: {\n gridColumnStart: 2,\n ...shorthands.overflow(\"hidden\"),\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 1,\n // min-h-4\n minHeight: tokens.spacingGroup2,\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n fontWeight: tokens.fontWeightSemibold,\n },\n description: {\n gridColumnStart: 2,\n display: \"grid\",\n justifyItems: \"start\",\n ...shorthands.gap(tokens.spacingElement1),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n \"& p\": {\n // leading-relaxed — no token for a 1.625 line-height.\n lineHeight: 1.625,\n },\n },\n action: {\n display: \"flex\",\n width: \"100%\",\n gridColumnEnd: \"span 3\",\n // mt-2\n marginTop: tokens.spacingElement2,\n },\n actionStart: {\n justifyContent: \"flex-start\",\n },\n actionStartIcon: {\n justifyContent: \"flex-start\",\n // ml-8\n marginLeft: tokens.spacingLayout2,\n },\n actionEnd: {\n justifyContent: \"flex-end\",\n },\n dismiss: {\n position: \"absolute\",\n // top-2 right-2\n top: tokens.spacingElement2,\n right: tokens.spacingElement2,\n // size-6 — the ClearButton itself supplies centering, rounding, hover and focus.\n width: tokens.spacingLayout1,\n height: tokens.spacingLayout1,\n },\n dismissIcon: {\n // size-4\n width: tokens.spacingGroup2,\n height: tokens.spacingGroup2,\n },\n})\n\nexport type CalloutProps = React.ComponentProps<\"div\"> & {\n variant?: CalloutVariant\n hideIcon?: boolean\n customIcon?: React.ReactNode\n /** Shows a top-right close button that dismisses the callout. */\n dismissible?: boolean\n /** Called when the close button is clicked, after the callout hides itself. */\n onDismiss?: () => void\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n function Callout(\n {\n className,\n variant = \"info\",\n hideIcon = false,\n customIcon,\n dismissible = false,\n onDismiss,\n style,\n children,\n ...props\n },\n ref\n ) {\n const [open, setOpen] = React.useState(true)\n const styles = useStyles()\n\n if (!open) {\n return null\n }\n\n const handleDismiss = () => {\n setOpen(false)\n onDismiss?.()\n }\n\n return (\n <CalloutContext.Provider value={{ variant, hideIcon }}>\n <div\n ref={ref}\n data-callout-variant={variant}\n data-slot=\"callout\"\n data-hide-icon={hideIcon ? \"true\" : \"false\"}\n data-dismissible={dismissible ? \"true\" : \"false\"}\n role=\"alert\"\n {...{ [SLOT_ATTR]: \"callout\" }}\n className={mergeClasses(\n styles.root,\n dismissible && styles.dismissible,\n className\n )}\n style={\n { ...VARIANT_SLOTS[variant](), ...style } as React.CSSProperties\n }\n {...props}\n >\n {!hideIcon && <CalloutIcon customIcon={customIcon} />}\n {children}\n {dismissible && (\n <ClearButton\n label=\"Dismiss\"\n onClick={handleDismiss}\n className={styles.dismiss}\n >\n <CloseIcon className={styles.dismissIcon} />\n </ClearButton>\n )}\n </div>\n </CalloutContext.Provider>\n )\n }\n)\n\nexport type CalloutTitleProps = React.ComponentProps<\"div\">\n\nexport const CalloutTitle = React.forwardRef<HTMLDivElement, CalloutTitleProps>(\n function CalloutTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-title\"\n {...{ [SLOT_ATTR]: \"callout-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n }\n)\n\nexport type CalloutDescriptionProps = React.ComponentProps<\"div\">\n\nexport const CalloutDescription = React.forwardRef<\n HTMLDivElement,\n CalloutDescriptionProps\n>(function CalloutDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-description\"\n {...{ [SLOT_ATTR]: \"callout-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n})\n\nexport type CalloutActionProps = React.ComponentProps<\"div\"> & {\n align?: \"start\" | \"end\"\n}\n\nexport const CalloutAction = React.forwardRef<\n HTMLDivElement,\n CalloutActionProps\n>(function CalloutAction({ className, align = \"start\", ...props }, ref) {\n const { hideIcon } = React.useContext(CalloutContext)\n const styles = useStyles()\n\n const alignment =\n align === \"end\"\n ? styles.actionEnd\n : hideIcon\n ? styles.actionStart\n : styles.actionStartIcon\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-action\"\n data-align={align}\n {...{ [SLOT_ATTR]: \"callout-action\" }}\n className={mergeClasses(styles.action, alignment, className)}\n {...props}\n />\n )\n})\n\ntype CalloutVariantIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutVariantIcon = React.forwardRef<\n SVGSVGElement,\n CalloutVariantIconProps\n>(function CalloutVariantIcon({ customIcon, ...props }, ref) {\n const { variant } = React.useContext(CalloutContext)\n\n if (customIcon) {\n return customIcon\n }\n\n switch (variant) {\n case \"info\":\n return <InfoIcon ref={ref} {...props} />\n case \"success\":\n return <CheckIcon ref={ref} {...props} />\n case \"warning\":\n return <WarningIcon ref={ref} {...props} />\n case \"destructive\":\n return <ErrorIcon ref={ref} {...props} />\n }\n\n // gray has no default icon; v1 renders nothing for it.\n return null\n})\n\nexport type CalloutIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutIcon = React.forwardRef<SVGSVGElement, CalloutIconProps>(\n function CalloutIcon({ className, customIcon, ...props }, ref) {\n return (\n <CalloutVariantIcon\n ref={ref}\n data-slot=\"callout-icon\"\n {...{ [SLOT_ATTR]: \"callout-icon\" }}\n customIcon={customIcon}\n className={className}\n {...props}\n />\n )\n }\n)\n"],"names":["InfoIcon","React","props","ref","jsx","WarningIcon","CheckIcon","ErrorIcon","CalloutContext","BG","FG","semantic","family","slot","NS","VARIANT_SLOTS","useStyles","makeZenithStyles","tokens.spacingElement3","tokens.textSm","tokens.leadingSm","SLOT_ATTR","shorthands","tokens.spacingGroup2","tokens.textBase","tokens.leadingBase","tokens.fontWeightSemibold","tokens.spacingElement1","tokens.spacingElement2","tokens.spacingLayout2","tokens.spacingLayout1","Callout","className","variant","hideIcon","customIcon","dismissible","onDismiss","style","children","open","setOpen","styles","handleDismiss","jsxs","mergeClasses","CalloutIcon","ClearButton","CloseIcon","CalloutTitle","CalloutDescription","CalloutAction","align","alignment","CalloutVariantIcon"],"mappings":";;;;;;;;AAiBA,MAAMA,IAAWC,EAAM;AAAA,EACrB,SAAkBC,GAAOC,GAAK;AAC5B,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAD;AAAA,QACA,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,MAAK;AAAA,QACJ,GAAGD;AAAA,QAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,m8CAAA,CAAm8C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGj9C;AACF,GAEMC,IAAcJ,EAAM,WAGxB,SAAqBC,GAAOC,GAAK;AACjC,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,OAAM;AAAA,MACN,SAAQ;AAAA,MACR,MAAK;AAAA,MACJ,GAAGD;AAAA,MAEJ,UAAA,gBAA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AACC,GAAA,EAAY,KAAAF,GAAW,GAAGD,EAAA,CAAO;AAAA,IAC3C,KAAK;AACH,aAAO,gBAAAE,EAACG,GAAA,EAAU,KAAAJ,GAAW,GAAGD,EAAA,CAAO;AAAA,EAAA;AAI3C,SAAO;AACT,CAAC,GAMK4C,IAAc7C,EAAM;AAAA,EACxB,SAAqB,EAAE,WAAA+B,GAAW,YAAAG,GAAY,GAAGjC,EAAA,GAASC,GAAK;AAC7D,WACE,gBAAAC;AAAA,MAACkD;AAAA,MAAA;AAAA,QACC,KAAAnD;AAAA,QACA,aAAU;AAAA,QACJ,CAACkB,CAAS,GAAG;AAAA,QACnB,YAAAc;AAAA,QACA,WAAAH;AAAA,QACC,GAAG9B;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
1
+ {"version":3,"file":"callout.js","sources":["../../../src/components/callout/callout.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { NS } from \"../../tokens\"\nimport * as tokens from \"../../tokens\"\nimport { ClearButton } from \"../../lib/clear-button\"\nimport { CloseIcon } from \"../../lib/icons\"\n\n/**\n * Callout — Badge's colour collapse applied to Card's compound pattern, in one makeZenithStyles\n * call. v1 hardcodes two variants per family as class strings (`bg-accent-soft text-accent-a12`,\n * ...).\n */\n\nconst InfoIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function InfoIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12.0003 16.75C12.2129 16.75 12.391 16.6781 12.5345 16.5343C12.6782 16.3906 12.75 16.2125 12.75 16V11.75C12.75 11.5375 12.6781 11.3593 12.5343 11.2155C12.3904 11.0718 12.2122 11 11.9997 11C11.7871 11 11.609 11.0718 11.4655 11.2155C11.3218 11.3593 11.25 11.5375 11.25 11.75V16C11.25 16.2125 11.3219 16.3906 11.4658 16.5343C11.6096 16.6781 11.7878 16.75 12.0003 16.75ZM12 9.2885C12.2288 9.2885 12.4207 9.21108 12.5755 9.05625C12.7303 8.90142 12.8077 8.70958 12.8077 8.48075C12.8077 8.25192 12.7303 8.06008 12.5755 7.90525C12.4207 7.75058 12.2288 7.67325 12 7.67325C11.7712 7.67325 11.5793 7.75058 11.4245 7.90525C11.2697 8.06008 11.1923 8.25192 11.1923 8.48075C11.1923 8.70958 11.2697 8.90142 11.4245 9.05625C11.5793 9.21108 11.7712 9.2885 12 9.2885ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nconst WarningIcon = React.forwardRef<\n SVGSVGElement,\n React.ComponentProps<\"svg\">\n>(function WarningIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M3.4255 20.5C3.256 20.5 3.10375 20.4586 2.96875 20.3757C2.83375 20.2929 2.72883 20.1837 2.654 20.048C2.576 19.9133 2.53308 19.7675 2.52525 19.6105C2.51742 19.4535 2.55975 19.298 2.65225 19.144L11.213 4.356C11.3057 4.202 11.4215 4.08817 11.5605 4.0145C11.6997 3.94083 11.8462 3.904 12 3.904C12.1538 3.904 12.3003 3.94083 12.4395 4.0145C12.5785 4.08817 12.6943 4.202 12.787 4.356L21.3477 19.144C21.4402 19.298 21.4826 19.4535 21.4747 19.6105C21.4669 19.7675 21.424 19.9133 21.346 20.048C21.2712 20.1837 21.1663 20.2929 21.0313 20.3757C20.8963 20.4586 20.744 20.5 20.5745 20.5H3.4255ZM12 17.8077C12.2288 17.8077 12.4207 17.7303 12.5755 17.5755C12.7303 17.4207 12.8078 17.2288 12.8078 17C12.8078 16.7712 12.7303 16.5793 12.5755 16.4245C12.4207 16.2697 12.2288 16.1923 12 16.1923C11.7712 16.1923 11.5793 16.2697 11.4245 16.4245C11.2697 16.5793 11.1923 16.7712 11.1923 17C11.1923 17.2288 11.2697 17.4207 11.4245 17.5755C11.5793 17.7303 11.7712 17.8077 12 17.8077ZM12.0003 15.1923C12.2129 15.1923 12.391 15.1204 12.5345 14.9768C12.6782 14.8329 12.75 14.6548 12.75 14.4423V10.9423C12.75 10.7298 12.6781 10.5517 12.5342 10.408C12.3904 10.2642 12.2122 10.1923 11.9997 10.1923C11.7871 10.1923 11.609 10.2642 11.4655 10.408C11.3218 10.5517 11.25 10.7298 11.25 10.9423V14.4423C11.25 14.6548 11.3219 14.8329 11.4658 14.9768C11.6096 15.1204 11.7878 15.1923 12.0003 15.1923Z\" />\n </svg>\n )\n})\n\nconst CheckIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M10.5808 14.1463L8.25775 11.823C8.11925 11.6847 7.94517 11.6138 7.7355 11.6105C7.526 11.6073 7.34875 11.6782 7.20375 11.823C7.05892 11.968 6.9865 12.1437 6.9865 12.35C6.9865 12.5563 7.05892 12.732 7.20375 12.877L9.948 15.6212C10.1288 15.8019 10.3398 15.8922 10.5808 15.8922C10.8218 15.8922 11.0327 15.8019 11.2135 15.6212L16.777 10.0577C16.9153 9.91925 16.9862 9.74517 16.9895 9.5355C16.9927 9.326 16.9218 9.14875 16.777 9.00375C16.632 8.85892 16.4563 8.7865 16.25 8.7865C16.0437 8.7865 15.868 8.85892 15.723 9.00375L10.5808 14.1463ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nconst ErrorIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function ErrorIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12 16.7307C12.2288 16.7307 12.4207 16.6533 12.5755 16.4985C12.7303 16.3437 12.8077 16.1518 12.8077 15.923C12.8077 15.6942 12.7303 15.5023 12.5755 15.3475C12.4207 15.1928 12.2288 15.1155 12 15.1155C11.7712 15.1155 11.5793 15.1928 11.4245 15.3475C11.2697 15.5023 11.1923 15.6942 11.1923 15.923C11.1923 16.1518 11.2697 16.3437 11.4245 16.4985C11.5793 16.6533 11.7712 16.7307 12 16.7307ZM12.0003 13.077C12.2129 13.077 12.391 13.0051 12.5345 12.8613C12.6782 12.7176 12.75 12.5395 12.75 12.327V7.827C12.75 7.6145 12.6781 7.43633 12.5343 7.2925C12.3904 7.14883 12.2122 7.077 11.9997 7.077C11.7871 7.077 11.609 7.14883 11.4655 7.2925C11.3218 7.43633 11.25 7.6145 11.25 7.827V12.327C11.25 12.5395 11.3219 12.7176 11.4658 12.8613C11.6096 13.0051 11.7878 13.077 12.0003 13.077ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nexport type CalloutVariant =\n \"info\" | \"gray\" | \"success\" | \"warning\" | \"destructive\"\n\ntype CalloutContextValue = {\n variant: CalloutVariant\n hideIcon: boolean\n}\n\nconst CalloutContext = React.createContext<CalloutContextValue>({\n variant: \"info\",\n hideIcon: false,\n})\n\n/**\n * The two slots a variant paints. Set inline; read by the root's atoms. Every variant is the same\n * style shape (soft background, default-graded text), so the five entries are data about five\n * families, not five class strings.\n */\nconst BG = \"--zenith-callout-bg\"\nconst FG = \"--zenith-callout-fg\"\n\nconst semantic = (family: string, slot: string): string =>\n `var(--zenith-${NS}-${family}-${slot})`\n\nconst VARIANT_SLOTS: Record<CalloutVariant, () => Record<string, string>> = {\n info: () => ({\n [BG]: semantic(\"accent\", \"soft\"),\n [FG]: semantic(\"accent\", \"default\"),\n }),\n gray: () => ({\n [BG]: semantic(\"gray\", \"soft\"),\n [FG]: semantic(\"gray\", \"default\"),\n }),\n success: () => ({\n [BG]: semantic(\"success\", \"soft\"),\n [FG]: semantic(\"success\", \"default\"),\n }),\n warning: () => ({\n [BG]: semantic(\"warning\", \"soft\"),\n [FG]: semantic(\"warning\", \"default\"),\n }),\n destructive: () => ({\n [BG]: semantic(\"error\", \"soft\"),\n [FG]: semantic(\"error\", \"default\"),\n }),\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n position: \"relative\",\n width: \"100%\",\n // p-3 — no token for 0.75rem.\n paddingTop: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n paddingBottom: tokens.spacingElement3,\n paddingLeft: tokens.spacingElement3,\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n backgroundColor: `var(${BG})`,\n color: `var(${FG})`,\n // `items-center`: present in every state, like v1's base string.\n alignItems: \"center\",\n // v1's `data-[hide-icon=false]:` block — the icon grid kicks in only when an icon renders.\n \"&[data-hide-icon='false']\": {\n display: \"grid\",\n gridTemplateColumns: \"0 1fr auto\",\n // gap-y-0.5 — no token for 0.125rem.\n rowGap: \"0.125rem\",\n // `has-[>svg]` and `has-data-[slot=callout-icon]` collapse to the same re-laid-out grid.\n \"&:has(>svg)\": {\n gridTemplateColumns: \"1rem 1fr\",\n // gap-x-3 — no token for 0.75rem.\n columnGap: tokens.spacingElement3,\n },\n [`&:has([${SLOT_ATTR}=\"callout-icon\"])`]: {\n gridTemplateColumns: \"1rem 1fr\",\n columnGap: tokens.spacingElement3,\n },\n },\n // v1 `[&>[data-slot=callout-icon]]` — SLOT_ATTR, never data-slot (CONVENTIONS rule 4).\n [`& > [${SLOT_ATTR}=\"callout-icon\"]`]: {\n // size-5 — no token for 1.25rem.\n width: \"1.25rem\",\n height: \"1.25rem\",\n flexShrink: 0,\n },\n },\n dismissible: {\n // pr-10 — no token for 2.5rem.\n paddingRight: \"2.5rem\",\n },\n title: {\n gridColumnStart: 2,\n ...shorthands.overflow(\"hidden\"),\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 1,\n // min-h-4\n minHeight: tokens.spacingGroup2,\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n fontWeight: tokens.fontWeightSemibold,\n },\n description: {\n gridColumnStart: 2,\n display: \"grid\",\n justifyItems: \"start\",\n ...shorthands.gap(tokens.spacingElement1),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n \"& p\": {\n // leading-relaxed — no token for a 1.625 line-height.\n lineHeight: 1.625,\n },\n },\n action: {\n display: \"flex\",\n width: \"100%\",\n gridColumnEnd: \"span 3\",\n // mt-2\n marginTop: tokens.spacingElement2,\n },\n actionStart: {\n justifyContent: \"flex-start\",\n },\n actionStartIcon: {\n justifyContent: \"flex-start\",\n // ml-8\n marginLeft: tokens.spacingLayout2,\n },\n actionEnd: {\n justifyContent: \"flex-end\",\n },\n dismiss: {\n position: \"absolute\",\n // top-2 right-2\n top: tokens.spacingElement2,\n right: tokens.spacingElement2,\n // size-6 — the ClearButton itself supplies centering, rounding, hover and focus.\n width: tokens.spacingLayout1,\n height: tokens.spacingLayout1,\n },\n dismissIcon: {\n // size-4\n width: tokens.spacingGroup2,\n height: tokens.spacingGroup2,\n },\n})\n\nexport type CalloutProps = React.ComponentProps<\"div\"> & {\n variant?: CalloutVariant\n hideIcon?: boolean\n customIcon?: React.ReactNode\n /** Shows a top-right close button that dismisses the callout. */\n dismissible?: boolean\n /** Called when the close button is clicked, after the callout hides itself. */\n onDismiss?: () => void\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n function Callout(\n {\n className,\n variant = \"info\",\n hideIcon = false,\n customIcon,\n dismissible = false,\n onDismiss,\n style,\n children,\n ...props\n },\n ref\n ) {\n const [open, setOpen] = React.useState(true)\n const styles = useStyles()\n\n if (!open) {\n return null\n }\n\n const handleDismiss = () => {\n setOpen(false)\n onDismiss?.()\n }\n\n return (\n <CalloutContext.Provider value={{ variant, hideIcon }}>\n <div\n ref={ref}\n data-callout-variant={variant}\n data-slot=\"callout\"\n data-hide-icon={hideIcon ? \"true\" : \"false\"}\n data-dismissible={dismissible ? \"true\" : \"false\"}\n role=\"alert\"\n {...{ [SLOT_ATTR]: \"callout\" }}\n className={mergeClasses(\n styles.root,\n dismissible && styles.dismissible,\n className\n )}\n style={\n { ...VARIANT_SLOTS[variant](), ...style } as React.CSSProperties\n }\n {...props}\n >\n {!hideIcon && <CalloutIcon customIcon={customIcon} />}\n {children}\n {dismissible && (\n <ClearButton\n label=\"Dismiss\"\n onClick={handleDismiss}\n className={styles.dismiss}\n >\n <CloseIcon className={styles.dismissIcon} />\n </ClearButton>\n )}\n </div>\n </CalloutContext.Provider>\n )\n }\n)\n\nexport type CalloutTitleProps = React.ComponentProps<\"div\">\n\nexport const CalloutTitle = React.forwardRef<HTMLDivElement, CalloutTitleProps>(\n function CalloutTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-title\"\n {...{ [SLOT_ATTR]: \"callout-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n }\n)\n\nexport type CalloutDescriptionProps = React.ComponentProps<\"div\">\n\nexport const CalloutDescription = React.forwardRef<\n HTMLDivElement,\n CalloutDescriptionProps\n>(function CalloutDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-description\"\n {...{ [SLOT_ATTR]: \"callout-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n})\n\nexport type CalloutActionProps = React.ComponentProps<\"div\"> & {\n align?: \"start\" | \"end\"\n}\n\nexport const CalloutAction = React.forwardRef<\n HTMLDivElement,\n CalloutActionProps\n>(function CalloutAction({ className, align = \"start\", ...props }, ref) {\n const { hideIcon } = React.useContext(CalloutContext)\n const styles = useStyles()\n\n const alignment =\n align === \"end\"\n ? styles.actionEnd\n : hideIcon\n ? styles.actionStart\n : styles.actionStartIcon\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-action\"\n data-align={align}\n {...{ [SLOT_ATTR]: \"callout-action\" }}\n className={mergeClasses(styles.action, alignment, className)}\n {...props}\n />\n )\n})\n\ntype CalloutVariantIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutVariantIcon = React.forwardRef<\n SVGSVGElement,\n CalloutVariantIconProps\n>(function CalloutVariantIcon({ customIcon, ...props }, ref) {\n const { variant } = React.useContext(CalloutContext)\n\n if (customIcon) {\n return customIcon\n }\n\n switch (variant) {\n case \"info\":\n return <InfoIcon ref={ref} {...props} />\n case \"success\":\n return <CheckIcon ref={ref} {...props} />\n case \"warning\":\n return <WarningIcon ref={ref} {...props} />\n case \"destructive\":\n return <ErrorIcon ref={ref} {...props} />\n }\n\n // gray has no default icon; v1 renders nothing for it.\n return null\n})\n\nexport type CalloutIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutIcon = React.forwardRef<SVGSVGElement, CalloutIconProps>(\n function CalloutIcon({ className, customIcon, ...props }, ref) {\n return (\n <CalloutVariantIcon\n ref={ref}\n data-slot=\"callout-icon\"\n {...{ [SLOT_ATTR]: \"callout-icon\" }}\n customIcon={customIcon}\n className={className}\n {...props}\n />\n )\n }\n)\n"],"names":["InfoIcon","React","props","ref","jsx","WarningIcon","CheckIcon","ErrorIcon","CalloutContext","BG","FG","semantic","family","slot","NS","VARIANT_SLOTS","useStyles","makeZenithStyles","tokens.spacingElement3","tokens.textSm","tokens.leadingSm","SLOT_ATTR","shorthands","tokens.spacingGroup2","tokens.textBase","tokens.leadingBase","tokens.fontWeightSemibold","tokens.spacingElement1","tokens.spacingElement2","tokens.spacingLayout2","tokens.spacingLayout1","Callout","className","variant","hideIcon","customIcon","dismissible","onDismiss","style","children","open","setOpen","styles","handleDismiss","jsxs","mergeClasses","CalloutIcon","ClearButton","CloseIcon","CalloutTitle","CalloutDescription","CalloutAction","align","alignment","CalloutVariantIcon"],"mappings":";;;;;;;;AAiBA,MAAMA,IAAWC,EAAM;AAAA,EACrB,SAAkBC,GAAOC,GAAK;AAC5B,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAD;AAAA,QACA,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,MAAK;AAAA,QACJ,GAAGD;AAAA,QAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,m8CAAA,CAAm8C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGj9C;AACF,GAEMC,IAAcJ,EAAM,WAGxB,SAAqBC,GAAOC,GAAK;AACjC,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,OAAM;AAAA,MACN,SAAQ;AAAA,MACR,MAAK;AAAA,MACJ,GAAGD;AAAA,MAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,i1CAAA,CAAi1C;AAAA,IAAA;AAAA,EAAA;AAG/1C,CAAC,GAEKE,IAAYL,EAAM;AAAA,EACtB,SAAmBC,GAAOC,GAAK;AAC7B,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAD;AAAA,QACA,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,MAAK;AAAA,QACJ,GAAGD;AAAA,QAEJ,UAAA,gBAAAE,EAAC,QAAA,EAA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AA,MAAA;AAAA,QACC,KAAAnD;AAAA,QACA,aAAU;AAAA,QACJ,CAACkB,CAAS,GAAG;AAAA,QACnB,YAAAc;AAAA,QACA,WAAAH;AAAA,QACC,GAAG9B;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import * as n from "react";
3
3
  import { Checkbox as m, CheckboxIndicator as u } from "../../vendor/.bun/@radix-ui_react-checkbox@1.3.3_2b23df507bdda662/vendor/@radix-ui/react-checkbox/dist/index.js";
4
- import { SLOT_ATTR as i, mergeClasses as x, shorthands as r } from "@epilot/zenith-runtime/v1";
4
+ import { SLOT_ATTR as i, mergeClasses as x, shorthands as e } from "@epilot/zenith-runtime/v1";
5
5
  import { makeZenithStyles as b } from "../../styles/make-styles.js";
6
- import { semAccentContrast as p, semAccentSolid as f, semAccentOnSoft as g, accentA7 as s, semFocusRing as d, radiusSm as k, semAccentSoft as w, errorA8 as C, grayA4 as v } from "../../tokens/index.js";
7
- const S = n.forwardRef(function(e, t) {
6
+ import { accentContrast as p, accentSolid as f, accentOnSoft as g, accentA7 as s, focusRing as d, radiusSm as k, accentSoft as w, errorA8 as C, grayA4 as v } from "../../tokens/index.js";
7
+ const S = n.forwardRef(function(r, t) {
8
8
  return /* @__PURE__ */ o(
9
9
  "svg",
10
10
  {
@@ -16,11 +16,11 @@ const S = n.forwardRef(function(e, t) {
16
16
  viewBox: "0 -960 960 960",
17
17
  width: "24px",
18
18
  fill: "currentColor",
19
- ...e,
19
+ ...r,
20
20
  children: /* @__PURE__ */ o("path", { d: "m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z" })
21
21
  }
22
22
  );
23
- }), y = n.forwardRef(function(e, t) {
23
+ }), y = n.forwardRef(function(r, t) {
24
24
  return /* @__PURE__ */ o(
25
25
  "svg",
26
26
  {
@@ -32,13 +32,13 @@ const S = n.forwardRef(function(e, t) {
32
32
  viewBox: "0 -960 960 960",
33
33
  width: "24px",
34
34
  fill: "currentColor",
35
- ...e,
35
+ ...r,
36
36
  children: /* @__PURE__ */ o("path", { d: "M280-440q-17 0-28.5-11.5T240-480q0-17 11.5-28.5T280-520h400q17 0 28.5 11.5T720-480q0 17-11.5 28.5T680-440H280Z" })
37
37
  }
38
38
  );
39
39
  }), T = b({
40
40
  root: {
41
- ...r.border("1px", "solid", s),
41
+ ...e.border("1px", "solid", s),
42
42
  backgroundColor: w,
43
43
  display: "inline-block",
44
44
  boxSizing: "border-box",
@@ -63,20 +63,20 @@ const S = n.forwardRef(function(e, t) {
63
63
  "&[data-disabled]": {
64
64
  cursor: "not-allowed",
65
65
  opacity: 0.5,
66
- ...r.borderColor(v)
66
+ ...e.borderColor(v)
67
67
  },
68
68
  "&[aria-invalid='true']": {
69
69
  outlineColor: d,
70
- ...r.borderColor(C)
70
+ ...e.borderColor(C)
71
71
  },
72
72
  "&[data-state='indeterminate']": {
73
73
  backgroundColor: s,
74
- ...r.borderColor("transparent"),
74
+ ...e.borderColor("transparent"),
75
75
  color: g
76
76
  },
77
77
  "&[data-state='checked']": {
78
78
  backgroundColor: f,
79
- ...r.borderWidth("0px"),
79
+ ...e.borderWidth("0px"),
80
80
  color: p
81
81
  },
82
82
  "&[data-state='checked'] svg, &[data-state='indeterminate'] svg": {
@@ -95,7 +95,7 @@ const S = n.forwardRef(function(e, t) {
95
95
  height: "0.875rem"
96
96
  }
97
97
  }
98
- }), M = n.forwardRef(function({ className: e, checked: t, ...l }, h) {
98
+ }), M = n.forwardRef(function({ className: r, checked: t, ...l }, h) {
99
99
  const a = T();
100
100
  return /* @__PURE__ */ o(
101
101
  m,
@@ -104,7 +104,7 @@ const S = n.forwardRef(function(e, t) {
104
104
  checked: t,
105
105
  "data-slot": "checkbox",
106
106
  [i]: "checkbox",
107
- className: x(a.root, e),
107
+ className: x(a.root, r),
108
108
  ...l,
109
109
  children: /* @__PURE__ */ o(
110
110
  u,
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import * as React from \"react\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\nconst CheckIcon = React.forwardRef<\n SVGSVGElement,\n React.SVGProps<SVGSVGElement>\n>(function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\n data-slot=\"checkbox-check-icon\"\n {...{ [SLOT_ATTR]: \"checkbox-check-icon\" }}\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 -960 960 960\"\n width=\"24px\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z\" />\n </svg>\n )\n})\n\nconst MinusIcon = React.forwardRef<\n SVGSVGElement,\n React.SVGProps<SVGSVGElement>\n>(function MinusIcon(props, ref) {\n return (\n <svg\n ref={ref}\n data-slot=\"checkbox-minus-icon\"\n {...{ [SLOT_ATTR]: \"checkbox-minus-icon\" }}\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 -960 960 960\"\n width=\"24px\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M280-440q-17 0-28.5-11.5T240-480q0-17 11.5-28.5T280-520h400q17 0 28.5 11.5T720-480q0 17-11.5 28.5T680-440H280Z\" />\n </svg>\n )\n})\n\nconst useStyles = makeZenithStyles({\n root: {\n ...shorthands.border(\"1px\", \"solid\", tokens.accentA7),\n backgroundColor: tokens.semAccentSoft,\n display: \"inline-block\",\n boxSizing: \"border-box\",\n width: \"1rem\",\n height: \"1rem\",\n flexShrink: 0,\n borderRadius: tokens.radiusSm,\n // v1 `shadow-xs` — elevation comes from Tailwind's shadow scale, which has no token (B7).\n boxShadow: \"0 1px 2px 0 #0000000d\",\n transitionProperty: \"box-shadow\",\n transitionTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n transitionDuration: \"150ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n },\n \":focus-visible\": {\n outlineOffset: \"2px\",\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineColor: tokens.semFocusRing,\n },\n \"&[data-disabled]\": {\n cursor: \"not-allowed\",\n opacity: 0.5,\n ...shorthands.borderColor(tokens.grayA4),\n },\n \"&[aria-invalid='true']\": {\n outlineColor: tokens.semFocusRing,\n ...shorthands.borderColor(tokens.errorA8),\n },\n \"&[data-state='indeterminate']\": {\n backgroundColor: tokens.accentA7,\n ...shorthands.borderColor(\"transparent\"),\n color: tokens.semAccentOnSoft,\n },\n \"&[data-state='checked']\": {\n backgroundColor: tokens.semAccentSolid,\n ...shorthands.borderWidth(\"0px\"),\n color: tokens.semAccentContrast,\n },\n \"&[data-state='checked'] svg, &[data-state='indeterminate'] svg\": {\n width: \"0.875rem\",\n height: \"0.875rem\",\n },\n },\n indicator: {\n display: \"grid\",\n placeContent: \"center\",\n height: \"100%\",\n color: \"currentColor\",\n transitionProperty: \"none\",\n \"& svg\": {\n width: \"0.875rem\",\n height: \"0.875rem\",\n },\n },\n})\n\nexport type CheckboxProps = React.ComponentProps<typeof CheckboxPrimitive.Root>\n\nexport const Checkbox = React.forwardRef<\n React.ComponentRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(function Checkbox({ className, checked, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <CheckboxPrimitive.Root\n ref={ref}\n checked={checked}\n data-slot=\"checkbox\"\n {...{ [SLOT_ATTR]: \"checkbox\" }}\n className={mergeClasses(styles.root, className)}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n {...{ [SLOT_ATTR]: \"checkbox-indicator\" }}\n className={styles.indicator}\n >\n {checked === \"indeterminate\" ? <MinusIcon /> : <CheckIcon />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n})\n"],"names":["CheckIcon","React","props","ref","jsx","SLOT_ATTR","MinusIcon","useStyles","makeZenithStyles","shorthands","tokens.accentA7","tokens.semAccentSoft","tokens.radiusSm","tokens.semFocusRing","tokens.grayA4","tokens.errorA8","tokens.semAccentOnSoft","tokens.semAccentSolid","tokens.semAccentContrast","Checkbox","className","checked","styles","CheckboxPrimitive.Root","mergeClasses","CheckboxPrimitive.Indicator"],"mappings":";;;;;;AAQA,MAAMA,IAAYC,EAAM,WAGtB,SAAmBC,GAAOC,GAAK;AAC/B,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,aAAU;AAAA,MACJ,CAACE,CAAS,GAAG;AAAA,MACnB,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,OAAM;AAAA,MACN,MAAK;AAAA,MACJ,GAAGH;AAAA,MAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,uJAAA,CAAuJ;AAAA,IAAA;AAAA,EAAA;AAGrK,CAAC,GAEKE,IAAYL,EAAM,WAGtB,SAAmBC,GAAOC,GAAK;AAC/B,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,aAAU;AAAA,MACJ,CAACE,CAAS,GAAG;AAAA,MACnB,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,OAAM;AAAA,MACN,MAAK;AAAA,MACJ,GAAGH;AAAA,MAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,iHAAA,CAAiH;AAAA,IAAA;AAAA,EAAA;AAG/H,CAAC,GAEK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AS,GAAGnB,EAAA,GAASC,GAAK;AACzD,QAAMmB,IAASf,EAAA;AAEf,SACE,gBAAAH;AAAA,IAACmB;AAAAA,IAAA;AAAA,MACC,KAAApB;AAAA,MACA,SAAAkB;AAAA,MACA,aAAU;AAAA,MACJ,CAAChB,CAAS,GAAG;AAAA,MACnB,WAAWmB,EAAaF,EAAO,MAAMF,CAAS;AAAA,MAC7C,GAAGlB;AAAA,MAEJ,UAAA,gBAAAE;AAAA,QAACqB;AAAAA,QAAA;AAAA,UACC,aAAU;AAAA,UACJ,CAACpB,CAAS,GAAG;AAAA,UACnB,WAAWiB,EAAO;AAAA,UAEjB,gBAAY,kBAAkB,gBAAAlB,EAACE,GAAA,EAAU,sBAAMN,GAAA,CAAA,CAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IAC5D;AAAA,EAAA;AAGN,CAAC;"}
1
+ {"version":3,"file":"checkbox.js","sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import * as React from \"react\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\nconst CheckIcon = React.forwardRef<\n SVGSVGElement,\n React.SVGProps<SVGSVGElement>\n>(function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\n data-slot=\"checkbox-check-icon\"\n {...{ [SLOT_ATTR]: \"checkbox-check-icon\" }}\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 -960 960 960\"\n width=\"24px\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z\" />\n </svg>\n )\n})\n\nconst MinusIcon = React.forwardRef<\n SVGSVGElement,\n React.SVGProps<SVGSVGElement>\n>(function MinusIcon(props, ref) {\n return (\n <svg\n ref={ref}\n data-slot=\"checkbox-minus-icon\"\n {...{ [SLOT_ATTR]: \"checkbox-minus-icon\" }}\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 -960 960 960\"\n width=\"24px\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M280-440q-17 0-28.5-11.5T240-480q0-17 11.5-28.5T280-520h400q17 0 28.5 11.5T720-480q0 17-11.5 28.5T680-440H280Z\" />\n </svg>\n )\n})\n\nconst useStyles = makeZenithStyles({\n root: {\n ...shorthands.border(\"1px\", \"solid\", tokens.accentA7),\n backgroundColor: tokens.accentSoft,\n display: \"inline-block\",\n boxSizing: \"border-box\",\n width: \"1rem\",\n height: \"1rem\",\n flexShrink: 0,\n borderRadius: tokens.radiusSm,\n // v1 `shadow-xs` — elevation comes from Tailwind's shadow scale, which has no token (B7).\n boxShadow: \"0 1px 2px 0 #0000000d\",\n transitionProperty: \"box-shadow\",\n transitionTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n transitionDuration: \"150ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n },\n \":focus-visible\": {\n outlineOffset: \"2px\",\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineColor: tokens.focusRing,\n },\n \"&[data-disabled]\": {\n cursor: \"not-allowed\",\n opacity: 0.5,\n ...shorthands.borderColor(tokens.grayA4),\n },\n \"&[aria-invalid='true']\": {\n outlineColor: tokens.focusRing,\n ...shorthands.borderColor(tokens.errorA8),\n },\n \"&[data-state='indeterminate']\": {\n backgroundColor: tokens.accentA7,\n ...shorthands.borderColor(\"transparent\"),\n color: tokens.accentOnSoft,\n },\n \"&[data-state='checked']\": {\n backgroundColor: tokens.accentSolid,\n ...shorthands.borderWidth(\"0px\"),\n color: tokens.accentContrast,\n },\n \"&[data-state='checked'] svg, &[data-state='indeterminate'] svg\": {\n width: \"0.875rem\",\n height: \"0.875rem\",\n },\n },\n indicator: {\n display: \"grid\",\n placeContent: \"center\",\n height: \"100%\",\n color: \"currentColor\",\n transitionProperty: \"none\",\n \"& svg\": {\n width: \"0.875rem\",\n height: \"0.875rem\",\n },\n },\n})\n\nexport type CheckboxProps = React.ComponentProps<typeof CheckboxPrimitive.Root>\n\nexport const Checkbox = React.forwardRef<\n React.ComponentRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(function Checkbox({ className, checked, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <CheckboxPrimitive.Root\n ref={ref}\n checked={checked}\n data-slot=\"checkbox\"\n {...{ [SLOT_ATTR]: \"checkbox\" }}\n className={mergeClasses(styles.root, className)}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n {...{ [SLOT_ATTR]: \"checkbox-indicator\" }}\n className={styles.indicator}\n >\n {checked === \"indeterminate\" ? <MinusIcon /> : <CheckIcon />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n})\n"],"names":["CheckIcon","React","props","ref","jsx","SLOT_ATTR","MinusIcon","useStyles","makeZenithStyles","shorthands","tokens.accentA7","tokens.accentSoft","tokens.radiusSm","tokens.focusRing","tokens.grayA4","tokens.errorA8","tokens.accentOnSoft","tokens.accentSolid","tokens.accentContrast","Checkbox","className","checked","styles","CheckboxPrimitive.Root","mergeClasses","CheckboxPrimitive.Indicator"],"mappings":";;;;;;AAQA,MAAMA,IAAYC,EAAM,WAGtB,SAAmBC,GAAOC,GAAK;AAC/B,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,aAAU;AAAA,MACJ,CAACE,CAAS,GAAG;AAAA,MACnB,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,OAAM;AAAA,MACN,MAAK;AAAA,MACJ,GAAGH;AAAA,MAEJ,UAAA,gBAAAE,EAAC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,2BAA2B;AAAA,MACzB,iBAAiBC;AAAAA,MACjB,GAAGR,EAAW,YAAY,KAAK;AAAA,MAC/B,OAAOS;AAAAA,IAAO;AAAA,IAEhB,kEAAkE;AAAA,MAChE,OAAO;AAAA,MACP,QAAQ;AAAA,IAAA;AAAA,EACV;AAAA,EAEF,WAAW;AAAA,IACT,SAAS;AAAA,IACT,cAAc;AAAA,IACd,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,oBAAoB;AAAA,IACpB,SAAS;AAAA,MACP,OAAO;AAAA,MACP,QAAQ;AAAA,IAAA;AAAA,EACV;AAEJ,CAAC,GAIYC,IAAWlB,EAAM,WAG5B,SAAkB,EAAE,WAAAmB,GAAW,SAAAC,GAAS,GAAGnB,EAAA,GAASC,GAAK;AACzD,QAAMmB,IAASf,EAAA;AAEf,SACE,gBAAAH;AAAA,IAACmB;AAAAA,IAAA;AAAA,MACC,KAAApB;AAAA,MACA,SAAAkB;AAAA,MACA,aAAU;AAAA,MACJ,CAAChB,CAAS,GAAG;AAAA,MACnB,WAAWmB,EAAaF,EAAO,MAAMF,CAAS;AAAA,MAC7C,GAAGlB;AAAA,MAEJ,UAAA,gBAAAE;AAAA,QAACqB;AAAAA,QAAA;AAAA,UACC,aAAU;AAAA,UACJ,CAACpB,CAAS,GAAG;AAAA,UACnB,WAAWiB,EAAO;AAAA,UAEjB,gBAAY,kBAAkB,gBAAAlB,EAACE,GAAA,EAAU,sBAAMN,GAAA,CAAA,CAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IAC5D;AAAA,EAAA;AAGN,CAAC;"}
@@ -2,12 +2,12 @@ import { jsxs as g, jsx as o } from "react/jsx-runtime";
2
2
  import * as a from "react";
3
3
  import { SLOT_ATTR as t, mergeClasses as m, shorthands as l } from "@epilot/zenith-runtime/v1";
4
4
  import { makeZenithStyles as oe } from "../../styles/make-styles.js";
5
- import { surfaceContainer as T, spacingElement3 as X, spacingElement2 as p, grayA8 as te, grayA2 as j, semFocusRing as ie, grayA12 as D, leadingXs as R, textXs as $, fontMono as E, spacingElement05 as b, grayA11 as le, fontWeightMedium as ae, surfaceRadiusContainer as ne, borderWidthContainer as F, surfaceSep as re, spacingElement1 as ce, borderContainer as de } from "../../tokens/index.js";
5
+ import { surfaceContainer as T, spacingElement3 as X, spacingElement2 as p, grayA8 as te, grayA2 as j, focusRing as ie, grayA12 as D, leadingXs as R, textXs as $, fontMono as E, spacingElement05 as b, grayA11 as le, fontWeightMedium as ae, surfaceRadiusContainer as ne, borderWidthContainer as Y, surfaceSep as re, spacingElement1 as ce, borderContainer as de } from "../../tokens/index.js";
6
6
  import { Button as se } from "../button/button.js";
7
7
  import { highlightCode as pe, splitTokenLines as he } from "../../lib/code-highlight.js";
8
8
  import { useCodeTokenRenderer as ue } from "../../lib/code-tokens.js";
9
9
  import { gutterDigits as fe } from "../../lib/code-lines.js";
10
- const me = 2e3, Y = "--zenith-code-gutter", be = oe({
10
+ const me = 2e3, F = "--zenith-code-gutter", be = oe({
11
11
  root: {
12
12
  display: "flex",
13
13
  flexDirection: "column",
@@ -16,7 +16,7 @@ const me = 2e3, Y = "--zenith-code-gutter", be = oe({
16
16
  // The same role recipe Surface's `section` uses, and the same property shapes, so a caller's
17
17
  // own border or radius replaces these through `mergeClasses` without a wrapper.
18
18
  backgroundColor: T,
19
- ...l.borderWidth(F),
19
+ ...l.borderWidth(Y),
20
20
  ...l.borderStyle("solid"),
21
21
  ...l.borderColor(de),
22
22
  borderRadius: ne,
@@ -38,7 +38,7 @@ const me = 2e3, Y = "--zenith-code-gutter", be = oe({
38
38
  // helper, and a bare `borderBottomWidth: …` alongside a neighbour's `borderWidth` shorthand
39
39
  // is exactly the property-shape mismatch AGENTS.md rule 3 warns about.
40
40
  ...l.borderBottom(
41
- F,
41
+ Y,
42
42
  "solid",
43
43
  re
44
44
  )
@@ -158,7 +158,7 @@ const me = 2e3, Y = "--zenith-code-gutter", be = oe({
158
158
  flexShrink: 0,
159
159
  color: te,
160
160
  boxSizing: "border-box",
161
- width: `calc(var(${Y}) + ${p} + ${X})`,
161
+ width: `calc(var(${F}) + ${p} + ${X})`,
162
162
  paddingLeft: p,
163
163
  paddingRight: X,
164
164
  // Opaque because horizontally scrolled code passes beneath the sticky gutter.
@@ -266,7 +266,7 @@ const me = 2e3, Y = "--zenith-code-gutter", be = oe({
266
266
  () => v && f !== null ? he(f) : null,
267
267
  [f, v]
268
268
  ), N = S !== void 0 && S !== "", M = c !== void 0 && c !== "", G = W["aria-label"], q = W["aria-labelledby"], H = N ? I : q, J = H !== void 0 || G !== void 0, O = h === "copied" ? _ : h === "error" ? K : P, Q = N || M, ee = s === null ? B : {
269
- [Y]: `${fe(s.length)}ch`,
269
+ [F]: `${fe(s.length)}ch`,
270
270
  ...B
271
271
  };
272
272
  return /* @__PURE__ */ g(
@@ -1 +1 @@
1
- {"version":3,"file":"code-block.js","sources":["../../../src/components/code-block/code-block.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport { Button } from \"../button/button\"\nimport { highlightCode, splitTokenLines } from \"../../lib/code-highlight\"\nimport { useCodeTokenRenderer } from \"../../lib/code-tokens\"\nimport { gutterDigits } from \"../../lib/code-lines\"\n\n/**\n * Read-only highlighted code. Source is rendered as text, and the focusable `<pre>` keeps\n * horizontal overflow keyboard-accessible.\n */\n\nconst COPY_FEEDBACK_MS = 2000\n\n/** Gutter width in monospace glyphs, shared by every numbered row. */\nconst GUTTER = \"--zenith-code-gutter\"\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n position: \"relative\",\n // The same role recipe Surface's `section` uses, and the same property shapes, so a caller's\n // own border or radius replaces these through `mergeClasses` without a wrapper.\n backgroundColor: tokens.surfaceContainer,\n ...shorthands.borderWidth(tokens.borderWidthContainer),\n ...shorthands.borderStyle(\"solid\"),\n ...shorthands.borderColor(tokens.borderContainer),\n borderRadius: tokens.surfaceRadiusContainer,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n },\n // Griffel ancestor state selectors must be declared on the ancestor.\n rootCopyReveal: {\n \"&:hover [data-copy-state]\": { opacity: 1 },\n \"&:focus-within [data-copy-state]\": { opacity: 1 },\n },\n header: {\n display: \"flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement2),\n ...shorthands.paddingBlock(tokens.spacingElement1),\n ...shorthands.paddingInline(tokens.spacingElement2),\n // `borderBottom` expands to the three bottom-edge longhands; there is no per-edge width\n // helper, and a bare `borderBottomWidth: …` alongside a neighbour's `borderWidth` shorthand\n // is exactly the property-shape mismatch AGENTS.md rule 3 warns about.\n ...shorthands.borderBottom(\n tokens.borderWidthContainer,\n \"solid\",\n tokens.surfaceSep\n ),\n },\n // Reserve the overlay button's width when a caption is present.\n headerWithCopy: {\n paddingRight: `calc(1.75rem + ${tokens.spacingElement2} + ${tokens.spacingElement05})`,\n minHeight: `calc(1.75rem + ${tokens.spacingElement05} + ${tokens.spacingElement05})`,\n },\n title: {\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightMedium,\n color: tokens.grayA12,\n minWidth: 0,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n language: {\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n color: tokens.grayA11,\n // The language label names a machine format, so it stays in the code family rather than\n // inheriting the surrounding UI face.\n fontFamily: tokens.fontMono,\n whiteSpace: \"nowrap\",\n },\n headerSpacer: {\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n minWidth: 0,\n },\n // The button stays in the tab order while its paint is hidden.\n copy: {\n position: \"absolute\",\n top: tokens.spacingElement05,\n right: tokens.spacingElement05,\n zIndex: 1,\n backgroundColor: tokens.surfaceContainer,\n opacity: 0,\n transitionProperty: \"opacity\",\n transitionDuration: \"120ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0s\",\n },\n \"@media (hover: none)\": {\n opacity: 1,\n },\n // Focus and feedback must override the hidden resting state.\n \"&[data-copy-state='copied']\": { opacity: 1 },\n \"&[data-copy-state='error']\": { opacity: 1 },\n \"&:focus-visible\": { opacity: 1 },\n },\n pre: {\n ...shorthands.margin(0),\n ...shorthands.padding(tokens.spacingElement2),\n overflowX: \"auto\",\n overflowY: \"auto\",\n fontFamily: tokens.fontMono,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n color: tokens.grayA12,\n // `tab-size` is what makes a tab-indented source line up at all; 2 matches the indent the\n // editor inserts by default.\n tabSize: 2,\n outlineStyle: \"none\",\n // Declared after the base so the focus ring wins, per the ordering rule in AGENTS.md.\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"-2px\",\n outlineColor: tokens.semFocusRing,\n },\n },\n // Sticky numbers must pin flush to the scrollport.\n preGutter: {\n paddingLeft: 0,\n },\n preNoWrap: {\n whiteSpace: \"pre\",\n },\n preWrap: {\n whiteSpace: \"pre-wrap\",\n overflowWrap: \"break-word\",\n },\n code: {\n // `<code>` is inline by default, which collapses the numbered-line grid to one row.\n display: \"block\",\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n lineHeight: \"inherit\",\n },\n // Give sticky gutters and row bands the full width of unwrapped code.\n codeNoWrap: {\n width: \"max-content\",\n minWidth: \"100%\",\n },\n line: {\n display: \"flex\",\n width: \"100%\",\n // Avoid sticky touch-hover states; paint both cells because the gutter is opaque.\n \"@media (hover: hover)\": {\n [`&:hover [${SLOT_ATTR}='code-block-line-number'], &:hover [${SLOT_ATTR}='code-block-line-content']`]:\n {\n backgroundImage: `linear-gradient(${tokens.grayA2}, ${tokens.grayA2})`,\n },\n },\n },\n lineNumber: {\n // Not selectable, so dragging a selection across the block copies code and not a column of\n // integers. The copy button never sees these at all — it copies the original `code` string.\n userSelect: \"none\",\n textAlign: \"right\",\n flexGrow: 0,\n flexShrink: 0,\n color: tokens.grayA8,\n boxSizing: \"border-box\",\n width: `calc(var(${GUTTER}) + ${tokens.spacingElement2} + ${tokens.spacingElement3})`,\n paddingLeft: tokens.spacingElement2,\n paddingRight: tokens.spacingElement3,\n // Opaque because horizontally scrolled code passes beneath the sticky gutter.\n position: \"sticky\",\n left: 0,\n backgroundColor: tokens.surfaceContainer,\n },\n lineContent: {\n minWidth: 0,\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"auto\",\n },\n lineContentWrap: {\n overflowWrap: \"break-word\",\n },\n srOnly: {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n ...shorthands.padding(0),\n ...shorthands.margin(\"-1px\"),\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n },\n})\n\nconst CopyIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M5 15V5a2 2 0 0 1 2-2h10\" />\n </svg>\n)\n\nconst CheckIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <path d=\"m4 12.5 5 5 11-11\" />\n </svg>\n)\n\n/** Idle, or the outcome of the last copy attempt. Drives both the icon and the live region. */\ntype CopyState = \"idle\" | \"copied\" | \"error\"\n\nexport type CodeBlockProps = Omit<\n React.ComponentProps<\"div\">,\n \"children\" | \"title\"\n> & {\n /** The source to display. Rendered as text — never as markup, and never evaluated. */\n code: string\n /** Language grammar used for syntax highlighting, also shown in the header. */\n language?: string\n /**\n * Visible caption, typically a file name. Also names the scrollable code region.\n *\n * This replaces the native `title` attribute, which would have rendered a browser tooltip\n * instead of a caption.\n */\n title?: string\n /** Soft-wrap long lines instead of scrolling horizontally. */\n wrap?: boolean\n /**\n * Render a non-selectable line-number gutter, and give each row a hover band.\n *\n * Off by default. Numbers are wayfinding for prose that refers to a line by number; on a\n * four-line snippet they are a column of noise that also costs horizontal space.\n */\n showLineNumbers?: boolean\n /** Show the copy button. */\n copyable?: boolean\n /** Accessible name of the copy button. */\n copyLabel?: string\n /** Announced, and used as the button's name, after a successful copy. */\n copiedLabel?: string\n /** Announced, and used as the button's name, when the clipboard is unavailable or refuses. */\n copyErrorLabel?: string\n /** Called with the exact string written to the clipboard. */\n onCopy?: (code: string) => void\n /** Called when the clipboard write failed or was unavailable. */\n onCopyError?: (error: unknown) => void\n}\n\nexport const CodeBlock = React.forwardRef<HTMLDivElement, CodeBlockProps>(\n function CodeBlock(\n {\n code,\n language,\n title,\n wrap = false,\n showLineNumbers = false,\n copyable = false,\n copyLabel = \"Copy code\",\n copiedLabel = \"Copied\",\n copyErrorLabel = \"Copy failed\",\n onCopy,\n onCopyError,\n className,\n style,\n ...props\n },\n ref\n ) {\n const styles = useStyles()\n const reactId = React.useId()\n const titleId = `${reactId}-title`\n\n const [copyState, setCopyState] = React.useState<CopyState>(\"idle\")\n const resetTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n\n React.useEffect(\n () => () => {\n if (resetTimer.current !== null) clearTimeout(resetTimer.current)\n },\n []\n )\n\n const handleCopy = React.useCallback(async () => {\n // Read the clipboard off `navigator` at click time, never at import or render time: this is\n // the only browser-only access in the component, and an event handler cannot run on a\n // server. A missing or rejecting clipboard is an ordinary outcome here (insecure origin,\n // denied permission, older browser), not an exception to propagate.\n let failure: unknown = null\n try {\n const clipboard =\n typeof navigator === \"undefined\" ? undefined : navigator.clipboard\n if (typeof clipboard?.writeText !== \"function\") {\n failure = new Error(\"Clipboard API unavailable\")\n } else {\n await clipboard.writeText(code)\n }\n } catch (error) {\n failure = error ?? new Error(\"Clipboard write rejected\")\n }\n\n if (failure === null) onCopy?.(code)\n else onCopyError?.(failure)\n\n setCopyState(failure === null ? \"copied\" : \"error\")\n if (resetTimer.current !== null) clearTimeout(resetTimer.current)\n resetTimer.current = setTimeout(() => {\n resetTimer.current = null\n setCopyState(\"idle\")\n }, COPY_FEEDBACK_MS)\n }, [code, onCopy, onCopyError])\n\n // One trailing newline is an artefact of how source files end, not a line the reader should\n // see numbered and empty. The clipboard still gets `code` byte for byte.\n const displayed = code.endsWith(\"\\n\") ? code.slice(0, -1) : code\n const renderTokens = useCodeTokenRenderer()\n\n // Tokenized once per (source, language). Synchronous by construction, so the server render and\n // the first client render produce identical markup and hydration has nothing to reconcile.\n const highlighted = React.useMemo(\n () => highlightCode(displayed, language),\n [displayed, language]\n )\n\n // Two shapes, because the gutter needs rows: a plain string or a token run when there are no\n // line numbers, and one entry per line when there are.\n const plainLines = React.useMemo(\n () => (showLineNumbers ? displayed.split(\"\\n\") : null),\n [displayed, showLineNumbers]\n )\n const tokenLines = React.useMemo(\n () =>\n showLineNumbers && highlighted !== null\n ? splitTokenLines(highlighted)\n : null,\n [highlighted, showLineNumbers]\n )\n\n // An empty string is not a caption. Normalised once, so the header, the caption element and\n // the region's name can never disagree about whether there is one — labelling the region by an\n // empty caption would name it with nothing, which is worse than leaving it unnamed.\n const hasTitle = title !== undefined && title !== \"\"\n const hasLanguage = language !== undefined && language !== \"\"\n\n const ariaLabel = props[\"aria-label\"]\n const ariaLabelledBy = props[\"aria-labelledby\"]\n // A region needs a name. Prefer the caption the reader can see, then whatever the caller\n // supplied; with none of the three, stay focusable but claim no landmark.\n const labelledBy = hasTitle ? titleId : ariaLabelledBy\n const named = labelledBy !== undefined || ariaLabel !== undefined\n\n const copyStatusLabel =\n copyState === \"copied\"\n ? copiedLabel\n : copyState === \"error\"\n ? copyErrorLabel\n : copyLabel\n\n // A header exists for content. A copy button is an overlay and does not summon one — that is\n // what lets `<CodeBlock code copyable />` reserve no vertical space for chrome at all.\n const showHeader = hasTitle || hasLanguage\n\n const gutterStyle =\n plainLines === null\n ? style\n : ({\n [GUTTER]: `${gutterDigits(plainLines.length)}ch`,\n ...style,\n } as React.CSSProperties)\n\n return (\n <div\n ref={ref}\n data-slot=\"code-block\"\n {...{ [SLOT_ATTR]: \"code-block\" }}\n data-language={language}\n className={mergeClasses(\n styles.root,\n copyable ? styles.rootCopyReveal : undefined,\n className\n )}\n style={gutterStyle}\n {...props}\n aria-label={undefined}\n aria-labelledby={undefined}\n >\n {showHeader ? (\n <div\n data-slot=\"code-block-header\"\n {...{ [SLOT_ATTR]: \"code-block-header\" }}\n className={mergeClasses(\n styles.header,\n copyable ? styles.headerWithCopy : undefined\n )}\n >\n {hasTitle ? (\n <span\n id={titleId}\n data-slot=\"code-block-title\"\n {...{ [SLOT_ATTR]: \"code-block-title\" }}\n className={styles.title}\n >\n {title}\n </span>\n ) : null}\n {hasLanguage ? (\n <span\n data-slot=\"code-block-language\"\n {...{ [SLOT_ATTR]: \"code-block-language\" }}\n className={styles.language}\n >\n {language}\n </span>\n ) : null}\n <span className={styles.headerSpacer} />\n </div>\n ) : null}\n\n {copyable ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n // Button keeps its OWN slot markers, the way Callout leaves the ClearButton it\n // composes alone: a Button stays a Button, and a rule written against the button\n // slot must still reach this one. `data-copy-state` is the handle for this\n // button specifically, and it carries the state a caller would want to select on.\n data-copy-state={copyState}\n aria-label={copyStatusLabel}\n className={styles.copy}\n onClick={handleCopy}\n >\n {copyState === \"copied\" ? <CheckIcon /> : <CopyIcon />}\n </Button>\n ) : null}\n\n <pre\n data-slot=\"code-block-content\"\n {...{ [SLOT_ATTR]: \"code-block-content\" }}\n // Always reachable: this is the scroll container, and a pointer must not be the only\n // way to scroll it.\n tabIndex={0}\n role={named ? \"region\" : undefined}\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n className={mergeClasses(\n styles.pre,\n plainLines === null ? undefined : styles.preGutter,\n wrap ? styles.preWrap : styles.preNoWrap\n )}\n >\n <code\n data-slot=\"code-block-code\"\n {...{ [SLOT_ATTR]: \"code-block-code\" }}\n className={mergeClasses(\n styles.code,\n plainLines !== null && !wrap ? styles.codeNoWrap : undefined\n )}\n >\n {plainLines === null\n ? // No gutter: one run, highlighted if we have a grammar, otherwise the raw string.\n highlighted === null\n ? displayed\n : renderTokens(highlighted)\n : plainLines.map((line, index) => (\n <span\n // Lines have no identity beyond their position, and the whole block\n // re-renders when `code` changes, so the index is the key.\n key={index}\n data-slot=\"code-block-line\"\n {...{ [SLOT_ATTR]: \"code-block-line\" }}\n data-line={index + 1}\n className={styles.line}\n >\n <span\n aria-hidden=\"true\"\n data-slot=\"code-block-line-number\"\n {...{ [SLOT_ATTR]: \"code-block-line-number\" }}\n className={styles.lineNumber}\n >\n {index + 1}\n </span>\n <span\n data-slot=\"code-block-line-content\"\n {...{ [SLOT_ATTR]: \"code-block-line-content\" }}\n className={mergeClasses(\n styles.lineContent,\n wrap ? styles.lineContentWrap : undefined\n )}\n >\n {/* `tokenLines` is the same text as `plainLines`, split by the same\n newlines — `splitTokenLines` round-trips — so the row count matches and\n the index is safe. Falls back to the plain line when there is no\n grammar. */}\n {tokenLines === null\n ? line\n : renderTokens(tokenLines[index] ?? [])}\n {/* The newline keeps a dragged selection line-separated, exactly as the\n unnumbered rendering is. */}\n {\"\\n\"}\n </span>\n </span>\n ))}\n </code>\n </pre>\n\n {copyable ? (\n <span\n role=\"status\"\n aria-live=\"polite\"\n data-slot=\"code-block-copy-status\"\n {...{ [SLOT_ATTR]: \"code-block-copy-status\" }}\n className={styles.srOnly}\n >\n {copyState === \"idle\" ? \"\" : copyStatusLabel}\n </span>\n ) : null}\n </div>\n )\n }\n)\n"],"names":["COPY_FEEDBACK_MS","GUTTER","useStyles","makeZenithStyles","tokens.surfaceContainer","shorthands","tokens.borderWidthContainer","tokens.borderContainer","tokens.surfaceRadiusContainer","tokens.spacingElement2","tokens.spacingElement1","tokens.surfaceSep","tokens.spacingElement05","tokens.textXs","tokens.leadingXs","tokens.fontWeightMedium","tokens.grayA12","tokens.grayA11","tokens.fontMono","tokens.semFocusRing","SLOT_ATTR","tokens.grayA2","tokens.grayA8","tokens.spacingElement3","CopyIcon","props","jsxs","jsx","CheckIcon","CodeBlock","React","code","language","title","wrap","showLineNumbers","copyable","copyLabel","copiedLabel","copyErrorLabel","onCopy","onCopyError","className","style","ref","styles","titleId","copyState","setCopyState","resetTimer","handleCopy","failure","clipboard","error","displayed","renderTokens","useCodeTokenRenderer","highlighted","highlightCode","plainLines","tokenLines","splitTokenLines","hasTitle","hasLanguage","ariaLabel","ariaLabelledBy","labelledBy","named","copyStatusLabel","showHeader","gutterStyle","gutterDigits","mergeClasses","Button","line","index"],"mappings":";;;;;;;;;AAiBA,MAAMA,KAAmB,KAGnBC,IAAS,wBAETC,KAAYC,GAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,eAAe;AAAA,IACf,UAAU;AAAA,IACV,UAAU;AAAA;AAAA;AAAA,IAGV,iBAAiBC;AAAAA,IACjB,GAAGC,EAAW,YAAYC,CAA2B;AAAA,IACrD,GAAGD,EAAW,YAAY,OAAO;AAAA,IACjC,GAAGA,EAAW,YAAYE,EAAsB;AAAA,IAChD,cAAcC;AAAAA,IACd,WAAW;AAAA,IACX,WAAW;AAAA,EAAA;AAAA;AAAA,EAGb,gBAAgB;AAAA,IACd,6BAA6B,EAAE,SAAS,EAAA;AAAA,IACxC,oCAAoC,EAAE,SAAS,EAAA;AAAA,EAAE;AAAA,EAEnD,QAAQ;AAAA,IACN,SAAS;AA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IACC,gBAAAT;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,aAAU;AAAA,cACV,aAAU;AAAA,cACJ,CAACP,CAAS,GAAG;AAAA,cACnB,WAAWyB,EAAO;AAAA,cAEjB,UAAAE,MAAc,SAAS,KAAKqB;AAAA,YAAA;AAAA,UAAA,IAE7B;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
1
+ {"version":3,"file":"code-block.js","sources":["../../../src/components/code-block/code-block.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport { Button } from \"../button/button\"\nimport { highlightCode, splitTokenLines } from \"../../lib/code-highlight\"\nimport { useCodeTokenRenderer } from \"../../lib/code-tokens\"\nimport { gutterDigits } from \"../../lib/code-lines\"\n\n/**\n * Read-only highlighted code. Source is rendered as text, and the focusable `<pre>` keeps\n * horizontal overflow keyboard-accessible.\n */\n\nconst COPY_FEEDBACK_MS = 2000\n\n/** Gutter width in monospace glyphs, shared by every numbered row. */\nconst GUTTER = \"--zenith-code-gutter\"\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n position: \"relative\",\n // The same role recipe Surface's `section` uses, and the same property shapes, so a caller's\n // own border or radius replaces these through `mergeClasses` without a wrapper.\n backgroundColor: tokens.surfaceContainer,\n ...shorthands.borderWidth(tokens.borderWidthContainer),\n ...shorthands.borderStyle(\"solid\"),\n ...shorthands.borderColor(tokens.borderContainer),\n borderRadius: tokens.surfaceRadiusContainer,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n },\n // Griffel ancestor state selectors must be declared on the ancestor.\n rootCopyReveal: {\n \"&:hover [data-copy-state]\": { opacity: 1 },\n \"&:focus-within [data-copy-state]\": { opacity: 1 },\n },\n header: {\n display: \"flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement2),\n ...shorthands.paddingBlock(tokens.spacingElement1),\n ...shorthands.paddingInline(tokens.spacingElement2),\n // `borderBottom` expands to the three bottom-edge longhands; there is no per-edge width\n // helper, and a bare `borderBottomWidth: …` alongside a neighbour's `borderWidth` shorthand\n // is exactly the property-shape mismatch AGENTS.md rule 3 warns about.\n ...shorthands.borderBottom(\n tokens.borderWidthContainer,\n \"solid\",\n tokens.surfaceSep\n ),\n },\n // Reserve the overlay button's width when a caption is present.\n headerWithCopy: {\n paddingRight: `calc(1.75rem + ${tokens.spacingElement2} + ${tokens.spacingElement05})`,\n minHeight: `calc(1.75rem + ${tokens.spacingElement05} + ${tokens.spacingElement05})`,\n },\n title: {\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightMedium,\n color: tokens.grayA12,\n minWidth: 0,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n language: {\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n color: tokens.grayA11,\n // The language label names a machine format, so it stays in the code family rather than\n // inheriting the surrounding UI face.\n fontFamily: tokens.fontMono,\n whiteSpace: \"nowrap\",\n },\n headerSpacer: {\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n minWidth: 0,\n },\n // The button stays in the tab order while its paint is hidden.\n copy: {\n position: \"absolute\",\n top: tokens.spacingElement05,\n right: tokens.spacingElement05,\n zIndex: 1,\n backgroundColor: tokens.surfaceContainer,\n opacity: 0,\n transitionProperty: \"opacity\",\n transitionDuration: \"120ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0s\",\n },\n \"@media (hover: none)\": {\n opacity: 1,\n },\n // Focus and feedback must override the hidden resting state.\n \"&[data-copy-state='copied']\": { opacity: 1 },\n \"&[data-copy-state='error']\": { opacity: 1 },\n \"&:focus-visible\": { opacity: 1 },\n },\n pre: {\n ...shorthands.margin(0),\n ...shorthands.padding(tokens.spacingElement2),\n overflowX: \"auto\",\n overflowY: \"auto\",\n fontFamily: tokens.fontMono,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n color: tokens.grayA12,\n // `tab-size` is what makes a tab-indented source line up at all; 2 matches the indent the\n // editor inserts by default.\n tabSize: 2,\n outlineStyle: \"none\",\n // Declared after the base so the focus ring wins, per the ordering rule in AGENTS.md.\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"-2px\",\n outlineColor: tokens.focusRing,\n },\n },\n // Sticky numbers must pin flush to the scrollport.\n preGutter: {\n paddingLeft: 0,\n },\n preNoWrap: {\n whiteSpace: \"pre\",\n },\n preWrap: {\n whiteSpace: \"pre-wrap\",\n overflowWrap: \"break-word\",\n },\n code: {\n // `<code>` is inline by default, which collapses the numbered-line grid to one row.\n display: \"block\",\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n lineHeight: \"inherit\",\n },\n // Give sticky gutters and row bands the full width of unwrapped code.\n codeNoWrap: {\n width: \"max-content\",\n minWidth: \"100%\",\n },\n line: {\n display: \"flex\",\n width: \"100%\",\n // Avoid sticky touch-hover states; paint both cells because the gutter is opaque.\n \"@media (hover: hover)\": {\n [`&:hover [${SLOT_ATTR}='code-block-line-number'], &:hover [${SLOT_ATTR}='code-block-line-content']`]:\n {\n backgroundImage: `linear-gradient(${tokens.grayA2}, ${tokens.grayA2})`,\n },\n },\n },\n lineNumber: {\n // Not selectable, so dragging a selection across the block copies code and not a column of\n // integers. The copy button never sees these at all — it copies the original `code` string.\n userSelect: \"none\",\n textAlign: \"right\",\n flexGrow: 0,\n flexShrink: 0,\n color: tokens.grayA8,\n boxSizing: \"border-box\",\n width: `calc(var(${GUTTER}) + ${tokens.spacingElement2} + ${tokens.spacingElement3})`,\n paddingLeft: tokens.spacingElement2,\n paddingRight: tokens.spacingElement3,\n // Opaque because horizontally scrolled code passes beneath the sticky gutter.\n position: \"sticky\",\n left: 0,\n backgroundColor: tokens.surfaceContainer,\n },\n lineContent: {\n minWidth: 0,\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"auto\",\n },\n lineContentWrap: {\n overflowWrap: \"break-word\",\n },\n srOnly: {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n ...shorthands.padding(0),\n ...shorthands.margin(\"-1px\"),\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n },\n})\n\nconst CopyIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M5 15V5a2 2 0 0 1 2-2h10\" />\n </svg>\n)\n\nconst CheckIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <path d=\"m4 12.5 5 5 11-11\" />\n </svg>\n)\n\n/** Idle, or the outcome of the last copy attempt. Drives both the icon and the live region. */\ntype CopyState = \"idle\" | \"copied\" | \"error\"\n\nexport type CodeBlockProps = Omit<\n React.ComponentProps<\"div\">,\n \"children\" | \"title\"\n> & {\n /** The source to display. Rendered as text — never as markup, and never evaluated. */\n code: string\n /** Language grammar used for syntax highlighting, also shown in the header. */\n language?: string\n /**\n * Visible caption, typically a file name. Also names the scrollable code region.\n *\n * This replaces the native `title` attribute, which would have rendered a browser tooltip\n * instead of a caption.\n */\n title?: string\n /** Soft-wrap long lines instead of scrolling horizontally. */\n wrap?: boolean\n /**\n * Render a non-selectable line-number gutter, and give each row a hover band.\n *\n * Off by default. Numbers are wayfinding for prose that refers to a line by number; on a\n * four-line snippet they are a column of noise that also costs horizontal space.\n */\n showLineNumbers?: boolean\n /** Show the copy button. */\n copyable?: boolean\n /** Accessible name of the copy button. */\n copyLabel?: string\n /** Announced, and used as the button's name, after a successful copy. */\n copiedLabel?: string\n /** Announced, and used as the button's name, when the clipboard is unavailable or refuses. */\n copyErrorLabel?: string\n /** Called with the exact string written to the clipboard. */\n onCopy?: (code: string) => void\n /** Called when the clipboard write failed or was unavailable. */\n onCopyError?: (error: unknown) => void\n}\n\nexport const CodeBlock = React.forwardRef<HTMLDivElement, CodeBlockProps>(\n function CodeBlock(\n {\n code,\n language,\n title,\n wrap = false,\n showLineNumbers = false,\n copyable = false,\n copyLabel = \"Copy code\",\n copiedLabel = \"Copied\",\n copyErrorLabel = \"Copy failed\",\n onCopy,\n onCopyError,\n className,\n style,\n ...props\n },\n ref\n ) {\n const styles = useStyles()\n const reactId = React.useId()\n const titleId = `${reactId}-title`\n\n const [copyState, setCopyState] = React.useState<CopyState>(\"idle\")\n const resetTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n React.useEffect(\n () => () => {\n if (resetTimer.current !== null) clearTimeout(resetTimer.current)\n },\n []\n )\n\n const handleCopy = React.useCallback(async () => {\n // Read the clipboard off `navigator` at click time, never at import or render time: this is\n // the only browser-only access in the component, and an event handler cannot run on a\n // server. A missing or rejecting clipboard is an ordinary outcome here (insecure origin,\n // denied permission, older browser), not an exception to propagate.\n let failure: unknown = null\n try {\n const clipboard =\n typeof navigator === \"undefined\" ? undefined : navigator.clipboard\n if (typeof clipboard?.writeText !== \"function\") {\n failure = new Error(\"Clipboard API unavailable\")\n } else {\n await clipboard.writeText(code)\n }\n } catch (error) {\n failure = error ?? new Error(\"Clipboard write rejected\")\n }\n\n if (failure === null) onCopy?.(code)\n else onCopyError?.(failure)\n\n setCopyState(failure === null ? \"copied\" : \"error\")\n if (resetTimer.current !== null) clearTimeout(resetTimer.current)\n resetTimer.current = setTimeout(() => {\n resetTimer.current = null\n setCopyState(\"idle\")\n }, COPY_FEEDBACK_MS)\n }, [code, onCopy, onCopyError])\n\n // One trailing newline is an artefact of how source files end, not a line the reader should\n // see numbered and empty. The clipboard still gets `code` byte for byte.\n const displayed = code.endsWith(\"\\n\") ? code.slice(0, -1) : code\n const renderTokens = useCodeTokenRenderer()\n\n // Tokenized once per (source, language). Synchronous by construction, so the server render and\n // the first client render produce identical markup and hydration has nothing to reconcile.\n const highlighted = React.useMemo(\n () => highlightCode(displayed, language),\n [displayed, language]\n )\n\n // Two shapes, because the gutter needs rows: a plain string or a token run when there are no\n // line numbers, and one entry per line when there are.\n const plainLines = React.useMemo(\n () => (showLineNumbers ? displayed.split(\"\\n\") : null),\n [displayed, showLineNumbers]\n )\n const tokenLines = React.useMemo(\n () =>\n showLineNumbers && highlighted !== null\n ? splitTokenLines(highlighted)\n : null,\n [highlighted, showLineNumbers]\n )\n\n // An empty string is not a caption. Normalised once, so the header, the caption element and\n // the region's name can never disagree about whether there is one — labelling the region by an\n // empty caption would name it with nothing, which is worse than leaving it unnamed.\n const hasTitle = title !== undefined && title !== \"\"\n const hasLanguage = language !== undefined && language !== \"\"\n\n const ariaLabel = props[\"aria-label\"]\n const ariaLabelledBy = props[\"aria-labelledby\"]\n // A region needs a name. Prefer the caption the reader can see, then whatever the caller\n // supplied; with none of the three, stay focusable but claim no landmark.\n const labelledBy = hasTitle ? titleId : ariaLabelledBy\n const named = labelledBy !== undefined || ariaLabel !== undefined\n\n const copyStatusLabel =\n copyState === \"copied\"\n ? copiedLabel\n : copyState === \"error\"\n ? copyErrorLabel\n : copyLabel\n\n // A header exists for content. A copy button is an overlay and does not summon one — that is\n // what lets `<CodeBlock code copyable />` reserve no vertical space for chrome at all.\n const showHeader = hasTitle || hasLanguage\n\n const gutterStyle =\n plainLines === null\n ? style\n : ({\n [GUTTER]: `${gutterDigits(plainLines.length)}ch`,\n ...style,\n } as React.CSSProperties)\n\n return (\n <div\n ref={ref}\n data-slot=\"code-block\"\n {...{ [SLOT_ATTR]: \"code-block\" }}\n data-language={language}\n className={mergeClasses(\n styles.root,\n copyable ? styles.rootCopyReveal : undefined,\n className\n )}\n style={gutterStyle}\n {...props}\n aria-label={undefined}\n aria-labelledby={undefined}\n >\n {showHeader ? (\n <div\n data-slot=\"code-block-header\"\n {...{ [SLOT_ATTR]: \"code-block-header\" }}\n className={mergeClasses(\n styles.header,\n copyable ? styles.headerWithCopy : undefined\n )}\n >\n {hasTitle ? (\n <span\n id={titleId}\n data-slot=\"code-block-title\"\n {...{ [SLOT_ATTR]: \"code-block-title\" }}\n className={styles.title}\n >\n {title}\n </span>\n ) : null}\n {hasLanguage ? (\n <span\n data-slot=\"code-block-language\"\n {...{ [SLOT_ATTR]: \"code-block-language\" }}\n className={styles.language}\n >\n {language}\n </span>\n ) : null}\n <span className={styles.headerSpacer} />\n </div>\n ) : null}\n\n {copyable ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n // Button keeps its OWN slot markers, the way Callout leaves the ClearButton it\n // composes alone: a Button stays a Button, and a rule written against the button\n // slot must still reach this one. `data-copy-state` is the handle for this\n // button specifically, and it carries the state a caller would want to select on.\n data-copy-state={copyState}\n aria-label={copyStatusLabel}\n className={styles.copy}\n onClick={handleCopy}\n >\n {copyState === \"copied\" ? <CheckIcon /> : <CopyIcon />}\n </Button>\n ) : null}\n\n <pre\n data-slot=\"code-block-content\"\n {...{ [SLOT_ATTR]: \"code-block-content\" }}\n // Always reachable: this is the scroll container, and a pointer must not be the only\n // way to scroll it.\n tabIndex={0}\n role={named ? \"region\" : undefined}\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n className={mergeClasses(\n styles.pre,\n plainLines === null ? undefined : styles.preGutter,\n wrap ? styles.preWrap : styles.preNoWrap\n )}\n >\n <code\n data-slot=\"code-block-code\"\n {...{ [SLOT_ATTR]: \"code-block-code\" }}\n className={mergeClasses(\n styles.code,\n plainLines !== null && !wrap ? styles.codeNoWrap : undefined\n )}\n >\n {plainLines === null\n ? // No gutter: one run, highlighted if we have a grammar, otherwise the raw string.\n highlighted === null\n ? displayed\n : renderTokens(highlighted)\n : plainLines.map((line, index) => (\n <span\n // Lines have no identity beyond their position, and the whole block\n // re-renders when `code` changes, so the index is the key.\n key={index}\n data-slot=\"code-block-line\"\n {...{ [SLOT_ATTR]: \"code-block-line\" }}\n data-line={index + 1}\n className={styles.line}\n >\n <span\n aria-hidden=\"true\"\n data-slot=\"code-block-line-number\"\n {...{ [SLOT_ATTR]: \"code-block-line-number\" }}\n className={styles.lineNumber}\n >\n {index + 1}\n </span>\n <span\n data-slot=\"code-block-line-content\"\n {...{ [SLOT_ATTR]: \"code-block-line-content\" }}\n className={mergeClasses(\n styles.lineContent,\n wrap ? styles.lineContentWrap : undefined\n )}\n >\n {/* `tokenLines` is the same text as `plainLines`, split by the same\n newlines — `splitTokenLines` round-trips — so the row count matches and\n the index is safe. Falls back to the plain line when there is no\n grammar. */}\n {tokenLines === null\n ? line\n : renderTokens(tokenLines[index] ?? [])}\n {/* The newline keeps a dragged selection line-separated, exactly as the\n unnumbered rendering is. */}\n {\"\\n\"}\n </span>\n </span>\n ))}\n </code>\n </pre>\n\n {copyable ? (\n <span\n role=\"status\"\n aria-live=\"polite\"\n data-slot=\"code-block-copy-status\"\n {...{ [SLOT_ATTR]: \"code-block-copy-status\" }}\n className={styles.srOnly}\n >\n {copyState === \"idle\" ? \"\" : copyStatusLabel}\n </span>\n ) : null}\n </div>\n )\n }\n)\n"],"names":["COPY_FEEDBACK_MS","GUTTER","useStyles","makeZenithStyles","tokens.surfaceContainer","shorthands","tokens.borderWidthContainer","tokens.borderContainer","tokens.surfaceRadiusContainer","tokens.spacingElement2","tokens.spacingElement1","tokens.surfaceSep","tokens.spacingElement05","tokens.textXs","tokens.leadingXs","tokens.fontWeightMedium","tokens.grayA12","tokens.grayA11","tokens.fontMono","tokens.focusRing","SLOT_ATTR","tokens.grayA2","tokens.grayA8","tokens.spacingElement3","CopyIcon","props","jsxs","jsx","CheckIcon","CodeBlock","React","code","language","title","wrap","showLineNumbers","copyable","copyLabel","copiedLabel","copyErrorLabel","onCopy","onCopyError","className","style","ref","styles","titleId","copyState","setCopyState","resetTimer","handleCopy","failure","clipboard","error","displayed","renderTokens","useCodeTokenRenderer","highlighted","highlightCode","plainLines","tokenLines","splitTokenLines","hasTitle","hasLanguage","ariaLabel","ariaLabelledBy","labelledBy","named","copyStatusLabel","showHeader","gutterStyle","gutterDigits","mergeClasses","Button","line","index"],"mappings":";;;;;;;;;AAiBA,MAAMA,KAAmB,KAGnBC,IAAS,wBAETC,KAAYC,GAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,eAAe;AAAA,IACf,UAAU;AAAA,IACV,UAAU;AAAA;AAAA;AAAA,IAGV,iBAAiBC;AAAAA,IACjB,GAAGC,EAAW,YAAYC,CAA2B;AAAA,IACrD,GAAGD,EAAW,YAAY,OAAO;AAAA,IACjC,GAAGA,EAAW,YAAYE,EAAsB;AAAA,IAChD,cAAcC;AAAAA,IACd,WAAW;AAAA,IACX,WAAW;AAAA,EAAA;AAAA;AAAA,EAGb,gBAAgB;AAAA,IACd,6BAA6B,EAAE,SAAS,EAAA;AAAA,IACxC,oCAAoC,EAAE,SAAS,EAAA;AAAA,EAAE;AAAA,EAEnD,QAAQ;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAGH,EAAW,IAAII,CAAsB;AAAA,IACxC,GAAGJ,EAAW,aAAaK,EAAsB;AAAA,IACjD,GAAGL,EAAW,cAAcI,CAAsB;AAAA;AAAA;AAAA;AAAA,IAIlD,GAAGJ,EAAW;AAAA,MACZC;AAAAA,MACA;AAAA,MACAK;AAAAA,IAAO;AAAA,EACT;AAA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AA,IAAA;AAAA,EAGV;AACF;"}
@@ -2,7 +2,7 @@ import { jsxs as j, jsx as n } from "react/jsx-runtime";
2
2
  import * as t from "react";
3
3
  import { mergeClasses as m, SLOT_ATTR as c, shorthands as l } from "@epilot/zenith-runtime/v1";
4
4
  import { makeZenithStyles as it } from "../../styles/make-styles.js";
5
- import { leadingXs as le, spacingElement2 as k, surfaceField as oe, spacingElement05 as ze, info11 as nt, warning11 as lt, error11 as at, semInfoUi as st, semWarningUi as ct, semErrorUi as De, grayA12 as _, spacingElement3 as ie, grayA8 as ne, grayA2 as We, accentA5 as dt, fontWeightNormal as ut, trackingNormal as ft, textXs as ht, fontMono as gt, grayA3 as Re, semFocusRing as mt, surfaceRadiusField as pt, borderField as vt, borderWidthField as bt } from "../../tokens/index.js";
5
+ import { leadingXs as le, spacingElement2 as k, surfaceField as oe, spacingElement05 as ze, info11 as nt, warning11 as lt, error11 as at, infoUi as st, warningUi as ct, errorUi as De, grayA12 as _, spacingElement3 as ie, grayA8 as ne, grayA2 as We, accentA5 as dt, fontWeightNormal as ut, trackingNormal as ft, textXs as ht, fontMono as gt, grayA3 as Re, focusRing as mt, surfaceRadiusField as pt, borderField as vt, borderWidthField as bt } from "../../tokens/index.js";
6
6
  import { Button as yt } from "../button/button.js";
7
7
  import { applyIndent as kt } from "./indent.js";
8
8
  import { highlightCode as xt, splitTokenLines as St } from "../../lib/code-highlight.js";