@crewlethq/ui 0.4.3 → 0.5.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 (237) hide show
  1. package/README.md +888 -24
  2. package/dist/Accordion/index.js +2 -2
  3. package/dist/AddPill/index.js +1 -1
  4. package/dist/{AddPill-DFWXYLIQ.css → AddPill-IJQYCY6C.css} +9 -0
  5. package/dist/AppShell/AppShell.d.ts +26 -5
  6. package/dist/AppShell/index.js +3 -3
  7. package/dist/{AppShell-NVE6LHNI.css → AppShell-XARELGIH.css} +178 -25
  8. package/dist/Avatar/Avatar.d.ts +85 -40
  9. package/dist/Avatar/AvatarStack.d.ts +76 -0
  10. package/dist/Avatar/index.d.ts +5 -2
  11. package/dist/Avatar/index.js +1 -1
  12. package/dist/Avatar-XID7Z74C.css +200 -0
  13. package/dist/AvatarStack-GEJBNV7E.css +72 -0
  14. package/dist/BrandLockup/index.js +1 -1
  15. package/dist/{BrandLockup-6ISDEHPJ.css → BrandLockup-JKGXFCZF.css} +25 -19
  16. package/dist/Button/Button.d.ts +7 -2
  17. package/dist/Button/index.js +1 -1
  18. package/dist/{Button-D4J6B4MA.css → Button-X4B2TJAQ.css} +50 -19
  19. package/dist/Callout/index.js +1 -1
  20. package/dist/Canvas/index.js +4 -4
  21. package/dist/Card/Card.d.ts +9 -5
  22. package/dist/Card/index.js +1 -1
  23. package/dist/{Card-RLR254LD.css → Card-GLP7SUV6.css} +25 -18
  24. package/dist/Charts/BarList.d.ts +18 -1
  25. package/dist/Charts/ChartTooltip.d.ts +68 -0
  26. package/dist/Charts/StackedBar.d.ts +25 -7
  27. package/dist/Charts/StackedColumns.d.ts +112 -0
  28. package/dist/Charts/TimeSeries.d.ts +33 -2
  29. package/dist/Charts/dataColor.d.ts +22 -14
  30. package/dist/Charts/index.d.ts +6 -0
  31. package/dist/Charts/index.js +1 -1
  32. package/dist/Charts/useChartHover.d.ts +56 -0
  33. package/dist/Charts-B3YEF7R4.css +742 -0
  34. package/dist/Checkbox/index.js +1 -1
  35. package/dist/{Checkbox-VGW26YLQ.css → Checkbox-BOXQ747I.css} +2 -2
  36. package/dist/CodeBlock/index.js +4 -4
  37. package/dist/Combobox/index.js +5 -5
  38. package/dist/CommandPalette/CommandPalette.d.ts +97 -6
  39. package/dist/CommandPalette/index.d.ts +1 -1
  40. package/dist/CommandPalette/index.js +9 -7
  41. package/dist/CommandPalette-C5AMKGN2.css +259 -0
  42. package/dist/Copyable/index.js +3 -3
  43. package/dist/DataTable/index.js +7 -7
  44. package/dist/{DataTable-ITNACQ2X.css → DataTable-OLHPF7D4.css} +44 -43
  45. package/dist/DataView/index.js +14 -14
  46. package/dist/{DataView-256YF32J.css → DataView-N6JX464S.css} +5 -4
  47. package/dist/DateTimePicker/index.js +5 -5
  48. package/dist/DiffList/index.js +1 -1
  49. package/dist/Disclosure/index.js +2 -2
  50. package/dist/EntityChip/EntityChip.d.ts +9 -12
  51. package/dist/EntityChip/index.d.ts +1 -1
  52. package/dist/EntityChip/index.js +2 -2
  53. package/dist/ErrorBoundary/index.js +2 -2
  54. package/dist/{ErrorBoundary-ME36CQTA.css → ErrorBoundary-U2PA3LY2.css} +4 -4
  55. package/dist/IconButton/index.js +1 -1
  56. package/dist/{IconButton-VQGNMJDI.css → IconButton-TVEUWK6L.css} +2 -2
  57. package/dist/ImageUpload/ImageUpload.d.ts +10 -7
  58. package/dist/ImageUpload/index.js +2 -2
  59. package/dist/{ImageUpload-HKFIZR6D.css → ImageUpload-YCHJMUGX.css} +24 -10
  60. package/dist/Input/index.js +2 -2
  61. package/dist/Kbd/Kbd.d.ts +14 -4
  62. package/dist/Kbd/index.js +1 -1
  63. package/dist/Kbd-JPLDVJIP.css +71 -0
  64. package/dist/Layer/index.js +1 -1
  65. package/dist/Link/index.js +1 -1
  66. package/dist/List/index.js +1 -1
  67. package/dist/{List-XTHESXLR.css → List-MYJIV6MP.css} +12 -2
  68. package/dist/ListInput/index.js +5 -5
  69. package/dist/Listbox/index.js +2 -2
  70. package/dist/Listbox/useListbox.d.ts +16 -0
  71. package/dist/Listbox/useOptionKeys.d.ts +12 -1
  72. package/dist/{Listbox-X2DOTSQA.css → Listbox-6WJNJQVQ.css} +60 -7
  73. package/dist/Menu/index.js +4 -4
  74. package/dist/{Menu-6DE7I66I.css → Menu-BT5PMFJI.css} +15 -0
  75. package/dist/Meter/Meter.d.ts +103 -16
  76. package/dist/Meter/index.d.ts +2 -2
  77. package/dist/Meter/index.js +1 -1
  78. package/dist/{Meter-SKOOXQBC.css → Meter-5VCSFMZW.css} +46 -7
  79. package/dist/Modal/index.js +4 -4
  80. package/dist/{Modal-XYQJ4BL6.css → Modal-JAYBS2KS.css} +13 -4
  81. package/dist/OrgLabel/OrgLabel.d.ts +60 -24
  82. package/dist/OrgLabel/index.d.ts +1 -1
  83. package/dist/OrgLabel/index.js +2 -1
  84. package/dist/{OrgLabel-D7U6QJZD.css → OrgLabel-CR233G34.css} +9 -18
  85. package/dist/OrgNode/index.js +3 -2
  86. package/dist/OrgTable/OrgTable.d.ts +2 -2
  87. package/dist/OrgTable/index.js +8 -7
  88. package/dist/Popover/index.js +2 -2
  89. package/dist/PricingCard/index.js +3 -3
  90. package/dist/{PricingCard-JFI7RYXP.css → PricingCard-7EFXRSD2.css} +4 -5
  91. package/dist/SearchTrigger/SearchTrigger.d.ts +23 -4
  92. package/dist/SearchTrigger/index.d.ts +1 -1
  93. package/dist/SearchTrigger/index.js +1 -1
  94. package/dist/SearchTrigger-Z5D4AAY7.css +112 -0
  95. package/dist/SegmentedControl/index.js +2 -2
  96. package/dist/SegmentedMeter/SegmentedMeter.d.ts +107 -0
  97. package/dist/SegmentedMeter/index.d.ts +3 -0
  98. package/dist/SegmentedMeter/index.js +2 -0
  99. package/dist/SegmentedMeter-KQNML2TW.css +109 -0
  100. package/dist/Select/index.js +3 -3
  101. package/dist/{Select-2X77FSWR.css → Select-E24U5LBC.css} +34 -0
  102. package/dist/Shortcut/index.js +2 -2
  103. package/dist/SidebarNav/SidebarNav.d.ts +85 -25
  104. package/dist/SidebarNav/index.d.ts +1 -1
  105. package/dist/SidebarNav/index.js +1 -1
  106. package/dist/SidebarNav-X5NLZNWA.css +424 -0
  107. package/dist/StatCard/StatCard.d.ts +59 -12
  108. package/dist/StatCard/index.d.ts +1 -1
  109. package/dist/StatCard/index.js +1 -1
  110. package/dist/StatCard-KPAFD4E2.css +204 -0
  111. package/dist/StatGroup/index.js +1 -1
  112. package/dist/{StatGroup-TGB6AEKM.css → StatGroup-HVG6O62W.css} +8 -9
  113. package/dist/StatusDot/StatusDot.d.ts +24 -6
  114. package/dist/StatusDot/index.js +1 -1
  115. package/dist/StatusDot-7OMCQCZF.css +186 -0
  116. package/dist/Stepper/Stepper.d.ts +78 -0
  117. package/dist/Stepper/index.d.ts +3 -0
  118. package/dist/Stepper/index.js +4 -0
  119. package/dist/Stepper-HW4JM3YH.css +176 -0
  120. package/dist/Table/index.js +1 -1
  121. package/dist/{Table-MDOLVUAW.css → Table-TGCS4C3F.css} +14 -4
  122. package/dist/Tabs/index.js +1 -1
  123. package/dist/{Tabs-VLICJFVB.css → Tabs-XCNPHA7B.css} +79 -27
  124. package/dist/Tag/Tag.d.ts +29 -22
  125. package/dist/Tag/index.js +2 -2
  126. package/dist/{Tag-VNZEYLB6.css → Tag-GBE7LQJP.css} +82 -83
  127. package/dist/TagsInput/index.js +6 -6
  128. package/dist/ThemeSwitcher/ThemeSwitcher.d.ts +53 -21
  129. package/dist/ThemeSwitcher/index.d.ts +3 -3
  130. package/dist/ThemeSwitcher/index.js +4 -3
  131. package/dist/ThemeSwitcher/preferences.d.ts +19 -5
  132. package/dist/ThemeToggle/ThemeToggle.d.ts +40 -0
  133. package/dist/ThemeToggle/index.d.ts +2 -0
  134. package/dist/ThemeToggle/index.js +5 -0
  135. package/dist/TimeWindowPicker/index.js +8 -8
  136. package/dist/Toaster/index.js +2 -2
  137. package/dist/Toolbar/index.js +2 -2
  138. package/dist/{Toolbar-IP6LXN45.css → Toolbar-HUOSMNTH.css} +3 -1
  139. package/dist/Tooltip/index.js +2 -2
  140. package/dist/Tree/index.d.ts +2 -2
  141. package/dist/Tree/index.js +1 -1
  142. package/dist/Tree/layout.d.ts +103 -28
  143. package/dist/TreeCanvas/TreeCanvas.d.ts +60 -14
  144. package/dist/TreeCanvas/index.d.ts +1 -1
  145. package/dist/TreeCanvas/index.js +6 -6
  146. package/dist/TreeCanvas/motion.d.ts +3 -2
  147. package/dist/{TreeCanvas-WBNQPHC7.css → TreeCanvas-HVOV4SQN.css} +154 -30
  148. package/dist/TreeGrid/index.js +4 -4
  149. package/dist/{chunk-F6OE5FH3.js → chunk-2FPENTCF.js} +1 -1
  150. package/dist/chunk-4AK52VHB.js +88 -0
  151. package/dist/{chunk-7EM5T4ME.js → chunk-4IQD3HUQ.js} +2 -2
  152. package/dist/{chunk-YODNNSZL.js → chunk-4PZ6FJKW.js} +43 -13
  153. package/dist/{chunk-F27EPQ7D.js → chunk-4UQ7SMPK.js} +1 -1
  154. package/dist/chunk-5QWIJSQM.js +73 -0
  155. package/dist/{chunk-GTOUGQQK.js → chunk-6MU7HNB4.js} +13 -10
  156. package/dist/{chunk-S2XHHEW4.js → chunk-74KMX7YH.js} +4 -4
  157. package/dist/{chunk-WNI2WSJF.js → chunk-7KBNFFM3.js} +1 -1
  158. package/dist/{chunk-DD5BBGBE.js → chunk-AUS5FNQE.js} +9 -5
  159. package/dist/{chunk-CMEE37QJ.js → chunk-BMYPGGPV.js} +4 -4
  160. package/dist/{chunk-H4FBTAYS.js → chunk-BNCCEER3.js} +8 -8
  161. package/dist/chunk-C5WJUZVR.js +56 -0
  162. package/dist/{chunk-5WS6L6FA.js → chunk-CAIHUYXV.js} +9 -9
  163. package/dist/{chunk-XV6WRMBC.js → chunk-CQY5NTRS.js} +4 -1
  164. package/dist/{chunk-UOGSZKLT.js → chunk-D6EVJUGU.js} +2 -2
  165. package/dist/{chunk-6ZFVFA56.js → chunk-DHPUMOTX.js} +2 -2
  166. package/dist/{chunk-HZ5XZNPS.js → chunk-DS2C73RJ.js} +3 -3
  167. package/dist/{chunk-O6232G37.js → chunk-DSUY5F4E.js} +17 -5
  168. package/dist/{chunk-Q4ZPPART.js → chunk-EFYPAJT3.js} +3 -3
  169. package/dist/{chunk-WQX73TWF.js → chunk-ERVO6OUF.js} +18 -17
  170. package/dist/{chunk-BZYDZBAN.js → chunk-ETYEBKR4.js} +3 -3
  171. package/dist/{chunk-34VGEDVV.js → chunk-FD5UEN6X.js} +30 -30
  172. package/dist/{chunk-5SDBMKUO.js → chunk-FIFNP6PL.js} +3 -3
  173. package/dist/{chunk-7HPRF5XN.js → chunk-FUF52K7E.js} +98 -16
  174. package/dist/{chunk-5KPQ6D7N.js → chunk-FZVJDJFN.js} +2 -2
  175. package/dist/chunk-IA232OTU.js +156 -0
  176. package/dist/{chunk-2EOKFKHX.js → chunk-IG27QX7Q.js} +7 -7
  177. package/dist/chunk-IKB6HFGK.js +55 -0
  178. package/dist/{chunk-FBZAKNSX.js → chunk-IPVQKAHO.js} +10 -7
  179. package/dist/{chunk-3EYF6HKB.js → chunk-IVFJD7WY.js} +28 -9
  180. package/dist/{chunk-WOYYD2YR.js → chunk-JGRNTBF2.js} +11 -11
  181. package/dist/chunk-K3OWD7BJ.js +121 -0
  182. package/dist/{chunk-BJSKPEZI.js → chunk-KD4H66L6.js} +7 -20
  183. package/dist/{chunk-SFZOKW2G.js → chunk-KJ34ZBBI.js} +8 -3
  184. package/dist/{chunk-HQNHV7D6.js → chunk-LFHCXZO5.js} +6 -6
  185. package/dist/{chunk-LWKJQTOM.js → chunk-MICH6QSJ.js} +1 -1
  186. package/dist/chunk-N3DPO6HG.js +226 -0
  187. package/dist/{chunk-S4GZWSKR.js → chunk-OM5E3TTK.js} +1 -1
  188. package/dist/{chunk-3QRYCPXQ.js → chunk-OPKIKM35.js} +6 -6
  189. package/dist/{chunk-5EKIWVOR.js → chunk-PGRPNDWM.js} +2 -2
  190. package/dist/{chunk-LFJ6UJTI.js → chunk-PQNILU27.js} +9 -9
  191. package/dist/{chunk-QNCVHRZL.js → chunk-QVAFL2LE.js} +1 -1
  192. package/dist/{chunk-QEUY3A5P.js → chunk-QY7UU5ZB.js} +3 -2
  193. package/dist/{chunk-ITHXJHBB.js → chunk-R25RGPUB.js} +1 -0
  194. package/dist/{chunk-KLJCCMF3.js → chunk-R6735B37.js} +2 -2
  195. package/dist/{chunk-3ZP55QZE.js → chunk-R6FBDTP3.js} +4 -4
  196. package/dist/{chunk-7FZ53WDJ.js → chunk-RIAZM6L3.js} +1 -1
  197. package/dist/chunk-RJM4QCGG.js +550 -0
  198. package/dist/{chunk-NTRZGNEX.js → chunk-S3BCVWTU.js} +215 -46
  199. package/dist/chunk-S7KW47IQ.js +121 -0
  200. package/dist/{chunk-OFHBK7RI.js → chunk-SJQ546ID.js} +34 -14
  201. package/dist/{chunk-D35VTV2Z.js → chunk-SV7QAONL.js} +1 -1
  202. package/dist/{chunk-IAJLHVUA.js → chunk-TIWAHZZ6.js} +1 -1
  203. package/dist/{chunk-2PRH365R.js → chunk-UA7O3KKJ.js} +1 -1
  204. package/dist/{chunk-NPZY6YYL.js → chunk-UG5ZMAXW.js} +6 -6
  205. package/dist/{chunk-FEFTGVMF.js → chunk-V2N3BMOT.js} +7 -2
  206. package/dist/{chunk-NDCATSW7.js → chunk-V34H2YCY.js} +1 -1
  207. package/dist/chunk-WIATRXEJ.js +22 -0
  208. package/dist/{chunk-5C5YMZQU.js → chunk-WOFOMTGB.js} +16 -10
  209. package/dist/{chunk-QYOFACSP.js → chunk-WSOFKOLP.js} +3 -3
  210. package/dist/{chunk-MNAXYY3R.js → chunk-WUVZDFHS.js} +31 -11
  211. package/dist/{chunk-UG46QBLT.js → chunk-YIMOT5OO.js} +10 -10
  212. package/dist/{chunk-2ZQMA2WB.js → chunk-ZPSOF6VL.js} +2 -2
  213. package/dist/generated/index.d.ts +3 -0
  214. package/dist/generated/index.js +66 -62
  215. package/dist/index.js +66 -62
  216. package/dist/styles.css +2719 -799
  217. package/dist/utils/index.d.ts +1 -1
  218. package/dist/utils/tone.d.ts +7 -12
  219. package/package.json +4 -4
  220. package/scripts/check-css-literals.mjs +159 -23
  221. package/scripts/check-css-variables.mjs +5 -3
  222. package/scripts/css-source.mjs +97 -5
  223. package/dist/Avatar-P2KRQM2B.css +0 -156
  224. package/dist/Charts-D7G2BSXH.css +0 -277
  225. package/dist/CommandPalette-CSJDUCQA.css +0 -115
  226. package/dist/Kbd-W66MXQI5.css +0 -61
  227. package/dist/SearchTrigger-QXOYAUUY.css +0 -79
  228. package/dist/SidebarNav-QGSFKZYA.css +0 -319
  229. package/dist/StatCard-KYPKZUWX.css +0 -111
  230. package/dist/StatusDot-HA2L2FSX.css +0 -84
  231. package/dist/chunk-22O7LAW2.js +0 -41
  232. package/dist/chunk-2HQR4U4D.js +0 -143
  233. package/dist/chunk-ESCO4XYW.js +0 -144
  234. package/dist/chunk-F4PJZ4ED.js +0 -245
  235. package/dist/chunk-PNFASD6F.js +0 -98
  236. package/dist/chunk-PZSWF74H.js +0 -15
  237. /package/dist/{chunk-ZCR6YGQ4.js → chunk-PKIN4IMB.js} +0 -0
@@ -1,144 +0,0 @@
1
- import { Modal } from './chunk-2EOKFKHX.js';
2
- import { useListbox } from './chunk-GTOUGQQK.js';
3
- import { Input } from './chunk-O6232G37.js';
4
- import { cx } from './chunk-ODEQTPFM.js';
5
- import './CommandPalette-CSJDUCQA.css';
6
- import { useId, useMemo } from 'react';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
-
9
- function CommandPalette({ open, ...rest }) {
10
- return open ? /* @__PURE__ */ jsx(Palette, { ...rest }) : null;
11
- }
12
- function Palette({
13
- onClose,
14
- label = "Search",
15
- query,
16
- onQueryChange,
17
- groups,
18
- placeholder = "Search",
19
- footer,
20
- emptyMessage = "Nothing matches that search.",
21
- resultsLabel = "Results",
22
- className,
23
- ...rest
24
- }) {
25
- const id = useId();
26
- const flat = useMemo(() => groups.flatMap((group) => group.items), [groups]);
27
- const listbox = useListbox({
28
- id,
29
- open: true,
30
- count: flat.length,
31
- popup: false,
32
- onCommit: (at) => {
33
- const item = flat[at];
34
- if (!item) return;
35
- item.onSelect();
36
- onClose();
37
- },
38
- onClose
39
- });
40
- const active = listbox.active;
41
- let index = -1;
42
- return /* @__PURE__ */ jsxs(
43
- Modal,
44
- {
45
- ...rest,
46
- open: true,
47
- onClose,
48
- placement: "top",
49
- size: "md",
50
- ariaLabel: label,
51
- showCloseButton: false,
52
- flush: true,
53
- className: cx("crewlet-palette", className),
54
- footerStart: footer,
55
- children: [
56
- /* @__PURE__ */ jsx(
57
- Input,
58
- {
59
- appearance: "command",
60
- containerClassName: "crewlet-palette__field",
61
- value: query,
62
- onChange: (event) => {
63
- onQueryChange(event.target.value);
64
- listbox.setActive(0);
65
- },
66
- onKeyDown: listbox.onKeyDown,
67
- placeholder,
68
- role: "combobox",
69
- "aria-label": label,
70
- "aria-expanded": true,
71
- "aria-controls": listbox.listId,
72
- "aria-autocomplete": "list",
73
- "aria-activedescendant": active >= 0 ? listbox.optionId(active) : void 0,
74
- autoComplete: "off",
75
- spellCheck: false
76
- }
77
- ),
78
- /* @__PURE__ */ jsx(
79
- "div",
80
- {
81
- className: "crewlet-palette__results",
82
- ref: listbox.listRef,
83
- id: listbox.listId,
84
- role: "listbox",
85
- "aria-label": resultsLabel,
86
- children: groups.map((group) => (
87
- // Named by the id of its own heading, never by the heading's text:
88
- // `aria-label` would repeat words already on screen, and
89
- // `aria-labelledby` given a name with a space in it splits on it.
90
- /* @__PURE__ */ jsxs("div", { role: "group", "aria-labelledby": `${id}-group-${group.id}`, children: [
91
- /* @__PURE__ */ jsx("div", { className: "crewlet-listbox__heading", id: `${id}-group-${group.id}`, role: "presentation", children: group.label }),
92
- group.items.map((item) => {
93
- index += 1;
94
- const mine = index;
95
- return (
96
- /*
97
- * NOT A BUTTON, and not focusable: focus never leaves the
98
- * field, so a row is reached by the arrows and by the pointer.
99
- *
100
- * The two rules turned off here are both asking for the shape
101
- * this pattern is defined NOT to have. A combobox points at its
102
- * active option with `aria-activedescendant`, which requires
103
- * that the option itself never take focus, and the keys that
104
- * take a row (Enter) are handled on the field, where the rule
105
- * cannot see them. Making a row focusable would put one tab
106
- * stop per result between the field and itself, which is the
107
- * defect this replaced. The axe run in the suite beside this
108
- * file is what actually holds the surface accessible.
109
- */
110
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/interactive-supports-focus
111
- /* @__PURE__ */ jsxs(
112
- "div",
113
- {
114
- id: listbox.optionId(mine),
115
- className: "crewlet-listbox__option",
116
- role: "option",
117
- "aria-selected": mine === active,
118
- onMouseEnter: listbox.optionHandlers(mine).onMouseEnter,
119
- onMouseDown: (event) => event.preventDefault(),
120
- onClick: () => {
121
- item.onSelect();
122
- onClose();
123
- },
124
- children: [
125
- item.icon !== void 0 ? /* @__PURE__ */ jsx("span", { className: "crewlet-palette__icon", "aria-hidden": "true", children: item.icon }) : null,
126
- /* @__PURE__ */ jsx("span", { className: "crewlet-palette__label", children: item.label }),
127
- item.hint !== void 0 ? /* @__PURE__ */ jsx("span", { className: "crewlet-listbox__hint", children: item.hint }) : null
128
- ]
129
- },
130
- item.id
131
- )
132
- );
133
- })
134
- ] }, group.id)
135
- ))
136
- }
137
- ),
138
- flat.length === 0 ? /* @__PURE__ */ jsx("p", { className: "crewlet-palette__empty", children: emptyMessage }) : null
139
- ]
140
- }
141
- );
142
- }
143
-
144
- export { CommandPalette };
@@ -1,245 +0,0 @@
1
- import { VisuallyHidden } from './chunk-BZFWDIV6.js';
2
- import { cx } from './chunk-ODEQTPFM.js';
3
- import './Charts-D7G2BSXH.css';
4
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import { useId } from 'react';
6
-
7
- // src/Charts/dataColor.ts
8
- var DATA_COLORS = [
9
- "var(--color-data-1)",
10
- "var(--color-data-2)",
11
- "var(--color-data-3)",
12
- "var(--color-data-4)",
13
- "var(--color-data-5)"
14
- ];
15
- var DATA_COLOR_OTHER = "var(--color-data-other)";
16
- function dataColor(index) {
17
- return DATA_COLORS[index] ?? DATA_COLOR_OTHER;
18
- }
19
- function Legend({ items, className }) {
20
- return (
21
- /*
22
- * `role="list"` although a `ul` already has one, which is why the lint
23
- * rule that calls it redundant is silenced here rather than obeyed: the
24
- * stylesheet takes the markers off, and WebKit answers a marker-less list
25
- * as a group of paragraphs, so a reader is no longer told how many series
26
- * there are before they are read. The role puts that back.
27
- */
28
- // eslint-disable-next-line jsx-a11y/no-redundant-roles
29
- /* @__PURE__ */ jsx("ul", { role: "list", className: cx("crewlet-legend", className), children: items.map((item, index) => /* @__PURE__ */ jsxs("li", { className: "crewlet-legend__item", children: [
30
- /* @__PURE__ */ jsx(
31
- "span",
32
- {
33
- className: "crewlet-legend__swatch",
34
- "aria-hidden": true,
35
- style: { "--crewlet-legend-swatch-color": item.color ?? dataColor(index) }
36
- }
37
- ),
38
- /* @__PURE__ */ jsx("span", { className: "crewlet-legend__label", children: item.label }),
39
- item.value != null && /* @__PURE__ */ jsx("span", { className: "crewlet-legend__value", children: item.value })
40
- ] }, item.id)) })
41
- );
42
- }
43
- function BarList({
44
- data,
45
- max,
46
- limit,
47
- moreLabel = (remaining) => `and ${remaining} more`,
48
- emptyLabel = "Nothing recorded in this window",
49
- className
50
- }) {
51
- const capped = limit != null;
52
- const shown = capped ? data.slice(0, limit) : data;
53
- const top = max ?? Math.max(1, ...data.map((datum) => datum.value));
54
- const remaining = capped ? Math.max(0, data.length - limit) : 0;
55
- if (!shown.length) return /* @__PURE__ */ jsx("p", { className: "crewlet-bar-list__empty", children: emptyLabel });
56
- return (
57
- // A list, and said to be one: the markers are off, and WebKit drops the
58
- // list role with them. See Legend for the same note, including why the
59
- // redundant-role rule is silenced rather than obeyed.
60
- // eslint-disable-next-line jsx-a11y/no-redundant-roles
61
- /* @__PURE__ */ jsxs("ul", { role: "list", className: cx("crewlet-bar-list", className), children: [
62
- shown.map((datum, index) => {
63
- const width = top > 0 && datum.value > 0 ? Math.max(1, datum.value / top * 100) : 0;
64
- const body = /* @__PURE__ */ jsxs(Fragment, { children: [
65
- /* @__PURE__ */ jsxs("span", { className: "crewlet-bar-list__head", children: [
66
- /* @__PURE__ */ jsx("span", { className: "crewlet-bar-list__label", children: datum.label }),
67
- /* @__PURE__ */ jsx("span", { className: "crewlet-bar-list__value", children: datum.display ?? datum.value.toLocaleString() })
68
- ] }),
69
- /* @__PURE__ */ jsx("span", { className: "crewlet-bar-list__track", "aria-hidden": true, children: width > 0 && /* @__PURE__ */ jsx(
70
- "span",
71
- {
72
- className: "crewlet-bar-list__bar",
73
- style: {
74
- width: `${width}%`,
75
- "--crewlet-bar-list-bar-color": datum.color ?? dataColor(index)
76
- }
77
- }
78
- ) }),
79
- datum.sub && /* @__PURE__ */ jsx("span", { className: "crewlet-bar-list__sub", children: datum.sub })
80
- ] });
81
- return /* @__PURE__ */ jsx("li", { className: "crewlet-bar-list__item", children: datum.href ? /* @__PURE__ */ jsx("a", { className: "crewlet-bar-list__row crewlet-bar-list__row--pressable", href: datum.href, children: body }) : datum.onSelect ? /* @__PURE__ */ jsx(
82
- "button",
83
- {
84
- type: "button",
85
- className: "crewlet-bar-list__row crewlet-bar-list__row--pressable",
86
- onClick: datum.onSelect,
87
- children: body
88
- }
89
- ) : /* @__PURE__ */ jsx("span", { className: "crewlet-bar-list__row", children: body }) }, datum.id);
90
- }),
91
- remaining > 0 && /* @__PURE__ */ jsx("li", { className: "crewlet-bar-list__more", children: moreLabel(remaining) })
92
- ] })
93
- );
94
- }
95
- function StackedBar({ segments, summary, className }) {
96
- const total = segments.reduce((sum, segment) => sum + Math.max(0, segment.value), 0);
97
- const drawn = segments.filter((segment) => segment.value > 0);
98
- const parts = drawn.map((segment) => ({
99
- label: segment.label,
100
- value: segment.value,
101
- percent: total > 0 ? Math.round(segment.value / total * 100) : 0
102
- }));
103
- const sentence = summary ? summary(parts) : parts.map((part) => `${part.label}: ${part.value.toLocaleString()} (${part.percent}%)`).join(", ");
104
- return /* @__PURE__ */ jsxs("div", { className: cx("crewlet-stacked-bar", className), children: [
105
- /* @__PURE__ */ jsx("div", { className: "crewlet-stacked-bar__track", "aria-hidden": true, children: drawn.map((segment) => {
106
- const index = segments.indexOf(segment);
107
- return /* @__PURE__ */ jsx(
108
- "span",
109
- {
110
- className: "crewlet-stacked-bar__segment",
111
- style: {
112
- width: `${segment.value / total * 100}%`,
113
- "--crewlet-stacked-bar-segment-color": segment.color ?? dataColor(index)
114
- }
115
- },
116
- segment.id
117
- );
118
- }) }),
119
- /* @__PURE__ */ jsx(VisuallyHidden, { children: sentence })
120
- ] });
121
- }
122
- function ActivityStrip({ buckets, label, summary, className }) {
123
- const peak = Math.max(1, ...buckets.map((bucket) => bucket.v));
124
- const total = buckets.reduce((sum, bucket) => sum + bucket.v, 0);
125
- const sentence = summary ? summary({ peak, total, buckets: buckets.length }) : `${label}. ${total.toLocaleString()} in ${buckets.length} buckets, peak ${peak.toLocaleString()}.`;
126
- return /* @__PURE__ */ jsx("div", { className: cx("crewlet-activity-strip", className), role: "img", "aria-label": sentence, children: buckets.map((bucket) => /* @__PURE__ */ jsx(
127
- "span",
128
- {
129
- className: cx("crewlet-activity-strip__cell", bucket.v > 0 && "is-active"),
130
- style: {
131
- /*
132
- * A floor of a fifth, so a bucket with one event in it reads as a
133
- * mark rather than as a line nobody can resolve, and an empty one
134
- * keeps the baseline hairline that says the bucket existed.
135
- */
136
- "--crewlet-activity-strip-fill": bucket.v > 0 ? `${Math.max(20, bucket.v / peak * 100)}%` : "10%"
137
- }
138
- },
139
- bucket.t
140
- )) });
141
- }
142
- function TimeSeries({
143
- series,
144
- from,
145
- to,
146
- label,
147
- height = "7.5rem",
148
- format = (value) => value.toLocaleString(),
149
- formatTime = (at) => new Date(at).toLocaleString(),
150
- summary,
151
- className
152
- }) {
153
- const id = useId();
154
- const width = 1e3;
155
- const plot = 120;
156
- const footer = 18;
157
- const head = 6;
158
- const span = Math.max(1, to - from);
159
- const peaks = series.map((one) => Math.max(0, ...one.points.map((point) => point.v)));
160
- const peak = Math.max(1, ...peaks);
161
- const x = (at) => (at - from) / span * width;
162
- const y = (value) => head + (1 - value / peak) * (plot - head - footer);
163
- const sentence = summary ? summary({ from, to, peak, series: series.map((one, index) => ({ name: one.name, peak: peaks[index] ?? 0 })) }) : `${label}. ${formatTime(from)} to ${formatTime(to)}, peak ${format(peak)}.`;
164
- return /* @__PURE__ */ jsxs("figure", { className: cx("crewlet-time-series", className), children: [
165
- /* @__PURE__ */ jsxs(
166
- "svg",
167
- {
168
- className: "crewlet-chart",
169
- viewBox: `0 0 ${width} ${plot}`,
170
- preserveAspectRatio: "none",
171
- style: { height },
172
- role: "img",
173
- "aria-label": sentence,
174
- children: [
175
- [0.25, 0.5, 0.75].map((fraction) => /* @__PURE__ */ jsx(
176
- "line",
177
- {
178
- className: "crewlet-chart__grid-line",
179
- x1: 0,
180
- x2: width,
181
- y1: y(peak * fraction),
182
- y2: y(peak * fraction)
183
- },
184
- fraction
185
- )),
186
- /* @__PURE__ */ jsx("line", { className: "crewlet-chart__axis-line", x1: 0, x2: width, y1: plot - footer, y2: plot - footer }),
187
- series.map((one, index) => {
188
- const color = one.color ?? dataColor(index);
189
- const points = [...one.points].sort((a, b) => a.t - b.t);
190
- if (points.length === 0) return null;
191
- const line = points.map((point) => `${x(point.t).toFixed(2)},${y(point.v).toFixed(2)}`).join(" ");
192
- const first = points[0];
193
- const last = points[points.length - 1];
194
- const area = `${x(first.t).toFixed(2)},${plot - footer} ${line} ${x(last.t).toFixed(2)},${plot - footer}`;
195
- return /* @__PURE__ */ jsxs("g", { children: [
196
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: `${id}-${index}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
197
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.22" }),
198
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0" })
199
- ] }) }),
200
- /* @__PURE__ */ jsx("polygon", { points: area, fill: `url(#${id}-${index})` }),
201
- /* @__PURE__ */ jsx(
202
- "polyline",
203
- {
204
- className: "crewlet-chart__series",
205
- points: line,
206
- stroke: color,
207
- vectorEffect: "non-scaling-stroke"
208
- }
209
- )
210
- ] }, one.id);
211
- })
212
- ]
213
- }
214
- ),
215
- /* @__PURE__ */ jsxs("figcaption", { className: "crewlet-time-series__scale", children: [
216
- /* @__PURE__ */ jsx("span", { children: formatTime(from) }),
217
- /* @__PURE__ */ jsxs("span", { children: [
218
- "peak ",
219
- format(peak)
220
- ] }),
221
- /* @__PURE__ */ jsx("span", { children: formatTime(to) })
222
- ] })
223
- ] });
224
- }
225
- function Sparkline({ values, color = "var(--color-brand-accent)", height = "1.75rem", className }) {
226
- const width = 200;
227
- const box = 28;
228
- if (values.length < 2) return /* @__PURE__ */ jsx("div", { className: cx("crewlet-spark", className), style: { height }, "aria-hidden": true });
229
- const peak = Math.max(1, ...values);
230
- const step = width / (values.length - 1);
231
- const points = values.map((value, index) => `${(index * step).toFixed(2)},${(box - value / peak * (box - 2) - 1).toFixed(2)}`).join(" ");
232
- return /* @__PURE__ */ jsx(
233
- "svg",
234
- {
235
- className: cx("crewlet-spark", className),
236
- viewBox: `0 0 ${width} ${box}`,
237
- preserveAspectRatio: "none",
238
- style: { height },
239
- "aria-hidden": true,
240
- children: /* @__PURE__ */ jsx("polyline", { className: "crewlet-chart__series", points, stroke: color, vectorEffect: "non-scaling-stroke" })
241
- }
242
- );
243
- }
244
-
245
- export { ActivityStrip, BarList, DATA_COLORS, DATA_COLOR_OTHER, Legend, Sparkline, StackedBar, TimeSeries, dataColor };
@@ -1,98 +0,0 @@
1
- import { cx } from './chunk-ODEQTPFM.js';
2
- import './Avatar-P2KRQM2B.css';
3
- import { useState, useEffect } from 'react';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- var AVATAR_SIZES = { xs: 20, sm: 26, md: 32, lg: 40 };
7
- var getInitials = (name) => {
8
- if (!name) return "?";
9
- const words = name.trim().split(/[\s\-_.]+/).filter(Boolean);
10
- if (words.length === 0) return "?";
11
- return words.slice(0, 2).map((word) => (Array.from(word)[0] ?? "").toUpperCase()).join("") || "?";
12
- };
13
- var TINT_COUNT = 10;
14
- var avatarTint = (seed) => {
15
- let hash = 0;
16
- for (let i = 0; i < seed.length; i += 1) {
17
- hash = hash * 31 + seed.charCodeAt(i) >>> 0;
18
- }
19
- return hash % TINT_COUNT;
20
- };
21
- function avatarPixels(size) {
22
- return typeof size === "number" ? size : AVATAR_SIZES[size];
23
- }
24
- function avatarSquareCorner(pixels) {
25
- if (pixels < 23) return "var(--radius-xs)";
26
- if (pixels < 36) return "var(--radius-md)";
27
- return "var(--radius-lg)";
28
- }
29
- var Avatar = ({
30
- src,
31
- name,
32
- size = "md",
33
- shape = "square",
34
- tone = "neutral",
35
- variant = "solid",
36
- decorative = false,
37
- colorSeed,
38
- className,
39
- style,
40
- ...rest
41
- }) => {
42
- const [imageFailed, setImageFailed] = useState(false);
43
- useEffect(() => {
44
- setImageFailed(false);
45
- }, [src]);
46
- const step = typeof size === "number" ? null : size;
47
- const pixels = avatarPixels(size);
48
- const measured = step === null ? {
49
- width: pixels,
50
- height: pixels,
51
- fontSize: Math.max(9, Math.round(pixels * 0.36)),
52
- // And its corner, for the same reason: the stylesheet's square steps
53
- // move the radius with the box, so an arbitrary box that took one
54
- // fixed step would be squarer or rounder than every step beside it.
55
- ...shape === "square" ? { borderRadius: avatarSquareCorner(pixels) } : {}
56
- } : {};
57
- const seeded = tone === "seeded" ? avatarTint(colorSeed ?? name ?? "") : null;
58
- const classes = cx(
59
- "crewlet-avatar",
60
- `crewlet-avatar--${shape}`,
61
- step === null ? null : `crewlet-avatar--${step}`,
62
- className
63
- );
64
- if (src && !imageFailed) {
65
- return /* @__PURE__ */ jsx(
66
- "img",
67
- {
68
- ...rest,
69
- className: cx(classes, "crewlet-avatar--image", variant === "dashed" && "crewlet-avatar--dashed"),
70
- style: { ...measured, ...style },
71
- src,
72
- alt: decorative ? "" : name ?? "",
73
- "aria-hidden": decorative ? true : void 0,
74
- onError: () => setImageFailed(true)
75
- }
76
- );
77
- }
78
- return /* @__PURE__ */ jsx(
79
- "span",
80
- {
81
- ...rest,
82
- className: cx(
83
- classes,
84
- "crewlet-avatar--fallback",
85
- `crewlet-avatar--${tone}`,
86
- variant === "dashed" && "crewlet-avatar--dashed",
87
- seeded === null ? null : `crewlet-avatar--tint-${seeded}`
88
- ),
89
- style: { ...measured, ...style },
90
- role: decorative ? void 0 : "img",
91
- "aria-hidden": decorative ? true : void 0,
92
- "aria-label": decorative ? void 0 : name ? `${name} avatar` : "Avatar",
93
- children: getInitials(name)
94
- }
95
- );
96
- };
97
-
98
- export { AVATAR_SIZES, Avatar, avatarPixels, avatarSquareCorner, avatarTint, getInitials };
@@ -1,15 +0,0 @@
1
- import { cx } from './chunk-ODEQTPFM.js';
2
- import './StatusDot-HA2L2FSX.css';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- function StatusDot({ tone = "neutral", pulse = false, className }) {
6
- return /* @__PURE__ */ jsx(
7
- "span",
8
- {
9
- "aria-hidden": true,
10
- className: cx("crewlet-status-dot", `crewlet-status-dot--${tone}`, pulse && "is-pulsing", className)
11
- }
12
- );
13
- }
14
-
15
- export { StatusDot };
File without changes