@crewlethq/ui 0.4.3 → 0.5.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 +888 -24
- package/dist/Accordion/index.js +2 -2
- package/dist/AddPill/index.js +1 -1
- package/dist/{AddPill-DFWXYLIQ.css → AddPill-IJQYCY6C.css} +9 -0
- package/dist/AppShell/AppShell.d.ts +26 -5
- package/dist/AppShell/index.js +3 -3
- package/dist/{AppShell-NVE6LHNI.css → AppShell-XARELGIH.css} +178 -25
- package/dist/Avatar/Avatar.d.ts +85 -40
- package/dist/Avatar/AvatarStack.d.ts +76 -0
- package/dist/Avatar/index.d.ts +5 -2
- package/dist/Avatar/index.js +1 -1
- package/dist/Avatar-XID7Z74C.css +200 -0
- package/dist/AvatarStack-GEJBNV7E.css +72 -0
- package/dist/BrandLockup/index.js +1 -1
- package/dist/{BrandLockup-6ISDEHPJ.css → BrandLockup-JKGXFCZF.css} +25 -19
- package/dist/Button/Button.d.ts +7 -2
- package/dist/Button/index.js +1 -1
- package/dist/{Button-D4J6B4MA.css → Button-X4B2TJAQ.css} +50 -19
- package/dist/Callout/index.js +1 -1
- package/dist/Canvas/index.js +4 -4
- package/dist/Card/Card.d.ts +9 -5
- package/dist/Card/index.js +1 -1
- package/dist/{Card-RLR254LD.css → Card-GLP7SUV6.css} +25 -18
- package/dist/Charts/BarList.d.ts +18 -1
- package/dist/Charts/ChartTooltip.d.ts +68 -0
- package/dist/Charts/StackedBar.d.ts +25 -7
- package/dist/Charts/StackedColumns.d.ts +112 -0
- package/dist/Charts/TimeSeries.d.ts +33 -2
- package/dist/Charts/dataColor.d.ts +22 -14
- package/dist/Charts/index.d.ts +6 -0
- package/dist/Charts/index.js +1 -1
- package/dist/Charts/useChartHover.d.ts +56 -0
- package/dist/Charts-B3YEF7R4.css +742 -0
- package/dist/Checkbox/index.js +1 -1
- package/dist/{Checkbox-VGW26YLQ.css → Checkbox-BOXQ747I.css} +2 -2
- package/dist/CodeBlock/index.js +4 -4
- package/dist/Combobox/index.js +5 -5
- package/dist/CommandPalette/CommandPalette.d.ts +97 -6
- package/dist/CommandPalette/index.d.ts +1 -1
- package/dist/CommandPalette/index.js +9 -7
- package/dist/CommandPalette-C5AMKGN2.css +259 -0
- package/dist/Copyable/index.js +3 -3
- package/dist/DataTable/index.js +7 -7
- package/dist/{DataTable-ITNACQ2X.css → DataTable-OLHPF7D4.css} +44 -43
- package/dist/DataView/index.js +14 -14
- package/dist/{DataView-256YF32J.css → DataView-N6JX464S.css} +5 -4
- package/dist/DateTimePicker/index.js +5 -5
- package/dist/DiffList/index.js +1 -1
- package/dist/Disclosure/index.js +2 -2
- package/dist/EntityChip/EntityChip.d.ts +9 -12
- package/dist/EntityChip/index.d.ts +1 -1
- package/dist/EntityChip/index.js +2 -2
- package/dist/ErrorBoundary/index.js +2 -2
- package/dist/{ErrorBoundary-ME36CQTA.css → ErrorBoundary-U2PA3LY2.css} +4 -4
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton-VQGNMJDI.css → IconButton-TVEUWK6L.css} +2 -2
- package/dist/ImageUpload/ImageUpload.d.ts +10 -7
- package/dist/ImageUpload/index.js +2 -2
- package/dist/{ImageUpload-HKFIZR6D.css → ImageUpload-YCHJMUGX.css} +24 -10
- package/dist/Input/index.js +2 -2
- package/dist/Kbd/Kbd.d.ts +14 -4
- package/dist/Kbd/index.js +1 -1
- package/dist/Kbd-JPLDVJIP.css +71 -0
- package/dist/Layer/index.js +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/List/index.js +1 -1
- package/dist/{List-XTHESXLR.css → List-MYJIV6MP.css} +12 -2
- package/dist/ListInput/index.js +5 -5
- package/dist/Listbox/index.js +2 -2
- package/dist/Listbox/useListbox.d.ts +16 -0
- package/dist/Listbox/useOptionKeys.d.ts +12 -1
- package/dist/{Listbox-X2DOTSQA.css → Listbox-6WJNJQVQ.css} +60 -7
- package/dist/Menu/index.js +4 -4
- package/dist/{Menu-6DE7I66I.css → Menu-BT5PMFJI.css} +15 -0
- package/dist/Meter/Meter.d.ts +103 -16
- package/dist/Meter/index.d.ts +2 -2
- package/dist/Meter/index.js +1 -1
- package/dist/{Meter-SKOOXQBC.css → Meter-5VCSFMZW.css} +46 -7
- package/dist/Modal/index.js +4 -4
- package/dist/{Modal-XYQJ4BL6.css → Modal-JAYBS2KS.css} +13 -4
- package/dist/OrgLabel/OrgLabel.d.ts +60 -24
- package/dist/OrgLabel/index.d.ts +1 -1
- package/dist/OrgLabel/index.js +2 -1
- package/dist/{OrgLabel-D7U6QJZD.css → OrgLabel-CR233G34.css} +9 -18
- package/dist/OrgNode/index.js +3 -2
- package/dist/OrgTable/OrgTable.d.ts +2 -2
- package/dist/OrgTable/index.js +8 -7
- package/dist/Popover/index.js +2 -2
- package/dist/PricingCard/index.js +3 -3
- package/dist/{PricingCard-JFI7RYXP.css → PricingCard-7EFXRSD2.css} +4 -5
- package/dist/SearchTrigger/SearchTrigger.d.ts +23 -4
- package/dist/SearchTrigger/index.d.ts +1 -1
- package/dist/SearchTrigger/index.js +1 -1
- package/dist/SearchTrigger-Z5D4AAY7.css +112 -0
- package/dist/SegmentedControl/index.js +2 -2
- package/dist/SegmentedMeter/SegmentedMeter.d.ts +107 -0
- package/dist/SegmentedMeter/index.d.ts +3 -0
- package/dist/SegmentedMeter/index.js +2 -0
- package/dist/SegmentedMeter-KQNML2TW.css +109 -0
- package/dist/Select/index.js +3 -3
- package/dist/{Select-2X77FSWR.css → Select-E24U5LBC.css} +34 -0
- package/dist/Shortcut/index.js +2 -2
- package/dist/SidebarNav/SidebarNav.d.ts +85 -25
- package/dist/SidebarNav/index.d.ts +1 -1
- package/dist/SidebarNav/index.js +1 -1
- package/dist/SidebarNav-X5NLZNWA.css +424 -0
- package/dist/StatCard/StatCard.d.ts +59 -12
- package/dist/StatCard/index.d.ts +1 -1
- package/dist/StatCard/index.js +1 -1
- package/dist/StatCard-KPAFD4E2.css +204 -0
- package/dist/StatGroup/index.js +1 -1
- package/dist/{StatGroup-TGB6AEKM.css → StatGroup-HVG6O62W.css} +8 -9
- package/dist/StatusDot/StatusDot.d.ts +24 -6
- package/dist/StatusDot/index.js +1 -1
- package/dist/StatusDot-7OMCQCZF.css +186 -0
- package/dist/Stepper/Stepper.d.ts +78 -0
- package/dist/Stepper/index.d.ts +3 -0
- package/dist/Stepper/index.js +4 -0
- package/dist/Stepper-HW4JM3YH.css +176 -0
- package/dist/Table/index.js +1 -1
- package/dist/{Table-MDOLVUAW.css → Table-TGCS4C3F.css} +14 -4
- package/dist/Tabs/index.js +1 -1
- package/dist/{Tabs-VLICJFVB.css → Tabs-XCNPHA7B.css} +79 -27
- package/dist/Tag/Tag.d.ts +29 -22
- package/dist/Tag/index.js +2 -2
- package/dist/{Tag-VNZEYLB6.css → Tag-GBE7LQJP.css} +82 -83
- package/dist/TagsInput/index.js +6 -6
- package/dist/ThemeSwitcher/ThemeSwitcher.d.ts +53 -21
- package/dist/ThemeSwitcher/index.d.ts +3 -3
- package/dist/ThemeSwitcher/index.js +4 -3
- package/dist/ThemeSwitcher/preferences.d.ts +19 -5
- package/dist/ThemeToggle/ThemeToggle.d.ts +40 -0
- package/dist/ThemeToggle/index.d.ts +2 -0
- package/dist/ThemeToggle/index.js +5 -0
- package/dist/TimeWindowPicker/index.js +8 -8
- package/dist/Toaster/index.js +2 -2
- package/dist/Toolbar/index.js +2 -2
- package/dist/{Toolbar-IP6LXN45.css → Toolbar-HUOSMNTH.css} +3 -1
- package/dist/Tooltip/index.js +2 -2
- package/dist/Tree/index.d.ts +2 -2
- package/dist/Tree/index.js +1 -1
- package/dist/Tree/layout.d.ts +103 -28
- package/dist/TreeCanvas/TreeCanvas.d.ts +60 -14
- package/dist/TreeCanvas/index.d.ts +1 -1
- package/dist/TreeCanvas/index.js +6 -6
- package/dist/TreeCanvas/motion.d.ts +3 -2
- package/dist/{TreeCanvas-WBNQPHC7.css → TreeCanvas-HVOV4SQN.css} +154 -30
- package/dist/TreeGrid/index.js +4 -4
- package/dist/{chunk-F6OE5FH3.js → chunk-2FPENTCF.js} +1 -1
- package/dist/chunk-4AK52VHB.js +88 -0
- package/dist/{chunk-7EM5T4ME.js → chunk-4IQD3HUQ.js} +2 -2
- package/dist/{chunk-YODNNSZL.js → chunk-4PZ6FJKW.js} +43 -13
- package/dist/{chunk-F27EPQ7D.js → chunk-4UQ7SMPK.js} +1 -1
- package/dist/chunk-5QWIJSQM.js +73 -0
- package/dist/{chunk-GTOUGQQK.js → chunk-6MU7HNB4.js} +13 -10
- package/dist/{chunk-S2XHHEW4.js → chunk-74KMX7YH.js} +4 -4
- package/dist/{chunk-WNI2WSJF.js → chunk-7KBNFFM3.js} +1 -1
- package/dist/{chunk-DD5BBGBE.js → chunk-AUS5FNQE.js} +9 -5
- package/dist/{chunk-CMEE37QJ.js → chunk-BMYPGGPV.js} +4 -4
- package/dist/{chunk-H4FBTAYS.js → chunk-BNCCEER3.js} +8 -8
- package/dist/chunk-C5WJUZVR.js +56 -0
- package/dist/{chunk-5WS6L6FA.js → chunk-CAIHUYXV.js} +9 -9
- package/dist/{chunk-XV6WRMBC.js → chunk-CQY5NTRS.js} +4 -1
- package/dist/{chunk-UOGSZKLT.js → chunk-D6EVJUGU.js} +2 -2
- package/dist/{chunk-6ZFVFA56.js → chunk-DHPUMOTX.js} +2 -2
- package/dist/{chunk-HZ5XZNPS.js → chunk-DS2C73RJ.js} +3 -3
- package/dist/{chunk-O6232G37.js → chunk-DSUY5F4E.js} +17 -5
- package/dist/{chunk-Q4ZPPART.js → chunk-EFYPAJT3.js} +3 -3
- package/dist/{chunk-WQX73TWF.js → chunk-ERVO6OUF.js} +18 -17
- package/dist/{chunk-BZYDZBAN.js → chunk-ETYEBKR4.js} +3 -3
- package/dist/{chunk-34VGEDVV.js → chunk-FD5UEN6X.js} +30 -30
- package/dist/{chunk-5SDBMKUO.js → chunk-FIFNP6PL.js} +3 -3
- package/dist/{chunk-7HPRF5XN.js → chunk-FUF52K7E.js} +98 -16
- package/dist/{chunk-5KPQ6D7N.js → chunk-FZVJDJFN.js} +2 -2
- package/dist/chunk-IA232OTU.js +156 -0
- package/dist/{chunk-2EOKFKHX.js → chunk-IG27QX7Q.js} +7 -7
- package/dist/chunk-IKB6HFGK.js +55 -0
- package/dist/{chunk-FBZAKNSX.js → chunk-IPVQKAHO.js} +10 -7
- package/dist/{chunk-3EYF6HKB.js → chunk-IVFJD7WY.js} +28 -9
- package/dist/{chunk-WOYYD2YR.js → chunk-JGRNTBF2.js} +11 -11
- package/dist/chunk-K3OWD7BJ.js +121 -0
- package/dist/{chunk-BJSKPEZI.js → chunk-KD4H66L6.js} +7 -20
- package/dist/{chunk-SFZOKW2G.js → chunk-KJ34ZBBI.js} +8 -3
- package/dist/{chunk-HQNHV7D6.js → chunk-LFHCXZO5.js} +6 -6
- package/dist/{chunk-LWKJQTOM.js → chunk-MICH6QSJ.js} +1 -1
- package/dist/chunk-N3DPO6HG.js +226 -0
- package/dist/{chunk-S4GZWSKR.js → chunk-OM5E3TTK.js} +1 -1
- package/dist/{chunk-3QRYCPXQ.js → chunk-OPKIKM35.js} +6 -6
- package/dist/{chunk-5EKIWVOR.js → chunk-PGRPNDWM.js} +2 -2
- package/dist/{chunk-LFJ6UJTI.js → chunk-PQNILU27.js} +9 -9
- package/dist/{chunk-QNCVHRZL.js → chunk-QVAFL2LE.js} +1 -1
- package/dist/{chunk-QEUY3A5P.js → chunk-QY7UU5ZB.js} +3 -2
- package/dist/{chunk-ITHXJHBB.js → chunk-R25RGPUB.js} +1 -0
- package/dist/{chunk-KLJCCMF3.js → chunk-R6735B37.js} +2 -2
- package/dist/{chunk-3ZP55QZE.js → chunk-R6FBDTP3.js} +4 -4
- package/dist/{chunk-7FZ53WDJ.js → chunk-RIAZM6L3.js} +1 -1
- package/dist/chunk-RJM4QCGG.js +550 -0
- package/dist/{chunk-NTRZGNEX.js → chunk-S3BCVWTU.js} +215 -46
- package/dist/chunk-S7KW47IQ.js +121 -0
- package/dist/{chunk-OFHBK7RI.js → chunk-SJQ546ID.js} +34 -14
- package/dist/{chunk-D35VTV2Z.js → chunk-SV7QAONL.js} +1 -1
- package/dist/{chunk-IAJLHVUA.js → chunk-TIWAHZZ6.js} +1 -1
- package/dist/{chunk-2PRH365R.js → chunk-UA7O3KKJ.js} +1 -1
- package/dist/{chunk-NPZY6YYL.js → chunk-UG5ZMAXW.js} +6 -6
- package/dist/{chunk-FEFTGVMF.js → chunk-V2N3BMOT.js} +7 -2
- package/dist/{chunk-NDCATSW7.js → chunk-V34H2YCY.js} +1 -1
- package/dist/chunk-WIATRXEJ.js +22 -0
- package/dist/{chunk-5C5YMZQU.js → chunk-WOFOMTGB.js} +16 -10
- package/dist/{chunk-QYOFACSP.js → chunk-WSOFKOLP.js} +3 -3
- package/dist/{chunk-MNAXYY3R.js → chunk-WUVZDFHS.js} +31 -11
- package/dist/{chunk-UG46QBLT.js → chunk-YIMOT5OO.js} +10 -10
- package/dist/{chunk-2ZQMA2WB.js → chunk-ZPSOF6VL.js} +2 -2
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.js +66 -62
- package/dist/index.js +66 -62
- package/dist/styles.css +2719 -799
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/tone.d.ts +7 -12
- package/package.json +4 -4
- package/scripts/check-css-literals.mjs +159 -23
- package/scripts/check-css-variables.mjs +5 -3
- package/scripts/css-source.mjs +97 -5
- package/dist/Avatar-P2KRQM2B.css +0 -156
- package/dist/Charts-D7G2BSXH.css +0 -277
- package/dist/CommandPalette-CSJDUCQA.css +0 -115
- package/dist/Kbd-W66MXQI5.css +0 -61
- package/dist/SearchTrigger-QXOYAUUY.css +0 -79
- package/dist/SidebarNav-QGSFKZYA.css +0 -319
- package/dist/StatCard-KYPKZUWX.css +0 -111
- package/dist/StatusDot-HA2L2FSX.css +0 -84
- package/dist/chunk-22O7LAW2.js +0 -41
- package/dist/chunk-2HQR4U4D.js +0 -143
- package/dist/chunk-ESCO4XYW.js +0 -144
- package/dist/chunk-F4PJZ4ED.js +0 -245
- package/dist/chunk-PNFASD6F.js +0 -98
- package/dist/chunk-PZSWF74H.js +0 -15
- /package/dist/{chunk-ZCR6YGQ4.js → chunk-PKIN4IMB.js} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
2
|
+
import './SegmentedMeter-KQNML2TW.css';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function settle(difference, scale) {
|
|
6
|
+
if (Math.abs(difference) <= scale * 1e-12) return 0;
|
|
7
|
+
return Number(difference.toPrecision(12));
|
|
8
|
+
}
|
|
9
|
+
function checked(segments, total) {
|
|
10
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11
|
+
for (const segment of segments) {
|
|
12
|
+
if (seen.has(segment.id)) {
|
|
13
|
+
throw new RangeError(`SegmentedMeter segment ids must be unique; "${segment.id}" is used twice`);
|
|
14
|
+
}
|
|
15
|
+
seen.add(segment.id);
|
|
16
|
+
if (!Number.isFinite(segment.value) || segment.value < 0) {
|
|
17
|
+
throw new RangeError(
|
|
18
|
+
`SegmentedMeter segment "${segment.id}" must be a finite count of at least 0; it was ${segment.value}`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (total !== void 0 && (!Number.isFinite(total) || total < 0)) {
|
|
23
|
+
throw new RangeError(`SegmentedMeter total must be a finite count of at least 0; it was ${total}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function measure(segments, total) {
|
|
27
|
+
const sum = segments.reduce((running, segment) => running + segment.value, 0);
|
|
28
|
+
const whole = total ?? sum;
|
|
29
|
+
const scale = Math.max(whole, sum);
|
|
30
|
+
const remainder = Math.max(0, settle(whole - sum, scale));
|
|
31
|
+
return { whole, scale, remainder };
|
|
32
|
+
}
|
|
33
|
+
function segmentedMeterLabel(segments, total, remainderLabel) {
|
|
34
|
+
checked(segments, total);
|
|
35
|
+
const { whole, remainder } = measure(segments, total);
|
|
36
|
+
const words = segments.filter((segment) => segment.value > 0).map((segment) => `${segment.value} ${segment.label}`);
|
|
37
|
+
if (remainder > 0 && remainderLabel !== void 0) words.push(`${remainder} ${remainderLabel}`);
|
|
38
|
+
return `${words.length === 0 ? "0" : words.join(", ")} of ${whole}`;
|
|
39
|
+
}
|
|
40
|
+
function SegmentedMeter({
|
|
41
|
+
segments,
|
|
42
|
+
total,
|
|
43
|
+
remainderLabel,
|
|
44
|
+
size = "default",
|
|
45
|
+
label,
|
|
46
|
+
decorative = false,
|
|
47
|
+
className,
|
|
48
|
+
style,
|
|
49
|
+
...rest
|
|
50
|
+
}) {
|
|
51
|
+
checked(segments, total);
|
|
52
|
+
const { scale, remainder } = measure(segments, total);
|
|
53
|
+
const parts = segments.filter((segment) => segment.value > 0);
|
|
54
|
+
const share = (value) => `${value / scale * 100}%`;
|
|
55
|
+
const leftover = scale === 0 ? "100%" : remainder > 0 ? share(remainder) : null;
|
|
56
|
+
const drawn = parts.length + (leftover === null ? 0 : 1);
|
|
57
|
+
return /* @__PURE__ */ jsxs(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
...rest,
|
|
61
|
+
className: cx("crewlet-segmented-meter", `crewlet-segmented-meter--${size}`, className),
|
|
62
|
+
style: { "--crewlet-segmented-meter-count": drawn, ...style },
|
|
63
|
+
role: decorative ? void 0 : "img",
|
|
64
|
+
"aria-label": decorative ? void 0 : label ?? segmentedMeterLabel(segments, total, remainderLabel),
|
|
65
|
+
"aria-hidden": decorative ? true : void 0,
|
|
66
|
+
children: [
|
|
67
|
+
parts.map((segment) => /* @__PURE__ */ jsx(
|
|
68
|
+
"span",
|
|
69
|
+
{
|
|
70
|
+
className: "crewlet-segmented-meter__segment",
|
|
71
|
+
"data-tone": segment.tone,
|
|
72
|
+
style: { flexBasis: share(segment.value) }
|
|
73
|
+
},
|
|
74
|
+
segment.id
|
|
75
|
+
)),
|
|
76
|
+
leftover === null ? null : /* @__PURE__ */ jsx(
|
|
77
|
+
"span",
|
|
78
|
+
{
|
|
79
|
+
className: "crewlet-segmented-meter__segment crewlet-segmented-meter__remainder",
|
|
80
|
+
style: { flexBasis: leftover }
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { SegmentedMeter, segmentedMeterLabel };
|
|
@@ -1,29 +1,58 @@
|
|
|
1
1
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
2
2
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
-
import './Meter-
|
|
3
|
+
import './Meter-5VCSFMZW.css';
|
|
4
4
|
import { useId } from 'react';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
+
var METER_STATES = Object.freeze(["ok", "near", "refusing"]);
|
|
8
|
+
var DEFAULT_METER_THRESHOLDS = Object.freeze({ near: 0.75 });
|
|
9
|
+
var STATE_TONES = {
|
|
10
|
+
ok: "quantity",
|
|
11
|
+
near: "warning",
|
|
12
|
+
refusing: "danger"
|
|
13
|
+
};
|
|
14
|
+
function meterStateTone(state) {
|
|
15
|
+
if (!Object.hasOwn(STATE_TONES, state)) {
|
|
16
|
+
throw new RangeError(`Meter state must be one of ${METER_STATES.join(", ")}; it was ${String(state)}`);
|
|
17
|
+
}
|
|
18
|
+
return STATE_TONES[state];
|
|
19
|
+
}
|
|
20
|
+
function meterState(fraction, thresholds = DEFAULT_METER_THRESHOLDS) {
|
|
21
|
+
const { near } = thresholds;
|
|
22
|
+
if (!Number.isFinite(near) || near <= 0 || near > 1) {
|
|
23
|
+
throw new RangeError(`Meter thresholds.near must be a fraction of the limit above 0 and at most 1; it was ${near}`);
|
|
24
|
+
}
|
|
25
|
+
if (fraction >= 1) return "refusing";
|
|
26
|
+
if (fraction >= near) return "near";
|
|
27
|
+
return "ok";
|
|
28
|
+
}
|
|
7
29
|
function meterTone(percent) {
|
|
8
|
-
|
|
9
|
-
if (percent >= 75) return "warning";
|
|
10
|
-
return "brand";
|
|
30
|
+
return meterStateTone(meterState(percent / 100));
|
|
11
31
|
}
|
|
12
32
|
function progressTone(percent) {
|
|
13
|
-
return percent >= 100 ? "success" : "
|
|
33
|
+
return percent >= 100 ? "success" : "quantity";
|
|
34
|
+
}
|
|
35
|
+
function drawnTone({
|
|
36
|
+
state,
|
|
37
|
+
tone,
|
|
38
|
+
polarity = "spent",
|
|
39
|
+
thresholds
|
|
40
|
+
}, fraction, percent) {
|
|
41
|
+
if (state !== void 0) return meterStateTone(state);
|
|
42
|
+
if (tone !== void 0) return tone;
|
|
43
|
+
if (polarity === "progress") return progressTone(percent);
|
|
44
|
+
return meterStateTone(meterState(fraction, thresholds));
|
|
14
45
|
}
|
|
15
|
-
var RAMPS = {
|
|
16
|
-
spent: meterTone,
|
|
17
|
-
progress: progressTone
|
|
18
|
-
};
|
|
19
46
|
function Meter({
|
|
20
47
|
value,
|
|
21
48
|
max,
|
|
22
49
|
label,
|
|
23
50
|
valueText,
|
|
24
51
|
hint,
|
|
52
|
+
state,
|
|
25
53
|
tone,
|
|
26
|
-
polarity
|
|
54
|
+
polarity,
|
|
55
|
+
thresholds,
|
|
27
56
|
size = "default",
|
|
28
57
|
hideLabel = false,
|
|
29
58
|
className,
|
|
@@ -31,8 +60,9 @@ function Meter({
|
|
|
31
60
|
}) {
|
|
32
61
|
const labelId = useId();
|
|
33
62
|
const bounded = max > 0;
|
|
34
|
-
const
|
|
35
|
-
const
|
|
63
|
+
const fraction = bounded ? value / max : 0;
|
|
64
|
+
const percent = bounded ? Math.min(100, Math.max(0, fraction * 100)) : 0;
|
|
65
|
+
const drawn = drawnTone({ state, tone, polarity, thresholds }, fraction, percent);
|
|
36
66
|
const trailing = hint ?? valueText;
|
|
37
67
|
const reported = bounded ? Math.min(max, Math.max(0, value)) : value;
|
|
38
68
|
const spoken = bounded ? valueText ?? (reported === value ? void 0 : `${value} of ${max}`) : void 0;
|
|
@@ -60,4 +90,4 @@ function Meter({
|
|
|
60
90
|
] });
|
|
61
91
|
}
|
|
62
92
|
|
|
63
|
-
export { Meter, meterTone, progressTone };
|
|
93
|
+
export { DEFAULT_METER_THRESHOLDS, METER_STATES, Meter, meterState, meterStateTone, meterTone, progressTone };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
2
2
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
-
import './IconButton-
|
|
3
|
+
import './IconButton-TVEUWK6L.css';
|
|
4
4
|
import { forwardRef, useId, Children, isValidElement, cloneElement } from 'react';
|
|
5
5
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { StatusDot } from './chunk-WIATRXEJ.js';
|
|
2
|
+
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
3
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
4
|
+
import './Stepper-HW4JM3YH.css';
|
|
5
|
+
import { CheckGlyph } from '@crewlethq/icons/glyphs';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function Stepper({
|
|
9
|
+
steps,
|
|
10
|
+
current,
|
|
11
|
+
label,
|
|
12
|
+
tone = "info",
|
|
13
|
+
pulse = false,
|
|
14
|
+
doneLabel = "Done",
|
|
15
|
+
className,
|
|
16
|
+
...rest
|
|
17
|
+
}) {
|
|
18
|
+
const seen = /* @__PURE__ */ new Set();
|
|
19
|
+
for (const step of steps) {
|
|
20
|
+
if (seen.has(step.id)) throw new RangeError(`Stepper step ids must be unique; "${step.id}" is used twice`);
|
|
21
|
+
seen.add(step.id);
|
|
22
|
+
}
|
|
23
|
+
const at = current === null ? steps.length : steps.findIndex((step) => step.id === current);
|
|
24
|
+
if (at < 0) {
|
|
25
|
+
throw new RangeError(
|
|
26
|
+
`Stepper current must be the id of one of its steps, or null once every step is done; "${current}" is not one of ${steps.map((step) => `"${step.id}"`).join(", ")}`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
if (steps.length === 0) return null;
|
|
30
|
+
const stateOf = (index) => index < at ? "done" : index === at ? "current" : "later";
|
|
31
|
+
return (
|
|
32
|
+
/*
|
|
33
|
+
* `role="list"` although an `ol` already has one, which is why the lint
|
|
34
|
+
* rule that calls it redundant is silenced here rather than obeyed, as
|
|
35
|
+
* `Legend` and `DiffList` silence it: the stylesheet takes the markers off,
|
|
36
|
+
* and WebKit answers a marker-less list as a group of paragraphs, so a
|
|
37
|
+
* reader would no longer be told how many steps there are before hearing
|
|
38
|
+
* them. The role puts that back.
|
|
39
|
+
*/
|
|
40
|
+
// eslint-disable-next-line jsx-a11y/no-redundant-roles
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
"ol",
|
|
43
|
+
{
|
|
44
|
+
...rest,
|
|
45
|
+
role: "list",
|
|
46
|
+
className: cx("crewlet-stepper", `crewlet-stepper--${tone}`, className),
|
|
47
|
+
"aria-label": label,
|
|
48
|
+
children: steps.map((step, index) => {
|
|
49
|
+
const state = stateOf(index);
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
"li",
|
|
52
|
+
{
|
|
53
|
+
className: cx("crewlet-stepper__step", `crewlet-stepper__step--${state}`),
|
|
54
|
+
"aria-current": state === "current" ? "step" : void 0,
|
|
55
|
+
children: /* @__PURE__ */ jsxs("span", { className: "crewlet-stepper__chip", children: [
|
|
56
|
+
state === "done" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
|
+
/* @__PURE__ */ jsx(CheckGlyph, { size: "xs", className: "crewlet-stepper__check" }),
|
|
58
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: doneLabel }),
|
|
59
|
+
" "
|
|
60
|
+
] }) : null,
|
|
61
|
+
state === "current" ? /* @__PURE__ */ jsx(StatusDot, { tone, pulse, className: "crewlet-stepper__dot" }) : null,
|
|
62
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-stepper__label", children: step.label })
|
|
63
|
+
] })
|
|
64
|
+
},
|
|
65
|
+
step.id
|
|
66
|
+
);
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { Stepper };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { usePopupLayer, isComposing } from './chunk-
|
|
2
|
-
import './Listbox-
|
|
1
|
+
import { usePopupLayer, isComposing } from './chunk-R25RGPUB.js';
|
|
2
|
+
import './Listbox-6WJNJQVQ.css';
|
|
3
3
|
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
function useListbox({
|
|
@@ -12,7 +12,7 @@ function useListbox({
|
|
|
12
12
|
popup = true
|
|
13
13
|
}) {
|
|
14
14
|
const [at, setAt] = useState(0);
|
|
15
|
-
const active = count === 0 ? -1 : Math.min(Math.max(at,
|
|
15
|
+
const active = count === 0 ? -1 : Math.min(Math.max(at, -1), count - 1);
|
|
16
16
|
const listId = `${id}-listbox`;
|
|
17
17
|
const layer = usePopupLayer({ open: open && popup, onDismiss: () => onClose() });
|
|
18
18
|
const list = useRef(null);
|
|
@@ -25,13 +25,13 @@ function useListbox({
|
|
|
25
25
|
);
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
const box = list.current;
|
|
28
|
-
const row =
|
|
29
|
-
if (!box || !row) return;
|
|
28
|
+
const row = active >= 0 ? document.getElementById(`${listId}-${active}`) : null;
|
|
29
|
+
if (!box || !row || !box.contains(row)) return;
|
|
30
30
|
const bounds = box.getBoundingClientRect();
|
|
31
31
|
const spot = row.getBoundingClientRect();
|
|
32
32
|
if (spot.top < bounds.top) box.scrollTop -= bounds.top - spot.top;
|
|
33
33
|
else if (spot.bottom > bounds.bottom) box.scrollTop += spot.bottom - bounds.bottom;
|
|
34
|
-
}, [active, count, open]);
|
|
34
|
+
}, [active, count, open, listId]);
|
|
35
35
|
function onKeyDown(event) {
|
|
36
36
|
if (!open || isComposing(event)) return false;
|
|
37
37
|
if (event.key === "Escape") {
|
|
@@ -52,6 +52,7 @@ function useListbox({
|
|
|
52
52
|
setAt((active - 1 + count) % count);
|
|
53
53
|
return true;
|
|
54
54
|
case "Enter":
|
|
55
|
+
if (event.metaKey || event.ctrlKey || event.altKey) return false;
|
|
55
56
|
event.preventDefault();
|
|
56
57
|
onCommit(active);
|
|
57
58
|
return true;
|
|
@@ -69,6 +70,7 @@ function useListbox({
|
|
|
69
70
|
setActive: setAt,
|
|
70
71
|
listId,
|
|
71
72
|
listRef,
|
|
73
|
+
panelRef: layer.panelRef,
|
|
72
74
|
anchorRef: layer.insideRef,
|
|
73
75
|
optionId: (index) => `${listId}-${index}`,
|
|
74
76
|
onKeyDown,
|
|
@@ -82,7 +84,7 @@ function useListbox({
|
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
86
|
var TYPE_AHEAD_WINDOW = 500;
|
|
85
|
-
function useOptionKeys({ listbox, count, disabled, textOf }) {
|
|
87
|
+
function useOptionKeys({ listbox, count, disabled, textOf, ends = true }) {
|
|
86
88
|
const typed = useRef({ text: "", at: 0 });
|
|
87
89
|
const { active, setActive } = listbox;
|
|
88
90
|
const step = useCallback(
|
|
@@ -96,7 +98,7 @@ function useOptionKeys({ listbox, count, disabled, textOf }) {
|
|
|
96
98
|
},
|
|
97
99
|
[count, disabled]
|
|
98
100
|
);
|
|
99
|
-
const opening = useCallback((chosen) => chosen >= 0 && !disabled?.(chosen) ? chosen :
|
|
101
|
+
const opening = useCallback((chosen) => chosen >= 0 && !disabled?.(chosen) ? chosen : step(0, 1), [disabled, step]);
|
|
100
102
|
const typeAhead = useCallback(
|
|
101
103
|
(key) => {
|
|
102
104
|
if (!textOf) return false;
|
|
@@ -118,6 +120,7 @@ function useOptionKeys({ listbox, count, disabled, textOf }) {
|
|
|
118
120
|
);
|
|
119
121
|
const onKeyDown = useCallback(
|
|
120
122
|
(event) => {
|
|
123
|
+
if (isComposing(event)) return false;
|
|
121
124
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
122
125
|
event.preventDefault();
|
|
123
126
|
const by = event.key === "ArrowDown" ? 1 : -1;
|
|
@@ -125,7 +128,7 @@ function useOptionKeys({ listbox, count, disabled, textOf }) {
|
|
|
125
128
|
if (next >= 0) setActive(next);
|
|
126
129
|
return true;
|
|
127
130
|
}
|
|
128
|
-
if (event.key === "Home" || event.key === "End") {
|
|
131
|
+
if (ends && (event.key === "Home" || event.key === "End")) {
|
|
129
132
|
event.preventDefault();
|
|
130
133
|
const next = event.key === "Home" ? step(0, 1) : step(count - 1, -1);
|
|
131
134
|
if (next >= 0) setActive(next);
|
|
@@ -139,7 +142,7 @@ function useOptionKeys({ listbox, count, disabled, textOf }) {
|
|
|
139
142
|
}
|
|
140
143
|
return false;
|
|
141
144
|
},
|
|
142
|
-
[active, count, setActive, step, typeAhead]
|
|
145
|
+
[active, count, ends, setActive, step, typeAhead]
|
|
143
146
|
);
|
|
144
147
|
return { onKeyDown, step, opening };
|
|
145
148
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { StatusDot } from './chunk-
|
|
1
|
+
import { StatusDot } from './chunk-WIATRXEJ.js';
|
|
2
2
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
-
import './Tag-
|
|
4
|
-
import {
|
|
3
|
+
import './Tag-GBE7LQJP.css';
|
|
4
|
+
import { XGlyph } from '@crewlethq/icons/glyphs';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
function Tag(props) {
|
|
@@ -63,7 +63,7 @@ function Tag(props) {
|
|
|
63
63
|
onRemove();
|
|
64
64
|
},
|
|
65
65
|
"aria-label": removeAriaLabel,
|
|
66
|
-
children: /* @__PURE__ */ jsx(
|
|
66
|
+
children: /* @__PURE__ */ jsx(XGlyph, { size: "xs" })
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
69
|
if (split) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useLayerContainer, viewportBounds, LAYER_GAP, outsideBounds, placePopup, LAYER_REPOSITION_EVENT } from './chunk-7RPGY3JE.js';
|
|
2
|
-
import { usePopupLayer, focusables } from './chunk-
|
|
2
|
+
import { usePopupLayer, focusables } from './chunk-R25RGPUB.js';
|
|
3
3
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
4
4
|
import './Popover-WJGCF3ZQ.css';
|
|
5
5
|
import { useId, useState, useRef, useCallback, useLayoutEffect, useEffect, cloneElement } from 'react';
|
|
@@ -50,10 +50,10 @@ function Popover({
|
|
|
50
50
|
const inHost = container !== document.body;
|
|
51
51
|
const host = inHost ? container.getBoundingClientRect() : viewportBounds();
|
|
52
52
|
const rect = at.getBoundingClientRect();
|
|
53
|
+
box.style.width = width === "match" ? `${rect.width}px` : "";
|
|
53
54
|
const own = box.getBoundingClientRect();
|
|
54
|
-
const panelWidth = width === "match" ? rect.width : own.width;
|
|
55
55
|
const local = {
|
|
56
|
-
x: (align === "end" ? rect.right -
|
|
56
|
+
x: (align === "end" ? rect.right - own.width : rect.left) - (inHost ? host.x : 0),
|
|
57
57
|
y: rect.top - (inHost ? host.y : 0),
|
|
58
58
|
width: rect.width,
|
|
59
59
|
height: rect.height
|
|
@@ -69,15 +69,16 @@ function Popover({
|
|
|
69
69
|
close("anchor-gone");
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
+
const asked = width === "match" ? rect.width : void 0;
|
|
72
73
|
const spot = placePopup(
|
|
73
74
|
local,
|
|
74
|
-
{ width:
|
|
75
|
+
{ width: own.width, height: own.height },
|
|
75
76
|
bounds,
|
|
76
77
|
LAYER_GAP,
|
|
77
78
|
side === "top" ? "above" : "below"
|
|
78
79
|
);
|
|
79
80
|
setPlace(
|
|
80
|
-
(was) => was && was.left === spot.left && was.top === spot.top && was.side === spot.side && was.width ===
|
|
81
|
+
(was) => was && was.left === spot.left && was.top === spot.top && was.side === spot.side && was.width === asked ? was : { left: spot.left, top: spot.top, side: spot.side, width: asked }
|
|
81
82
|
);
|
|
82
83
|
}, [align, close, container, side, width]);
|
|
83
84
|
useLayoutEffect(() => {
|
|
@@ -87,10 +88,13 @@ function Popover({
|
|
|
87
88
|
container?.addEventListener(LAYER_REPOSITION_EVENT, onLayout);
|
|
88
89
|
window.addEventListener("resize", onLayout);
|
|
89
90
|
window.addEventListener("scroll", onLayout, true);
|
|
91
|
+
const resize = typeof ResizeObserver === "function" ? new ResizeObserver(onLayout) : null;
|
|
92
|
+
if (panel.current) resize?.observe(panel.current);
|
|
90
93
|
return () => {
|
|
91
94
|
container?.removeEventListener(LAYER_REPOSITION_EVENT, onLayout);
|
|
92
95
|
window.removeEventListener("resize", onLayout);
|
|
93
96
|
window.removeEventListener("scroll", onLayout, true);
|
|
97
|
+
resize?.disconnect();
|
|
94
98
|
};
|
|
95
99
|
}, [open, container, position]);
|
|
96
100
|
useEffect(() => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { LayerNodeBridge } from './chunk-53DVJCVW.js';
|
|
2
2
|
import { LAYER_REPOSITION_EVENT, LayerHost } from './chunk-7RPGY3JE.js';
|
|
3
|
-
import { IconButton } from './chunk-
|
|
4
|
-
import { Button } from './chunk-
|
|
3
|
+
import { IconButton } from './chunk-4UQ7SMPK.js';
|
|
4
|
+
import { Button } from './chunk-ETYEBKR4.js';
|
|
5
5
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
6
6
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
7
7
|
import './Canvas-Q6JETCWR.css';
|
|
8
8
|
import { useId, useRef, useState, useCallback, useLayoutEffect, useImperativeHandle, useEffect } from 'react';
|
|
9
|
-
import { ZoomOutGlyph, ZoomInGlyph,
|
|
9
|
+
import { ZoomOutGlyph, ZoomInGlyph, FullscreenGlyph } from '@crewlethq/icons/glyphs';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
12
|
// src/Canvas/geometry.ts
|
|
@@ -528,7 +528,7 @@ function Canvas({
|
|
|
528
528
|
{
|
|
529
529
|
size: "sm",
|
|
530
530
|
label: text.fit,
|
|
531
|
-
icon: /* @__PURE__ */ jsx(
|
|
531
|
+
icon: /* @__PURE__ */ jsx(FullscreenGlyph, {}),
|
|
532
532
|
onClick: () => content && apply(fitView(content, sizeNow.current), "near"),
|
|
533
533
|
disabled: !ready
|
|
534
534
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { TreeGrid } from './chunk-
|
|
2
|
-
import { createTreeModel } from './chunk-
|
|
3
|
-
import { OrgLabel } from './chunk-
|
|
4
|
-
import { AddPill } from './chunk-
|
|
5
|
-
import { IconButton } from './chunk-
|
|
1
|
+
import { TreeGrid } from './chunk-FIFNP6PL.js';
|
|
2
|
+
import { createTreeModel } from './chunk-S3BCVWTU.js';
|
|
3
|
+
import { OrgLabel } from './chunk-WOFOMTGB.js';
|
|
4
|
+
import { AddPill } from './chunk-OM5E3TTK.js';
|
|
5
|
+
import { IconButton } from './chunk-4UQ7SMPK.js';
|
|
6
6
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
7
7
|
import './OrgTable-VWMFC3TB.css';
|
|
8
8
|
import { useMemo, useRef, useImperativeHandle, useCallback } from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { ChevronDownGlyph, ChevronUpGlyph } from '@crewlethq/icons/glyphs';
|
|
10
10
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
12
|
var LABELS = {
|
|
@@ -69,7 +69,7 @@ function OrgTable({
|
|
|
69
69
|
size: "sm",
|
|
70
70
|
label: text.expandAll,
|
|
71
71
|
title: text.expandAll,
|
|
72
|
-
icon: /* @__PURE__ */ jsx(
|
|
72
|
+
icon: /* @__PURE__ */ jsx(ChevronDownGlyph, {}),
|
|
73
73
|
onClick: () => grid.current?.expandAll()
|
|
74
74
|
}
|
|
75
75
|
),
|
|
@@ -79,7 +79,7 @@ function OrgTable({
|
|
|
79
79
|
size: "sm",
|
|
80
80
|
label: text.collapseAll,
|
|
81
81
|
title: text.collapseAll,
|
|
82
|
-
icon: /* @__PURE__ */ jsx(
|
|
82
|
+
icon: /* @__PURE__ */ jsx(ChevronUpGlyph, {}),
|
|
83
83
|
onClick: () => grid.current?.collapseAll()
|
|
84
84
|
}
|
|
85
85
|
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useThemePreference, useSystemTheme, resolveTheme } from './chunk-K3OWD7BJ.js';
|
|
2
|
+
import { IconButton } from './chunk-4UQ7SMPK.js';
|
|
3
|
+
import { SunGlyph, MoonGlyph } from '@crewlethq/icons/glyphs';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function ThemeToggle(props) {
|
|
7
|
+
if (props.value !== void 0) {
|
|
8
|
+
const { storageKey: _none, ...controlled } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(ToggleButton, { ...controlled });
|
|
10
|
+
}
|
|
11
|
+
const { value: _stored, storageKey = "crewlet_theme", ...button } = props;
|
|
12
|
+
return /* @__PURE__ */ jsx(StoredThemeToggle, { ...button, storageKey });
|
|
13
|
+
}
|
|
14
|
+
function StoredThemeToggle({
|
|
15
|
+
storageKey,
|
|
16
|
+
onChange,
|
|
17
|
+
...button
|
|
18
|
+
}) {
|
|
19
|
+
const [theme, choose] = useThemePreference({ storageKey });
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
ToggleButton,
|
|
22
|
+
{
|
|
23
|
+
...button,
|
|
24
|
+
value: theme,
|
|
25
|
+
onChange: (next) => {
|
|
26
|
+
choose(next);
|
|
27
|
+
onChange?.(next);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function ToggleButton({
|
|
33
|
+
value,
|
|
34
|
+
onChange,
|
|
35
|
+
toLightLabel = "Switch to the light theme",
|
|
36
|
+
toDarkLabel = "Switch to the dark theme",
|
|
37
|
+
size = "sm",
|
|
38
|
+
variant = "ghost",
|
|
39
|
+
className
|
|
40
|
+
}) {
|
|
41
|
+
const system = useSystemTheme();
|
|
42
|
+
const next = resolveTheme(value, system) === "dark" ? "light" : "dark";
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
IconButton,
|
|
45
|
+
{
|
|
46
|
+
label: next === "light" ? toLightLabel : toDarkLabel,
|
|
47
|
+
icon: next === "light" ? /* @__PURE__ */ jsx(SunGlyph, {}) : /* @__PURE__ */ jsx(MoonGlyph, {}),
|
|
48
|
+
size,
|
|
49
|
+
variant,
|
|
50
|
+
className,
|
|
51
|
+
onClick: () => onChange(next)
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { ThemeToggle };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import './ImageUpload-
|
|
1
|
+
import { avatarCorner, Avatar } from './chunk-IA232OTU.js';
|
|
2
|
+
import './ImageUpload-YCHJMUGX.css';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { CameraGlyph, XGlyph } from '@crewlethq/icons/glyphs';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
var ImageUpload = ({
|
|
8
8
|
src,
|
|
9
9
|
name,
|
|
10
10
|
size = 64,
|
|
11
|
-
|
|
11
|
+
kind = "agent",
|
|
12
12
|
readOnly = false,
|
|
13
13
|
uploading = false,
|
|
14
14
|
accept = "image/*",
|
|
@@ -41,7 +41,7 @@ var ImageUpload = ({
|
|
|
41
41
|
const empty = !src && !readOnly;
|
|
42
42
|
const wrapperClasses = [
|
|
43
43
|
"crewlet-image-upload",
|
|
44
|
-
`crewlet-image-upload--${
|
|
44
|
+
`crewlet-image-upload--${kind}`,
|
|
45
45
|
uploading ? "is-uploading" : "",
|
|
46
46
|
empty ? "is-empty" : "",
|
|
47
47
|
className
|
|
@@ -54,7 +54,7 @@ var ImageUpload = ({
|
|
|
54
54
|
* showed the badge's corners through the overlay at every size but the one
|
|
55
55
|
* the step was chosen for.
|
|
56
56
|
*/
|
|
57
|
-
"--crewlet-image-upload-corner":
|
|
57
|
+
"--crewlet-image-upload-corner": `${avatarCorner(size)}px`,
|
|
58
58
|
...style
|
|
59
59
|
};
|
|
60
60
|
const triggerLabel = uploading ? "Uploading image" : src ? "Change image" : "Upload image";
|
|
@@ -69,9 +69,9 @@ var ImageUpload = ({
|
|
|
69
69
|
"aria-label": triggerLabel,
|
|
70
70
|
"aria-busy": uploading,
|
|
71
71
|
children: [
|
|
72
|
-
/* @__PURE__ */ jsx(Avatar, { src, name, size,
|
|
72
|
+
/* @__PURE__ */ jsx(Avatar, { src, name, size, kind }),
|
|
73
73
|
!readOnly ? /* @__PURE__ */ jsx("span", { className: "crewlet-image-upload__overlay", "aria-hidden": true, children: uploading ? /* @__PURE__ */ jsx("span", { className: "crewlet-image-upload__spinner" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
-
/* @__PURE__ */ jsx(
|
|
74
|
+
/* @__PURE__ */ jsx(CameraGlyph, { size: "lg" }),
|
|
75
75
|
/* @__PURE__ */ jsx("span", { className: "crewlet-image-upload__overlay-text", children: src ? "Change" : "Upload" })
|
|
76
76
|
] }) }) : null
|
|
77
77
|
]
|
|
@@ -85,7 +85,7 @@ var ImageUpload = ({
|
|
|
85
85
|
onClick: handleRemove,
|
|
86
86
|
disabled: uploading,
|
|
87
87
|
"aria-label": "Remove image",
|
|
88
|
-
children: /* @__PURE__ */ jsx(
|
|
88
|
+
children: /* @__PURE__ */ jsx(XGlyph, { size: "sm" })
|
|
89
89
|
}
|
|
90
90
|
) : null,
|
|
91
91
|
!readOnly ? (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useLayerContainer, viewportBounds, LAYER_GAP, outsideBounds, placePopup, LAYER_REPOSITION_EVENT } from './chunk-7RPGY3JE.js';
|
|
2
|
-
import { usePopupLayer } from './chunk-
|
|
2
|
+
import { usePopupLayer } from './chunk-R25RGPUB.js';
|
|
3
3
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
4
4
|
import './Tooltip-LKQF7CE4.css';
|
|
5
5
|
import { useId, useState, useRef, useCallback, useEffect, useLayoutEffect, cloneElement } from 'react';
|
|
@@ -123,10 +123,13 @@ function Tooltip({
|
|
|
123
123
|
container?.addEventListener(LAYER_REPOSITION_EVENT, onLayout);
|
|
124
124
|
window.addEventListener("resize", onLayout);
|
|
125
125
|
window.addEventListener("scroll", onLayout, true);
|
|
126
|
+
const resize = typeof ResizeObserver === "function" ? new ResizeObserver(onLayout) : null;
|
|
127
|
+
if (panel.current) resize?.observe(panel.current);
|
|
126
128
|
return () => {
|
|
127
129
|
container?.removeEventListener(LAYER_REPOSITION_EVENT, onLayout);
|
|
128
130
|
window.removeEventListener("resize", onLayout);
|
|
129
131
|
window.removeEventListener("scroll", onLayout, true);
|
|
132
|
+
resize?.disconnect();
|
|
130
133
|
};
|
|
131
134
|
}, [open, container, position]);
|
|
132
135
|
useEffect(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useListbox } from './chunk-
|
|
2
|
-
import { Input } from './chunk-
|
|
1
|
+
import { useListbox } from './chunk-6MU7HNB4.js';
|
|
2
|
+
import { Input } from './chunk-DSUY5F4E.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,8 +1,8 @@
|
|
|
1
|
-
import { useRoving, tabStop, tabId } from './chunk-
|
|
1
|
+
import { useRoving, tabStop, tabId } from './chunk-QY7UU5ZB.js';
|
|
2
2
|
import { Count } from './chunk-BHHIIK3M.js';
|
|
3
3
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
4
4
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
5
|
-
import './Tabs-
|
|
5
|
+
import './Tabs-XCNPHA7B.css';
|
|
6
6
|
import './SegmentedControl-X3BI3XU4.css';
|
|
7
7
|
import { useId } from 'react';
|
|
8
8
|
import { jsxs, jsx } from 'react/jsx-runtime';
|