@crewlethq/ui 0.97.0 → 0.98.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 (272) hide show
  1. package/dist/AddPill/AddPill.d.ts +3 -1
  2. package/dist/AddPill/index.js +1 -1
  3. package/dist/{AddPill-FPM5RUKI.css → AddPill-OP3MMVZG.css} +13 -0
  4. package/dist/AgentHandoffPanel/index.js +12 -8
  5. package/dist/AppShell/index.js +9 -8
  6. package/dist/ArrangeFrame/index.js +9 -2
  7. package/dist/ArrangeList/index.js +10 -5
  8. package/dist/ArtifactBar/index.js +12 -11
  9. package/dist/ArtifactCard/index.js +9 -4
  10. package/dist/ArtifactPanel/index.js +8 -4
  11. package/dist/AttentionList/index.js +9 -2
  12. package/dist/AvatarPicker/index.js +13 -10
  13. package/dist/BriefCard/index.js +9 -2
  14. package/dist/Button/Button.d.ts +6 -0
  15. package/dist/Button/index.js +8 -1
  16. package/dist/Canvas/Canvas.d.ts +18 -1
  17. package/dist/Canvas/index.js +9 -8
  18. package/dist/{Canvas-4QJHVLJ4.css → Canvas-UQVR7IUL.css} +43 -0
  19. package/dist/CanvasBoard/index.js +11 -10
  20. package/dist/CanvasToolbar/index.js +10 -9
  21. package/dist/ChangeMark/index.js +4 -4
  22. package/dist/ChatMessage/index.js +9 -2
  23. package/dist/ChatThread/index.js +9 -2
  24. package/dist/CheckGrid/index.js +9 -4
  25. package/dist/Checkbox/index.js +8 -3
  26. package/dist/ChipField/index.js +1 -1
  27. package/dist/CodeBlock/index.js +11 -4
  28. package/dist/ColorField/index.js +8 -3
  29. package/dist/ColorSwatch/index.js +11 -4
  30. package/dist/Combobox/index.js +8 -3
  31. package/dist/CommandPalette/index.js +10 -7
  32. package/dist/CommentThread/index.js +10 -6
  33. package/dist/CompactNav/index.js +3 -3
  34. package/dist/Composer/index.js +8 -4
  35. package/dist/ConfirmField/index.js +8 -3
  36. package/dist/ConflictNote/index.js +9 -2
  37. package/dist/ContrastHelp/index.js +7 -4
  38. package/dist/Copyable/index.js +10 -3
  39. package/dist/DataGrid/index.js +10 -5
  40. package/dist/DataTable/index.js +12 -9
  41. package/dist/DataView/index.js +16 -13
  42. package/dist/DateTimePicker/index.js +9 -6
  43. package/dist/DeepWorkCard/index.js +10 -3
  44. package/dist/DocTabsEditor/index.js +10 -7
  45. package/dist/DownloadButton/index.js +9 -2
  46. package/dist/{Editor-63L5QQDN.js → Editor-QWGTLJHM.js} +9 -6
  47. package/dist/EmojiPicker/index.js +9 -8
  48. package/dist/EntityChip/EntityChip.d.ts +9 -1
  49. package/dist/EntityChip/index.js +1 -1
  50. package/dist/ErrorBoundary/index.js +9 -2
  51. package/dist/FactList/index.js +4 -4
  52. package/dist/FileDrop/index.js +9 -2
  53. package/dist/FilterPill/index.js +9 -2
  54. package/dist/FollowBanner/index.js +7 -3
  55. package/dist/HuePicker/index.js +11 -8
  56. package/dist/IconButton/IconButton.d.ts +6 -0
  57. package/dist/IconButton/index.js +8 -1
  58. package/dist/InlineEditor/index.js +7 -3
  59. package/dist/Input/index.js +7 -2
  60. package/dist/KeyValueRows/index.js +9 -4
  61. package/dist/Layer/index.d.ts +1 -1
  62. package/dist/Layer/index.js +1 -1
  63. package/dist/Layer/place.d.ts +6 -0
  64. package/dist/Link/Link.d.ts +6 -1
  65. package/dist/Link/index.js +1 -1
  66. package/dist/{Link-CLURSR2O.css → Link-Z23PLCVS.css} +9 -0
  67. package/dist/LinkInterstitial/index.js +9 -6
  68. package/dist/List/List.d.ts +1 -7
  69. package/dist/ListInput/index.js +9 -5
  70. package/dist/LogoSlot/index.js +10 -3
  71. package/dist/MarkdownEditor/index.js +12 -9
  72. package/dist/MemberPicker/index.js +9 -4
  73. package/dist/Menu/Menu.d.ts +7 -1
  74. package/dist/Menu/index.js +8 -5
  75. package/dist/MergeConflicts/index.js +12 -9
  76. package/dist/MessageActions/index.js +10 -10
  77. package/dist/Modal/index.js +8 -5
  78. package/dist/ObjectHeader/index.js +2 -2
  79. package/dist/OpenInAppCard/index.js +10 -3
  80. package/dist/OrgLabel/OrgLabel.d.ts +14 -0
  81. package/dist/OrgLabel/index.js +1 -1
  82. package/dist/{OrgLabel-R5KY7C3W.css → OrgLabel-6UGWHDQQ.css} +38 -0
  83. package/dist/OrgNode/index.js +2 -2
  84. package/dist/OrgTable/OrgTable.d.ts +28 -3
  85. package/dist/OrgTable/index.d.ts +1 -1
  86. package/dist/OrgTable/index.js +17 -7
  87. package/dist/{OrgTable-JZSYTUIK.css → OrgTable-GBRYKTDH.css} +68 -2
  88. package/dist/PeekRail/index.js +10 -3
  89. package/dist/PeopleRail/index.js +10 -3
  90. package/dist/PinTile/index.js +9 -2
  91. package/dist/Popover/index.js +2 -2
  92. package/dist/PresenterView/index.js +9 -5
  93. package/dist/PrincipalPicker/index.js +9 -4
  94. package/dist/PropertyList/index.js +3 -3
  95. package/dist/ProposalCard/index.js +11 -6
  96. package/dist/RailList/index.js +3 -3
  97. package/dist/ReactionBar/index.js +10 -10
  98. package/dist/ReceiptStrip/index.js +9 -2
  99. package/dist/RecordChip/index.js +3 -3
  100. package/dist/ResultTableCard/index.js +10 -3
  101. package/dist/RichEditor/index.js +9 -2
  102. package/dist/SandboxedFrame/index.js +9 -2
  103. package/dist/SegmentedControl/index.js +11 -8
  104. package/dist/{SegmentedControl-7GY2KM44.css → SegmentedControl-PWTB7KEE.css} +4 -1
  105. package/dist/Select/index.js +2 -2
  106. package/dist/SelectionBar/index.js +7 -3
  107. package/dist/SendButton/index.js +9 -2
  108. package/dist/ShareDialog/index.js +11 -8
  109. package/dist/SheetColumnEditor/index.js +15 -12
  110. package/dist/SheetGrid/index.js +11 -10
  111. package/dist/Shortcut/index.js +1 -1
  112. package/dist/SidePanel/index.js +7 -3
  113. package/dist/SlideCompare/index.js +7 -3
  114. package/dist/SlideFilmstrip/index.js +9 -6
  115. package/dist/SlideGrid/index.js +1 -1
  116. package/dist/SlideNav/index.js +9 -2
  117. package/dist/SlideStage/index.js +1 -1
  118. package/dist/StatusLegend/StatusLegend.d.ts +31 -0
  119. package/dist/StatusLegend/index.d.ts +3 -0
  120. package/dist/StatusLegend/index.js +4 -0
  121. package/dist/StatusLegend-7MS2SBVC.css +77 -0
  122. package/dist/StatusLine/StatusLine.d.ts +32 -0
  123. package/dist/StatusLine/index.d.ts +3 -0
  124. package/dist/StatusLine/index.js +10 -0
  125. package/dist/StatusLine-C6IY3U2F.css +55 -0
  126. package/dist/Switch/Switch.d.ts +2 -0
  127. package/dist/Switch/index.js +1 -1
  128. package/dist/{Switch-XJE34BZH.css → Switch-M3VVQMCY.css} +21 -0
  129. package/dist/Switcher/index.js +11 -8
  130. package/dist/TableCells/index.js +2 -2
  131. package/dist/Tabs/index.js +9 -6
  132. package/dist/TagsInput/index.js +7 -3
  133. package/dist/ThemeSwitcher/index.js +12 -9
  134. package/dist/ThemeToggle/index.js +9 -2
  135. package/dist/TimeRangePicker/index.js +14 -11
  136. package/dist/TimeWindowPicker/index.js +11 -8
  137. package/dist/Toaster/index.js +2 -2
  138. package/dist/Toolbar/index.js +1 -1
  139. package/dist/Tooltip/index.js +3 -3
  140. package/dist/TreeCanvas/TreeCanvas.d.ts +38 -2
  141. package/dist/TreeCanvas/index.d.ts +1 -1
  142. package/dist/TreeCanvas/index.js +10 -9
  143. package/dist/{TreeCanvas-5FPK4CII.css → TreeCanvas-X5RCUSTP.css} +24 -0
  144. package/dist/TreeGrid/TreeGrid.d.ts +26 -3
  145. package/dist/TreeGrid/index.js +8 -4
  146. package/dist/{TreeGrid-522U6WBG.css → TreeGrid-PZ3DFVRO.css} +24 -0
  147. package/dist/ValueField/index.js +10 -6
  148. package/dist/VersionCompare/index.js +12 -9
  149. package/dist/VersionTimeline/index.js +9 -2
  150. package/dist/{chunk-QF5UNP4T.js → chunk-2PB5D4TI.js} +1 -1
  151. package/dist/{chunk-7ZJ662U4.js → chunk-2W4US3JO.js} +3 -3
  152. package/dist/{chunk-NCUSI4ZU.js → chunk-33632WEN.js} +54 -14
  153. package/dist/{chunk-VB3FVKNI.js → chunk-3JAGO633.js} +1 -1
  154. package/dist/{chunk-XA2QKGBJ.js → chunk-3QBQY2XK.js} +1 -1
  155. package/dist/{chunk-2BZ2W2YU.js → chunk-3Z2BSKS5.js} +5 -5
  156. package/dist/{chunk-5U6XAUYM.js → chunk-4FNAPCCK.js} +1 -1
  157. package/dist/{chunk-IJ7KLXUZ.js → chunk-4OHBHPIB.js} +1 -1
  158. package/dist/{chunk-3LKOXQWZ.js → chunk-4QTOAMQN.js} +1 -1
  159. package/dist/{chunk-5YXMKZUA.js → chunk-4XYKBZJE.js} +8 -3
  160. package/dist/{chunk-EHFQMY3B.js → chunk-52UBOSNQ.js} +1 -1
  161. package/dist/{chunk-KCLHYBIZ.js → chunk-56ES76ST.js} +1 -1
  162. package/dist/{chunk-B3BJ66GQ.js → chunk-5JGEEUWQ.js} +2 -2
  163. package/dist/{chunk-WJZTI2WC.js → chunk-5KJOG5YP.js} +7 -7
  164. package/dist/{chunk-IUBOLGHG.js → chunk-5KKZCSER.js} +1 -1
  165. package/dist/{chunk-7K6LVM5I.js → chunk-63NRTOGO.js} +3 -3
  166. package/dist/chunk-6FS6W3P5.js +37 -0
  167. package/dist/chunk-6FVTKYH6.js +37 -0
  168. package/dist/{chunk-DGXZ635L.js → chunk-6KUOHUY5.js} +29 -24
  169. package/dist/{chunk-5AJR6X75.js → chunk-6V465OCU.js} +1 -1
  170. package/dist/{chunk-FRERGOW3.js → chunk-7IW4BVZF.js} +1 -1
  171. package/dist/{chunk-G3JY2DLC.js → chunk-7L6JJ7VJ.js} +1 -1
  172. package/dist/{chunk-CWJLDCB7.js → chunk-A5ISYHW7.js} +3 -3
  173. package/dist/{chunk-SDHLAW3G.js → chunk-AAP7A6WV.js} +2 -2
  174. package/dist/{chunk-AQCWYVE3.js → chunk-AC255TMQ.js} +1 -1
  175. package/dist/{chunk-K4LZXSKZ.js → chunk-AEFR4M2W.js} +1 -1
  176. package/dist/{chunk-GC3UQZPL.js → chunk-AEUZU5SA.js} +1 -1
  177. package/dist/{chunk-5MOBCUNA.js → chunk-AHPMAPVN.js} +2 -2
  178. package/dist/{chunk-2HBY3FOZ.js → chunk-AP6SM6BL.js} +3 -3
  179. package/dist/{chunk-NTGAPLMJ.js → chunk-BC4H2EMM.js} +1 -1
  180. package/dist/{chunk-OGOLTPFQ.js → chunk-BCZQDB3U.js} +1 -1
  181. package/dist/{chunk-QW4LAFTX.js → chunk-BK4KUIAZ.js} +1 -1
  182. package/dist/{chunk-T2GC7UAP.js → chunk-C34CKBKF.js} +1 -1
  183. package/dist/{chunk-LAZ72JOP.js → chunk-CQIODINH.js} +2 -2
  184. package/dist/{chunk-HZBXC3YD.js → chunk-CTNQOSQF.js} +2 -2
  185. package/dist/{chunk-3N3XK2G5.js → chunk-CZKEABMI.js} +3 -1
  186. package/dist/{chunk-HZPUMGQV.js → chunk-D4MMW2NF.js} +3 -3
  187. package/dist/{chunk-K66TAOJA.js → chunk-DBH7ORCH.js} +2 -2
  188. package/dist/{chunk-FXGQWLZ6.js → chunk-DK7CXQFY.js} +1 -1
  189. package/dist/{chunk-RO5JU6SN.js → chunk-E23AXDKL.js} +1 -1
  190. package/dist/{chunk-SKGOKLJD.js → chunk-E2XDYCFO.js} +1 -1
  191. package/dist/{chunk-XSJSDNRR.js → chunk-EF3CJDZO.js} +3 -3
  192. package/dist/{chunk-ZXXZESCD.js → chunk-EMDRNB23.js} +3 -3
  193. package/dist/{chunk-BHVEHAAX.js → chunk-EMXUREKE.js} +3 -3
  194. package/dist/{chunk-3P7XS5VT.js → chunk-FBNGCPKZ.js} +2 -2
  195. package/dist/{chunk-OMV5W53A.js → chunk-FIX72ZEC.js} +15 -1
  196. package/dist/{chunk-QWRAWKB2.js → chunk-FMOYO5OO.js} +2 -2
  197. package/dist/{chunk-GYVEKHVI.js → chunk-FP6OFRAU.js} +1 -1
  198. package/dist/{chunk-AVWEXCJ4.js → chunk-GA773IOZ.js} +2 -2
  199. package/dist/{chunk-XJMES7AE.js → chunk-GBBRSZ2J.js} +1 -1
  200. package/dist/{chunk-SNQ7PH3D.js → chunk-GDYZPBLI.js} +1 -1
  201. package/dist/{chunk-DRFOTWJE.js → chunk-GWRU4JHQ.js} +2 -2
  202. package/dist/{chunk-3NO5GRZY.js → chunk-HMXTZKAI.js} +4 -4
  203. package/dist/{chunk-QDGHOGSW.js → chunk-HTCNTCBE.js} +2 -2
  204. package/dist/{chunk-SRHLFQ4J.js → chunk-HU5PAZMU.js} +3 -3
  205. package/dist/{chunk-T5HZ5AYW.js → chunk-IA3NL54W.js} +4 -4
  206. package/dist/{chunk-3IWZVEXA.js → chunk-IAR2ULSK.js} +1 -1
  207. package/dist/{chunk-4ME4J3YY.js → chunk-IDBGDMQS.js} +1 -1
  208. package/dist/{chunk-WSHKY7SH.js → chunk-IGECN5B6.js} +1 -1
  209. package/dist/{chunk-OMMHKM6I.js → chunk-IYJCJOHW.js} +1 -1
  210. package/dist/{chunk-YTIXNVS7.js → chunk-J3QFTG4B.js} +3 -3
  211. package/dist/{chunk-TGGYSQRD.js → chunk-JK6WLRYP.js} +34 -22
  212. package/dist/{chunk-NKBKHOMU.js → chunk-JQCKRABK.js} +1 -1
  213. package/dist/{chunk-PICHV3PC.js → chunk-JZADK2FT.js} +3 -3
  214. package/dist/{chunk-4RLUVHYP.js → chunk-L72GPZ56.js} +1 -1
  215. package/dist/{chunk-EC6EUIAD.js → chunk-LCAKSEMB.js} +1 -1
  216. package/dist/{chunk-IPMJGK2Q.js → chunk-LYVWOAUN.js} +1 -1
  217. package/dist/{chunk-CFJ7FQZI.js → chunk-M6EVTMTK.js} +1 -1
  218. package/dist/{chunk-TGSOHXXH.js → chunk-M6G7XLLP.js} +1 -1
  219. package/dist/{chunk-JIBWNHTC.js → chunk-MIQNKO2R.js} +1 -1
  220. package/dist/{chunk-QGEDXYLB.js → chunk-MJ73YBP2.js} +2 -2
  221. package/dist/{chunk-BBKYJQZ6.js → chunk-MOP4D5HF.js} +5 -5
  222. package/dist/{chunk-Y7PPKQFQ.js → chunk-MTKHMGJH.js} +5 -5
  223. package/dist/{chunk-KQWJWTED.js → chunk-N7H5TFQK.js} +1 -1
  224. package/dist/{chunk-LJ3KWQLP.js → chunk-NBOHNPZB.js} +1 -1
  225. package/dist/{chunk-M576OESX.js → chunk-NKNG6YER.js} +1 -1
  226. package/dist/{chunk-ZDMZP5H4.js → chunk-OAKECTYH.js} +6 -6
  227. package/dist/{chunk-LMEMH6DO.js → chunk-OSU4ELU3.js} +2 -2
  228. package/dist/{chunk-5ILRWUE7.js → chunk-P667Y6NQ.js} +1 -1
  229. package/dist/{chunk-LGPTZGHJ.js → chunk-PF6X74C5.js} +8 -8
  230. package/dist/{chunk-6FAI4VLM.js → chunk-PJMDZEWY.js} +1 -1
  231. package/dist/{chunk-OSH55AKI.js → chunk-PMO6W5NE.js} +3 -3
  232. package/dist/{chunk-ZPTKAYJK.js → chunk-QH2YJDRI.js} +1 -1
  233. package/dist/{chunk-VTQSSU2E.js → chunk-QND44ROZ.js} +1 -1
  234. package/dist/{chunk-AELKT34H.js → chunk-QPRTTTUN.js} +1 -1
  235. package/dist/{chunk-7ZSEUO5Q.js → chunk-QZKGFBAR.js} +2 -2
  236. package/dist/{chunk-OC6BMY3C.js → chunk-RBR4AHBT.js} +1 -1
  237. package/dist/chunk-ROFAWLFS.js +352 -0
  238. package/dist/{chunk-VONEKR3J.js → chunk-RPCIU4S5.js} +1 -1
  239. package/dist/{chunk-2NNMBEJV.js → chunk-RSI6EJSH.js} +5 -5
  240. package/dist/{chunk-GNJXUNEU.js → chunk-RVJJZVVS.js} +1 -1
  241. package/dist/{chunk-V6WDJUYK.js → chunk-SF6FUU42.js} +1 -1
  242. package/dist/{chunk-CVKANYHD.js → chunk-SSN7Y3UY.js} +1 -1
  243. package/dist/{chunk-BMBQ6UMD.js → chunk-TAWPKNNZ.js} +1 -1
  244. package/dist/{chunk-I4IO56EY.js → chunk-TKAERQQF.js} +1 -1
  245. package/dist/{chunk-AXEXOAZQ.js → chunk-TVGTMKYO.js} +1 -1
  246. package/dist/{chunk-FPU7AA3X.js → chunk-UUDQEDHQ.js} +72 -26
  247. package/dist/{chunk-2SVQBQAD.js → chunk-V7WDP3HR.js} +3 -3
  248. package/dist/{chunk-65RFU7LF.js → chunk-VDQGWPGQ.js} +4 -1
  249. package/dist/{chunk-H4WQWCHP.js → chunk-VULZ4FAA.js} +2 -2
  250. package/dist/{chunk-UAUP6XGK.js → chunk-WDLAAZFZ.js} +30 -24
  251. package/dist/{chunk-6EZX26BD.js → chunk-WF2UJYCT.js} +1 -1
  252. package/dist/{chunk-EVM6GYZ2.js → chunk-WSR4OB4T.js} +1 -1
  253. package/dist/{chunk-LM3ISVJA.js → chunk-X4HBZSXA.js} +1 -1
  254. package/dist/{chunk-CDNZTCP2.js → chunk-XHQ2JJCB.js} +2 -2
  255. package/dist/{chunk-O3II3KJY.js → chunk-XLVWSNW3.js} +3 -3
  256. package/dist/{chunk-TXOTL7AA.js → chunk-YEQTGPCE.js} +3 -3
  257. package/dist/{chunk-ZWCK4N4L.js → chunk-YS4PWTNL.js} +1 -1
  258. package/dist/{chunk-B3PK2LND.js → chunk-YYKLPEOS.js} +1 -1
  259. package/dist/chunk-Z6E3WOWS.js +189 -0
  260. package/dist/{chunk-ETNQYT5O.js → chunk-ZGKGSW42.js} +2 -2
  261. package/dist/{chunk-OPVTNHPH.js → chunk-ZKC3QFDX.js} +2 -2
  262. package/dist/{chunk-NTRKC2JV.js → chunk-ZUWEVSDP.js} +1 -1
  263. package/dist/generated/index.d.ts +2 -0
  264. package/dist/generated/index.js +133 -131
  265. package/dist/index.js +133 -131
  266. package/dist/styles.css +391 -12
  267. package/dist/utils/index.js +2 -2
  268. package/package.json +3 -3
  269. package/scripts/check-css-literals.mjs +3 -4
  270. package/dist/chunk-DWQYV5AV.js +0 -141
  271. package/dist/chunk-ZDWAIVWL.js +0 -310
  272. /package/dist/{chunk-VNACAMDK.js → chunk-2DYEPDT7.js} +0 -0
@@ -1,141 +0,0 @@
1
- import { TreeGrid } from './chunk-ZDWAIVWL.js';
2
- import { createTreeModel, treeParent } from './chunk-MY374UUD.js';
3
- import { OrgLabel } from './chunk-5YXMKZUA.js';
4
- import { AddPill } from './chunk-CVKANYHD.js';
5
- import { IconButton } from './chunk-UAUP6XGK.js';
6
- import { cx } from './chunk-ODEQTPFM.js';
7
- import './OrgTable-JZSYTUIK.css';
8
- import { useMemo, useRef, useImperativeHandle, useCallback } from 'react';
9
- import { ChevronDownGlyph, ChevronUpGlyph } from '@crewlethq/icons/glyphs';
10
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
11
-
12
- var LABELS = {
13
- expandAll: "Expand all",
14
- collapseAll: "Collapse all"
15
- };
16
- function OrgTable({
17
- rows,
18
- renderCell,
19
- tone,
20
- controls = true,
21
- labels,
22
- ref,
23
- className,
24
- ...rest
25
- }) {
26
- const text = { ...LABELS, ...labels };
27
- const tree = useMemo(() => createTreeModel(rows), [rows]);
28
- const grid = useRef(null);
29
- useImperativeHandle(
30
- ref,
31
- () => ({
32
- focusNode: (id) => grid.current?.focusNode(id),
33
- expandAll: () => grid.current?.expandAll(),
34
- collapseAll: () => grid.current?.collapseAll()
35
- }),
36
- []
37
- );
38
- const cell = useCallback(
39
- (id, column, context) => {
40
- if (column !== 1) return renderCell(id, column, context);
41
- const depth = tree.depth.get(id) ?? 0;
42
- const open = context.expandable(id) && context.expanded(id);
43
- return /* @__PURE__ */ jsxs(Fragment, { children: [
44
- /* @__PURE__ */ jsx(
45
- OrgTableWire,
46
- {
47
- depth,
48
- tone: tone?.(id),
49
- trunk: depth > 0 || open,
50
- last: !open && lastUnderRoot(tree, id)
51
- }
52
- ),
53
- renderCell(id, column, context)
54
- ] });
55
- },
56
- [tree, renderCell, tone]
57
- );
58
- return /* @__PURE__ */ jsxs("div", { className: cx("crewlet-org-table", className), children: [
59
- controls && /*
60
- * THE CHEVRONS THE ROWS THEMSELVES TURN, pointed at every row at once.
61
- * They wore the plus and the minus, which is the drawing the add on
62
- * every row under them wears: one mark meant "Expand all" at the
63
- * table's top edge and "Add to this row" nine times below it. Down is
64
- * what an open row's own chevron points at, so the pair reads as the
65
- * state it puts the whole table into.
66
- */
67
- /* @__PURE__ */ jsxs("div", { className: "crewlet-org-table__controls", children: [
68
- /* @__PURE__ */ jsx(
69
- IconButton,
70
- {
71
- size: "sm",
72
- label: text.expandAll,
73
- title: text.expandAll,
74
- icon: /* @__PURE__ */ jsx(ChevronDownGlyph, {}),
75
- onClick: () => grid.current?.expandAll()
76
- }
77
- ),
78
- /* @__PURE__ */ jsx(
79
- IconButton,
80
- {
81
- size: "sm",
82
- label: text.collapseAll,
83
- title: text.collapseAll,
84
- icon: /* @__PURE__ */ jsx(ChevronUpGlyph, {}),
85
- onClick: () => grid.current?.collapseAll()
86
- }
87
- )
88
- ] }),
89
- /* @__PURE__ */ jsx(
90
- TreeGrid,
91
- {
92
- ...rest,
93
- ref: grid,
94
- rows,
95
- renderCell: cell,
96
- labels,
97
- className: "crewlet-org-table__grid"
98
- }
99
- )
100
- ] });
101
- }
102
- function lastUnderRoot(tree, id) {
103
- for (let at = id, up = treeParent(tree, id); up !== null; at = up, up = treeParent(tree, up)) {
104
- const siblings = tree.children.get(up) ?? [];
105
- if (siblings[siblings.length - 1] !== at) return false;
106
- }
107
- return true;
108
- }
109
- function OrgTableWire({
110
- depth,
111
- tone,
112
- trunk,
113
- last
114
- }) {
115
- return /* @__PURE__ */ jsx(
116
- "span",
117
- {
118
- className: "crewlet-org-table__wire",
119
- "aria-hidden": "true",
120
- "data-trunk": trunk ? "" : void 0,
121
- "data-last": last ? "" : void 0,
122
- "data-root": depth === 0 ? "" : void 0,
123
- "data-tone": tone,
124
- style: { "--crewlet-org-table-depth": depth }
125
- }
126
- );
127
- }
128
- function OrgTableName({ tone, ...content }) {
129
- return /* @__PURE__ */ jsx(OrgLabel, { layout: "row", ...content, ...tone ? { tone } : {} });
130
- }
131
- function OrgTableActions({
132
- children,
133
- className
134
- }) {
135
- return /* @__PURE__ */ jsx("span", { className: cx("crewlet-org-table__actions", className), children });
136
- }
137
- function OrgTableAdd({ onOpen, className, ...pill }) {
138
- return /* @__PURE__ */ jsx("span", { className: cx("crewlet-org-table__add", className), onClickCapture: () => onOpen?.(), children: /* @__PURE__ */ jsx(AddPill, { ...pill }) });
139
- }
140
-
141
- export { OrgTable, OrgTableActions, OrgTableAdd, OrgTableName };
@@ -1,310 +0,0 @@
1
- import { useTreeState, treeExpandable, treeLevel, treePosInSet, treeSetSize, treeItemAction, treePrevious, treeNext, treeStep } from './chunk-MY374UUD.js';
2
- import { LayerNodeBridge } from './chunk-LM3ISVJA.js';
3
- import { LayerHost, LAYER_REPOSITION_EVENT } from './chunk-OMV5W53A.js';
4
- import { focusables } from './chunk-TUEM2XIW.js';
5
- import { IconButton } from './chunk-UAUP6XGK.js';
6
- import { VisuallyHidden } from './chunk-UT6CW3C7.js';
7
- import { cx } from './chunk-ODEQTPFM.js';
8
- import './TreeGrid-522U6WBG.css';
9
- import { useState, useRef, useCallback, useLayoutEffect, useImperativeHandle } from 'react';
10
- import { ChevronRightGlyph } from '@crewlethq/icons/glyphs';
11
- import { jsx, jsxs } from 'react/jsx-runtime';
12
-
13
- var LABELS = {
14
- expand: (label) => `Expand ${label}`,
15
- collapse: (label) => `Collapse ${label}`
16
- };
17
- function controlIn(cell) {
18
- return focusables(cell).find((el) => !el.closest('[aria-hidden="true"]')) ?? null;
19
- }
20
- var TEXT_INPUTS = /* @__PURE__ */ new Set(["text", "search", "url", "email", "tel", "password", "number"]);
21
- function caretKey(target, key) {
22
- const lines = target instanceof HTMLTextAreaElement || target.isContentEditable;
23
- const field = lines || target instanceof HTMLInputElement && TEXT_INPUTS.has(target.type);
24
- if (!field) return false;
25
- if (key === "ArrowLeft" || key === "ArrowRight" || key === "Home" || key === "End") return true;
26
- return lines && (key === "ArrowUp" || key === "ArrowDown");
27
- }
28
- function TreeGrid({
29
- label,
30
- columns,
31
- rows: forest,
32
- renderCell,
33
- cellHasControl,
34
- onRowKey,
35
- onRowKeyDown,
36
- hasRowMenu,
37
- addRow,
38
- selectedId = null,
39
- onSelect,
40
- readOnly,
41
- defaultExpanded,
42
- expanded: held,
43
- onExpandedChange,
44
- headless = false,
45
- labels,
46
- ref,
47
- className
48
- }) {
49
- const text = { ...LABELS, ...labels };
50
- const tree = useTreeState(forest, selectedId, { defaultExpanded, expanded: held, onExpandedChange });
51
- const { model, expanded, rows, active, setActive, toggle } = tree;
52
- const [column, setColumn] = useState(null);
53
- const [menuFor, setMenuFor] = useState(null);
54
- const current = useRef({ addRow, onSelect });
55
- current.current = { addRow, onSelect };
56
- const isAddRow = (id) => current.current.addRow?.(id) ?? null;
57
- const rowEls = useRef(/* @__PURE__ */ new Map());
58
- const refs = useRef(/* @__PURE__ */ new Map());
59
- const rowRef = (id) => {
60
- let callback = refs.current.get(id);
61
- if (!callback) {
62
- callback = (el) => {
63
- if (el) rowEls.current.set(id, el);
64
- else rowEls.current.delete(id);
65
- };
66
- refs.current.set(id, callback);
67
- }
68
- return callback;
69
- };
70
- const [request, setRequest] = useState(null);
71
- const focusAt = useCallback(
72
- (id, col) => {
73
- if (current.current.addRow?.(id) == null) current.current.onSelect?.(id);
74
- setActive(id);
75
- setColumn(col);
76
- setRequest({ id, column: col });
77
- },
78
- [setActive]
79
- );
80
- useLayoutEffect(() => {
81
- const row = request ? rowEls.current.get(request.id) : void 0;
82
- if (!request || !row) return;
83
- if (request.column === null) {
84
- row.focus();
85
- return;
86
- }
87
- const cell = row.querySelector(`[aria-colindex="${request.column}"]`);
88
- const control = cell ? controlIn(cell) : null;
89
- (control ?? cell ?? row).focus();
90
- }, [request]);
91
- const focusRef = useRef(() => {
92
- });
93
- focusRef.current = (id) => {
94
- if (!model.parent.has(id)) return;
95
- tree.open(id);
96
- focusAt(id, null);
97
- };
98
- const { expandAll, collapseAll } = tree;
99
- useImperativeHandle(
100
- ref,
101
- () => ({ focusNode: (id) => focusRef.current(id), expandAll, collapseAll }),
102
- [expandAll, collapseAll]
103
- );
104
- function onKeyDownCapture(event) {
105
- const target = event.target;
106
- const row = target.closest("[data-tree-id]");
107
- if (!row) return;
108
- const id = row.getAttribute("data-tree-id");
109
- const onRow = target === row;
110
- const cellIndex = target.closest("[role='gridcell']")?.getAttribute("aria-colindex");
111
- const col = onRow || !cellIndex ? null : Number(cellIndex);
112
- const add = isAddRow(id);
113
- const cells = add ? add.cells : columns.length;
114
- const handled = () => {
115
- event.preventDefault();
116
- event.stopPropagation();
117
- };
118
- if (onRow && add === null) {
119
- if (onRowKeyDown?.(id, event)) {
120
- handled();
121
- return;
122
- }
123
- const action = treeItemAction(event);
124
- if (action === "menu") {
125
- if (hasRowMenu?.(id)) {
126
- handled();
127
- setMenuFor(id);
128
- }
129
- return;
130
- }
131
- if (action !== null) {
132
- if (onRowKey?.(id, action)) handled();
133
- return;
134
- }
135
- }
136
- if (event.ctrlKey || event.metaKey || event.altKey) return;
137
- const sameColumn = (next) => {
138
- if (next === null) return;
139
- const other = isAddRow(next);
140
- const width = other ? other.cells : columns.length;
141
- focusAt(next, col === null ? null : Math.min(col, width));
142
- };
143
- if (col !== null && caretKey(target, event.key)) return;
144
- if (col !== null) {
145
- switch (event.key) {
146
- case "ArrowRight":
147
- handled();
148
- if (col < cells) focusAt(id, col + 1);
149
- return;
150
- case "ArrowLeft":
151
- handled();
152
- focusAt(id, col > 1 ? col - 1 : null);
153
- return;
154
- case "Home":
155
- handled();
156
- focusAt(id, 1);
157
- return;
158
- case "End":
159
- handled();
160
- focusAt(id, cells);
161
- return;
162
- case "ArrowDown":
163
- handled();
164
- sameColumn(treeNext(model, expanded, id));
165
- return;
166
- case "ArrowUp":
167
- handled();
168
- sameColumn(treePrevious(model, expanded, id));
169
- return;
170
- default:
171
- return;
172
- }
173
- }
174
- if (event.key === "ArrowRight" && !(treeExpandable(model, id) && !expanded.has(id))) {
175
- handled();
176
- focusAt(id, 1);
177
- return;
178
- }
179
- if (add !== null && event.key === "Enter") {
180
- handled();
181
- focusAt(id, 1);
182
- return;
183
- }
184
- const step = treeStep(tree, id, event);
185
- if (step === void 0) return;
186
- handled();
187
- if (step === null) return;
188
- if ("toggle" in step) toggle(step.toggle);
189
- else focusAt(step.focus, null);
190
- }
191
- const [layer, setLayer] = useState(null);
192
- const onScroll = () => layer?.dispatchEvent(new CustomEvent(LAYER_REPOSITION_EVENT));
193
- const stop = (id, col) => id === active && column === col;
194
- const grid = {
195
- expanded: (id) => expanded.has(id),
196
- expandable: (id) => treeExpandable(model, id),
197
- toggle,
198
- tabStop: stop,
199
- opened: (id, col) => {
200
- setActive(id);
201
- setColumn(col);
202
- },
203
- press: (id) => ({
204
- onMouseDown: (event) => {
205
- event.preventDefault();
206
- focusAt(id, null);
207
- }
208
- }),
209
- menuOpen: (id) => menuFor === id,
210
- setMenuOpen: (id, open) => setMenuFor((was) => open ? id : was === id ? null : was)
211
- };
212
- const template = columns.map((one) => one.width ?? "minmax(0, 1fr)").join(" ");
213
- return /* @__PURE__ */ jsx("div", { className: cx("crewlet-tree-grid", headless && "crewlet-tree-grid--headless", className), children: /* @__PURE__ */ jsxs(LayerHost, { className: "crewlet-tree-grid__layer", children: [
214
- /* @__PURE__ */ jsx("div", { className: "crewlet-tree-grid__scroller", onScroll, children: /* @__PURE__ */ jsxs(
215
- "div",
216
- {
217
- role: "treegrid",
218
- "aria-label": label,
219
- "aria-colcount": columns.length,
220
- "aria-readonly": readOnly || void 0,
221
- className: "crewlet-tree-grid__grid",
222
- style: { "--crewlet-tree-grid-columns": template },
223
- onKeyDownCapture,
224
- children: [
225
- /* @__PURE__ */ jsx("div", { role: "rowgroup", className: "crewlet-tree-grid__head", children: /* @__PURE__ */ jsx("div", { role: "row", className: "crewlet-tree-grid__row", children: columns.map((one, index) => /* @__PURE__ */ jsx("div", { role: "columnheader", "aria-colindex": index + 1, children: one.headerHidden ? /* @__PURE__ */ jsx(VisuallyHidden, { children: one.header }) : one.header }, one.key)) }) }),
226
- /* @__PURE__ */ jsx("div", { role: "rowgroup", children: rows.map((id) => {
227
- const add = isAddRow(id);
228
- const cells = add ? add.cells : columns.length;
229
- const expandable = treeExpandable(model, id);
230
- const open = expanded.has(id);
231
- const name = model.label.get(id) ?? "";
232
- return (
233
- /* The row's keys are the GRID's, captured at the treegrid so
234
- one handler serves every row and reaches a cell's control
235
- first. A listener on the row itself would be a second
236
- place for them to live. */
237
- /* eslint-disable-next-line jsx-a11y/click-events-have-key-events -- see above */
238
- /* @__PURE__ */ jsx(
239
- "div",
240
- {
241
- role: "row",
242
- "data-tree-id": id,
243
- ref: rowRef(id),
244
- tabIndex: id === active && column === null ? 0 : -1,
245
- "aria-level": treeLevel(model, id),
246
- "aria-setsize": treeSetSize(model, id),
247
- "aria-posinset": treePosInSet(model, id),
248
- "aria-expanded": expandable ? open : void 0,
249
- "aria-selected": add ? void 0 : id === selectedId,
250
- "aria-label": add ? add.label : void 0,
251
- className: cx("crewlet-tree-grid__row", add && "crewlet-tree-grid__row--add"),
252
- style: { "--crewlet-tree-grid-depth": treeLevel(model, id) - 1 },
253
- onClick: (event) => {
254
- if (event.target.closest("button, [role='menu']")) return;
255
- focusAt(id, null);
256
- },
257
- children: Array.from({ length: cells }, (_, index) => {
258
- const col = index + 1;
259
- return /* @__PURE__ */ jsxs(
260
- "div",
261
- {
262
- role: "gridcell",
263
- "aria-colindex": col,
264
- tabIndex: stop(id, col) && !cellHasControl?.(id, col) ? 0 : -1,
265
- className: "crewlet-tree-grid__cell",
266
- children: [
267
- col === 1 && /* THE PRESS LANDS ON THE ROW. The chevron is a
268
- pointer-only control hidden from assistive
269
- technology (the keyboard opens and closes a row
270
- with Right and Left), and focus inside a hidden
271
- subtree is focus nowhere, so the press is stopped
272
- from focusing it and the row takes the focus. */
273
- /* @__PURE__ */ jsx(
274
- "span",
275
- {
276
- className: "crewlet-tree-grid__toggle",
277
- "data-open": open ? "" : void 0,
278
- "aria-hidden": "true",
279
- ...grid.press(id),
280
- children: expandable && /* @__PURE__ */ jsx(
281
- IconButton,
282
- {
283
- size: "sm",
284
- label: open ? text.collapse(name) : text.expand(name),
285
- icon: /* @__PURE__ */ jsx(ChevronRightGlyph, {}),
286
- tabIndex: -1,
287
- onClick: () => toggle(id)
288
- }
289
- )
290
- }
291
- ),
292
- renderCell(id, col, grid)
293
- ]
294
- },
295
- col
296
- );
297
- })
298
- },
299
- id
300
- )
301
- );
302
- }) })
303
- ]
304
- }
305
- ) }),
306
- /* @__PURE__ */ jsx(LayerNodeBridge, { onNode: setLayer })
307
- ] }) });
308
- }
309
-
310
- export { TreeGrid };
File without changes