@crewlethq/ui 0.189.0 → 0.190.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +18 -2
  2. package/dist/AgentHandoffPanel/index.js +1 -1
  3. package/dist/AgentIdentity/AgentIdentity.d.ts +19 -8
  4. package/dist/AgentIdentity/AgentIdentitySheet.d.ts +50 -0
  5. package/dist/AgentIdentity/index.d.ts +2 -2
  6. package/dist/AgentIdentity/index.js +7 -6
  7. package/dist/AgentIdentitySheet-WLJL3KT7.css +110 -0
  8. package/dist/AppShell/index.js +2 -2
  9. package/dist/AssignmentList/index.js +3 -3
  10. package/dist/CodeBlock/index.js +2 -2
  11. package/dist/ColorSwatch/index.js +3 -3
  12. package/dist/CommandPalette/index.js +5 -5
  13. package/dist/ConfirmField/index.js +3 -3
  14. package/dist/ConsequenceList/index.js +3 -3
  15. package/dist/Copyable/index.js +2 -2
  16. package/dist/{Copyable-CMT2N2JE.css → Copyable-HTJHIJ2D.css} +3 -2
  17. package/dist/DataTable/index.js +5 -5
  18. package/dist/DataView/index.js +6 -6
  19. package/dist/InlineCode/index.js +2 -2
  20. package/dist/LinkInterstitial/index.js +5 -5
  21. package/dist/Modal/index.js +4 -4
  22. package/dist/OrgTable/index.js +2 -2
  23. package/dist/ScopeList/ScopeList.d.ts +12 -3
  24. package/dist/ScopeList/index.js +2 -1
  25. package/dist/{ScopeList-564YHC7Z.css → ScopeList-4THHOZ46.css} +20 -0
  26. package/dist/ShareDialog/index.js +6 -6
  27. package/dist/Switcher/index.js +5 -5
  28. package/dist/TimeRangePicker/index.js +5 -5
  29. package/dist/ToolCallLog/index.js +2 -2
  30. package/dist/{chunk-N3VY4RNR.js → chunk-237WBIAN.js} +1 -1
  31. package/dist/{chunk-OVKHRNRD.js → chunk-2FWNVZSX.js} +129 -8
  32. package/dist/{chunk-ISM47T7P.js → chunk-33KDTRUV.js} +4 -4
  33. package/dist/{chunk-W4UJWFCZ.js → chunk-E3XKFND2.js} +1 -1
  34. package/dist/chunk-EK5NJV6K.js +110 -0
  35. package/dist/{chunk-TBHMGRN6.js → chunk-G5UBUODG.js} +1 -1
  36. package/dist/{chunk-RAPKKIMQ.js → chunk-HUZ27VZ7.js} +2 -2
  37. package/dist/{chunk-LUPO23ST.js → chunk-HWJVQFXQ.js} +1 -1
  38. package/dist/{chunk-Q3VKR72D.js → chunk-IAOROOL6.js} +1 -1
  39. package/dist/chunk-JADTOJUL.js +20 -0
  40. package/dist/{chunk-C2676ENR.js → chunk-KQTWO46B.js} +1 -1
  41. package/dist/{chunk-MMW5KBJE.js → chunk-NHQ3CXFN.js} +1 -1
  42. package/dist/{chunk-7KAWHHZW.js → chunk-R5UTN5QB.js} +1 -1
  43. package/dist/{chunk-NIPRTH7C.js → chunk-SW3JOJUV.js} +1 -1
  44. package/dist/{chunk-HZXS5CEL.js → chunk-T4JEGIUW.js} +5 -4
  45. package/dist/{chunk-VXJP2WI3.js → chunk-TIGEUFVV.js} +1 -1
  46. package/dist/{chunk-O2JB7YLM.js → chunk-U7AHXPYA.js} +1 -1
  47. package/dist/{chunk-S7MHUIJX.js → chunk-VNEUVMUR.js} +1 -1
  48. package/dist/generated/index.js +42 -41
  49. package/dist/index.js +42 -41
  50. package/dist/styles.css +108 -5
  51. package/dist/utils/groupInOrder.d.ts +13 -0
  52. package/dist/utils/pathBreaks.d.ts +5 -2
  53. package/package.json +3 -3
  54. package/dist/AgentIdentitySheet-QIOWB7XK.css +0 -28
  55. package/dist/chunk-MPVJW5M6.js +0 -92
  56. package/dist/{chunk-7V5SREXT.js → chunk-QVSG3XSW.js} +1 -1
  57. package/dist/{chunk-SETK4FN5.js → chunk-V5AZLXR4.js} +1 -1
@@ -33,6 +33,26 @@
33
33
  list-style: none;
34
34
  }
35
35
 
36
+ /* A group's rows under its name, the name on the rows' own inset. */
37
+ .crewlet-scope-list__group {
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: var(--spacing-1);
41
+ min-inline-size: 0;
42
+ }
43
+
44
+ /* A section between groups, so each name reads as the head of the rows under it. */
45
+ .crewlet-scope-list__group + .crewlet-scope-list__group,
46
+ .crewlet-scope-list__rows + .crewlet-scope-list__group {
47
+ margin-block-start: var(--spacing-2);
48
+ }
49
+
50
+ .crewlet-scope-list__group-name {
51
+ margin: 0;
52
+ padding-inline-start: var(--spacing-3);
53
+ overflow-wrap: anywhere;
54
+ }
55
+
36
56
  .crewlet-scope-list__row {
37
57
  display: flex;
38
58
  align-items: flex-start;
@@ -1,4 +1,4 @@
1
- export { ARTIFACT_ROLES, SHAREABLE_ROLES, ShareDialog, roleAtLeast } from '../chunk-MMW5KBJE.js';
1
+ export { ARTIFACT_ROLES, SHAREABLE_ROLES, ShareDialog, roleAtLeast } from '../chunk-NHQ3CXFN.js';
2
2
  import '../chunk-DPCXOBXN.js';
3
3
  import '../chunk-KW7T23RT.js';
4
4
  import '../chunk-265IX4YA.js';
@@ -9,18 +9,18 @@ import '../chunk-YMFFGPFE.js';
9
9
  import '../chunk-2YTOOH3A.js';
10
10
  import '../chunk-SK4BIFTG.js';
11
11
  import '../chunk-COS6LJ4K.js';
12
- import '../chunk-ISM47T7P.js';
12
+ import '../chunk-33KDTRUV.js';
13
13
  import '../chunk-NAHBGKE7.js';
14
14
  import '../chunk-STJ7QBC3.js';
15
15
  import '../chunk-DTIW4CHZ.js';
16
- import '../chunk-C2676ENR.js';
17
- import '../chunk-N3VY4RNR.js';
16
+ import '../chunk-KQTWO46B.js';
17
+ import '../chunk-237WBIAN.js';
18
18
  import '../chunk-XXHIU65G.js';
19
19
  import '../chunk-7XUP32RY.js';
20
20
  import '../chunk-XJLGQ7U7.js';
21
21
  import '../chunk-RK4XPHVG.js';
22
- import '../chunk-W4UJWFCZ.js';
23
- import '../chunk-HZXS5CEL.js';
22
+ import '../chunk-E3XKFND2.js';
23
+ import '../chunk-T4JEGIUW.js';
24
24
  import '../chunk-ASBBB5AJ.js';
25
25
  import '../chunk-QRE6JCHS.js';
26
26
  import '../chunk-2DESFB7K.js';
@@ -1,17 +1,17 @@
1
- export { Switcher } from '../chunk-O2JB7YLM.js';
1
+ export { Switcher } from '../chunk-U7AHXPYA.js';
2
2
  import '../chunk-KW7T23RT.js';
3
3
  import '../chunk-HBDA76EZ.js';
4
4
  import '../chunk-WFAJYBLX.js';
5
5
  import '../chunk-SWZV6R46.js';
6
6
  import '../chunk-SK4BIFTG.js';
7
7
  import '../chunk-COS6LJ4K.js';
8
- import '../chunk-C2676ENR.js';
9
- import '../chunk-N3VY4RNR.js';
8
+ import '../chunk-KQTWO46B.js';
9
+ import '../chunk-237WBIAN.js';
10
10
  import '../chunk-XXHIU65G.js';
11
11
  import '../chunk-7XUP32RY.js';
12
12
  import '../chunk-RK4XPHVG.js';
13
- import '../chunk-W4UJWFCZ.js';
14
- import '../chunk-HZXS5CEL.js';
13
+ import '../chunk-E3XKFND2.js';
14
+ import '../chunk-T4JEGIUW.js';
15
15
  import '../chunk-ASBBB5AJ.js';
16
16
  import '../chunk-QRE6JCHS.js';
17
17
  import '../chunk-475DOAWF.js';
@@ -1,18 +1,18 @@
1
- export { TIME_RANGE_CUSTOM, TIME_RANGE_PICKER_LABELS, TimeRangePicker, timeRangeFieldKey, timeRangeProblem } from '../chunk-7KAWHHZW.js';
1
+ export { TIME_RANGE_CUSTOM, TIME_RANGE_PICKER_LABELS, TimeRangePicker, timeRangeFieldKey, timeRangeProblem } from '../chunk-R5UTN5QB.js';
2
2
  import '../chunk-DG6H4EO2.js';
3
3
  import '../chunk-2XC4MYBB.js';
4
4
  import '../chunk-Y4A7AYX4.js';
5
5
  import '../chunk-7F3OPUM5.js';
6
6
  import '../chunk-43N4EHFR.js';
7
7
  import '../chunk-2YTOOH3A.js';
8
- import '../chunk-C2676ENR.js';
9
- import '../chunk-N3VY4RNR.js';
8
+ import '../chunk-KQTWO46B.js';
9
+ import '../chunk-237WBIAN.js';
10
10
  import '../chunk-XXHIU65G.js';
11
11
  import '../chunk-7XUP32RY.js';
12
12
  import '../chunk-XJLGQ7U7.js';
13
13
  import '../chunk-RK4XPHVG.js';
14
- import '../chunk-W4UJWFCZ.js';
15
- import '../chunk-HZXS5CEL.js';
14
+ import '../chunk-E3XKFND2.js';
15
+ import '../chunk-T4JEGIUW.js';
16
16
  import '../chunk-ASBBB5AJ.js';
17
17
  import '../chunk-QRE6JCHS.js';
18
18
  import '../chunk-2DESFB7K.js';
@@ -3,11 +3,11 @@ import '../chunk-V3AWITMI.js';
3
3
  import '../chunk-IPIILXQU.js';
4
4
  import '../chunk-SK4BIFTG.js';
5
5
  import '../chunk-COS6LJ4K.js';
6
- import '../chunk-ISM47T7P.js';
6
+ import '../chunk-33KDTRUV.js';
7
7
  import '../chunk-NAHBGKE7.js';
8
8
  import '../chunk-STJ7QBC3.js';
9
9
  import '../chunk-DTIW4CHZ.js';
10
- import '../chunk-HZXS5CEL.js';
10
+ import '../chunk-T4JEGIUW.js';
11
11
  import '../chunk-YVMIT2OW.js';
12
12
  import '../chunk-XSPCITPN.js';
13
13
  import '../chunk-66H4BC5Z.js';
@@ -1,5 +1,5 @@
1
1
  import { Eyebrow } from './chunk-RK4XPHVG.js';
2
- import { InlineCode } from './chunk-W4UJWFCZ.js';
2
+ import { InlineCode } from './chunk-E3XKFND2.js';
3
3
  import { Checkbox } from './chunk-2DESFB7K.js';
4
4
  import { titleWhenCut } from './chunk-WSIJDWUG.js';
5
5
  import { cx } from './chunk-ODEQTPFM.js';
@@ -1,25 +1,30 @@
1
+ import { groupInOrder } from './chunk-JADTOJUL.js';
1
2
  import { List, ListItem } from './chunk-Q7ZP6UPU.js';
2
3
  import { FileDrop, FilePickButton } from './chunk-ICIWCUDN.js';
3
4
  import { StepList, Stepper } from './chunk-2MN3RNRM.js';
4
- import { Copyable } from './chunk-ISM47T7P.js';
5
- import { Modal } from './chunk-C2676ENR.js';
5
+ import { Copyable } from './chunk-33KDTRUV.js';
6
+ import { Modal } from './chunk-KQTWO46B.js';
6
7
  import { Callout } from './chunk-XJLGQ7U7.js';
7
8
  import { Tag } from './chunk-ASBBB5AJ.js';
8
9
  import { Text } from './chunk-475DOAWF.js';
9
10
  import { Disclosure } from './chunk-RUROK3EU.js';
10
11
  import { Button, ButtonLink } from './chunk-YVMIT2OW.js';
11
12
  import { FormField, Input } from './chunk-ZR276S44.js';
13
+ import { headingTag, useHeadingLevel } from './chunk-PQADV6P6.js';
12
14
  import { cx } from './chunk-ODEQTPFM.js';
13
15
  import './AgentIdentity-KQWGKBNT.css';
14
- import './AgentIdentitySheet-QIOWB7XK.css';
15
- import { useId, useState, useRef, useEffect } from 'react';
16
+ import './AgentIdentitySheet-WLJL3KT7.css';
17
+ import { useId, useState, useRef, useEffect, Children, isValidElement } from 'react';
16
18
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
19
+ import { ExternalLinkGlyph } from '@crewlethq/icons/glyphs';
17
20
 
18
21
  var AGENT_IDENTITY_STATES = [
19
22
  "company",
20
23
  "none",
24
+ "preparing",
21
25
  "checking",
22
26
  "ready",
27
+ "unchecked",
23
28
  "wrong_role",
24
29
  "wrong_team",
25
30
  "refused",
@@ -28,8 +33,10 @@ var AGENT_IDENTITY_STATES = [
28
33
  var AGENT_IDENTITY_CHIPS = {
29
34
  company: { label: "Company's", tone: "neutral" },
30
35
  none: { label: "Not set up", tone: "warning" },
36
+ preparing: { label: "Getting ready", tone: "info" },
31
37
  checking: { label: "Checking", tone: "info" },
32
38
  ready: { label: "Ready", tone: "success" },
39
+ unchecked: { label: "Role not checked", tone: "info" },
33
40
  wrong_role: { label: "Wrong role", tone: "warning" },
34
41
  wrong_team: { label: "Wrong team", tone: "danger" },
35
42
  refused: { label: "Refused", tone: "danger" },
@@ -46,7 +53,7 @@ function agentIdentityNeedsSetUp(state) {
46
53
  return state === "company" || state === "none" || state === "wrong_role" || state === "wrong_team" || state === "refused";
47
54
  }
48
55
  function agentIdentityNeedsYou(state, perAgent) {
49
- return perAgent && state !== "ready";
56
+ return perAgent && state !== "ready" && state !== "preparing" && state !== "unchecked";
50
57
  }
51
58
  function AgentIdentity({
52
59
  vendor,
@@ -64,9 +71,10 @@ function AgentIdentity({
64
71
  const titleId = useId();
65
72
  const chip = AGENT_IDENTITY_CHIPS[state];
66
73
  const setUp = perAgent && agentIdentityNeedsSetUp(state);
67
- const replace = perAgent && state === "ready";
74
+ const replace = perAgent && (state === "ready" || state === "unchecked");
68
75
  const primary = onSetUp && (setUp || replace) ? setUp ? AGENT_IDENTITY_WORDS.setUp : AGENT_IDENTITY_WORDS.replace : null;
69
76
  const company = perAgent && onUseCompany && state === "refused";
77
+ const calm = state === "preparing" || state === "unchecked";
70
78
  return /* @__PURE__ */ jsxs(
71
79
  "section",
72
80
  {
@@ -109,11 +117,35 @@ function AgentIdentity({
109
117
  ] }) : null
110
118
  ] }),
111
119
  /* @__PURE__ */ jsx(Text, { as: "p", variant: "caption", tone: "secondary", className: "crewlet-agent-identity__summary", children: summary }),
112
- problem ? /* @__PURE__ */ jsx(Callout, { variant: chip.tone === "danger" ? "danger" : "warning", title: problem.title, action: problem.action, children: problem.body }) : null
120
+ problem ? /* @__PURE__ */ jsx(
121
+ Callout,
122
+ {
123
+ variant: chip.tone === "danger" ? "danger" : calm ? "info" : "warning",
124
+ title: problem.title,
125
+ action: problem.action,
126
+ children: problem.body
127
+ }
128
+ ) : null
113
129
  ]
114
130
  }
115
131
  );
116
132
  }
133
+ function agentIdentityEntryChip(state, vendor) {
134
+ switch (state) {
135
+ case "missing":
136
+ return { label: "Not added yet", tone: "warning" };
137
+ case "added":
138
+ return { label: "Added", tone: "success" };
139
+ case "applying":
140
+ return { label: `${vendor} is applying it`, tone: "info" };
141
+ case "wrong_role":
142
+ return AGENT_IDENTITY_CHIPS.wrong_role;
143
+ case "unchecked":
144
+ return AGENT_IDENTITY_CHIPS.unchecked;
145
+ case "unknown":
146
+ return null;
147
+ }
148
+ }
117
149
  function AgentIdentitySheet(props) {
118
150
  return props.open ? /* @__PURE__ */ jsx(Walk, { ...props }) : null;
119
151
  }
@@ -137,6 +169,10 @@ function Walk({
137
169
  link,
138
170
  note,
139
171
  caution,
172
+ entries,
173
+ entryAction = "Open",
174
+ wider,
175
+ notReady: notYet,
140
176
  make,
141
177
  handIn,
142
178
  reads,
@@ -264,8 +300,10 @@ function Walk({
264
300
  };
265
301
  });
266
302
  const vendorSteps = /* @__PURE__ */ jsx(VendorSteps, { steps, link });
303
+ const held = shownNode(notYet) ? plainText(notYet) || "Not ready yet." : void 0;
267
304
  const content = {
268
305
  vendor: /* @__PURE__ */ jsxs(Fragment, { children: [
306
+ shownNode(notYet) ? /* @__PURE__ */ jsx(Callout, { variant: "info", children: notYet }) : null,
269
307
  caution,
270
308
  make ? /* @__PURE__ */ jsx(
271
309
  Callout,
@@ -277,6 +315,11 @@ function Walk({
277
315
  }
278
316
  ) : null,
279
317
  makeable ? /* @__PURE__ */ jsx(Disclosure, { title: `Or make it by hand at ${vendor}`, size: "compact", children: vendorSteps }) : vendorSteps,
318
+ entries && entries.length > 0 ? /* @__PURE__ */ jsx(Entries, { entries, vendor, action: entryAction, held }) : null,
319
+ wider ? /* @__PURE__ */ jsxs(Callout, { variant: "neutral", appearance: "quiet", title: wider.title, children: [
320
+ /* @__PURE__ */ jsx("div", { children: wider.body }),
321
+ wider.links.length > 0 ? /* @__PURE__ */ jsx("div", { className: "crewlet-agent-identity-sheet__wider-links", children: wider.links.map((l) => /* @__PURE__ */ jsx(VendorLink, { href: l.href, held, children: l.label }, l.href)) }) : null
322
+ ] }) : null,
280
323
  note ? /* @__PURE__ */ jsx(Text, { as: "p", variant: "caption", tone: "secondary", className: "crewlet-agent-identity-sheet__note", children: note }) : null
281
324
  ] }),
282
325
  back: handIn.kind === "file" ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -412,5 +455,83 @@ function VendorSteps({
412
455
  link ? /* @__PURE__ */ jsx("span", { className: "crewlet-agent-identity-sheet__link", children: /* @__PURE__ */ jsx(ButtonLink, { size: "small", variant: "secondary", href: link.href, external: true, children: link.label }) }) : null
413
456
  ] });
414
457
  }
458
+ function shownNode(node) {
459
+ return node !== null && node !== void 0 && typeof node !== "boolean" && node !== "";
460
+ }
461
+ function plainText(node) {
462
+ const words = (n) => Children.toArray(n).map(
463
+ (child) => typeof child === "string" || typeof child === "number" ? String(child) : isValidElement(child) ? words(child.props.children) : ""
464
+ ).join("");
465
+ return words(node).replace(/\s+/g, " ").trim();
466
+ }
467
+ function VendorLink({
468
+ href,
469
+ held,
470
+ children,
471
+ ...aria
472
+ }) {
473
+ return held === void 0 ? /* @__PURE__ */ jsx(ButtonLink, { size: "small", variant: "secondary", href, external: true, ...aria, children }) : /* @__PURE__ */ jsx(
474
+ Button,
475
+ {
476
+ size: "small",
477
+ variant: "secondary",
478
+ disabledReason: held,
479
+ tooltip: true,
480
+ trailingIcon: /* @__PURE__ */ jsx(ExternalLinkGlyph, { size: "sm" }),
481
+ ...aria,
482
+ children
483
+ }
484
+ );
485
+ }
486
+ function Entries({
487
+ entries,
488
+ vendor,
489
+ action,
490
+ held
491
+ }) {
492
+ const base = useId();
493
+ const Heading = headingTag(useHeadingLevel());
494
+ const at = new Map(entries.map((e, i) => [e, i]));
495
+ return /* @__PURE__ */ jsx("div", { className: "crewlet-agent-identity-sheet__entries", children: groupInOrder(entries).map((run, r) => {
496
+ const groupId = run.name === void 0 ? void 0 : `${base}-group-${r}`;
497
+ const rows = /* @__PURE__ */ jsx("ul", { className: "crewlet-agent-identity-sheet__entry-rows", children: run.items.map((entry) => {
498
+ const idId = `${base}-id-${at.get(entry)}`;
499
+ const chip = agentIdentityEntryChip(entry.state, vendor);
500
+ return /* @__PURE__ */ jsxs("li", { className: "crewlet-agent-identity-sheet__entry", "data-state": entry.state, children: [
501
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-agent-identity-sheet__entry-words", children: [
502
+ /* @__PURE__ */ jsx(Text, { className: "crewlet-agent-identity-sheet__entry-name", children: entry.name }),
503
+ /* @__PURE__ */ jsx(Text, { id: idId, variant: "caption", tone: "tertiary", mono: true, className: "crewlet-agent-identity-sheet__entry-id", children: entry.id }),
504
+ shownNode(entry.note) ? /* @__PURE__ */ jsx(Text, { variant: "caption", tone: "secondary", children: entry.note }) : null
505
+ ] }),
506
+ chip || entry.state !== "added" && entry.href ? /* @__PURE__ */ jsxs("span", { className: "crewlet-agent-identity-sheet__entry-end", children: [
507
+ chip ? /* @__PURE__ */ jsx(Tag, { size: "sm", variant: chip.tone, children: chip.label }) : null,
508
+ entry.state !== "added" && entry.href ? /* @__PURE__ */ jsx(
509
+ VendorLink,
510
+ {
511
+ href: entry.href,
512
+ held,
513
+ "aria-label": `${action}: ${entry.name}`,
514
+ "aria-describedby": cx(idId, groupId),
515
+ children: action
516
+ }
517
+ ) : null
518
+ ] }) : null
519
+ ] }, entry.id);
520
+ }) });
521
+ return groupId === void 0 ? /* @__PURE__ */ jsx("div", { className: "crewlet-agent-identity-sheet__entry-group", children: rows }, "") : /* @__PURE__ */ jsxs(
522
+ "div",
523
+ {
524
+ role: "group",
525
+ "aria-labelledby": groupId,
526
+ className: "crewlet-agent-identity-sheet__entry-group",
527
+ children: [
528
+ /* @__PURE__ */ jsx(Text, { as: Heading, id: groupId, variant: "label", className: "crewlet-agent-identity-sheet__entry-group-name", children: run.name }),
529
+ rows
530
+ ]
531
+ },
532
+ run.name
533
+ );
534
+ }) });
535
+ }
415
536
 
416
- export { AGENT_IDENTITY_CHIPS, AGENT_IDENTITY_NEEDS_YOU, AGENT_IDENTITY_STATES, AGENT_IDENTITY_WORDS, AgentIdentity, AgentIdentitySheet, agentIdentityNeedsSetUp, agentIdentityNeedsYou };
537
+ export { AGENT_IDENTITY_CHIPS, AGENT_IDENTITY_NEEDS_YOU, AGENT_IDENTITY_STATES, AGENT_IDENTITY_WORDS, AgentIdentity, AgentIdentitySheet, agentIdentityEntryChip, agentIdentityNeedsSetUp, agentIdentityNeedsYou };
@@ -1,9 +1,9 @@
1
1
  import { copyGlyph, CopyStatus } from './chunk-NAHBGKE7.js';
2
2
  import { useClipboard } from './chunk-STJ7QBC3.js';
3
- import { pathBreaks } from './chunk-HZXS5CEL.js';
3
+ import { pathBreaks } from './chunk-T4JEGIUW.js';
4
4
  import { IconButton } from './chunk-66H4BC5Z.js';
5
5
  import { cx } from './chunk-ODEQTPFM.js';
6
- import './Copyable-CMT2N2JE.css';
6
+ import './Copyable-HTJHIJ2D.css';
7
7
  import { useCallback } from 'react';
8
8
  import { jsxs, jsx } from 'react/jsx-runtime';
9
9
 
@@ -42,7 +42,7 @@ var Copyable = ({
42
42
  const shouldTruncate = truncate || variant === "chip" && text.length > resolvedLength;
43
43
  const rendered = display ?? (shouldTruncate ? truncateValue(text, resolvedLength, variant) : text);
44
44
  const wraps = variant === "block" || variant === "compact";
45
- const opaque = wraps && display === void 0 && !/[\s/]/.test(text);
45
+ const opaque = wraps && display === void 0 && !/[\s/@.]/.test(text);
46
46
  const valueTitle = variant === "compact" && rendered === text ? void 0 : text;
47
47
  return /* @__PURE__ */ jsxs(
48
48
  "span",
@@ -58,7 +58,7 @@ var Copyable = ({
58
58
  className
59
59
  ),
60
60
  children: [
61
- /* @__PURE__ */ jsx("span", { className: "crewlet-copyable__value", title: valueTitle, children: variant === "chip" || shouldTruncate ? rendered : pathBreaks(rendered) }),
61
+ /* @__PURE__ */ jsx("span", { className: "crewlet-copyable__value", title: valueTitle, children: variant === "chip" || shouldTruncate ? rendered : pathBreaks(rendered, { addresses: true }) }),
62
62
  /* @__PURE__ */ jsx(
63
63
  IconButton,
64
64
  {
@@ -1,4 +1,4 @@
1
- import { pathBreaks } from './chunk-HZXS5CEL.js';
1
+ import { pathBreaks } from './chunk-T4JEGIUW.js';
2
2
  import { cx } from './chunk-ODEQTPFM.js';
3
3
  import './InlineCode-3KJCBT5I.css';
4
4
  import { Children } from 'react';
@@ -0,0 +1,110 @@
1
+ import { groupInOrder } from './chunk-JADTOJUL.js';
2
+ import { Text } from './chunk-475DOAWF.js';
3
+ import { Checkbox } from './chunk-2DESFB7K.js';
4
+ import { Button } from './chunk-YVMIT2OW.js';
5
+ import { Input } from './chunk-ZR276S44.js';
6
+ import { headingTag, useHeadingLevel } from './chunk-PQADV6P6.js';
7
+ import { VisuallyHidden } from './chunk-RRRK2KB6.js';
8
+ import { cx } from './chunk-ODEQTPFM.js';
9
+ import './ScopeList-4THHOZ46.css';
10
+ import { useId, useState } from 'react';
11
+ import { SearchGlyph } from '@crewlethq/icons/glyphs';
12
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
13
+
14
+ var SCOPE_LIST_LABELS = {
15
+ chosen: (chosen, of) => `${chosen.toLocaleString()} of ${of.toLocaleString()} chosen`,
16
+ chooseAll: "Choose all",
17
+ clear: "Clear",
18
+ find: "Find by name or ID",
19
+ noMatch: (term) => `Nothing matches \u201C${term}\u201D.`,
20
+ none: "Nothing to choose from."
21
+ };
22
+ function ScopeList({
23
+ label,
24
+ options,
25
+ value,
26
+ onChange,
27
+ searchFrom = 8,
28
+ bulk = true,
29
+ labels: overrides,
30
+ className
31
+ }) {
32
+ const labels = { ...SCOPE_LIST_LABELS, ...overrides };
33
+ const base = useId();
34
+ const [term, setTerm] = useState("");
35
+ const chosen = new Set(value);
36
+ const searchable = options.length >= searchFrom;
37
+ const find = searchable ? term.trim().toLowerCase() : "";
38
+ const shown = find ? options.filter(
39
+ (o) => `${o.label} ${o.detail ?? ""} ${o.id ?? ""} ${o.value} ${o.group ?? ""}`.toLowerCase().includes(find)
40
+ ) : options;
41
+ const open = shown.filter((o) => !o.disabled);
42
+ const allShown = open.length > 0 && open.every((o) => chosen.has(o.value));
43
+ const toggleShown = () => {
44
+ if (allShown) {
45
+ const off = new Set(open.map((o) => o.value));
46
+ onChange(value.filter((v) => !off.has(v)));
47
+ } else {
48
+ onChange([...value, ...open.map((o) => o.value).filter((v) => !chosen.has(v))]);
49
+ }
50
+ };
51
+ const count = options.filter((o) => chosen.has(o.value)).length;
52
+ const Heading = headingTag(useHeadingLevel());
53
+ const row = (o, i, groupId) => {
54
+ const on = chosen.has(o.value);
55
+ const idId = o.id && o.id !== o.label ? `${base}-id-${i}` : void 0;
56
+ return /* @__PURE__ */ jsxs("li", { className: "crewlet-scope-list__row", "data-chosen": on || void 0, children: [
57
+ /* @__PURE__ */ jsx(
58
+ Checkbox,
59
+ {
60
+ className: "crewlet-scope-list__check",
61
+ label: o.label,
62
+ description: o.detail || o.disabled && o.disabledReason ? /* @__PURE__ */ jsxs(Fragment, { children: [
63
+ o.detail ? /* @__PURE__ */ jsx("span", { className: "crewlet-scope-list__detail", children: o.detail }) : null,
64
+ o.disabled && o.disabledReason ? /* @__PURE__ */ jsx("span", { children: o.disabledReason }) : null
65
+ ] }) : void 0,
66
+ checked: on,
67
+ disabled: o.disabled,
68
+ "aria-describedby": cx(idId, groupId) || void 0,
69
+ onCheckedChange: (next) => onChange(next ? [...value, o.value] : value.filter((v) => v !== o.value))
70
+ }
71
+ ),
72
+ idId ? /* @__PURE__ */ jsx(Text, { id: idId, variant: "caption", tone: "tertiary", mono: true, className: "crewlet-scope-list__id", children: o.id }) : null
73
+ ] }, o.value);
74
+ };
75
+ const at = new Map(shown.map((o, i) => [o.value, i]));
76
+ const visible = new Set(shown);
77
+ const runs = groupInOrder(options).map((run) => ({ ...run, items: run.items.filter((o) => visible.has(o)) })).filter((run) => run.items.length > 0);
78
+ return /* @__PURE__ */ jsxs("fieldset", { className: cx("crewlet-scope-list", className), children: [
79
+ /* @__PURE__ */ jsx(VisuallyHidden, { as: "legend", children: label }),
80
+ bulk ? /* @__PURE__ */ jsxs("div", { className: "crewlet-scope-list__bar", children: [
81
+ /* @__PURE__ */ jsx(Text, { variant: "caption", tone: "secondary", children: labels.chosen(count, options.length) }),
82
+ /* @__PURE__ */ jsx(Button, { size: "small", variant: "ghost", disabled: open.length === 0, onClick: toggleShown, children: allShown ? labels.clear : labels.chooseAll })
83
+ ] }) : null,
84
+ searchable ? /* @__PURE__ */ jsx(
85
+ Input,
86
+ {
87
+ type: "search",
88
+ "aria-label": labels.find,
89
+ placeholder: labels.find,
90
+ inputSize: "sm",
91
+ width: "full",
92
+ leading: /* @__PURE__ */ jsx(SearchGlyph, { size: "sm" }),
93
+ value: term,
94
+ onChange: (e) => setTerm(e.target.value)
95
+ }
96
+ ) : null,
97
+ shown.length > 0 ? runs.map((run, r) => {
98
+ if (run.name === void 0) {
99
+ return /* @__PURE__ */ jsx("ul", { className: "crewlet-scope-list__rows", children: run.items.map((o) => row(o, at.get(o.value), void 0)) }, "");
100
+ }
101
+ const groupId = `${base}-group-${r}`;
102
+ return /* @__PURE__ */ jsxs("div", { role: "group", "aria-labelledby": groupId, className: "crewlet-scope-list__group", children: [
103
+ /* @__PURE__ */ jsx(Text, { as: Heading, id: groupId, variant: "label", className: "crewlet-scope-list__group-name", children: run.name }),
104
+ /* @__PURE__ */ jsx("ul", { className: "crewlet-scope-list__rows", children: run.items.map((o) => row(o, at.get(o.value), groupId)) })
105
+ ] }, run.name);
106
+ }) : /* @__PURE__ */ jsx(Text, { as: "p", variant: "caption", tone: "secondary", className: "crewlet-scope-list__empty", children: find ? labels.noMatch(term.trim()) : labels.none })
107
+ ] });
108
+ }
109
+
110
+ export { SCOPE_LIST_LABELS, ScopeList };
@@ -1,4 +1,4 @@
1
- import { InlineCode } from './chunk-W4UJWFCZ.js';
1
+ import { InlineCode } from './chunk-E3XKFND2.js';
2
2
  import { FormField, Input } from './chunk-ZR276S44.js';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
 
@@ -1,6 +1,6 @@
1
- import { ConfirmModal } from './chunk-C2676ENR.js';
1
+ import { ConfirmModal } from './chunk-KQTWO46B.js';
2
2
  import { Callout } from './chunk-XJLGQ7U7.js';
3
- import { InlineCode } from './chunk-W4UJWFCZ.js';
3
+ import { InlineCode } from './chunk-E3XKFND2.js';
4
4
  import './LinkInterstitial-ET4MSVSV.css';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { useListbox, useHighlightRest } from './chunk-KW7T23RT.js';
2
2
  import { Kbd } from './chunk-VBBLHS2Y.js';
3
3
  import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
4
- import { useScrollerFocus, Modal } from './chunk-C2676ENR.js';
4
+ import { useScrollerFocus, Modal } from './chunk-KQTWO46B.js';
5
5
  import { Input } from './chunk-ZR276S44.js';
6
6
  import { Count } from './chunk-6YKTRAWI.js';
7
7
  import { isComposing } from './chunk-EDPMHSLZ.js';
@@ -1,7 +1,7 @@
1
1
  import { PageHeader } from './chunk-FPDIHEM4.js';
2
2
  import { FilterPill } from './chunk-GR6Y53EC.js';
3
3
  import { DateTimePicker } from './chunk-LY7XCIMS.js';
4
- import { DataTable } from './chunk-S7MHUIJX.js';
4
+ import { DataTable } from './chunk-VNEUVMUR.js';
5
5
  import { useListbox, useOptionKeys } from './chunk-KW7T23RT.js';
6
6
  import { Toolbar } from './chunk-NPEI2QAN.js';
7
7
  import { RelativeTime } from './chunk-5ZL3PXEL.js';
@@ -0,0 +1,20 @@
1
+ // src/utils/groupInOrder.ts
2
+ function groupInOrder(items) {
3
+ const loose = [];
4
+ const runs = /* @__PURE__ */ new Map();
5
+ for (const item of items) {
6
+ if (item.group === void 0 || item.group === "") {
7
+ loose.push(item);
8
+ continue;
9
+ }
10
+ const run = runs.get(item.group);
11
+ if (run) run.push(item);
12
+ else runs.set(item.group, [item]);
13
+ }
14
+ return [
15
+ ...loose.length > 0 ? [{ name: void 0, items: loose }] : [],
16
+ ...[...runs].map(([name, run]) => ({ name, items: run }))
17
+ ];
18
+ }
19
+
20
+ export { groupInOrder };
@@ -1,4 +1,4 @@
1
- import { consequencesAnswered, ConsequenceList } from './chunk-N3VY4RNR.js';
1
+ import { consequencesAnswered, ConsequenceList } from './chunk-237WBIAN.js';
2
2
  import { ChangeGroups } from './chunk-XXHIU65G.js';
3
3
  import { Button } from './chunk-YVMIT2OW.js';
4
4
  import { IconButton } from './chunk-66H4BC5Z.js';
@@ -2,7 +2,7 @@ import { Select } from './chunk-DPCXOBXN.js';
2
2
  import { PrincipalAvatar } from './chunk-265IX4YA.js';
3
3
  import { useMediaMatch } from './chunk-COS6LJ4K.js';
4
4
  import { CopyButton } from './chunk-NAHBGKE7.js';
5
- import { Modal } from './chunk-C2676ENR.js';
5
+ import { Modal } from './chunk-KQTWO46B.js';
6
6
  import { Callout } from './chunk-XJLGQ7U7.js';
7
7
  import { Button } from './chunk-YVMIT2OW.js';
8
8
  import { IconButton } from './chunk-66H4BC5Z.js';
@@ -1,5 +1,5 @@
1
1
  import { SegmentedControl } from './chunk-2XC4MYBB.js';
2
- import { Modal } from './chunk-C2676ENR.js';
2
+ import { Modal } from './chunk-KQTWO46B.js';
3
3
  import { Callout } from './chunk-XJLGQ7U7.js';
4
4
  import { Button } from './chunk-YVMIT2OW.js';
5
5
  import { FormField, Input } from './chunk-ZR276S44.js';
@@ -1,5 +1,5 @@
1
1
  import { Eyebrow } from './chunk-RK4XPHVG.js';
2
- import { InlineCode } from './chunk-W4UJWFCZ.js';
2
+ import { InlineCode } from './chunk-E3XKFND2.js';
3
3
  import { Tag } from './chunk-ASBBB5AJ.js';
4
4
  import { titleWhenCut } from './chunk-WSIJDWUG.js';
5
5
  import { cx } from './chunk-ODEQTPFM.js';
@@ -2,12 +2,13 @@ import { Children, Fragment } from 'react';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
 
4
4
  // src/utils/pathBreaks.tsx
5
- function pathBreaks(children) {
5
+ var PATH = /(?<=\/)/;
6
+ var ADDRESS = /(?<=\/|[^\s/@.][@.])/;
7
+ function pathBreaks(children, { addresses = false } = {}) {
6
8
  const parts = Children.toArray(children);
7
9
  if (!parts.every((part) => typeof part === "string" || typeof part === "number")) return children;
8
- const text = parts.join("");
9
- if (!text.includes("/")) return children;
10
- const runs = text.split(/(?<=\/)/);
10
+ const runs = parts.join("").split(addresses ? ADDRESS : PATH);
11
+ if (runs.length < 2) return children;
11
12
  return runs.map((run, i) => /* @__PURE__ */ jsxs(Fragment, { children: [
12
13
  run,
13
14
  i < runs.length - 1 ? /* @__PURE__ */ jsx("wbr", {}) : null
@@ -1,5 +1,5 @@
1
1
  import { normalizeHex } from './chunk-7W3LYIOC.js';
2
- import { Copyable } from './chunk-ISM47T7P.js';
2
+ import { Copyable } from './chunk-33KDTRUV.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './ColorSwatch-HBNYO6EK.css';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -3,7 +3,7 @@ import { KeyChip, highlightMatch } from './chunk-HBDA76EZ.js';
3
3
  import { Skeleton } from './chunk-WFAJYBLX.js';
4
4
  import { Popover } from './chunk-SWZV6R46.js';
5
5
  import { useMediaMatch } from './chunk-COS6LJ4K.js';
6
- import { Modal } from './chunk-C2676ENR.js';
6
+ import { Modal } from './chunk-KQTWO46B.js';
7
7
  import { Text } from './chunk-475DOAWF.js';
8
8
  import { Input } from './chunk-ZR276S44.js';
9
9
  import { announce } from './chunk-WGMKERCR.js';
@@ -2,7 +2,7 @@ import { EmptyValue } from './chunk-WGLOH33S.js';
2
2
  import { useCardHeaderSlot } from './chunk-AV2DXAEL.js';
3
3
  import { Menu } from './chunk-43N4EHFR.js';
4
4
  import { useClipboard } from './chunk-STJ7QBC3.js';
5
- import { Modal } from './chunk-C2676ENR.js';
5
+ import { Modal } from './chunk-KQTWO46B.js';
6
6
  import { Checkbox } from './chunk-2DESFB7K.js';
7
7
  import { Button } from './chunk-YVMIT2OW.js';
8
8
  import { IconButton } from './chunk-66H4BC5Z.js';