@crewlethq/ui 0.17.1 → 0.19.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 (226) hide show
  1. package/README.md +55 -3
  2. package/dist/AccessDeniedCard/AccessDeniedCard.d.ts +39 -0
  3. package/dist/AccessDeniedCard/index.d.ts +3 -0
  4. package/dist/AccessDeniedCard/index.js +8 -0
  5. package/dist/AccessDeniedCard-WXM5DBDZ.css +8 -0
  6. package/dist/AppShell/index.js +2 -2
  7. package/dist/ArrangeBoard/ArrangeBoard.d.ts +32 -0
  8. package/dist/ArrangeBoard/index.d.ts +3 -0
  9. package/dist/ArrangeBoard/index.js +2 -0
  10. package/dist/ArrangeBoard-MQE35P6Z.css +80 -0
  11. package/dist/ArrangeFrame/ArrangeFrame.d.ts +82 -0
  12. package/dist/ArrangeFrame/index.d.ts +5 -0
  13. package/dist/ArrangeFrame/index.js +5 -0
  14. package/dist/ArrangeFrame/useGridResize.d.ts +66 -0
  15. package/dist/ArrangeFrame-3PLZAG22.css +329 -0
  16. package/dist/ArrangeGroup/ArrangeGroup.d.ts +42 -0
  17. package/dist/ArrangeGroup/index.d.ts +3 -0
  18. package/dist/ArrangeGroup/index.js +4 -0
  19. package/dist/ArrangeGroup-SHFHA7BE.css +170 -0
  20. package/dist/ArrangeList/ArrangeList.d.ts +64 -0
  21. package/dist/ArrangeList/index.d.ts +3 -0
  22. package/dist/ArrangeList/index.js +10 -0
  23. package/dist/ArrangeList-NNRTDFI5.css +94 -0
  24. package/dist/ArtifactCard/ArtifactCard.d.ts +61 -0
  25. package/dist/ArtifactCard/index.d.ts +3 -0
  26. package/dist/ArtifactCard/index.js +12 -0
  27. package/dist/ArtifactCard-EXVAEBV6.css +109 -0
  28. package/dist/AuthLayout/index.js +2 -2
  29. package/dist/AvatarPicker/index.js +5 -5
  30. package/dist/Canvas/index.js +2 -2
  31. package/dist/Card/index.js +1 -1
  32. package/dist/ChangeMark/ChangeMark.d.ts +26 -0
  33. package/dist/ChangeMark/index.d.ts +3 -0
  34. package/dist/ChangeMark/index.js +8 -0
  35. package/dist/ChangeMark-3VMTW7MT.css +22 -0
  36. package/dist/Checkbox/index.js +3 -3
  37. package/dist/Combobox/index.js +3 -3
  38. package/dist/CommandPalette/index.js +5 -5
  39. package/dist/Composer/index.js +3 -3
  40. package/dist/ConfirmField/index.js +3 -3
  41. package/dist/CursorFlag/CursorFlag.d.ts +34 -0
  42. package/dist/CursorFlag/index.d.ts +3 -0
  43. package/dist/CursorFlag/index.js +3 -0
  44. package/dist/CursorFlag-AJQJBUGY.css +61 -0
  45. package/dist/DataTable/index.js +7 -7
  46. package/dist/DataView/index.js +13 -13
  47. package/dist/DateTimePicker/index.js +2 -2
  48. package/dist/Divider/Divider.d.ts +15 -0
  49. package/dist/Divider/index.d.ts +3 -0
  50. package/dist/Divider/index.js +2 -0
  51. package/dist/Divider-3Z77ZAJH.css +37 -0
  52. package/dist/FollowBanner/FollowBanner.d.ts +35 -0
  53. package/dist/FollowBanner/index.d.ts +2 -0
  54. package/dist/FollowBanner/index.js +7 -0
  55. package/dist/FrameProtocol/index.d.ts +2 -0
  56. package/dist/FrameProtocol/index.js +2 -0
  57. package/dist/FrameProtocol/protocol.d.ts +164 -0
  58. package/dist/HuePicker/HuePicker.d.ts +16 -4
  59. package/dist/HuePicker/index.js +3 -3
  60. package/dist/{HuePicker-5QIUR6L7.css → HuePicker-PAIGH6LR.css} +6 -0
  61. package/dist/IconTile/IconTile.d.ts +23 -0
  62. package/dist/IconTile/index.d.ts +3 -0
  63. package/dist/IconTile/index.js +2 -0
  64. package/dist/IconTile-4GNWTLAW.css +30 -0
  65. package/dist/Input/index.js +2 -2
  66. package/dist/LinkInterstitial/LinkInterstitial.d.ts +41 -0
  67. package/dist/LinkInterstitial/index.d.ts +3 -0
  68. package/dist/LinkInterstitial/index.js +11 -0
  69. package/dist/LinkInterstitial-ET4MSVSV.css +34 -0
  70. package/dist/ListInput/index.js +4 -4
  71. package/dist/LiveCursor/LiveCursor.d.ts +34 -0
  72. package/dist/LiveCursor/index.d.ts +3 -0
  73. package/dist/LiveCursor/index.js +4 -0
  74. package/dist/LiveCursor-DZHGIYWE.css +47 -0
  75. package/dist/MarkdownEditor/index.js +3 -3
  76. package/dist/Menu/index.js +2 -2
  77. package/dist/Modal/Modal.d.ts +20 -0
  78. package/dist/Modal/index.js +2 -2
  79. package/dist/{Modal-RQAYGG4L.css → Modal-XOSV6FAH.css} +14 -0
  80. package/dist/Note/Note.d.ts +23 -0
  81. package/dist/Note/index.d.ts +3 -0
  82. package/dist/Note/index.js +2 -0
  83. package/dist/Note-RT4L6VUT.css +58 -0
  84. package/dist/OrgTable/index.js +5 -5
  85. package/dist/PinTile/PinTile.d.ts +37 -0
  86. package/dist/PinTile/index.d.ts +3 -0
  87. package/dist/PinTile/index.js +4 -0
  88. package/dist/PinTile-IIA25MNZ.css +141 -0
  89. package/dist/PresenceModel/index.d.ts +2 -0
  90. package/dist/PresenceModel/index.js +3 -0
  91. package/dist/PresenceModel/presence.d.ts +80 -0
  92. package/dist/PresenceRing/PresenceRing.d.ts +31 -0
  93. package/dist/PresenceRing/index.d.ts +3 -0
  94. package/dist/PresenceRing/index.js +2 -0
  95. package/dist/PresenceRing-M4C22Q6U.css +68 -0
  96. package/dist/PresenceStack/PresenceStack.d.ts +36 -0
  97. package/dist/PresenceStack/index.d.ts +3 -0
  98. package/dist/PresenceStack/index.js +9 -0
  99. package/dist/PresenceStack-QSXQJND5.css +59 -0
  100. package/dist/PricingCard/index.js +2 -2
  101. package/dist/Principal/Principal.d.ts +35 -0
  102. package/dist/Principal/index.d.ts +2 -0
  103. package/dist/Principal/index.js +4 -0
  104. package/dist/PrincipalPicker/PrincipalPicker.d.ts +45 -0
  105. package/dist/PrincipalPicker/index.d.ts +3 -0
  106. package/dist/PrincipalPicker/index.js +12 -0
  107. package/dist/PrincipalPicker-7NNZTGUP.css +41 -0
  108. package/dist/Reorder/index.d.ts +2 -0
  109. package/dist/Reorder/index.js +4 -0
  110. package/dist/Reorder/useReorder.d.ts +138 -0
  111. package/dist/SandboxedFrame/SandboxedFrame.d.ts +142 -0
  112. package/dist/SandboxedFrame/index.d.ts +3 -0
  113. package/dist/SandboxedFrame/index.js +8 -0
  114. package/dist/SandboxedFrame-L6HBQZCD.css +50 -0
  115. package/dist/ShareDialog/ShareDialog.d.ts +101 -0
  116. package/dist/ShareDialog/index.d.ts +5 -0
  117. package/dist/ShareDialog/index.js +19 -0
  118. package/dist/ShareDialog/roles.d.ts +10 -0
  119. package/dist/ShareDialog-YZ4F37MW.css +146 -0
  120. package/dist/SheetGrid/SheetGrid.d.ts +78 -0
  121. package/dist/SheetGrid/cells.d.ts +117 -0
  122. package/dist/SheetGrid/index.d.ts +5 -0
  123. package/dist/SheetGrid/index.js +18 -0
  124. package/dist/SheetGrid-4HOXDVIB.css +595 -0
  125. package/dist/SheetModel/clipboard.d.ts +37 -0
  126. package/dist/SheetModel/edits.d.ts +68 -0
  127. package/dist/SheetModel/index.d.ts +14 -0
  128. package/dist/SheetModel/index.js +3 -0
  129. package/dist/SheetModel/labels.d.ts +71 -0
  130. package/dist/SheetModel/navigation.d.ts +79 -0
  131. package/dist/SheetModel/options.d.ts +28 -0
  132. package/dist/SheetModel/types.d.ts +126 -0
  133. package/dist/SheetModel/values.d.ts +76 -0
  134. package/dist/SheetModel/view.d.ts +32 -0
  135. package/dist/StatGroup/StatGroup.d.ts +7 -1
  136. package/dist/StatGroup/index.js +1 -1
  137. package/dist/{StatGroup-HVG6O62W.css → StatGroup-PADTJCUQ.css} +7 -0
  138. package/dist/Switcher/index.js +8 -8
  139. package/dist/Tag/Tag.d.ts +13 -0
  140. package/dist/Tag/index.js +1 -1
  141. package/dist/{Tag-4BRQS6GN.css → Tag-SRGTK5KI.css} +42 -0
  142. package/dist/TagsInput/index.js +4 -4
  143. package/dist/ThemeSwitcher/apply.d.ts +43 -0
  144. package/dist/ThemeSwitcher/index.d.ts +4 -2
  145. package/dist/ThemeSwitcher/index.js +3 -2
  146. package/dist/ThemeSwitcher/preferences.d.ts +2 -19
  147. package/dist/ThemeToggle/index.js +3 -2
  148. package/dist/TimeWindowPicker/index.js +4 -4
  149. package/dist/Timeline/Timeline.d.ts +7 -2
  150. package/dist/Timeline/index.js +1 -1
  151. package/dist/TreeCanvas/index.js +3 -3
  152. package/dist/TreeGrid/index.js +2 -2
  153. package/dist/VersionTimeline/VersionTimeline.d.ts +76 -0
  154. package/dist/VersionTimeline/index.d.ts +3 -0
  155. package/dist/VersionTimeline/index.js +10 -0
  156. package/dist/VersionTimeline-EBJ6MIPJ.css +108 -0
  157. package/dist/{chunk-SBRE7IML.js → chunk-2ONWEDQT.js} +1 -1
  158. package/dist/chunk-35XVR5JQ.js +81 -0
  159. package/dist/chunk-3BYIWOTV.js +29 -0
  160. package/dist/chunk-4KP4RC3O.js +25 -0
  161. package/dist/chunk-5XACKNYR.js +53 -0
  162. package/dist/chunk-63WJLRB2.js +24 -0
  163. package/dist/{chunk-L4ZLXYPO.js → chunk-6A7P6II6.js} +1 -1
  164. package/dist/chunk-6KWNXIDE.js +18 -0
  165. package/dist/chunk-6MIXD6IW.js +49 -0
  166. package/dist/{chunk-FA2V2VT6.js → chunk-7FQEUNHX.js} +4 -4
  167. package/dist/{chunk-DEEVA6TV.js → chunk-7IJARUIF.js} +17 -4
  168. package/dist/{chunk-JCO3SIST.js → chunk-7ZNKEPLN.js} +2 -2
  169. package/dist/chunk-AIVZVKYZ.js +126 -0
  170. package/dist/{chunk-FSKTOIYC.js → chunk-AJESMWJS.js} +5 -5
  171. package/dist/{chunk-O67VF5MS.js → chunk-AUQPBL4O.js} +2 -2
  172. package/dist/chunk-CENOOTAV.js +1 -0
  173. package/dist/chunk-DEJHAOC5.js +279 -0
  174. package/dist/{chunk-UCYIRDND.js → chunk-DQSXWQMJ.js} +1 -1
  175. package/dist/{chunk-JF7X673Z.js → chunk-EIGEIT4O.js} +2 -2
  176. package/dist/chunk-F6V2PTN6.js +142 -0
  177. package/dist/chunk-FFMCMSJB.js +1 -0
  178. package/dist/chunk-FW7HN6AP.js +40 -0
  179. package/dist/chunk-G3EEUNZQ.js +46 -0
  180. package/dist/{chunk-LOECRMHA.js → chunk-GFV4LJHH.js} +4 -3
  181. package/dist/chunk-HTCJSUIZ.js +216 -0
  182. package/dist/{chunk-75CLJNDQ.js → chunk-I6NZKJGK.js} +1 -1
  183. package/dist/chunk-I6POAB4V.js +20 -0
  184. package/dist/chunk-IXJHTFXG.js +17 -0
  185. package/dist/chunk-JEDWC3GI.js +98 -0
  186. package/dist/{chunk-QVAFL2LE.js → chunk-JXRI5YD2.js} +3 -3
  187. package/dist/{chunk-ZFH7H7GS.js → chunk-LOLELDBW.js} +1 -1
  188. package/dist/{chunk-6TSZCBID.js → chunk-NP2C4Y4E.js} +1 -1
  189. package/dist/{chunk-6NN2F7GM.js → chunk-OIMAK5AE.js} +6 -6
  190. package/dist/chunk-PPAQFGS2.js +12 -0
  191. package/dist/chunk-PUQY4WXR.js +1235 -0
  192. package/dist/chunk-QO7QEQKV.js +24 -0
  193. package/dist/chunk-RT323I4I.js +49 -0
  194. package/dist/chunk-S35G6PNC.js +80 -0
  195. package/dist/{chunk-HENOTGUV.js → chunk-T7ICFXEC.js} +2 -2
  196. package/dist/{chunk-2OLCUNG7.js → chunk-TBIZSQHB.js} +1 -1
  197. package/dist/chunk-TODND5AD.js +99 -0
  198. package/dist/{chunk-PQ63NLFC.js → chunk-UXELEORU.js} +3 -3
  199. package/dist/{chunk-6NIMZ5XC.js → chunk-VJLYGPPE.js} +1 -1
  200. package/dist/chunk-VYDFB6PJ.js +243 -0
  201. package/dist/{chunk-7QFAORCY.js → chunk-WHZFDS62.js} +1 -1
  202. package/dist/chunk-WXAULPBH.js +135 -0
  203. package/dist/chunk-XJ2QEBMM.js +277 -0
  204. package/dist/{chunk-NXDEPUVG.js → chunk-XU4ZUGLE.js} +20 -5
  205. package/dist/chunk-YM3GJHGW.js +69 -0
  206. package/dist/{chunk-T3ZWBZ65.js → chunk-YSJYWQSP.js} +2 -2
  207. package/dist/{chunk-CXBAIVYZ.js → chunk-YSY6UJ4F.js} +1 -1
  208. package/dist/chunk-YYZRLLLY.js +822 -0
  209. package/dist/{chunk-EG6NYWVK.js → chunk-YZCJ63JF.js} +1 -1
  210. package/dist/{chunk-K3OWD7BJ.js → chunk-Z24ZUSTX.js} +4 -19
  211. package/dist/chunk-ZXXDZJQN.js +36 -0
  212. package/dist/generated/index.d.ts +27 -0
  213. package/dist/generated/index.js +98 -69
  214. package/dist/index.js +98 -69
  215. package/dist/styles.css +13625 -11206
  216. package/dist/utils/index.js +1 -1
  217. package/package.json +3 -3
  218. package/dist/chunk-EXHQ2QVW.js +0 -1
  219. package/dist/{chunk-CRVETI5L.js → chunk-4Z7PW3L6.js} +0 -0
  220. package/dist/{chunk-OYOQU7O5.js → chunk-EDGCPVVD.js} +1 -1
  221. package/dist/{chunk-NS7BVLL3.js → chunk-JULMZNGT.js} +1 -1
  222. package/dist/{chunk-2UU5IGZI.js → chunk-L4H7SSWF.js} +1 -1
  223. package/dist/{chunk-4GB57WIT.js → chunk-Q55TXPA3.js} +1 -1
  224. package/dist/{chunk-77IEHFY4.js → chunk-QQGWES46.js} +1 -1
  225. package/dist/{chunk-B2Z2CDM5.js → chunk-T5TFZ2JB.js} +1 -1
  226. package/dist/{chunk-AMH67MLM.js → chunk-TXAFKH2A.js} +1 -1
@@ -0,0 +1,135 @@
1
+ import { Timeline } from './chunk-AUQPBL4O.js';
2
+ import { Button } from './chunk-OG6CL3EB.js';
3
+ import { PrincipalAvatar } from './chunk-4KP4RC3O.js';
4
+ import { RelativeTime } from './chunk-3CZ7XAVY.js';
5
+ import { cx } from './chunk-ODEQTPFM.js';
6
+ import './VersionTimeline-EBJ6MIPJ.css';
7
+ import { RotateCcwClockGlyph, PencilGlyph, ShieldGlyph, DatabaseGlyph, UploadGlyph } from '@crewlethq/icons/glyphs';
8
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
+
10
+ var LABELS = {
11
+ list: "Versions",
12
+ version: (version) => `Version ${version}`,
13
+ latest: "Latest",
14
+ publish: "Published",
15
+ restore: (from) => from === void 0 ? "Restored" : `Restored version ${from}`,
16
+ schema: "Schema changed",
17
+ capabilities: "Capabilities changed",
18
+ compare: "Compare",
19
+ compareWith: (version) => `Compare with version ${version}`,
20
+ restoreAction: "Restore",
21
+ restoreVersion: (version) => `Restore version ${version}`,
22
+ labelAction: "Name",
23
+ labelVersion: (version) => `Name version ${version}`,
24
+ retention: (oldestKept) => oldestKept > 2 ? `Versions 1 to ${oldestKept - 1} are past the retention window and are no longer kept.` : "Version 1 is past the retention window and is no longer kept."
25
+ };
26
+ var GLYPHS = {
27
+ publish: /* @__PURE__ */ jsx(UploadGlyph, { size: "xs" }),
28
+ restore: /* @__PURE__ */ jsx(RotateCcwClockGlyph, { size: "xs" }),
29
+ schema: /* @__PURE__ */ jsx(DatabaseGlyph, { size: "xs" }),
30
+ capabilities: /* @__PURE__ */ jsx(ShieldGlyph, { size: "xs" })
31
+ };
32
+ function VersionTimeline({
33
+ versions,
34
+ latest,
35
+ selected,
36
+ against,
37
+ onSelect,
38
+ onCompare,
39
+ onRestore,
40
+ onLabel,
41
+ oldestKept,
42
+ now,
43
+ labels,
44
+ className,
45
+ ...rest
46
+ }) {
47
+ const text = { ...LABELS, ...labels };
48
+ const newest = latest ?? versions.reduce((high, item) => Math.max(high, item.version), 0);
49
+ const gap = oldestKept !== void 0 && oldestKept > 1;
50
+ return /* @__PURE__ */ jsxs("nav", { ...rest, "aria-label": text.list, className: cx("crewlet-version-timeline", className), children: [
51
+ /* @__PURE__ */ jsx(Timeline, { children: versions.map((item) => {
52
+ const kind = item.kind ?? "publish";
53
+ const current = item.version === selected;
54
+ const compared = item.version === against;
55
+ const what = kind === "restore" ? text.restore(item.restoredFrom) : text[kind];
56
+ return /* @__PURE__ */ jsxs(
57
+ Timeline.Item,
58
+ {
59
+ marker: GLYPHS[kind],
60
+ label: false,
61
+ className: cx(current && "is-current", compared && "is-compared"),
62
+ children: [
63
+ /* @__PURE__ */ jsxs(
64
+ "button",
65
+ {
66
+ type: "button",
67
+ className: "crewlet-version-timeline__select",
68
+ "aria-current": current || void 0,
69
+ onClick: () => onSelect(item.version),
70
+ children: [
71
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-version-timeline__head", children: [
72
+ /* @__PURE__ */ jsx("span", { className: "crewlet-version-timeline__number", children: text.version(item.version) }),
73
+ item.version === newest ? /* @__PURE__ */ jsx("span", { className: "crewlet-version-timeline__latest", children: text.latest }) : null,
74
+ item.label ? /* @__PURE__ */ jsx("span", { className: "crewlet-version-timeline__label", children: item.label }) : null
75
+ ] }),
76
+ /* @__PURE__ */ jsx("span", { className: "crewlet-version-timeline__summary", children: item.summary ?? what })
77
+ ]
78
+ }
79
+ ),
80
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-version-timeline__meta", children: [
81
+ /* @__PURE__ */ jsx(PrincipalAvatar, { principal: item.author, size: "xs" }),
82
+ /* @__PURE__ */ jsx("span", { children: item.author.name }),
83
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xB7" }),
84
+ /* @__PURE__ */ jsx(RelativeTime, { value: item.at, now }),
85
+ item.summary ? /* @__PURE__ */ jsxs(Fragment, { children: [
86
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xB7" }),
87
+ /* @__PURE__ */ jsx("span", { children: what })
88
+ ] }) : null
89
+ ] }),
90
+ item.source ? /* @__PURE__ */ jsx("span", { className: "crewlet-version-timeline__source", children: item.source }) : null,
91
+ onCompare || onRestore || onLabel ? /* @__PURE__ */ jsxs("span", { className: "crewlet-version-timeline__actions", children: [
92
+ onCompare && !current ? /* @__PURE__ */ jsx(
93
+ Button,
94
+ {
95
+ size: "small",
96
+ variant: "ghost",
97
+ pressed: compared,
98
+ "aria-label": text.compareWith(item.version),
99
+ onClick: () => onCompare(compared ? null : item.version),
100
+ children: text.compare
101
+ }
102
+ ) : null,
103
+ onRestore && item.version !== newest ? /* @__PURE__ */ jsx(
104
+ Button,
105
+ {
106
+ size: "small",
107
+ variant: "ghost",
108
+ leadingIcon: /* @__PURE__ */ jsx(RotateCcwClockGlyph, {}),
109
+ "aria-label": text.restoreVersion(item.version),
110
+ onClick: () => onRestore(item.version),
111
+ children: text.restoreAction
112
+ }
113
+ ) : null,
114
+ onLabel ? /* @__PURE__ */ jsx(
115
+ Button,
116
+ {
117
+ size: "small",
118
+ variant: "ghost",
119
+ leadingIcon: /* @__PURE__ */ jsx(PencilGlyph, {}),
120
+ "aria-label": text.labelVersion(item.version),
121
+ onClick: () => onLabel(item.version),
122
+ children: text.labelAction
123
+ }
124
+ ) : null
125
+ ] }) : null
126
+ ]
127
+ },
128
+ item.version
129
+ );
130
+ }) }),
131
+ gap ? /* @__PURE__ */ jsx("p", { className: "crewlet-version-timeline__gap", children: text.retention(oldestKept) }) : null
132
+ ] });
133
+ }
134
+
135
+ export { VersionTimeline };
@@ -0,0 +1,277 @@
1
+ import { announce } from './chunk-RSAQOKH3.js';
2
+ import { useId, useState, useRef, useCallback, useLayoutEffect, useMemo } from 'react';
3
+
4
+ var DEFAULT_REORDER_LABELS = {
5
+ handle: (name) => `Move ${name}`,
6
+ hint: "Drag to move, or press the arrow keys.",
7
+ moved: (name, position, total) => `${name} moved to position ${position} of ${total}.`
8
+ };
9
+ function moveKey(keys, key, to) {
10
+ const next = keys.filter((k) => k !== key);
11
+ next.splice(Math.max(0, Math.min(to, next.length)), 0, key);
12
+ return next;
13
+ }
14
+ function listOf(lists, key) {
15
+ for (const [id, keys] of Object.entries(lists)) if (keys.includes(key)) return id;
16
+ return null;
17
+ }
18
+ function place(lists, key, list, index) {
19
+ const next = {};
20
+ for (const [id, keys] of Object.entries(lists)) next[id] = keys.filter((k) => k !== key);
21
+ const target = next[list] ?? [];
22
+ target.splice(Math.max(0, Math.min(index, target.length)), 0, key);
23
+ next[list] = target;
24
+ return next;
25
+ }
26
+ var SETTLE_MS = 200;
27
+ var settleMs = () => typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? 20 : SETTLE_MS;
28
+ var now = () => typeof performance !== "undefined" ? performance.now() : Date.now();
29
+ function byRows(node, axis) {
30
+ if (axis === "vertical") return true;
31
+ const row = node.parentElement?.getBoundingClientRect();
32
+ return row !== void 0 && node.getBoundingClientRect().width > row.width * 0.75;
33
+ }
34
+ var lineOf = (node, axis) => byRows(node, axis) ? "horizontal" : "vertical";
35
+ function inEarlierHalf(node, axis, x, y) {
36
+ const r = node.getBoundingClientRect();
37
+ return byRows(node, axis) ? y < r.top + r.height / 2 : x < r.left + r.width / 2;
38
+ }
39
+ function lastOf(keys, except) {
40
+ const rest = (keys ?? []).filter((k) => k !== except);
41
+ return rest[rest.length - 1];
42
+ }
43
+ var sameLists = (a, b) => JSON.stringify(a) === JSON.stringify(b);
44
+ var PREVIOUS = {
45
+ vertical: ["ArrowUp"],
46
+ grid: ["ArrowUp", "ArrowLeft"]
47
+ };
48
+ var NEXT = {
49
+ vertical: ["ArrowDown"],
50
+ grid: ["ArrowDown", "ArrowRight"]
51
+ };
52
+ function useReorderLists({
53
+ lists,
54
+ onReorder,
55
+ nameOf,
56
+ accepts,
57
+ axis = "vertical",
58
+ labels: labelOverrides
59
+ }) {
60
+ const labels = { ...DEFAULT_REORDER_LABELS, ...labelOverrides };
61
+ const hintId = `${useId()}-reorder-hint`;
62
+ const [dragging, setDragging] = useState(null);
63
+ const [preview, setPreview] = useState(null);
64
+ const [target, setTarget] = useState(
65
+ null
66
+ );
67
+ const shown = preview ?? lists;
68
+ const nodes = useRef(/* @__PURE__ */ new Map());
69
+ const before = useRef(/* @__PURE__ */ new Map());
70
+ const measure = useCallback(() => {
71
+ before.current = /* @__PURE__ */ new Map();
72
+ for (const [key, node] of nodes.current) {
73
+ for (const a of node.getAnimations?.() ?? []) a.finish();
74
+ before.current.set(key, node.getBoundingClientRect());
75
+ }
76
+ }, []);
77
+ const shape = JSON.stringify(shown);
78
+ useLayoutEffect(() => {
79
+ const last = before.current;
80
+ before.current = /* @__PURE__ */ new Map();
81
+ if (last.size === 0) return;
82
+ if (typeof window === "undefined" || window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
83
+ for (const [key, node] of nodes.current) {
84
+ const was = last.get(key);
85
+ if (!was) continue;
86
+ const now2 = node.getBoundingClientRect();
87
+ const dx = was.left - now2.left;
88
+ const dy = was.top - now2.top;
89
+ if (dx === 0 && dy === 0) continue;
90
+ node.animate?.([{ transform: `translate(${dx}px, ${dy}px)` }, { transform: "translate(0, 0)" }], {
91
+ duration: 180,
92
+ easing: "cubic-bezier(0.2, 0, 0, 1)"
93
+ });
94
+ }
95
+ }, [shape]);
96
+ const said = useRef(labels.moved);
97
+ said.current = labels.moved;
98
+ const commit = useCallback(
99
+ (next, moved) => {
100
+ onReorder(next);
101
+ const list = listOf(next, moved);
102
+ const keys = list ? next[list] ?? [] : [];
103
+ announce(said.current(nameOf(moved), keys.indexOf(moved) + 1, keys.length));
104
+ },
105
+ [onReorder, nameOf]
106
+ );
107
+ const move = useCallback(
108
+ (key, by) => {
109
+ const list = listOf(lists, key);
110
+ if (list === null) return;
111
+ const keys = lists[list] ?? [];
112
+ const at = keys.indexOf(key);
113
+ const to = Math.max(0, Math.min(keys.length - 1, at + by));
114
+ if (to === at) return;
115
+ measure();
116
+ commit(place(lists, key, list, to), key);
117
+ },
118
+ [lists, measure, commit]
119
+ );
120
+ const moveTo = useCallback(
121
+ (key, list) => {
122
+ if (listOf(lists, key) === list) return;
123
+ if (accepts && !accepts(key, list)) return;
124
+ measure();
125
+ commit(place(lists, key, list, (lists[list] ?? []).length), key);
126
+ },
127
+ [lists, accepts, measure, commit]
128
+ );
129
+ const settled = useRef(0);
130
+ const insertionPoint = (list, moved, x, y) => {
131
+ let last;
132
+ for (const k of preview?.[list] ?? []) {
133
+ if (k === moved) continue;
134
+ const node = nodes.current.get(k);
135
+ if (!node) continue;
136
+ last = node;
137
+ const r = node.getBoundingClientRect();
138
+ if (y < r.top || y <= r.bottom && inEarlierHalf(node, axis, x, y)) {
139
+ return { list, before: k, line: lineOf(node, axis) };
140
+ }
141
+ }
142
+ return { list, before: null, line: last ? lineOf(last, axis) : "vertical" };
143
+ };
144
+ const aim = (list, moved, x, y) => {
145
+ const next = insertionPoint(list, moved, x, y);
146
+ if (target?.list !== next.list || target.before !== next.before || target.line !== next.line) setTarget(next);
147
+ };
148
+ const reset = () => {
149
+ setDragging(null);
150
+ setPreview(null);
151
+ setTarget(null);
152
+ settled.current = 0;
153
+ };
154
+ const drop = (event) => {
155
+ if (dragging === null || !preview) return;
156
+ event.preventDefault();
157
+ event.stopPropagation();
158
+ const moved = dragging;
159
+ let next = preview;
160
+ if (target) {
161
+ const keys = (preview[target.list] ?? []).filter((k) => k !== moved);
162
+ const at = target.before === null ? keys.length : keys.indexOf(target.before);
163
+ next = place(preview, moved, target.list, at < 0 ? keys.length : at);
164
+ }
165
+ reset();
166
+ if (!sameLists(next, lists)) {
167
+ measure();
168
+ commit(next, moved);
169
+ }
170
+ };
171
+ const handleProps = (key) => ({
172
+ draggable: true,
173
+ "aria-label": labels.handle(nameOf(key)),
174
+ "aria-describedby": hintId,
175
+ onDragStart: (event) => {
176
+ event.stopPropagation();
177
+ event.dataTransfer.effectAllowed = "move";
178
+ event.dataTransfer.setData("text/plain", nameOf(key));
179
+ const node = nodes.current.get(key);
180
+ if (node) event.dataTransfer.setDragImage(node, 24, 16);
181
+ setDragging(key);
182
+ setPreview(Object.fromEntries(Object.entries(lists).map(([id, keys]) => [id, [...keys]])));
183
+ },
184
+ // Whatever ended the drag, the preview goes: a drop has already committed.
185
+ onDragEnd: reset,
186
+ onKeyDown: (event) => {
187
+ if (event.altKey || event.ctrlKey || event.metaKey) return;
188
+ const by = PREVIOUS[axis].includes(event.key) ? -1 : NEXT[axis].includes(event.key) ? 1 : 0;
189
+ if (by === 0) return;
190
+ event.preventDefault();
191
+ event.stopPropagation();
192
+ move(key, by);
193
+ }
194
+ });
195
+ const markerOf = (key) => {
196
+ if (!target) return {};
197
+ const edge = target.before === key ? "before" : target.before === null && lastOf(preview?.[target.list], dragging) === key ? "after" : void 0;
198
+ return edge ? { "data-reorder-target": edge, "data-reorder-line": target.line } : {};
199
+ };
200
+ const itemProps = (key) => ({
201
+ ref: (node) => {
202
+ if (node) nodes.current.set(key, node);
203
+ else nodes.current.delete(key);
204
+ },
205
+ "data-reorder": dragging === key ? "dragging" : "idle",
206
+ ...markerOf(key),
207
+ onDragOver: (event) => {
208
+ if (dragging === null || !preview) return;
209
+ const list = listOf(preview, key);
210
+ if (list === null) return;
211
+ if (accepts && !accepts(dragging, list)) return;
212
+ event.preventDefault();
213
+ event.stopPropagation();
214
+ event.dataTransfer.dropEffect = "move";
215
+ if (key === dragging) return;
216
+ if (listOf(preview, dragging) !== list) {
217
+ aim(list, dragging, event.clientX, event.clientY);
218
+ return;
219
+ }
220
+ if (target) setTarget(null);
221
+ if (now() < settled.current) return;
222
+ const keys = preview[list] ?? [];
223
+ const from = keys.indexOf(dragging);
224
+ const to = keys.indexOf(key);
225
+ if (from === to) return;
226
+ const early = inEarlierHalf(event.currentTarget, axis, event.clientX, event.clientY);
227
+ if (from < to && early) return;
228
+ if (from > to && !early) return;
229
+ measure();
230
+ setPreview(place(preview, dragging, list, to));
231
+ settled.current = now() + settleMs();
232
+ },
233
+ onDrop: drop
234
+ });
235
+ const listProps = (list) => ({
236
+ // Lit only when the item would move INTO this list: reordering within a
237
+ // list is already shown by the items moving.
238
+ "data-reorder-over": dragging !== null && target?.list === list ? "true" : void 0,
239
+ onDragOver: (event) => {
240
+ if (dragging === null || !preview) return;
241
+ if (accepts && !accepts(dragging, list)) return;
242
+ event.preventDefault();
243
+ event.stopPropagation();
244
+ if (listOf(preview, dragging) === list) {
245
+ if (target) setTarget(null);
246
+ return;
247
+ }
248
+ aim(list, dragging, event.clientX, event.clientY);
249
+ },
250
+ onDrop: drop
251
+ });
252
+ return { lists: shown, dragging, handleProps, itemProps, listProps, move, moveTo, hintId, hint: labels.hint };
253
+ }
254
+ var ONLY = "list";
255
+ function useReorder({
256
+ keys,
257
+ onReorder,
258
+ nameOf,
259
+ axis,
260
+ labels
261
+ }) {
262
+ const lists = useMemo(() => ({ [ONLY]: keys }), [keys]);
263
+ const report = useCallback((next) => onReorder(next[ONLY] ?? []), [onReorder]);
264
+ const r = useReorderLists({ lists, onReorder: report, nameOf, axis, labels });
265
+ return {
266
+ order: r.lists[ONLY] ?? [],
267
+ dragging: r.dragging,
268
+ handleProps: r.handleProps,
269
+ itemProps: r.itemProps,
270
+ containerProps: r.listProps(ONLY),
271
+ move: r.move,
272
+ hintId: r.hintId,
273
+ hint: r.hint
274
+ };
275
+ }
276
+
277
+ export { DEFAULT_REORDER_LABELS, moveKey, useReorder, useReorderLists };
@@ -1,5 +1,5 @@
1
- import { NODE_HUES, NODE_HUE_NAMES } from './chunk-AYKXMIOR.js';
2
1
  import { SegmentedControl } from './chunk-26PEPONN.js';
2
+ import { NODE_HUES, NODE_HUE_NAMES } from './chunk-AYKXMIOR.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
@@ -11,16 +11,31 @@ var optionsFor = (disabled) => NODE_HUES.map((hue) => ({
11
11
  }));
12
12
  var ENABLED = optionsFor(false);
13
13
  var DISABLED = optionsFor(true);
14
- function HuePicker({ label, value, onValueChange, size, disabled = false, className }) {
14
+ function HuePicker(props) {
15
+ const { label, size, disabled = false, className } = props;
16
+ const hues = disabled ? DISABLED : ENABLED;
17
+ const options = props.none === void 0 ? hues : [
18
+ {
19
+ value: "none",
20
+ label: props.none,
21
+ icon: /* @__PURE__ */ jsx("span", { className: "crewlet-hue-picker__swatch crewlet-hue-picker__swatch--none" }),
22
+ disabled
23
+ },
24
+ ...hues
25
+ ];
15
26
  return /* @__PURE__ */ jsx(
16
27
  SegmentedControl,
17
28
  {
18
29
  semantics: "radio",
19
30
  layout: "chips",
20
31
  label,
21
- options: disabled ? DISABLED : ENABLED,
22
- value,
23
- onValueChange,
32
+ options,
33
+ value: props.value,
34
+ onValueChange: (next) => {
35
+ if (props.none === void 0) {
36
+ if (next !== "none") props.onValueChange(next);
37
+ } else props.onValueChange(next);
38
+ },
24
39
  size,
25
40
  className: cx("crewlet-hue-picker", className)
26
41
  }
@@ -0,0 +1,69 @@
1
+ import { presenceHueClass } from './chunk-I6POAB4V.js';
2
+ import { presenceLabels, presenceOrder } from './chunk-S35G6PNC.js';
3
+ import { AVATAR_SIZES, Avatar } from './chunk-5OM447RW.js';
4
+ import { VisuallyHidden } from './chunk-BZFWDIV6.js';
5
+ import { cx } from './chunk-ODEQTPFM.js';
6
+ import './PresenceStack-QSXQJND5.css';
7
+ import { isCrewletCharacter } from '@crewlethq/icons/characters';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
9
+
10
+ function PresenceStack({ members, self = true, max = 4, size = "sm", onSelect, label, labels, className }) {
11
+ if (!Number.isInteger(max) || max < 1) {
12
+ throw new RangeError(`PresenceStack max must be a whole number of at least 1; it was ${max}`);
13
+ }
14
+ const text = presenceLabels(labels);
15
+ const ordered = presenceOrder(members);
16
+ if (ordered.length === 0 && !self) return null;
17
+ const shown = ordered.slice(0, max);
18
+ const hidden = ordered.slice(max);
19
+ const here = label ?? text.here(ordered.length, self);
20
+ const spoken = [here, ...ordered.map((member) => text.member(member))].join(". ");
21
+ const badge = (member) => /* @__PURE__ */ jsx(
22
+ Avatar,
23
+ {
24
+ name: member.name,
25
+ kind: member.kind,
26
+ src: member.src,
27
+ character: member.character !== void 0 && isCrewletCharacter(member.character) ? member.character : void 0,
28
+ hue: member.kind === "agent" ? member.hue : void 0,
29
+ size,
30
+ decorative: true,
31
+ className: cx(
32
+ "crewlet-presence-stack__badge",
33
+ member.hue !== void 0 && member.activity !== "idle" && presenceHueClass(member.hue),
34
+ member.hue !== void 0 && member.activity !== "idle" && "crewlet-presence-stack__badge--present",
35
+ member.activity === "idle" && "crewlet-presence-stack__badge--idle"
36
+ )
37
+ }
38
+ );
39
+ const more = hidden.length > 0 ? /* @__PURE__ */ jsxs("span", { className: "crewlet-avatar-stack__member crewlet-avatar-stack__more", "aria-hidden": "true", children: [
40
+ "+",
41
+ hidden.length
42
+ ] }) : null;
43
+ const style = { "--crewlet-avatar-stack-size": `${AVATAR_SIZES[size]}px` };
44
+ if (onSelect === void 0) {
45
+ if (ordered.length === 0) return null;
46
+ return /* @__PURE__ */ jsxs("span", { className: cx("crewlet-avatar-stack", "crewlet-presence-stack", className), style, role: "img", "aria-label": spoken, children: [
47
+ shown.map((member) => /* @__PURE__ */ jsx("span", { className: cx("crewlet-avatar-stack__member", "crewlet-presence-stack__member", `crewlet-presence-stack__member--${member.kind}`), children: badge(member) }, member.id)),
48
+ more
49
+ ] });
50
+ }
51
+ return /* @__PURE__ */ jsxs("div", { className: cx("crewlet-avatar-stack", "crewlet-presence-stack", className), style, role: "group", "aria-label": here, children: [
52
+ shown.map((member) => /* @__PURE__ */ jsx(
53
+ "button",
54
+ {
55
+ type: "button",
56
+ className: cx("crewlet-avatar-stack__member", "crewlet-presence-stack__member", `crewlet-presence-stack__member--${member.kind}`),
57
+ "aria-label": text.member(member),
58
+ title: text.member(member),
59
+ onClick: () => onSelect(member),
60
+ children: badge(member)
61
+ },
62
+ member.id
63
+ )),
64
+ more,
65
+ hidden.length > 0 ? /* @__PURE__ */ jsx(VisuallyHidden, { children: `${text.more(hidden.length)}: ${hidden.map((member) => text.member(member)).join(", ")}` }) : null
66
+ ] });
67
+ }
68
+
69
+ export { PresenceStack };
@@ -1,8 +1,8 @@
1
1
  import { Kbd } from './chunk-SMBKXWML.js';
2
- import { FormField, Textarea, Input } from './chunk-4GB57WIT.js';
2
+ import { FormField, Textarea, Input } from './chunk-Q55TXPA3.js';
3
+ import { isComposing } from './chunk-R25RGPUB.js';
3
4
  import { announce } from './chunk-RSAQOKH3.js';
4
5
  import { IconButton } from './chunk-4FQT6ZAY.js';
5
- import { isComposing } from './chunk-R25RGPUB.js';
6
6
  import './ListInput-O7LJKOIG.css';
7
7
  import { useState, useRef, useLayoutEffect } from 'react';
8
8
  import { ArrowUpGlyph, ArrowDownGlyph, XGlyph, PlusGlyph } from '@crewlethq/icons/glyphs';
@@ -1,5 +1,5 @@
1
1
  import { InlineCode } from './chunk-5CLW2CXT.js';
2
- import { FormField, Input } from './chunk-4GB57WIT.js';
2
+ import { FormField, Input } from './chunk-Q55TXPA3.js';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
 
5
5
  function confirmMatches(typed, phrase) {