@crewlethq/ui 0.4.4 → 0.5.1

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 (231) 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-37UWTRN6.css → DataTable-OLHPF7D4.css} +35 -38
  45. package/dist/DataView/index.js +16 -16
  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 +6 -6
  69. package/dist/Listbox/index.js +2 -2
  70. package/dist/Listbox/useListbox.d.ts +2 -0
  71. package/dist/{Listbox-ZXYYNN6U.css → Listbox-6WJNJQVQ.css} +32 -7
  72. package/dist/Menu/index.js +4 -4
  73. package/dist/Meter/Meter.d.ts +103 -16
  74. package/dist/Meter/index.d.ts +2 -2
  75. package/dist/Meter/index.js +1 -1
  76. package/dist/{Meter-SKOOXQBC.css → Meter-5VCSFMZW.css} +46 -7
  77. package/dist/Modal/index.js +4 -4
  78. package/dist/{Modal-XYQJ4BL6.css → Modal-JAYBS2KS.css} +13 -4
  79. package/dist/OrgLabel/OrgLabel.d.ts +60 -24
  80. package/dist/OrgLabel/index.d.ts +1 -1
  81. package/dist/OrgLabel/index.js +2 -1
  82. package/dist/{OrgLabel-D7U6QJZD.css → OrgLabel-CR233G34.css} +9 -18
  83. package/dist/OrgNode/index.js +3 -2
  84. package/dist/OrgTable/OrgTable.d.ts +2 -2
  85. package/dist/OrgTable/index.js +8 -7
  86. package/dist/Popover/index.js +2 -2
  87. package/dist/PricingCard/index.js +3 -3
  88. package/dist/{PricingCard-JFI7RYXP.css → PricingCard-7EFXRSD2.css} +4 -5
  89. package/dist/SearchTrigger/SearchTrigger.d.ts +23 -4
  90. package/dist/SearchTrigger/index.d.ts +1 -1
  91. package/dist/SearchTrigger/index.js +1 -1
  92. package/dist/SearchTrigger-Z5D4AAY7.css +112 -0
  93. package/dist/SegmentedControl/index.js +2 -2
  94. package/dist/SegmentedMeter/SegmentedMeter.d.ts +107 -0
  95. package/dist/SegmentedMeter/index.d.ts +3 -0
  96. package/dist/SegmentedMeter/index.js +2 -0
  97. package/dist/SegmentedMeter-KQNML2TW.css +109 -0
  98. package/dist/Select/index.js +3 -3
  99. package/dist/Shortcut/index.js +2 -2
  100. package/dist/SidebarNav/SidebarNav.d.ts +85 -25
  101. package/dist/SidebarNav/index.d.ts +1 -1
  102. package/dist/SidebarNav/index.js +1 -1
  103. package/dist/SidebarNav-X5NLZNWA.css +424 -0
  104. package/dist/StatCard/StatCard.d.ts +59 -12
  105. package/dist/StatCard/index.d.ts +1 -1
  106. package/dist/StatCard/index.js +1 -1
  107. package/dist/StatCard-KPAFD4E2.css +204 -0
  108. package/dist/StatGroup/index.js +1 -1
  109. package/dist/{StatGroup-TGB6AEKM.css → StatGroup-HVG6O62W.css} +8 -9
  110. package/dist/StatusDot/StatusDot.d.ts +24 -6
  111. package/dist/StatusDot/index.js +1 -1
  112. package/dist/StatusDot-7OMCQCZF.css +186 -0
  113. package/dist/Stepper/Stepper.d.ts +78 -0
  114. package/dist/Stepper/index.d.ts +3 -0
  115. package/dist/Stepper/index.js +4 -0
  116. package/dist/Stepper-HW4JM3YH.css +176 -0
  117. package/dist/Tabs/index.js +1 -1
  118. package/dist/{Tabs-MJ2E3VPK.css → Tabs-XCNPHA7B.css} +46 -26
  119. package/dist/Tag/Tag.d.ts +29 -22
  120. package/dist/Tag/index.js +2 -2
  121. package/dist/{Tag-VNZEYLB6.css → Tag-GBE7LQJP.css} +82 -83
  122. package/dist/TagsInput/index.js +7 -7
  123. package/dist/ThemeSwitcher/ThemeSwitcher.d.ts +53 -21
  124. package/dist/ThemeSwitcher/index.d.ts +3 -3
  125. package/dist/ThemeSwitcher/index.js +4 -3
  126. package/dist/ThemeSwitcher/preferences.d.ts +19 -5
  127. package/dist/ThemeToggle/ThemeToggle.d.ts +40 -0
  128. package/dist/ThemeToggle/index.d.ts +2 -0
  129. package/dist/ThemeToggle/index.js +5 -0
  130. package/dist/TimeWindowPicker/index.js +8 -8
  131. package/dist/Toaster/index.js +2 -2
  132. package/dist/Toolbar/index.js +2 -2
  133. package/dist/{Toolbar-IP6LXN45.css → Toolbar-HUOSMNTH.css} +3 -1
  134. package/dist/Tooltip/index.js +2 -2
  135. package/dist/Tree/index.d.ts +2 -2
  136. package/dist/Tree/index.js +1 -1
  137. package/dist/Tree/layout.d.ts +103 -28
  138. package/dist/TreeCanvas/TreeCanvas.d.ts +60 -14
  139. package/dist/TreeCanvas/index.d.ts +1 -1
  140. package/dist/TreeCanvas/index.js +6 -6
  141. package/dist/TreeCanvas/motion.d.ts +3 -2
  142. package/dist/{TreeCanvas-WBNQPHC7.css → TreeCanvas-HVOV4SQN.css} +154 -30
  143. package/dist/TreeGrid/index.js +4 -4
  144. package/dist/{chunk-F6OE5FH3.js → chunk-2FPENTCF.js} +1 -1
  145. package/dist/chunk-4AK52VHB.js +88 -0
  146. package/dist/{chunk-7EM5T4ME.js → chunk-4IQD3HUQ.js} +2 -2
  147. package/dist/{chunk-YODNNSZL.js → chunk-4PZ6FJKW.js} +43 -13
  148. package/dist/{chunk-F27EPQ7D.js → chunk-4UQ7SMPK.js} +1 -1
  149. package/dist/chunk-5QWIJSQM.js +73 -0
  150. package/dist/{chunk-KIC7BZYJ.js → chunk-6MU7HNB4.js} +6 -5
  151. package/dist/{chunk-S2XHHEW4.js → chunk-74KMX7YH.js} +4 -4
  152. package/dist/{chunk-WNI2WSJF.js → chunk-7KBNFFM3.js} +1 -1
  153. package/dist/{chunk-EFSG7HNU.js → chunk-AUS5FNQE.js} +1 -1
  154. package/dist/{chunk-CMEE37QJ.js → chunk-BMYPGGPV.js} +4 -4
  155. package/dist/{chunk-H4FBTAYS.js → chunk-BNCCEER3.js} +8 -8
  156. package/dist/chunk-C5WJUZVR.js +56 -0
  157. package/dist/{chunk-5WS6L6FA.js → chunk-CAIHUYXV.js} +9 -9
  158. package/dist/{chunk-5KSRXHOW.js → chunk-CQY5NTRS.js} +1 -1
  159. package/dist/{chunk-MW356IVK.js → chunk-D6EVJUGU.js} +2 -2
  160. package/dist/{chunk-7PEFUMQJ.js → chunk-DHPUMOTX.js} +2 -2
  161. package/dist/{chunk-HZ5XZNPS.js → chunk-DS2C73RJ.js} +3 -3
  162. package/dist/{chunk-GKHAKGOF.js → chunk-DSUY5F4E.js} +3 -3
  163. package/dist/{chunk-Q4ZPPART.js → chunk-EFYPAJT3.js} +3 -3
  164. package/dist/{chunk-PATXSJGR.js → chunk-ERVO6OUF.js} +17 -17
  165. package/dist/{chunk-BZYDZBAN.js → chunk-ETYEBKR4.js} +3 -3
  166. package/dist/{chunk-CC67MUUO.js → chunk-FD5UEN6X.js} +30 -30
  167. package/dist/{chunk-5SDBMKUO.js → chunk-FIFNP6PL.js} +3 -3
  168. package/dist/{chunk-7HPRF5XN.js → chunk-FUF52K7E.js} +98 -16
  169. package/dist/{chunk-5KPQ6D7N.js → chunk-FZVJDJFN.js} +2 -2
  170. package/dist/chunk-IA232OTU.js +156 -0
  171. package/dist/{chunk-2EOKFKHX.js → chunk-IG27QX7Q.js} +7 -7
  172. package/dist/chunk-IKB6HFGK.js +55 -0
  173. package/dist/{chunk-T43A26SD.js → chunk-IPVQKAHO.js} +6 -6
  174. package/dist/{chunk-3EYF6HKB.js → chunk-IVFJD7WY.js} +28 -9
  175. package/dist/{chunk-XJWXPRSK.js → chunk-JGRNTBF2.js} +11 -11
  176. package/dist/chunk-K3OWD7BJ.js +121 -0
  177. package/dist/{chunk-6KCO2D5C.js → chunk-KD4H66L6.js} +7 -20
  178. package/dist/{chunk-SFZOKW2G.js → chunk-KJ34ZBBI.js} +8 -3
  179. package/dist/{chunk-AQTBF4EB.js → chunk-LFHCXZO5.js} +5 -5
  180. package/dist/{chunk-LWKJQTOM.js → chunk-MICH6QSJ.js} +1 -1
  181. package/dist/chunk-N3DPO6HG.js +226 -0
  182. package/dist/{chunk-S4GZWSKR.js → chunk-OM5E3TTK.js} +1 -1
  183. package/dist/{chunk-3QRYCPXQ.js → chunk-OPKIKM35.js} +6 -6
  184. package/dist/{chunk-5EKIWVOR.js → chunk-PGRPNDWM.js} +2 -2
  185. package/dist/{chunk-FSOW3ARP.js → chunk-PQNILU27.js} +9 -9
  186. package/dist/{chunk-QNCVHRZL.js → chunk-QVAFL2LE.js} +1 -1
  187. package/dist/{chunk-Q3B66TJM.js → chunk-QY7UU5ZB.js} +1 -1
  188. package/dist/{chunk-ITHXJHBB.js → chunk-R25RGPUB.js} +1 -0
  189. package/dist/{chunk-KLJCCMF3.js → chunk-R6735B37.js} +2 -2
  190. package/dist/{chunk-3ZP55QZE.js → chunk-R6FBDTP3.js} +4 -4
  191. package/dist/{chunk-7FZ53WDJ.js → chunk-RIAZM6L3.js} +1 -1
  192. package/dist/chunk-RJM4QCGG.js +550 -0
  193. package/dist/{chunk-NTRZGNEX.js → chunk-S3BCVWTU.js} +215 -46
  194. package/dist/chunk-S7KW47IQ.js +121 -0
  195. package/dist/{chunk-KNYYCWMK.js → chunk-SJQ546ID.js} +4 -4
  196. package/dist/{chunk-D35VTV2Z.js → chunk-SV7QAONL.js} +1 -1
  197. package/dist/{chunk-IAJLHVUA.js → chunk-TIWAHZZ6.js} +1 -1
  198. package/dist/{chunk-2PRH365R.js → chunk-UA7O3KKJ.js} +1 -1
  199. package/dist/{chunk-NPZY6YYL.js → chunk-UG5ZMAXW.js} +6 -6
  200. package/dist/{chunk-NDCATSW7.js → chunk-V34H2YCY.js} +1 -1
  201. package/dist/chunk-WIATRXEJ.js +22 -0
  202. package/dist/{chunk-5C5YMZQU.js → chunk-WOFOMTGB.js} +16 -10
  203. package/dist/{chunk-QYOFACSP.js → chunk-WSOFKOLP.js} +3 -3
  204. package/dist/{chunk-MNAXYY3R.js → chunk-WUVZDFHS.js} +31 -11
  205. package/dist/{chunk-DB2VDLVR.js → chunk-YIMOT5OO.js} +10 -10
  206. package/dist/{chunk-2ZQMA2WB.js → chunk-ZPSOF6VL.js} +2 -2
  207. package/dist/generated/index.d.ts +3 -0
  208. package/dist/generated/index.js +70 -66
  209. package/dist/index.js +70 -66
  210. package/dist/styles.css +2538 -741
  211. package/dist/utils/index.d.ts +1 -1
  212. package/dist/utils/tone.d.ts +7 -12
  213. package/package.json +4 -4
  214. package/scripts/check-css-literals.mjs +159 -23
  215. package/scripts/check-css-variables.mjs +5 -3
  216. package/scripts/css-source.mjs +97 -5
  217. package/dist/Avatar-P2KRQM2B.css +0 -156
  218. package/dist/Charts-D7G2BSXH.css +0 -277
  219. package/dist/CommandPalette-CSJDUCQA.css +0 -115
  220. package/dist/Kbd-W66MXQI5.css +0 -61
  221. package/dist/SearchTrigger-QXOYAUUY.css +0 -79
  222. package/dist/SidebarNav-QGSFKZYA.css +0 -319
  223. package/dist/StatCard-KYPKZUWX.css +0 -111
  224. package/dist/StatusDot-HA2L2FSX.css +0 -84
  225. package/dist/chunk-22O7LAW2.js +0 -41
  226. package/dist/chunk-AJNCATWZ.js +0 -144
  227. package/dist/chunk-F4PJZ4ED.js +0 -245
  228. package/dist/chunk-PNFASD6F.js +0 -98
  229. package/dist/chunk-PZSWF74H.js +0 -15
  230. package/dist/chunk-R66KLW7S.js +0 -143
  231. /package/dist/{chunk-ZCR6YGQ4.js → chunk-PKIN4IMB.js} +0 -0
@@ -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 };
@@ -1,143 +0,0 @@
1
- import { SegmentedControl } from './chunk-7PEFUMQJ.js';
2
- import { LightModeGlyph, ComputerGlyph, DarkModeGlyph } from '@crewlethq/icons/glyphs';
3
- import { useState, useEffect, useCallback } from 'react';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- var THEMES = ["system", "light", "dark"];
7
- var DENSITIES = ["normal", "compact", "comfortable"];
8
- function read(key, allowed, fallback) {
9
- try {
10
- const held = globalThis.localStorage?.getItem(key);
11
- return allowed.includes(held) ? held : fallback;
12
- } catch {
13
- return fallback;
14
- }
15
- }
16
- function write(key, value) {
17
- try {
18
- globalThis.localStorage?.setItem(key, value);
19
- } catch {
20
- }
21
- }
22
- function root() {
23
- return typeof document === "undefined" ? null : document.documentElement;
24
- }
25
- function applyTheme(theme) {
26
- const el = root();
27
- if (!el) return;
28
- if (theme === "system") el.removeAttribute("data-theme");
29
- else el.setAttribute("data-theme", theme);
30
- }
31
- function applyDensity(density) {
32
- const el = root();
33
- if (!el) return;
34
- if (density === "normal") el.removeAttribute("data-density");
35
- else el.setAttribute("data-density", density);
36
- }
37
- function useThemePreference({
38
- storageKey
39
- }) {
40
- const [theme, setTheme] = useState(() => read(storageKey, THEMES, "system"));
41
- useEffect(() => {
42
- applyTheme(theme);
43
- }, [theme]);
44
- const choose = useCallback(
45
- (next) => {
46
- setTheme(next);
47
- applyTheme(next);
48
- write(storageKey, next);
49
- },
50
- [storageKey]
51
- );
52
- return [theme, choose];
53
- }
54
- function useDensityPreference({
55
- storageKey
56
- }) {
57
- const [density, setDensity] = useState(
58
- () => read(storageKey, DENSITIES, "normal")
59
- );
60
- useEffect(() => {
61
- applyDensity(density);
62
- }, [density]);
63
- const choose = useCallback(
64
- (next) => {
65
- setDensity(next);
66
- applyDensity(next);
67
- write(storageKey, next);
68
- },
69
- [storageKey]
70
- );
71
- return [density, choose];
72
- }
73
- function applyStoredPreferences({ themeKey, densityKey }) {
74
- const theme = themeKey ? read(themeKey, THEMES, "system") : "system";
75
- const density = densityKey ? read(densityKey, DENSITIES, "normal") : "normal";
76
- applyTheme(theme);
77
- applyDensity(density);
78
- return { theme, density };
79
- }
80
- function ThemeSwitcher({
81
- storageKey = "crewlet_theme",
82
- label = "Theme",
83
- lightLabel = "Light",
84
- systemLabel = "Follow the system",
85
- darkLabel = "Dark",
86
- size = "sm",
87
- className
88
- }) {
89
- const [theme, choose] = useThemePreference({ storageKey });
90
- return /* @__PURE__ */ jsx(
91
- SegmentedControl,
92
- {
93
- label,
94
- semantics: "radio",
95
- size,
96
- className,
97
- value: theme,
98
- onValueChange: choose,
99
- options: [
100
- { value: "light", icon: /* @__PURE__ */ jsx(LightModeGlyph, {}), srLabel: lightLabel, title: lightLabel },
101
- { value: "system", icon: /* @__PURE__ */ jsx(ComputerGlyph, {}), srLabel: systemLabel, title: systemLabel },
102
- { value: "dark", icon: /* @__PURE__ */ jsx(DarkModeGlyph, {}), srLabel: darkLabel, title: darkLabel }
103
- ]
104
- }
105
- );
106
- }
107
- function DensitySwitcher({
108
- storageKey = "crewlet_density",
109
- label = "Density",
110
- compactLabel = "Compact",
111
- normalLabel = "Normal",
112
- comfortableLabel = "Comfortable",
113
- compactMark = "S",
114
- normalMark = "M",
115
- comfortableMark = "L",
116
- size = "sm",
117
- className
118
- }) {
119
- const [density, choose] = useDensityPreference({ storageKey });
120
- return /* @__PURE__ */ jsx(
121
- SegmentedControl,
122
- {
123
- label,
124
- semantics: "radio",
125
- size,
126
- className,
127
- value: density,
128
- onValueChange: choose,
129
- options: [
130
- { value: "compact", label: compactMark, srLabel: compactLabel, title: compactLabel },
131
- { value: "normal", label: normalMark, srLabel: normalLabel, title: normalLabel },
132
- {
133
- value: "comfortable",
134
- label: comfortableMark,
135
- srLabel: comfortableLabel,
136
- title: comfortableLabel
137
- }
138
- ]
139
- }
140
- );
141
- }
142
-
143
- export { DensitySwitcher, ThemeSwitcher, applyDensity, applyStoredPreferences, applyTheme, useDensityPreference, useThemePreference };
File without changes