@crewlethq/ui 0.48.3 → 0.49.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 +56 -0
- package/dist/AgentHandoffPanel/index.js +3 -3
- package/dist/ArrangeList/index.js +2 -2
- package/dist/ArtifactBar/index.js +4 -4
- package/dist/{ArtifactBar-6PGWGKN2.css → ArtifactBar-UMZCTARR.css} +9 -0
- package/dist/ArtifactCard/ArtifactCard.d.ts +30 -1
- package/dist/ArtifactCard/index.js +10 -3
- package/dist/{ArtifactCard-OGTMO2KI.css → ArtifactCard-SOB63NV5.css} +72 -1
- package/dist/ArtifactCover/index.js +2 -2
- package/dist/ArtifactIcon/index.js +2 -2
- package/dist/ArtifactKindGlyph/ArtifactKindGlyph.d.ts +7 -3
- package/dist/ArtifactKindGlyph/index.js +1 -1
- package/dist/ArtifactKindIllustration/ArtifactKindIllustration.d.ts +4 -3
- package/dist/ArtifactKindIllustration/index.js +1 -1
- package/dist/{ArtifactKinds-CVD3FCYO.css → ArtifactKinds-O3CALPVX.css} +1 -0
- package/dist/ArtifactMakeRow/index.js +2 -2
- package/dist/ArtifactNameCell/ArtifactNameCell.d.ts +14 -1
- package/dist/ArtifactNameCell/index.d.ts +1 -1
- package/dist/ArtifactNameCell/index.js +2 -2
- package/dist/{ArtifactNameCell-RTVP4LO4.css → ArtifactNameCell-3AHLUSE5.css} +12 -0
- package/dist/BrandChip/BrandChip.d.ts +26 -0
- package/dist/BrandChip/index.d.ts +3 -0
- package/dist/BrandChip/index.js +2 -0
- package/dist/BrandChip-SQWBC2WU.css +81 -0
- package/dist/BrandSample/BrandSample.d.ts +75 -0
- package/dist/BrandSample/index.d.ts +3 -0
- package/dist/BrandSample/index.js +5 -0
- package/dist/BrandSample-G5V7GKR2.css +185 -0
- package/dist/BrandScope/BrandScope.d.ts +61 -0
- package/dist/BrandScope/index.d.ts +4 -0
- package/dist/BrandScope/index.js +4 -0
- package/dist/BrandScope-H2KZHGT7.css +29 -0
- package/dist/Checkbox/Checkbox.d.ts +8 -0
- package/dist/Checkbox/index.js +1 -1
- package/dist/{Checkbox-ALWG3WV2.css → Checkbox-MB22OW6P.css} +18 -0
- package/dist/ColorField/ColorField.d.ts +63 -0
- package/dist/ColorField/index.d.ts +3 -0
- package/dist/ColorField/index.js +11 -0
- package/dist/ColorField-2OIOWT3Z.css +68 -0
- package/dist/ColorSwatch/ColorSwatch.d.ts +43 -0
- package/dist/ColorSwatch/index.d.ts +3 -0
- package/dist/ColorSwatch/index.js +9 -0
- package/dist/ColorSwatch-DNMUFHNS.css +83 -0
- package/dist/Combobox/Combobox.d.ts +45 -4
- package/dist/Combobox/index.d.ts +1 -1
- package/dist/Combobox/index.js +1 -1
- package/dist/Combobox-GBCWXWEB.css +163 -0
- package/dist/CommandPalette/index.js +3 -3
- package/dist/CommentThread/index.js +3 -3
- package/dist/Composer/index.js +2 -2
- package/dist/ContrastBadge/ContrastBadge.d.ts +63 -0
- package/dist/ContrastBadge/index.d.ts +3 -0
- package/dist/ContrastBadge/index.js +6 -0
- package/dist/ContrastBadge-CBZPGG3G.css +47 -0
- package/dist/DataGrid/DataGrid.d.ts +28 -1
- package/dist/DataGrid/index.js +8 -1
- package/dist/{DataGrid-AQKPJD7W.css → DataGrid-VNGQESJA.css} +15 -0
- package/dist/DataTable/index.js +3 -3
- package/dist/DataView/index.js +8 -8
- package/dist/DateTimePicker/index.js +2 -2
- package/dist/FolderTile/FolderTile.d.ts +91 -0
- package/dist/FolderTile/index.d.ts +3 -0
- package/dist/FolderTile/index.js +7 -0
- package/dist/FolderTile-FDT5Y63Z.css +231 -0
- package/dist/LinkInterstitial/index.js +2 -2
- package/dist/ListInput/index.js +2 -2
- package/dist/LogoSlot/LogoSlot.d.ts +84 -0
- package/dist/LogoSlot/index.d.ts +3 -0
- package/dist/LogoSlot/index.js +9 -0
- package/dist/LogoSlot-T2UFOJXU.css +159 -0
- package/dist/Modal/Modal.d.ts +13 -0
- package/dist/Modal/index.js +1 -1
- package/dist/{Modal-TOEWHDCQ.css → Modal-3HMP7WAZ.css} +30 -0
- package/dist/PresenterView/index.js +2 -2
- package/dist/PrincipalPicker/index.js +2 -2
- package/dist/SelectionBar/SelectionBar.d.ts +50 -0
- package/dist/SelectionBar/index.d.ts +3 -0
- package/dist/SelectionBar/index.js +9 -0
- package/dist/SelectionBar-XPWKUOSC.css +61 -0
- package/dist/ShareDialog/index.js +3 -3
- package/dist/SheetColumnEditor/index.js +3 -3
- package/dist/SheetGrid/index.js +2 -2
- package/dist/Switcher/index.js +2 -2
- package/dist/ThemeGallery/ThemeGallery.d.ts +13 -2
- package/dist/ThemeGallery/index.js +3 -1
- package/dist/{ThemeGallery-X35Y25EX.css → ThemeGallery-UEFZRT6W.css} +21 -0
- package/dist/TimeWindowPicker/index.js +2 -2
- package/dist/TypeSpecimen/TypeSpecimen.d.ts +49 -0
- package/dist/TypeSpecimen/index.d.ts +3 -0
- package/dist/TypeSpecimen/index.js +3 -0
- package/dist/TypeSpecimen-WK6YNHL7.css +96 -0
- package/dist/chunk-5SGHW42B.js +23 -0
- package/dist/{chunk-ILDNJHRU.js → chunk-AVL52EME.js} +1 -1
- package/dist/chunk-B235ANDO.js +66 -0
- package/dist/{chunk-2MYSESZF.js → chunk-FB5CFQTG.js} +82 -12
- package/dist/{chunk-DY4DQ7EB.js → chunk-GP4YWZFO.js} +1 -1
- package/dist/{chunk-LIJQT74Y.js → chunk-H55D66IK.js} +1 -1
- package/dist/{chunk-6EBGPCAW.js → chunk-H7NMJ5AI.js} +1 -1
- package/dist/chunk-ITI2Z44C.js +139 -0
- package/dist/{chunk-P5VGSVWG.js → chunk-J24Q4HTD.js} +17 -8
- package/dist/{chunk-5EBDOE3C.js → chunk-JFDIMO3A.js} +1 -1
- package/dist/chunk-JKAFEFFC.js +44 -0
- package/dist/{chunk-32TGEMQQ.js → chunk-KHZYAEGZ.js} +1 -1
- package/dist/chunk-M4QM477B.js +80 -0
- package/dist/{chunk-TWZEWXNW.js → chunk-MIEBOO7Y.js} +2 -2
- package/dist/{chunk-SMOFYZJ5.js → chunk-NAWUXCBC.js} +3 -3
- package/dist/{chunk-F57N6ZJG.js → chunk-NCHKKYPQ.js} +5 -2
- package/dist/chunk-OCRVY42T.js +50 -0
- package/dist/chunk-OEEYL2CM.js +73 -0
- package/dist/chunk-P3OIM6OC.js +38 -0
- package/dist/{chunk-FWBKMPNR.js → chunk-P3QWT5VR.js} +1 -1
- package/dist/chunk-P5JBDHWC.js +206 -0
- package/dist/{chunk-OKE5YSLD.js → chunk-Q44X36QC.js} +79 -35
- package/dist/{chunk-R2IBCEU6.js → chunk-R3BA3C4Y.js} +2 -2
- package/dist/{chunk-CE2THTQR.js → chunk-RSKW25Y5.js} +4 -3
- package/dist/{chunk-UBZDYOCA.js → chunk-RV6XB5UV.js} +12 -1
- package/dist/{chunk-E4BOVKNJ.js → chunk-UTESMBPL.js} +5 -3
- package/dist/chunk-UZMNR366.js +9 -0
- package/dist/{chunk-CWKWMIIJ.js → chunk-V7GOOXPK.js} +1 -1
- package/dist/{chunk-7JED2NYP.js → chunk-VBIM6HFC.js} +1 -1
- package/dist/{chunk-U4HOKU6P.js → chunk-VN47PYUF.js} +5 -5
- package/dist/{chunk-MUQJCH2Y.js → chunk-VTSJMDGP.js} +2 -2
- package/dist/chunk-W6FOEBIL.js +119 -0
- package/dist/chunk-WLSEAIVC.js +48 -0
- package/dist/{chunk-AS2BMY3E.js → chunk-WQ7S7CKZ.js} +2 -2
- package/dist/{chunk-6AKG2VLR.js → chunk-YCC2S7DF.js} +4 -1
- package/dist/chunk-ZH77BXMA.js +14 -0
- package/dist/generated/index.d.ts +10 -0
- package/dist/generated/index.js +80 -68
- package/dist/index.js +80 -68
- package/dist/styles.css +1414 -85
- package/dist/utils/fontFamily.d.ts +29 -0
- package/dist/utils/hexColour.d.ts +12 -0
- package/package.json +3 -3
- package/scripts/check-css-variables.mjs +18 -2
- package/dist/Combobox-YDONYDTM.css +0 -81
- package/dist/chunk-OOJTPR7N.js +0 -137
- package/dist/{chunk-245IXG5P.js → chunk-3WMOEGEL.js} +0 -0
- package/dist/{chunk-ISDEXIXH.js → chunk-E6HXFFWO.js} +1 -1
- package/dist/{chunk-6R5BSA36.js → chunk-GHY63X4C.js} +1 -1
- package/dist/{chunk-ICVS3U4S.js → chunk-PGR2PKH6.js} +1 -1
- package/dist/{chunk-VKFG4FLE.js → chunk-R6R2UHVG.js} +1 -1
- package/dist/{chunk-OO7QJCJQ.js → chunk-WXOYHVWG.js} +1 -1
- package/dist/{chunk-UFXLNC2N.js → chunk-ZFM5L7M4.js} +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { Checkbox } from './chunk-NCHKKYPQ.js';
|
|
1
2
|
import { EmptyState } from './chunk-PPUR46MK.js';
|
|
2
3
|
import { useMediaMatch } from './chunk-RTPQDNW3.js';
|
|
3
4
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
4
5
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
5
6
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
6
|
-
import './DataGrid-
|
|
7
|
+
import './DataGrid-VNGQESJA.css';
|
|
7
8
|
import { useId, useRef, useState, useMemo, useCallback, useLayoutEffect, useImperativeHandle } from 'react';
|
|
8
9
|
import { breakpoint } from '@crewlethq/tokens';
|
|
9
10
|
import { ChevronDownGlyph, ChevronUpGlyph } from '@crewlethq/icons/glyphs';
|
|
@@ -50,8 +51,10 @@ var LABELS = {
|
|
|
50
51
|
hiddenToFit: (names) => `Hidden to fit: ${names}`,
|
|
51
52
|
loadMore: "Load more",
|
|
52
53
|
showEveryColumn: "Show every column",
|
|
53
|
-
and: "and"
|
|
54
|
+
and: "and",
|
|
55
|
+
selectAll: "Select every row"
|
|
54
56
|
};
|
|
57
|
+
var SELECT_COLUMN = "crewlet-select";
|
|
55
58
|
function parseGridSort(raw) {
|
|
56
59
|
if (!raw) return null;
|
|
57
60
|
return raw.startsWith("-") ? { key: raw.slice(1), desc: true } : { key: raw, desc: false };
|
|
@@ -103,7 +106,7 @@ function overflowing(wrap) {
|
|
|
103
106
|
const inner = wrap.getBoundingClientRect().left + wrap.clientLeft + wrap.clientWidth;
|
|
104
107
|
return last.getBoundingClientRect().right > inner + 0.5;
|
|
105
108
|
}
|
|
106
|
-
function squeezed(wrap, visible) {
|
|
109
|
+
function squeezed(wrap, visible, leading = 0) {
|
|
107
110
|
const heads = wrap.querySelector(":scope > .crewlet-data-grid__head")?.children;
|
|
108
111
|
if (!heads) return false;
|
|
109
112
|
const cap = wrap.clientWidth * SHRINK_SHARE - 1;
|
|
@@ -114,10 +117,10 @@ function squeezed(wrap, visible) {
|
|
|
114
117
|
for (let i = 0; i < visible.length; i++) {
|
|
115
118
|
const column = visible[i];
|
|
116
119
|
if (!column.shrink || column.width) continue;
|
|
117
|
-
const head = heads[i];
|
|
120
|
+
const head = heads[i + leading];
|
|
118
121
|
if (!head || head.getBoundingClientRect().width >= cap) continue;
|
|
119
122
|
for (const row of rows) {
|
|
120
|
-
const cell = row.querySelectorAll(":scope > .crewlet-data-grid__cell")[i];
|
|
123
|
+
const cell = row.querySelectorAll(":scope > .crewlet-data-grid__cell")[i + leading];
|
|
121
124
|
if (cell && cutShort(cell)) return true;
|
|
122
125
|
}
|
|
123
126
|
}
|
|
@@ -145,6 +148,7 @@ function DataGrid({
|
|
|
145
148
|
onRowActivate,
|
|
146
149
|
rowHref,
|
|
147
150
|
isSelected,
|
|
151
|
+
selection,
|
|
148
152
|
isFailed,
|
|
149
153
|
sort: sortRaw = "",
|
|
150
154
|
onSortChange,
|
|
@@ -208,6 +212,70 @@ function DataGrid({
|
|
|
208
212
|
if (bands) return bands.flatMap(walk);
|
|
209
213
|
return sortRows(rows ?? []);
|
|
210
214
|
}, [bands, rows, sortRows]);
|
|
215
|
+
const anchor = useRef(null);
|
|
216
|
+
const pickable = useMemo(
|
|
217
|
+
() => selection ? flat.filter((row) => selection.isSelectable?.(row) ?? true) : [],
|
|
218
|
+
[flat, selection]
|
|
219
|
+
);
|
|
220
|
+
const pickedCount = selection ? pickable.filter((row) => selection.selected.has(rowKey(row))).length : 0;
|
|
221
|
+
const allPicked = pickable.length > 0 && pickedCount === pickable.length;
|
|
222
|
+
const pick = (row, on, range) => {
|
|
223
|
+
if (!selection) return;
|
|
224
|
+
const key = rowKey(row);
|
|
225
|
+
const next = new Set(selection.selected);
|
|
226
|
+
const to = flat.findIndex((r) => rowKey(r) === key);
|
|
227
|
+
const from = range && anchor.current !== null ? flat.findIndex((r) => rowKey(r) === anchor.current) : -1;
|
|
228
|
+
const span = from >= 0 && to >= 0 ? flat.slice(Math.min(from, to), Math.max(from, to) + 1) : [row];
|
|
229
|
+
for (const r of span) {
|
|
230
|
+
if (selection.isSelectable?.(r) === false) continue;
|
|
231
|
+
if (on) next.add(rowKey(r));
|
|
232
|
+
else next.delete(rowKey(r));
|
|
233
|
+
}
|
|
234
|
+
anchor.current = key;
|
|
235
|
+
selection.onChange(next);
|
|
236
|
+
};
|
|
237
|
+
const pickAll = () => {
|
|
238
|
+
if (!selection) return;
|
|
239
|
+
const next = new Set(selection.selected);
|
|
240
|
+
for (const row of pickable) {
|
|
241
|
+
if (allPicked) next.delete(rowKey(row));
|
|
242
|
+
else next.add(rowKey(row));
|
|
243
|
+
}
|
|
244
|
+
anchor.current = null;
|
|
245
|
+
selection.onChange(next);
|
|
246
|
+
};
|
|
247
|
+
const selectColumn = selection ? {
|
|
248
|
+
key: SELECT_COLUMN,
|
|
249
|
+
header: /* @__PURE__ */ jsx(
|
|
250
|
+
Checkbox,
|
|
251
|
+
{
|
|
252
|
+
hideLabel: true,
|
|
253
|
+
label: text.selectAll,
|
|
254
|
+
checked: allPicked,
|
|
255
|
+
indeterminate: pickedCount > 0 && !allPicked,
|
|
256
|
+
disabled: pickable.length === 0,
|
|
257
|
+
onChange: pickAll
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
cell: (row) => (
|
|
261
|
+
// ABOVE THE ROW'S LINK, so the press lands on the box.
|
|
262
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__select", "data-above-row": true, children: /* @__PURE__ */ jsx(
|
|
263
|
+
Checkbox,
|
|
264
|
+
{
|
|
265
|
+
hideLabel: true,
|
|
266
|
+
label: selection.rowLabel(row),
|
|
267
|
+
checked: selection.selected.has(rowKey(row)),
|
|
268
|
+
disabled: selection.isSelectable?.(row) === false,
|
|
269
|
+
onChange: (event) => pick(row, event.target.checked, event.nativeEvent.shiftKey === true)
|
|
270
|
+
}
|
|
271
|
+
) })
|
|
272
|
+
),
|
|
273
|
+
action: true,
|
|
274
|
+
phoneLead: true,
|
|
275
|
+
width: "calc(var(--size-target-min) + var(--spacing-3) * 2)"
|
|
276
|
+
} : null;
|
|
277
|
+
const drawnColumns = selectColumn ? [selectColumn, ...visibleColumns] : visibleColumns;
|
|
278
|
+
const leading = drawnColumns.length - visibleColumns.length;
|
|
211
279
|
const [boxWidth, setBoxWidth] = useState(0);
|
|
212
280
|
useLayoutEffect(() => {
|
|
213
281
|
if (!wrap || typeof ResizeObserver !== "function") return;
|
|
@@ -221,11 +289,11 @@ function DataGrid({
|
|
|
221
289
|
const next = fitGridColumns({
|
|
222
290
|
fit: fit.set === shownKeys ? fit : { ...NO_FIT, set: shownKeys },
|
|
223
291
|
width: el.clientWidth,
|
|
224
|
-
overflows: overflowing(el) || squeezed(el, visibleColumns),
|
|
292
|
+
overflows: overflowing(el) || squeezed(el, visibleColumns, leading),
|
|
225
293
|
visible: visibleColumns
|
|
226
294
|
});
|
|
227
295
|
if (next !== null) setFit(next);
|
|
228
|
-
}, [wrap, phone, fit, shownKeys, visibleColumns, flat, boxWidth]);
|
|
296
|
+
}, [wrap, phone, fit, shownKeys, visibleColumns, leading, flat, boxWidth]);
|
|
229
297
|
useImperativeHandle(
|
|
230
298
|
handleRef,
|
|
231
299
|
() => ({
|
|
@@ -250,7 +318,7 @@ function DataGrid({
|
|
|
250
318
|
else if (sort?.key === column.key && sort.desc) onSortChange("");
|
|
251
319
|
else onSortChange(column.key);
|
|
252
320
|
}
|
|
253
|
-
const template =
|
|
321
|
+
const template = drawnColumns.map((c) => c.width ?? (c.shrink ? `fit-content(${SHRINK_CAP})` : `minmax(${c.floor ?? 0}, 1fr)`)).join(" ");
|
|
254
322
|
if (flat.length === 0 && !bands?.length && empty) {
|
|
255
323
|
return /* @__PURE__ */ jsx("div", { className: cx("crewlet-data-grid", className), "data-flush": flush || void 0, children: /* @__PURE__ */ jsx(
|
|
256
324
|
EmptyState,
|
|
@@ -269,6 +337,7 @@ function DataGrid({
|
|
|
269
337
|
const at = index;
|
|
270
338
|
const link = rowHref?.(row);
|
|
271
339
|
const marked = Boolean(isSelected?.(row));
|
|
340
|
+
const picked = Boolean(selection?.selected.has(rowKey(row)));
|
|
272
341
|
const rowId = `${gridId}-row-${at}`;
|
|
273
342
|
const overlay = link !== void 0 ? (
|
|
274
343
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
@@ -292,7 +361,7 @@ function DataGrid({
|
|
|
292
361
|
onClick: (e) => onRowActivate(row, e)
|
|
293
362
|
}
|
|
294
363
|
) : null;
|
|
295
|
-
const inner =
|
|
364
|
+
const inner = drawnColumns.map((column, i) => /* @__PURE__ */ jsxs(
|
|
296
365
|
"span",
|
|
297
366
|
{
|
|
298
367
|
role: "cell",
|
|
@@ -319,6 +388,7 @@ function DataGrid({
|
|
|
319
388
|
className: cx(
|
|
320
389
|
"crewlet-data-grid__row",
|
|
321
390
|
marked && "crewlet-data-grid__row--selected",
|
|
391
|
+
picked && "crewlet-data-grid__row--picked",
|
|
322
392
|
isFailed?.(row) && "crewlet-data-grid__row--failed",
|
|
323
393
|
cursor === at && "crewlet-data-grid__row--cursor"
|
|
324
394
|
),
|
|
@@ -335,13 +405,13 @@ function DataGrid({
|
|
|
335
405
|
// A BAND IS ROWS OF THE TABLE: its head and its foot are rows of one
|
|
336
406
|
// cell each across every column, and its own box is layout alone.
|
|
337
407
|
/* @__PURE__ */ jsxs("div", { className: "crewlet-data-grid__band", role: "none", children: [
|
|
338
|
-
/* @__PURE__ */ jsx("div", { className: "crewlet-data-grid__band-head", role: "row", children: /* @__PURE__ */ jsxs("span", { className: "crewlet-data-grid__band-cell", role: "rowheader", "aria-colspan":
|
|
408
|
+
/* @__PURE__ */ jsx("div", { className: "crewlet-data-grid__band-head", role: "row", children: /* @__PURE__ */ jsxs("span", { className: "crewlet-data-grid__band-cell", role: "rowheader", "aria-colspan": drawnColumns.length, children: [
|
|
339
409
|
band.mark,
|
|
340
410
|
/* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__truncate", children: band.label }),
|
|
341
411
|
/* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__band-count", children: band.total != null && band.total !== loaded ? `${loaded} of ${band.total}` : loaded })
|
|
342
412
|
] }) }),
|
|
343
413
|
band.bands ? band.bands.map((sub) => renderBand(sub)) : sortRows(band.rows).map(renderRow),
|
|
344
|
-
band.footer && /* @__PURE__ */ jsx("div", { className: "crewlet-data-grid__band-foot", role: "row", children: /* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__band-cell", role: "cell", "aria-colspan":
|
|
414
|
+
band.footer && /* @__PURE__ */ jsx("div", { className: "crewlet-data-grid__band-foot", role: "row", children: /* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__band-cell", role: "cell", "aria-colspan": drawnColumns.length, children: band.footer }) })
|
|
345
415
|
] }, band.key)
|
|
346
416
|
);
|
|
347
417
|
}
|
|
@@ -358,7 +428,7 @@ function DataGrid({
|
|
|
358
428
|
style: { gridTemplateColumns: template },
|
|
359
429
|
onPointerDown,
|
|
360
430
|
children: [
|
|
361
|
-
/* @__PURE__ */ jsx("div", { className: "crewlet-data-grid__head", role: "row", children:
|
|
431
|
+
/* @__PURE__ */ jsx("div", { className: "crewlet-data-grid__head", role: "row", children: drawnColumns.map((column) => {
|
|
362
432
|
const sorted = sort?.key === column.key;
|
|
363
433
|
const sortable = Boolean(column.sortValue && onSortChange);
|
|
364
434
|
const headClass = cx(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ConfirmModal } from './chunk-YCC2S7DF.js';
|
|
1
2
|
import { InlineCode } from './chunk-5CLW2CXT.js';
|
|
2
|
-
import { ConfirmModal } from './chunk-6AKG2VLR.js';
|
|
3
3
|
import { Callout } from './chunk-SZZRIHGT.js';
|
|
4
4
|
import './LinkInterstitial-ET4MSVSV.css';
|
|
5
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Switch } from './chunk-A722MUNR.js';
|
|
2
2
|
import { useReorder } from './chunk-XJ2QEBMM.js';
|
|
3
|
-
import { Checkbox } from './chunk-
|
|
3
|
+
import { Checkbox } from './chunk-NCHKKYPQ.js';
|
|
4
4
|
import { IconButton } from './chunk-LACA4JGC.js';
|
|
5
5
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
6
6
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PrincipalAvatar } from './chunk-CI3VPIJN.js';
|
|
2
2
|
import { toInstant, RelativeTime, formatExact, toISO } from './chunk-3CZ7XAVY.js';
|
|
3
3
|
import { Document } from './chunk-PWG3VHRQ.js';
|
|
4
|
-
import { Composer } from './chunk-
|
|
4
|
+
import { Composer } from './chunk-GHY63X4C.js';
|
|
5
5
|
import { Count } from './chunk-BHHIIK3M.js';
|
|
6
6
|
import { useHeadingLevel, headingTag } from './chunk-PQADV6P6.js';
|
|
7
7
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { FileDrop, FilePickButton } from './chunk-THDGBD6Y.js';
|
|
2
|
+
import { contrastRatio } from './chunk-B235ANDO.js';
|
|
3
|
+
import { normalizeHex } from './chunk-UZMNR366.js';
|
|
4
|
+
import { Button } from './chunk-OG6CL3EB.js';
|
|
5
|
+
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
6
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
7
|
+
import './LogoSlot-T2UFOJXU.css';
|
|
8
|
+
import { useId } from 'react';
|
|
9
|
+
import { ImageGlyph, CircleAlertGlyph, UploadGlyph, TrashGlyph } from '@crewlethq/icons/glyphs';
|
|
10
|
+
import { themes } from '@crewlethq/tokens';
|
|
11
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
var LABELS = {
|
|
14
|
+
choose: "Choose a file",
|
|
15
|
+
replace: "Replace",
|
|
16
|
+
remove: "Remove",
|
|
17
|
+
drop: "Drop the file to use it",
|
|
18
|
+
uploading: "Uploading",
|
|
19
|
+
empty: "No logo yet",
|
|
20
|
+
hint: "SVG, PNG or WebP, up to 2 MB."
|
|
21
|
+
};
|
|
22
|
+
var DEFAULT_GROUNDS = {
|
|
23
|
+
light: themes.light.color.surface.background,
|
|
24
|
+
dark: themes.dark.color.surface.background
|
|
25
|
+
};
|
|
26
|
+
var INKS = [themes.light.color.text.secondary, themes.dark.color.text.secondary];
|
|
27
|
+
function inkOn(ground) {
|
|
28
|
+
let best = INKS[0];
|
|
29
|
+
let most = -1;
|
|
30
|
+
for (const ink of INKS) {
|
|
31
|
+
const ratio = contrastRatio(ink, ground) ?? 0;
|
|
32
|
+
if (ratio > most) {
|
|
33
|
+
most = ratio;
|
|
34
|
+
best = ink;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return best;
|
|
38
|
+
}
|
|
39
|
+
function LogoSlot({
|
|
40
|
+
label,
|
|
41
|
+
description,
|
|
42
|
+
ground,
|
|
43
|
+
groundColor,
|
|
44
|
+
shape = "wide",
|
|
45
|
+
src,
|
|
46
|
+
alt,
|
|
47
|
+
guide = true,
|
|
48
|
+
uploading = false,
|
|
49
|
+
error,
|
|
50
|
+
editable = false,
|
|
51
|
+
onFile,
|
|
52
|
+
onRemove,
|
|
53
|
+
accept = "image/svg+xml,image/png,image/webp",
|
|
54
|
+
download,
|
|
55
|
+
emptyNote,
|
|
56
|
+
className,
|
|
57
|
+
labels
|
|
58
|
+
}) {
|
|
59
|
+
const text = { ...LABELS, ...labels };
|
|
60
|
+
const labelId = useId();
|
|
61
|
+
const descriptionId = useId();
|
|
62
|
+
const groundValue = normalizeHex(groundColor) ?? DEFAULT_GROUNDS[ground];
|
|
63
|
+
const filled = Boolean(src);
|
|
64
|
+
const take = (files) => {
|
|
65
|
+
const first = files[0];
|
|
66
|
+
if (first && !uploading) onFile?.(first.file);
|
|
67
|
+
};
|
|
68
|
+
const stage = /* @__PURE__ */ jsx(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: cx(
|
|
72
|
+
"crewlet-logo-slot__stage",
|
|
73
|
+
`crewlet-logo-slot__stage--${ground}`,
|
|
74
|
+
`crewlet-logo-slot__stage--${shape}`,
|
|
75
|
+
!filled && "is-empty",
|
|
76
|
+
uploading && "is-uploading"
|
|
77
|
+
),
|
|
78
|
+
style: { "--crewlet-logo-slot-ground": groundValue, "--crewlet-logo-slot-ink": inkOn(groundValue) },
|
|
79
|
+
children: /* @__PURE__ */ jsx("span", { className: cx("crewlet-logo-slot__space", guide && "has-guide"), children: filled ? /* @__PURE__ */ jsx("img", { src: src ?? void 0, alt, className: "crewlet-logo-slot__image", draggable: false }) : /* @__PURE__ */ jsx("span", { className: "crewlet-logo-slot__placeholder", "aria-hidden": "true", children: /* @__PURE__ */ jsx(ImageGlyph, { size: "lg" }) }) })
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
return /* @__PURE__ */ jsxs(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
role: "group",
|
|
86
|
+
"aria-labelledby": labelId,
|
|
87
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
88
|
+
"aria-busy": uploading || void 0,
|
|
89
|
+
className: cx("crewlet-logo-slot", className),
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ jsxs("div", { className: "crewlet-logo-slot__head", children: [
|
|
92
|
+
/* @__PURE__ */ jsxs("span", { className: "crewlet-logo-slot__words", children: [
|
|
93
|
+
/* @__PURE__ */ jsx("span", { id: labelId, className: "crewlet-logo-slot__label", children: label }),
|
|
94
|
+
description ? /* @__PURE__ */ jsx("span", { id: descriptionId, className: "crewlet-logo-slot__description", children: description }) : null
|
|
95
|
+
] }),
|
|
96
|
+
download && filled ? /* @__PURE__ */ jsx("span", { className: "crewlet-logo-slot__download", children: download }) : null
|
|
97
|
+
] }),
|
|
98
|
+
editable ? /* @__PURE__ */ jsx(FileDrop, { title: text.drop, onFiles: take, disabled: uploading, children: stage }) : stage,
|
|
99
|
+
!filled && (!editable || emptyNote) ? /* @__PURE__ */ jsx("p", { className: "crewlet-logo-slot__empty", children: emptyNote ?? text.empty }) : null,
|
|
100
|
+
error ? /* @__PURE__ */ jsxs("p", { className: "crewlet-logo-slot__error", role: "alert", children: [
|
|
101
|
+
/* @__PURE__ */ jsx(CircleAlertGlyph, { size: "sm", "aria-hidden": "true" }),
|
|
102
|
+
/* @__PURE__ */ jsx("span", { children: error })
|
|
103
|
+
] }) : null,
|
|
104
|
+
editable ? /* @__PURE__ */ jsxs("div", { className: "crewlet-logo-slot__foot", children: [
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
FilePickButton,
|
|
107
|
+
{
|
|
108
|
+
size: "small",
|
|
109
|
+
variant: "secondary",
|
|
110
|
+
leadingIcon: /* @__PURE__ */ jsx(UploadGlyph, { size: "sm" }),
|
|
111
|
+
accept,
|
|
112
|
+
multiple: false,
|
|
113
|
+
loading: uploading,
|
|
114
|
+
"aria-describedby": labelId,
|
|
115
|
+
onFiles: take,
|
|
116
|
+
children: filled ? text.replace : text.choose
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
filled && onRemove ? /* @__PURE__ */ jsx(
|
|
120
|
+
Button,
|
|
121
|
+
{
|
|
122
|
+
size: "small",
|
|
123
|
+
variant: "ghost",
|
|
124
|
+
leadingIcon: /* @__PURE__ */ jsx(TrashGlyph, { size: "sm" }),
|
|
125
|
+
disabledReason: uploading ? text.uploading : void 0,
|
|
126
|
+
"aria-describedby": labelId,
|
|
127
|
+
onClick: onRemove,
|
|
128
|
+
children: text.remove
|
|
129
|
+
}
|
|
130
|
+
) : null,
|
|
131
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-logo-slot__hint", children: text.hint })
|
|
132
|
+
] }) : null,
|
|
133
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("span", { role: "status", children: uploading ? text.uploading : "" }) })
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { LogoSlot };
|
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
import { ArtifactKindGlyph } from './chunk-
|
|
1
|
+
import { ArtifactKindGlyph } from './chunk-RSKW25Y5.js';
|
|
2
2
|
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
3
3
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
4
|
-
import './ArtifactKinds-
|
|
5
|
-
import './ArtifactNameCell-
|
|
6
|
-
import { PinGlyph } from '@crewlethq/icons/glyphs';
|
|
4
|
+
import './ArtifactKinds-O3CALPVX.css';
|
|
5
|
+
import './ArtifactNameCell-3AHLUSE5.css';
|
|
6
|
+
import { FolderGlyph, PinGlyph } from '@crewlethq/icons/glyphs';
|
|
7
7
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
9
|
var LABELS = {
|
|
10
|
-
kinds: { html: "HTML", doc: "Doc", slides: "Slides", design: "Design", dashboard: "Dashboard", sheet: "Sheet" },
|
|
11
|
-
pinned: "Pinned"
|
|
10
|
+
kinds: { html: "HTML", doc: "Doc", slides: "Slides", design: "Design", dashboard: "Dashboard", sheet: "Sheet", brand: "Brand" },
|
|
11
|
+
pinned: "Pinned",
|
|
12
|
+
folder: "Folder"
|
|
12
13
|
};
|
|
13
14
|
function ArtifactNameCell({ kind, title, detail, pinned = false, trashed = false, className, labels }) {
|
|
14
15
|
const text = { ...LABELS, ...labels, kinds: { ...LABELS.kinds, ...labels?.kinds } };
|
|
15
|
-
const
|
|
16
|
+
const folder = kind === "folder";
|
|
17
|
+
const kindWord = folder ? text.folder : text.kinds[kind];
|
|
16
18
|
const about = detail?.trim();
|
|
17
19
|
return /* @__PURE__ */ jsxs("span", { className: cx("crewlet-artifact-name", trashed && "crewlet-artifact-name--trashed", className), children: [
|
|
18
|
-
/* @__PURE__ */ jsx(
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
className: cx("crewlet-artifact-name__mark", folder ? "crewlet-artifact-name__mark--folder" : `crewlet-kind--${kind}`),
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
children: folder ? /* @__PURE__ */ jsx(FolderGlyph, { size: "sm" }) : /* @__PURE__ */ jsx(ArtifactKindGlyph, { kind, size: "sm" })
|
|
26
|
+
}
|
|
27
|
+
),
|
|
19
28
|
/* @__PURE__ */ jsxs("span", { className: "crewlet-artifact-name__words", children: [
|
|
20
29
|
/* @__PURE__ */ jsxs("span", { className: "crewlet-artifact-name__title-row", children: [
|
|
21
30
|
/* @__PURE__ */ jsx("span", { className: "crewlet-artifact-name__title", title, children: title }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Select } from './chunk-XQZ6EWOE.js';
|
|
2
|
+
import { Modal } from './chunk-YCC2S7DF.js';
|
|
2
3
|
import { CopyButton } from './chunk-7SHAFLEX.js';
|
|
3
|
-
import { Modal } from './chunk-6AKG2VLR.js';
|
|
4
4
|
import { Callout } from './chunk-SZZRIHGT.js';
|
|
5
5
|
import { PrincipalAvatar } from './chunk-CI3VPIJN.js';
|
|
6
6
|
import { useHeadingLevel, headingTag } from './chunk-PQADV6P6.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { fontStack, safeFontFamily } from './chunk-5SGHW42B.js';
|
|
2
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
+
import './TypeSpecimen-WK6YNHL7.css';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var LABELS = {
|
|
7
|
+
glyphs: "Aa",
|
|
8
|
+
sample: "Every doc, deck and page your company makes, in its own type."
|
|
9
|
+
};
|
|
10
|
+
function quotedFamily(family) {
|
|
11
|
+
return `"${family.replace(/["\\\r\n]/g, "").trim()}"`;
|
|
12
|
+
}
|
|
13
|
+
function TypeSpecimen({
|
|
14
|
+
family,
|
|
15
|
+
label,
|
|
16
|
+
fontFamily,
|
|
17
|
+
sample,
|
|
18
|
+
detail,
|
|
19
|
+
weight = "regular",
|
|
20
|
+
size = "md",
|
|
21
|
+
className,
|
|
22
|
+
labels
|
|
23
|
+
}) {
|
|
24
|
+
const text = { ...LABELS, ...labels };
|
|
25
|
+
const stack = fontStack(safeFontFamily(fontFamily) ?? quotedFamily(family), "var(--font-family-sans)");
|
|
26
|
+
return /* @__PURE__ */ jsxs(
|
|
27
|
+
"figure",
|
|
28
|
+
{
|
|
29
|
+
className: cx("crewlet-type-specimen", `crewlet-type-specimen--${size}`, `crewlet-type-specimen--${weight}`, className),
|
|
30
|
+
style: { "--crewlet-type-specimen-family": stack },
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsxs("figcaption", { className: "crewlet-type-specimen__caption", children: [
|
|
33
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-type-specimen__label", children: label }),
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-type-specimen__family", children: family }),
|
|
35
|
+
detail ? /* @__PURE__ */ jsx("span", { className: "crewlet-type-specimen__detail", children: detail }) : null
|
|
36
|
+
] }),
|
|
37
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-type-specimen__glyphs", "aria-hidden": "true", children: text.glyphs }),
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-type-specimen__sample", children: sample ?? text.sample })
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { TypeSpecimen };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Card } from './chunk-INHXF2CL.js';
|
|
2
|
+
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
3
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
4
|
+
import './FolderTile-FDT5Y63Z.css';
|
|
5
|
+
import { useId } from 'react';
|
|
6
|
+
import { FolderGlyph } from '@crewlethq/icons/glyphs';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var CONTENTS = {
|
|
10
|
+
artifacts: (count) => count === 1 ? "1 artifact" : `${count} artifacts`,
|
|
11
|
+
folders: (count) => count === 1 ? "1 folder" : `${count} folders`,
|
|
12
|
+
nothing: "Nothing you can open yet"
|
|
13
|
+
};
|
|
14
|
+
function describeFolderContents(contents, labels) {
|
|
15
|
+
const text = { ...CONTENTS, ...labels };
|
|
16
|
+
const parts = [];
|
|
17
|
+
if (contents.artifacts > 0) parts.push(text.artifacts(contents.artifacts));
|
|
18
|
+
if (contents.folders > 0) parts.push(text.folders(contents.folders));
|
|
19
|
+
return parts.length > 0 ? parts.join(" \xB7 ") : text.nothing;
|
|
20
|
+
}
|
|
21
|
+
var LABELS = {
|
|
22
|
+
...CONTENTS,
|
|
23
|
+
folder: "Folder",
|
|
24
|
+
selected: "Selected"
|
|
25
|
+
};
|
|
26
|
+
function FolderTile({
|
|
27
|
+
name,
|
|
28
|
+
href,
|
|
29
|
+
visibility,
|
|
30
|
+
contents,
|
|
31
|
+
actions,
|
|
32
|
+
selected = false,
|
|
33
|
+
dropTarget = false,
|
|
34
|
+
size = "tile",
|
|
35
|
+
className,
|
|
36
|
+
labels
|
|
37
|
+
}) {
|
|
38
|
+
const text = { ...LABELS, ...labels };
|
|
39
|
+
const nameId = useId();
|
|
40
|
+
const factsId = useId();
|
|
41
|
+
return /* @__PURE__ */ jsxs(
|
|
42
|
+
Card,
|
|
43
|
+
{
|
|
44
|
+
variant: "subtle",
|
|
45
|
+
padding: "none",
|
|
46
|
+
interactive: true,
|
|
47
|
+
selected,
|
|
48
|
+
className: cx(
|
|
49
|
+
"crewlet-folder-tile",
|
|
50
|
+
`crewlet-folder-tile--${size}`,
|
|
51
|
+
dropTarget && "is-drop-target",
|
|
52
|
+
actions ? "crewlet-folder-tile--with-actions" : null,
|
|
53
|
+
className
|
|
54
|
+
),
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsxs("a", { href, className: "crewlet-folder-tile__link", "aria-labelledby": nameId, "aria-describedby": factsId, children: [
|
|
57
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-folder-tile__glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx(FolderGlyph, { size: size === "row" ? "md" : "lg" }) }),
|
|
58
|
+
/* @__PURE__ */ jsxs("span", { className: "crewlet-folder-tile__body", children: [
|
|
59
|
+
/* @__PURE__ */ jsx("span", { id: nameId, className: "crewlet-folder-tile__name", title: name, children: name }),
|
|
60
|
+
/* @__PURE__ */ jsxs("span", { id: factsId, className: "crewlet-folder-tile__facts", children: [
|
|
61
|
+
/* @__PURE__ */ jsxs(VisuallyHidden, { children: [
|
|
62
|
+
text.folder,
|
|
63
|
+
selected ? `, ${text.selected}` : "",
|
|
64
|
+
visibility || contents ? ", " : ""
|
|
65
|
+
] }),
|
|
66
|
+
visibility ? /* @__PURE__ */ jsx("span", { className: "crewlet-folder-tile__visibility", children: visibility }) : null,
|
|
67
|
+
contents ? /* @__PURE__ */ jsxs("span", { className: "crewlet-folder-tile__contents", children: [
|
|
68
|
+
visibility ? /* @__PURE__ */ jsx(VisuallyHidden, { children: ", " }) : null,
|
|
69
|
+
describeFolderContents(contents, text)
|
|
70
|
+
] }) : null
|
|
71
|
+
] })
|
|
72
|
+
] })
|
|
73
|
+
] }),
|
|
74
|
+
actions ? /* @__PURE__ */ jsx("span", { className: "crewlet-folder-tile__actions", children: actions }) : null
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { FolderTile, describeFolderContents };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Modal } from './chunk-
|
|
1
|
+
import { Modal } from './chunk-YCC2S7DF.js';
|
|
2
2
|
import { useListbox, useHighlightRest } from './chunk-7KHM2FZH.js';
|
|
3
|
-
import { Input } from './chunk-EXRRTKWT.js';
|
|
4
3
|
import { Kbd } from './chunk-SMBKXWML.js';
|
|
4
|
+
import { Input } from './chunk-EXRRTKWT.js';
|
|
5
5
|
import { Count } from './chunk-BHHIIK3M.js';
|
|
6
6
|
import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
|
|
7
7
|
import { isComposing } from './chunk-H5XTJ7GJ.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PageHeader } from './chunk-DKB73KZI.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { DateTimePicker } from './chunk-ZFM5L7M4.js';
|
|
3
|
+
import { DataTable } from './chunk-WQ7S7CKZ.js';
|
|
4
4
|
import { useListbox, useOptionKeys } from './chunk-7KHM2FZH.js';
|
|
5
5
|
import { Toolbar } from './chunk-NR4CPM4T.js';
|
|
6
6
|
import { Popover } from './chunk-KHJIEPZV.js';
|
|
7
7
|
import { RelativeTime } from './chunk-3CZ7XAVY.js';
|
|
8
|
-
import { Input } from './chunk-EXRRTKWT.js';
|
|
9
8
|
import { Kbd } from './chunk-SMBKXWML.js';
|
|
9
|
+
import { Input } from './chunk-EXRRTKWT.js';
|
|
10
10
|
import { Count } from './chunk-BHHIIK3M.js';
|
|
11
11
|
import { Menu } from './chunk-TMM32U7D.js';
|
|
12
12
|
import { Button } from './chunk-OG6CL3EB.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormField } from './chunk-EXRRTKWT.js';
|
|
2
|
+
import { VisuallyHidden } from './chunk-BZFWDIV6.js';
|
|
2
3
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
-
import './Checkbox-
|
|
4
|
+
import './Checkbox-MB22OW6P.css';
|
|
4
5
|
import { forwardRef, useId, useRef, useCallback, useEffect } from 'react';
|
|
5
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
7
|
|
|
@@ -11,6 +12,7 @@ var Checkbox = forwardRef(function Checkbox2({
|
|
|
11
12
|
framed = false,
|
|
12
13
|
size = "md",
|
|
13
14
|
indeterminate = false,
|
|
15
|
+
hideLabel = false,
|
|
14
16
|
onCheckedChange,
|
|
15
17
|
onChange,
|
|
16
18
|
className = "",
|
|
@@ -44,6 +46,7 @@ var Checkbox = forwardRef(function Checkbox2({
|
|
|
44
46
|
tone === "danger" && "crewlet-checkbox--danger",
|
|
45
47
|
framed && "crewlet-checkbox--framed",
|
|
46
48
|
size === "sm" && "crewlet-checkbox--sm",
|
|
49
|
+
hideLabel && "crewlet-checkbox--bare",
|
|
47
50
|
disabled && "is-disabled",
|
|
48
51
|
className
|
|
49
52
|
),
|
|
@@ -65,7 +68,7 @@ var Checkbox = forwardRef(function Checkbox2({
|
|
|
65
68
|
...rest
|
|
66
69
|
}
|
|
67
70
|
),
|
|
68
|
-
/* @__PURE__ */ jsxs("span", { className: "crewlet-checkbox__text", children: [
|
|
71
|
+
hideLabel ? /* @__PURE__ */ jsx(VisuallyHidden, { id: labelId, children: label }) : /* @__PURE__ */ jsxs("span", { className: "crewlet-checkbox__text", children: [
|
|
69
72
|
/* @__PURE__ */ jsx("span", { className: "crewlet-checkbox__label", id: labelId, children: label }),
|
|
70
73
|
description ? /* @__PURE__ */ jsx("span", { className: "crewlet-checkbox__description", id: descriptionId, children: description }) : null
|
|
71
74
|
] })
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Toolbar } from './chunk-NR4CPM4T.js';
|
|
2
|
+
import { announce } from './chunk-RSAQOKH3.js';
|
|
3
|
+
import { Button } from './chunk-OG6CL3EB.js';
|
|
4
|
+
import { returnFocus } from './chunk-NUZHC6MM.js';
|
|
5
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
6
|
+
import './SelectionBar-XPWKUOSC.css';
|
|
7
|
+
import { useRef, useEffect } from 'react';
|
|
8
|
+
import { XGlyph } from '@crewlethq/icons/glyphs';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var LABELS = {
|
|
12
|
+
count: (count) => `${count} selected`,
|
|
13
|
+
cleared: "Selection cleared",
|
|
14
|
+
clear: "Clear",
|
|
15
|
+
label: "Selection"
|
|
16
|
+
};
|
|
17
|
+
function SelectionBar({ count, onClear, children, returnFocusRef, className, labels }) {
|
|
18
|
+
const text = { ...LABELS, ...labels };
|
|
19
|
+
const said = useRef(0);
|
|
20
|
+
const countWords = text.count(count);
|
|
21
|
+
const clearedWords = text.cleared;
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (count === said.current) return;
|
|
24
|
+
const before = said.current;
|
|
25
|
+
said.current = count;
|
|
26
|
+
if (count > 0) announce(countWords);
|
|
27
|
+
else if (before > 0) announce(clearedWords);
|
|
28
|
+
}, [count, countWords, clearedWords]);
|
|
29
|
+
if (count <= 0) return null;
|
|
30
|
+
return /* @__PURE__ */ jsxs(Toolbar, { label: text.label, className: cx("crewlet-selection-bar", className), children: [
|
|
31
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-selection-bar__count", children: countWords }),
|
|
32
|
+
children ? /* @__PURE__ */ jsx("span", { className: "crewlet-selection-bar__actions", children }) : null,
|
|
33
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-selection-bar__spacer", "aria-hidden": "true" }),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
Button,
|
|
36
|
+
{
|
|
37
|
+
variant: "ghost",
|
|
38
|
+
size: "small",
|
|
39
|
+
leadingIcon: /* @__PURE__ */ jsx(XGlyph, { size: "sm" }),
|
|
40
|
+
onClick: () => {
|
|
41
|
+
onClear();
|
|
42
|
+
returnFocus(returnFocusRef?.current);
|
|
43
|
+
},
|
|
44
|
+
children: text.clear
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { SelectionBar };
|