strata-react 1.0.11 → 1.0.15
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 +9 -3
- package/UPGRADING.md +5 -0
- package/dist/components/button.d.ts +6 -3
- package/dist/components/checkbox.d.ts +11 -0
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/density.d.ts +16 -0
- package/dist/components/field.d.ts +9 -4
- package/dist/components/history.d.ts +61 -0
- package/dist/components/save.d.ts +46 -0
- package/dist/components/selectable-grid.d.ts +1 -1
- package/dist/components/selection.d.ts +1 -0
- package/dist/components/theme.d.ts +7 -1
- package/dist/components/value-controls.d.ts +4 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +800 -430
- package/dist/index.js.map +1 -1
- package/dist/lib/control.d.ts +4 -0
- package/dist/{query-CXlmWmrY.js → query-CIh1Dpgn.js} +43 -11
- package/dist/query-CIh1Dpgn.js.map +1 -0
- package/dist/strata.css +7 -1
- package/dist/testing.js +1 -1
- package/dist/testing.js.map +1 -1
- package/package.json +1 -2
- package/dist/query-CXlmWmrY.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as describeHttpError, D as cn, E as Tooltip, O as typeSteps, S as describeActionError, T as readErrorBody, _ as NativeSelect, a as toLoad, b as controlHeight, c as ColorSchemeChoice, d as useColorScheme, f as useSystemColorScheme, g as Input, h as Field, i as staleOf, l as ThemeProvider, m as ChoiceGroup, n as createQueryClient, o as useLoad, p as Density, r as fetchJson, s as COLOR_SCHEME_STORAGE_KEY, t as StrataQueryProvider, u as colorSchemeScript, v as Textarea, w as fieldErrorsOf, x as HttpError, y as useFieldControl } from "./query-CIh1Dpgn.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { Autocomplete, Button as Button$1, Checkbox as Checkbox$1, Collection, Dialog as Dialog$1, DialogTrigger, Disclosure as Disclosure$1, DisclosurePanel, DropIndicator, DropZone, FileTrigger, GridList, GridListItem, Header, Heading, I18nProvider, Input as Input$1, Keyboard, ListLayout, ListStateContext, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, NumberField as NumberField$1, Popover as Popover$1, SearchField, Separator, Slider as Slider$1, SliderOutput, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Toolbar as Toolbar$1, UNSTABLE_Toast, UNSTABLE_ToastContent, UNSTABLE_ToastQueue, UNSTABLE_ToastRegion, Virtualizer, useDragAndDrop, useFilter } from "react-aria-components";
|
|
3
|
+
import { Autocomplete, Button as Button$1, Cell, Checkbox as Checkbox$1, Collection, Column, Dialog as Dialog$1, DialogTrigger, Disclosure as Disclosure$1, DisclosurePanel, DropIndicator, DropZone, FileTrigger, GridLayout, GridList, GridListItem, Header, Heading, I18nProvider, Input as Input$1, Keyboard, ListLayout, ListStateContext, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, NumberField as NumberField$1, Popover as Popover$1, Row, SearchField, Separator, Slider as Slider$1, SliderOutput, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Table, TableBody, TableHeader, TableLayout, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Toolbar as Toolbar$1, UNSTABLE_Toast, UNSTABLE_ToastContent, UNSTABLE_ToastQueue, UNSTABLE_ToastRegion, Virtualizer, useDragAndDrop, useFilter } from "react-aria-components";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronRight, CircleAlert, CircleCheck, FileQuestion, GripVertical, History, ImageOff, Info, Loader, LoaderCircle, Maximize, Maximize2, Minimize, Minus, Pause, Play, RotateCcw, Scan, Search, SkipBack, SkipForward, Square, StepBack, StepForward, Trash2, TriangleAlert, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
|
|
6
|
+
import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronRight, CircleAlert, CircleCheck, FileQuestion, GripVertical, History, ImageOff, Info, Loader, LoaderCircle, Maximize, Maximize2, Minimize, Minus, Pause, Play, Redo2, RotateCcw, Scan, Search, SkipBack, SkipForward, Square, StepBack, StepForward, Trash2, TriangleAlert, Undo2, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
|
|
7
7
|
import { Link, NavLink, useSearchParams } from "react-router";
|
|
8
8
|
import { createSortedRowModel, flexRender, rowSortingFeature, tableFeatures, useTable } from "@tanstack/react-table";
|
|
9
|
-
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
10
9
|
import { VisuallyHidden, mergeProps, useFocusRing, useSlider, useSliderThumb } from "react-aria";
|
|
11
|
-
import { useSliderState } from "react-stately";
|
|
10
|
+
import { Size, useSliderState } from "react-stately";
|
|
12
11
|
import { hashKey, useInfiniteQuery, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
13
12
|
import pixelmatch from "pixelmatch";
|
|
14
13
|
// src/lib/format.ts
|
|
@@ -234,7 +233,7 @@ function useInView({ active = true, rootMargin = "0px", once = false, unsupporte
|
|
|
234
233
|
};
|
|
235
234
|
}
|
|
236
235
|
// src/components/button.tsx
|
|
237
|
-
var buttonVariants = cva("inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control type-label transition-state press disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
236
|
+
var buttonVariants = cva("inline-flex max-w-full shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control type-label transition-state press disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
238
237
|
variants: {
|
|
239
238
|
variant: {
|
|
240
239
|
default: "bg-primary text-primary-foreground hover:bg-primary-10",
|
|
@@ -247,7 +246,8 @@ var buttonVariants = cva("inline-flex shrink-0 cursor-pointer items-center justi
|
|
|
247
246
|
size: {
|
|
248
247
|
default: "h-(--control-h) px-4",
|
|
249
248
|
sm: "h-(--control-h-sm) px-3",
|
|
250
|
-
icon: "size-(--control-h)"
|
|
249
|
+
icon: "size-(--control-h)",
|
|
250
|
+
"icon-sm": "size-(--control-h-sm)"
|
|
251
251
|
}
|
|
252
252
|
},
|
|
253
253
|
defaultVariants: {
|
|
@@ -261,7 +261,7 @@ var buttonVariants = cva("inline-flex shrink-0 cursor-pointer items-center justi
|
|
|
261
261
|
* `outline`; ask for the filled accent (`variant="default"`) once per view. `type` defaults to `button`.
|
|
262
262
|
* `onClick` and `disabled` are the DOM names and keep working; `onPress` is also accepted.
|
|
263
263
|
*/
|
|
264
|
-
function Button({ className, variant, size, type = "button", disabled, ...props }) {
|
|
264
|
+
function Button({ className, variant, size, type = "button", disabled, children, ...props }) {
|
|
265
265
|
return /* @__PURE__ */ jsx(Button$1, {
|
|
266
266
|
type,
|
|
267
267
|
isDisabled: disabled,
|
|
@@ -270,16 +270,20 @@ function Button({ className, variant, size, type = "button", disabled, ...props
|
|
|
270
270
|
variant,
|
|
271
271
|
size
|
|
272
272
|
}), className),
|
|
273
|
-
...props
|
|
273
|
+
...props,
|
|
274
|
+
children: typeof children === "string" ? /* @__PURE__ */ jsx("span", {
|
|
275
|
+
className: "min-w-0 truncate",
|
|
276
|
+
children
|
|
277
|
+
}) : children
|
|
274
278
|
});
|
|
275
279
|
}
|
|
276
280
|
/** An icon-only button. `label` is required and becomes the accessible name and the tooltip (hover and keyboard focus); `hint` adds a muted aside to it, such as a shortcut. */
|
|
277
|
-
function IconButton({ icon: Icon, label, hint, variant = "ghost", ...props }) {
|
|
281
|
+
function IconButton({ icon: Icon, label, hint, variant = "ghost", size = "default", ...props }) {
|
|
278
282
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
279
283
|
label,
|
|
280
284
|
hint,
|
|
281
285
|
children: /* @__PURE__ */ jsx(Button, {
|
|
282
|
-
size: "icon",
|
|
286
|
+
size: size === "sm" ? "icon-sm" : "icon",
|
|
283
287
|
variant,
|
|
284
288
|
"aria-label": label,
|
|
285
289
|
...props,
|
|
@@ -926,14 +930,47 @@ var sizes = {
|
|
|
926
930
|
md: "max-w-lg",
|
|
927
931
|
lg: "max-w-3xl"
|
|
928
932
|
};
|
|
933
|
+
function Overlay({ trigger, open, onOpenChange, children }) {
|
|
934
|
+
if (trigger) return /* @__PURE__ */ jsxs(DialogTrigger, {
|
|
935
|
+
isOpen: open,
|
|
936
|
+
onOpenChange,
|
|
937
|
+
children: [trigger, children]
|
|
938
|
+
});
|
|
939
|
+
return /* @__PURE__ */ jsx(Driven, {
|
|
940
|
+
open,
|
|
941
|
+
onOpenChange,
|
|
942
|
+
children
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
function Driven({ open, onOpenChange, children }) {
|
|
946
|
+
const opener = React.useRef(null);
|
|
947
|
+
const wasOpen = React.useRef(false);
|
|
948
|
+
if (open && !wasOpen.current) opener.current = typeof document === "undefined" ? null : document.activeElement;
|
|
949
|
+
wasOpen.current = Boolean(open);
|
|
950
|
+
React.useEffect(() => {
|
|
951
|
+
if (!open) return;
|
|
952
|
+
return () => {
|
|
953
|
+
const back = opener.current;
|
|
954
|
+
opener.current = null;
|
|
955
|
+
requestAnimationFrame(() => {
|
|
956
|
+
if ((!document.activeElement || document.activeElement === document.body) && back instanceof HTMLElement && back.isConnected) back.focus();
|
|
957
|
+
});
|
|
958
|
+
};
|
|
959
|
+
}, [open]);
|
|
960
|
+
return React.cloneElement(children, {
|
|
961
|
+
isOpen: open,
|
|
962
|
+
onOpenChange
|
|
963
|
+
});
|
|
964
|
+
}
|
|
929
965
|
var overlayClass = "layer-overlay fixed inset-0 grid overflow-hidden bg-foreground/40";
|
|
930
966
|
/** A modal dialog with a required title; focus goes in and returns, Escape and a close control dismiss it. `placement="end"` makes it a sheet. */
|
|
931
967
|
function Dialog({ title, description, trigger, open, onOpenChange, className, children, actions, hideTitle, closable = true, placement = "center", size = "md" }) {
|
|
932
968
|
const descriptionId = React.useId();
|
|
933
|
-
return /* @__PURE__ */
|
|
934
|
-
|
|
969
|
+
return /* @__PURE__ */ jsx(Overlay, {
|
|
970
|
+
trigger,
|
|
971
|
+
open,
|
|
935
972
|
onOpenChange,
|
|
936
|
-
children:
|
|
973
|
+
children: /* @__PURE__ */ jsx(ModalOverlay, {
|
|
937
974
|
isDismissable: closable,
|
|
938
975
|
isKeyboardDismissDisabled: !closable,
|
|
939
976
|
className: cn(overlayClass, placement === "end" ? "justify-items-end" : "place-items-center p-4"),
|
|
@@ -974,7 +1011,7 @@ function Dialog({ title, description, trigger, open, onOpenChange, className, ch
|
|
|
974
1011
|
] })
|
|
975
1012
|
})
|
|
976
1013
|
})
|
|
977
|
-
})
|
|
1014
|
+
})
|
|
978
1015
|
});
|
|
979
1016
|
}
|
|
980
1017
|
/**
|
|
@@ -1007,10 +1044,11 @@ function AlertDialog({ title, description, trigger, open, onOpenChange, classNam
|
|
|
1007
1044
|
setError(describeActionError(thrown) ?? "That did not go through. Nothing was confirmed; try again.");
|
|
1008
1045
|
}
|
|
1009
1046
|
};
|
|
1010
|
-
return /* @__PURE__ */
|
|
1011
|
-
|
|
1047
|
+
return /* @__PURE__ */ jsx(Overlay, {
|
|
1048
|
+
trigger,
|
|
1049
|
+
open: isOpen,
|
|
1012
1050
|
onOpenChange: change,
|
|
1013
|
-
children:
|
|
1051
|
+
children: /* @__PURE__ */ jsx(ModalOverlay, {
|
|
1014
1052
|
isDismissable: false,
|
|
1015
1053
|
isKeyboardDismissDisabled: busy,
|
|
1016
1054
|
className: cn(overlayClass, "place-items-center p-4"),
|
|
@@ -1055,7 +1093,7 @@ function AlertDialog({ title, description, trigger, open, onOpenChange, classNam
|
|
|
1055
1093
|
})] })
|
|
1056
1094
|
})
|
|
1057
1095
|
})
|
|
1058
|
-
})
|
|
1096
|
+
})
|
|
1059
1097
|
});
|
|
1060
1098
|
}
|
|
1061
1099
|
// src/components/popover.tsx
|
|
@@ -1099,16 +1137,10 @@ function Checkbox({ label, hideLabel = false, detail, checked, onCheckedChange,
|
|
|
1099
1137
|
"aria-label": hideLabel ? label : void 0,
|
|
1100
1138
|
...props,
|
|
1101
1139
|
className: cn("group inline-flex min-h-6 min-w-6 items-start gap-3", hideLabel && "items-center justify-center", disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer", className),
|
|
1102
|
-
children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
className: "size-3.5",
|
|
1107
|
-
strokeWidth: 3
|
|
1108
|
-
}) : isSelected ? /* @__PURE__ */ jsx(Check, {
|
|
1109
|
-
className: "size-3.5",
|
|
1110
|
-
strokeWidth: 3
|
|
1111
|
-
}) : null
|
|
1140
|
+
children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CheckboxBox, {
|
|
1141
|
+
selected: isSelected,
|
|
1142
|
+
indeterminate: isIndeterminate,
|
|
1143
|
+
hideLabel
|
|
1112
1144
|
}), !hideLabel && /* @__PURE__ */ jsxs("span", {
|
|
1113
1145
|
className: "grid",
|
|
1114
1146
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -1137,6 +1169,41 @@ function useShiftNote() {
|
|
|
1137
1169
|
}
|
|
1138
1170
|
}), []);
|
|
1139
1171
|
}
|
|
1172
|
+
function CheckboxBox({ selected, indeterminate, hideLabel }) {
|
|
1173
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1174
|
+
"aria-hidden": true,
|
|
1175
|
+
className: cn("grid size-4.5 shrink-0 place-items-center rounded-control border border-input bg-background transition-state", "group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-ring", (selected || indeterminate) && "border-primary bg-primary text-primary-foreground", !hideLabel && "mt-0.5"),
|
|
1176
|
+
children: indeterminate ? /* @__PURE__ */ jsx(Minus, {
|
|
1177
|
+
className: "size-3.5",
|
|
1178
|
+
strokeWidth: 3
|
|
1179
|
+
}) : selected ? /* @__PURE__ */ jsx(Check, {
|
|
1180
|
+
className: "size-3.5",
|
|
1181
|
+
strokeWidth: 3
|
|
1182
|
+
}) : null
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* The checkbox of a React Aria `Table` row or header (`slot="selection"`): its checked, mixed and
|
|
1187
|
+
* disabled state come from the table, so it takes only a name. A `Checkbox` is controlled and would
|
|
1188
|
+
* fight the table's own selection state. Not exported from the package: `DataTable` uses it.
|
|
1189
|
+
* @internal
|
|
1190
|
+
*/
|
|
1191
|
+
function TableSelectionCheckbox({ label, className, disabled }) {
|
|
1192
|
+
const id = React.useId();
|
|
1193
|
+
return /* @__PURE__ */ jsx(Checkbox$1, {
|
|
1194
|
+
slot: "selection",
|
|
1195
|
+
isDisabled: disabled,
|
|
1196
|
+
id,
|
|
1197
|
+
"aria-labelledby": id,
|
|
1198
|
+
"aria-label": label,
|
|
1199
|
+
className: ({ isDisabled }) => cn("group inline-flex min-h-6 min-w-6 items-center justify-center", isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer", className),
|
|
1200
|
+
children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsx(CheckboxBox, {
|
|
1201
|
+
selected: isSelected,
|
|
1202
|
+
indeterminate: isIndeterminate,
|
|
1203
|
+
hideLabel: true
|
|
1204
|
+
})
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1140
1207
|
// src/components/async-button.tsx
|
|
1141
1208
|
/** One button through idle, pending, done and error, with the label changing in place and its width fixed by the longest label. The outcome is announced politely, with the error's own words when `error` is given. */
|
|
1142
1209
|
function AsyncButton({ phase, labels, error, disabled, ...props }) {
|
|
@@ -1699,7 +1766,7 @@ function contrastRatio(a, b) {
|
|
|
1699
1766
|
return (hi + .05) / (lo + .05);
|
|
1700
1767
|
}
|
|
1701
1768
|
// src/components/value-controls.tsx
|
|
1702
|
-
var box = "flex
|
|
1769
|
+
var box = "flex w-full min-w-0 items-center rounded-control border border-input bg-background px-3 type-body text-foreground transition-state disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-70 has-[input:disabled]:cursor-not-allowed has-[input:disabled]:bg-muted has-[input:disabled]:opacity-70 aria-invalid:border-danger has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-ring";
|
|
1703
1770
|
/** A number with its unit joined by a non-breaking space; `%` and `°` stay attached. */
|
|
1704
1771
|
function withUnit(text, unit) {
|
|
1705
1772
|
if (!unit) return text;
|
|
@@ -1752,7 +1819,7 @@ function describeRange(min, max, show, unit) {
|
|
|
1752
1819
|
return "Enter a number.";
|
|
1753
1820
|
}
|
|
1754
1821
|
/** A number with a unit on React Aria's number field: typed input is validated, not clamped, so an out-of-range value is explained in the surrounding `Field` and never passed on; empty stays `null`. */
|
|
1755
|
-
function NumberField({ value, onChange, min, max, step = 1, places, unit, locale = format.locale, required = false, disabled, id: idProp, name, className, "aria-label": ariaLabel }) {
|
|
1822
|
+
function NumberField({ value, onChange, min, max, step = 1, places, unit, locale = format.locale, required = false, disabled, id: idProp, name, size = "default", className, "aria-label": ariaLabel }) {
|
|
1756
1823
|
const { field, report } = useFieldControl();
|
|
1757
1824
|
const digits = places ?? Math.max(decimalsOf(step), min === void 0 ? 0 : decimalsOf(min));
|
|
1758
1825
|
const show = useNumberText(locale, digits);
|
|
@@ -1802,7 +1869,7 @@ function NumberField({ value, onChange, min, max, step = 1, places, unit, locale
|
|
|
1802
1869
|
isInvalid: invalid || void 0,
|
|
1803
1870
|
name,
|
|
1804
1871
|
"aria-label": ariaLabel ?? field?.label,
|
|
1805
|
-
className: cn(box, className),
|
|
1872
|
+
className: cn(box, controlHeight[size], className),
|
|
1806
1873
|
children: [/* @__PURE__ */ jsx(Input$1, {
|
|
1807
1874
|
id: idProp ?? field?.id,
|
|
1808
1875
|
placeholder: format.missing,
|
|
@@ -1880,6 +1947,8 @@ function Slider({ value, onChange, min, max, step = 1, unit, locale = format.loc
|
|
|
1880
1947
|
/** Choose a colour with the platform picker, see and type its hex value, pick from the app's suggestions, and get a note when it would be hard to see on `against`. A half-typed value is never passed on. */
|
|
1881
1948
|
function ColorField({ value, onChange, suggestions, against, againstLabel = "the background", minContrast = 3, disabled, id: idProp, className, "aria-label": ariaLabel }) {
|
|
1882
1949
|
const { field, report } = useFieldControl();
|
|
1950
|
+
const label = ariaLabel ?? field?.label;
|
|
1951
|
+
const pickerName = label ? `${label}, picker` : "Colour picker";
|
|
1883
1952
|
const [draft, setDraft] = React.useState(null);
|
|
1884
1953
|
const [own, setOwn] = React.useState(false);
|
|
1885
1954
|
const text = draft ?? value ?? "";
|
|
@@ -1913,7 +1982,7 @@ function ColorField({ value, onChange, suggestions, against, againstLabel = "the
|
|
|
1913
1982
|
className: cn("grid min-w-0 gap-2", className),
|
|
1914
1983
|
children: [
|
|
1915
1984
|
/* @__PURE__ */ jsxs("div", {
|
|
1916
|
-
className: cn(box, "gap-2 px-2"),
|
|
1985
|
+
className: cn(box, controlHeight.default, "gap-2 px-2"),
|
|
1917
1986
|
"aria-invalid": invalid || void 0,
|
|
1918
1987
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
1919
1988
|
className: "relative size-6 shrink-0 overflow-hidden rounded-control border border-input",
|
|
@@ -1923,7 +1992,7 @@ function ColorField({ value, onChange, suggestions, against, againstLabel = "the
|
|
|
1923
1992
|
style: value ? { background: value } : void 0
|
|
1924
1993
|
}), /* @__PURE__ */ jsx("input", {
|
|
1925
1994
|
type: "color",
|
|
1926
|
-
"aria-label":
|
|
1995
|
+
"aria-label": pickerName,
|
|
1927
1996
|
value: value ?? "#000000",
|
|
1928
1997
|
disabled,
|
|
1929
1998
|
onChange: (e) => pick(e.target.value),
|
|
@@ -2345,90 +2414,6 @@ function ThumbnailSkeleton({ aspect = 1, className }) {
|
|
|
2345
2414
|
children: /* @__PURE__ */ jsx(Skeleton, { className: "absolute inset-0" })
|
|
2346
2415
|
});
|
|
2347
2416
|
}
|
|
2348
|
-
// src/components/disclosure.tsx
|
|
2349
|
-
/** Shows more of one thing in place: a button with `aria-expanded` around `summary`, and a body mounted only while open (so a request inside it runs on first open). Controlled with `open`/`onOpenChange` or `useExpanded`, or uncontrolled with `defaultOpen`. */
|
|
2350
|
-
function Disclosure({ summary, children, actions, open, defaultOpen = false, onOpenChange, className }) {
|
|
2351
|
-
const [own, setOwn] = React.useState(defaultOpen);
|
|
2352
|
-
const isOpen = open ?? own;
|
|
2353
|
-
const bodyId = React.useId();
|
|
2354
|
-
const toggle = () => {
|
|
2355
|
-
if (open === void 0) setOwn(!isOpen);
|
|
2356
|
-
onOpenChange?.(!isOpen);
|
|
2357
|
-
};
|
|
2358
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
2359
|
-
className: cn("min-w-0", className),
|
|
2360
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
2361
|
-
className: "flex items-center gap-3",
|
|
2362
|
-
children: [/* @__PURE__ */ jsxs("button", {
|
|
2363
|
-
type: "button",
|
|
2364
|
-
"aria-expanded": isOpen,
|
|
2365
|
-
"aria-controls": isOpen ? bodyId : void 0,
|
|
2366
|
-
onClick: toggle,
|
|
2367
|
-
className: "-mx-1 flex min-h-(--control-h-sm) min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-control px-1 text-left hover:bg-muted",
|
|
2368
|
-
children: [/* @__PURE__ */ jsx(Chevron, { open: isOpen }), /* @__PURE__ */ jsx("span", {
|
|
2369
|
-
className: "min-w-0 flex-1",
|
|
2370
|
-
children: summary
|
|
2371
|
-
})]
|
|
2372
|
-
}), actions && /* @__PURE__ */ jsx("div", {
|
|
2373
|
-
className: "flex shrink-0 items-center gap-2",
|
|
2374
|
-
children: actions
|
|
2375
|
-
})]
|
|
2376
|
-
}), isOpen && /* @__PURE__ */ jsx("div", {
|
|
2377
|
-
id: bodyId,
|
|
2378
|
-
className: "pt-2 pb-3 pl-6",
|
|
2379
|
-
children
|
|
2380
|
-
})]
|
|
2381
|
-
});
|
|
2382
|
-
}
|
|
2383
|
-
/** The disclosure chevron: points right when closed, down when open. Shared with `DataTable`'s row toggle. */
|
|
2384
|
-
function Chevron({ open, className }) {
|
|
2385
|
-
return /* @__PURE__ */ jsx(ChevronRight, {
|
|
2386
|
-
"aria-hidden": true,
|
|
2387
|
-
className: cn("size-4 shrink-0 text-muted-foreground", open && "rotate-90", className)
|
|
2388
|
-
});
|
|
2389
|
-
}
|
|
2390
|
-
/** Shared open state for the disclosures of one list or table, optionally kept in the URL (`param`). */
|
|
2391
|
-
function useExpanded(options = {}) {
|
|
2392
|
-
return options.param ? useUrlExpanded(options.param, options) : useLocalExpanded(options);
|
|
2393
|
-
}
|
|
2394
|
-
function api(expanded, set, single) {
|
|
2395
|
-
return {
|
|
2396
|
-
expanded,
|
|
2397
|
-
onChange: (next) => {
|
|
2398
|
-
const opened = single ? [...next].filter((k) => !expanded.has(k)) : [];
|
|
2399
|
-
set(opened.length ? /* @__PURE__ */ new Set([opened[opened.length - 1]]) : next);
|
|
2400
|
-
},
|
|
2401
|
-
isOpen: (key) => expanded.has(key),
|
|
2402
|
-
setOpen: (key, open) => {
|
|
2403
|
-
const next = single ? /* @__PURE__ */ new Set() : new Set(expanded);
|
|
2404
|
-
if (open) next.add(key);
|
|
2405
|
-
else next.delete(key);
|
|
2406
|
-
set(next);
|
|
2407
|
-
},
|
|
2408
|
-
collapseAll: () => set(/* @__PURE__ */ new Set())
|
|
2409
|
-
};
|
|
2410
|
-
}
|
|
2411
|
-
function useLocalExpanded({ initial = [], single }) {
|
|
2412
|
-
const [expanded, setExpanded] = React.useState(() => new Set(initial));
|
|
2413
|
-
return React.useMemo(() => api(expanded, setExpanded, single), [expanded, single]);
|
|
2414
|
-
}
|
|
2415
|
-
function useUrlExpanded(param, { single }) {
|
|
2416
|
-
const [params, setParams] = useSearchParams();
|
|
2417
|
-
const fromUrl = params.getAll(param);
|
|
2418
|
-
const joined = fromUrl.join("\0");
|
|
2419
|
-
const expanded = React.useMemo(() => new Set(fromUrl), [joined]);
|
|
2420
|
-
const set = React.useCallback((next) => setParams((p) => {
|
|
2421
|
-
const out = new URLSearchParams(p);
|
|
2422
|
-
out.delete(param);
|
|
2423
|
-
for (const k of next) out.append(param, k);
|
|
2424
|
-
return out;
|
|
2425
|
-
}, { replace: true }), [param, setParams]);
|
|
2426
|
-
return React.useMemo(() => api(expanded, set, single), [
|
|
2427
|
-
expanded,
|
|
2428
|
-
set,
|
|
2429
|
-
single
|
|
2430
|
-
]);
|
|
2431
|
-
}
|
|
2432
2417
|
// src/components/selection.tsx
|
|
2433
2418
|
function reconcile(prev, rows, keys, initial) {
|
|
2434
2419
|
const present = new Set(keys);
|
|
@@ -2537,8 +2522,12 @@ function useSelectRows(rows, rowKey, selection) {
|
|
|
2537
2522
|
else keys.forEach((k) => next.delete(k));
|
|
2538
2523
|
selection.onChange(next);
|
|
2539
2524
|
};
|
|
2525
|
+
const setAnchor = (key) => {
|
|
2526
|
+
if (key !== null) anchor.current = key;
|
|
2527
|
+
};
|
|
2540
2528
|
return {
|
|
2541
2529
|
toggle,
|
|
2530
|
+
setAnchor,
|
|
2542
2531
|
all: {
|
|
2543
2532
|
checked: allChecked,
|
|
2544
2533
|
toggle: toggleAll,
|
|
@@ -2570,6 +2559,90 @@ function BulkBar({ count, noun, onClear, children, format: format$1 = format, cl
|
|
|
2570
2559
|
})]
|
|
2571
2560
|
});
|
|
2572
2561
|
}
|
|
2562
|
+
// src/components/disclosure.tsx
|
|
2563
|
+
/** Shows more of one thing in place: a button with `aria-expanded` around `summary`, and a body mounted only while open (so a request inside it runs on first open). Controlled with `open`/`onOpenChange` or `useExpanded`, or uncontrolled with `defaultOpen`. */
|
|
2564
|
+
function Disclosure({ summary, children, actions, open, defaultOpen = false, onOpenChange, className }) {
|
|
2565
|
+
const [own, setOwn] = React.useState(defaultOpen);
|
|
2566
|
+
const isOpen = open ?? own;
|
|
2567
|
+
const bodyId = React.useId();
|
|
2568
|
+
const toggle = () => {
|
|
2569
|
+
if (open === void 0) setOwn(!isOpen);
|
|
2570
|
+
onOpenChange?.(!isOpen);
|
|
2571
|
+
};
|
|
2572
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2573
|
+
className: cn("min-w-0", className),
|
|
2574
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2575
|
+
className: "flex items-center gap-3",
|
|
2576
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
2577
|
+
type: "button",
|
|
2578
|
+
"aria-expanded": isOpen,
|
|
2579
|
+
"aria-controls": isOpen ? bodyId : void 0,
|
|
2580
|
+
onClick: toggle,
|
|
2581
|
+
className: "-mx-1 flex min-h-(--control-h-sm) min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-control px-1 text-left hover:bg-muted",
|
|
2582
|
+
children: [/* @__PURE__ */ jsx(Chevron, { open: isOpen }), /* @__PURE__ */ jsx("span", {
|
|
2583
|
+
className: "min-w-0 flex-1",
|
|
2584
|
+
children: summary
|
|
2585
|
+
})]
|
|
2586
|
+
}), actions && /* @__PURE__ */ jsx("div", {
|
|
2587
|
+
className: "flex shrink-0 items-center gap-2",
|
|
2588
|
+
children: actions
|
|
2589
|
+
})]
|
|
2590
|
+
}), isOpen && /* @__PURE__ */ jsx("div", {
|
|
2591
|
+
id: bodyId,
|
|
2592
|
+
className: "pt-2 pb-3 pl-6",
|
|
2593
|
+
children
|
|
2594
|
+
})]
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2597
|
+
/** The disclosure chevron: points right when closed, down when open. Shared with `DataTable`'s row toggle. */
|
|
2598
|
+
function Chevron({ open, className }) {
|
|
2599
|
+
return /* @__PURE__ */ jsx(ChevronRight, {
|
|
2600
|
+
"aria-hidden": true,
|
|
2601
|
+
className: cn("size-4 shrink-0 text-muted-foreground", open && "rotate-90", className)
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2604
|
+
/** Shared open state for the disclosures of one list or table, optionally kept in the URL (`param`). */
|
|
2605
|
+
function useExpanded(options = {}) {
|
|
2606
|
+
return options.param ? useUrlExpanded(options.param, options) : useLocalExpanded(options);
|
|
2607
|
+
}
|
|
2608
|
+
function api(expanded, set, single) {
|
|
2609
|
+
return {
|
|
2610
|
+
expanded,
|
|
2611
|
+
onChange: (next) => {
|
|
2612
|
+
const opened = single ? [...next].filter((k) => !expanded.has(k)) : [];
|
|
2613
|
+
set(opened.length ? /* @__PURE__ */ new Set([opened[opened.length - 1]]) : next);
|
|
2614
|
+
},
|
|
2615
|
+
isOpen: (key) => expanded.has(key),
|
|
2616
|
+
setOpen: (key, open) => {
|
|
2617
|
+
const next = single ? /* @__PURE__ */ new Set() : new Set(expanded);
|
|
2618
|
+
if (open) next.add(key);
|
|
2619
|
+
else next.delete(key);
|
|
2620
|
+
set(next);
|
|
2621
|
+
},
|
|
2622
|
+
collapseAll: () => set(/* @__PURE__ */ new Set())
|
|
2623
|
+
};
|
|
2624
|
+
}
|
|
2625
|
+
function useLocalExpanded({ initial = [], single }) {
|
|
2626
|
+
const [expanded, setExpanded] = React.useState(() => new Set(initial));
|
|
2627
|
+
return React.useMemo(() => api(expanded, setExpanded, single), [expanded, single]);
|
|
2628
|
+
}
|
|
2629
|
+
function useUrlExpanded(param, { single }) {
|
|
2630
|
+
const [params, setParams] = useSearchParams();
|
|
2631
|
+
const fromUrl = params.getAll(param);
|
|
2632
|
+
const joined = fromUrl.join("\0");
|
|
2633
|
+
const expanded = React.useMemo(() => new Set(fromUrl), [joined]);
|
|
2634
|
+
const set = React.useCallback((next) => setParams((p) => {
|
|
2635
|
+
const out = new URLSearchParams(p);
|
|
2636
|
+
out.delete(param);
|
|
2637
|
+
for (const k of next) out.append(param, k);
|
|
2638
|
+
return out;
|
|
2639
|
+
}, { replace: true }), [param, setParams]);
|
|
2640
|
+
return React.useMemo(() => api(expanded, set, single), [
|
|
2641
|
+
expanded,
|
|
2642
|
+
set,
|
|
2643
|
+
single
|
|
2644
|
+
]);
|
|
2645
|
+
}
|
|
2573
2646
|
// src/components/data-table.tsx
|
|
2574
2647
|
var collator = new Intl.Collator(void 0, {
|
|
2575
2648
|
numeric: true,
|
|
@@ -2627,7 +2700,7 @@ function useUrlSort(param, initial) {
|
|
|
2627
2700
|
return out;
|
|
2628
2701
|
}, { replace: true }), [param, setParams])];
|
|
2629
2702
|
}
|
|
2630
|
-
/** A table on TanStack Table: muted headers, row rules, right-aligned tabular numbers, sortable headers with `aria-sort`, virtualised from `virtualizeFrom` rows, sort optionally kept in the URL (`sortParam`). */
|
|
2703
|
+
/** A table on React Aria's Table with TanStack Table's data model: muted headers, row rules, right-aligned tabular numbers, sortable headers with `aria-sort`, virtualised from `virtualizeFrom` rows, sort optionally kept in the URL (`sortParam`). */
|
|
2631
2704
|
function DataTable(props) {
|
|
2632
2705
|
return props.sortParam ? /* @__PURE__ */ jsx(UrlSortedTable, {
|
|
2633
2706
|
...props,
|
|
@@ -2635,13 +2708,13 @@ function DataTable(props) {
|
|
|
2635
2708
|
}) : /* @__PURE__ */ jsx(LocalSortedTable, { ...props });
|
|
2636
2709
|
}
|
|
2637
2710
|
function LocalSortedTable(props) {
|
|
2638
|
-
return /* @__PURE__ */ jsx(Table, {
|
|
2711
|
+
return /* @__PURE__ */ jsx(Table$1, {
|
|
2639
2712
|
...props,
|
|
2640
2713
|
sortState: useLocalSort(props.initialSort)
|
|
2641
2714
|
});
|
|
2642
2715
|
}
|
|
2643
2716
|
function UrlSortedTable(props) {
|
|
2644
|
-
return /* @__PURE__ */ jsx(Table, {
|
|
2717
|
+
return /* @__PURE__ */ jsx(Table$1, {
|
|
2645
2718
|
...props,
|
|
2646
2719
|
sortState: useUrlSort(props.sortParam, props.initialSort)
|
|
2647
2720
|
});
|
|
@@ -2650,15 +2723,8 @@ var features = tableFeatures({
|
|
|
2650
2723
|
rowSortingFeature,
|
|
2651
2724
|
sortedRowModel: createSortedRowModel()
|
|
2652
2725
|
});
|
|
2653
|
-
function Table({ caption, columns, rows, rowKey, sortState: [sort, setSort], virtualizeFrom = 100, maxHeight = 480, selection, expansion, className }) {
|
|
2654
|
-
const baseId = React.useId();
|
|
2726
|
+
function Table$1({ caption, columns, rows, rowKey, sortState: [sort, setSort], virtualizeFrom = 100, maxHeight = 480, selection, expansion, className }) {
|
|
2655
2727
|
const defs = React.useMemo(() => columns.map((c) => {
|
|
2656
|
-
const meta = {
|
|
2657
|
-
numeric: c.numeric,
|
|
2658
|
-
truncate: c.truncate,
|
|
2659
|
-
hideHeader: c.hideHeader,
|
|
2660
|
-
className: c.className
|
|
2661
|
-
};
|
|
2662
2728
|
const { value, sort } = c;
|
|
2663
2729
|
if (!value) return {
|
|
2664
2730
|
id: c.key,
|
|
@@ -2666,8 +2732,7 @@ function Table({ caption, columns, rows, rowKey, sortState: [sort, setSort], vir
|
|
|
2666
2732
|
header: c.header,
|
|
2667
2733
|
cell: (info) => c.cell?.(info.row.original),
|
|
2668
2734
|
enableSorting: Boolean(sort),
|
|
2669
|
-
sortFn: sort ? (a, b) => sort(a.original, b.original) : void 0
|
|
2670
|
-
meta
|
|
2735
|
+
sortFn: sort ? (a, b) => sort(a.original, b.original) : void 0
|
|
2671
2736
|
};
|
|
2672
2737
|
return {
|
|
2673
2738
|
id: c.key,
|
|
@@ -2680,204 +2745,204 @@ function Table({ caption, columns, rows, rowKey, sortState: [sort, setSort], vir
|
|
|
2680
2745
|
},
|
|
2681
2746
|
enableSorting: sort !== false,
|
|
2682
2747
|
sortUndefined: "last",
|
|
2683
|
-
sortFn: sort ? (a, b) => sort(a.original, b.original) : (a, b) => compareValues(a.getValue(c.key), b.getValue(c.key))
|
|
2684
|
-
meta
|
|
2748
|
+
sortFn: sort ? (a, b) => sort(a.original, b.original) : (a, b) => compareValues(a.getValue(c.key), b.getValue(c.key))
|
|
2685
2749
|
};
|
|
2686
2750
|
}), [columns]);
|
|
2687
|
-
const
|
|
2751
|
+
const sortable = (c) => c.value ? c.sort !== false : Boolean(c.sort);
|
|
2752
|
+
const sorting = sort && columns.some((c) => c.key === sort.key && sortable(c)) ? [{
|
|
2688
2753
|
id: sort.key,
|
|
2689
2754
|
desc: sort.dir === "descending"
|
|
2690
2755
|
}] : [];
|
|
2691
|
-
const
|
|
2756
|
+
const modelRows = useTable({
|
|
2692
2757
|
features,
|
|
2693
2758
|
data: rows,
|
|
2694
2759
|
columns: defs,
|
|
2695
2760
|
state: { sorting },
|
|
2696
2761
|
getRowId: (row) => rowKey(row),
|
|
2697
2762
|
autoResetAll: false
|
|
2698
|
-
});
|
|
2699
|
-
const toggle = (key) => setSort({
|
|
2700
|
-
key,
|
|
2701
|
-
dir: sort?.key === key && sort.dir === "ascending" ? "descending" : "ascending"
|
|
2702
|
-
});
|
|
2703
|
-
const modelRows = table.getRowModel().rows;
|
|
2763
|
+
}).getRowModel().rows;
|
|
2704
2764
|
const canExpand = (row) => expansion?.isExpandable?.(row) ?? true;
|
|
2705
|
-
const lines = React.useMemo(() => expansion ? modelRows.flatMap((row) => expansion.expanded.has(row.id) && canExpand(row.original) ? [{
|
|
2706
|
-
row,
|
|
2707
|
-
detail: false
|
|
2708
|
-
}, {
|
|
2709
|
-
row,
|
|
2710
|
-
detail: true
|
|
2711
|
-
}] : [{
|
|
2712
|
-
row,
|
|
2713
|
-
detail: false
|
|
2714
|
-
}]) : modelRows.map((row) => ({
|
|
2715
|
-
row,
|
|
2716
|
-
detail: false
|
|
2717
|
-
})), [modelRows, expansion]);
|
|
2718
|
-
const select = useSelectRows(React.useMemo(() => modelRows.map((r) => r.original), [modelRows]), rowKey, selection);
|
|
2719
|
-
const selectAll = selection ? select.all : void 0;
|
|
2720
2765
|
const virtual = modelRows.length >= virtualizeFrom;
|
|
2721
|
-
const scroller = React.useRef(null);
|
|
2722
|
-
const virtualizer = useVirtualizer({
|
|
2723
|
-
count: virtual ? lines.length : 0,
|
|
2724
|
-
getScrollElement: () => scroller.current,
|
|
2725
|
-
estimateSize: (i) => lines[i]?.detail ? 160 : 41,
|
|
2726
|
-
getItemKey: (i) => lines[i] ? `${lines[i].row.id}${lines[i].detail ? "\0detail" : ""}` : i,
|
|
2727
|
-
overscan: 8,
|
|
2728
|
-
initialRect: {
|
|
2729
|
-
width: 0,
|
|
2730
|
-
height: maxHeight
|
|
2731
|
-
}
|
|
2732
|
-
});
|
|
2733
|
-
const items = virtual ? virtualizer.getVirtualItems() : [];
|
|
2734
|
-
const padTop = items.length ? items[0].start : 0;
|
|
2735
|
-
const padBottom = items.length ? virtualizer.getTotalSize() - items[items.length - 1].end : 0;
|
|
2736
|
-
const visible = virtual ? items.map((i) => ({
|
|
2737
|
-
...lines[i.index],
|
|
2738
|
-
index: i.index
|
|
2739
|
-
})) : lines.map((l, index) => ({
|
|
2740
|
-
...l,
|
|
2741
|
-
index
|
|
2742
|
-
}));
|
|
2743
2766
|
const lead = (selection ? 1 : 0) + (expansion ? 1 : 0);
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2767
|
+
const shownKeys = React.useMemo(() => new Set(modelRows.map((r) => r.id)), [modelRows]);
|
|
2768
|
+
const selectableKeys = modelRows.filter((r) => selection?.isSelectable?.(r.original) ?? true).map((r) => r.id);
|
|
2769
|
+
const detailKey = (id) => `${id}\u0000detail`;
|
|
2770
|
+
const disabledKeys = React.useMemo(() => {
|
|
2771
|
+
const keys = [];
|
|
2772
|
+
for (const r of modelRows) {
|
|
2773
|
+
if (selection && !(selection.isSelectable?.(r.original) ?? true)) keys.push(r.id);
|
|
2774
|
+
if (expansion && canExpand(r.original)) keys.push(detailKey(r.id));
|
|
2775
|
+
}
|
|
2776
|
+
return keys;
|
|
2777
|
+
}, [
|
|
2778
|
+
modelRows,
|
|
2779
|
+
selection,
|
|
2780
|
+
expansion
|
|
2781
|
+
]);
|
|
2782
|
+
const shift = useShiftNote();
|
|
2783
|
+
const pressed = React.useRef(null);
|
|
2784
|
+
const notePress = (e) => void (pressed.current = e.target.closest("[data-key]")?.getAttribute("data-key") ?? null);
|
|
2785
|
+
const select = useSelectRows(React.useMemo(() => modelRows.map((r) => r.original), [modelRows]), rowKey, selection);
|
|
2786
|
+
const changeSelection = (next) => {
|
|
2787
|
+
if (!selection) return;
|
|
2788
|
+
if (next !== "all") {
|
|
2789
|
+
const nextShown = new Set([...next].map(String).filter((k) => shownKeys.has(k)));
|
|
2790
|
+
const added = [...nextShown].filter((k) => !selection.selected.has(k));
|
|
2791
|
+
const removed = [...selection.selected].filter((k) => shownKeys.has(k) && !nextShown.has(k));
|
|
2792
|
+
if (added.length + removed.length === 1) {
|
|
2793
|
+
select.toggle(added[0] ?? removed[0], added.length === 1, shift.take());
|
|
2794
|
+
return;
|
|
2795
|
+
}
|
|
2796
|
+
select.setAnchor(pressed.current);
|
|
2797
|
+
}
|
|
2798
|
+
const outside = [...selection.selected].filter((k) => !shownKeys.has(k));
|
|
2799
|
+
const chosen = selectableKeys.filter((k) => selection.selected.has(k)).length;
|
|
2800
|
+
const picked = next === "all" ? chosen > 0 && chosen < selectableKeys.length ? [] : selectableKeys : [...next].map(String).filter((k) => shownKeys.has(k));
|
|
2801
|
+
selection.onChange(/* @__PURE__ */ new Set([...outside, ...picked]));
|
|
2802
|
+
};
|
|
2803
|
+
const grid = /* @__PURE__ */ jsxs(Table, {
|
|
2747
2804
|
"aria-label": caption,
|
|
2748
|
-
|
|
2749
|
-
|
|
2805
|
+
selectionMode: selection ? "multiple" : "none",
|
|
2806
|
+
selectionBehavior: "toggle",
|
|
2807
|
+
selectedKeys: selection ? new Set([...selection.selected].filter((k) => shownKeys.has(k))) : void 0,
|
|
2808
|
+
onSelectionChange: changeSelection,
|
|
2809
|
+
disabledKeys,
|
|
2810
|
+
sortDescriptor: sort && columns.some((c) => c.key === sort.key && sortable(c)) ? {
|
|
2811
|
+
column: sort.key,
|
|
2812
|
+
direction: sort.dir
|
|
2813
|
+
} : void 0,
|
|
2814
|
+
onSortChange: (d) => setSort({
|
|
2815
|
+
key: String(d.column),
|
|
2816
|
+
dir: d.direction
|
|
2817
|
+
}),
|
|
2818
|
+
className: cn("w-full border-collapse type-body-sm outline-none", virtual && "overflow-auto"),
|
|
2750
2819
|
style: virtual ? { maxHeight } : void 0,
|
|
2751
|
-
children: /* @__PURE__ */ jsxs(
|
|
2752
|
-
className:
|
|
2753
|
-
"aria-rowcount": virtual ? lines.length + 1 : void 0,
|
|
2820
|
+
children: [/* @__PURE__ */ jsxs(TableHeader, {
|
|
2821
|
+
className: cn(virtual && "bg-background"),
|
|
2754
2822
|
children: [
|
|
2755
|
-
/* @__PURE__ */ jsx(
|
|
2756
|
-
|
|
2757
|
-
|
|
2823
|
+
selection && /* @__PURE__ */ jsx(Column, {
|
|
2824
|
+
id: SELECT,
|
|
2825
|
+
textValue: "Select all shown",
|
|
2826
|
+
width: 32,
|
|
2827
|
+
className: "w-8 py-2 pr-2 text-left align-bottom outline-offset-[-2px]",
|
|
2828
|
+
children: /* @__PURE__ */ jsx(TableSelectionCheckbox, {
|
|
2829
|
+
label: "Select all shown",
|
|
2830
|
+
className: "-my-1",
|
|
2831
|
+
disabled: selectableKeys.length === 0
|
|
2832
|
+
})
|
|
2758
2833
|
}),
|
|
2759
|
-
/* @__PURE__ */ jsx(
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
hideLabel: true,
|
|
2769
|
-
checked: selectAll.checked,
|
|
2770
|
-
disabled: selectAll.disabled,
|
|
2771
|
-
onCheckedChange: selectAll.toggle
|
|
2772
|
-
})
|
|
2773
|
-
}),
|
|
2774
|
-
expansion && /* @__PURE__ */ jsx("th", {
|
|
2775
|
-
scope: "col",
|
|
2776
|
-
className: "w-10 py-2 pr-2",
|
|
2777
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
2778
|
-
className: "sr-only",
|
|
2779
|
-
children: "Details"
|
|
2780
|
-
})
|
|
2781
|
-
}),
|
|
2782
|
-
group.headers.map((header) => {
|
|
2783
|
-
const meta = header.column.columnDef.meta;
|
|
2784
|
-
const active = sort?.key === header.id && header.column.getCanSort() ? sort.dir : void 0;
|
|
2785
|
-
const Icon = active === "ascending" ? ArrowUp : active === "descending" ? ArrowDown : ArrowUpDown;
|
|
2786
|
-
const rendered = flexRender(header.column.columnDef.header, header.getContext());
|
|
2787
|
-
const label = meta?.hideHeader ? /* @__PURE__ */ jsx("span", {
|
|
2788
|
-
className: "sr-only",
|
|
2789
|
-
children: rendered
|
|
2790
|
-
}) : rendered;
|
|
2791
|
-
return /* @__PURE__ */ jsx("th", {
|
|
2792
|
-
scope: "col",
|
|
2793
|
-
"aria-sort": active,
|
|
2794
|
-
className: cn("py-2 pr-4 text-left align-bottom type-caption text-muted-foreground last:pr-0", meta?.numeric && "text-right"),
|
|
2795
|
-
children: header.column.getCanSort() ? /* @__PURE__ */ jsxs("button", {
|
|
2796
|
-
type: "button",
|
|
2797
|
-
onClick: () => toggle(header.id),
|
|
2798
|
-
className: cn("-mx-1 inline-flex cursor-pointer items-center gap-1 rounded-control px-1 transition-state hover:text-foreground", meta?.numeric && "flex-row-reverse", active && "text-foreground"),
|
|
2799
|
-
children: [label, /* @__PURE__ */ jsx(Icon, {
|
|
2800
|
-
"aria-hidden": true,
|
|
2801
|
-
className: cn("size-3.5", !active && "opacity-50")
|
|
2802
|
-
})]
|
|
2803
|
-
}) : label
|
|
2804
|
-
}, header.id);
|
|
2805
|
-
})
|
|
2806
|
-
] }, group.id))
|
|
2834
|
+
expansion && /* @__PURE__ */ jsx(Column, {
|
|
2835
|
+
id: EXPAND,
|
|
2836
|
+
textValue: "Details",
|
|
2837
|
+
width: 40,
|
|
2838
|
+
className: "w-10 py-2 pr-2 outline-offset-[-2px]",
|
|
2839
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
2840
|
+
className: "sr-only",
|
|
2841
|
+
children: "Details"
|
|
2842
|
+
})
|
|
2807
2843
|
}),
|
|
2808
|
-
/* @__PURE__ */
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
"
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2844
|
+
columns.map((c, i) => /* @__PURE__ */ jsx(Column, {
|
|
2845
|
+
id: c.key,
|
|
2846
|
+
textValue: c.header,
|
|
2847
|
+
isRowHeader: i === 0,
|
|
2848
|
+
allowsSorting: sortable(c),
|
|
2849
|
+
width: c.numeric ? "0.6fr" : "1fr",
|
|
2850
|
+
className: cn("py-2 text-left align-bottom type-caption font-normal text-muted-foreground outline-offset-[-2px]", i < columns.length - 1 && "pr-4", c.numeric && "text-right"),
|
|
2851
|
+
children: ({ allowsSorting, sortDirection }) => {
|
|
2852
|
+
const Icon = sortDirection === "ascending" ? ArrowUp : sortDirection === "descending" ? ArrowDown : ArrowUpDown;
|
|
2853
|
+
const label = c.hideHeader ? /* @__PURE__ */ jsx("span", {
|
|
2854
|
+
className: "sr-only",
|
|
2855
|
+
children: c.header
|
|
2856
|
+
}) : c.header;
|
|
2857
|
+
return allowsSorting ? /* @__PURE__ */ jsxs("span", {
|
|
2858
|
+
className: cn("-mx-1 inline-flex cursor-pointer items-center gap-1 rounded-control px-1 transition-state hover:text-foreground", c.numeric && "flex-row-reverse", sortDirection && "text-foreground"),
|
|
2859
|
+
children: [label, /* @__PURE__ */ jsx(Icon, {
|
|
2860
|
+
"aria-hidden": true,
|
|
2861
|
+
className: cn("size-3.5", !sortDirection && "opacity-50")
|
|
2826
2862
|
})]
|
|
2827
|
-
}
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
children: canExpand(row.original) && /* @__PURE__ */ jsx("button", {
|
|
2847
|
-
type: "button",
|
|
2848
|
-
"aria-expanded": open,
|
|
2849
|
-
"aria-controls": open ? detailId : void 0,
|
|
2850
|
-
"aria-label": expansion.rowLabel(row.original),
|
|
2851
|
-
title: expansion.rowLabel(row.original),
|
|
2852
|
-
onClick: () => {
|
|
2853
|
-
const next = new Set(expansion.expanded);
|
|
2854
|
-
if (open) next.delete(row.id);
|
|
2855
|
-
else next.add(row.id);
|
|
2856
|
-
expansion.onChange(next);
|
|
2857
|
-
},
|
|
2858
|
-
className: "-my-1.5 grid size-(--control-h-sm) cursor-pointer place-items-center rounded-control hover:bg-muted",
|
|
2859
|
-
children: /* @__PURE__ */ jsx(Chevron, { open })
|
|
2860
|
-
})
|
|
2861
|
-
}),
|
|
2862
|
-
row.getAllCells().map((cell) => {
|
|
2863
|
-
const meta = cell.column.columnDef.meta;
|
|
2864
|
-
return /* @__PURE__ */ jsx("td", {
|
|
2865
|
-
className: cn("py-2.5 pr-4 align-middle last:pr-0", meta?.numeric && "text-right tabular-nums", meta?.truncate && "max-w-48 truncate", meta?.className),
|
|
2866
|
-
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
2867
|
-
}, cell.id);
|
|
2868
|
-
})
|
|
2869
|
-
]
|
|
2870
|
-
}, row.id);
|
|
2863
|
+
}) : label;
|
|
2864
|
+
}
|
|
2865
|
+
}, c.key))
|
|
2866
|
+
]
|
|
2867
|
+
}), /* @__PURE__ */ jsx(TableBody, { children: modelRows.flatMap((row) => {
|
|
2868
|
+
const open = (expansion?.expanded.has(row.id) ?? false) && canExpand(row.original);
|
|
2869
|
+
const cells = new Map(row.getAllCells().map((cell) => [cell.column.id, cell]));
|
|
2870
|
+
const items = [/* @__PURE__ */ jsxs(Row, {
|
|
2871
|
+
id: row.id,
|
|
2872
|
+
textValue: selection?.rowLabel(row.original) ?? expansion?.rowLabel(row.original) ?? row.id,
|
|
2873
|
+
onAction: selection ? noop : void 0,
|
|
2874
|
+
className: cn("border-t border-border outline-offset-[-2px] selected:bg-surface-sunken", open && "selected:bg-surface-sunken"),
|
|
2875
|
+
children: [
|
|
2876
|
+
selection && /* @__PURE__ */ jsx(Cell, {
|
|
2877
|
+
className: "w-8 py-2.5 pr-2 align-middle",
|
|
2878
|
+
children: /* @__PURE__ */ jsx(TableSelectionCheckbox, {
|
|
2879
|
+
label: `Select ${selection.rowLabel(row.original)}`,
|
|
2880
|
+
className: "-my-0.5"
|
|
2881
|
+
})
|
|
2871
2882
|
}),
|
|
2872
|
-
|
|
2873
|
-
"
|
|
2874
|
-
|
|
2883
|
+
expansion && /* @__PURE__ */ jsx(Cell, {
|
|
2884
|
+
className: "w-10 py-2.5 pr-2 align-middle",
|
|
2885
|
+
children: canExpand(row.original) && /* @__PURE__ */ jsx(Button$1, {
|
|
2886
|
+
"aria-expanded": open,
|
|
2887
|
+
"aria-label": expansion.rowLabel(row.original),
|
|
2888
|
+
onPress: () => {
|
|
2889
|
+
const next = new Set(expansion.expanded);
|
|
2890
|
+
if (open) next.delete(row.id);
|
|
2891
|
+
else next.add(row.id);
|
|
2892
|
+
expansion.onChange(next);
|
|
2893
|
+
},
|
|
2894
|
+
className: "-my-1.5 grid size-(--control-h-sm) cursor-pointer place-items-center rounded-control hover:bg-muted",
|
|
2895
|
+
children: /* @__PURE__ */ jsx(Chevron, { open })
|
|
2896
|
+
})
|
|
2897
|
+
}),
|
|
2898
|
+
columns.map((c, i) => {
|
|
2899
|
+
const cell = cells.get(c.key);
|
|
2900
|
+
return /* @__PURE__ */ jsx(Cell, {
|
|
2901
|
+
className: cn("py-2.5 align-middle", i < columns.length - 1 && "pr-4", c.numeric && "text-right tabular-nums", c.truncate && "max-w-48 truncate", c.className),
|
|
2902
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
2903
|
+
}, c.key);
|
|
2875
2904
|
})
|
|
2876
|
-
]
|
|
2877
|
-
]
|
|
2878
|
-
|
|
2905
|
+
]
|
|
2906
|
+
}, row.id)];
|
|
2907
|
+
if (open && expansion) items.push(/* @__PURE__ */ jsxs(Row, {
|
|
2908
|
+
id: detailKey(row.id),
|
|
2909
|
+
textValue: expansion.rowLabel(row.original),
|
|
2910
|
+
className: "outline-offset-[-2px]",
|
|
2911
|
+
children: [lead > 0 && /* @__PURE__ */ jsx(Cell, { colSpan: lead }), /* @__PURE__ */ jsx(Cell, {
|
|
2912
|
+
colSpan: columns.length,
|
|
2913
|
+
className: "pt-0.5 pb-4 align-top",
|
|
2914
|
+
children: expansion.detail(row.original)
|
|
2915
|
+
})]
|
|
2916
|
+
}, detailKey(row.id)));
|
|
2917
|
+
return items;
|
|
2918
|
+
}) })]
|
|
2919
|
+
});
|
|
2920
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2921
|
+
className: cn("relative min-w-0", !virtual && "overflow-x-auto", className),
|
|
2922
|
+
onMouseDownCapture: (e) => {
|
|
2923
|
+
shift.handlers.onMouseDown(e);
|
|
2924
|
+
notePress(e);
|
|
2925
|
+
},
|
|
2926
|
+
onKeyDownCapture: (e) => {
|
|
2927
|
+
shift.handlers.onKeyDown(e);
|
|
2928
|
+
notePress(e);
|
|
2929
|
+
},
|
|
2930
|
+
children: virtual ? /* @__PURE__ */ jsx(Virtualizer, {
|
|
2931
|
+
layout: TableLayout,
|
|
2932
|
+
layoutOptions: expansion ? {
|
|
2933
|
+
estimatedRowHeight: 41,
|
|
2934
|
+
headingHeight: 36
|
|
2935
|
+
} : {
|
|
2936
|
+
rowHeight: 41,
|
|
2937
|
+
headingHeight: 36
|
|
2938
|
+
},
|
|
2939
|
+
children: grid
|
|
2940
|
+
}) : grid
|
|
2879
2941
|
});
|
|
2880
2942
|
}
|
|
2943
|
+
var SELECT = "\0select";
|
|
2944
|
+
var EXPAND = "\0expand";
|
|
2945
|
+
var noop = () => {};
|
|
2881
2946
|
/** The loading placeholder for a `DataTable`, shaped like its rows. */
|
|
2882
2947
|
function TableSkeleton({ rows = 4, columns = 5 }) {
|
|
2883
2948
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -4435,7 +4500,7 @@ function Inspector({ title, kind, empty, selectionKey, storageKey, actions, summ
|
|
|
4435
4500
|
"aria-label": title === null ? "Properties" : void 0,
|
|
4436
4501
|
className: cn("min-w-0", className),
|
|
4437
4502
|
children: title === null ? empty : /* @__PURE__ */ jsxs("div", {
|
|
4438
|
-
className: "grid gap-4",
|
|
4503
|
+
className: "grid grid-cols-1 gap-4",
|
|
4439
4504
|
children: [
|
|
4440
4505
|
/* @__PURE__ */ jsxs("header", {
|
|
4441
4506
|
className: "flex items-start gap-3",
|
|
@@ -4460,7 +4525,7 @@ function Inspector({ title, kind, empty, selectionKey, storageKey, actions, summ
|
|
|
4460
4525
|
}),
|
|
4461
4526
|
summary,
|
|
4462
4527
|
/* @__PURE__ */ jsx("div", {
|
|
4463
|
-
className: "grid",
|
|
4528
|
+
className: "grid grid-cols-1 *:min-w-0",
|
|
4464
4529
|
children
|
|
4465
4530
|
}, selectionKey)
|
|
4466
4531
|
]
|
|
@@ -4499,7 +4564,7 @@ function InspectorSection({ id, title, defaultOpen = true, actions, children, cl
|
|
|
4499
4564
|
children: actions
|
|
4500
4565
|
})]
|
|
4501
4566
|
}), /* @__PURE__ */ jsx(DisclosurePanel, { children: isExpanded && /* @__PURE__ */ jsx("div", {
|
|
4502
|
-
className: "grid gap-4 pt-2 pb-4 pl-6",
|
|
4567
|
+
className: "grid grid-cols-1 gap-4 pt-2 pb-4 pl-6 *:min-w-0",
|
|
4503
4568
|
children
|
|
4504
4569
|
}) })] })
|
|
4505
4570
|
});
|
|
@@ -4575,141 +4640,104 @@ var TILE_CHROME = 40;
|
|
|
4575
4640
|
function SelectableGrid({ label, rows, rowKey, renderImage, detail, selection, aspect = "square", tileSize = "md", virtualizeFrom = 100, maxHeight = 480, className }) {
|
|
4576
4641
|
const select = useSelectRows(rows, rowKey, selection);
|
|
4577
4642
|
const virtual = rows.length >= virtualizeFrom;
|
|
4578
|
-
const
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4643
|
+
const shownKeys = React.useMemo(() => new Set(rows.map(rowKey)), [rows, rowKey]);
|
|
4644
|
+
const disabledKeys = rows.filter((r) => !(selection.isSelectable?.(r) ?? true)).map(rowKey);
|
|
4645
|
+
const shift = useShiftNote();
|
|
4646
|
+
const pressed = React.useRef(null);
|
|
4647
|
+
const notePress = (e) => void (pressed.current = e.target.closest("[data-key]")?.getAttribute("data-key") ?? null);
|
|
4648
|
+
const changeSelection = (next) => {
|
|
4649
|
+
if (next !== "all") {
|
|
4650
|
+
const nextShown = new Set([...next].map(String).filter((k) => shownKeys.has(k)));
|
|
4651
|
+
const added = [...nextShown].filter((k) => !selection.selected.has(k));
|
|
4652
|
+
const removed = [...selection.selected].filter((k) => shownKeys.has(k) && !nextShown.has(k));
|
|
4653
|
+
if (added.length + removed.length === 1) {
|
|
4654
|
+
select.toggle(added[0] ?? removed[0], added.length === 1, shift.take());
|
|
4655
|
+
return;
|
|
4656
|
+
}
|
|
4657
|
+
select.setAnchor(pressed.current);
|
|
4658
|
+
}
|
|
4659
|
+
const outside = [...selection.selected].filter((k) => !shownKeys.has(k));
|
|
4660
|
+
const picked = next === "all" ? rows.filter((r) => selection.isSelectable?.(r) ?? true).map(rowKey) : [...next].map(String).filter((k) => shownKeys.has(k));
|
|
4661
|
+
selection.onChange(/* @__PURE__ */ new Set([...outside, ...picked]));
|
|
4590
4662
|
};
|
|
4663
|
+
const layoutOptions = React.useMemo(() => ({
|
|
4664
|
+
minItemSize: new Size(minWidth[tileSize], Math.round(minWidth[tileSize] * aspectRatio[aspect]) + TILE_CHROME),
|
|
4665
|
+
minSpace: new Size(GAP, GAP)
|
|
4666
|
+
}), [tileSize, aspect]);
|
|
4667
|
+
const grid = /* @__PURE__ */ jsx(GridList, {
|
|
4668
|
+
"aria-label": label,
|
|
4669
|
+
layout: "grid",
|
|
4670
|
+
selectionMode: "multiple",
|
|
4671
|
+
selectionBehavior: "toggle",
|
|
4672
|
+
selectedKeys: new Set([...selection.selected].filter((k) => shownKeys.has(k))),
|
|
4673
|
+
onSelectionChange: changeSelection,
|
|
4674
|
+
disabledKeys,
|
|
4675
|
+
"data-strata-scroll": "",
|
|
4676
|
+
className: cn("min-w-0 outline-none", virtual ? "overflow-y-auto" : "grid gap-3"),
|
|
4677
|
+
style: virtual ? { height: maxHeight } : { gridTemplateColumns: `repeat(auto-fill, minmax(min(${minWidth[tileSize]}px, 100%), 1fr))` },
|
|
4678
|
+
children: rows.map((row, index) => {
|
|
4679
|
+
const key = rowKey(row);
|
|
4680
|
+
const name = selection.rowLabel(row);
|
|
4681
|
+
return /* @__PURE__ */ jsxs(GridListItem, {
|
|
4682
|
+
id: key,
|
|
4683
|
+
textValue: name,
|
|
4684
|
+
"data-index": index,
|
|
4685
|
+
className: cn("group relative grid min-w-0 gap-1.5 rounded-surface border border-transparent p-1.5 select-none outline-offset-2 transition-state", "selected:border-primary selected:bg-surface-sunken disabled:cursor-not-allowed disabled:opacity-50", "cursor-pointer hover:bg-surface-sunken disabled:hover:bg-transparent"),
|
|
4686
|
+
children: [
|
|
4687
|
+
/* @__PURE__ */ jsx("span", {
|
|
4688
|
+
className: cn("block overflow-hidden rounded-control bg-muted *:size-full *:object-cover", aspectClass[aspect]),
|
|
4689
|
+
children: renderImage(row)
|
|
4690
|
+
}),
|
|
4691
|
+
/* @__PURE__ */ jsx(TileBox, { label: `Select ${name}` }),
|
|
4692
|
+
detail?.(row) != null && /* @__PURE__ */ jsx("span", {
|
|
4693
|
+
className: "truncate type-body-sm text-muted-foreground",
|
|
4694
|
+
children: detail(row)
|
|
4695
|
+
})
|
|
4696
|
+
]
|
|
4697
|
+
}, key);
|
|
4698
|
+
})
|
|
4699
|
+
});
|
|
4591
4700
|
return /* @__PURE__ */ jsxs("div", {
|
|
4592
4701
|
className: cn("grid min-w-0 gap-3", className),
|
|
4702
|
+
onMouseDownCapture: (e) => {
|
|
4703
|
+
shift.handlers.onMouseDown(e);
|
|
4704
|
+
notePress(e);
|
|
4705
|
+
},
|
|
4706
|
+
onKeyDownCapture: (e) => {
|
|
4707
|
+
shift.handlers.onKeyDown(e);
|
|
4708
|
+
notePress(e);
|
|
4709
|
+
},
|
|
4593
4710
|
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
4594
4711
|
className: "justify-self-start",
|
|
4595
4712
|
label: "Select all shown",
|
|
4596
4713
|
checked: select.all.checked,
|
|
4597
4714
|
disabled: select.all.disabled,
|
|
4598
4715
|
onCheckedChange: select.all.toggle
|
|
4599
|
-
}), virtual ? /* @__PURE__ */ jsx(
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
})]
|
|
4613
|
-
});
|
|
4614
|
-
}
|
|
4615
|
-
function VirtualTiles({ label, rows, rowKey, tile, aspect, tileSize, maxHeight }) {
|
|
4616
|
-
const scroller = React.useRef(null);
|
|
4617
|
-
const [width, setWidth] = React.useState(0);
|
|
4618
|
-
React.useLayoutEffect(() => {
|
|
4619
|
-
const el = scroller.current;
|
|
4620
|
-
if (!el || typeof ResizeObserver === "undefined") return;
|
|
4621
|
-
const observer = new ResizeObserver(([entry]) => setWidth(entry.contentRect.width));
|
|
4622
|
-
observer.observe(el);
|
|
4623
|
-
return () => observer.disconnect();
|
|
4624
|
-
}, []);
|
|
4625
|
-
const min = minWidth[tileSize];
|
|
4626
|
-
const columns = Math.max(1, Math.floor((width + GAP) / (min + GAP)));
|
|
4627
|
-
const tileWidth = width > 0 ? (width - GAP * (columns - 1)) / columns : min;
|
|
4628
|
-
const lines = Math.ceil(rows.length / columns);
|
|
4629
|
-
const virtualizer = useVirtualizer({
|
|
4630
|
-
count: lines,
|
|
4631
|
-
getScrollElement: () => scroller.current,
|
|
4632
|
-
estimateSize: () => Math.round(tileWidth * aspectRatio[aspect]) + TILE_CHROME + GAP,
|
|
4633
|
-
overscan: 3,
|
|
4634
|
-
getItemKey: (i) => `${columns}:${i}`,
|
|
4635
|
-
initialRect: {
|
|
4636
|
-
width: 0,
|
|
4637
|
-
height: maxHeight
|
|
4638
|
-
}
|
|
4639
|
-
});
|
|
4640
|
-
const items = virtualizer.getVirtualItems();
|
|
4641
|
-
return /* @__PURE__ */ jsx("div", {
|
|
4642
|
-
ref: scroller,
|
|
4643
|
-
role: "region",
|
|
4716
|
+
}), virtual ? /* @__PURE__ */ jsx(Virtualizer, {
|
|
4717
|
+
layout: GridLayout,
|
|
4718
|
+
layoutOptions,
|
|
4719
|
+
children: grid
|
|
4720
|
+
}) : grid]
|
|
4721
|
+
});
|
|
4722
|
+
}
|
|
4723
|
+
function TileBox({ label }) {
|
|
4724
|
+
const id = React.useId();
|
|
4725
|
+
return /* @__PURE__ */ jsx(Checkbox$1, {
|
|
4726
|
+
slot: "selection",
|
|
4727
|
+
id,
|
|
4728
|
+
"aria-labelledby": id,
|
|
4644
4729
|
"aria-label": label,
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
className: "relative w-full",
|
|
4653
|
-
style: { height: virtualizer.getTotalSize() },
|
|
4654
|
-
children: items.map((v) => {
|
|
4655
|
-
const start = v.index * columns;
|
|
4656
|
-
return /* @__PURE__ */ jsx("div", {
|
|
4657
|
-
ref: virtualizer.measureElement,
|
|
4658
|
-
"data-index": v.index,
|
|
4659
|
-
role: "none",
|
|
4660
|
-
className: "absolute inset-x-0 top-0 grid gap-3 pb-3",
|
|
4661
|
-
style: {
|
|
4662
|
-
translate: `0 ${v.start}px`,
|
|
4663
|
-
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
4664
|
-
},
|
|
4665
|
-
children: rows.slice(start, start + columns).map((row, i) => /* @__PURE__ */ jsx("div", {
|
|
4666
|
-
role: "listitem",
|
|
4667
|
-
"aria-setsize": rows.length,
|
|
4668
|
-
"aria-posinset": start + i + 1,
|
|
4669
|
-
children: tile(row, start + i)
|
|
4670
|
-
}, rowKey(row)))
|
|
4671
|
-
}, v.key);
|
|
4730
|
+
className: "absolute top-3 left-3 grid size-7 place-items-center rounded-control bg-background",
|
|
4731
|
+
children: ({ isSelected }) => /* @__PURE__ */ jsx("span", {
|
|
4732
|
+
"aria-hidden": true,
|
|
4733
|
+
className: cn("grid size-4.5 place-items-center rounded-control border border-input bg-background", isSelected && "border-primary bg-primary text-primary-foreground"),
|
|
4734
|
+
children: isSelected && /* @__PURE__ */ jsx(Check, {
|
|
4735
|
+
className: "size-3.5",
|
|
4736
|
+
strokeWidth: 3
|
|
4672
4737
|
})
|
|
4673
4738
|
})
|
|
4674
4739
|
});
|
|
4675
4740
|
}
|
|
4676
|
-
function Tile({ name, chosen, disabled, onChange, aspect, image, detail, index }) {
|
|
4677
|
-
const shift = useShiftNote();
|
|
4678
|
-
return /* @__PURE__ */ jsx("span", {
|
|
4679
|
-
className: "contents",
|
|
4680
|
-
onMouseDownCapture: shift.handlers.onMouseDown,
|
|
4681
|
-
onKeyDownCapture: shift.handlers.onKeyDown,
|
|
4682
|
-
children: /* @__PURE__ */ jsxs(Checkbox$1, {
|
|
4683
|
-
isSelected: chosen,
|
|
4684
|
-
isDisabled: disabled,
|
|
4685
|
-
"aria-label": name,
|
|
4686
|
-
onChange: (on) => onChange(on, shift.take()),
|
|
4687
|
-
"data-index": index,
|
|
4688
|
-
className: cn("group relative grid min-w-0 gap-1.5 rounded-surface border border-transparent p-1.5 select-none transition-state", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", chosen && "border-primary bg-surface-sunken", disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-surface-sunken"),
|
|
4689
|
-
children: [
|
|
4690
|
-
/* @__PURE__ */ jsx("span", {
|
|
4691
|
-
className: cn("block overflow-hidden rounded-control bg-muted *:size-full *:object-cover", aspectClass[aspect]),
|
|
4692
|
-
children: image
|
|
4693
|
-
}),
|
|
4694
|
-
/* @__PURE__ */ jsx("span", {
|
|
4695
|
-
className: "absolute top-3 left-3 grid size-7 place-items-center rounded-control bg-background",
|
|
4696
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
4697
|
-
"aria-hidden": true,
|
|
4698
|
-
className: cn("grid size-4.5 place-items-center rounded-control border border-input bg-background", chosen && "border-primary bg-primary text-primary-foreground"),
|
|
4699
|
-
children: chosen && /* @__PURE__ */ jsx(Check, {
|
|
4700
|
-
className: "size-3.5",
|
|
4701
|
-
strokeWidth: 3
|
|
4702
|
-
})
|
|
4703
|
-
})
|
|
4704
|
-
}),
|
|
4705
|
-
detail != null && /* @__PURE__ */ jsx("span", {
|
|
4706
|
-
className: "truncate type-body-sm text-muted-foreground",
|
|
4707
|
-
children: detail
|
|
4708
|
-
})
|
|
4709
|
-
]
|
|
4710
|
-
})
|
|
4711
|
-
});
|
|
4712
|
-
}
|
|
4713
4741
|
// src/components/virtual-list.tsx
|
|
4714
4742
|
var FOOTER = "\0footer";
|
|
4715
4743
|
/** A list that renders only its visible rows (React Aria's GridList and Virtualizer) from `virtualizeFrom` items, with arrow-key navigation between rows. */
|
|
@@ -7026,6 +7054,348 @@ function CompareGrid({ label, items, blind, missing, actions, columns = 3, keys
|
|
|
7026
7054
|
})
|
|
7027
7055
|
});
|
|
7028
7056
|
}
|
|
7029
|
-
|
|
7057
|
+
// src/components/history.tsx
|
|
7058
|
+
var compose = (older, newer) => ({
|
|
7059
|
+
label: older.label,
|
|
7060
|
+
key: older.key,
|
|
7061
|
+
undo: () => {
|
|
7062
|
+
newer.undo();
|
|
7063
|
+
older.undo();
|
|
7064
|
+
},
|
|
7065
|
+
redo: () => {
|
|
7066
|
+
older.redo();
|
|
7067
|
+
newer.redo();
|
|
7068
|
+
}
|
|
7069
|
+
});
|
|
7070
|
+
/** A history of named, undoable steps with grouping, a limit, and Undo and Redo as commands. */
|
|
7071
|
+
function useHistory({ limit = 100 } = {}) {
|
|
7072
|
+
const store = React.useRef({
|
|
7073
|
+
past: [],
|
|
7074
|
+
future: [],
|
|
7075
|
+
open: [],
|
|
7076
|
+
merge: false
|
|
7077
|
+
});
|
|
7078
|
+
const [version, bump] = React.useReducer((n) => n + 1, 0);
|
|
7079
|
+
const max = Math.max(1, limit);
|
|
7080
|
+
const api = React.useMemo(() => {
|
|
7081
|
+
const s = store.current;
|
|
7082
|
+
const record = (step) => {
|
|
7083
|
+
const last = s.past[s.past.length - 1];
|
|
7084
|
+
if (s.merge && step.key && last && last.key === step.key) s.past[s.past.length - 1] = compose(last, step);
|
|
7085
|
+
else {
|
|
7086
|
+
s.past.push(step);
|
|
7087
|
+
if (s.past.length > max) s.past.splice(0, s.past.length - max);
|
|
7088
|
+
}
|
|
7089
|
+
s.future = [];
|
|
7090
|
+
s.merge = Boolean(step.key);
|
|
7091
|
+
bump();
|
|
7092
|
+
};
|
|
7093
|
+
const push = (step) => {
|
|
7094
|
+
const group = s.open[s.open.length - 1];
|
|
7095
|
+
if (group) group.push(step);
|
|
7096
|
+
else record(step);
|
|
7097
|
+
};
|
|
7098
|
+
const begin = (label) => {
|
|
7099
|
+
const steps = [];
|
|
7100
|
+
s.open.push(steps);
|
|
7101
|
+
let ended = false;
|
|
7102
|
+
return () => {
|
|
7103
|
+
if (ended) return;
|
|
7104
|
+
ended = true;
|
|
7105
|
+
s.open.pop();
|
|
7106
|
+
if (!steps.length) return;
|
|
7107
|
+
push({
|
|
7108
|
+
label,
|
|
7109
|
+
undo: () => [...steps].reverse().forEach((x) => x.undo()),
|
|
7110
|
+
redo: () => steps.forEach((x) => x.redo())
|
|
7111
|
+
});
|
|
7112
|
+
};
|
|
7113
|
+
};
|
|
7114
|
+
return {
|
|
7115
|
+
push,
|
|
7116
|
+
begin,
|
|
7117
|
+
group: (label, run) => {
|
|
7118
|
+
const end = begin(label);
|
|
7119
|
+
try {
|
|
7120
|
+
return run();
|
|
7121
|
+
} finally {
|
|
7122
|
+
end();
|
|
7123
|
+
}
|
|
7124
|
+
},
|
|
7125
|
+
undo: () => {
|
|
7126
|
+
if (s.open.length) return;
|
|
7127
|
+
const step = s.past.pop();
|
|
7128
|
+
if (!step) return;
|
|
7129
|
+
step.undo();
|
|
7130
|
+
s.future.unshift(step);
|
|
7131
|
+
s.merge = false;
|
|
7132
|
+
bump();
|
|
7133
|
+
},
|
|
7134
|
+
redo: () => {
|
|
7135
|
+
if (s.open.length) return;
|
|
7136
|
+
const step = s.future.shift();
|
|
7137
|
+
if (!step) return;
|
|
7138
|
+
step.redo();
|
|
7139
|
+
s.past.push(step);
|
|
7140
|
+
s.merge = false;
|
|
7141
|
+
bump();
|
|
7142
|
+
},
|
|
7143
|
+
clear: () => {
|
|
7144
|
+
s.past = [];
|
|
7145
|
+
s.future = [];
|
|
7146
|
+
s.merge = false;
|
|
7147
|
+
bump();
|
|
7148
|
+
}
|
|
7149
|
+
};
|
|
7150
|
+
}, [max]);
|
|
7151
|
+
return React.useMemo(() => {
|
|
7152
|
+
const { past, future } = store.current;
|
|
7153
|
+
const undoLabel = past[past.length - 1]?.label;
|
|
7154
|
+
const redoLabel = future[0]?.label;
|
|
7155
|
+
const commands = [{
|
|
7156
|
+
id: "history.undo",
|
|
7157
|
+
label: undoLabel ? `Undo ${undoLabel}` : "Undo",
|
|
7158
|
+
icon: Undo2,
|
|
7159
|
+
keys: ["Mod+Z"],
|
|
7160
|
+
disabled: undoLabel ? false : "Nothing to undo",
|
|
7161
|
+
run: api.undo
|
|
7162
|
+
}, {
|
|
7163
|
+
id: "history.redo",
|
|
7164
|
+
label: redoLabel ? `Redo ${redoLabel}` : "Redo",
|
|
7165
|
+
icon: Redo2,
|
|
7166
|
+
keys: ["Mod+Shift+Z", "Mod+Y"],
|
|
7167
|
+
disabled: redoLabel ? false : "Nothing to redo",
|
|
7168
|
+
run: api.redo
|
|
7169
|
+
}];
|
|
7170
|
+
return {
|
|
7171
|
+
...api,
|
|
7172
|
+
canUndo: past.length > 0,
|
|
7173
|
+
canRedo: future.length > 0,
|
|
7174
|
+
undoLabel,
|
|
7175
|
+
redoLabel,
|
|
7176
|
+
past: past.map((x) => x.label),
|
|
7177
|
+
future: future.map((x) => x.label),
|
|
7178
|
+
atLimit: past.length >= max,
|
|
7179
|
+
commands
|
|
7180
|
+
};
|
|
7181
|
+
}, [
|
|
7182
|
+
api,
|
|
7183
|
+
version,
|
|
7184
|
+
max
|
|
7185
|
+
]);
|
|
7186
|
+
}
|
|
7187
|
+
/**
|
|
7188
|
+
* React state with a history: `set(next, "move clip")` changes the value and records the step; Undo
|
|
7189
|
+
* and Redo put the old and new values back. For an app whose document is a plain value. An app on its
|
|
7190
|
+
* own store uses `useHistory` and pushes steps from its actions.
|
|
7191
|
+
*/
|
|
7192
|
+
function useHistoryState(initial, options) {
|
|
7193
|
+
const [value, setValue] = React.useState(initial);
|
|
7194
|
+
const latest = React.useRef(value);
|
|
7195
|
+
const history = useHistory(options);
|
|
7196
|
+
const { push } = history;
|
|
7197
|
+
const write = React.useCallback((next) => {
|
|
7198
|
+
latest.current = next;
|
|
7199
|
+
setValue(next);
|
|
7200
|
+
}, []);
|
|
7201
|
+
return {
|
|
7202
|
+
value,
|
|
7203
|
+
set: React.useCallback((next, label, { key } = {}) => {
|
|
7204
|
+
const before = latest.current;
|
|
7205
|
+
const after = typeof next === "function" ? next(before) : next;
|
|
7206
|
+
if (Object.is(before, after)) return;
|
|
7207
|
+
write(after);
|
|
7208
|
+
push({
|
|
7209
|
+
label,
|
|
7210
|
+
key,
|
|
7211
|
+
undo: () => write(before),
|
|
7212
|
+
redo: () => write(after)
|
|
7213
|
+
});
|
|
7214
|
+
}, [push, write]),
|
|
7215
|
+
reset: React.useCallback((next) => {
|
|
7216
|
+
write(next);
|
|
7217
|
+
history.clear();
|
|
7218
|
+
}, [write, history.clear]),
|
|
7219
|
+
history
|
|
7220
|
+
};
|
|
7221
|
+
}
|
|
7222
|
+
// src/components/save.tsx
|
|
7223
|
+
/** Saves `value` after changes settle, never two at once, and says where it stands. The document's first `value` counts as saved. */
|
|
7224
|
+
function useAutoSave({ value, save, delayMs = 1500, equals = Object.is, describeError = describeActionError }) {
|
|
7225
|
+
const [state, setState] = React.useState({
|
|
7226
|
+
status: "saved",
|
|
7227
|
+
at: null
|
|
7228
|
+
});
|
|
7229
|
+
const latest = React.useRef({
|
|
7230
|
+
value,
|
|
7231
|
+
save,
|
|
7232
|
+
equals,
|
|
7233
|
+
describeError,
|
|
7234
|
+
delayMs
|
|
7235
|
+
});
|
|
7236
|
+
latest.current = {
|
|
7237
|
+
value,
|
|
7238
|
+
save,
|
|
7239
|
+
equals,
|
|
7240
|
+
describeError,
|
|
7241
|
+
delayMs
|
|
7242
|
+
};
|
|
7243
|
+
const saved = React.useRef(value);
|
|
7244
|
+
const savedAt = React.useRef(null);
|
|
7245
|
+
const running = React.useRef(null);
|
|
7246
|
+
const timer = React.useRef(void 0);
|
|
7247
|
+
const mounted = React.useRef(true);
|
|
7248
|
+
React.useEffect(() => {
|
|
7249
|
+
mounted.current = true;
|
|
7250
|
+
return () => {
|
|
7251
|
+
mounted.current = false;
|
|
7252
|
+
window.clearTimeout(timer.current);
|
|
7253
|
+
};
|
|
7254
|
+
}, []);
|
|
7255
|
+
const schedule = React.useCallback(() => {
|
|
7256
|
+
window.clearTimeout(timer.current);
|
|
7257
|
+
if (latest.current.delayMs === null) return;
|
|
7258
|
+
timer.current = window.setTimeout(() => void run(), latest.current.delayMs);
|
|
7259
|
+
}, []);
|
|
7260
|
+
const run = React.useCallback(() => {
|
|
7261
|
+
window.clearTimeout(timer.current);
|
|
7262
|
+
if (running.current) return running.current;
|
|
7263
|
+
const current = latest.current.value;
|
|
7264
|
+
if (latest.current.equals(current, saved.current)) {
|
|
7265
|
+
setState((s) => s.status === "saved" ? s : {
|
|
7266
|
+
status: "saved",
|
|
7267
|
+
at: /* @__PURE__ */ new Date()
|
|
7268
|
+
});
|
|
7269
|
+
return Promise.resolve();
|
|
7270
|
+
}
|
|
7271
|
+
setState({ status: "saving" });
|
|
7272
|
+
let settled = false;
|
|
7273
|
+
const attempt = (async () => {
|
|
7274
|
+
try {
|
|
7275
|
+
await latest.current.save(current);
|
|
7276
|
+
saved.current = current;
|
|
7277
|
+
savedAt.current = /* @__PURE__ */ new Date();
|
|
7278
|
+
if (!mounted.current) return;
|
|
7279
|
+
if (latest.current.equals(latest.current.value, current)) setState({
|
|
7280
|
+
status: "saved",
|
|
7281
|
+
at: savedAt.current
|
|
7282
|
+
});
|
|
7283
|
+
else {
|
|
7284
|
+
setState({ status: "dirty" });
|
|
7285
|
+
schedule();
|
|
7286
|
+
}
|
|
7287
|
+
} catch (error) {
|
|
7288
|
+
if (mounted.current) setState({
|
|
7289
|
+
status: "failed",
|
|
7290
|
+
reason: latest.current.describeError(error)
|
|
7291
|
+
});
|
|
7292
|
+
} finally {
|
|
7293
|
+
settled = true;
|
|
7294
|
+
running.current = null;
|
|
7295
|
+
}
|
|
7296
|
+
})();
|
|
7297
|
+
if (!settled) running.current = attempt;
|
|
7298
|
+
return attempt;
|
|
7299
|
+
}, [schedule]);
|
|
7300
|
+
React.useEffect(() => {
|
|
7301
|
+
if (latest.current.equals(value, saved.current)) {
|
|
7302
|
+
if (!running.current) {
|
|
7303
|
+
window.clearTimeout(timer.current);
|
|
7304
|
+
setState((s) => s.status === "dirty" || s.status === "failed" ? {
|
|
7305
|
+
status: "saved",
|
|
7306
|
+
at: savedAt.current
|
|
7307
|
+
} : s);
|
|
7308
|
+
}
|
|
7309
|
+
return;
|
|
7310
|
+
}
|
|
7311
|
+
if (!running.current) setState((s) => s.status === "failed" ? s : { status: "dirty" });
|
|
7312
|
+
if (!running.current) schedule();
|
|
7313
|
+
}, [value, schedule]);
|
|
7314
|
+
return {
|
|
7315
|
+
state,
|
|
7316
|
+
saveNow: run
|
|
7317
|
+
};
|
|
7318
|
+
}
|
|
7319
|
+
/** Asks the browser to confirm before the page is closed or reloaded, while `active`. Off when there is nothing to lose. */
|
|
7320
|
+
function useLeaveGuard(active) {
|
|
7321
|
+
React.useEffect(() => {
|
|
7322
|
+
if (!active) return;
|
|
7323
|
+
const onBeforeUnload = (e) => {
|
|
7324
|
+
e.preventDefault();
|
|
7325
|
+
e.returnValue = "";
|
|
7326
|
+
};
|
|
7327
|
+
window.addEventListener("beforeunload", onBeforeUnload);
|
|
7328
|
+
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
7329
|
+
}, [active]);
|
|
7330
|
+
}
|
|
7331
|
+
var labelOf$1 = (s) => s.status === "saved" ? s.at ? `Saved ${format.clock(s.at)}` : "Saved" : s.status === "saving" ? "Saving…" : s.status === "dirty" ? "Unsaved changes" : "Not saved";
|
|
7332
|
+
/**
|
|
7333
|
+
* The sign of whether the work is safe: "Saved 10:42", "Saving…", "Unsaved changes", or "Not saved"
|
|
7334
|
+
* with the reason and "Try again". Fixed width, so it never moves what is beside it. Announces a
|
|
7335
|
+
* failure, and the recovery from one, politely; a routine save is silent.
|
|
7336
|
+
*/
|
|
7337
|
+
function SaveStatus({ state, onRetry, className }) {
|
|
7338
|
+
const lastFailure = React.useRef(false);
|
|
7339
|
+
const failed = state.status === "failed";
|
|
7340
|
+
let announcement = "";
|
|
7341
|
+
if (failed) announcement = `Not saved${state.reason ? `: ${state.reason}` : "."} Your changes are still here.`;
|
|
7342
|
+
else if (lastFailure.current && state.status === "saved") announcement = "Saved.";
|
|
7343
|
+
React.useEffect(() => {
|
|
7344
|
+
if (failed) lastFailure.current = true;
|
|
7345
|
+
else if (state.status === "saved") lastFailure.current = false;
|
|
7346
|
+
}, [failed, state.status]);
|
|
7347
|
+
const Icon = {
|
|
7348
|
+
saved: Check,
|
|
7349
|
+
saving: LoaderCircle,
|
|
7350
|
+
dirty: null,
|
|
7351
|
+
failed: CircleAlert
|
|
7352
|
+
}[state.status];
|
|
7353
|
+
const current = labelOf$1(state);
|
|
7354
|
+
const all = [
|
|
7355
|
+
"Saved 00:00",
|
|
7356
|
+
"Saving…",
|
|
7357
|
+
"Unsaved changes",
|
|
7358
|
+
"Not saved"
|
|
7359
|
+
];
|
|
7360
|
+
const shown = failed && state.reason ? `Not saved: ${state.reason}` : current;
|
|
7361
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
7362
|
+
"data-status": state.status,
|
|
7363
|
+
title: failed ? shown : void 0,
|
|
7364
|
+
className: cn("inline-flex w-72 items-center justify-end gap-2 type-body-sm", failed ? "text-danger" : "text-muted-foreground", className),
|
|
7365
|
+
children: [
|
|
7366
|
+
Icon && /* @__PURE__ */ jsx(Icon, {
|
|
7367
|
+
"aria-hidden": true,
|
|
7368
|
+
className: cn("size-4 shrink-0", state.status === "saving" && "motion-safe:animate-spin")
|
|
7369
|
+
}),
|
|
7370
|
+
failed ? /* @__PURE__ */ jsx("span", {
|
|
7371
|
+
className: "min-w-0 truncate",
|
|
7372
|
+
children: shown
|
|
7373
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
7374
|
+
className: "grid",
|
|
7375
|
+
children: all.map((l) => {
|
|
7376
|
+
const active = l === current || l === "Saved 00:00" && state.status === "saved";
|
|
7377
|
+
return /* @__PURE__ */ jsx("span", {
|
|
7378
|
+
"aria-hidden": !active,
|
|
7379
|
+
className: active ? "[grid-area:1/1] text-end tabular-nums" : "invisible [grid-area:1/1] text-end",
|
|
7380
|
+
children: active ? current : l
|
|
7381
|
+
}, l);
|
|
7382
|
+
})
|
|
7383
|
+
}),
|
|
7384
|
+
failed && /* @__PURE__ */ jsx(Button, {
|
|
7385
|
+
size: "sm",
|
|
7386
|
+
variant: "ghost",
|
|
7387
|
+
onClick: onRetry,
|
|
7388
|
+
className: "shrink-0",
|
|
7389
|
+
children: "Try again"
|
|
7390
|
+
}),
|
|
7391
|
+
/* @__PURE__ */ jsx("span", {
|
|
7392
|
+
role: "status",
|
|
7393
|
+
className: "sr-only",
|
|
7394
|
+
children: announcement
|
|
7395
|
+
})
|
|
7396
|
+
]
|
|
7397
|
+
});
|
|
7398
|
+
}
|
|
7399
|
+
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, Breadcrumb, BulkBar, Button, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGroup, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareGrid, CompositionBar, ContextMenu, DEFAULT_TOLERANCE, DataTable, DataView, Density, Dialog, Disclosure, Done, EmptyState, FIT, Field, FileButton, FileDropZone, FileOutcomes, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, Inspector, InspectorSection, JobStatus, KeysLegend, LineChart, LinkCard, LinkCardList, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, MediaStage, Menu, Meter, Metric, MetricStrip, MissingFile, NBSP, NativeSelect, NumberField, PageHeader, Popover, PropertyList, PropertyRow, RateChoice, RowAction, SaveStatus, SeekBar, SelectableGrid, SideNav, Skeleton, Slider, SortableList, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, TableSkeleton, Tabs, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TimeReadout, Timeline, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, Transport, UndoBar, ViewportFrame, VirtualList, VolumeControl, actualPixelsScale, buttonVariants, canFullscreen, clampViewport, cn, colorSchemeScript, commandShortcut, createFormat, createQueryClient, crossedThreshold, describeActionError, describeHttpError, detectPlatform, differences, fetchJson, fieldErrorsOf, format, formatChord, isReservedChord, isTypingTarget, labelOf, matchesAccept, matchesChord, noOverlap, parseChord, parseSort, readErrorBody, readPixels, resample, serialiseSort, staleOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toast, toastTimeout, transportShortcuts, typeSteps, useActiveItem, useAsyncAction, useAutoSave, useClientWork, useColorScheme, useCommands, useDifference, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useJob, useLeaveGuard, useLoad, useSelection, useSystemColorScheme, useTimelineZoom, useUndoable, useViewport, zoomAt };
|
|
7030
7400
|
|
|
7031
7401
|
//# sourceMappingURL=index.js.map
|