@crewlethq/ui 0.18.0 → 0.20.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.
- package/README.md +40 -4
- package/dist/AccessDeniedCard/index.js +2 -2
- package/dist/AppShell/index.js +2 -2
- package/dist/ArrangeBoard/ArrangeBoard.d.ts +32 -0
- package/dist/ArrangeBoard/index.d.ts +3 -0
- package/dist/ArrangeBoard/index.js +2 -0
- package/dist/ArrangeBoard-MQE35P6Z.css +80 -0
- package/dist/ArrangeFrame/ArrangeFrame.d.ts +82 -0
- package/dist/ArrangeFrame/index.d.ts +5 -0
- package/dist/ArrangeFrame/index.js +5 -0
- package/dist/ArrangeFrame/useGridResize.d.ts +66 -0
- package/dist/ArrangeFrame-3PLZAG22.css +329 -0
- package/dist/ArrangeGroup/ArrangeGroup.d.ts +42 -0
- package/dist/ArrangeGroup/index.d.ts +3 -0
- package/dist/ArrangeGroup/index.js +4 -0
- package/dist/ArrangeGroup-SHFHA7BE.css +170 -0
- package/dist/ArrangeList/ArrangeList.d.ts +64 -0
- package/dist/ArrangeList/index.d.ts +3 -0
- package/dist/ArrangeList/index.js +10 -0
- package/dist/ArrangeList-NNRTDFI5.css +94 -0
- package/dist/ArtifactCard/index.js +2 -2
- package/dist/AuthLayout/index.js +2 -2
- package/dist/AvatarPicker/index.js +4 -4
- package/dist/Canvas/index.js +2 -2
- package/dist/Card/index.js +1 -1
- package/dist/Checkbox/index.js +3 -3
- package/dist/Combobox/index.js +4 -4
- package/dist/CommandPalette/index.js +6 -6
- package/dist/CommentThread/CommentThread.d.ts +85 -0
- package/dist/CommentThread/index.d.ts +3 -0
- package/dist/CommentThread/index.js +16 -0
- package/dist/CommentThread-7VXOFTZO.css +90 -0
- package/dist/Composer/index.js +3 -3
- package/dist/ConfirmField/index.js +3 -3
- package/dist/ConflictNote/ConflictNote.d.ts +42 -0
- package/dist/ConflictNote/index.d.ts +3 -0
- package/dist/ConflictNote/index.js +4 -0
- package/dist/ConflictNote-DH77PYF7.css +27 -0
- package/dist/DataTable/index.js +8 -8
- package/dist/DataView/index.js +13 -13
- package/dist/DateTimePicker/index.js +3 -3
- package/dist/DiffView/DiffView.d.ts +59 -0
- package/dist/DiffView/diff.d.ts +97 -0
- package/dist/DiffView/index.d.ts +5 -0
- package/dist/DiffView/index.js +3 -0
- package/dist/DiffView-RVLIHTKG.css +91 -0
- package/dist/Divider/Divider.d.ts +15 -0
- package/dist/Divider/index.d.ts +3 -0
- package/dist/Divider/index.js +2 -0
- package/dist/Divider-3Z77ZAJH.css +37 -0
- package/dist/HuePicker/HuePicker.d.ts +16 -4
- package/dist/HuePicker/index.js +2 -2
- package/dist/{HuePicker-5QIUR6L7.css → HuePicker-PAIGH6LR.css} +6 -0
- package/dist/IconTile/IconTile.d.ts +23 -0
- package/dist/IconTile/index.d.ts +3 -0
- package/dist/IconTile/index.js +2 -0
- package/dist/IconTile-4GNWTLAW.css +30 -0
- package/dist/Input/index.js +2 -2
- package/dist/LinkInterstitial/index.js +4 -4
- package/dist/ListInput/index.js +5 -5
- package/dist/MarkdownEditor/index.js +2 -2
- package/dist/Menu/index.js +2 -2
- package/dist/Modal/Modal.d.ts +20 -0
- package/dist/Modal/index.js +3 -3
- package/dist/{Modal-RQAYGG4L.css → Modal-XOSV6FAH.css} +14 -0
- package/dist/Note/Note.d.ts +23 -0
- package/dist/Note/index.d.ts +3 -0
- package/dist/Note/index.js +2 -0
- package/dist/Note-RT4L6VUT.css +58 -0
- package/dist/OrgTable/index.js +5 -5
- package/dist/PeopleRail/PeopleRail.d.ts +52 -0
- package/dist/PeopleRail/index.d.ts +3 -0
- package/dist/PeopleRail/index.js +11 -0
- package/dist/PeopleRail-R64WVOSH.css +75 -0
- package/dist/PinTile/PinTile.d.ts +37 -0
- package/dist/PinTile/index.d.ts +3 -0
- package/dist/PinTile/index.js +4 -0
- package/dist/PinTile-IIA25MNZ.css +141 -0
- package/dist/PresenceStack/index.js +1 -1
- package/dist/PrincipalPicker/index.js +5 -5
- package/dist/Reorder/index.d.ts +2 -0
- package/dist/Reorder/index.js +4 -0
- package/dist/Reorder/useReorder.d.ts +138 -0
- package/dist/ShareDialog/index.js +7 -7
- package/dist/SheetGrid/index.js +5 -5
- package/dist/StatGroup/StatGroup.d.ts +7 -1
- package/dist/StatGroup/index.js +1 -1
- package/dist/{StatGroup-HVG6O62W.css → StatGroup-PADTJCUQ.css} +7 -0
- package/dist/Switcher/index.js +8 -8
- package/dist/TableCells/TableCells.d.ts +153 -0
- package/dist/TableCells/index.d.ts +3 -0
- package/dist/TableCells/index.js +10 -0
- package/dist/TableCells-3VN5N2M3.css +104 -0
- package/dist/TagsInput/index.js +3 -3
- package/dist/TimeWindowPicker/index.js +5 -5
- package/dist/TreeCanvas/index.js +3 -3
- package/dist/TreeGrid/index.js +2 -2
- package/dist/VersionCompare/VersionCompare.d.ts +70 -0
- package/dist/VersionCompare/index.d.ts +3 -0
- package/dist/VersionCompare/index.js +11 -0
- package/dist/VersionCompare-UUZOPTQO.css +68 -0
- package/dist/chunk-35XVR5JQ.js +81 -0
- package/dist/chunk-63WJLRB2.js +24 -0
- package/dist/{chunk-L4ZLXYPO.js → chunk-6A7P6II6.js} +1 -1
- package/dist/chunk-6KWNXIDE.js +18 -0
- package/dist/chunk-6MIXD6IW.js +49 -0
- package/dist/chunk-73QBUUYX.js +102 -0
- package/dist/{chunk-NZY77ZDU.js → chunk-7FQEUNHX.js} +4 -4
- package/dist/{chunk-2TZATTIU.js → chunk-7IJARUIF.js} +18 -5
- package/dist/{chunk-A7EBCHEG.js → chunk-A4VMJMXJ.js} +1 -1
- package/dist/chunk-AIVZVKYZ.js +126 -0
- package/dist/{chunk-76FXDZAZ.js → chunk-AJESMWJS.js} +4 -4
- package/dist/chunk-BVWSLXTY.js +187 -0
- package/dist/chunk-DEJHAOC5.js +279 -0
- package/dist/{chunk-ERV5BUS3.js → chunk-EIGEIT4O.js} +3 -3
- package/dist/chunk-EZBLOUWX.js +176 -0
- package/dist/chunk-FFMCMSJB.js +1 -0
- package/dist/{chunk-LFZ45HV2.js → chunk-G3EEUNZQ.js} +1 -1
- package/dist/{chunk-2YR5ZPQ3.js → chunk-HTCJSUIZ.js} +3 -3
- package/dist/{chunk-75CLJNDQ.js → chunk-I6NZKJGK.js} +1 -1
- package/dist/chunk-IXJHTFXG.js +17 -0
- package/dist/{chunk-3UAA4IWJ.js → chunk-JEDWC3GI.js} +1 -1
- package/dist/{chunk-QVAFL2LE.js → chunk-JXRI5YD2.js} +3 -3
- package/dist/{chunk-ZFH7H7GS.js → chunk-LOLELDBW.js} +1 -1
- package/dist/chunk-MUGM7SEG.js +88 -0
- package/dist/chunk-N4GFRW5C.js +96 -0
- package/dist/{chunk-KVT3TJVG.js → chunk-OIMAK5AE.js} +6 -6
- package/dist/chunk-QO7QEQKV.js +24 -0
- package/dist/{chunk-BOW2VUCH.js → chunk-T7ICFXEC.js} +1 -1
- package/dist/{chunk-2OLCUNG7.js → chunk-TBIZSQHB.js} +1 -1
- package/dist/{chunk-4U3GQ7D2.js → chunk-TODND5AD.js} +1 -1
- package/dist/chunk-UO7JZVCO.js +35 -0
- package/dist/{chunk-IFKBDRNJ.js → chunk-UXELEORU.js} +3 -3
- package/dist/{chunk-6NIMZ5XC.js → chunk-VJLYGPPE.js} +1 -1
- package/dist/{chunk-7QFAORCY.js → chunk-WHZFDS62.js} +1 -1
- package/dist/chunk-XJ2QEBMM.js +277 -0
- package/dist/{chunk-PA4CYTBY.js → chunk-XU4ZUGLE.js} +19 -4
- package/dist/{chunk-T3ZWBZ65.js → chunk-YSJYWQSP.js} +2 -2
- package/dist/{chunk-CXBAIVYZ.js → chunk-YSY6UJ4F.js} +1 -1
- package/dist/{chunk-EG6NYWVK.js → chunk-YZCJ63JF.js} +1 -1
- package/dist/generated/index.d.ts +15 -0
- package/dist/generated/index.js +89 -74
- package/dist/index.js +89 -74
- package/dist/styles.css +1533 -70
- package/package.json +3 -3
- package/dist/chunk-EXHQ2QVW.js +0 -1
- package/dist/{chunk-AQCV62K6.js → chunk-7ZNKEPLN.js} +1 -1
- package/dist/{chunk-OYOQU7O5.js → chunk-EDGCPVVD.js} +1 -1
- package/dist/{chunk-FYXRWBJJ.js → chunk-J2G4HGQM.js} +1 -1
- package/dist/{chunk-NS7BVLL3.js → chunk-JULMZNGT.js} +1 -1
- package/dist/{chunk-5NVKTB6E.js → chunk-L4H7SSWF.js} +1 -1
- package/dist/{chunk-ESKP3TXM.js → chunk-MSSZHDZI.js} +0 -0
- package/dist/{chunk-4GB57WIT.js → chunk-Q55TXPA3.js} +1 -1
- package/dist/{chunk-B2Z2CDM5.js → chunk-T5TFZ2JB.js} +1 -1
- package/dist/{chunk-AMH67MLM.js → chunk-TXAFKH2A.js} +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { IconButton } from './chunk-4FQT6ZAY.js';
|
|
2
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
+
import './PinTile-IIA25MNZ.css';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { GripVerticalGlyph, PinGlyph } from '@crewlethq/icons/glyphs';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var PinTile = forwardRef(function PinTile2({ title, href, kind, meta, leading, status, figure, onUnpin, handle, className, ...rest }, ref) {
|
|
9
|
+
const { "aria-label": handleName, ...handleRest } = handle ?? { "aria-label": "" };
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cx("crewlet-pin-tile", className), ...rest, children: [
|
|
11
|
+
handle ? /* @__PURE__ */ jsx(
|
|
12
|
+
IconButton,
|
|
13
|
+
{
|
|
14
|
+
size: "sm",
|
|
15
|
+
variant: "ghost",
|
|
16
|
+
className: "crewlet-pin-tile__handle",
|
|
17
|
+
label: handleName,
|
|
18
|
+
icon: /* @__PURE__ */ jsx(GripVerticalGlyph, { size: "sm" }),
|
|
19
|
+
...handleRest
|
|
20
|
+
}
|
|
21
|
+
) : null,
|
|
22
|
+
leading ? /* @__PURE__ */ jsx("span", { className: "crewlet-pin-tile__leading", "aria-hidden": "true", children: leading }) : null,
|
|
23
|
+
/* @__PURE__ */ jsxs("span", { className: "crewlet-pin-tile__body", children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("span", { className: "crewlet-pin-tile__head", children: [
|
|
25
|
+
/* @__PURE__ */ jsx("a", { className: "crewlet-pin-tile__link", href, children: title }),
|
|
26
|
+
status ? /* @__PURE__ */ jsx("span", { className: "crewlet-pin-tile__status", children: status }) : null
|
|
27
|
+
] }),
|
|
28
|
+
kind || meta ? /* @__PURE__ */ jsxs("span", { className: "crewlet-pin-tile__meta", children: [
|
|
29
|
+
kind ? /* @__PURE__ */ jsx("span", { className: "crewlet-pin-tile__kind", children: kind }) : null,
|
|
30
|
+
kind && meta ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: " \xB7 " }) : null,
|
|
31
|
+
meta
|
|
32
|
+
] }) : null
|
|
33
|
+
] }),
|
|
34
|
+
figure !== void 0 && figure !== null ? /* @__PURE__ */ jsx("span", { className: "crewlet-pin-tile__figure", children: figure }) : null,
|
|
35
|
+
onUnpin ? /* @__PURE__ */ jsx(
|
|
36
|
+
IconButton,
|
|
37
|
+
{
|
|
38
|
+
size: "sm",
|
|
39
|
+
variant: "ghost",
|
|
40
|
+
className: "crewlet-pin-tile__unpin",
|
|
41
|
+
label: `Unpin ${title}`,
|
|
42
|
+
icon: /* @__PURE__ */ jsx(PinGlyph, { size: "sm" }),
|
|
43
|
+
onClick: onUnpin
|
|
44
|
+
}
|
|
45
|
+
) : null
|
|
46
|
+
] });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export { PinTile };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { diffLines, diffStat, collapseDiff, DiffSummary, DiffView } from './chunk-BVWSLXTY.js';
|
|
2
|
+
import { SegmentedControl } from './chunk-26PEPONN.js';
|
|
3
|
+
import { EmptyState } from './chunk-RA2ULG6H.js';
|
|
4
|
+
import { useHeadingLevel, headingTag, nextHeadingLevel, HeadingLevelProvider } from './chunk-PQADV6P6.js';
|
|
5
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
6
|
+
import './VersionCompare-UUZOPTQO.css';
|
|
7
|
+
import { useId, useMemo } from 'react';
|
|
8
|
+
import { CheckGlyph } from '@crewlethq/icons/glyphs';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var VERSION_COMPARE_LENSES = ["changes", "versions"];
|
|
12
|
+
var VERSION_COMPARE_LABELS = {
|
|
13
|
+
title: (from, to) => `${from} and ${to}`,
|
|
14
|
+
lens: "Compare by",
|
|
15
|
+
changes: "Changes",
|
|
16
|
+
versions: "Side by side",
|
|
17
|
+
region: (from, to) => `Changes from ${from} to ${to}`,
|
|
18
|
+
identicalTitle: "Nothing changed",
|
|
19
|
+
identicalDescription: "The two versions hold the same text."
|
|
20
|
+
};
|
|
21
|
+
function VersionCompare({
|
|
22
|
+
fromLabel,
|
|
23
|
+
toLabel,
|
|
24
|
+
title,
|
|
25
|
+
description,
|
|
26
|
+
lens,
|
|
27
|
+
onLensChange,
|
|
28
|
+
before,
|
|
29
|
+
after,
|
|
30
|
+
changes,
|
|
31
|
+
context = 3,
|
|
32
|
+
from,
|
|
33
|
+
to,
|
|
34
|
+
note,
|
|
35
|
+
actions,
|
|
36
|
+
labels: overrides,
|
|
37
|
+
className
|
|
38
|
+
}) {
|
|
39
|
+
const labels = overrides ? { ...VERSION_COMPARE_LABELS, ...overrides } : VERSION_COMPARE_LABELS;
|
|
40
|
+
const headingID = useId();
|
|
41
|
+
const level = useHeadingLevel();
|
|
42
|
+
const Heading = headingTag(level);
|
|
43
|
+
const inner = nextHeadingLevel(level);
|
|
44
|
+
const PaneHeading = headingTag(inner);
|
|
45
|
+
const hostChanges = changes !== void 0 && changes !== null;
|
|
46
|
+
const canChanges = hostChanges || before !== void 0 && after !== void 0;
|
|
47
|
+
const canVersions = from !== void 0 && from !== null || to !== void 0 && to !== null;
|
|
48
|
+
const shown = lens === "versions" ? canVersions ? "versions" : "changes" : canChanges ? "changes" : "versions";
|
|
49
|
+
const diff = useMemo(() => {
|
|
50
|
+
if (hostChanges || shown !== "changes" || before === void 0 || after === void 0) return null;
|
|
51
|
+
const lines = diffLines(before, after);
|
|
52
|
+
return { sections: collapseDiff(lines, context), stat: diffStat(lines) };
|
|
53
|
+
}, [hostChanges, shown, before, after, context]);
|
|
54
|
+
const panes = [
|
|
55
|
+
{ key: "from", label: fromLabel, node: from },
|
|
56
|
+
{ key: "to", label: toLabel, node: to }
|
|
57
|
+
].filter((pane) => pane.node !== void 0 && pane.node !== null);
|
|
58
|
+
return /* @__PURE__ */ jsxs("section", { className: cx("crewlet-version-compare", className), "aria-labelledby": headingID, children: [
|
|
59
|
+
/* @__PURE__ */ jsxs("div", { className: "crewlet-version-compare__head", children: [
|
|
60
|
+
/* @__PURE__ */ jsxs("div", { className: "crewlet-version-compare__titles", children: [
|
|
61
|
+
/* @__PURE__ */ jsx(Heading, { className: "crewlet-version-compare__title", id: headingID, children: title ?? labels.title(fromLabel, toLabel) }),
|
|
62
|
+
description !== void 0 && description !== null && /* @__PURE__ */ jsx("p", { className: "crewlet-version-compare__description", children: description })
|
|
63
|
+
] }),
|
|
64
|
+
onLensChange && canChanges && canVersions && /* @__PURE__ */ jsx(
|
|
65
|
+
SegmentedControl,
|
|
66
|
+
{
|
|
67
|
+
semantics: "radio",
|
|
68
|
+
activate: "manual",
|
|
69
|
+
size: "sm",
|
|
70
|
+
label: labels.lens,
|
|
71
|
+
value: shown,
|
|
72
|
+
onValueChange: onLensChange,
|
|
73
|
+
options: [
|
|
74
|
+
{ value: "changes", label: labels.changes },
|
|
75
|
+
{ value: "versions", label: labels.versions }
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
actions
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ jsx(HeadingLevelProvider, { level: inner, children: shown === "changes" ? diff ? diff.stat.identical ? /* @__PURE__ */ jsx(
|
|
82
|
+
EmptyState,
|
|
83
|
+
{
|
|
84
|
+
size: "compact",
|
|
85
|
+
icon: /* @__PURE__ */ jsx(CheckGlyph, { size: "xl" }),
|
|
86
|
+
title: labels.identicalTitle,
|
|
87
|
+
description: labels.identicalDescription
|
|
88
|
+
}
|
|
89
|
+
) : /* @__PURE__ */ jsxs("div", { className: "crewlet-version-compare__changes", children: [
|
|
90
|
+
/* @__PURE__ */ jsx(DiffSummary, { added: diff.stat.added, removed: diff.stat.removed, against: fromLabel }),
|
|
91
|
+
/* @__PURE__ */ jsx(DiffView, { sections: diff.sections, "aria-label": labels.region(fromLabel, toLabel) })
|
|
92
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "crewlet-version-compare__changes", children: changes }) : /* @__PURE__ */ jsxs("div", { className: "crewlet-version-compare__versions", children: [
|
|
93
|
+
note !== void 0 && note !== null && /* @__PURE__ */ jsx("p", { className: "crewlet-version-compare__note", children: note }),
|
|
94
|
+
/* @__PURE__ */ jsx("div", { className: "crewlet-version-compare__panes", children: panes.map((pane) => /* @__PURE__ */ jsxs("div", { className: "crewlet-version-compare__pane", children: [
|
|
95
|
+
/* @__PURE__ */ jsx(PaneHeading, { className: "crewlet-version-compare__pane-title", children: pane.label }),
|
|
96
|
+
/* @__PURE__ */ jsx(HeadingLevelProvider, { level: nextHeadingLevel(inner), children: pane.node })
|
|
97
|
+
] }, pane.key)) })
|
|
98
|
+
] }) })
|
|
99
|
+
] });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { VERSION_COMPARE_LABELS, VERSION_COMPARE_LENSES, VersionCompare };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Skeleton } from './chunk-W5J7R5EB.js';
|
|
2
|
-
import { Modal } from './chunk-
|
|
2
|
+
import { Modal } from './chunk-7IJARUIF.js';
|
|
3
3
|
import { useListbox, useOptionKeys } from './chunk-F73MC7EZ.js';
|
|
4
|
-
import {
|
|
5
|
-
import { Input } from './chunk-4GB57WIT.js';
|
|
4
|
+
import { Input } from './chunk-Q55TXPA3.js';
|
|
6
5
|
import { Popover } from './chunk-BWRGFKJP.js';
|
|
7
|
-
import {
|
|
6
|
+
import { KeyChip, highlightMatch } from './chunk-FYTIJM2T.js';
|
|
8
7
|
import { useMediaMatch } from './chunk-IG75YMUN.js';
|
|
9
8
|
import { focusables, isComposing } from './chunk-R25RGPUB.js';
|
|
9
|
+
import { announce } from './chunk-RSAQOKH3.js';
|
|
10
10
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
11
11
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
12
12
|
import './Switcher-B44Q4WF4.css';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
2
|
-
import {
|
|
2
|
+
import { HeadingLevelProvider } from './chunk-PQADV6P6.js';
|
|
3
3
|
import { useLayerContainer } from './chunk-HMPFGIWM.js';
|
|
4
4
|
import { focusables, useModalLayer, useBodyScrollLock } from './chunk-R25RGPUB.js';
|
|
5
|
-
import {
|
|
5
|
+
import { IconButton } from './chunk-4FQT6ZAY.js';
|
|
6
6
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
7
|
-
import './Modal-
|
|
7
|
+
import './Modal-XOSV6FAH.css';
|
|
8
8
|
import { useId, useRef, useCallback } from 'react';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
|
-
import { XGlyph } from '@crewlethq/icons/glyphs';
|
|
10
|
+
import { ChevronLeftGlyph, XGlyph } from '@crewlethq/icons/glyphs';
|
|
11
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
12
12
|
|
|
13
13
|
function Modal({ open, ...rest }) {
|
|
@@ -35,6 +35,8 @@ function ModalFrame({
|
|
|
35
35
|
footer,
|
|
36
36
|
footerStart,
|
|
37
37
|
headerActions,
|
|
38
|
+
onBack,
|
|
39
|
+
backLabel = "Back",
|
|
38
40
|
children,
|
|
39
41
|
size = "sm",
|
|
40
42
|
variant = "dialog",
|
|
@@ -43,6 +45,7 @@ function ModalFrame({
|
|
|
43
45
|
role = "dialog",
|
|
44
46
|
dismissable = true,
|
|
45
47
|
closeOnBackdrop = true,
|
|
48
|
+
backdrop = "veil",
|
|
46
49
|
showCloseButton = true,
|
|
47
50
|
stackBody = false,
|
|
48
51
|
flush = false,
|
|
@@ -101,7 +104,16 @@ function ModalFrame({
|
|
|
101
104
|
};
|
|
102
105
|
const closes = banded && showCloseButton;
|
|
103
106
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
104
|
-
banded && (given(title) || given(subtitle) || given(headerActions) || closes) ? /* @__PURE__ */ jsxs("div", { className: cx("crewlet-modal__header", sheet ? "crewlet-modal__header--sheet" : void 0), children: [
|
|
107
|
+
banded && (given(title) || given(subtitle) || given(headerActions) || closes || onBack) ? /* @__PURE__ */ jsxs("div", { className: cx("crewlet-modal__header", sheet ? "crewlet-modal__header--sheet" : void 0), children: [
|
|
108
|
+
onBack ? /* @__PURE__ */ jsx(
|
|
109
|
+
IconButton,
|
|
110
|
+
{
|
|
111
|
+
className: "crewlet-modal__back",
|
|
112
|
+
label: backLabel,
|
|
113
|
+
icon: /* @__PURE__ */ jsx(ChevronLeftGlyph, { size: "md" }),
|
|
114
|
+
onClick: onBack
|
|
115
|
+
}
|
|
116
|
+
) : null,
|
|
105
117
|
given(icon) ? /* @__PURE__ */ jsx("span", { className: "crewlet-modal__icon", "aria-hidden": "true", children: icon }) : null,
|
|
106
118
|
/* @__PURE__ */ jsxs("div", { className: "crewlet-modal__heading", children: [
|
|
107
119
|
given(title) ? /* @__PURE__ */ jsx(
|
|
@@ -163,6 +175,7 @@ function ModalFrame({
|
|
|
163
175
|
"crewlet-modal-overlay",
|
|
164
176
|
`crewlet-modal-overlay--${variant}`,
|
|
165
177
|
`crewlet-modal-overlay--${place}`,
|
|
178
|
+
backdrop === "clear" && "crewlet-modal-overlay--clear",
|
|
166
179
|
// Fixed against the window, absolute inside a LayerHost: a fullscreen
|
|
167
180
|
// container paints only its own subtree, so a surface drawn there
|
|
168
181
|
// covers the container rather than a viewport it cannot reach.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConfirmModal } from './chunk-2TZATTIU.js';
|
|
2
1
|
import { InlineCode } from './chunk-5CLW2CXT.js';
|
|
2
|
+
import { ConfirmModal } from './chunk-7IJARUIF.js';
|
|
3
3
|
import { Callout } from './chunk-SVSCLHHI.js';
|
|
4
4
|
import './LinkInterstitial-ET4MSVSV.css';
|
|
5
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Switch } from './chunk-A722MUNR.js';
|
|
2
|
+
import { useReorder } from './chunk-XJ2QEBMM.js';
|
|
3
|
+
import { Checkbox } from './chunk-I6NZKJGK.js';
|
|
4
|
+
import { IconButton } from './chunk-4FQT6ZAY.js';
|
|
5
|
+
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
6
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
7
|
+
import './ArrangeList-NNRTDFI5.css';
|
|
8
|
+
import { GripVerticalGlyph, ChevronUpGlyph, ChevronDownGlyph } from '@crewlethq/icons/glyphs';
|
|
9
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var DEFAULT_ARRANGE_LABELS = {
|
|
12
|
+
handle: (name) => `Move ${name}`,
|
|
13
|
+
hint: "Drag to move, or press the up or down arrow key.",
|
|
14
|
+
moved: (name, position, total) => `${name} moved to position ${position} of ${total}.`,
|
|
15
|
+
moveUp: (name) => `Move ${name} up`,
|
|
16
|
+
moveDown: (name) => `Move ${name} down`,
|
|
17
|
+
atTop: (name) => `${name} is first.`,
|
|
18
|
+
atBottom: (name) => `${name} is last.`
|
|
19
|
+
};
|
|
20
|
+
function ArrangeList({
|
|
21
|
+
label,
|
|
22
|
+
items,
|
|
23
|
+
onReorder,
|
|
24
|
+
onShownChange,
|
|
25
|
+
toggle = "switch",
|
|
26
|
+
moveButtons = true,
|
|
27
|
+
labels: overrides,
|
|
28
|
+
className
|
|
29
|
+
}) {
|
|
30
|
+
const labels = { ...DEFAULT_ARRANGE_LABELS, ...overrides };
|
|
31
|
+
const byKey = new Map(items.map((item) => [item.key, item]));
|
|
32
|
+
const nameOf = (key) => byKey.get(key)?.label ?? key;
|
|
33
|
+
const reorder = useReorder({
|
|
34
|
+
keys: items.map((item) => item.key),
|
|
35
|
+
onReorder,
|
|
36
|
+
nameOf,
|
|
37
|
+
labels
|
|
38
|
+
});
|
|
39
|
+
const last = reorder.order.length - 1;
|
|
40
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { id: reorder.hintId, children: reorder.hint }),
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
"ul",
|
|
44
|
+
{
|
|
45
|
+
className: cx("crewlet-arrange-list", className),
|
|
46
|
+
"aria-label": label,
|
|
47
|
+
...reorder.containerProps,
|
|
48
|
+
children: reorder.order.map((key, index) => {
|
|
49
|
+
const item = byKey.get(key);
|
|
50
|
+
if (!item) return null;
|
|
51
|
+
const { "aria-label": handleName, ...handle } = reorder.handleProps(key);
|
|
52
|
+
const fixed = item.fixed !== void 0 && item.shown ? item.fixed : void 0;
|
|
53
|
+
const Toggle = toggle === "switch" ? Switch : Checkbox;
|
|
54
|
+
return /* @__PURE__ */ jsxs(
|
|
55
|
+
"li",
|
|
56
|
+
{
|
|
57
|
+
className: cx("crewlet-arrange-list__item", !item.shown && "is-off"),
|
|
58
|
+
...reorder.itemProps(key),
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
IconButton,
|
|
62
|
+
{
|
|
63
|
+
size: "sm",
|
|
64
|
+
variant: "ghost",
|
|
65
|
+
className: "crewlet-arrange-list__handle",
|
|
66
|
+
label: handleName,
|
|
67
|
+
icon: /* @__PURE__ */ jsx(GripVerticalGlyph, { size: "md" }),
|
|
68
|
+
...handle
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
Toggle,
|
|
73
|
+
{
|
|
74
|
+
className: "crewlet-arrange-list__toggle",
|
|
75
|
+
label: item.icon ? /* @__PURE__ */ jsxs("span", { className: "crewlet-arrange-list__label", children: [
|
|
76
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-arrange-list__icon", "aria-hidden": "true", children: item.icon }),
|
|
77
|
+
item.label
|
|
78
|
+
] }) : item.label,
|
|
79
|
+
description: fixed ?? item.description,
|
|
80
|
+
checked: item.shown,
|
|
81
|
+
...fixed ? { "aria-disabled": true } : {},
|
|
82
|
+
onChange: (event) => {
|
|
83
|
+
if (fixed) {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
onShownChange(key, event.target.checked);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
item.trailing ? /* @__PURE__ */ jsx("span", { className: "crewlet-arrange-list__trailing", children: item.trailing }) : null,
|
|
92
|
+
moveButtons ? /* @__PURE__ */ jsxs("span", { className: "crewlet-arrange-list__moves", children: [
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
IconButton,
|
|
95
|
+
{
|
|
96
|
+
size: "sm",
|
|
97
|
+
variant: "ghost",
|
|
98
|
+
label: labels.moveUp(item.label),
|
|
99
|
+
icon: /* @__PURE__ */ jsx(ChevronUpGlyph, { size: "sm" }),
|
|
100
|
+
...index === 0 ? { disabledReason: labels.atTop(item.label) } : {},
|
|
101
|
+
onClick: () => reorder.move(key, -1)
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
IconButton,
|
|
106
|
+
{
|
|
107
|
+
size: "sm",
|
|
108
|
+
variant: "ghost",
|
|
109
|
+
label: labels.moveDown(item.label),
|
|
110
|
+
icon: /* @__PURE__ */ jsx(ChevronDownGlyph, { size: "sm" }),
|
|
111
|
+
...index === last ? { disabledReason: labels.atBottom(item.label) } : {},
|
|
112
|
+
onClick: () => reorder.move(key, 1)
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] }) : null
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
key
|
|
119
|
+
);
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { ArrangeList, DEFAULT_ARRANGE_LABELS };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Menu } from './chunk-
|
|
2
|
-
import { Modal } from './chunk-2TZATTIU.js';
|
|
3
|
-
import { Checkbox } from './chunk-75CLJNDQ.js';
|
|
1
|
+
import { Menu } from './chunk-JULMZNGT.js';
|
|
4
2
|
import { useClipboard } from './chunk-STJ7QBC3.js';
|
|
3
|
+
import { Modal } from './chunk-7IJARUIF.js';
|
|
5
4
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
6
|
-
import {
|
|
5
|
+
import { Checkbox } from './chunk-I6NZKJGK.js';
|
|
7
6
|
import { EmptyValue } from './chunk-EUCC37WY.js';
|
|
8
7
|
import { useCardHeaderSlot } from './chunk-AV2DXAEL.js';
|
|
8
|
+
import { IconButton } from './chunk-4FQT6ZAY.js';
|
|
9
9
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
10
10
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
11
11
|
import './DataTable-WZK3V62B.css';
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
2
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
+
import './DiffView-RVLIHTKG.css';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var DIFF_VIEW_LABELS = {
|
|
7
|
+
skipped: (count) => count === 1 ? "1 unchanged line" : `${count.toLocaleString()} unchanged lines`,
|
|
8
|
+
added: "Added",
|
|
9
|
+
removed: "Removed",
|
|
10
|
+
region: "Line changes"
|
|
11
|
+
};
|
|
12
|
+
function DiffView({ sections, labels: overrides, className, "aria-label": ariaLabel, ...rest }) {
|
|
13
|
+
const labels = overrides ? { ...DIFF_VIEW_LABELS, ...overrides } : DIFF_VIEW_LABELS;
|
|
14
|
+
return /* @__PURE__ */ jsx("div", { ...rest, role: "group", "aria-label": ariaLabel ?? labels.region, className: cx("crewlet-diff-view", className), children: sections.map((section, s) => (
|
|
15
|
+
// A section has no identity of its own: a diff is computed whole, so
|
|
16
|
+
// its position is what tells two sections apart.
|
|
17
|
+
/* @__PURE__ */ jsxs("div", { className: "crewlet-diff-view__section", children: [
|
|
18
|
+
section.skipped > 0 && /* @__PURE__ */ jsx("div", { className: "crewlet-diff-view__skip", children: labels.skipped(section.skipped) }),
|
|
19
|
+
section.lines.map((line, i) => (
|
|
20
|
+
// THE CLASS NAMES ARE LITERALS, never assembled from the value: a
|
|
21
|
+
// stylesheet gate that cannot see a class cannot tell a rule this
|
|
22
|
+
// file relies on from one nothing uses.
|
|
23
|
+
/* @__PURE__ */ jsxs(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: cx(
|
|
27
|
+
"crewlet-diff-view__line",
|
|
28
|
+
line.kind === "add" && "crewlet-diff-view__line--add",
|
|
29
|
+
line.kind === "remove" && "crewlet-diff-view__line--remove"
|
|
30
|
+
),
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-diff-view__number", "aria-hidden": "true", children: line.before ?? "" }),
|
|
33
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-diff-view__number", "aria-hidden": "true", children: line.after ?? "" }),
|
|
34
|
+
/* @__PURE__ */ jsxs("span", { className: "crewlet-diff-view__mark", children: [
|
|
35
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: line.kind === "add" ? "+" : line.kind === "remove" ? "\u2212" : " " }),
|
|
36
|
+
line.kind === "add" && /* @__PURE__ */ jsx(VisuallyHidden, { children: labels.added }),
|
|
37
|
+
line.kind === "remove" && /* @__PURE__ */ jsx(VisuallyHidden, { children: labels.removed })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-diff-view__text", children: line.text || " " })
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
i
|
|
43
|
+
)
|
|
44
|
+
))
|
|
45
|
+
] }, s)
|
|
46
|
+
)) });
|
|
47
|
+
}
|
|
48
|
+
var DIFF_SUMMARY_LABELS = {
|
|
49
|
+
spoken: (added, removed) => `${added === 1 ? "1 line" : `${added.toLocaleString()} lines`} added, ${removed.toLocaleString()} removed`,
|
|
50
|
+
against: (what) => `against ${what}`
|
|
51
|
+
};
|
|
52
|
+
function DiffSummary({ added, removed, against, labels: overrides, className, ...rest }) {
|
|
53
|
+
const labels = overrides ? { ...DIFF_SUMMARY_LABELS, ...overrides } : DIFF_SUMMARY_LABELS;
|
|
54
|
+
return /* @__PURE__ */ jsxs("p", { ...rest, className: cx("crewlet-diff-summary", className), children: [
|
|
55
|
+
/* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
|
|
56
|
+
/* @__PURE__ */ jsxs("span", { className: "crewlet-diff-summary__added", children: [
|
|
57
|
+
"+",
|
|
58
|
+
added.toLocaleString()
|
|
59
|
+
] }),
|
|
60
|
+
" ",
|
|
61
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-diff-summary__removed", children: `\u2212${removed.toLocaleString()}` })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: labels.spoken(added, removed) }),
|
|
64
|
+
against !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
+
" ",
|
|
66
|
+
labels.against(against)
|
|
67
|
+
] })
|
|
68
|
+
] });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/DiffView/diff.ts
|
|
72
|
+
var MAX_DIFF_LINES = 2e3;
|
|
73
|
+
function splitLines(text) {
|
|
74
|
+
const normalised = (text ?? "").replace(/\r\n?/g, "\n");
|
|
75
|
+
if (normalised === "") return [];
|
|
76
|
+
return normalised.replace(/\n$/, "").split("\n");
|
|
77
|
+
}
|
|
78
|
+
function diffLines(before, after) {
|
|
79
|
+
const a = splitLines(before);
|
|
80
|
+
const b = splitLines(after);
|
|
81
|
+
if (a.length > MAX_DIFF_LINES || b.length > MAX_DIFF_LINES) {
|
|
82
|
+
return [
|
|
83
|
+
...a.map((text, i) => ({ kind: "remove", text, before: i + 1, after: null })),
|
|
84
|
+
...b.map((text, i) => ({ kind: "add", text, before: null, after: i + 1 }))
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
return walk(a, b, common(a, b));
|
|
88
|
+
}
|
|
89
|
+
function diffStat(diff) {
|
|
90
|
+
let added = 0;
|
|
91
|
+
let removed = 0;
|
|
92
|
+
for (const line of diff) {
|
|
93
|
+
if (line.kind === "add") added++;
|
|
94
|
+
if (line.kind === "remove") removed++;
|
|
95
|
+
}
|
|
96
|
+
return { added, removed, identical: added === 0 && removed === 0 };
|
|
97
|
+
}
|
|
98
|
+
function collapseDiff(diff, context = 3) {
|
|
99
|
+
const keep = new Array(diff.length).fill(false);
|
|
100
|
+
diff.forEach((line, i) => {
|
|
101
|
+
if (line.kind === "same") return;
|
|
102
|
+
for (let k = Math.max(0, i - context); k <= Math.min(diff.length - 1, i + context); k++) {
|
|
103
|
+
keep[k] = true;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
const out = [];
|
|
107
|
+
let skipped = 0;
|
|
108
|
+
let current = null;
|
|
109
|
+
diff.forEach((line, i) => {
|
|
110
|
+
if (keep[i]) {
|
|
111
|
+
if (!current) {
|
|
112
|
+
current = [];
|
|
113
|
+
out.push({ lines: current, skipped });
|
|
114
|
+
skipped = 0;
|
|
115
|
+
}
|
|
116
|
+
current.push(line);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
skipped++;
|
|
120
|
+
current = null;
|
|
121
|
+
});
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
function firstChangedLines(sections, max) {
|
|
125
|
+
const out = [];
|
|
126
|
+
let shown = 0;
|
|
127
|
+
let more = 0;
|
|
128
|
+
for (const section of sections) {
|
|
129
|
+
const kept = [];
|
|
130
|
+
for (const line of section.lines) {
|
|
131
|
+
const changed = line.kind !== "same";
|
|
132
|
+
if (shown >= max) {
|
|
133
|
+
if (changed) more++;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (changed) shown++;
|
|
137
|
+
kept.push(line);
|
|
138
|
+
}
|
|
139
|
+
if (kept.length > 0) out.push({ lines: kept, skipped: section.skipped });
|
|
140
|
+
}
|
|
141
|
+
return { sections: out, more };
|
|
142
|
+
}
|
|
143
|
+
function common(a, b) {
|
|
144
|
+
const table = [];
|
|
145
|
+
for (let i = 0; i <= a.length; i++) table.push(new Uint32Array(b.length + 1));
|
|
146
|
+
for (let i = a.length - 1; i >= 0; i--) {
|
|
147
|
+
const row = table[i];
|
|
148
|
+
const next = table[i + 1];
|
|
149
|
+
for (let j = b.length - 1; j >= 0; j--) {
|
|
150
|
+
row[j] = a[i] === b[j] ? next[j + 1] + 1 : Math.max(next[j], row[j + 1]);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return table;
|
|
154
|
+
}
|
|
155
|
+
function walk(a, b, table) {
|
|
156
|
+
const out = [];
|
|
157
|
+
let i = 0;
|
|
158
|
+
let j = 0;
|
|
159
|
+
while (i < a.length && j < b.length) {
|
|
160
|
+
if (a[i] === b[j]) {
|
|
161
|
+
out.push({ kind: "same", text: a[i], before: i + 1, after: j + 1 });
|
|
162
|
+
i++;
|
|
163
|
+
j++;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
const down = table[i + 1][j];
|
|
167
|
+
const right = table[i][j + 1];
|
|
168
|
+
if (down >= right) {
|
|
169
|
+
out.push({ kind: "remove", text: a[i], before: i + 1, after: null });
|
|
170
|
+
i++;
|
|
171
|
+
} else {
|
|
172
|
+
out.push({ kind: "add", text: b[j], before: null, after: j + 1 });
|
|
173
|
+
j++;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
while (i < a.length) {
|
|
177
|
+
out.push({ kind: "remove", text: a[i], before: i + 1, after: null });
|
|
178
|
+
i++;
|
|
179
|
+
}
|
|
180
|
+
while (j < b.length) {
|
|
181
|
+
out.push({ kind: "add", text: b[j], before: null, after: j + 1 });
|
|
182
|
+
j++;
|
|
183
|
+
}
|
|
184
|
+
return out;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export { DIFF_SUMMARY_LABELS, DIFF_VIEW_LABELS, DiffSummary, DiffView, MAX_DIFF_LINES, collapseDiff, diffLines, diffStat, firstChangedLines, splitLines };
|