@42-central/ui-react 0.25.0 → 0.27.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 (232) hide show
  1. package/dist/{chunk-YZJUPYPO.js → chunk-2W7H43WL.js} +3 -3
  2. package/dist/{chunk-YZJUPYPO.js.map → chunk-2W7H43WL.js.map} +1 -1
  3. package/dist/{chunk-NLSJ6T7V.js → chunk-4D2V4JE4.js} +3 -3
  4. package/dist/{chunk-NLSJ6T7V.js.map → chunk-4D2V4JE4.js.map} +1 -1
  5. package/dist/{chunk-QZ4N5LYG.js → chunk-5H5YOPCF.js} +3 -3
  6. package/dist/{chunk-QZ4N5LYG.js.map → chunk-5H5YOPCF.js.map} +1 -1
  7. package/dist/{chunk-6II2DVYR.js → chunk-7KFUFAVP.js} +4 -4
  8. package/dist/{chunk-6II2DVYR.js.map → chunk-7KFUFAVP.js.map} +1 -1
  9. package/dist/{chunk-XUFCI262.js → chunk-7OGZT7U2.js} +12 -4
  10. package/dist/chunk-7OGZT7U2.js.map +1 -0
  11. package/dist/{chunk-PI7X5YFJ.js → chunk-BGDVUC3B.js} +5 -5
  12. package/dist/{chunk-PI7X5YFJ.js.map → chunk-BGDVUC3B.js.map} +1 -1
  13. package/dist/{chunk-7247WBTV.js → chunk-DJ72KP32.js} +3 -3
  14. package/dist/{chunk-7247WBTV.js.map → chunk-DJ72KP32.js.map} +1 -1
  15. package/dist/{chunk-FZSLSUSX.js → chunk-HCHGERDB.js} +3 -3
  16. package/dist/{chunk-FZSLSUSX.js.map → chunk-HCHGERDB.js.map} +1 -1
  17. package/dist/{chunk-H7WOMZXO.js → chunk-HWBFRDX7.js} +16 -8
  18. package/dist/chunk-HWBFRDX7.js.map +1 -0
  19. package/dist/{chunk-HQPU73WV.js → chunk-I4IJOLNA.js} +4 -4
  20. package/dist/{chunk-HQPU73WV.js.map → chunk-I4IJOLNA.js.map} +1 -1
  21. package/dist/{chunk-UDCCOUWR.js → chunk-IA6DCC3N.js} +6 -6
  22. package/dist/{chunk-UDCCOUWR.js.map → chunk-IA6DCC3N.js.map} +1 -1
  23. package/dist/{chunk-36NWC4GV.js → chunk-ISX3AM32.js} +3 -3
  24. package/dist/{chunk-36NWC4GV.js.map → chunk-ISX3AM32.js.map} +1 -1
  25. package/dist/{chunk-LMCUGYHT.js → chunk-L24N5EON.js} +6 -6
  26. package/dist/chunk-L24N5EON.js.map +1 -0
  27. package/dist/{chunk-HRNWWL3Y.js → chunk-L5GH7LLD.js} +61 -29
  28. package/dist/chunk-L5GH7LLD.js.map +1 -0
  29. package/dist/chunk-LJVIZNPE.js +9 -0
  30. package/dist/chunk-LJVIZNPE.js.map +1 -0
  31. package/dist/{chunk-AHKMN3YQ.js → chunk-MCRTAUSZ.js} +6 -6
  32. package/dist/chunk-MCRTAUSZ.js.map +1 -0
  33. package/dist/{chunk-LHUWOA2U.js → chunk-MNYY7UU2.js} +6 -6
  34. package/dist/{chunk-LHUWOA2U.js.map → chunk-MNYY7UU2.js.map} +1 -1
  35. package/dist/{chunk-7HZBD4YZ.js → chunk-NF2PBGD3.js} +36 -23
  36. package/dist/chunk-NF2PBGD3.js.map +1 -0
  37. package/dist/{chunk-54W6VAI3.js → chunk-NNPSBC7O.js} +5 -5
  38. package/dist/{chunk-54W6VAI3.js.map → chunk-NNPSBC7O.js.map} +1 -1
  39. package/dist/{chunk-MW42XVPD.js → chunk-PBSVX5DB.js} +15 -5
  40. package/dist/chunk-PBSVX5DB.js.map +1 -0
  41. package/dist/{chunk-2CL3FKEY.js → chunk-QEMXXQQO.js} +3 -3
  42. package/dist/{chunk-2CL3FKEY.js.map → chunk-QEMXXQQO.js.map} +1 -1
  43. package/dist/{chunk-6UIQJJNJ.js → chunk-QRNQQIQM.js} +5 -5
  44. package/dist/{chunk-6UIQJJNJ.js.map → chunk-QRNQQIQM.js.map} +1 -1
  45. package/dist/{chunk-N66NC6QK.js → chunk-RKCUXOU2.js} +4 -4
  46. package/dist/{chunk-N66NC6QK.js.map → chunk-RKCUXOU2.js.map} +1 -1
  47. package/dist/{chunk-N5M4PDBK.js → chunk-SBZJGFZ6.js} +3 -3
  48. package/dist/{chunk-N5M4PDBK.js.map → chunk-SBZJGFZ6.js.map} +1 -1
  49. package/dist/{chunk-7P32XCEU.js → chunk-SLUOF7XW.js} +2 -2
  50. package/dist/chunk-SLUOF7XW.js.map +1 -0
  51. package/dist/{chunk-SAXWCGWR.js → chunk-SOUDKESO.js} +14 -7
  52. package/dist/chunk-SOUDKESO.js.map +1 -0
  53. package/dist/{chunk-T44RW5DW.js → chunk-ULF5LOBS.js} +4 -4
  54. package/dist/{chunk-T44RW5DW.js.map → chunk-ULF5LOBS.js.map} +1 -1
  55. package/dist/components/ambient-background/index.js +9 -23
  56. package/dist/components/ambient-background/index.js.map +1 -1
  57. package/dist/components/ambient-background/starfield.d.ts.map +1 -1
  58. package/dist/components/app-shell/app-shell.d.ts +55 -10
  59. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  60. package/dist/components/app-shell/index.d.ts +1 -1
  61. package/dist/components/app-shell/index.d.ts.map +1 -1
  62. package/dist/components/app-shell/index.js +299 -38
  63. package/dist/components/app-shell/index.js.map +1 -1
  64. package/dist/components/autocomplete/index.js +4 -4
  65. package/dist/components/avatar/avatar.d.ts +1 -1
  66. package/dist/components/avatar/avatar.d.ts.map +1 -1
  67. package/dist/components/avatar/index.js +10 -1
  68. package/dist/components/avatar/index.js.map +1 -1
  69. package/dist/components/button-group/button-group.d.ts +10 -2
  70. package/dist/components/button-group/button-group.d.ts.map +1 -1
  71. package/dist/components/button-group/index.js +1 -1
  72. package/dist/components/button-multi-select/index.js +2 -2
  73. package/dist/components/button-select/button-select-control.d.ts +4 -1
  74. package/dist/components/button-select/button-select-control.d.ts.map +1 -1
  75. package/dist/components/button-select/button-select.d.ts +4 -1
  76. package/dist/components/button-select/button-select.d.ts.map +1 -1
  77. package/dist/components/button-select/index.js +2 -2
  78. package/dist/components/calendar-heatmap/index.js +2 -2
  79. package/dist/components/camera/index.js +6 -6
  80. package/dist/components/code-block/chrome.js +5 -5
  81. package/dist/components/code-block/index.js +6 -6
  82. package/dist/components/combobox/index.js +4 -4
  83. package/dist/components/combobox-list/index.js +6 -6
  84. package/dist/components/data-table/data-table-features.d.ts +8 -0
  85. package/dist/components/data-table/data-table-features.d.ts.map +1 -1
  86. package/dist/components/data-table/data-table-group.d.ts +128 -0
  87. package/dist/components/data-table/data-table-group.d.ts.map +1 -0
  88. package/dist/components/data-table/data-table-grouping.d.ts +72 -0
  89. package/dist/components/data-table/data-table-grouping.d.ts.map +1 -0
  90. package/dist/components/data-table/data-table-icons.d.ts +4 -2
  91. package/dist/components/data-table/data-table-icons.d.ts.map +1 -1
  92. package/dist/components/data-table/data-table-meta.d.ts +9 -0
  93. package/dist/components/data-table/data-table-meta.d.ts.map +1 -1
  94. package/dist/components/data-table/data-table-pagination.d.ts +4 -1
  95. package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
  96. package/dist/components/data-table/data-table-schema.d.ts +4 -0
  97. package/dist/components/data-table/data-table-schema.d.ts.map +1 -1
  98. package/dist/components/data-table/data-table-stack.d.ts +16 -3
  99. package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
  100. package/dist/components/data-table/data-table-toolbar.d.ts +33 -2
  101. package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
  102. package/dist/components/data-table/data-table-translations.d.ts +35 -0
  103. package/dist/components/data-table/data-table-translations.d.ts.map +1 -1
  104. package/dist/components/data-table/data-table.d.ts +55 -3
  105. package/dist/components/data-table/data-table.d.ts.map +1 -1
  106. package/dist/components/data-table/index.d.ts +3 -1
  107. package/dist/components/data-table/index.d.ts.map +1 -1
  108. package/dist/components/data-table/index.js +878 -230
  109. package/dist/components/data-table/index.js.map +1 -1
  110. package/dist/components/date-picker/index.js +8 -8
  111. package/dist/components/drawer/index.js +4 -4
  112. package/dist/components/geodesic/a11y.d.ts +3 -3
  113. package/dist/components/geodesic/a11y.d.ts.map +1 -1
  114. package/dist/components/geodesic/badge-frame.d.ts +13 -1
  115. package/dist/components/geodesic/badge-frame.d.ts.map +1 -1
  116. package/dist/components/geodesic/exam-badge.d.ts +4 -1
  117. package/dist/components/geodesic/exam-badge.d.ts.map +1 -1
  118. package/dist/components/geodesic/geometry.d.ts +14 -9
  119. package/dist/components/geodesic/geometry.d.ts.map +1 -1
  120. package/dist/components/geodesic/index.js +62 -23
  121. package/dist/components/geodesic/index.js.map +1 -1
  122. package/dist/components/geodesic/status.d.ts +8 -6
  123. package/dist/components/geodesic/status.d.ts.map +1 -1
  124. package/dist/components/geodesic/styles.css +15 -2
  125. package/dist/components/hover-card/index.js +3 -3
  126. package/dist/components/indicator/index.js +23 -8
  127. package/dist/components/indicator/index.js.map +1 -1
  128. package/dist/components/indicator/indicator.d.ts +15 -6
  129. package/dist/components/indicator/indicator.d.ts.map +1 -1
  130. package/dist/components/kbd/index.js +3 -3
  131. package/dist/components/lightbox/index.js +4 -4
  132. package/dist/components/menu/index.js +4 -4
  133. package/dist/components/modal/index.js +4 -4
  134. package/dist/components/multi-combobox-list/index.js +6 -6
  135. package/dist/components/multi-select/index.js +4 -4
  136. package/dist/components/nav-link/index.js +5 -1
  137. package/dist/components/nav-link/nav-link.d.ts.map +1 -1
  138. package/dist/components/nav-link/tanstack.js +5 -1
  139. package/dist/components/nav-link/tanstack.js.map +1 -1
  140. package/dist/components/notification/create-notifier.d.ts.map +1 -1
  141. package/dist/components/notification/index.js +15 -3
  142. package/dist/components/notification/index.js.map +1 -1
  143. package/dist/components/notification/types.d.ts +5 -0
  144. package/dist/components/notification/types.d.ts.map +1 -1
  145. package/dist/components/number-input/index.js +4 -4
  146. package/dist/components/overlays/index.js +5 -5
  147. package/dist/components/photo-capture/index.js +6 -6
  148. package/dist/components/popover/index.js +3 -3
  149. package/dist/components/schedule/index.js +4 -4
  150. package/dist/components/segment-group/index.js +1 -1
  151. package/dist/components/segment-group/segment-group.d.ts +6 -1
  152. package/dist/components/segment-group/segment-group.d.ts.map +1 -1
  153. package/dist/components/select/index.js +5 -5
  154. package/dist/components/spotlight/index.js +8 -8
  155. package/dist/components/tabs/index.js +1 -1
  156. package/dist/components/tabs/tabs-data.d.ts +4 -1
  157. package/dist/components/tabs/tabs-data.d.ts.map +1 -1
  158. package/dist/components/tabs/tabs.d.ts +4 -1
  159. package/dist/components/tabs/tabs.d.ts.map +1 -1
  160. package/dist/components/tags-input/index.js +3 -3
  161. package/dist/components/time-input/index.js +6 -6
  162. package/dist/components/tooltip/index.js +2 -2
  163. package/dist/components/tree-multi-select/index.js +4 -4
  164. package/dist/components/tree-select/index.js +4 -4
  165. package/dist/index.js +2 -2
  166. package/dist/lib/overlay-container.d.ts.map +1 -1
  167. package/dist/lib/overlay-layer.d.ts +10 -3
  168. package/dist/lib/overlay-layer.d.ts.map +1 -1
  169. package/dist/lib/sidebar-rail.d.ts +21 -0
  170. package/dist/lib/sidebar-rail.d.ts.map +1 -0
  171. package/dist/theme.css +21 -18
  172. package/package.json +1 -1
  173. package/src/as-child.contract.test.tsx +6 -0
  174. package/src/components/ambient-background/starfield.tsx +14 -41
  175. package/src/components/app-shell/app-shell.test.tsx +430 -5
  176. package/src/components/app-shell/app-shell.tsx +484 -24
  177. package/src/components/app-shell/index.ts +2 -0
  178. package/src/components/avatar/avatar.test.tsx +12 -0
  179. package/src/components/avatar/avatar.tsx +9 -0
  180. package/src/components/button-group/button-group.test.tsx +24 -0
  181. package/src/components/button-group/button-group.tsx +21 -4
  182. package/src/components/button-multi-select/button-multi-select.test.tsx +15 -0
  183. package/src/components/button-select/button-select-control.tsx +5 -0
  184. package/src/components/button-select/button-select.test.tsx +25 -0
  185. package/src/components/button-select/button-select.tsx +13 -2
  186. package/src/components/data-table/data-table-features.ts +11 -0
  187. package/src/components/data-table/data-table-group.test.tsx +1007 -0
  188. package/src/components/data-table/data-table-group.tsx +474 -0
  189. package/src/components/data-table/data-table-grouping.ts +160 -0
  190. package/src/components/data-table/data-table-icons.tsx +8 -1
  191. package/src/components/data-table/data-table-meta.ts +9 -0
  192. package/src/components/data-table/data-table-pagination.tsx +5 -1
  193. package/src/components/data-table/data-table-stack.tsx +165 -43
  194. package/src/components/data-table/data-table-toolbar.tsx +110 -2
  195. package/src/components/data-table/data-table-translations.ts +44 -0
  196. package/src/components/data-table/data-table.tsx +420 -150
  197. package/src/components/data-table/index.ts +4 -0
  198. package/src/components/drawer/drawer.tsx +1 -1
  199. package/src/components/geodesic/badge-frame.tsx +67 -13
  200. package/src/components/geodesic/exam-badge.tsx +8 -4
  201. package/src/components/geodesic/geometry.ts +8 -6
  202. package/src/components/geodesic/status.test.ts +11 -2
  203. package/src/components/geodesic/status.ts +11 -7
  204. package/src/components/geodesic/styles.css +15 -2
  205. package/src/components/indicator/indicator.test.tsx +45 -0
  206. package/src/components/indicator/indicator.tsx +40 -13
  207. package/src/components/modal/modal.tsx +1 -1
  208. package/src/components/nav-link/nav-link.test.tsx +121 -1
  209. package/src/components/nav-link/nav-link.tsx +78 -29
  210. package/src/components/notification/create-notifier.tsx +18 -2
  211. package/src/components/notification/notify-in-modal.test.tsx +128 -0
  212. package/src/components/notification/types.ts +5 -0
  213. package/src/components/segment-group/segment-group.test.tsx +22 -0
  214. package/src/components/segment-group/segment-group.tsx +35 -19
  215. package/src/components/tabs/tabs-data.tsx +5 -1
  216. package/src/components/tabs/tabs.test.tsx +28 -0
  217. package/src/components/tabs/tabs.tsx +14 -4
  218. package/src/lib/overlay-container.tsx +2 -1
  219. package/src/lib/overlay-layer.test.tsx +63 -1
  220. package/src/lib/overlay-layer.tsx +29 -6
  221. package/src/lib/sidebar-rail.ts +24 -0
  222. package/src/theme.css +21 -18
  223. package/src/theme.test.ts +14 -11
  224. package/dist/chunk-7HZBD4YZ.js.map +0 -1
  225. package/dist/chunk-7P32XCEU.js.map +0 -1
  226. package/dist/chunk-AHKMN3YQ.js.map +0 -1
  227. package/dist/chunk-H7WOMZXO.js.map +0 -1
  228. package/dist/chunk-HRNWWL3Y.js.map +0 -1
  229. package/dist/chunk-LMCUGYHT.js.map +0 -1
  230. package/dist/chunk-MW42XVPD.js.map +0 -1
  231. package/dist/chunk-SAXWCGWR.js.map +0 -1
  232. package/dist/chunk-XUFCI262.js.map +0 -1
@@ -8,6 +8,8 @@ export type {
8
8
  ColumnFiltersState,
9
9
  ColumnSizingState,
10
10
  ColumnVisibilityState,
11
+ ExpandedState,
12
+ GroupingState,
11
13
  OnChangeFn,
12
14
  PaginationState,
13
15
  RowSelectionState,
@@ -40,6 +42,8 @@ export {
40
42
  type HeaderContext,
41
43
  type Row,
42
44
  } from "./data-table-features"
45
+ export type { DataTableGroupHeaderContext, DataTableGroupShowMore } from "./data-table-group"
46
+ export type { DataTableGroup } from "./data-table-grouping"
43
47
  export type {
44
48
  DataTableIconSlot,
45
49
  DataTableIcons,
@@ -201,7 +201,7 @@ const DrawerRoot = ({
201
201
  >
202
202
  {/* A layer itself, registered with whatever it opened from (the page,
203
203
  or an enclosing overlay), so what's under it knows it's covered. */}
204
- <Ark.Context>{(api) => <NestedLayer open={api.open} />}</Ark.Context>
204
+ <Ark.Context>{(api) => <NestedLayer open={api.open} modal />}</Ark.Context>
205
205
  <DrawerPlacementContext value={placement}>
206
206
  <DialogRootProviders icons={icons} layers={guard.layers}>
207
207
  {children}
@@ -11,6 +11,7 @@ import {
11
11
  fillLevel,
12
12
  type Hue,
13
13
  hueOf,
14
+ inProgressShare,
14
15
  liquidFadeWidth,
15
16
  paint,
16
17
  type Tone,
@@ -28,6 +29,8 @@ export type SolidData = {
28
29
  readonly hidden: string
29
30
  readonly hull: string
30
31
  readonly details: string
32
+ /** The facet (index) a corner fill grows on, and the corner it grows from. */
33
+ readonly cap?: { readonly facet: number; readonly origin: readonly [number, number] }
31
34
  }
32
35
 
33
36
  export type BadgeTile =
@@ -63,6 +66,13 @@ type BadgeFrameProps = BadgeBaseProps & {
63
66
  locked: "wire" | "silhouette"
64
67
  /** Dotted connectors drawn between the solids (the social badge). */
65
68
  links?: string
69
+ /**
70
+ * How progress fills the solid: `liquid` rises through every face from the
71
+ * bottom; `corner` grows a square on the solid's cap from its front corner
72
+ * (the exam), so its sides lengthen with progress. `corner` needs a solid
73
+ * with a `cap`.
74
+ */
75
+ fill?: "liquid" | "corner"
66
76
  }
67
77
 
68
78
  const VIEWBOX = "0 0 64 64"
@@ -130,14 +140,14 @@ function Solid({
130
140
  hue,
131
141
  progress,
132
142
  locked,
133
- }: {
134
- solid: SolidData
135
- status: BadgeStatus
136
- hue: Hue
137
- progress: number
138
- locked: "wire" | "silhouette"
139
- }) {
140
- const lit = <LiquidSolid solid={solid} status={status} hue={hue} progress={progress} />
143
+ fill,
144
+ }: SolidProps & { locked: "wire" | "silhouette"; fill: "liquid" | "corner" }) {
145
+ const lit =
146
+ fill === "corner" && solid.cap ? (
147
+ <CornerSolid solid={solid} status={status} hue={hue} progress={progress} />
148
+ ) : (
149
+ <LiquidSolid solid={solid} status={status} hue={hue} progress={progress} />
150
+ )
141
151
  if (locked === "wire") return lit
142
152
  // The silhouette and the solid are both kept mounted and cross-faded, so
143
153
  // locking and unlocking ease like every other status change.
@@ -168,9 +178,11 @@ function Wires({ solid, status, hue }: Omit<SolidProps, "progress">) {
168
178
  const done = status === "done"
169
179
  // Done glints over its own faces, the same on either page; the bare
170
180
  // wireframe takes one step darker on a light page, just enough to show.
181
+ // Failed burns a deeper red, so the closed, glowing tile still reads as a
182
+ // fault rather than a pale "available".
171
183
  const wire = done
172
184
  ? paint(hue, [200, 200], 50)
173
- : paint(hue, status === "locked" ? [400, 400] : [200, 400])
185
+ : paint(hue, status === "locked" ? [400, 400] : status === "failed" ? [400, 500] : [200, 400])
174
186
  return (
175
187
  <>
176
188
  {!done && solid.hidden && (
@@ -236,6 +248,44 @@ function LiquidSolid({ solid, status, hue, progress }: SolidProps) {
236
248
  )
237
249
  }
238
250
 
251
+ /**
252
+ * The corner fill: the faces light as a whole (in progress lights the sides
253
+ * and leaves the cap dim), and a copy of the cap, scaled from its front
254
+ * corner by progress, is the level — Figma's "Niveau" square. Scaling keeps
255
+ * it a square on the cap at every value, and its side, not its area, tracks
256
+ * progress. The first frame renders it at 0, so it grows when it appears.
257
+ */
258
+ function CornerSolid({ solid, status, hue, progress }: SolidProps) {
259
+ const cap = solid.cap
260
+ const capFacet = cap && solid.facets[cap.facet]
261
+ const lit = status === "done" || status === "in-progress"
262
+ const share =
263
+ status === "done" ? 1 : status === "in-progress" ? inProgressShare(progress) / 100 : 0
264
+ const scale = useSettled(0, share)
265
+ if (!cap || !capFacet) return null
266
+ return (
267
+ <g>
268
+ {solid.facets.map((facet) => (
269
+ <polygon
270
+ key={facet.points}
271
+ points={facet.points}
272
+ fill={faceFill(hue, facet === capFacet && lit ? "available" : status, facet.tone)}
273
+ />
274
+ ))}
275
+ <polygon
276
+ className="geodesic-cap"
277
+ points={capFacet.points}
278
+ fill={faceFill(hue, lit ? status : "in-progress", capFacet.tone)}
279
+ style={{
280
+ transformOrigin: `${cap.origin[0]}px ${cap.origin[1]}px`,
281
+ transform: `scale(${scale})`,
282
+ }}
283
+ />
284
+ <Wires solid={solid} status={status} hue={hue} />
285
+ </g>
286
+ )
287
+ }
288
+
239
289
  /**
240
290
  * Draws any statused badge: a tile, one or more solids, and what the status
241
291
  * adds (lock, glow). The per-shape components only pick the geometry
@@ -254,16 +304,19 @@ export function BadgeFrame({
254
304
  progress = 50,
255
305
  locked,
256
306
  links,
307
+ fill = "liquid",
257
308
  }: BadgeFrameProps) {
258
309
  const hue = hueOf(status, doneHue)
259
310
  const done = status === "done"
311
+ // Done and failed are both over: a closed tile and a glow, in their own hue.
312
+ const closed = done || status === "failed"
260
313
  const tileFill =
261
314
  // Locked is a fully transparent tint, not `none`, so the fill can ease in.
262
- paint(hue, [500, 500], status === "locked" ? 0 : done ? 20 : status === "available" ? 22 : 16)
315
+ paint(hue, [500, 500], status === "locked" ? 0 : closed ? 20 : status === "available" ? 22 : 16)
263
316
  const tileStroke =
264
317
  status === "locked"
265
318
  ? paint("neutral", [500, 400])
266
- : done
319
+ : closed
267
320
  ? paint(hue, [400, 400])
268
321
  : paint(hue, [400, 400], 65)
269
322
 
@@ -277,7 +330,7 @@ export function BadgeFrame({
277
330
  width: size,
278
331
  height: size,
279
332
  flex: "none",
280
- filter: done ? `drop-shadow(0 0 ${size * 0.09}px ${tint(hue, 500, 55)})` : undefined,
333
+ filter: closed ? `drop-shadow(0 0 ${size * 0.09}px ${tint(hue, 500, 55)})` : undefined,
281
334
  ...style,
282
335
  }}
283
336
  >
@@ -293,7 +346,7 @@ export function BadgeFrame({
293
346
  fill={tileFill}
294
347
  stroke={tileStroke}
295
348
  strokeWidth={1}
296
- strokeDasharray={done ? undefined : DASH}
349
+ strokeDasharray={closed ? undefined : DASH}
297
350
  strokeLinejoin="round"
298
351
  />
299
352
  {links && (
@@ -315,6 +368,7 @@ export function BadgeFrame({
315
368
  hue={hue}
316
369
  progress={progress}
317
370
  locked={locked}
371
+ fill={fill}
318
372
  />
319
373
  ))}
320
374
  <Lock shown={status === "locked"} />
@@ -3,15 +3,19 @@ import { GEOMETRY } from "./geometry"
3
3
 
4
4
  export type ExamBadgeProps = BadgeBaseProps
5
5
 
6
- /** An exam: the tetrahedron in a triangle. Validated, gold. */
6
+ /**
7
+ * An exam: a square slab lying on a square tile. Progress grows a square on
8
+ * its top from the front corner; blue once passed, red when failed.
9
+ */
7
10
  export function ExamBadge(props: ExamBadgeProps) {
8
11
  return (
9
12
  <BadgeFrame
10
13
  {...props}
11
- tile={{ kind: "polygon", points: GEOMETRY.tiles.triangle }}
14
+ tile={{ kind: "polygon", points: GEOMETRY.tiles.square }}
12
15
  solids={[GEOMETRY.exam]}
13
- doneHue="yellow"
14
- locked="silhouette"
16
+ doneHue="blue"
17
+ locked="wire"
18
+ fill="corner"
15
19
  />
16
20
  )
17
21
  }
@@ -66,15 +66,16 @@ export const GEOMETRY = {
66
66
  },
67
67
  exam: {
68
68
  facets: [
69
- { points: "32,39.31 20.3,41.73 32,21.55", tone: 3, rank: 2 },
70
- { points: "43.7,41.73 32,39.31 32,21.55", tone: 2, rank: 1 },
71
- { points: "32,39.31 43.7,41.73 20.3,41.73", tone: 0, rank: 0 },
69
+ { points: "12.59,22.46 24.55,45.72 24.55,48.81 12.59,25.55", tone: 2, rank: 1 },
70
+ { points: "12.59,22.46 39.45,12.11 51.41,35.37 24.55,45.72", tone: 3, rank: 2 },
71
+ { points: "24.55,45.72 51.41,35.37 51.41,38.46 24.55,48.81", tone: 0, rank: 0 },
72
72
  ],
73
73
  edges:
74
- "M20.3 41.73L32 21.55M43.7 41.73L20.3 41.73M32 21.55L43.7 41.73M20.3 41.73L32 39.31M32 39.31L32 21.55M32 39.31L43.7 41.73",
75
- hidden: "",
76
- hull: "20.3,41.73 32,21.55 43.7,41.73",
74
+ "M24.55 45.72L12.59 22.46M24.55 48.81L24.55 45.72M12.59 25.55L24.55 48.81M12.59 22.46L12.59 25.55M51.41 35.37L51.41 38.46M39.45 12.11L51.41 35.37M39.45 12.11L12.59 22.46M24.55 45.72L51.41 35.37M51.41 38.46L24.55 48.81",
75
+ hidden: "M39.45 15.2L39.45 12.11M51.41 38.46L39.45 15.2M12.59 25.55L39.45 15.2",
76
+ hull: "12.59,22.46 39.45,12.11 51.41,35.37 51.41,38.46 24.55,48.81 12.59,25.55",
77
77
  details: "",
78
+ cap: { facet: 1, origin: [24.55, 45.72] },
78
79
  },
79
80
  activity: {
80
81
  facets: [
@@ -363,5 +364,6 @@ export const GEOMETRY = {
363
364
  pentagon: "32,4.5 59.58,24.54 49.05,56.96 14.95,56.96 4.42,24.54",
364
365
  octagon: "43.1,5.21 58.79,20.9 58.79,43.1 43.1,58.79 20.9,58.79 5.21,43.1 5.21,20.9 20.9,5.21",
365
366
  giftToken: "32,18 44.12,25 44.12,39 32,46 19.88,39 19.88,25",
367
+ square: "0.56,21.55 44.07,4.77 63.44,42.46 19.93,59.23",
366
368
  },
367
369
  } as const
@@ -1,5 +1,13 @@
1
1
  import { describe, expect, it } from "vitest"
2
- import { faceLight, fillLevel, inProgressShare, MIN_IN_PROGRESS } from "./status"
2
+ import { faceLight, fillLevel, hueOf, inProgressShare, MIN_IN_PROGRESS } from "./status"
3
+
4
+ describe("hueOf", () => {
5
+ it("is red when failed, whatever the shape's done hue", () => {
6
+ expect(hueOf("failed", "green")).toBe("red")
7
+ expect(hueOf("failed", "blue")).toBe("red")
8
+ expect(hueOf("done", "blue")).toBe("blue")
9
+ })
10
+ })
3
11
 
4
12
  describe("inProgressShare", () => {
5
13
  it("maps 0–100 onto the floor–100", () => {
@@ -22,8 +30,9 @@ describe("fillLevel and faceLight", () => {
22
30
  )
23
31
  const total = (values: number[]) => values.reduce((a, b) => a + b, 0)
24
32
 
25
- it("lights every face when done and none when locked or available", () => {
33
+ it("lights every face when done and none when locked, available or failed", () => {
26
34
  expect(lights("done", 0, 40)).toEqual(Array(40).fill(1))
35
+ expect(lights("failed", 100, 40)).toEqual(Array(40).fill(0))
27
36
  expect(lights("locked", 100, 40)).toEqual(Array(40).fill(0))
28
37
  expect(lights("available", 100, 40)).toEqual(Array(40).fill(0))
29
38
  })
@@ -3,11 +3,13 @@
3
3
  * levels": one colour per status, and the same progression on every shape —
4
4
  * wireframe, then half lit, then full with a closed orbit.
5
5
  *
6
- * Only "done" varies by shape (a module is green, a validated exam gold…), so
6
+ * Only "done" varies by shape (a module is green, a passed exam blue…), so
7
7
  * each badge passes its own done hue and everything else comes from here.
8
+ * "failed" is red on every shape: the solid stays unlit like "available",
9
+ * but its tile closes and glows like "done" — the attempt is over.
8
10
  */
9
11
 
10
- export type BadgeStatus = "locked" | "available" | "in-progress" | "done"
12
+ export type BadgeStatus = "locked" | "available" | "in-progress" | "done" | "failed"
11
13
 
12
14
  /**
13
15
  * A kit colour ramp, read as `--color-<hue>-<step>`, or `neutral`: the
@@ -76,6 +78,7 @@ const STATUS_HUE: Record<Exclude<BadgeStatus, "done">, Hue> = {
76
78
  locked: "neutral",
77
79
  available: "purple",
78
80
  "in-progress": "pink",
81
+ failed: "red",
79
82
  }
80
83
 
81
84
  export function hueOf(status: BadgeStatus, doneHue: Hue): Hue {
@@ -106,12 +109,13 @@ const IN_PROGRESS_TONE_STEPS = { dark: [400, 300, 300, 200], light: [400, 300, 3
106
109
  /**
107
110
  * A facet's fill for its light bucket, per status and theme.
108
111
  *
109
- * Locked and available light no facet, so theirs only shows while lit faces
110
- * drain out after a status change back down; a deep, see-through step close
111
- * to the page keeps that drain from flashing coloured faces.
112
+ * Locked, available and failed light no facet, so theirs only shows while
113
+ * lit faces drain out after a status change back down; a deep, see-through
114
+ * step close to the page keeps that drain from flashing coloured faces.
112
115
  */
113
116
  export function faceFill(hue: Hue, status: BadgeStatus, tone: Tone) {
114
- if (status === "locked" || status === "available") return paint(hue, [800, 100], 40)
117
+ if (status === "locked" || status === "available" || status === "failed")
118
+ return paint(hue, [800, 100], 40)
115
119
  const steps = status === "in-progress" ? IN_PROGRESS_TONE_STEPS : TONE_STEPS
116
120
  return paint(hue, [steps.dark[tone], steps.light[tone]])
117
121
  }
@@ -144,7 +148,7 @@ export function fadeWidth(facetCount: number) {
144
148
  /**
145
149
  * Where the fill stands, measured in faces along the bottom-up order: a face
146
150
  * of rank `r` is lit by how far the level has passed it (see faceLight).
147
- * Done is full, locked and available are empty, and in progress maps
151
+ * Done is full, locked, available and failed are empty, and in progress maps
148
152
  * `progress` through inProgressShare, so 0% still shows light.
149
153
  */
150
154
  export function fillLevel(
@@ -134,13 +134,26 @@
134
134
  transition: fill 300ms ease;
135
135
  }
136
136
 
137
+ /*
138
+ * The corner fill's level: the cap, scaled from its front corner (set
139
+ * inline, in viewBox units, hence the view-box transform box).
140
+ */
141
+ .geodesic-cap {
142
+ transform-box: view-box;
143
+ transition:
144
+ transform 900ms cubic-bezier(0.4, 0, 0.2, 1),
145
+ fill 300ms ease;
146
+ }
147
+
137
148
  :where(:root[data-motion="reduced"]) {
138
- .geodesic-solid-smooth {
149
+ .geodesic-solid-smooth,
150
+ .geodesic-cap {
139
151
  transition: none;
140
152
  }
141
153
  }
142
154
  @media (prefers-reduced-motion: reduce) {
143
- .geodesic-solid-smooth {
155
+ .geodesic-solid-smooth,
156
+ .geodesic-cap {
144
157
  transition: none;
145
158
  }
146
159
  }
@@ -305,4 +305,49 @@ describe("Indicator", () => {
305
305
  )
306
306
  expect(screen.getByRole("button", { name: "Inbox" })).toBeTruthy()
307
307
  })
308
+
309
+ describe("without children", () => {
310
+ it("renders the dot alone, in the flow, inside an inline <span> root", () => {
311
+ const { container } = render(<Indicator testId="dot" color="pink" size="sm" />)
312
+ const root = screen.getByTestId("dot")
313
+ expect(root.tagName).toBe("SPAN")
314
+ expect(root.className).toContain("inline-flex")
315
+ const dot = getIndicator(container)
316
+ expect(dot?.className).toContain("relative")
317
+ expect(dot?.className).not.toContain("absolute")
318
+ expect(dot?.className).toContain("size-2")
319
+ expect(dot?.getAttribute("data-color")).toBe("pink")
320
+ })
321
+
322
+ it("ignores position and offset", () => {
323
+ const { container } = render(<Indicator position="bottom-start" offset={4} />)
324
+ const dot = getIndicator(container)
325
+ expect(dot?.hasAttribute("data-position")).toBe(false)
326
+ expect(dot?.className).not.toContain("bottom-0")
327
+ expect(dot?.style.bottom).toBe("")
328
+ })
329
+
330
+ it("keeps the processing pulse and alt", () => {
331
+ const { container } = render(<Indicator processing alt="Online" />)
332
+ expect(container.querySelector('[data-part="processing"]')).toBeTruthy()
333
+ expect(screen.getByText("Online").className).toContain("sr-only")
334
+ })
335
+
336
+ it("renders nothing when hidden", () => {
337
+ const { container } = render(<Indicator disabled testId="gone" />)
338
+ expect(container.innerHTML).toBe("")
339
+ const zero = render(<Indicator label={0} hideZero />)
340
+ expect(zero.container.innerHTML).toBe("")
341
+ })
342
+
343
+ it("renders a label badge in the flow too", () => {
344
+ const { container } = render(<Indicator label={3} />)
345
+ expect(getIndicator(container)?.textContent).toBe("3")
346
+ expect(getIndicator(container)?.className).not.toContain("absolute")
347
+ })
348
+
349
+ it("stays a Server Component", () => {
350
+ expect(renderToStaticMarkup(<Indicator color="green" />)).toContain('data-part="indicator"')
351
+ })
352
+ })
308
353
  })
@@ -83,12 +83,16 @@ const indicatorVariants = cva(
83
83
  // the "positioned, stack-level 0" step, which paints after `children`'s
84
84
  // step — now the dot (and, tucked behind just its own box, the pulse) is
85
85
  // the thing establishing the context, so it's it that ends up on top.
86
- "absolute z-0 inline-flex items-center justify-center",
86
+ "z-0 inline-flex items-center justify-center",
87
87
  "font-sans font-medium leading-none whitespace-nowrap select-none",
88
88
  "bg-(--c-solid) text-(--c-on-solid)",
89
89
  ],
90
90
  {
91
91
  variants: {
92
+ // Overlaid on `children`, or standing in the flow when there are none.
93
+ // `relative` keeps the dot a positioned box either way, so `z-0` still
94
+ // makes it the stacking context the `processing` pulse relies on.
95
+ placement: { overlay: "absolute", standalone: "relative shrink-0" },
92
96
  shape: { dot: "rounded-full", label: "" },
93
97
  size: { xs: "", sm: "", md: "", lg: "", xl: "" },
94
98
  radius: { xs: "", sm: "", md: "", lg: "", xl: "" },
@@ -110,15 +114,15 @@ const indicatorVariants = cva(
110
114
  { shape: "label", radius: "lg", class: "rounded-lg" },
111
115
  { shape: "label", radius: "xl", class: "rounded-xl" },
112
116
  ],
113
- defaultVariants: { shape: "dot", size: "md", radius: "xl" },
117
+ defaultVariants: { placement: "overlay", shape: "dot", size: "md", radius: "xl" },
114
118
  },
115
119
  )
116
120
 
117
121
  export type IndicatorProps = Omit<ComponentPropsWithoutRef<"div">, "children"> &
118
122
  WithTestId & {
119
- /** Which corner (or edge midpoint) of `children` the dot anchors to, straddling it. Default `"top-end"`. */
123
+ /** Which corner (or edge midpoint) of `children` the dot anchors to, straddling it. Default `"top-end"`. Ignored without `children`. */
120
124
  position?: IndicatorPosition
121
- /** Extra px nudge away from the anchor point — a single number for both axes, or `{ x, y }` independently. Ignored on whichever axis a position has no directional edge for (the `center`/`middle` axis of that position). */
125
+ /** Extra px nudge away from the anchor point — a single number for both axes, or `{ x, y }` independently. Ignored on whichever axis a position has no directional edge for (the `center`/`middle` axis of that position), and without `children`. */
122
126
  offset?: IndicatorOffset
123
127
  /** Dot diameter (no `label`) or badge height, off the kit's shared `xs`–`xl` scale. Default `"md"`. */
124
128
  size?: Size
@@ -146,12 +150,12 @@ export type IndicatorProps = Omit<ComponentPropsWithoutRef<"div">, "children"> &
146
150
  withBorder?: boolean
147
151
  /** Corner rounding of the label badge shape once `label` is set — irrelevant to the bare dot, which is always a circle. Default `"xl"`. */
148
152
  radius?: Size
149
- /** Root renders as a `<span>` with `display: inline-block` instead of the default `<div>`/`block` — for wrapping a run of inline content (a word, an icon) that shouldn't force its own line. The tag itself has to change, not just the display: a `<div>` is flow content and is never valid inside phrasing content (e.g. a `<p>`), regardless of its CSS display. Both modes shrink-wrap to `children`'s own intrinsic size either way (the default adds `width: fit-content` — a plain `display: block` box would otherwise stretch to its container's full width, dragging the corner dot away from a small child like an `Avatar` whenever the parent isn't already a flex/grid context). */
153
+ /** Root renders as a `<span>` with `display: inline-block` instead of the default `<div>`/`block` — for wrapping a run of inline content (a word, an icon) that shouldn't force its own line. Without `children` the root is always an inline `<span>`. The tag itself has to change, not just the display: a `<div>` is flow content and is never valid inside phrasing content (e.g. a `<p>`), regardless of its CSS display. Both modes shrink-wrap to `children`'s own intrinsic size either way (the default adds `width: fit-content` — a plain `display: block` box would otherwise stretch to its container's full width, dragging the corner dot away from a small child like an `Avatar` whenever the parent isn't already a flex/grid context). */
150
154
  inline?: boolean
151
155
  /** Stacking order of the dot/badge overlay. */
152
156
  zIndex?: number
153
- /** The element being decorated. Required — `Indicator` has no meaningful standalone render. */
154
- children: ReactNode
157
+ /** The element being decorated. Omit it for a standalone dot (or badge) that sits in the flow — a status dot before a word, a count beside a label — with `position`/`offset` ignored. */
158
+ children?: ReactNode
155
159
  }
156
160
 
157
161
  /** `offset`'s x/y split, defaulting each axis to 0. */
@@ -199,6 +203,10 @@ const buildOffsetStyle = (
199
203
  * on its own, so `alt` supplies the words ("3 unread messages") as visually
200
204
  * hidden text instead.
201
205
  *
206
+ * Without `children` it's a standalone dot in the flow, for a status before a
207
+ * word. The dot still says nothing on its own: pair it with visible text, or
208
+ * give it an `alt`.
209
+ *
202
210
  * No `asChild` — same reasoning as `Skeleton`: the root must stay a real
203
211
  * wrapping element around *two* things at once (`children` **and** the
204
212
  * absolutely-positioned dot sibling), which is structurally incompatible
@@ -212,6 +220,11 @@ const buildOffsetStyle = (
212
220
  * <Indicator processing color="green" position="bottom-end">
213
221
  * <ActionIcon><Wifi /></ActionIcon>
214
222
  * </Indicator>
223
+ *
224
+ * <span className="inline-flex items-center gap-1.5">
225
+ * <Indicator size="sm" color="pink" />
226
+ * Registered
227
+ * </span>
215
228
  */
216
229
  export const Indicator = ({
217
230
  className,
@@ -254,11 +267,20 @@ export const Indicator = ({
254
267
  // prop's own doc below), so the root tag switches to <span> too — the only
255
268
  // way `inline` actually delivers on wrapping a run of inline text without
256
269
  // the browser closing the paragraph around it.
257
- const Root = inline ? "span" : "div"
270
+ const standalone = children == null
271
+ const Root = inline || standalone ? "span" : "div"
272
+
273
+ // Nothing to decorate and nothing to show: render nothing rather than an
274
+ // empty box that still takes a gap in its parent's flex row.
275
+ if (standalone && !visible) return null
258
276
 
259
277
  return (
260
278
  <Root
261
- className={cn("relative", inline ? "inline-block" : "block w-fit", className)}
279
+ className={cn(
280
+ "relative",
281
+ standalone ? "inline-flex shrink-0 align-middle" : inline ? "inline-block" : "block w-fit",
282
+ className,
283
+ )}
262
284
  style={style}
263
285
  {...dataProps({ "data-testid": testId })}
264
286
  {...rest}
@@ -273,15 +295,20 @@ export const Indicator = ({
273
295
  <span
274
296
  aria-hidden="true"
275
297
  data-part="indicator"
276
- data-position={position}
298
+ data-position={standalone ? undefined : position}
277
299
  data-color={color}
278
300
  className={cn(
279
- indicatorVariants({ shape: hasLabel ? "label" : "dot", size, radius }),
280
- POSITION_CLASS[position],
301
+ indicatorVariants({
302
+ placement: standalone ? "standalone" : "overlay",
303
+ shape: hasLabel ? "label" : "dot",
304
+ size,
305
+ radius,
306
+ }),
307
+ !standalone && POSITION_CLASS[position],
281
308
  withBorder && "border-2 border-(--indicator-border-color)",
282
309
  )}
283
310
  style={{
284
- ...buildOffsetStyle(position, offset),
311
+ ...(standalone ? null : buildOffsetStyle(position, offset)),
285
312
  ...(zIndex !== undefined ? { zIndex } : null),
286
313
  }}
287
314
  >
@@ -113,7 +113,7 @@ const ModalRoot = ({ onPointerDownOutside, icons, children, ...rest }: ModalRoot
113
113
  <Ark.Root onPointerDownOutside={guard.onPointerDownOutside} {...rest}>
114
114
  {/* A layer itself, registered with whatever it opened from (the page,
115
115
  or an enclosing overlay), so what's under it knows it's covered. */}
116
- <Ark.Context>{(api) => <NestedLayer open={api.open} />}</Ark.Context>
116
+ <Ark.Context>{(api) => <NestedLayer open={api.open} modal />}</Ark.Context>
117
117
  <DialogRootProviders icons={icons} layers={guard.layers}>
118
118
  {children}
119
119
  </DialogRootProviders>