@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 @@
1
+ import './HuePicker-PAIGH6LR.css';
@@ -0,0 +1,40 @@
1
+ import { Callout } from './chunk-SVSCLHHI.js';
2
+ import { Button } from './chunk-OG6CL3EB.js';
3
+ import { isComposing } from './chunk-R25RGPUB.js';
4
+ import { cx } from './chunk-ODEQTPFM.js';
5
+ import { useEffect } from 'react';
6
+ import { EyeGlyph, UserGlyph } from '@crewlethq/icons/glyphs';
7
+ import { jsx } from 'react/jsx-runtime';
8
+
9
+ var LABELS = {
10
+ following: (name) => `Following ${name}. Press Esc or scroll to stop.`,
11
+ left: (name) => `${name} left. You stopped following.`,
12
+ stop: "Stop following",
13
+ dismiss: "Dismiss"
14
+ };
15
+ function FollowBanner({ name, state = "following", onStop, onDismiss, className, labels }) {
16
+ const text = { ...LABELS, ...labels };
17
+ const following = state === "following";
18
+ useEffect(() => {
19
+ if (!following) return void 0;
20
+ const onKeyDown = (event) => {
21
+ if (event.key !== "Escape" || event.defaultPrevented || isComposing(event)) return;
22
+ onStop();
23
+ };
24
+ document.addEventListener("keydown", onKeyDown);
25
+ return () => document.removeEventListener("keydown", onKeyDown);
26
+ }, [following, onStop]);
27
+ return /* @__PURE__ */ jsx(
28
+ Callout,
29
+ {
30
+ layout: "banner",
31
+ live: "polite",
32
+ icon: following ? /* @__PURE__ */ jsx(EyeGlyph, { size: "md" }) : /* @__PURE__ */ jsx(UserGlyph, { size: "md" }),
33
+ className: cx("crewlet-follow-banner", className),
34
+ action: following ? /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", onClick: onStop, children: text.stop }) : onDismiss ? /* @__PURE__ */ jsx(Button, { size: "small", variant: "ghost", onClick: onDismiss, children: text.dismiss }) : void 0,
35
+ children: following ? text.following(name) : text.left(name)
36
+ }
37
+ );
38
+ }
39
+
40
+ export { FollowBanner };
@@ -0,0 +1,46 @@
1
+ import { EmptyState } from './chunk-RA2ULG6H.js';
2
+ import { Card } from './chunk-YZCJ63JF.js';
3
+ import { cx } from './chunk-ODEQTPFM.js';
4
+ import './AccessDeniedCard-WXM5DBDZ.css';
5
+ import { ShieldGlyph, LockGlyph, EyeOffGlyph } from '@crewlethq/icons/glyphs';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ var ACCESS_DENIED_REASONS = ["not-found", "no-access", "revoked", "app-locked"];
9
+ var LABELS = {
10
+ titles: {
11
+ "not-found": "This artifact does not exist, or it has not been shared with you",
12
+ "no-access": "You do not have access to this artifact",
13
+ revoked: "Your access to this artifact ended",
14
+ "app-locked": "Needs Artifacts access"
15
+ },
16
+ descriptions: {
17
+ "not-found": () => "Check the link, or ask whoever sent it to share the artifact with you.",
18
+ "no-access": (owner) => owner ? `Ask ${owner} to share it with you.` : "Ask its owner to share it with you.",
19
+ revoked: (owner) => owner ? `${owner} removed your access, or narrowed who can open it. Ask them if you still need it.` : "Its owner removed your access, or narrowed who can open it. Ask them if you still need it.",
20
+ "app-locked": () => "Your role does not include Artifacts. Ask an administrator to give you access."
21
+ }
22
+ };
23
+ var GLYPHS = {
24
+ "not-found": /* @__PURE__ */ jsx(EyeOffGlyph, { size: 32 }),
25
+ "no-access": /* @__PURE__ */ jsx(LockGlyph, { size: 32 }),
26
+ revoked: /* @__PURE__ */ jsx(LockGlyph, { size: 32 }),
27
+ "app-locked": /* @__PURE__ */ jsx(ShieldGlyph, { size: 32 })
28
+ };
29
+ function AccessDeniedCard({ reason, owner, action, headingLevel, className, labels }) {
30
+ const text = {
31
+ titles: { ...LABELS.titles, ...labels?.titles },
32
+ descriptions: { ...LABELS.descriptions, ...labels?.descriptions }
33
+ };
34
+ return /* @__PURE__ */ jsx(Card, { padding: "lg", className: cx("crewlet-access-denied-card", className), "data-reason": reason, children: /* @__PURE__ */ jsx(
35
+ EmptyState,
36
+ {
37
+ icon: GLYPHS[reason],
38
+ title: text.titles[reason],
39
+ description: text.descriptions[reason](owner),
40
+ action,
41
+ headingLevel
42
+ }
43
+ ) });
44
+ }
45
+
46
+ export { ACCESS_DENIED_REASONS, AccessDeniedCard };
@@ -1,12 +1,13 @@
1
1
  import { StatusDot } from './chunk-WIATRXEJ.js';
2
2
  import { cx } from './chunk-ODEQTPFM.js';
3
- import './Tag-4BRQS6GN.css';
3
+ import './Tag-SRGTK5KI.css';
4
4
  import { XGlyph } from '@crewlethq/icons/glyphs';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
 
7
7
  function Tag(props) {
8
8
  const {
9
9
  variant = "neutral",
10
+ hue,
10
11
  appearance = "soft",
11
12
  size = "sm",
12
13
  leadingIcon,
@@ -31,7 +32,7 @@ function Tag(props) {
31
32
  const drawnSize = acts && size === "xs" ? "sm" : size;
32
33
  const classes = cx(
33
34
  "crewlet-tag",
34
- `crewlet-tag--${variant}`,
35
+ hue === void 0 ? `crewlet-tag--${variant}` : `crewlet-tag--hue-${hue}`,
35
36
  `crewlet-tag--${appearance}`,
36
37
  `crewlet-tag--${drawnSize}`,
37
38
  monospace && "crewlet-tag--monospace",
@@ -48,7 +49,7 @@ function Tag(props) {
48
49
  className
49
50
  );
50
51
  const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
51
- dot ? /* @__PURE__ */ jsx(StatusDot, { tone: variant, className: "crewlet-tag__dot" }) : null,
52
+ dot ? /* @__PURE__ */ jsx(StatusDot, { tone: hue === void 0 ? variant : "neutral", className: "crewlet-tag__dot" }) : null,
52
53
  leadingIcon ? /* @__PURE__ */ jsx("span", { className: "crewlet-tag__icon", "aria-hidden": true, children: leadingIcon }) : null,
53
54
  /* @__PURE__ */ jsx("span", { className: "crewlet-tag__label", children }),
54
55
  count === void 0 ? null : /* @__PURE__ */ jsx("span", { className: "crewlet-tag__count", children: count })
@@ -0,0 +1,216 @@
1
+ import { Select } from './chunk-FC4YTTFJ.js';
2
+ import { CopyButton } from './chunk-W46LPU4R.js';
3
+ import { Modal } from './chunk-7IJARUIF.js';
4
+ import { Callout } from './chunk-SVSCLHHI.js';
5
+ import { Button } from './chunk-OG6CL3EB.js';
6
+ import { PrincipalAvatar } from './chunk-4KP4RC3O.js';
7
+ import { useHeadingLevel, headingTag } from './chunk-PQADV6P6.js';
8
+ import { useMediaMatch } from './chunk-IG75YMUN.js';
9
+ import { IconButton } from './chunk-4FQT6ZAY.js';
10
+ import { cx } from './chunk-ODEQTPFM.js';
11
+ import './ShareDialog-YZ4F37MW.css';
12
+ import { useState, useId } from 'react';
13
+ import { breakpoint } from '@crewlethq/tokens';
14
+ import { XGlyph } from '@crewlethq/icons/glyphs';
15
+ import { jsxs, jsx } from 'react/jsx-runtime';
16
+
17
+ // src/ShareDialog/roles.ts
18
+ var ARTIFACT_ROLES = ["viewer", "commenter", "contributor", "editor", "owner"];
19
+ var SHAREABLE_ROLES = ["viewer", "commenter", "contributor", "editor"];
20
+ function roleAtLeast(role, floor) {
21
+ return ARTIFACT_ROLES.indexOf(role) >= ARTIFACT_ROLES.indexOf(floor);
22
+ }
23
+ var AGENT_CAN = {
24
+ viewer: "read this artifact in its turns",
25
+ commenter: "read this artifact and comment on it in its turns",
26
+ contributor: "read this artifact in its turns and edit its data",
27
+ editor: "read this artifact, edit its data and publish versions in its turns",
28
+ owner: "read, edit, publish and share this artifact in its turns"
29
+ };
30
+ var LABELS = {
31
+ title: (artifact) => `Share "${artifact}"`,
32
+ addRole: "Role for people you add",
33
+ audience: "Who has access",
34
+ you: "(you)",
35
+ roles: { viewer: "Viewer", commenter: "Commenter", contributor: "Contributor", editor: "Editor", owner: "Owner" },
36
+ roleDescriptions: {
37
+ viewer: "Reads the artifact, its versions and its history",
38
+ commenter: "Also comments",
39
+ contributor: "Also edits its data",
40
+ editor: "Also publishes versions and changes the schema",
41
+ owner: "Also shares, trashes and transfers it"
42
+ },
43
+ roleFor: (name) => `Role for ${name}`,
44
+ remove: (name) => `Remove ${name}`,
45
+ saving: "Saving",
46
+ busy: "Wait for the change to finish.",
47
+ agentNote: (name, role) => `${name} can ${AGENT_CAN[role]}.`,
48
+ companyAccess: "Company access",
49
+ company: (company, access) => {
50
+ switch (access) {
51
+ case "none":
52
+ return "Only people with access above";
53
+ case "viewer":
54
+ return `Everyone in ${company} can view`;
55
+ case "commenter":
56
+ return `Everyone in ${company} can comment`;
57
+ case "contributor":
58
+ return `Everyone in ${company} can edit its data`;
59
+ case "editor":
60
+ return `Everyone in ${company} can edit`;
61
+ }
62
+ },
63
+ copyLink: "Copy link",
64
+ linkCopied: "Link copied",
65
+ linkNote: "Only people with access can open the link.",
66
+ done: "Done"
67
+ };
68
+ function ShareDialog({
69
+ open,
70
+ onClose,
71
+ title,
72
+ picker,
73
+ defaultAddRole = "viewer",
74
+ grantableRoles = SHAREABLE_ROLES,
75
+ audience,
76
+ onRoleChange,
77
+ onRemove,
78
+ companyName,
79
+ companyAccess,
80
+ onCompanyAccessChange,
81
+ companyPending = false,
82
+ companyRefusal,
83
+ link,
84
+ readOnly,
85
+ note,
86
+ labels
87
+ }) {
88
+ const text = {
89
+ ...LABELS,
90
+ ...labels,
91
+ roles: { ...LABELS.roles, ...labels?.roles },
92
+ roleDescriptions: { ...LABELS.roleDescriptions, ...labels?.roleDescriptions }
93
+ };
94
+ const phone = useMediaMatch(`(width < ${breakpoint.phone})`);
95
+ const [addRole, setAddRole] = useState(defaultAddRole);
96
+ const level = useHeadingLevel();
97
+ const Heading = headingTag(level);
98
+ const audienceId = useId();
99
+ const companyId = useId();
100
+ const roleOptions = grantableRoles.map((role) => ({
101
+ value: role,
102
+ label: text.roles[role],
103
+ description: text.roleDescriptions[role]
104
+ }));
105
+ const companyOptions = ["none", ...grantableRoles].map((access) => ({
106
+ value: access,
107
+ label: text.company(companyName, access)
108
+ }));
109
+ return /* @__PURE__ */ jsxs(
110
+ Modal,
111
+ {
112
+ open,
113
+ onClose,
114
+ title: text.title(title),
115
+ placement: phone ? "bottom" : "top",
116
+ size: "md",
117
+ stackBody: true,
118
+ footerStart: link ? /* @__PURE__ */ jsxs("span", { className: "crewlet-share-dialog__link", children: [
119
+ /* @__PURE__ */ jsx(CopyButton, { text: link, label: text.copyLink, copiedLabel: text.linkCopied, copiedMessage: text.linkCopied, size: "small", variant: "outline" }),
120
+ /* @__PURE__ */ jsx("span", { className: "crewlet-share-dialog__link-note", children: text.linkNote })
121
+ ] }) : void 0,
122
+ footer: /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: onClose, children: text.done }),
123
+ children: [
124
+ note ? /* @__PURE__ */ jsx(Callout, { variant: "info", children: note }) : null,
125
+ readOnly ? /* @__PURE__ */ jsx(Callout, { variant: "neutral", children: readOnly.reason }) : null,
126
+ !readOnly && picker ? /* @__PURE__ */ jsxs("div", { className: "crewlet-share-dialog__add", children: [
127
+ picker({ role: addRole }),
128
+ /* @__PURE__ */ jsx(
129
+ Select,
130
+ {
131
+ value: addRole,
132
+ options: roleOptions,
133
+ onChange: (value) => setAddRole(value),
134
+ ariaLabel: text.addRole,
135
+ size: "md",
136
+ width: "auto",
137
+ align: "right"
138
+ }
139
+ )
140
+ ] }) : null,
141
+ /* @__PURE__ */ jsxs("section", { className: "crewlet-share-dialog__section", "aria-labelledby": audienceId, children: [
142
+ /* @__PURE__ */ jsx(Heading, { id: audienceId, className: "crewlet-share-dialog__heading", children: text.audience }),
143
+ /* @__PURE__ */ jsx("ul", { className: "crewlet-share-dialog__audience", children: audience.map((row) => {
144
+ const direct = row.via === void 0 && row.role !== "owner";
145
+ const editable = !readOnly && onRoleChange !== void 0 && (row.editable ?? direct);
146
+ const removable = !readOnly && onRemove !== void 0 && (row.removable ?? (row.editable ?? direct));
147
+ const rowNote = row.note ?? (row.principal.kind === "agent" ? text.agentNote(row.principal.name, row.role) : void 0);
148
+ const detail = row.via ?? row.principal.detail;
149
+ return /* @__PURE__ */ jsxs("li", { className: cx("crewlet-share-dialog__row", row.pending && "is-pending"), "aria-busy": row.pending || void 0, children: [
150
+ /* @__PURE__ */ jsx(PrincipalAvatar, { principal: row.principal, size: "md" }),
151
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-share-dialog__who", children: [
152
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-share-dialog__name", children: [
153
+ row.principal.name,
154
+ row.self ? /* @__PURE__ */ jsxs("span", { className: "crewlet-share-dialog__you", children: [
155
+ " ",
156
+ text.you
157
+ ] }) : null
158
+ ] }),
159
+ detail ? /* @__PURE__ */ jsx("span", { className: "crewlet-share-dialog__detail", children: detail }) : null
160
+ ] }),
161
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-share-dialog__controls", children: [
162
+ row.pending ? /* @__PURE__ */ jsx("span", { className: "crewlet-share-dialog__saving", children: text.saving }) : null,
163
+ editable && row.role !== "owner" ? /* @__PURE__ */ jsx(
164
+ Select,
165
+ {
166
+ value: row.role,
167
+ options: roleOptions,
168
+ onChange: (value) => onRoleChange(row, value),
169
+ ariaLabel: text.roleFor(row.principal.name),
170
+ disabled: row.pending ?? false,
171
+ size: "sm",
172
+ width: "auto",
173
+ align: "right"
174
+ }
175
+ ) : /* @__PURE__ */ jsx("span", { className: "crewlet-share-dialog__role", children: text.roles[row.role] }),
176
+ removable ? /* @__PURE__ */ jsx(
177
+ IconButton,
178
+ {
179
+ label: text.remove(row.principal.name),
180
+ icon: /* @__PURE__ */ jsx(XGlyph, {}),
181
+ size: "sm",
182
+ variant: "ghost",
183
+ disabledReason: row.pending ? text.busy : void 0,
184
+ onClick: () => onRemove(row)
185
+ }
186
+ ) : null
187
+ ] }),
188
+ rowNote ? /* @__PURE__ */ jsx("span", { className: "crewlet-share-dialog__note", children: rowNote }) : null,
189
+ /* @__PURE__ */ jsx("span", { className: "crewlet-share-dialog__refusal", "aria-live": "polite", children: row.refusal ?? "" })
190
+ ] }, row.id);
191
+ }) })
192
+ ] }),
193
+ /* @__PURE__ */ jsxs("section", { className: "crewlet-share-dialog__section", "aria-labelledby": companyId, "aria-busy": companyPending || void 0, children: [
194
+ /* @__PURE__ */ jsx(Heading, { id: companyId, className: "crewlet-share-dialog__heading", children: text.companyAccess }),
195
+ readOnly || !onCompanyAccessChange ? /* @__PURE__ */ jsx("p", { className: "crewlet-share-dialog__company-text", children: text.company(companyName, companyAccess) }) : /* @__PURE__ */ jsxs("span", { className: "crewlet-share-dialog__company", children: [
196
+ /* @__PURE__ */ jsx(
197
+ Select,
198
+ {
199
+ value: companyAccess,
200
+ options: companyOptions,
201
+ onChange: (value) => onCompanyAccessChange(value),
202
+ ariaLabel: text.companyAccess,
203
+ disabled: companyPending,
204
+ size: "md"
205
+ }
206
+ ),
207
+ companyPending ? /* @__PURE__ */ jsx("span", { className: "crewlet-share-dialog__saving", children: text.saving }) : null
208
+ ] }),
209
+ /* @__PURE__ */ jsx("span", { className: "crewlet-share-dialog__refusal", "aria-live": "polite", children: companyRefusal ?? "" })
210
+ ] })
211
+ ]
212
+ }
213
+ );
214
+ }
215
+
216
+ export { ARTIFACT_ROLES, SHAREABLE_ROLES, ShareDialog, roleAtLeast };
@@ -1,4 +1,4 @@
1
- import { FormField } from './chunk-4GB57WIT.js';
1
+ import { FormField } from './chunk-Q55TXPA3.js';
2
2
  import { cx } from './chunk-ODEQTPFM.js';
3
3
  import './Checkbox-KT7RS6QQ.css';
4
4
  import { forwardRef, useId, useRef, useCallback, useEffect } from 'react';
@@ -0,0 +1,20 @@
1
+ import { cx } from './chunk-ODEQTPFM.js';
2
+ import './PresenceRing-M4C22Q6U.css';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ function presenceHueClass(hue) {
6
+ return `crewlet-presence-hue--${hue}`;
7
+ }
8
+ function PresenceRing({ hue, state = "active", inset = 1, className, style, children, ...rest }) {
9
+ return /* @__PURE__ */ jsx(
10
+ "span",
11
+ {
12
+ ...rest,
13
+ className: cx("crewlet-presence-ring", presenceHueClass(hue), state === "idle" && "crewlet-presence-ring--idle", className),
14
+ style: { "--crewlet-presence-ring-inset": `${inset}px`, ...style },
15
+ children
16
+ }
17
+ );
18
+ }
19
+
20
+ export { PresenceRing, presenceHueClass };
@@ -0,0 +1,17 @@
1
+ import { cx } from './chunk-ODEQTPFM.js';
2
+ import './IconTile-4GNWTLAW.css';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ function IconTile({ children, hue, size = "md", className, ...rest }) {
6
+ return /* @__PURE__ */ jsx(
7
+ "span",
8
+ {
9
+ "aria-hidden": "true",
10
+ ...rest,
11
+ className: cx("crewlet-icon-tile", `crewlet-icon-tile--${size}`, hue && `crewlet-icon-tile--${hue}`, className),
12
+ children
13
+ }
14
+ );
15
+ }
16
+
17
+ export { IconTile };
@@ -0,0 +1,98 @@
1
+ import { Combobox } from './chunk-LOLELDBW.js';
2
+ import { PRINCIPAL_KINDS, PrincipalAvatar } from './chunk-4KP4RC3O.js';
3
+ import { cx } from './chunk-ODEQTPFM.js';
4
+ import './PrincipalPicker-7NNZTGUP.css';
5
+ import { useState, useId, useMemo } from 'react';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
+
8
+ var LABELS = {
9
+ groups: { person: "People", agent: "Agents", team: "Teams" },
10
+ empty: "Nobody matches. Try a name, a handle or a team.",
11
+ loading: "Searching"
12
+ };
13
+ var key = (principal) => `${principal.kind}:${principal.id}`;
14
+ function PrincipalPicker({
15
+ query,
16
+ onQueryChange,
17
+ options,
18
+ onPick,
19
+ label,
20
+ placeholder,
21
+ loading = false,
22
+ disabled = false,
23
+ className,
24
+ labels
25
+ }) {
26
+ const text = { ...LABELS, ...labels, groups: { ...LABELS.groups, ...labels?.groups } };
27
+ const [open, setOpen] = useState(false);
28
+ const groupId = useId();
29
+ const ordered = useMemo(
30
+ () => PRINCIPAL_KINDS.flatMap((kind) => options.filter((option) => option.kind === kind)),
31
+ [options]
32
+ );
33
+ const offered = useMemo(
34
+ () => ordered.map((option) => ({ value: key(option), label: option.name, disabled: option.disabled ?? false })),
35
+ [ordered]
36
+ );
37
+ return /* @__PURE__ */ jsx(
38
+ Combobox,
39
+ {
40
+ value: query,
41
+ onValueChange: (next) => {
42
+ onQueryChange(next);
43
+ setOpen(true);
44
+ },
45
+ options: offered,
46
+ open: open && !disabled,
47
+ onOpenChange: setOpen,
48
+ label,
49
+ "aria-label": label,
50
+ placeholder,
51
+ disabled,
52
+ containerClassName: cx("crewlet-principal-picker", className),
53
+ onFocus: () => setOpen(true),
54
+ onBlur: () => setOpen(false),
55
+ emptyMessage: loading ? text.loading : query.trim() ? text.empty : void 0,
56
+ onCommit: (_option, index) => {
57
+ const picked = ordered[index];
58
+ if (!picked || picked.disabled) return;
59
+ onPick(picked);
60
+ onQueryChange("");
61
+ },
62
+ renderList: ordered.length > 0 ? ({ active, optionId, optionHandlers }) => PRINCIPAL_KINDS.map((kind) => {
63
+ const rows = ordered.map((option, index) => ({ option, index })).filter(({ option }) => option.kind === kind);
64
+ if (rows.length === 0) return null;
65
+ const headingId = `${groupId}-${kind}`;
66
+ return /* @__PURE__ */ jsxs("div", { role: "group", "aria-labelledby": headingId, className: "crewlet-principal-picker__group", children: [
67
+ /* @__PURE__ */ jsx("div", { id: headingId, role: "presentation", className: "crewlet-principal-picker__heading", children: text.groups[kind] }),
68
+ rows.map(({ option, index }) => /* @__PURE__ */ jsxs(
69
+ "div",
70
+ {
71
+ id: optionId(index),
72
+ role: "option",
73
+ "aria-selected": index === active,
74
+ "aria-disabled": option.disabled || void 0,
75
+ className: cx(
76
+ "crewlet-listbox__option",
77
+ "crewlet-principal-picker__option",
78
+ index === active && "is-highlight",
79
+ option.disabled && "is-disabled"
80
+ ),
81
+ ...option.disabled ? {} : optionHandlers(index),
82
+ children: [
83
+ /* @__PURE__ */ jsx(PrincipalAvatar, { principal: option, size: "sm" }),
84
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-principal-picker__text", children: [
85
+ /* @__PURE__ */ jsx("span", { className: "crewlet-principal-picker__name", children: option.name }),
86
+ option.disabledReason ?? option.detail ? /* @__PURE__ */ jsx("span", { className: "crewlet-listbox__hint", children: option.disabledReason ?? option.detail }) : null
87
+ ] })
88
+ ]
89
+ },
90
+ key(option)
91
+ ))
92
+ ] }, kind);
93
+ }) : void 0
94
+ }
95
+ );
96
+ }
97
+
98
+ export { PrincipalPicker };
@@ -1,13 +1,13 @@
1
1
  import { cx } from './chunk-ODEQTPFM.js';
2
- import './StatGroup-HVG6O62W.css';
2
+ import './StatGroup-PADTJCUQ.css';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
- function StatGroup({ columns = 4, className, children, ...rest }) {
5
+ function StatGroup({ columns = 4, flush = false, className, children, ...rest }) {
6
6
  return /* @__PURE__ */ jsx(
7
7
  "div",
8
8
  {
9
9
  ...rest,
10
- className: cx("crewlet-stat-group", className),
10
+ className: cx("crewlet-stat-group", flush && "crewlet-stat-group--flush", className),
11
11
  style: { "--crewlet-stat-group-cols": columns, ...rest.style },
12
12
  children
13
13
  }
@@ -1,5 +1,5 @@
1
1
  import { useListbox } from './chunk-F73MC7EZ.js';
2
- import { Input } from './chunk-4GB57WIT.js';
2
+ import { Input } from './chunk-Q55TXPA3.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './Combobox-4FUVYIE7.css';
5
5
  import { forwardRef, useId, useMemo, useRef, useCallback } from 'react';
@@ -1,4 +1,4 @@
1
- import { useThemePreference, useSystemTheme, resolveTheme } from './chunk-K3OWD7BJ.js';
1
+ import { useThemePreference, useSystemTheme, resolveTheme } from './chunk-Z24ZUSTX.js';
2
2
  import { IconButton } from './chunk-4FQT6ZAY.js';
3
3
  import { SunGlyph, MoonGlyph } from '@crewlethq/icons/glyphs';
4
4
  import { jsx } from 'react/jsx-runtime';
@@ -1,16 +1,16 @@
1
- import { RelativeTime } from './chunk-3CZ7XAVY.js';
2
1
  import { PageHeader } from './chunk-HOXGBLEY.js';
3
2
  import { Toolbar } from './chunk-PGRPNDWM.js';
4
- import { DataTable } from './chunk-FSKTOIYC.js';
5
- import { Menu } from './chunk-NS7BVLL3.js';
6
- import { DateTimePicker } from './chunk-2UU5IGZI.js';
3
+ import { DataTable } from './chunk-AJESMWJS.js';
4
+ import { Menu } from './chunk-JULMZNGT.js';
5
+ import { DateTimePicker } from './chunk-L4H7SSWF.js';
7
6
  import { useListbox, useOptionKeys } from './chunk-F73MC7EZ.js';
8
7
  import { Kbd } from './chunk-SMBKXWML.js';
9
- import { Input } from './chunk-4GB57WIT.js';
10
8
  import { Button } from './chunk-OG6CL3EB.js';
11
- import { IconButton } from './chunk-4FQT6ZAY.js';
9
+ import { Input } from './chunk-Q55TXPA3.js';
10
+ import { RelativeTime } from './chunk-3CZ7XAVY.js';
12
11
  import { Popover } from './chunk-BWRGFKJP.js';
13
12
  import { Count } from './chunk-BHHIIK3M.js';
13
+ import { IconButton } from './chunk-4FQT6ZAY.js';
14
14
  import { VisuallyHidden } from './chunk-BZFWDIV6.js';
15
15
  import { cx } from './chunk-ODEQTPFM.js';
16
16
  import './DataView-N6JX464S.css';
@@ -0,0 +1,12 @@
1
+ import { changeText, sheetLabels } from './chunk-YYZRLLLY.js';
2
+ import { Tooltip } from './chunk-QWOPX2MN.js';
3
+ import { cx } from './chunk-ODEQTPFM.js';
4
+ import './ChangeMark-3VMTW7MT.css';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ function ChangeMark({ by, at, previous = null, locale, className, labels }) {
8
+ const text = changeText({ by, at }, sheetLabels(labels), previous, locale);
9
+ return /* @__PURE__ */ jsx(Tooltip, { content: text, children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cx("crewlet-change-mark", className) }) });
10
+ }
11
+
12
+ export { ChangeMark };