@crewlethq/ui 0.149.0 → 0.150.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentHandoffPanel/index.js +11 -11
- package/dist/ArrangeFrame/index.js +2 -2
- package/dist/ArrangeList/index.js +6 -6
- package/dist/ArtifactBar/index.js +4 -4
- package/dist/ArtifactCard/index.js +6 -6
- package/dist/ArtifactPanel/index.js +3 -3
- package/dist/ArtifactRef/index.js +2 -2
- package/dist/AttentionList/index.js +3 -3
- package/dist/AuthLayout/index.js +1 -1
- package/dist/AvatarPicker/index.js +6 -6
- package/dist/BriefCard/index.js +3 -3
- package/dist/CheckGrid/index.js +5 -5
- package/dist/Checkbox/index.js +4 -4
- package/dist/ChipField/index.js +2 -2
- package/dist/ColorField/index.js +4 -4
- package/dist/Combobox/index.js +4 -4
- package/dist/CommandPalette/index.js +6 -6
- package/dist/CommentPin/cursor.d.ts +3 -5
- package/dist/CommentThread/index.js +7 -7
- package/dist/Composer/index.js +4 -4
- package/dist/ConfirmField/index.js +4 -4
- package/dist/DataGrid/index.js +7 -6
- package/dist/DataTable/index.js +7 -7
- package/dist/DataView/index.js +9 -9
- package/dist/DatasetSource/index.js +1 -1
- package/dist/DeepWorkCard/index.js +4 -4
- package/dist/DocTabsEditor/index.js +6 -6
- package/dist/DurationField/DurationField.d.ts +59 -0
- package/dist/DurationField/index.d.ts +3 -0
- package/dist/DurationField/index.js +32 -0
- package/dist/DurationField-TJFIAUMW.css +23 -0
- package/dist/EditingStatus/index.js +2 -2
- package/dist/{Editor-FXREHINI.js → Editor-XAJF2WQ3.js} +4 -4
- package/dist/EmojiPicker/index.js +4 -4
- package/dist/EntityList/index.js +1 -1
- package/dist/HuePicker/index.js +4 -4
- package/dist/InboxList/index.js +2 -2
- package/dist/InlineEditor/index.js +3 -3
- package/dist/InlineRef/index.js +1 -1
- package/dist/{InlineRef-CUBTBIYD.css → InlineRef-EBQZ26KM.css} +6 -0
- package/dist/Input/index.js +3 -3
- package/dist/KeyValueRows/index.js +4 -4
- package/dist/LinkInterstitial/index.js +3 -3
- package/dist/ListInput/index.js +5 -5
- package/dist/MarkdownEditor/index.js +4 -4
- package/dist/MemberPicker/index.js +5 -5
- package/dist/MergeConflicts/index.js +4 -4
- package/dist/MessageActions/index.js +5 -5
- package/dist/Modal/index.js +2 -2
- package/dist/NumberField/NumberField.d.ts +56 -0
- package/dist/NumberField/index.d.ts +3 -0
- package/dist/NumberField/index.js +29 -0
- package/dist/NumberField-G7H4VNZP.css +30 -0
- package/dist/OpenInAppCard/index.js +4 -4
- package/dist/OrgTable/index.js +9 -8
- package/dist/PeopleRail/index.js +2 -2
- package/dist/PresetChips/PresetChips.d.ts +27 -0
- package/dist/PresetChips/index.d.ts +2 -0
- package/dist/PresetChips/index.js +21 -0
- package/dist/PrincipalPicker/index.js +5 -5
- package/dist/ProposalCard/index.js +8 -8
- package/dist/RailList/index.js +4 -4
- package/dist/ReactionBar/index.js +5 -5
- package/dist/ReadingPane/index.js +2 -2
- package/dist/RefusalCard/index.js +1 -1
- package/dist/Reorder/index.js +2 -2
- package/dist/ResultTableCard/index.js +3 -3
- package/dist/RichEditor/index.js +1 -1
- package/dist/RunChip/index.js +1 -1
- package/dist/SegmentedControl/index.js +3 -3
- package/dist/SelectionBar/index.js +2 -2
- package/dist/SettingForm/SettingForm.d.ts +50 -0
- package/dist/SettingForm/index.d.ts +3 -0
- package/dist/SettingForm/index.js +20 -0
- package/dist/SettingForm-ODVZZ7JZ.css +30 -0
- package/dist/SettingsTable/SettingsTable.d.ts +47 -34
- package/dist/SettingsTable/index.d.ts +3 -2
- package/dist/SettingsTable/index.js +3 -1
- package/dist/SettingsTable-KAMWVCQB.css +169 -0
- package/dist/SetupWizard/index.js +4 -4
- package/dist/ShareDialog/index.js +3 -3
- package/dist/SheetColumnEditor/index.js +11 -11
- package/dist/SheetGrid/index.js +3 -3
- package/dist/SidePanel/index.js +2 -2
- package/dist/SlideFilmstrip/index.js +3 -3
- package/dist/StatusCard/index.js +1 -1
- package/dist/Switcher/index.js +5 -5
- package/dist/TableCells/index.js +1 -1
- package/dist/Tabs/index.js +2 -2
- package/dist/TagsInput/index.js +2 -2
- package/dist/ThemeSwitcher/index.js +4 -4
- package/dist/TimeRangePicker/index.js +9 -9
- package/dist/TimeWindowPicker/index.js +4 -4
- package/dist/TreeGrid/index.js +8 -7
- package/dist/ValueField/index.js +5 -5
- package/dist/VersionCompare/index.js +6 -6
- package/dist/{chunk-V67VL3WD.js → chunk-2IOI52YU.js} +1 -1
- package/dist/{chunk-TPABM6DW.js → chunk-2LTJUWCR.js} +2 -2
- package/dist/{chunk-HIDOUXLD.js → chunk-3ZSKFZP3.js} +1 -1
- package/dist/{chunk-X5ZUDJNK.js → chunk-5K7D64VG.js} +1 -1
- package/dist/{chunk-OMVGWZ3V.js → chunk-6DL4HM7T.js} +1 -1
- package/dist/{chunk-TSLXQVBC.js → chunk-6KCQXKFQ.js} +1 -1
- package/dist/{chunk-WAF36OFS.js → chunk-6VSR7TW7.js} +2 -2
- package/dist/{chunk-N3LAAA4R.js → chunk-7NEHBDNS.js} +2 -2
- package/dist/chunk-7TITGQ3A.js +127 -0
- package/dist/{chunk-27NS67UI.js → chunk-ABWPMBMX.js} +1 -1
- package/dist/{chunk-GMXOZEF5.js → chunk-ANXCMHTP.js} +2 -2
- package/dist/{chunk-4DUK2TC4.js → chunk-B4QF35QY.js} +1 -1
- package/dist/{chunk-R2RHSKAT.js → chunk-BC4OVFBQ.js} +1 -1
- package/dist/{chunk-7FY7L6WD.js → chunk-BCOTJM4W.js} +3 -3
- package/dist/chunk-BQMDD2FD.js +224 -0
- package/dist/chunk-C7BK32JK.js +21 -0
- package/dist/{chunk-PW6QXVIX.js → chunk-CFSPFFHJ.js} +3 -3
- package/dist/{chunk-QRUQOITJ.js → chunk-CUU24MKQ.js} +1 -1
- package/dist/{chunk-27ZF7D3C.js → chunk-FWXAPOMM.js} +1 -1
- package/dist/{chunk-7CVV3DQC.js → chunk-GVD7GVPM.js} +1 -1
- package/dist/chunk-HU56GCZ7.js +198 -0
- package/dist/{chunk-N3R2POGO.js → chunk-JGJSCWZY.js} +2 -2
- package/dist/{chunk-YMBXTGFC.js → chunk-K7C4BIX6.js} +1 -1
- package/dist/{chunk-U3ZUZ7VU.js → chunk-KCFF2MBD.js} +4 -4
- package/dist/{chunk-ZNEMXLTY.js → chunk-KY6W76V3.js} +1 -1
- package/dist/{chunk-MUBJN75T.js → chunk-LMWDWGPE.js} +1 -1
- package/dist/{chunk-BRMJPZC4.js → chunk-MALV624H.js} +1 -1
- package/dist/{chunk-O3CY4MHN.js → chunk-MWAQEHAF.js} +3 -2
- package/dist/{chunk-M4VA76JF.js → chunk-NCQBZ7FU.js} +3 -3
- package/dist/{chunk-RUNZWWN6.js → chunk-OESG3U7F.js} +2 -2
- package/dist/{chunk-FCRJAFTU.js → chunk-OIX7B57V.js} +3 -3
- package/dist/{chunk-YRNIPS4M.js → chunk-PMS3TIU2.js} +2 -2
- package/dist/{chunk-RNVPYDRQ.js → chunk-PN6VKDRF.js} +1 -1
- package/dist/{chunk-3SUIU2ZO.js → chunk-PQDMYIEJ.js} +7 -196
- package/dist/chunk-Q5OB4LBX.js +134 -0
- package/dist/{chunk-FYVV6GJN.js → chunk-QNSAFNGT.js} +1 -1
- package/dist/{chunk-Z6OZNSHF.js → chunk-ROE6HKEI.js} +1 -1
- package/dist/{chunk-S4ADDFRT.js → chunk-S7TZH45K.js} +2 -2
- package/dist/{chunk-UPQ4MDPE.js → chunk-SG3XSUJ5.js} +1 -1
- package/dist/{chunk-ZAQ7CEYN.js → chunk-SIM6FR5B.js} +1 -1
- package/dist/{chunk-EDQHZOU3.js → chunk-SM7NURKY.js} +2 -2
- package/dist/{chunk-FMKQSDBQ.js → chunk-SZH7MLBY.js} +1 -1
- package/dist/{chunk-ODN3LSYW.js → chunk-T2457TRX.js} +1 -1
- package/dist/chunk-TYZSARP5.js +53 -0
- package/dist/{chunk-YWPUT6JQ.js → chunk-UH6B2HTX.js} +1 -1
- package/dist/{chunk-Q7RI66TT.js → chunk-VI2ZUOP7.js} +1 -1
- package/dist/{chunk-E3JUS3CR.js → chunk-VZOGZZCA.js} +1 -1
- package/dist/{chunk-5C7MP4C7.js → chunk-VZWRSV4M.js} +1 -1
- package/dist/{chunk-CA62YCFK.js → chunk-WTWYN7Z5.js} +1 -1
- package/dist/{chunk-F6OYNO7O.js → chunk-YLDZ3TXH.js} +1 -1
- package/dist/{chunk-O2J5PSWI.js → chunk-YQHSUUMN.js} +3 -3
- package/dist/{chunk-VARFEAUH.js → chunk-ZEKRJMX5.js} +3 -3
- package/dist/generated/index.d.ts +4 -0
- package/dist/generated/index.js +127 -122
- package/dist/index.js +127 -122
- package/dist/styles.css +173 -88
- package/dist/utils/index.js +1 -1
- package/package.json +3 -3
- package/dist/SettingsTable-MTZJTKA6.css +0 -182
- package/dist/chunk-RTMFZLU3.js +0 -94
- package/dist/{chunk-II7TPQ64.js → chunk-2DASEYUG.js} +0 -0
- package/dist/{chunk-KRF3GQ63.js → chunk-6N53ZWRM.js} +1 -1
- package/dist/{chunk-UMEK5DHS.js → chunk-6VWBIHSJ.js} +1 -1
- package/dist/{chunk-7PK2Z5JY.js → chunk-73XXYQC7.js} +1 -1
- package/dist/{chunk-3OZPHFDT.js → chunk-DHYJNBWC.js} +1 -1
- package/dist/{chunk-3EL3IF3W.js → chunk-DZPT7P2I.js} +1 -1
- package/dist/{chunk-3GWCWUSY.js → chunk-ECYA6XZL.js} +1 -1
- package/dist/{chunk-Z7BA2EVV.js → chunk-EDUK7DD5.js} +1 -1
- package/dist/{chunk-XQMRSL7Z.js → chunk-GTAAOGDQ.js} +2 -2
- package/dist/{chunk-YUW4DD2Z.js → chunk-H5CN7YWD.js} +1 -1
- package/dist/{chunk-7C6NHVMX.js → chunk-HKRNKAHN.js} +1 -1
- package/dist/{chunk-XZ47PWVD.js → chunk-LXPA2SRT.js} +1 -1
- package/dist/{chunk-JMBPMSNI.js → chunk-NIOE6ZAL.js} +1 -1
- package/dist/{chunk-DGB7R42F.js → chunk-PWRYYOQ4.js} +1 -1
- package/dist/{chunk-2DZV4PHK.js → chunk-R76HBPY5.js} +1 -1
- package/dist/{chunk-ZC73GPA3.js → chunk-RJDRNXDB.js} +1 -1
- package/dist/{chunk-W2T7RGH7.js → chunk-UR3UUHPC.js} +1 -1
- package/dist/{chunk-XJU53WMW.js → chunk-V3RQYIZO.js} +1 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Select } from './chunk-657WR3MX.js';
|
|
2
|
+
import { typedNumber, NumberField } from './chunk-Q5OB4LBX.js';
|
|
3
|
+
import { PresetChips } from './chunk-C7BK32JK.js';
|
|
4
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
5
|
+
import './DurationField-TJFIAUMW.css';
|
|
6
|
+
import { useId } from 'react';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var DURATION_UNIT_SECONDS = {
|
|
10
|
+
days: 86400,
|
|
11
|
+
hours: 3600,
|
|
12
|
+
minutes: 60,
|
|
13
|
+
seconds: 1
|
|
14
|
+
};
|
|
15
|
+
var UNITS_LARGEST_FIRST = ["days", "hours", "minutes", "seconds"];
|
|
16
|
+
var DURATION_FIELD_LABELS = {
|
|
17
|
+
units: {
|
|
18
|
+
seconds: ["second", "seconds"],
|
|
19
|
+
minutes: ["minute", "minutes"],
|
|
20
|
+
hours: ["hour", "hours"],
|
|
21
|
+
days: ["day", "days"]
|
|
22
|
+
},
|
|
23
|
+
unit: "Unit",
|
|
24
|
+
defaultPreset: (words) => `Default (${words})`,
|
|
25
|
+
presets: "Common durations",
|
|
26
|
+
decrease: "Decrease",
|
|
27
|
+
increase: "Increase"
|
|
28
|
+
};
|
|
29
|
+
function unitOf(seconds, units) {
|
|
30
|
+
const ordered = UNITS_LARGEST_FIRST.filter((u) => units.includes(u));
|
|
31
|
+
for (const unit of ordered) {
|
|
32
|
+
if (seconds !== 0 && seconds % DURATION_UNIT_SECONDS[unit] === 0) return unit;
|
|
33
|
+
}
|
|
34
|
+
return ordered[ordered.length - 1] ?? "seconds";
|
|
35
|
+
}
|
|
36
|
+
function durationValue(seconds, fallback = null, units = UNITS_LARGEST_FIRST) {
|
|
37
|
+
if (seconds === null) return { amount: "", unit: unitOf(fallback ?? 0, units) };
|
|
38
|
+
const unit = unitOf(seconds, units);
|
|
39
|
+
return { amount: String(seconds / DURATION_UNIT_SECONDS[unit]), unit };
|
|
40
|
+
}
|
|
41
|
+
function durationSeconds(value) {
|
|
42
|
+
if (value.amount.trim() === "") return null;
|
|
43
|
+
const n = typedNumber(value.amount);
|
|
44
|
+
return n === null ? Number.NaN : n * DURATION_UNIT_SECONDS[value.unit];
|
|
45
|
+
}
|
|
46
|
+
function durationWords(seconds, labels = DURATION_FIELD_LABELS) {
|
|
47
|
+
const { amount, unit } = durationValue(seconds);
|
|
48
|
+
const n = Number(amount);
|
|
49
|
+
const [one, many] = labels.units[unit];
|
|
50
|
+
return `${n.toLocaleString()} ${n === 1 ? one : many}`;
|
|
51
|
+
}
|
|
52
|
+
function DurationField({
|
|
53
|
+
id,
|
|
54
|
+
value,
|
|
55
|
+
onValueChange,
|
|
56
|
+
defaultValue,
|
|
57
|
+
min,
|
|
58
|
+
max,
|
|
59
|
+
units = UNITS_LARGEST_FIRST,
|
|
60
|
+
presets,
|
|
61
|
+
error,
|
|
62
|
+
disabled = false,
|
|
63
|
+
focusOnMount,
|
|
64
|
+
labels: overrides,
|
|
65
|
+
className,
|
|
66
|
+
...aria
|
|
67
|
+
}) {
|
|
68
|
+
const labels = { ...DURATION_FIELD_LABELS, ...overrides };
|
|
69
|
+
const unitId = useId();
|
|
70
|
+
const size = DURATION_UNIT_SECONDS[value.unit];
|
|
71
|
+
const fallback = defaultValue === void 0 ? void 0 : defaultValue / size;
|
|
72
|
+
const seconds = durationSeconds(value);
|
|
73
|
+
const words = (s) => durationWords(s, labels);
|
|
74
|
+
const chosen = seconds === null ? "" : (presets ?? []).find((p) => p === seconds) !== void 0 ? String(seconds) : "#typed";
|
|
75
|
+
const chips = [
|
|
76
|
+
...defaultValue === void 0 ? [] : [{ value: "", label: labels.defaultPreset(words(defaultValue)) }],
|
|
77
|
+
...(presets ?? []).map((p) => ({ value: String(p), label: words(p) }))
|
|
78
|
+
];
|
|
79
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("crewlet-duration-field", className), children: [
|
|
80
|
+
/* @__PURE__ */ jsxs("div", { className: "crewlet-duration-field__row", children: [
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
NumberField,
|
|
83
|
+
{
|
|
84
|
+
id,
|
|
85
|
+
value: value.amount,
|
|
86
|
+
onValueChange: (amount) => onValueChange({ amount, unit: value.unit }),
|
|
87
|
+
defaultValue: fallback !== void 0 && Number.isInteger(fallback) ? fallback : void 0,
|
|
88
|
+
min: min === void 0 ? 0 : Math.ceil(min / size),
|
|
89
|
+
max: max === void 0 ? void 0 : Math.floor(max / size),
|
|
90
|
+
error,
|
|
91
|
+
disabled,
|
|
92
|
+
focusOnMount,
|
|
93
|
+
"aria-label": aria["aria-label"],
|
|
94
|
+
"aria-describedby": aria["aria-describedby"],
|
|
95
|
+
labels: { decrease: labels.decrease, increase: labels.increase },
|
|
96
|
+
className: "crewlet-duration-field__amount"
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
Select,
|
|
101
|
+
{
|
|
102
|
+
id: unitId,
|
|
103
|
+
ariaLabel: labels.unit,
|
|
104
|
+
size: "md",
|
|
105
|
+
width: "auto",
|
|
106
|
+
disabled,
|
|
107
|
+
value: value.unit,
|
|
108
|
+
options: UNITS_LARGEST_FIRST.filter((u) => units.includes(u)).reverse().map((u) => ({ value: u, label: labels.units[u][1] })),
|
|
109
|
+
onChange: (next) => onValueChange({ amount: value.amount, unit: next }),
|
|
110
|
+
className: "crewlet-duration-field__unit"
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] }),
|
|
114
|
+
chips.length > 0 ? /* @__PURE__ */ jsx(
|
|
115
|
+
PresetChips,
|
|
116
|
+
{
|
|
117
|
+
label: labels.presets,
|
|
118
|
+
options: chips,
|
|
119
|
+
value: chosen,
|
|
120
|
+
disabled,
|
|
121
|
+
onPick: (picked) => onValueChange(picked === "" ? durationValue(null, defaultValue ?? null, units) : durationValue(Number(picked), null, units))
|
|
122
|
+
}
|
|
123
|
+
) : null
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { DURATION_FIELD_LABELS, DURATION_UNIT_SECONDS, DurationField, durationSeconds, durationValue, durationWords };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { tabId } from './chunk-
|
|
1
|
+
import { tabId } from './chunk-V3RQYIZO.js';
|
|
2
2
|
import { useRoving, tabStop } from './chunk-7F3OPUM5.js';
|
|
3
|
-
import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
|
|
4
3
|
import { Count } from './chunk-Y5CMDLQM.js';
|
|
4
|
+
import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
|
|
5
5
|
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
6
6
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
7
7
|
import { useState, useId } from 'react';
|
|
@@ -9,7 +9,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
9
9
|
var engine = null;
|
|
10
10
|
var loading = null;
|
|
11
11
|
function loadEngine() {
|
|
12
|
-
loading ??= import('./Editor-
|
|
12
|
+
loading ??= import('./Editor-XAJF2WQ3.js').then(
|
|
13
13
|
(module) => {
|
|
14
14
|
engine = module.Editor;
|
|
15
15
|
return engine;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useScrollerFocus, Modal } from './chunk-
|
|
1
|
+
import { useScrollerFocus, Modal } from './chunk-73XXYQC7.js';
|
|
2
2
|
import { useListbox, useHighlightRest } from './chunk-KW7T23RT.js';
|
|
3
|
-
import { Input } from './chunk-
|
|
3
|
+
import { Input } from './chunk-GTAAOGDQ.js';
|
|
4
|
+
import { Count } from './chunk-Y5CMDLQM.js';
|
|
4
5
|
import { Kbd } from './chunk-VBBLHS2Y.js';
|
|
5
6
|
import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
|
|
6
7
|
import { isComposing } from './chunk-EDPMHSLZ.js';
|
|
7
|
-
import { Count } from './chunk-Y5CMDLQM.js';
|
|
8
8
|
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
9
9
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
10
10
|
import './HitArea-QUOS6ZDJ.css';
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { GridHeadCell } from './chunk-HU56GCZ7.js';
|
|
2
|
+
import { copyGlyph, CopyStatus } from './chunk-IRGS5FEC.js';
|
|
3
|
+
import { useClipboard } from './chunk-STJ7QBC3.js';
|
|
4
|
+
import { StatusDot } from './chunk-QRE6JCHS.js';
|
|
5
|
+
import { Button } from './chunk-IMF3CPTY.js';
|
|
6
|
+
import { IconButton } from './chunk-KM5OKCW6.js';
|
|
7
|
+
import { returnFocus } from './chunk-4ITETIGZ.js';
|
|
8
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
9
|
+
import './DataGrid-XX6ALDIM.css';
|
|
10
|
+
import './SettingsTable-KAMWVCQB.css';
|
|
11
|
+
import { useState, useRef, useLayoutEffect } from 'react';
|
|
12
|
+
import { RotateCcwGlyph } from '@crewlethq/icons/glyphs';
|
|
13
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
14
|
+
|
|
15
|
+
var COLUMNS = {
|
|
16
|
+
setting: "Setting",
|
|
17
|
+
value: "Value",
|
|
18
|
+
source: "Source",
|
|
19
|
+
actions: "Actions"
|
|
20
|
+
};
|
|
21
|
+
var noSort = () => void 0;
|
|
22
|
+
function SettingsTable({ header = true, columns, className, children, ...rest }) {
|
|
23
|
+
const names = { ...COLUMNS, ...columns };
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, role: "table", className: cx("crewlet-data-grid", "crewlet-settings-table", className), children: [
|
|
25
|
+
/* @__PURE__ */ jsxs(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
role: "row",
|
|
29
|
+
className: cx(
|
|
30
|
+
"crewlet-data-grid__head",
|
|
31
|
+
"crewlet-settings-table__head",
|
|
32
|
+
!header && "crewlet-settings-table__head--hidden"
|
|
33
|
+
),
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx(GridHeadCell, { column: { key: "setting", header: names.setting }, sort: null, sortable: false, onSort: noSort }),
|
|
36
|
+
/* @__PURE__ */ jsx(GridHeadCell, { column: { key: "value", header: names.value }, sort: null, sortable: false, onSort: noSort }),
|
|
37
|
+
/* @__PURE__ */ jsx(GridHeadCell, { column: { key: "source", header: names.source }, sort: null, sortable: false, onSort: noSort }),
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
GridHeadCell,
|
|
40
|
+
{
|
|
41
|
+
column: { key: "actions", header: "", action: true, label: names.actions },
|
|
42
|
+
sort: null,
|
|
43
|
+
sortable: false,
|
|
44
|
+
onSort: noSort
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx("div", { role: "rowgroup", className: "crewlet-data-grid__body crewlet-settings-table__body", children })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
var SETTINGS_TABLE_ROW_LABELS = {
|
|
54
|
+
reset: "Reset to default",
|
|
55
|
+
confirm: (defaultLabel) => defaultLabel === void 0 || defaultLabel === null ? "Reset to the default?" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
+
"Reset to ",
|
|
57
|
+
defaultLabel,
|
|
58
|
+
"?"
|
|
59
|
+
] }),
|
|
60
|
+
confirmReset: "Reset",
|
|
61
|
+
cancel: "Cancel"
|
|
62
|
+
};
|
|
63
|
+
function SettingsTableRow({
|
|
64
|
+
label,
|
|
65
|
+
settingKey,
|
|
66
|
+
source,
|
|
67
|
+
changed = false,
|
|
68
|
+
actions,
|
|
69
|
+
onReset,
|
|
70
|
+
defaultLabel,
|
|
71
|
+
resetHeld,
|
|
72
|
+
labels: overrides,
|
|
73
|
+
className,
|
|
74
|
+
children,
|
|
75
|
+
...rest
|
|
76
|
+
}) {
|
|
77
|
+
const labels = { ...SETTINGS_TABLE_ROW_LABELS, ...overrides };
|
|
78
|
+
const offered = changed && onReset !== void 0;
|
|
79
|
+
const [asking, setAsking] = useState(false);
|
|
80
|
+
const confirming = asking && offered;
|
|
81
|
+
const resetButton = useRef(null);
|
|
82
|
+
const confirmButton = useRef(null);
|
|
83
|
+
const actionsCell = useRef(null);
|
|
84
|
+
const settleFocus = useRef(false);
|
|
85
|
+
const resetHeldFocus = useRef(false);
|
|
86
|
+
useLayoutEffect(() => {
|
|
87
|
+
if (confirming) {
|
|
88
|
+
confirmButton.current?.focus();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (!settleFocus.current && !(resetHeldFocus.current && !offered)) return;
|
|
92
|
+
settleFocus.current = false;
|
|
93
|
+
resetHeldFocus.current = false;
|
|
94
|
+
returnFocus(resetButton.current ?? actionsCell.current?.querySelector("button") ?? null);
|
|
95
|
+
}, [confirming, offered]);
|
|
96
|
+
const close = (reset) => {
|
|
97
|
+
settleFocus.current = true;
|
|
98
|
+
setAsking(false);
|
|
99
|
+
if (reset) onReset?.();
|
|
100
|
+
};
|
|
101
|
+
const keys = (event) => {
|
|
102
|
+
if (event.key !== "Escape") return;
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
event.stopPropagation();
|
|
105
|
+
close(false);
|
|
106
|
+
};
|
|
107
|
+
const leave = (event) => {
|
|
108
|
+
if (event.relatedTarget instanceof Node && event.currentTarget.contains(event.relatedTarget)) return;
|
|
109
|
+
setAsking(false);
|
|
110
|
+
};
|
|
111
|
+
return /* @__PURE__ */ jsxs(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
...rest,
|
|
115
|
+
role: "row",
|
|
116
|
+
"data-changed": changed ? "" : void 0,
|
|
117
|
+
"data-confirming": confirming ? "" : void 0,
|
|
118
|
+
className: cx("crewlet-data-grid__row", "crewlet-settings-table__row", className),
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ jsxs("div", { role: "rowheader", className: "crewlet-data-grid__cell crewlet-settings-table__setting", children: [
|
|
121
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-settings-table__label", children: label }),
|
|
122
|
+
settingKey === void 0 ? null : /* @__PURE__ */ jsx(SettingKey, { settingKey })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ jsx("div", { role: "cell", className: "crewlet-data-grid__cell crewlet-settings-table__value", children }),
|
|
125
|
+
confirming ? (
|
|
126
|
+
// The question's own keys and focus: Escape answers no, and leaving it puts it away.
|
|
127
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
128
|
+
/* @__PURE__ */ jsxs(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
role: "cell",
|
|
132
|
+
className: "crewlet-data-grid__cell crewlet-settings-table__confirm",
|
|
133
|
+
onKeyDown: keys,
|
|
134
|
+
onBlur: leave,
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-settings-table__question", children: labels.confirm(defaultLabel) }),
|
|
137
|
+
/* @__PURE__ */ jsx(Button, { type: "button", size: "small", variant: "ghost", onClick: () => close(false), children: labels.cancel }),
|
|
138
|
+
/* @__PURE__ */ jsx(Button, { ref: confirmButton, type: "button", size: "small", variant: "secondary", onClick: () => close(true), children: labels.confirmReset })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
143
|
+
/* @__PURE__ */ jsxs(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
role: "cell",
|
|
147
|
+
className: cx(
|
|
148
|
+
"crewlet-data-grid__cell",
|
|
149
|
+
"crewlet-settings-table__source",
|
|
150
|
+
changed && "crewlet-settings-table__source--changed"
|
|
151
|
+
),
|
|
152
|
+
children: [
|
|
153
|
+
changed ? /* @__PURE__ */ jsx(StatusDot, { tone: "brand" }) : null,
|
|
154
|
+
source
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ jsxs(
|
|
159
|
+
"div",
|
|
160
|
+
{
|
|
161
|
+
ref: actionsCell,
|
|
162
|
+
role: "cell",
|
|
163
|
+
className: "crewlet-data-grid__cell crewlet-data-grid__cell--action crewlet-settings-table__actions",
|
|
164
|
+
children: [
|
|
165
|
+
offered ? /* @__PURE__ */ jsx(
|
|
166
|
+
IconButton,
|
|
167
|
+
{
|
|
168
|
+
ref: resetButton,
|
|
169
|
+
size: "sm",
|
|
170
|
+
variant: "ghost",
|
|
171
|
+
icon: /* @__PURE__ */ jsx(RotateCcwGlyph, {}),
|
|
172
|
+
label: labels.reset,
|
|
173
|
+
tooltip: true,
|
|
174
|
+
disabledReason: resetHeld,
|
|
175
|
+
onFocus: () => {
|
|
176
|
+
resetHeldFocus.current = true;
|
|
177
|
+
},
|
|
178
|
+
onBlur: () => {
|
|
179
|
+
resetHeldFocus.current = false;
|
|
180
|
+
},
|
|
181
|
+
onClick: () => {
|
|
182
|
+
if (resetHeld === void 0) setAsking(true);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
) : null,
|
|
186
|
+
actions
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] })
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
SettingsTable.Row = SettingsTableRow;
|
|
196
|
+
function SettingKey({ settingKey }) {
|
|
197
|
+
const { state, attempt, copy } = useClipboard({ failedResetMs: null });
|
|
198
|
+
return /* @__PURE__ */ jsxs("span", { className: "crewlet-settings-table__key", "data-copy": state, children: [
|
|
199
|
+
/* @__PURE__ */ jsx(
|
|
200
|
+
IconButton,
|
|
201
|
+
{
|
|
202
|
+
size: "sm",
|
|
203
|
+
variant: "ghost",
|
|
204
|
+
icon: copyGlyph(state),
|
|
205
|
+
label: `Copy the setting's key, ${settingKey}`,
|
|
206
|
+
tooltip: settingKey,
|
|
207
|
+
onClick: () => {
|
|
208
|
+
void copy(settingKey);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsx(
|
|
213
|
+
CopyStatus,
|
|
214
|
+
{
|
|
215
|
+
state,
|
|
216
|
+
attempt,
|
|
217
|
+
copiedMessage: `${settingKey} copied to the clipboard`,
|
|
218
|
+
failedMessage: "the browser refused the clipboard"
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
] });
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export { SETTINGS_TABLE_ROW_LABELS, SettingsTable, SettingsTableRow };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SegmentedControl } from './chunk-ANXCMHTP.js';
|
|
2
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function PresetChips({ label, options, value, onPick, disabled = false, className }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
SegmentedControl,
|
|
8
|
+
{
|
|
9
|
+
semantics: "radio",
|
|
10
|
+
layout: "chips",
|
|
11
|
+
size: "sm",
|
|
12
|
+
label,
|
|
13
|
+
className: cx("crewlet-preset-chips", className),
|
|
14
|
+
options: options.map((option) => ({ value: option.value, label: option.label, disabled })),
|
|
15
|
+
value,
|
|
16
|
+
onValueChange: onPick
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { PresetChips };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useReorder } from './chunk-
|
|
2
|
-
import { FormField, Textarea } from './chunk-
|
|
1
|
+
import { useReorder } from './chunk-NIOE6ZAL.js';
|
|
2
|
+
import { FormField, Textarea } from './chunk-GTAAOGDQ.js';
|
|
3
3
|
import { characterCountState, CharacterCount, countCharacters } from './chunk-TEXK4RK6.js';
|
|
4
|
+
import { announce } from './chunk-WGMKERCR.js';
|
|
4
5
|
import { Kbd } from './chunk-VBBLHS2Y.js';
|
|
5
6
|
import { Button } from './chunk-IMF3CPTY.js';
|
|
6
7
|
import { IconButton } from './chunk-KM5OKCW6.js';
|
|
7
8
|
import { isComposing } from './chunk-EDPMHSLZ.js';
|
|
8
|
-
import { announce } from './chunk-WGMKERCR.js';
|
|
9
9
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
10
10
|
import './ListInput-L6XJUDTB.css';
|
|
11
11
|
import { forwardRef, useState, useRef, useImperativeHandle, useLayoutEffect, useId } from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSendOnEnter, SendKeysHint } from './chunk-UZMXC5T6.js';
|
|
2
|
-
import { Textarea } from './chunk-
|
|
2
|
+
import { Textarea } from './chunk-GTAAOGDQ.js';
|
|
3
3
|
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
4
4
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
5
5
|
import './ChatScale-LGESYXCO.css';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { emojiOfShortcode, emojiName, EmojiPicker } from './chunk-
|
|
1
|
+
import { emojiOfShortcode, emojiName, EmojiPicker } from './chunk-K7C4BIX6.js';
|
|
2
2
|
import { heldHint } from './chunk-TDFLCUBE.js';
|
|
3
3
|
import { Tooltip } from './chunk-BFZAGIXR.js';
|
|
4
4
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SlideStage } from './chunk-7O53SWKI.js';
|
|
2
|
-
import { useReorder } from './chunk-
|
|
2
|
+
import { useReorder } from './chunk-NIOE6ZAL.js';
|
|
3
3
|
import { Menu } from './chunk-ZMZNKDPO.js';
|
|
4
4
|
import { Kbd, isApplePlatform } from './chunk-VBBLHS2Y.js';
|
|
5
5
|
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { titleWhenCut, titleIfCut } from './chunk-WSIJDWUG.js';
|
|
2
|
+
import { Button } from './chunk-IMF3CPTY.js';
|
|
3
|
+
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
4
|
+
import { cx } from './chunk-ODEQTPFM.js';
|
|
5
|
+
import { ArrowDownGlyph, ArrowUpGlyph, ArrowUpDownGlyph } from '@crewlethq/icons/glyphs';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/utils/tableTrack.ts
|
|
9
|
+
var SHORT_COLUMN_PX = 192;
|
|
10
|
+
var SHRINK_SHARE = 0.2;
|
|
11
|
+
function tableTrack({ width, shrink, floor, short }) {
|
|
12
|
+
if (width) return width;
|
|
13
|
+
if (shrink) return `fit-content(${SHRINK_SHARE * 100}%)`;
|
|
14
|
+
if (short) return floor === "max-content" || !floor ? "max-content" : `minmax(${floor}, max-content)`;
|
|
15
|
+
return `minmax(${floor ?? 0}, 1fr)`;
|
|
16
|
+
}
|
|
17
|
+
var GRID_ICON_TRACK = "calc(var(--size-target-min) + var(--spacing-3) * 2)";
|
|
18
|
+
function alignOf(column) {
|
|
19
|
+
return column.align ?? (column.icon ? "center" : "left");
|
|
20
|
+
}
|
|
21
|
+
function headerWord(column) {
|
|
22
|
+
return typeof column.header === "string" ? column.header : "";
|
|
23
|
+
}
|
|
24
|
+
function columnName(column) {
|
|
25
|
+
return headerWord(column) || column.label || column.key;
|
|
26
|
+
}
|
|
27
|
+
function parseGridSort(raw) {
|
|
28
|
+
if (!raw) return null;
|
|
29
|
+
return raw.startsWith("-") ? { key: raw.slice(1), desc: true } : { key: raw, desc: false };
|
|
30
|
+
}
|
|
31
|
+
function nextGridSort(column, sort, defaultSort = "") {
|
|
32
|
+
const chosen = sort === defaultSort ? "" : sort;
|
|
33
|
+
const current = parseGridSort(chosen || defaultSort);
|
|
34
|
+
let next;
|
|
35
|
+
if (current?.key !== column) next = column;
|
|
36
|
+
else if (!current.desc) next = `-${column}`;
|
|
37
|
+
else next = chosen ? "" : column;
|
|
38
|
+
return next === defaultSort ? "" : next;
|
|
39
|
+
}
|
|
40
|
+
function compare(a, b) {
|
|
41
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
42
|
+
if (Number.isNaN(a)) return Number.isNaN(b) ? 0 : 1;
|
|
43
|
+
if (Number.isNaN(b)) return -1;
|
|
44
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
45
|
+
}
|
|
46
|
+
return String(a).localeCompare(String(b), void 0, { numeric: true, sensitivity: "base" });
|
|
47
|
+
}
|
|
48
|
+
function sortByValue(items, get, desc) {
|
|
49
|
+
return [...items].sort((a, b) => {
|
|
50
|
+
const av = get(a);
|
|
51
|
+
const bv = get(b);
|
|
52
|
+
if (av == null && bv == null) return 0;
|
|
53
|
+
if (av == null) return 1;
|
|
54
|
+
if (bv == null) return -1;
|
|
55
|
+
const cmp = compare(av, bv);
|
|
56
|
+
return desc ? -cmp : cmp;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
var GRID_FOOT_LABELS = {
|
|
60
|
+
hiddenToFit: (names) => `Hidden to fit: ${names}`,
|
|
61
|
+
loadMore: "Load more",
|
|
62
|
+
showEveryColumn: "Show every column",
|
|
63
|
+
and: "and"
|
|
64
|
+
};
|
|
65
|
+
function droppedNames(columns, dropped, and) {
|
|
66
|
+
const names = dropped.map((key) => {
|
|
67
|
+
const c = columns.find((col) => col.key === key);
|
|
68
|
+
return c ? columnName(c) : key;
|
|
69
|
+
});
|
|
70
|
+
return names.length <= 1 ? names[0] ?? "" : `${names.slice(0, -1).join(", ")} ${and} ${names[names.length - 1]}`;
|
|
71
|
+
}
|
|
72
|
+
function GridHeadCell({
|
|
73
|
+
column,
|
|
74
|
+
sort,
|
|
75
|
+
sortable,
|
|
76
|
+
onSort,
|
|
77
|
+
hidden = false,
|
|
78
|
+
colIndex,
|
|
79
|
+
actionsLabel
|
|
80
|
+
}) {
|
|
81
|
+
const align = alignOf(column);
|
|
82
|
+
const sorted = sort?.key === column.key;
|
|
83
|
+
const headClass = cx(
|
|
84
|
+
"crewlet-data-grid__th",
|
|
85
|
+
align !== "left" && `crewlet-data-grid__th--${align}`,
|
|
86
|
+
column.icon && "crewlet-data-grid__th--icon",
|
|
87
|
+
column.shrink && "crewlet-data-grid__th--shrink",
|
|
88
|
+
sorted && "crewlet-data-grid__th--sorted",
|
|
89
|
+
!sortable && "crewlet-data-grid__th--plain"
|
|
90
|
+
);
|
|
91
|
+
const worded = column.header !== "" && column.header !== null && column.header !== void 0;
|
|
92
|
+
const label = !worded ? null : hidden ? /* @__PURE__ */ jsx(VisuallyHidden, { children: column.header }) : /* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__truncate", onMouseEnter: titleWhenCut, children: column.header });
|
|
93
|
+
const arrow = sorted ? sort?.desc ? /* @__PURE__ */ jsx(ArrowDownGlyph, { size: "xs" }) : /* @__PURE__ */ jsx(ArrowUpGlyph, { size: "xs" }) : sortable ? /* @__PURE__ */ jsx(ArrowUpDownGlyph, { size: "xs" }) : null;
|
|
94
|
+
const ariaSort = sorted ? sort?.desc ? "descending" : "ascending" : void 0;
|
|
95
|
+
const mark = arrow && /* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__sort-mark", "aria-hidden": "true", children: arrow });
|
|
96
|
+
if (!sortable) {
|
|
97
|
+
const word = headerWord(column);
|
|
98
|
+
const glyph = !word && !column.action ? column.label : void 0;
|
|
99
|
+
const named = word ? void 0 : glyph ?? (column.action && !worded ? column.label ?? actionsLabel : void 0);
|
|
100
|
+
return /* @__PURE__ */ jsxs("div", { className: headClass, role: "columnheader", "aria-colindex": colIndex, title: glyph, "aria-sort": ariaSort, children: [
|
|
101
|
+
label,
|
|
102
|
+
mark,
|
|
103
|
+
named && /* @__PURE__ */ jsx(VisuallyHidden, { children: named })
|
|
104
|
+
] });
|
|
105
|
+
}
|
|
106
|
+
return /* @__PURE__ */ jsx("div", { className: headClass, role: "columnheader", "aria-colindex": colIndex, "aria-sort": ariaSort, children: /* @__PURE__ */ jsxs(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
className: "crewlet-data-grid__sort",
|
|
111
|
+
onClick: onSort,
|
|
112
|
+
"aria-label": headerWord(column) ? void 0 : column.label,
|
|
113
|
+
children: [
|
|
114
|
+
label,
|
|
115
|
+
mark
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
) });
|
|
119
|
+
}
|
|
120
|
+
function GridFoot({ footer, dropped, loadedNote, onLoadMore, onReset, labels, columns }) {
|
|
121
|
+
const shows = Boolean(footer) || Boolean(onLoadMore) || Boolean(loadedNote) || dropped !== "";
|
|
122
|
+
if (!shows && !onReset) return null;
|
|
123
|
+
const table = columns !== void 0;
|
|
124
|
+
const cell = (className, children) => table ? /* @__PURE__ */ jsx("div", { role: "cell", "aria-colspan": columns, className, children }) : /* @__PURE__ */ jsx("div", { className, children });
|
|
125
|
+
return /* @__PURE__ */ jsxs("div", { role: table ? "rowgroup" : void 0, className: "crewlet-data-grid__foot-group", children: [
|
|
126
|
+
shows && /* @__PURE__ */ jsx("div", { role: table ? "row" : void 0, className: "crewlet-data-grid__foot", children: cell(
|
|
127
|
+
"crewlet-data-grid__foot-cell",
|
|
128
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
129
|
+
footer,
|
|
130
|
+
/* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__foot-spacer", "aria-hidden": "true" }),
|
|
131
|
+
dropped !== "" && /* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__note", children: labels.hiddenToFit(dropped) }),
|
|
132
|
+
loadedNote && /* @__PURE__ */ jsx("span", { className: "crewlet-data-grid__note", children: loadedNote }),
|
|
133
|
+
onLoadMore && /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", onClick: onLoadMore, children: labels.loadMore })
|
|
134
|
+
] })
|
|
135
|
+
) }),
|
|
136
|
+
onReset && /* @__PURE__ */ jsx("div", { role: table ? "row" : void 0, className: "crewlet-data-grid__reset", children: cell(
|
|
137
|
+
"crewlet-data-grid__reset-cell",
|
|
138
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "crewlet-data-grid__cols-reset", onClick: onReset, children: labels.showEveryColumn })
|
|
139
|
+
) })
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
var CUT = ".crewlet-data-grid__truncate, .crewlet-table-cell__truncate, .crewlet-text--truncate";
|
|
143
|
+
function titleBeneath(link, x, y) {
|
|
144
|
+
const row = link.closest('[role="row"]');
|
|
145
|
+
if (!row || typeof document.elementsFromPoint !== "function") return null;
|
|
146
|
+
const under = document.elementsFromPoint(x, y).find((el) => el !== link && row.contains(el) && el !== row);
|
|
147
|
+
if (!under) return null;
|
|
148
|
+
const titled = under.closest("[title]");
|
|
149
|
+
const own = titled && row.contains(titled) && titled !== row ? titled : null;
|
|
150
|
+
if (own && !own.matches(CUT)) return own.getAttribute("title");
|
|
151
|
+
const cut = under.closest(CUT);
|
|
152
|
+
if (cut && row.contains(cut)) {
|
|
153
|
+
titleIfCut(cut);
|
|
154
|
+
return cut.getAttribute("title");
|
|
155
|
+
}
|
|
156
|
+
return own?.getAttribute("title") ?? null;
|
|
157
|
+
}
|
|
158
|
+
var rowLinkTitle = {
|
|
159
|
+
onMouseMove: (event) => {
|
|
160
|
+
const title = titleBeneath(event.currentTarget, event.clientX, event.clientY);
|
|
161
|
+
if (title) event.currentTarget.setAttribute("title", title);
|
|
162
|
+
else event.currentTarget.removeAttribute("title");
|
|
163
|
+
},
|
|
164
|
+
onMouseLeave: (event) => event.currentTarget.removeAttribute("title")
|
|
165
|
+
};
|
|
166
|
+
var SQUEEZE_SAMPLE_ROWS = 12;
|
|
167
|
+
function overrunning(box, head) {
|
|
168
|
+
const last = head?.lastElementChild;
|
|
169
|
+
if (!last) return false;
|
|
170
|
+
const inner = box.getBoundingClientRect().left + box.clientLeft + box.clientWidth;
|
|
171
|
+
return last.getBoundingClientRect().right > inner + 0.5;
|
|
172
|
+
}
|
|
173
|
+
function cutShort(el) {
|
|
174
|
+
for (const node of [el, ...el.querySelectorAll("*")]) {
|
|
175
|
+
const box = node;
|
|
176
|
+
if (box.clientWidth > 1 && box.scrollWidth > box.clientWidth + 1) return true;
|
|
177
|
+
}
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
function squeezedCells(width, heads, rows, cellsOf, visible, leading = 0) {
|
|
181
|
+
const cap = width * SHRINK_SHARE - 1;
|
|
182
|
+
const sample = rows.slice(0, SQUEEZE_SAMPLE_ROWS);
|
|
183
|
+
let headCut = false;
|
|
184
|
+
for (let i = 0; i < visible.length; i++) {
|
|
185
|
+
const column = visible[i];
|
|
186
|
+
if (!column.shrink || column.width || column.icon) continue;
|
|
187
|
+
const head = heads[i + leading];
|
|
188
|
+
if (!head || head.getBoundingClientRect().width >= cap) continue;
|
|
189
|
+
if (cutShort(head)) headCut = true;
|
|
190
|
+
for (const row of sample) {
|
|
191
|
+
const cell = cellsOf(row)[i + leading];
|
|
192
|
+
if (cell && cutShort(cell)) return "values";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return headCut ? "heads" : null;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export { GRID_FOOT_LABELS, GRID_ICON_TRACK, GridFoot, GridHeadCell, SHORT_COLUMN_PX, alignOf, droppedNames, headerWord, nextGridSort, overrunning, parseGridSort, rowLinkTitle, sortByValue, squeezedCells, tableTrack };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useReorder } from './chunk-
|
|
1
|
+
import { useReorder } from './chunk-NIOE6ZAL.js';
|
|
2
|
+
import { Input } from './chunk-GTAAOGDQ.js';
|
|
2
3
|
import { Menu } from './chunk-ZMZNKDPO.js';
|
|
3
|
-
import { Input } from './chunk-XQMRSL7Z.js';
|
|
4
4
|
import { IconButton } from './chunk-KM5OKCW6.js';
|
|
5
5
|
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
6
6
|
import { cx } from './chunk-ODEQTPFM.js';
|