@parallelworks/ui 0.77.0 → 0.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -5
- package/dist/access/AccessDrawer.d.ts +28 -7
- package/dist/access/AccessDrawer.js +216 -35
- package/dist/access/AccessList.d.ts +19 -1
- package/dist/access/AccessList.js +220 -9
- package/dist/access/GrantView.d.ts +3 -1
- package/dist/access/GrantView.js +17 -4
- package/dist/access/PrincipalPicker.js +5 -5
- package/dist/access/focus.js +1 -1
- package/dist/access/index.d.ts +2 -2
- package/dist/access/index.js +2 -2
- package/dist/access/strings.d.ts +18 -0
- package/dist/access/strings.js +20 -2
- package/dist/access/types.d.ts +26 -0
- package/dist/ai/components/AllocationSelector.js +1 -1
- package/dist/ai/components/AttachmentManager.js +5 -5
- package/dist/ai/components/AttachmentUpload.js +2 -2
- package/dist/ai/components/BranchNavigator.js +1 -1
- package/dist/ai/components/ChatActivity.js +1 -1
- package/dist/ai/components/ChatEmptyState.js +3 -3
- package/dist/ai/components/ChatInput.js +3 -5
- package/dist/ai/components/ChatLayout.js +1 -1
- package/dist/ai/components/ChatMessage.js +1 -1
- package/dist/ai/components/ChatMessageList.js +2 -2
- package/dist/ai/components/ChatSidebar.js +3 -3
- package/dist/ai/components/ChatThread.js +4 -4
- package/dist/ai/components/ComposerAddMenu.js +9 -20
- package/dist/ai/components/ModelSelector.js +3 -3
- package/dist/ai/components/PastedText.js +5 -5
- package/dist/ai/components/SessionView.js +1 -1
- package/dist/ai/components/ShareDialog.js +3 -3
- package/dist/ai/components/SlashMenu.d.ts +31 -4
- package/dist/ai/components/SlashMenu.js +36 -63
- package/dist/ai/components/agent/ActivityLine.js +1 -1
- package/dist/ai/components/agent/AgentMessageParts.js +13 -13
- package/dist/ai/components/conversationActions.js +3 -3
- package/dist/ai/core/ChatProvider.js +1 -1
- package/dist/ai/core/config.js +1 -1
- package/dist/ai/ui/ConversationSidebar.js +3 -3
- package/dist/ai/ui/sidebar.js +3 -3
- package/dist/assets/yaml.worker-DOBV2lND.js +884 -0
- package/dist/components/ActionMenu.d.ts +38 -9
- package/dist/components/ActionMenu.js +48 -22
- package/dist/components/Avatar.d.ts +66 -6
- package/dist/components/Avatar.js +130 -18
- package/dist/components/Breadcrumbs.d.ts +4 -0
- package/dist/components/Breadcrumbs.js +26 -10
- package/dist/components/Button.d.ts +3 -2
- package/dist/components/Button.js +11 -1
- package/dist/components/Callout.d.ts +3 -2
- package/dist/components/Callout.js +3 -2
- package/dist/components/Card.d.ts +33 -9
- package/dist/components/Card.js +24 -8
- package/dist/components/Checkbox.d.ts +3 -1
- package/dist/components/Checkbox.js +4 -2
- package/dist/components/ColorInput.js +1 -1
- package/dist/components/Combobox.d.ts +23 -0
- package/dist/components/Combobox.js +252 -86
- package/dist/components/ConfirmModal.d.ts +26 -2
- package/dist/components/ConfirmModal.js +81 -15
- package/dist/components/ContextMenu.d.ts +29 -2
- package/dist/components/ContextMenu.js +60 -8
- package/dist/components/CopyButton.d.ts +21 -8
- package/dist/components/CopyButton.js +29 -9
- package/dist/components/CreateModal.d.ts +16 -4
- package/dist/components/CreateModal.js +27 -16
- package/dist/components/DatePicker.d.ts +31 -1
- package/dist/components/DatePicker.js +178 -47
- package/dist/components/DescriptionList.d.ts +13 -3
- package/dist/components/DescriptionList.js +43 -11
- package/dist/components/Disclosure.d.ts +10 -2
- package/dist/components/Disclosure.js +18 -7
- package/dist/components/Drawer.js +5 -5
- package/dist/components/EmptyState.d.ts +12 -4
- package/dist/components/EmptyState.js +18 -10
- package/dist/components/ErrorPage.d.ts +40 -0
- package/dist/components/ErrorPage.js +101 -0
- package/dist/components/ExternalLink.d.ts +4 -1
- package/dist/components/ExternalLink.js +4 -5
- package/dist/components/Field.d.ts +21 -6
- package/dist/components/Field.js +32 -16
- package/dist/components/FileButton.d.ts +19 -0
- package/dist/components/FileButton.js +32 -0
- package/dist/components/HoverCard.d.ts +26 -6
- package/dist/components/HoverCard.js +11 -5
- package/dist/components/IconButton.js +4 -2
- package/dist/components/InfoTip.js +3 -3
- package/dist/components/Input.d.ts +33 -3
- package/dist/components/Input.js +149 -14
- package/dist/components/Kbd.d.ts +40 -0
- package/dist/components/Kbd.js +168 -0
- package/dist/components/Listbox.d.ts +103 -0
- package/dist/components/Listbox.js +190 -0
- package/dist/components/Loader.d.ts +8 -2
- package/dist/components/Loader.js +16 -1
- package/dist/components/Markdown.js +1 -1
- package/dist/components/MarkdownImpl.js +1 -1
- package/dist/components/Menu.d.ts +20 -2
- package/dist/components/Menu.js +48 -19
- package/dist/components/MenuEntries.d.ts +38 -2
- package/dist/components/MenuEntries.js +266 -39
- package/dist/components/Meter.d.ts +50 -11
- package/dist/components/Meter.js +71 -21
- package/dist/components/Modal.d.ts +9 -3
- package/dist/components/Modal.js +68 -29
- package/dist/components/OneTimeCodeInput.js +1 -1
- package/dist/components/PageHeader.js +111 -7
- package/dist/components/PageHeaderAction.d.ts +8 -3
- package/dist/components/PageHeaderAction.js +122 -34
- package/dist/components/Pagination.d.ts +13 -1
- package/dist/components/Pagination.js +90 -19
- package/dist/components/Popover.d.ts +13 -2
- package/dist/components/Popover.js +20 -21
- package/dist/components/Provider.d.ts +140 -3
- package/dist/components/Provider.js +142 -12
- package/dist/components/RefreshButton.d.ts +13 -6
- package/dist/components/RefreshButton.js +17 -9
- package/dist/components/RunStatusIcon.d.ts +16 -7
- package/dist/components/RunStatusIcon.js +21 -8
- package/dist/components/Section.d.ts +11 -4
- package/dist/components/Section.js +33 -22
- package/dist/components/SegmentedControl.d.ts +16 -3
- package/dist/components/SegmentedControl.js +7 -3
- package/dist/components/Select.d.ts +19 -3
- package/dist/components/Select.js +114 -68
- package/dist/components/SelectionCopy.d.ts +10 -0
- package/dist/components/SelectionCopy.js +105 -0
- package/dist/components/SettingModeOption.js +1 -1
- package/dist/components/SettingsCard.js +1 -1
- package/dist/components/Skeleton.js +1 -1
- package/dist/components/StatusBadge.d.ts +55 -10
- package/dist/components/StatusBadge.js +91 -15
- package/dist/components/StickyBar.js +1 -1
- package/dist/components/Table.d.ts +22 -4
- package/dist/components/Table.js +46 -24
- package/dist/components/Tabs.d.ts +9 -4
- package/dist/components/Tabs.js +9 -4
- package/dist/components/Tag.d.ts +49 -0
- package/dist/components/Tag.js +199 -0
- package/dist/components/ThemeEditor.js +1 -1
- package/dist/components/Toast.js +1 -1
- package/dist/components/ToggleGroup.d.ts +4 -1
- package/dist/components/ToggleGroup.js +30 -13
- package/dist/components/Tooltip.d.ts +9 -3
- package/dist/components/Tooltip.js +55 -39
- package/dist/components/buttonClasses.d.ts +5 -2
- package/dist/components/buttonClasses.js +11 -10
- package/dist/components/chart.d.ts +69 -0
- package/dist/components/chart.js +145 -0
- package/dist/components/comboboxItems.d.ts +7 -1
- package/dist/components/comboboxItems.js +6 -2
- package/dist/components/dismiss.d.ts +5 -1
- package/dist/components/dismiss.js +6 -2
- package/dist/components/floating.d.ts +4 -4
- package/dist/components/floating.js +5 -5
- package/dist/components/headerActionsFit.d.ts +37 -0
- package/dist/components/headerActionsFit.js +81 -0
- package/dist/components/pageHeaderStore.d.ts +3 -0
- package/dist/components/pageHeaderStore.js +3 -0
- package/dist/components/pathBreaks.js +2 -2
- package/dist/components/popupContainer.d.ts +17 -0
- package/dist/components/popupContainer.js +69 -0
- package/dist/components/relativeTime.d.ts +21 -10
- package/dist/components/relativeTime.js +50 -22
- package/dist/components/segmented.d.ts +18 -4
- package/dist/components/segmented.js +48 -6
- package/dist/components/typedDate.d.ts +5 -0
- package/dist/components/typedDate.js +50 -0
- package/dist/components/useClosingValue.d.ts +4 -0
- package/dist/components/useClosingValue.js +12 -0
- package/dist/components/useCopy.d.ts +6 -0
- package/dist/components/useCopy.js +3 -3
- package/dist/components/useNarrow.d.ts +2 -0
- package/dist/components/useNarrow.js +16 -0
- package/dist/editor/Editor.js +1 -1
- package/dist/editor/FormCodePanel.js +1 -1
- package/dist/editor/Monaco.js +1 -1
- package/dist/editor/workers.js +1 -1
- package/dist/file-explorer/FileExplorer.js +16 -15
- package/dist/file-explorer/FileExplorerContext.js +2 -2
- package/dist/file-explorer/FilePreview/Viewer.js +3 -3
- package/dist/file-explorer/FilePreview/index.js +2 -2
- package/dist/file-explorer/FileRowsWindow.js +3 -3
- package/dist/file-explorer/FileTable.js +1 -1
- package/dist/file-explorer/LoadMoreRow.js +1 -1
- package/dist/file-explorer/TreeView.js +5 -5
- package/dist/file-explorer/helpers.js +2 -2
- package/dist/file-explorer/toasts.js +2 -2
- package/dist/form/Fields/CheckboxGroupField.js +1 -1
- package/dist/form/Fields/DropdownField.js +1 -1
- package/dist/form/Fields/DurationField.js +2 -2
- package/dist/form/Fields/MultiDropdownField.js +1 -1
- package/dist/form/Fields/NumberField.js +1 -1
- package/dist/form/Fields/ObjectField.js +1 -1
- package/dist/form/Fields/RangeField.js +1 -1
- package/dist/form/Fields/StringField.js +1 -1
- package/dist/form/Form.js +3 -3
- package/dist/form/FormLayout.js +1 -1
- package/dist/form/Wizard/WizardContainer.js +1 -1
- package/dist/form/Wizard/WizardNavigation.js +1 -1
- package/dist/form/Wizard/WizardStepContent.js +1 -1
- package/dist/form/fieldRegistry.js +1 -1
- package/dist/form/formEditing.js +1 -1
- package/dist/format.d.ts +17 -7
- package/dist/format.js +39 -16
- package/dist/graph/AnnotationBanner.js +2 -2
- package/dist/graph/Connectors.js +5 -5
- package/dist/graph/DependencyGraph.js +10 -9
- package/dist/graph/GraphEditor.js +4 -4
- package/dist/graph/GraphEditorDialogs.js +13 -12
- package/dist/graph/GraphNode.js +1 -1
- package/dist/graph/InputDialog.js +5 -5
- package/dist/graph/InputsEditor.js +7 -7
- package/dist/graph/MatrixGroup.js +2 -2
- package/dist/graph/ProblemsButton.js +3 -3
- package/dist/graph/Reveal.js +1 -1
- package/dist/graph/RunWarningsList.js +1 -1
- package/dist/graph/ShortcutsButton.js +25 -8
- package/dist/graph/StepSummaries.js +1 -1
- package/dist/graph/TreeView.js +2 -2
- package/dist/graph/WorkflowSettingsDialog.js +3 -3
- package/dist/graph/editorFields.js +3 -3
- package/dist/graph/editorPrimitives.js +1 -1
- package/dist/graph/editorRows.js +5 -5
- package/dist/graph/fieldProblems.js +2 -2
- package/dist/graph/inputRefs.js +7 -6
- package/dist/graph/stepWith.js +2 -2
- package/dist/index.d.ts +30 -21
- package/dist/index.js +20 -12
- package/dist/list/ActionToolbar.d.ts +4 -0
- package/dist/list/ActionToolbar.js +35 -12
- package/dist/list/ListFilterBar.d.ts +42 -0
- package/dist/list/ListFilterBar.js +789 -0
- package/dist/list/ListPage.d.ts +42 -4
- package/dist/list/ListPage.js +56 -22
- package/dist/list/ListTable.d.ts +27 -3
- package/dist/list/ListTable.js +48 -23
- package/dist/list/ListToolbar.d.ts +31 -0
- package/dist/list/ListToolbar.js +43 -0
- package/dist/list/ListViewControls.d.ts +8 -4
- package/dist/list/ListViewControls.js +22 -14
- package/dist/list/UserHoverCard.d.ts +8 -2
- package/dist/list/UserHoverCard.js +26 -13
- package/dist/list/filterModel.d.ts +122 -0
- package/dist/list/filterModel.js +308 -0
- package/dist/list/index.d.ts +6 -2
- package/dist/list/index.js +6 -2
- package/dist/list/listSearch.d.ts +1 -1
- package/dist/list/listSearch.js +8 -4
- package/dist/list/listView.d.ts +24 -2
- package/dist/list/listView.js +47 -45
- package/dist/list/rowMenu.d.ts +10 -5
- package/dist/list/rowMenu.js +17 -7
- package/dist/list/useListFilters.d.ts +68 -0
- package/dist/list/useListFilters.js +252 -0
- package/dist/logviewer/LogViewer.js +4 -4
- package/dist/styles/theme.css +94 -0
- package/dist/styles.css +1 -1
- package/package.json +11 -11
- package/dist/assets/yaml.worker-k9AdOqzf.js +0 -1441
- package/dist/components/fullscreen.d.ts +0 -4
- package/dist/components/fullscreen.js +0 -18
|
@@ -2,12 +2,14 @@ import { cx } from "../cx.js";
|
|
|
2
2
|
import { buttonClasses } from "./buttonClasses.js";
|
|
3
3
|
import { CalendarIcon, ChevronLeftIcon, ChevronRightIcon } from "../icons.js";
|
|
4
4
|
import { panelClassName, positionerClassName } from "./floating.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { usePopupContainer } from "./popupContainer.js";
|
|
6
|
+
import { Tooltip } from "./Tooltip.js";
|
|
7
|
+
import { useLocale, useStrings } from "./Provider.js";
|
|
7
8
|
import { fieldBox } from "./fieldBox.js";
|
|
8
9
|
import { useFieldLabelledControl } from "./Field.js";
|
|
10
|
+
import { formatNumericDate, parseTypedDate } from "./typedDate.js";
|
|
11
|
+
import { useId, useRef, useState } from "react";
|
|
9
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { useState } from "react";
|
|
11
13
|
import { Popover } from "@base-ui/react/popover";
|
|
12
14
|
import { DayPicker } from "@daypicker/react";
|
|
13
15
|
//#region src/components/DatePicker.tsx
|
|
@@ -23,23 +25,41 @@ function parseDay(value) {
|
|
|
23
25
|
}
|
|
24
26
|
var timeOf = (value) => value?.match(/T(\d{2}:\d{2}(?::\d{2})?)/)?.[1];
|
|
25
27
|
/** The locale's first day of the week, where the browser reports it; Sunday otherwise. */
|
|
26
|
-
function firstWeekday() {
|
|
28
|
+
function firstWeekday(tag) {
|
|
27
29
|
try {
|
|
28
|
-
const locale = new Intl.Locale(navigator.language);
|
|
30
|
+
const locale = new Intl.Locale(tag ?? navigator.language);
|
|
29
31
|
const firstDay = (locale.getWeekInfo?.() ?? locale.weekInfo)?.firstDay;
|
|
30
32
|
return firstDay === void 0 ? 0 : firstDay % 7;
|
|
31
33
|
} catch {
|
|
32
34
|
return 0;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
function dateFormats(locale) {
|
|
38
|
+
return {
|
|
39
|
+
caption: new Intl.DateTimeFormat(locale, {
|
|
40
|
+
month: "long",
|
|
41
|
+
year: "numeric"
|
|
42
|
+
}),
|
|
43
|
+
weekday: new Intl.DateTimeFormat(locale, { weekday: "narrow" }),
|
|
44
|
+
longDay: new Intl.DateTimeFormat(locale, { dateStyle: "full" }),
|
|
45
|
+
shownDay: new Intl.DateTimeFormat(locale, { dateStyle: "medium" }),
|
|
46
|
+
shownDayThisYear: new Intl.DateTimeFormat(locale, {
|
|
47
|
+
month: "short",
|
|
48
|
+
day: "numeric"
|
|
49
|
+
}),
|
|
50
|
+
longWeekday: new Intl.DateTimeFormat(locale, { weekday: "long" }),
|
|
51
|
+
weekStartsOn: firstWeekday(locale)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
var formatsByLocale = /* @__PURE__ */ new Map();
|
|
55
|
+
function formatsFor(locale) {
|
|
56
|
+
let formats = formatsByLocale.get(locale);
|
|
57
|
+
if (!formats) {
|
|
58
|
+
formats = dateFormats(locale);
|
|
59
|
+
formatsByLocale.set(locale, formats);
|
|
60
|
+
}
|
|
61
|
+
return formats;
|
|
62
|
+
}
|
|
43
63
|
var calendarClassNames = {
|
|
44
64
|
root: "relative p-3",
|
|
45
65
|
months: "flex flex-col",
|
|
@@ -74,14 +94,19 @@ var triggerClassName = (size) => cx(fieldBox({ size }), "flex flex-1 cursor-poin
|
|
|
74
94
|
* date or datetime-local input holds it, so it reads the same in forms and URLs; months, weekdays
|
|
75
95
|
* and the shown date follow the reader's locale.
|
|
76
96
|
*/
|
|
77
|
-
function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep = 60, required = false, disabled = false, placeholder, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, size = "md", className }) {
|
|
78
|
-
const
|
|
97
|
+
function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep = 60, required = false, disabled = false, placeholder, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, size = "md", className, trigger, triggerTooltip, align = "start" }) {
|
|
98
|
+
const portal = usePopupContainer();
|
|
79
99
|
const t = useStrings().datePicker;
|
|
80
100
|
const { common } = useStrings();
|
|
81
101
|
const field = useFieldLabelledControl();
|
|
82
102
|
const [open, setOpen] = useState(false);
|
|
83
|
-
const
|
|
103
|
+
const locale = useLocale();
|
|
104
|
+
const { caption, weekday, longDay, shownDay, shownDayThisYear, longWeekday, weekStartsOn } = formatsFor(locale);
|
|
84
105
|
const day = parseDay(value);
|
|
106
|
+
const uid = useId();
|
|
107
|
+
const [month, setMonth] = useState(void 0);
|
|
108
|
+
const [typed, setTyped] = useState("");
|
|
109
|
+
const typedBox = useRef(null);
|
|
85
110
|
const time = timeOf(value) ?? timeOf(min) ?? "00:00";
|
|
86
111
|
const earliest = parseDay(min);
|
|
87
112
|
const latest = parseDay(max);
|
|
@@ -98,37 +123,90 @@ function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep
|
|
|
98
123
|
emit(next);
|
|
99
124
|
setOpen(false);
|
|
100
125
|
};
|
|
126
|
+
const onOpenChange = (next) => {
|
|
127
|
+
if (next) {
|
|
128
|
+
setMonth(opensOn ?? /* @__PURE__ */ new Date());
|
|
129
|
+
setTyped(day ? formatNumericDate(day, locale) : "");
|
|
130
|
+
}
|
|
131
|
+
setOpen(next);
|
|
132
|
+
};
|
|
133
|
+
const inRange = (date) => (!earliest || date >= earliest) && (!latest || date <= latest);
|
|
134
|
+
const typedDay = typed.trim() ? parseTypedDate(typed, locale) : void 0;
|
|
135
|
+
const typedInvalid = typed.trim() !== "" && (!typedDay || !inRange(typedDay));
|
|
136
|
+
const shown = day ? (day.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear() ? shownDayThisYear : shownDay).format(day) : void 0;
|
|
137
|
+
const triggerProps = {
|
|
138
|
+
id: id ?? field?.id,
|
|
139
|
+
disabled,
|
|
140
|
+
"aria-label": ariaLabel,
|
|
141
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel ? void 0 : field?.["aria-labelledby"]),
|
|
142
|
+
"aria-describedby": ariaDescribedBy ?? field?.["aria-describedby"],
|
|
143
|
+
"aria-invalid": ariaInvalid || field?.["aria-invalid"],
|
|
144
|
+
"aria-required": ariaRequired || field?.["aria-required"]
|
|
145
|
+
};
|
|
101
146
|
const sameDay = (bound) => day !== void 0 && parseDay(bound)?.getTime() === day.getTime();
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
children:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"aria-describedby": ariaDescribedBy ?? field?.["aria-describedby"],
|
|
113
|
-
"aria-invalid": ariaInvalid || field?.["aria-invalid"],
|
|
114
|
-
"aria-required": ariaRequired || field?.["aria-required"],
|
|
147
|
+
const picker = /* @__PURE__ */ jsxs(Popover.Root, {
|
|
148
|
+
open,
|
|
149
|
+
onOpenChange,
|
|
150
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
151
|
+
content: triggerTooltip,
|
|
152
|
+
children: trigger ? /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
153
|
+
...triggerProps,
|
|
154
|
+
render: trigger
|
|
155
|
+
}) : /* @__PURE__ */ jsxs(Popover.Trigger, {
|
|
156
|
+
...triggerProps,
|
|
115
157
|
className: triggerClassName(size),
|
|
116
158
|
children: [/* @__PURE__ */ jsx(CalendarIcon, {
|
|
117
159
|
"aria-hidden": "true",
|
|
118
160
|
className: cx("shrink-0 text-(--theme-muted-text-color)", size === "sm" ? "size-3" : "size-3.5")
|
|
119
161
|
}), /* @__PURE__ */ jsx("span", {
|
|
120
162
|
className: cx("truncate", !day && "text-(--theme-placeholder)"),
|
|
121
|
-
children:
|
|
163
|
+
children: shown ?? placeholder ?? t.pickDate
|
|
122
164
|
})]
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
165
|
+
})
|
|
166
|
+
}), /* @__PURE__ */ jsx(Popover.Portal, {
|
|
167
|
+
...portal,
|
|
168
|
+
children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
169
|
+
align,
|
|
170
|
+
sideOffset: 4,
|
|
171
|
+
className: positionerClassName,
|
|
172
|
+
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
173
|
+
initialFocus: typedBox,
|
|
174
|
+
className: panelClassName,
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ jsxs("div", {
|
|
177
|
+
className: "border-b border-(--theme-border) p-2",
|
|
178
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
179
|
+
type: "text",
|
|
180
|
+
inputMode: "numeric",
|
|
181
|
+
autoComplete: "off",
|
|
182
|
+
spellCheck: false,
|
|
183
|
+
"aria-label": t.typeDate,
|
|
184
|
+
"aria-invalid": typedInvalid || void 0,
|
|
185
|
+
"aria-describedby": typedInvalid ? `${uid}invalid` : void 0,
|
|
186
|
+
placeholder: formatNumericDate(/* @__PURE__ */ new Date(), locale),
|
|
187
|
+
value: typed,
|
|
188
|
+
ref: typedBox,
|
|
189
|
+
onChange: (event) => {
|
|
190
|
+
const next = event.target.value;
|
|
191
|
+
setTyped(next);
|
|
192
|
+
const parsed = parseTypedDate(next, locale);
|
|
193
|
+
if (parsed) setMonth(parsed);
|
|
194
|
+
},
|
|
195
|
+
onKeyDown: (event) => {
|
|
196
|
+
if (event.key === "Enter") {
|
|
197
|
+
event.preventDefault();
|
|
198
|
+
if (typedDay && inRange(typedDay)) pick(typedDay);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
className: cx(fieldBox({ size: "sm" }), "tabular-nums")
|
|
202
|
+
}), typedInvalid && /* @__PURE__ */ jsx("div", {
|
|
203
|
+
id: `${uid}invalid`,
|
|
204
|
+
className: "mt-1 text-xs text-(--theme-error-text)",
|
|
205
|
+
"aria-live": "polite",
|
|
206
|
+
children: t.invalidDate
|
|
207
|
+
})]
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ jsx(DayPicker, {
|
|
132
210
|
...required ? {
|
|
133
211
|
mode: "single",
|
|
134
212
|
required: true,
|
|
@@ -139,12 +217,12 @@ function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep
|
|
|
139
217
|
selected: day,
|
|
140
218
|
onSelect: pick
|
|
141
219
|
},
|
|
142
|
-
...
|
|
220
|
+
...month && { month },
|
|
221
|
+
onMonthChange: setMonth,
|
|
143
222
|
...earliest && { startMonth: earliest },
|
|
144
223
|
...latest && { endMonth: latest },
|
|
145
224
|
disabled: outOfRange,
|
|
146
225
|
weekStartsOn,
|
|
147
|
-
autoFocus: true,
|
|
148
226
|
showOutsideDays: true,
|
|
149
227
|
fixedWeeks: true,
|
|
150
228
|
classNames: calendarClassNames,
|
|
@@ -160,7 +238,8 @@ function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep
|
|
|
160
238
|
labelWeekday: (date) => longWeekday.format(date)
|
|
161
239
|
},
|
|
162
240
|
components: { Chevron: ({ orientation }) => orientation === "left" ? /* @__PURE__ */ jsx(ChevronLeftIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { "aria-hidden": "true" }) }
|
|
163
|
-
}),
|
|
241
|
+
}),
|
|
242
|
+
!required && day && /* @__PURE__ */ jsx("div", {
|
|
164
243
|
className: "flex justify-end border-t border-(--theme-border) px-3 py-2",
|
|
165
244
|
children: /* @__PURE__ */ jsx("button", {
|
|
166
245
|
type: "button",
|
|
@@ -174,11 +253,16 @@ function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep
|
|
|
174
253
|
},
|
|
175
254
|
children: common.clear
|
|
176
255
|
})
|
|
177
|
-
})
|
|
178
|
-
|
|
256
|
+
})
|
|
257
|
+
]
|
|
179
258
|
})
|
|
180
|
-
})
|
|
181
|
-
})
|
|
259
|
+
})
|
|
260
|
+
})]
|
|
261
|
+
});
|
|
262
|
+
if (trigger && !withTime) return picker;
|
|
263
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
264
|
+
className: cx(trigger ? "inline-flex" : "flex w-full", "items-center", size === "sm" ? "gap-1.5" : "gap-2", className),
|
|
265
|
+
children: [picker, withTime && /* @__PURE__ */ jsx("input", {
|
|
182
266
|
type: "time",
|
|
183
267
|
"aria-label": t.time,
|
|
184
268
|
value: day ? time : "",
|
|
@@ -195,5 +279,52 @@ function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep
|
|
|
195
279
|
})]
|
|
196
280
|
});
|
|
197
281
|
}
|
|
282
|
+
var rangeClassNames = {
|
|
283
|
+
...calendarClassNames,
|
|
284
|
+
selected: "",
|
|
285
|
+
range_start: "[&>button]:bg-(--theme-accent) [&>button]:text-(--theme-accent-text) [&>button]:hover:bg-(--theme-accent)",
|
|
286
|
+
range_end: "[&>button]:bg-(--theme-accent) [&>button]:text-(--theme-accent-text) [&>button]:hover:bg-(--theme-accent)",
|
|
287
|
+
range_middle: "[&>button]:bg-(--theme-accent-subtle) [&>button]:rounded-none"
|
|
288
|
+
};
|
|
289
|
+
/** The month grid DatePicker opens, for a panel that holds a calendar in place, such as a
|
|
290
|
+
* date filter's picker. Months, weekdays and labels follow the reader's locale. */
|
|
291
|
+
function Calendar({ min, max, defaultMonth, autoFocus = false, ...props }) {
|
|
292
|
+
const t = useStrings().datePicker;
|
|
293
|
+
const { caption, weekday, longDay, longWeekday, weekStartsOn } = formatsFor(useLocale());
|
|
294
|
+
const outOfRange = [...min ? [{ before: min }] : [], ...max ? [{ after: max }] : []];
|
|
295
|
+
const opensOn = defaultMonth ?? (props.mode === "single" ? props.selected : props.selected?.from) ?? min;
|
|
296
|
+
return /* @__PURE__ */ jsx(DayPicker, {
|
|
297
|
+
...props.mode === "single" ? {
|
|
298
|
+
mode: "single",
|
|
299
|
+
selected: props.selected,
|
|
300
|
+
onSelect: props.onSelect
|
|
301
|
+
} : {
|
|
302
|
+
mode: "range",
|
|
303
|
+
selected: props.selected,
|
|
304
|
+
onSelect: props.onSelect
|
|
305
|
+
},
|
|
306
|
+
...opensOn && { defaultMonth: opensOn },
|
|
307
|
+
...min && { startMonth: min },
|
|
308
|
+
...max && { endMonth: max },
|
|
309
|
+
disabled: outOfRange,
|
|
310
|
+
weekStartsOn,
|
|
311
|
+
autoFocus,
|
|
312
|
+
showOutsideDays: true,
|
|
313
|
+
fixedWeeks: true,
|
|
314
|
+
classNames: props.mode === "range" ? rangeClassNames : calendarClassNames,
|
|
315
|
+
formatters: {
|
|
316
|
+
formatCaption: (month) => caption.format(month),
|
|
317
|
+
formatWeekdayName: (date) => weekday.format(date)
|
|
318
|
+
},
|
|
319
|
+
labels: {
|
|
320
|
+
labelDayButton: (date) => longDay.format(date),
|
|
321
|
+
labelPrevious: () => t.previousMonth,
|
|
322
|
+
labelNext: () => t.nextMonth,
|
|
323
|
+
labelGrid: (month) => caption.format(month),
|
|
324
|
+
labelWeekday: (date) => longWeekday.format(date)
|
|
325
|
+
},
|
|
326
|
+
components: { Chevron: ({ orientation }) => orientation === "left" ? /* @__PURE__ */ jsx(ChevronLeftIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { "aria-hidden": "true" }) }
|
|
327
|
+
});
|
|
328
|
+
}
|
|
198
329
|
//#endregion
|
|
199
|
-
export { DatePicker };
|
|
330
|
+
export { Calendar, DatePicker };
|
|
@@ -13,22 +13,28 @@ export interface DescriptionListProps extends Omit<ComponentPropsWithoutRef<'dl'
|
|
|
13
13
|
* list is too narrow for both side by side. In a DescriptionListGroup, the group's
|
|
14
14
|
* `stacked` decides. */
|
|
15
15
|
stacked?: boolean | undefined;
|
|
16
|
+
/** `xs` sets smaller type, for a dense panel of details such as a job's;
|
|
17
|
+
* in a DescriptionListGroup, the group's `size` decides. */
|
|
18
|
+
size?: DescriptionListSize | undefined;
|
|
16
19
|
/** Styles the box around the list, such as its margins or width. */
|
|
17
20
|
className?: string | undefined;
|
|
18
21
|
}
|
|
22
|
+
export type DescriptionListSize = 'sm' | 'xs';
|
|
19
23
|
/** Names and their values, such as the details of a record in a drawer or a card. The
|
|
20
24
|
* label column is as wide as its longest label, up to two fifths of the list, so a
|
|
21
25
|
* long label wraps rather than squeezing the values; each label sits over its value
|
|
22
26
|
* when the list is narrow. Lists side by side in one panel share their label column
|
|
23
27
|
* inside a `DescriptionListGroup`. */
|
|
24
|
-
export default function DescriptionList({ variant, title, headingLevel, stacked, className, children, ...props }: DescriptionListProps): import("react").JSX.Element;
|
|
28
|
+
export default function DescriptionList({ variant, title, headingLevel, stacked, size: sizeProp, className, children, ...props }: DescriptionListProps): import("react").JSX.Element;
|
|
25
29
|
/** Description lists in one panel, such as a record's Overview, Actor and Target, that
|
|
26
30
|
* share one label column: it fits the longest label across all of them, so their
|
|
27
31
|
* values start at one edge down the panel. Each list keeps its own title and variant;
|
|
28
32
|
* all of them stack together when the panel is narrow. */
|
|
29
|
-
export declare function DescriptionListGroup({ stacked, className, children, }: {
|
|
33
|
+
export declare function DescriptionListGroup({ stacked, size, className, children, }: {
|
|
30
34
|
/** Puts each label over its value at any width. */
|
|
31
35
|
stacked?: boolean | undefined;
|
|
36
|
+
/** Every list's type size, so the lists in one panel match. */
|
|
37
|
+
size?: DescriptionListSize | undefined;
|
|
32
38
|
/** Styles the box around the group, such as its margins or width. */
|
|
33
39
|
className?: string | undefined;
|
|
34
40
|
/** `DescriptionList`s. */
|
|
@@ -46,7 +52,11 @@ export interface DescriptionListItemProps {
|
|
|
46
52
|
/** Adds a button that copies the value: `true` copies its text as shown; a string
|
|
47
53
|
* copies that instead, such as a full ID behind a shortened one. */
|
|
48
54
|
copy?: boolean | string | undefined;
|
|
55
|
+
/** Keeps the value to one line, cut off with an ellipsis, and shows it whole
|
|
56
|
+
* on hover, for a long ID or a list of nodes in a dense panel. `copy` still
|
|
57
|
+
* copies all of it. */
|
|
58
|
+
truncate?: boolean | undefined;
|
|
49
59
|
className?: string | undefined;
|
|
50
60
|
}
|
|
51
61
|
/** A label and its value in a DescriptionList. */
|
|
52
|
-
export declare function DescriptionListItem({ label, children, tooltip, mono, copy, className, }: DescriptionListItemProps): import("react").JSX.Element;
|
|
62
|
+
export declare function DescriptionListItem({ label, children, tooltip, mono, copy, truncate, className, }: DescriptionListItemProps): import("react").JSX.Element;
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { cx } from "../cx.js";
|
|
2
|
+
import { Tooltip } from "./Tooltip.js";
|
|
2
3
|
import { useStrings } from "./Provider.js";
|
|
3
4
|
import { InfoTip } from "./InfoTip.js";
|
|
4
5
|
import { CopyButton } from "./CopyButton.js";
|
|
5
6
|
import { withPathBreaks } from "./pathBreaks.js";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { createContext, useContext, useId, useRef } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/DescriptionList.tsx
|
|
10
|
+
var sizeText = {
|
|
11
|
+
sm: "text-sm",
|
|
12
|
+
xs: "text-xs"
|
|
13
|
+
};
|
|
14
|
+
var sizeLeading = {
|
|
15
|
+
sm: "leading-5",
|
|
16
|
+
xs: "leading-4"
|
|
17
|
+
};
|
|
18
|
+
var sizeMono = {
|
|
19
|
+
sm: "font-mono text-[0.8125rem]",
|
|
20
|
+
xs: "font-mono text-[0.75rem]"
|
|
21
|
+
};
|
|
22
|
+
var SizeContext = createContext(null);
|
|
9
23
|
var variantClasses = {
|
|
10
24
|
plain: "*:py-1",
|
|
11
25
|
divided: "divide-y divide-(--theme-border) *:py-2",
|
|
@@ -19,14 +33,18 @@ var titleClassName = "col-span-full m-0 mb-1 text-sm font-semibold text-(--theme
|
|
|
19
33
|
* long label wraps rather than squeezing the values; each label sits over its value
|
|
20
34
|
* when the list is narrow. Lists side by side in one panel share their label column
|
|
21
35
|
* inside a `DescriptionListGroup`. */
|
|
22
|
-
function DescriptionList({ variant = "plain", title, headingLevel = 3, stacked = false, className, children, ...props }) {
|
|
36
|
+
function DescriptionList({ variant = "plain", title, headingLevel = 3, stacked = false, size: sizeProp, className, children, ...props }) {
|
|
23
37
|
const grouped = useContext(InGroup);
|
|
38
|
+
const size = useContext(SizeContext) ?? sizeProp ?? "sm";
|
|
24
39
|
const titleId = useId();
|
|
25
40
|
const Heading = `h${headingLevel}`;
|
|
26
41
|
const list = /* @__PURE__ */ jsx("dl", {
|
|
27
42
|
...props,
|
|
28
|
-
className: cx("m-0
|
|
29
|
-
children
|
|
43
|
+
className: cx("m-0", sizeText[size], grouped ? "col-span-full grid grid-cols-subgrid" : columns(stacked), variantClasses[variant]),
|
|
44
|
+
children: /* @__PURE__ */ jsx(SizeContext, {
|
|
45
|
+
value: size,
|
|
46
|
+
children
|
|
47
|
+
})
|
|
30
48
|
});
|
|
31
49
|
const named = title !== void 0 ? {
|
|
32
50
|
role: "group",
|
|
@@ -52,26 +70,31 @@ function DescriptionList({ variant = "plain", title, headingLevel = 3, stacked =
|
|
|
52
70
|
* share one label column: it fits the longest label across all of them, so their
|
|
53
71
|
* values start at one edge down the panel. Each list keeps its own title and variant;
|
|
54
72
|
* all of them stack together when the panel is narrow. */
|
|
55
|
-
function DescriptionListGroup({ stacked = false, className, children }) {
|
|
73
|
+
function DescriptionListGroup({ stacked = false, size, className, children }) {
|
|
56
74
|
return /* @__PURE__ */ jsx("div", {
|
|
57
75
|
className: cx("@container/dl min-w-0", className),
|
|
58
76
|
children: /* @__PURE__ */ jsx("div", {
|
|
59
77
|
className: cx(columns(stacked), "gap-y-6"),
|
|
60
78
|
children: /* @__PURE__ */ jsx(InGroup, {
|
|
61
79
|
value: true,
|
|
62
|
-
children
|
|
80
|
+
children: size ? /* @__PURE__ */ jsx(SizeContext, {
|
|
81
|
+
value: size,
|
|
82
|
+
children
|
|
83
|
+
}) : children
|
|
63
84
|
})
|
|
64
85
|
})
|
|
65
86
|
});
|
|
66
87
|
}
|
|
67
88
|
var isEmpty = (value) => value === null || value === void 0 || value === false || value === "";
|
|
68
89
|
/** A label and its value in a DescriptionList. */
|
|
69
|
-
function DescriptionListItem({ label, children, tooltip, mono = false, copy = false, className }) {
|
|
90
|
+
function DescriptionListItem({ label, children, tooltip, mono = false, copy = false, truncate = false, className }) {
|
|
70
91
|
const labelId = useId();
|
|
92
|
+
const size = useContext(SizeContext) ?? "sm";
|
|
93
|
+
const leading = sizeLeading[size];
|
|
71
94
|
return /* @__PURE__ */ jsxs("div", {
|
|
72
95
|
className: cx("col-span-full grid grid-cols-subgrid gap-y-0.5", className),
|
|
73
96
|
children: [/* @__PURE__ */ jsxs("dt", {
|
|
74
|
-
className: "min-w-0
|
|
97
|
+
className: cx("min-w-0 wrap-break-word text-(--theme-muted-text-color)", leading),
|
|
75
98
|
children: [/* @__PURE__ */ jsx("span", {
|
|
76
99
|
id: labelId,
|
|
77
100
|
children: label
|
|
@@ -81,9 +104,17 @@ function DescriptionListItem({ label, children, tooltip, mono = false, copy = fa
|
|
|
81
104
|
})]
|
|
82
105
|
}), /* @__PURE__ */ jsx("dd", {
|
|
83
106
|
className: "m-0 flex min-w-0 items-start gap-1 text-(--theme-app)",
|
|
84
|
-
children: isEmpty(children) ? /* @__PURE__ */ jsx(EmptyValue, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(
|
|
107
|
+
children: isEmpty(children) ? /* @__PURE__ */ jsx(EmptyValue, {}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [truncate ? /* @__PURE__ */ jsx(Tooltip, {
|
|
108
|
+
content: children,
|
|
109
|
+
overflowOnly: true,
|
|
110
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
111
|
+
"data-value": true,
|
|
112
|
+
className: cx("min-w-0 truncate", leading, mono && sizeMono[size]),
|
|
113
|
+
children
|
|
114
|
+
})
|
|
115
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
85
116
|
"data-value": true,
|
|
86
|
-
className: cx("min-w-0
|
|
117
|
+
className: cx("min-w-0 wrap-anywhere", leading, mono && sizeMono[size]),
|
|
87
118
|
children: withPathBreaks(children)
|
|
88
119
|
}), copy !== false && /* @__PURE__ */ jsx(CopyValue, {
|
|
89
120
|
text: copy === true ? void 0 : copy,
|
|
@@ -96,8 +127,9 @@ function DescriptionListItem({ label, children, tooltip, mono = false, copy = fa
|
|
|
96
127
|
var EMPTY_MARK = "—";
|
|
97
128
|
function EmptyValue() {
|
|
98
129
|
const { common: t } = useStrings();
|
|
130
|
+
const size = useContext(SizeContext) ?? "sm";
|
|
99
131
|
return /* @__PURE__ */ jsxs("span", {
|
|
100
|
-
className: "
|
|
132
|
+
className: cx("text-(--theme-muted-text-color)", sizeLeading[size]),
|
|
101
133
|
children: [/* @__PURE__ */ jsx("span", {
|
|
102
134
|
"aria-hidden": "true",
|
|
103
135
|
children: EMPTY_MARK
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { MouseEventHandler, ReactNode } from 'react';
|
|
2
2
|
/** The height a collapsible panel animates as it opens and closes. It clips
|
|
3
3
|
* only while it moves, so focus rings and overflowing content show once open. */
|
|
4
4
|
export declare const collapsePanelClassName = "h-(--collapsible-panel-height) transition-[height,opacity] duration-200 ease-out motion-reduce:transition-none data-starting-style:h-0 data-starting-style:overflow-hidden data-starting-style:opacity-0 data-ending-style:h-0 data-ending-style:overflow-hidden data-ending-style:opacity-0";
|
|
@@ -17,12 +17,20 @@ export interface DisclosureProps {
|
|
|
17
17
|
summaryClassName?: string | undefined;
|
|
18
18
|
/** On the revealed detail: its indent and spacing. */
|
|
19
19
|
panelClassName?: string | undefined;
|
|
20
|
+
/** False drops the chevron, for a row that reads as a toggle on its own, such as a whole
|
|
21
|
+
* list row that opens its detail. */
|
|
22
|
+
chevron?: boolean | undefined;
|
|
23
|
+
/** Controls beside the summary, outside the toggle, so a row can hold buttons without
|
|
24
|
+
* nesting them in it. */
|
|
25
|
+
actions?: ReactNode;
|
|
26
|
+
/** On the whole disclosure, summary and detail, such as a row's own menu. */
|
|
27
|
+
onContextMenu?: MouseEventHandler<HTMLDivElement> | undefined;
|
|
20
28
|
children: ReactNode;
|
|
21
29
|
}
|
|
22
30
|
/** A line inside content that reveals more detail beneath it, such as a tool
|
|
23
31
|
* call's arguments or a model's reasoning. For a titled part of a page or
|
|
24
32
|
* form, which belongs in the page's outline, use Section. */
|
|
25
|
-
export declare function Disclosure({ summary, open, onOpenChange, defaultOpen, disabled, keepMounted, className, summaryClassName, panelClassName, children, }: DisclosureProps): import("react").JSX.Element;
|
|
33
|
+
export declare function Disclosure({ summary, open, onOpenChange, defaultOpen, disabled, keepMounted, className, summaryClassName, panelClassName, chevron, actions, onContextMenu, children, }: DisclosureProps): import("react").JSX.Element;
|
|
26
34
|
/** The revealing panel alone, for a toggle that lives elsewhere, such as a
|
|
27
35
|
* tree row's chevron that names this panel with `aria-controls`. */
|
|
28
36
|
export declare function DisclosurePanel({ open, id, keepMounted, className, children, }: {
|
|
@@ -9,20 +9,31 @@ var collapsePanelClassName = "h-(--collapsible-panel-height) transition-[height,
|
|
|
9
9
|
/** A line inside content that reveals more detail beneath it, such as a tool
|
|
10
10
|
* call's arguments or a model's reasoning. For a titled part of a page or
|
|
11
11
|
* form, which belongs in the page's outline, use Section. */
|
|
12
|
-
function Disclosure({ summary, open, onOpenChange, defaultOpen = false, disabled = false, keepMounted = false, className, summaryClassName, panelClassName, children }) {
|
|
12
|
+
function Disclosure({ summary, open, onOpenChange, defaultOpen = false, disabled = false, keepMounted = false, className, summaryClassName, panelClassName, chevron = true, actions, onContextMenu, children }) {
|
|
13
|
+
const toggle = /* @__PURE__ */ jsxs(Collapsible.Trigger, {
|
|
14
|
+
className: cx("group/disclosure flex min-w-0 items-start gap-2 rounded-sm text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--theme-focus)", disabled ? "cursor-default" : "cursor-pointer", summaryClassName),
|
|
15
|
+
children: [summary, !disabled && chevron && /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
className: "mt-1 h-3.5 w-3.5 shrink-0 opacity-70 transition-transform group-data-panel-open/disclosure:rotate-90 motion-reduce:transition-none"
|
|
18
|
+
})]
|
|
19
|
+
});
|
|
13
20
|
return /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
14
21
|
open,
|
|
15
22
|
onOpenChange: (next) => onOpenChange?.(next),
|
|
16
23
|
defaultOpen,
|
|
17
24
|
disabled,
|
|
18
25
|
className,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
className: "
|
|
26
|
+
onContextMenu,
|
|
27
|
+
children: [actions ? /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
className: "flex min-w-0 items-center gap-2",
|
|
29
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
30
|
+
className: "flex min-w-0 flex-1",
|
|
31
|
+
children: toggle
|
|
32
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
33
|
+
className: "flex shrink-0 items-center gap-1",
|
|
34
|
+
children: actions
|
|
24
35
|
})]
|
|
25
|
-
}), /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
36
|
+
}) : toggle, /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
26
37
|
keepMounted,
|
|
27
38
|
className: cx(collapsePanelClassName, panelClassName),
|
|
28
39
|
children
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { cx } from "../cx.js";
|
|
2
2
|
import { ArrowLeftIcon, CloseIcon } from "../icons.js";
|
|
3
|
-
import {
|
|
3
|
+
import { usePopupContainer } from "./popupContainer.js";
|
|
4
4
|
import { useStrings } from "./Provider.js";
|
|
5
5
|
import { IconButton } from "./IconButton.js";
|
|
6
6
|
import { closeHandler } from "./dismiss.js";
|
|
7
7
|
import { useSplitter } from "./splitter.js";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { Drawer } from "@base-ui/react/drawer";
|
|
11
11
|
//#region src/components/Drawer.tsx
|
|
12
12
|
/** A panel that slides in from an edge over the page. A swipe toward that edge,
|
|
@@ -17,7 +17,7 @@ import { Drawer } from "@base-ui/react/drawer";
|
|
|
17
17
|
* `--app-inset-start` (a start-side sidebar's width, at least 2.5rem). Set both
|
|
18
18
|
* on the document root. */
|
|
19
19
|
function Drawer$1({ open, onClose, title, description, onBack, backLabel, footer, side = "right", width = 480, resizable = false, minWidth = 320, dismissible = true, modal = true, closeButton = true, contained = false, keepMounted = false, padded = true, className, children, ...popupProps }) {
|
|
20
|
-
const
|
|
20
|
+
const portal = usePopupContainer();
|
|
21
21
|
const { common } = useStrings();
|
|
22
22
|
const container = useRef(null);
|
|
23
23
|
const viewport = useRef(null);
|
|
@@ -44,9 +44,9 @@ function Drawer$1({ open, onClose, title, description, onBack, backLabel, footer
|
|
|
44
44
|
ref: container,
|
|
45
45
|
className: "contents"
|
|
46
46
|
}), /* @__PURE__ */ jsxs(Drawer.Portal, {
|
|
47
|
-
container: contained ? container :
|
|
47
|
+
container: contained ? container : portal.container,
|
|
48
48
|
keepMounted,
|
|
49
|
-
className: contained ? "contents" :
|
|
49
|
+
className: contained ? "contents" : portal.className,
|
|
50
50
|
children: [modal !== false && /* @__PURE__ */ jsx(Drawer.Backdrop, { className: cx(area, "z-(--layer-drawer) bg-black/40 opacity-[calc(1-var(--drawer-swipe-progress))] transition-opacity duration-300 data-ending-style:opacity-0 data-starting-style:opacity-0 data-swiping:duration-0 motion-reduce:transition-none") }), /* @__PURE__ */ jsx(Drawer.Viewport, {
|
|
51
51
|
ref: viewport,
|
|
52
52
|
className: cx(area, "pointer-events-none z-(--layer-drawer) flex", side === "right" ? "justify-end pl-[max(var(--app-inset-start,0px),2.5rem)]" : "justify-start pl-(--app-inset-start,0px) pr-10"),
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
/** `panel` frames it in a card, standing in for a whole page or list; `plain`
|
|
3
|
+
* gives it the same room with no frame, for a list or page body that holds
|
|
4
|
+
* nothing; `dashed` draws a dashed frame, for a place to add or drop the
|
|
5
|
+
* first item; `bare` is small, inside something that already frames it, such
|
|
6
|
+
* as a sidebar, a menu or a dialog. */
|
|
7
|
+
export type EmptyStateVariant = 'panel' | 'plain' | 'dashed' | 'bare';
|
|
2
8
|
export interface EmptyStateProps {
|
|
3
9
|
title: ReactNode;
|
|
4
10
|
description?: ReactNode;
|
|
5
11
|
/** What to do about it, such as a create button. */
|
|
6
12
|
action?: ReactNode;
|
|
13
|
+
/** A glyph for what is missing, drawn bare and faded above the title. */
|
|
7
14
|
icon?: ReactNode;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
variant?: EmptyStateVariant | undefined;
|
|
16
|
+
/** Makes the title a heading at this level, for an empty state that stands
|
|
17
|
+
* in for a section's content; a paragraph otherwise. */
|
|
18
|
+
headingLevel?: 2 | 3 | 4 | undefined;
|
|
11
19
|
className?: string | undefined;
|
|
12
20
|
testId?: string | undefined;
|
|
13
21
|
}
|
|
14
22
|
/** What shows where there is nothing yet, or nothing matches: what's missing,
|
|
15
23
|
* and what to do about it. */
|
|
16
|
-
export declare function EmptyState({ title, description, action, icon, variant, className, testId, }: EmptyStateProps): import("react").JSX.Element;
|
|
24
|
+
export declare function EmptyState({ title, description, action, icon, variant, headingLevel, className, testId, }: EmptyStateProps): import("react").JSX.Element;
|
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
import { cx } from "../cx.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/EmptyState.tsx
|
|
4
|
+
var frames = {
|
|
5
|
+
panel: "panel px-6 py-12",
|
|
6
|
+
plain: "px-6 py-16",
|
|
7
|
+
dashed: "rounded-xl border border-dashed border-(--theme-border) px-6 py-12",
|
|
8
|
+
bare: "px-3 py-6"
|
|
9
|
+
};
|
|
4
10
|
/** What shows where there is nothing yet, or nothing matches: what's missing,
|
|
5
11
|
* and what to do about it. */
|
|
6
|
-
function EmptyState({ title, description, action, icon, variant = "panel", className, testId }) {
|
|
7
|
-
const
|
|
12
|
+
function EmptyState({ title, description, action, icon, variant = "panel", headingLevel, className, testId }) {
|
|
13
|
+
const bare = variant === "bare";
|
|
14
|
+
const Title = headingLevel ? `h${headingLevel}` : "p";
|
|
8
15
|
return /* @__PURE__ */ jsxs("div", {
|
|
9
16
|
"data-testid": testId,
|
|
10
|
-
className: cx("flex flex-col items-center justify-center text-center",
|
|
17
|
+
className: cx("flex flex-col items-center justify-center text-center", frames[variant], className),
|
|
11
18
|
children: [
|
|
12
|
-
icon && /* @__PURE__ */ jsx("div", {
|
|
13
|
-
|
|
19
|
+
!!icon && /* @__PURE__ */ jsx("div", {
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
className: cx("flex items-center justify-center text-(--theme-muted-text-color) opacity-40", bare ? "mb-2 [&_svg]:size-6" : "mb-3 [&_svg]:size-8"),
|
|
14
22
|
children: icon
|
|
15
23
|
}),
|
|
16
|
-
/* @__PURE__ */ jsx(
|
|
17
|
-
className: cx("text-sm",
|
|
24
|
+
/* @__PURE__ */ jsx(Title, {
|
|
25
|
+
className: cx("m-0 text-sm", bare ? "text-(--theme-muted-text-color)" : "mb-1 font-medium text-(--theme-app)"),
|
|
18
26
|
children: title
|
|
19
27
|
}),
|
|
20
|
-
description && /* @__PURE__ */ jsx("p", {
|
|
21
|
-
className: "max-w-
|
|
28
|
+
!!description && /* @__PURE__ */ jsx("p", {
|
|
29
|
+
className: "m-0 max-w-sm text-xs text-(--theme-muted-text-color)",
|
|
22
30
|
children: description
|
|
23
31
|
}),
|
|
24
|
-
action && /* @__PURE__ */ jsx("div", {
|
|
32
|
+
!!action && /* @__PURE__ */ jsx("div", {
|
|
25
33
|
className: "mt-4",
|
|
26
34
|
children: action
|
|
27
35
|
})
|