@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
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
import { safeUrl } from "../safeUrl.js";
|
|
2
|
+
import { ContextMenuProvider } from "./ContextMenu.js";
|
|
2
3
|
import { useLocalPersistedState } from "./persistedState.js";
|
|
3
4
|
import { Toaster } from "./Toast.js";
|
|
4
5
|
import { TooltipProvider } from "./Tooltip.js";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { createContext, use, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { CSPProvider } from "@base-ui/react/csp-provider";
|
|
8
9
|
import { dequal } from "dequal";
|
|
9
10
|
//#region src/components/Provider.tsx
|
|
11
|
+
/** What a host passes to translate the strings: any group, any string in it, at any depth.
|
|
12
|
+
* A string it leaves out stays in English. */
|
|
13
|
+
var OPERATOR_WORDS = {
|
|
14
|
+
is: (n) => n > 1 ? "is any of" : "is",
|
|
15
|
+
isNot: (n) => n > 1 ? "is none of" : "is not",
|
|
16
|
+
includesAll: (n) => n > 1 ? "includes all of" : "includes",
|
|
17
|
+
after: () => "is after",
|
|
18
|
+
before: () => "is before",
|
|
19
|
+
between: () => "is between",
|
|
20
|
+
contains: () => "contains",
|
|
21
|
+
notContains: () => "does not contain",
|
|
22
|
+
isSet: () => "is set",
|
|
23
|
+
isNotSet: () => "is not set"
|
|
24
|
+
};
|
|
25
|
+
var dayFormats = /* @__PURE__ */ new Map();
|
|
26
|
+
function dayFormat(locale) {
|
|
27
|
+
let formats = dayFormats.get(locale);
|
|
28
|
+
if (!formats) {
|
|
29
|
+
formats = {
|
|
30
|
+
short: new Intl.DateTimeFormat(locale, {
|
|
31
|
+
month: "short",
|
|
32
|
+
day: "numeric"
|
|
33
|
+
}),
|
|
34
|
+
medium: new Intl.DateTimeFormat(locale, { dateStyle: "medium" })
|
|
35
|
+
};
|
|
36
|
+
dayFormats.set(locale, formats);
|
|
37
|
+
}
|
|
38
|
+
return formats;
|
|
39
|
+
}
|
|
10
40
|
var isGroup = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11
41
|
function mergeStrings(defaults, overrides) {
|
|
12
42
|
if (!isGroup(overrides) || !isGroup(defaults)) return defaults;
|
|
@@ -81,6 +111,7 @@ var DEFAULTS = {
|
|
|
81
111
|
copyThing: (label) => `Copy ${label}`,
|
|
82
112
|
copiedThing: (label) => `Copied ${label}`,
|
|
83
113
|
copyThingFailed: (label) => `Couldn't copy ${label}`,
|
|
114
|
+
countOverflow: (max) => `${max}+`,
|
|
84
115
|
noValue: "None",
|
|
85
116
|
invalidName: "Use letters, numbers, dashes, and underscores.",
|
|
86
117
|
invalidNumber: "Use a number.",
|
|
@@ -122,7 +153,10 @@ var DEFAULTS = {
|
|
|
122
153
|
panelWidth: (px) => `${px} pixels wide`,
|
|
123
154
|
refresh: "Refresh",
|
|
124
155
|
refreshing: "Refreshing",
|
|
125
|
-
updated: (ago) => `Updated ${ago}
|
|
156
|
+
updated: (ago) => `Updated ${ago}`,
|
|
157
|
+
moreCount: (count) => `${count} more`,
|
|
158
|
+
copySelection: "Copy selection",
|
|
159
|
+
hiddenValue: "Hidden value"
|
|
126
160
|
},
|
|
127
161
|
dropdown: {
|
|
128
162
|
select: (type) => `Select ${type}`,
|
|
@@ -130,6 +164,8 @@ var DEFAULTS = {
|
|
|
130
164
|
searching: "Searching…",
|
|
131
165
|
showOptions: "Show options",
|
|
132
166
|
add: (text) => `Add “${text}”`,
|
|
167
|
+
create: (text) => `Create “${text}”`,
|
|
168
|
+
suggested: "Suggested",
|
|
133
169
|
limitReached: (max) => `Up to ${max}`,
|
|
134
170
|
removeValue: (label) => `Remove ${label}`
|
|
135
171
|
},
|
|
@@ -137,7 +173,9 @@ var DEFAULTS = {
|
|
|
137
173
|
pickDate: "Pick a date",
|
|
138
174
|
time: "Time",
|
|
139
175
|
previousMonth: "Previous month",
|
|
140
|
-
nextMonth: "Next month"
|
|
176
|
+
nextMonth: "Next month",
|
|
177
|
+
typeDate: "Type a date",
|
|
178
|
+
invalidDate: "Not a date that can be chosen"
|
|
141
179
|
},
|
|
142
180
|
colorInput: {
|
|
143
181
|
pick: (name) => name ? `Pick ${name.toLowerCase()}` : "Pick a color",
|
|
@@ -524,8 +562,23 @@ var DEFAULTS = {
|
|
|
524
562
|
minutes: (n) => `${n}m`,
|
|
525
563
|
hours: (n) => `${n}h`,
|
|
526
564
|
days: (n) => `${n}d`,
|
|
527
|
-
years: (n) => `${n}y
|
|
565
|
+
years: (n) => `${n}y`,
|
|
566
|
+
inFuture: (label) => `in ${label}`,
|
|
567
|
+
date: (date, locale) => dayFormat(locale)[date.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear() ? "short" : "medium"].format(date)
|
|
568
|
+
},
|
|
569
|
+
keys: {
|
|
570
|
+
ctrl: "Ctrl",
|
|
571
|
+
alt: "Alt",
|
|
572
|
+
shift: "Shift",
|
|
573
|
+
meta: "Meta",
|
|
574
|
+
enter: "Enter",
|
|
575
|
+
escape: "Esc",
|
|
576
|
+
space: "Space",
|
|
577
|
+
tab: "Tab",
|
|
578
|
+
backspace: "Backspace",
|
|
579
|
+
delete: "Delete"
|
|
528
580
|
},
|
|
581
|
+
chart: { total: "Total" },
|
|
529
582
|
list: {
|
|
530
583
|
moreActions: "More actions",
|
|
531
584
|
labelName: "name",
|
|
@@ -535,6 +588,7 @@ var DEFAULTS = {
|
|
|
535
588
|
labelId: "ID",
|
|
536
589
|
labelUrl: "URL",
|
|
537
590
|
couldNotLoad: (noun) => `Couldn't load ${noun}`,
|
|
591
|
+
couldNotLoadHint: "Something went wrong. Try again in a moment.",
|
|
538
592
|
data: "data",
|
|
539
593
|
count: (count, noun) => `${count} ${noun}`,
|
|
540
594
|
matchCount: (matches, total, nounPlural) => `${matches} of ${total} ${nounPlural}`,
|
|
@@ -562,7 +616,62 @@ var DEFAULTS = {
|
|
|
562
616
|
paginationPrevious: "Previous",
|
|
563
617
|
paginationNext: "Next",
|
|
564
618
|
pagination: "Pagination",
|
|
619
|
+
page: (page) => `Page ${page}`,
|
|
565
620
|
removeSearchTerm: (term) => `Remove filter ${term}`
|
|
621
|
+
},
|
|
622
|
+
filters: {
|
|
623
|
+
addFilter: "Filter",
|
|
624
|
+
searchFields: "Filter by…",
|
|
625
|
+
activeFilters: "Active filters",
|
|
626
|
+
filterButton: (count) => count > 0 ? `Filter, ${count} on` : "Filter",
|
|
627
|
+
any: "Any",
|
|
628
|
+
pending: "Choose…",
|
|
629
|
+
operator: (op, count) => OPERATOR_WORDS[op](count),
|
|
630
|
+
more: (count) => `+${count}`,
|
|
631
|
+
overflow: (count) => `+${count} ${count === 1 ? "filter" : "filters"}`,
|
|
632
|
+
sheetTitle: "Filters",
|
|
633
|
+
remove: (field) => `Remove ${field} filter`,
|
|
634
|
+
chip: (field, operator, values) => [
|
|
635
|
+
field,
|
|
636
|
+
operator,
|
|
637
|
+
values
|
|
638
|
+
].filter(Boolean).join(" "),
|
|
639
|
+
changeField: (field) => `Field: ${field}`,
|
|
640
|
+
changeOperator: (operator) => `Condition: ${operator}`,
|
|
641
|
+
changeValue: (values) => `Value: ${values}`,
|
|
642
|
+
list: (values) => values.join(", "),
|
|
643
|
+
datePreset: (preset) => {
|
|
644
|
+
const days = preset.match(/^-(\d+)d$/)?.[1];
|
|
645
|
+
return preset === "today" ? "Today" : preset === "month" ? "This month" : days ? `Last ${days} days` : preset;
|
|
646
|
+
},
|
|
647
|
+
customDate: "Custom…",
|
|
648
|
+
between: (from, to) => `${from} – ${to}`,
|
|
649
|
+
formatDate: (date, locale) => dayFormat(locale)[date.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear() ? "short" : "medium"].format(date),
|
|
650
|
+
textPlaceholder: "Type, then press Enter",
|
|
651
|
+
yes: "Yes",
|
|
652
|
+
no: "No"
|
|
653
|
+
},
|
|
654
|
+
errorPage: {
|
|
655
|
+
back: "Back",
|
|
656
|
+
home: "Back to home",
|
|
657
|
+
error: "This page couldn’t load",
|
|
658
|
+
statusTitle: (status) => `Error ${status}`,
|
|
659
|
+
titles: {
|
|
660
|
+
notFound: "Could not find the requested page",
|
|
661
|
+
forbidden: "No access",
|
|
662
|
+
unauthenticated: "Signed out",
|
|
663
|
+
unavailable: "The service is unreachable",
|
|
664
|
+
server: "Something went wrong on our side",
|
|
665
|
+
network: "You’re offline"
|
|
666
|
+
},
|
|
667
|
+
descriptions: {
|
|
668
|
+
notFound: "This page does not exist, or you do not have access to it.",
|
|
669
|
+
forbidden: "You can’t open this. Ask an administrator for access.",
|
|
670
|
+
unauthenticated: "Your session ended. Sign in again to pick up where you were.",
|
|
671
|
+
unavailable: "The server isn’t answering right now. Try again in a moment.",
|
|
672
|
+
server: "The page couldn’t load because of an error on the server.",
|
|
673
|
+
network: "The server couldn’t be reached. Check your connection and try again."
|
|
674
|
+
}
|
|
566
675
|
}
|
|
567
676
|
},
|
|
568
677
|
navigation: {
|
|
@@ -577,7 +686,9 @@ var DEFAULTS = {
|
|
|
577
686
|
openExternal: (href) => {
|
|
578
687
|
const url = safeUrl(href);
|
|
579
688
|
if (url) window.open(url, "_blank");
|
|
580
|
-
}
|
|
689
|
+
},
|
|
690
|
+
goBack: () => window.history.back(),
|
|
691
|
+
canGoBack: () => typeof window !== "undefined" && window.history.length > 1
|
|
581
692
|
},
|
|
582
693
|
data: {
|
|
583
694
|
useRunFile: defaultUseRunFile,
|
|
@@ -590,9 +701,20 @@ var NavigationContext = createContext(DEFAULTS.navigation);
|
|
|
590
701
|
var DataContext = createContext(DEFAULTS.data);
|
|
591
702
|
var SlotsContext = createContext(DEFAULTS.slots);
|
|
592
703
|
var EngineContext = createContext(void 0);
|
|
704
|
+
var LocaleContext = createContext(void 0);
|
|
705
|
+
var AvatarColoringContext = createContext("name");
|
|
593
706
|
function useStrings() {
|
|
594
707
|
return useContext(StringsContext);
|
|
595
708
|
}
|
|
709
|
+
/** The host's locale for dates and times, such as `de-DE`. Undefined without one, which leaves
|
|
710
|
+
* each format's own default: the date library's for its times, the browser's for the rest. */
|
|
711
|
+
function useLocale() {
|
|
712
|
+
return useContext(LocaleContext);
|
|
713
|
+
}
|
|
714
|
+
/** How the host colors avatars, UIProvider's `avatarColoring`. */
|
|
715
|
+
function useAvatarColoring() {
|
|
716
|
+
return useContext(AvatarColoringContext);
|
|
717
|
+
}
|
|
596
718
|
function useNavigation() {
|
|
597
719
|
return useContext(NavigationContext);
|
|
598
720
|
}
|
|
@@ -698,7 +820,7 @@ function useMerged(compute, input) {
|
|
|
698
820
|
};
|
|
699
821
|
return ref.current.value;
|
|
700
822
|
}
|
|
701
|
-
function UIProvider({ strings, navigation, data, slots, engine: engineProp, nonce, children }) {
|
|
823
|
+
function UIProvider({ strings, navigation, data, slots, engine: engineProp, nonce, locale, avatarColoring = "name", children }) {
|
|
702
824
|
const [firstLoader] = useState(() => typeof engineProp === "function" ? engineProp : void 0);
|
|
703
825
|
const engine = typeof engineProp === "function" ? firstLoader ?? engineProp : engineProp;
|
|
704
826
|
useEffect(() => {
|
|
@@ -715,7 +837,9 @@ function UIProvider({ strings, navigation, data, slots, engine: engineProp, nonc
|
|
|
715
837
|
const [stableNavigation] = useState(() => ({
|
|
716
838
|
goTo: (to) => (navigationRef.current?.goTo ?? DEFAULTS.navigation.goTo)(to),
|
|
717
839
|
openStepSource: (uses, sourceUrl) => (navigationRef.current?.openStepSource ?? DEFAULTS.navigation.openStepSource)(uses, sourceUrl),
|
|
718
|
-
openExternal: (href) => (navigationRef.current?.openExternal ?? DEFAULTS.navigation.openExternal)(href)
|
|
840
|
+
openExternal: (href) => (navigationRef.current?.openExternal ?? DEFAULTS.navigation.openExternal)(href),
|
|
841
|
+
goBack: () => (navigationRef.current?.goBack ?? DEFAULTS.navigation.goBack)(),
|
|
842
|
+
canGoBack: () => (navigationRef.current?.canGoBack ?? DEFAULTS.navigation.canGoBack)()
|
|
719
843
|
}));
|
|
720
844
|
return /* @__PURE__ */ jsx(StringsContext, {
|
|
721
845
|
value: mergedStrings,
|
|
@@ -727,10 +851,16 @@ function UIProvider({ strings, navigation, data, slots, engine: engineProp, nonc
|
|
|
727
851
|
value: stableSlots,
|
|
728
852
|
children: /* @__PURE__ */ jsx(EngineContext, {
|
|
729
853
|
value: engine,
|
|
730
|
-
children: /* @__PURE__ */
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
854
|
+
children: /* @__PURE__ */ jsx(LocaleContext, {
|
|
855
|
+
value: locale,
|
|
856
|
+
children: /* @__PURE__ */ jsx(AvatarColoringContext, {
|
|
857
|
+
value: avatarColoring,
|
|
858
|
+
children: /* @__PURE__ */ jsxs(CSPProvider, {
|
|
859
|
+
nonce,
|
|
860
|
+
disableStyleElements: true,
|
|
861
|
+
children: [/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(ContextMenuProvider, { children }) }), /* @__PURE__ */ jsx(Toaster, {})]
|
|
862
|
+
})
|
|
863
|
+
})
|
|
734
864
|
})
|
|
735
865
|
})
|
|
736
866
|
})
|
|
@@ -739,4 +869,4 @@ function UIProvider({ strings, navigation, data, slots, engine: engineProp, nonc
|
|
|
739
869
|
});
|
|
740
870
|
}
|
|
741
871
|
//#endregion
|
|
742
|
-
export { UIProvider, useLink, useLoadedWorkflowEngine, useNavigation, useOptionalWorkflowEngine, usePersistedState, useProvisionCorsRules, useRepoSuggestions, useRunFile, useSecretVariablesResolver, useSlots, useStrings, useWorkflowActions, useWorkflowEditing, useWorkflowEngine, useWorkflowEngineLoader, useWorkflowJsonResolver };
|
|
872
|
+
export { UIProvider, useAvatarColoring, useLink, useLoadedWorkflowEngine, useLocale, useNavigation, useOptionalWorkflowEngine, usePersistedState, useProvisionCorsRules, useRepoSuggestions, useRunFile, useSecretVariablesResolver, useSlots, useStrings, useWorkflowActions, useWorkflowEditing, useWorkflowEngine, useWorkflowEngineLoader, useWorkflowJsonResolver };
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TimeValue } from '../format.js';
|
|
2
|
+
import { type ButtonSize, type ButtonVariant } from './buttonClasses.js';
|
|
2
3
|
export interface RefreshButtonProps {
|
|
3
|
-
/** May return a promise; the button spins until it settles.
|
|
4
|
+
/** May return a promise; the button spins until it settles. A rejection only
|
|
5
|
+
* stops the spinning, so report a failure from the handler. */
|
|
4
6
|
onRefresh: () => unknown;
|
|
5
7
|
/** Spins for a refresh the host tracks itself, such as a revalidation. */
|
|
6
8
|
refreshing?: boolean | undefined;
|
|
7
|
-
/** When the data was last fetched
|
|
8
|
-
* seconds ago" instead of "Refresh", and
|
|
9
|
-
|
|
9
|
+
/** When the data was last fetched: a Date, epoch milliseconds, an ISO string or a luxon
|
|
10
|
+
* DateTime. The button then reads "Updated 5 seconds ago" instead of "Refresh", and
|
|
11
|
+
* keeps that current. */
|
|
12
|
+
updatedAt?: TimeValue;
|
|
10
13
|
size?: ButtonSize | undefined;
|
|
14
|
+
/** A button's look, `ghost` by default; `inline` is text-sized muted text with no box, for
|
|
15
|
+
* a line of details such as a header's "Updated 2 minutes ago". */
|
|
16
|
+
variant?: ButtonVariant | 'inline' | undefined;
|
|
11
17
|
/** Only the icon shows, with "Refresh" as its name and tooltip. */
|
|
12
18
|
iconOnly?: boolean | undefined;
|
|
19
|
+
className?: string | undefined;
|
|
13
20
|
}
|
|
14
21
|
/** Fetches again on demand, and says so while it does, out loud too. */
|
|
15
|
-
export declare function RefreshButton({ onRefresh, refreshing, updatedAt, size, iconOnly, }: RefreshButtonProps): import("react").JSX.Element;
|
|
22
|
+
export declare function RefreshButton({ onRefresh, refreshing, updatedAt, size, variant, iconOnly, className, }: RefreshButtonProps): import("react").JSX.Element;
|
|
@@ -4,11 +4,12 @@ import { RefreshIcon } from "../icons.js";
|
|
|
4
4
|
import { Tooltip } from "./Tooltip.js";
|
|
5
5
|
import { useStrings } from "./Provider.js";
|
|
6
6
|
import { useRelativeTime } from "./relativeTime.js";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { useState } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/RefreshButton.tsx
|
|
10
|
+
var inlineClasses = "inline-flex cursor-pointer items-center gap-1 rounded px-1 py-0.5 text-(--theme-muted-text-color) transition-colors hover:bg-(--theme-muted-panel-bg) hover:text-(--theme-app) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--theme-focus) [&_svg]:size-3";
|
|
10
11
|
/** Fetches again on demand, and says so while it does, out loud too. */
|
|
11
|
-
function RefreshButton({ onRefresh, refreshing = false, updatedAt, size = "md", iconOnly = false }) {
|
|
12
|
+
function RefreshButton({ onRefresh, refreshing = false, updatedAt, size = "md", variant = "ghost", iconOnly = false, className }) {
|
|
12
13
|
const { common: t } = useStrings();
|
|
13
14
|
const [pending, setPending] = useState(false);
|
|
14
15
|
const busy = refreshing || pending;
|
|
@@ -18,7 +19,8 @@ function RefreshButton({ onRefresh, refreshing = false, updatedAt, size = "md",
|
|
|
18
19
|
const result = onRefresh();
|
|
19
20
|
if (result instanceof Promise) {
|
|
20
21
|
setPending(true);
|
|
21
|
-
|
|
22
|
+
const done = () => setPending(false);
|
|
23
|
+
result.then(done, done);
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
26
|
const button = /* @__PURE__ */ jsxs("button", {
|
|
@@ -26,20 +28,26 @@ function RefreshButton({ onRefresh, refreshing = false, updatedAt, size = "md",
|
|
|
26
28
|
onClick: refresh,
|
|
27
29
|
"aria-busy": busy,
|
|
28
30
|
"aria-label": iconOnly ? t.refresh : void 0,
|
|
29
|
-
className: cx(buttonClasses({
|
|
30
|
-
variant
|
|
31
|
+
className: cx(variant === "inline" ? inlineClasses : buttonClasses({
|
|
32
|
+
variant,
|
|
31
33
|
size,
|
|
32
34
|
iconOnly
|
|
33
|
-
}), "group aria-busy:cursor-progress"),
|
|
35
|
+
}), "group aria-busy:cursor-progress", className),
|
|
34
36
|
children: [/* @__PURE__ */ jsx(RefreshIcon, {
|
|
35
37
|
"aria-hidden": "true",
|
|
36
38
|
className: cx("shrink-0 motion-reduce:animate-none motion-reduce:transition-none", busy ? "animate-spin" : "transition-transform duration-300 group-hover:rotate-180")
|
|
37
|
-
}), !iconOnly && (ago ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
39
|
+
}), !iconOnly && (ago ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
|
|
38
40
|
className: "sr-only",
|
|
39
41
|
children: [t.refresh, ". "]
|
|
40
|
-
}), t.updated(ago)] }) :
|
|
42
|
+
}), t.updated(ago)] }) : busy ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
43
|
+
className: "sr-only",
|
|
44
|
+
children: t.refresh
|
|
45
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
children: t.refreshing
|
|
48
|
+
})] }) : t.refresh)]
|
|
41
49
|
});
|
|
42
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [iconOnly ? /* @__PURE__ */ jsx(Tooltip, {
|
|
50
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [iconOnly ? /* @__PURE__ */ jsx(Tooltip, {
|
|
43
51
|
content: t.refresh,
|
|
44
52
|
children: button
|
|
45
53
|
}) : button, /* @__PURE__ */ jsx("span", {
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type { RunStatus } from '../engine.js';
|
|
2
2
|
import { type Tone } from './tone.js';
|
|
3
|
+
/** A status the icon shows: a run's, or one a host maps onto it, such as
|
|
4
|
+
* `pending` for something queued and `warning` for something done with problems. */
|
|
5
|
+
export type RunStatusIconStatus = RunStatus | 'pending' | 'warning';
|
|
3
6
|
/** The tone a run status reads in, so a badge that says the status in words matches the
|
|
4
7
|
* icon: `<StatusBadge variant={runStatusTone(status)}>`. */
|
|
5
|
-
export declare function runStatusTone(status:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export declare function runStatusTone(status: RunStatusIconStatus): Tone;
|
|
9
|
+
export interface RunStatusIconProps {
|
|
10
|
+
status: RunStatusIconStatus;
|
|
11
|
+
/** Names the icon in place of `strings.dag.statusLabel`, for a host's own status
|
|
12
|
+
* shown in a run's look, such as "Provisioning" as running. */
|
|
13
|
+
label?: string | undefined;
|
|
14
|
+
/** Shows the name on hover and focus too, for an icon that stands without words. */
|
|
15
|
+
tooltip?: boolean | undefined;
|
|
11
16
|
className?: string | undefined;
|
|
12
|
-
}
|
|
17
|
+
}
|
|
18
|
+
/** A run's, job's or step's status as an icon in its tone, beside the name of what ran. It
|
|
19
|
+
* is named by `label`, or else `strings.dag.statusLabel`. To say the status in words, use
|
|
20
|
+
* `StatusBadge` with `runStatusTone`. */
|
|
21
|
+
export declare function RunStatusIcon({ status, label: ownLabel, tooltip, className, }: RunStatusIconProps): import("react").JSX.Element;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { cx } from "../cx.js";
|
|
2
|
-
import { CancelIcon, FailIcon, NotRunningIcon, RunningIcon, SkipIcon, SuccessIcon } from "../icons.js";
|
|
2
|
+
import { CancelIcon, FailIcon, NotRunningIcon, PendingIcon, RunningIcon, SkipIcon, SuccessIcon, WarningIcon } from "../icons.js";
|
|
3
3
|
import { toneIcon } from "./tone.js";
|
|
4
|
+
import { Tooltip } from "./Tooltip.js";
|
|
4
5
|
import { useStrings } from "./Provider.js";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/RunStatusIcon.tsx
|
|
7
8
|
var looks = {
|
|
9
|
+
pending: {
|
|
10
|
+
tone: "muted",
|
|
11
|
+
icon: PendingIcon
|
|
12
|
+
},
|
|
8
13
|
started: {
|
|
9
|
-
tone: "
|
|
14
|
+
tone: "info",
|
|
10
15
|
icon: RunningIcon,
|
|
11
16
|
spin: true
|
|
12
17
|
},
|
|
13
18
|
running: {
|
|
14
|
-
tone: "
|
|
19
|
+
tone: "info",
|
|
15
20
|
icon: RunningIcon,
|
|
16
21
|
spin: true
|
|
17
22
|
},
|
|
@@ -19,6 +24,10 @@ var looks = {
|
|
|
19
24
|
tone: "success",
|
|
20
25
|
icon: SuccessIcon
|
|
21
26
|
},
|
|
27
|
+
warning: {
|
|
28
|
+
tone: "warning",
|
|
29
|
+
icon: WarningIcon
|
|
30
|
+
},
|
|
22
31
|
failed: {
|
|
23
32
|
tone: "error",
|
|
24
33
|
icon: FailIcon
|
|
@@ -60,14 +69,14 @@ function runStatusTone(status) {
|
|
|
60
69
|
return looks[status ?? ""].tone;
|
|
61
70
|
}
|
|
62
71
|
/** A run's, job's or step's status as an icon in its tone, beside the name of what ran. It
|
|
63
|
-
* is named by `strings.dag.statusLabel`. To say the status in words, use
|
|
64
|
-
* `runStatusTone`. */
|
|
65
|
-
function RunStatusIcon({ status, className }) {
|
|
72
|
+
* is named by `label`, or else `strings.dag.statusLabel`. To say the status in words, use
|
|
73
|
+
* `StatusBadge` with `runStatusTone`. */
|
|
74
|
+
function RunStatusIcon({ status, label: ownLabel, tooltip = false, className }) {
|
|
66
75
|
const { dag } = useStrings();
|
|
67
76
|
const look = looks[status ?? ""];
|
|
68
77
|
const Icon = look.icon;
|
|
69
|
-
const label = dag.statusLabel(status ?? "");
|
|
70
|
-
|
|
78
|
+
const label = ownLabel ?? dag.statusLabel(status ?? "");
|
|
79
|
+
const icon = /* @__PURE__ */ jsx("span", {
|
|
71
80
|
...label ? {
|
|
72
81
|
role: "img",
|
|
73
82
|
"aria-label": label
|
|
@@ -79,6 +88,10 @@ function RunStatusIcon({ status, className }) {
|
|
|
79
88
|
className: cx(look.spin && "animate-spin rounded-full")
|
|
80
89
|
})
|
|
81
90
|
});
|
|
91
|
+
return tooltip && label ? /* @__PURE__ */ jsx(Tooltip, {
|
|
92
|
+
content: label,
|
|
93
|
+
children: icon
|
|
94
|
+
}) : icon;
|
|
82
95
|
}
|
|
83
96
|
//#endregion
|
|
84
97
|
export { RunStatusIcon, runStatusTone };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
export type SectionVariant = 'plain' | 'card';
|
|
2
|
+
export type SectionVariant = 'plain' | 'bare' | 'card';
|
|
3
|
+
export type SectionTone = 'default' | 'error';
|
|
3
4
|
export type SectionSpacing = 'regular' | 'tight';
|
|
4
5
|
export interface SectionProps {
|
|
5
6
|
title: ReactNode;
|
|
@@ -10,9 +11,15 @@ export interface SectionProps {
|
|
|
10
11
|
beside?: ReactNode;
|
|
11
12
|
/** At the header's far end, such as an add button or a range picker. */
|
|
12
13
|
actions?: ReactNode;
|
|
13
|
-
/** `plain` rules the title off from the content under it; `
|
|
14
|
-
* section as a panel. */
|
|
14
|
+
/** `plain` rules the title off from the content under it; `bare` sets the title
|
|
15
|
+
* over the content with no rule; `card` frames the section as a panel. */
|
|
15
16
|
variant?: SectionVariant | undefined;
|
|
17
|
+
/** `error` marks a card of irreversible actions, such as deleting what the page
|
|
18
|
+
* shows: its border and title turn the error color over a clear body. */
|
|
19
|
+
tone?: SectionTone | undefined;
|
|
20
|
+
/** A card's content reaches its edges, such as a table or a list ruled to its
|
|
21
|
+
* sides, instead of sitting inset under the header. */
|
|
22
|
+
flush?: boolean | undefined;
|
|
16
23
|
/** The room between a `plain` section's rule and its content. `tight` suits content that
|
|
17
24
|
* spaces itself tightly, such as a form with its labels over its fields, so the first row
|
|
18
25
|
* sits as far under the rule as the rows under it sit under one another. */
|
|
@@ -35,4 +42,4 @@ export interface SectionProps {
|
|
|
35
42
|
* that can fold away. Folding keeps the content mounted, so fields hold their
|
|
36
43
|
* values and validation while closed. For a line inside content that reveals
|
|
37
44
|
* more detail, use Disclosure. */
|
|
38
|
-
export declare function Section({ title, description, beside, actions, variant, spacing, collapsible, open, onOpenChange, defaultOpen, headingLevel, id, className, children, }: SectionProps): import("react").JSX.Element;
|
|
45
|
+
export declare function Section({ title, description, beside, actions, variant, tone, flush, spacing, collapsible, open, onOpenChange, defaultOpen, headingLevel, id, className, children, }: SectionProps): import("react").JSX.Element;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { cx } from "../cx.js";
|
|
2
2
|
import { ChevronRightIcon } from "../icons.js";
|
|
3
3
|
import { collapsePanelClassName } from "./Disclosure.js";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import { useId } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Collapsible } from "@base-ui/react/collapsible";
|
|
7
7
|
//#region src/components/Section.tsx
|
|
8
8
|
var rootClasses = {
|
|
9
9
|
plain: "flex w-full flex-col",
|
|
10
|
+
bare: "flex w-full flex-col",
|
|
10
11
|
card: "panel mb-1 flex w-full flex-col"
|
|
11
12
|
};
|
|
13
|
+
var errorCardClassName = "border-(--theme-error)/30 bg-transparent";
|
|
12
14
|
var headerClasses = {
|
|
13
|
-
plain: "flex w-full items-center gap-2 border-b border-(--theme-border) pb-1",
|
|
14
|
-
|
|
15
|
+
plain: "@container/section-header flex w-full flex-wrap items-center gap-x-2 gap-y-2 border-b border-(--theme-border) pb-1",
|
|
16
|
+
bare: "@container/section-header flex w-full flex-wrap items-center gap-x-2 gap-y-2",
|
|
17
|
+
card: "@container/section-header flex w-full flex-wrap items-center gap-x-2 gap-y-2 px-4 py-3"
|
|
15
18
|
};
|
|
19
|
+
var actionsClassName = "flex shrink-0 ms-auto @max-[24rem]/section-header:ms-0 @max-[24rem]/section-header:basis-full";
|
|
16
20
|
var ruleGaps = {
|
|
17
21
|
regular: "mb-4",
|
|
18
22
|
tight: "mb-1.5"
|
|
@@ -20,10 +24,12 @@ var ruleGaps = {
|
|
|
20
24
|
var cardBodyClassName = "px-4 pb-4";
|
|
21
25
|
var titleClasses = {
|
|
22
26
|
plain: "text-base font-semibold",
|
|
27
|
+
bare: "text-base font-semibold",
|
|
23
28
|
card: "text-base font-semibold"
|
|
24
29
|
};
|
|
25
30
|
var foldedTitleClasses = {
|
|
26
31
|
plain: "",
|
|
32
|
+
bare: "",
|
|
27
33
|
card: "not-data-panel-open:text-(--theme-muted-text-color)"
|
|
28
34
|
};
|
|
29
35
|
var chevronIndent = "pl-6";
|
|
@@ -31,19 +37,27 @@ var chevronIndent = "pl-6";
|
|
|
31
37
|
* that can fold away. Folding keeps the content mounted, so fields hold their
|
|
32
38
|
* values and validation while closed. For a line inside content that reveals
|
|
33
39
|
* more detail, use Disclosure. */
|
|
34
|
-
function Section({ title, description, beside, actions, variant = "plain", spacing = "regular", collapsible = true, open, onOpenChange, defaultOpen = true, headingLevel = 3, id, className, children }) {
|
|
40
|
+
function Section({ title, description, beside, actions, variant = "plain", tone = "default", flush = false, spacing = "regular", collapsible = true, open, onOpenChange, defaultOpen = true, headingLevel = 3, id, className, children }) {
|
|
35
41
|
const Heading = `h${headingLevel}`;
|
|
36
42
|
const descriptionId = useId();
|
|
37
43
|
const describedBy = description ? descriptionId : void 0;
|
|
38
44
|
const titleProps = { "data-section-title": "" };
|
|
39
45
|
const fill = !beside && !actions;
|
|
46
|
+
const card = variant === "card";
|
|
47
|
+
const danger = card && tone === "error";
|
|
48
|
+
const rootClassName = cx(rootClasses[variant], danger && errorCardClassName, className);
|
|
49
|
+
const titleTone = danger && "text-(--theme-error-text)";
|
|
50
|
+
const body = card && !flush ? /* @__PURE__ */ jsx("div", {
|
|
51
|
+
className: cardBodyClassName,
|
|
52
|
+
children
|
|
53
|
+
}) : children;
|
|
40
54
|
const header = (heading) => /* @__PURE__ */ jsxs("div", {
|
|
41
|
-
className: cx(headerClasses[variant],
|
|
55
|
+
className: cx(headerClasses[variant], !card && ruleGaps[spacing]),
|
|
42
56
|
"data-section-header": true,
|
|
43
57
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
44
|
-
className: "flex min-w-0
|
|
58
|
+
className: "flex min-w-0 grow basis-0 flex-col gap-0.5",
|
|
45
59
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
46
|
-
className: "flex min-w-0 items-
|
|
60
|
+
className: "flex min-w-0 items-start gap-2",
|
|
47
61
|
children: [heading, beside]
|
|
48
62
|
}), description && /* @__PURE__ */ jsx("p", {
|
|
49
63
|
id: descriptionId,
|
|
@@ -51,22 +65,22 @@ function Section({ title, description, beside, actions, variant = "plain", spaci
|
|
|
51
65
|
children: description
|
|
52
66
|
})]
|
|
53
67
|
}), actions && /* @__PURE__ */ jsx("div", {
|
|
54
|
-
className:
|
|
55
|
-
children:
|
|
68
|
+
className: cx(actionsClassName, collapsible && "@max-[24rem]/section-header:ps-6"),
|
|
69
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
70
|
+
className: "flex w-fit items-center gap-2",
|
|
71
|
+
children: actions
|
|
72
|
+
})
|
|
56
73
|
})]
|
|
57
74
|
});
|
|
58
75
|
if (!collapsible) return /* @__PURE__ */ jsxs("section", {
|
|
59
76
|
id,
|
|
60
77
|
"aria-describedby": describedBy,
|
|
61
|
-
className:
|
|
78
|
+
className: rootClassName,
|
|
62
79
|
children: [header(/* @__PURE__ */ jsx(Heading, {
|
|
63
80
|
...titleProps,
|
|
64
|
-
className: cx("flex items-center", titleClasses[variant]),
|
|
81
|
+
className: cx("flex items-center", titleClasses[variant], titleTone),
|
|
65
82
|
children: title
|
|
66
|
-
})),
|
|
67
|
-
className: cardBodyClassName,
|
|
68
|
-
children
|
|
69
|
-
}) : children]
|
|
83
|
+
})), body]
|
|
70
84
|
});
|
|
71
85
|
return /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
72
86
|
id,
|
|
@@ -74,25 +88,22 @@ function Section({ title, description, beside, actions, variant = "plain", spaci
|
|
|
74
88
|
open,
|
|
75
89
|
onOpenChange: (next) => onOpenChange?.(next),
|
|
76
90
|
defaultOpen,
|
|
77
|
-
className:
|
|
91
|
+
className: rootClassName,
|
|
78
92
|
children: [header(/* @__PURE__ */ jsx(Heading, {
|
|
79
93
|
className: cx("flex min-w-0", fill && "flex-1"),
|
|
80
94
|
children: /* @__PURE__ */ jsxs(Collapsible.Trigger, {
|
|
81
95
|
...titleProps,
|
|
82
96
|
"aria-describedby": describedBy,
|
|
83
|
-
className: cx("group flex min-w-0 cursor-pointer items-
|
|
97
|
+
className: cx("group flex min-w-0 cursor-pointer items-start gap-1 rounded-sm text-left select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--theme-focus)", fill && "w-full", titleClasses[variant], titleTone || foldedTitleClasses[variant]),
|
|
84
98
|
children: [/* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
85
99
|
"aria-hidden": "true",
|
|
86
|
-
className: cx("shrink-0 transition-transform group-data-panel-open:rotate-90 motion-reduce:transition-none", "px-1 text-[1.25rem]")
|
|
100
|
+
className: cx("shrink-0 transition-transform group-data-panel-open:rotate-90 motion-reduce:transition-none", "mt-0.5 px-1 text-[1.25rem]")
|
|
87
101
|
}), title]
|
|
88
102
|
})
|
|
89
103
|
})), /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
90
104
|
keepMounted: true,
|
|
91
105
|
className: collapsePanelClassName,
|
|
92
|
-
children:
|
|
93
|
-
className: cardBodyClassName,
|
|
94
|
-
children
|
|
95
|
-
}) : children
|
|
106
|
+
children: body
|
|
96
107
|
})]
|
|
97
108
|
});
|
|
98
109
|
}
|
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import { type SegmentLayout } from './segmented.js';
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { type SegmentLayout, type SegmentTone } from './segmented.js';
|
|
3
3
|
export interface SegmentedOption<T extends string> {
|
|
4
4
|
value: T;
|
|
5
5
|
label: string;
|
|
6
6
|
icon?: ReactNode;
|
|
7
7
|
/** Beside the label, or in the corner when only the icon shows. */
|
|
8
8
|
badge?: ReactNode;
|
|
9
|
+
/** How many things the choice holds, as a pill after the label. */
|
|
10
|
+
count?: number | undefined;
|
|
11
|
+
/** Colors the label and the count, for a choice that needs attention. */
|
|
12
|
+
tone?: SegmentTone | undefined;
|
|
13
|
+
/** Can't be chosen now; it still shows, and the rest still work. */
|
|
14
|
+
disabled?: boolean | undefined;
|
|
9
15
|
testId?: string;
|
|
10
16
|
}
|
|
17
|
+
/** What else reaches the group's root element, such as `onContextMenu` for a
|
|
18
|
+
* menu on the whole control, `id` or `aria-describedby`. Its look and its
|
|
19
|
+
* value stay the control's own. */
|
|
20
|
+
export type SegmentedControlRootProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'className' | 'style' | 'defaultValue' | 'onChange' | 'dir' | 'aria-label'>;
|
|
11
21
|
/** A few mutually exclusive choices side by side, one always current, such as
|
|
12
22
|
* a time range or what to group by. To move between views or pages, use
|
|
13
23
|
* `Tabs` with `variant="segmented"`, which looks the same. To filter a list
|
|
14
24
|
* by values that may all be off, or several at once, use `ToggleGroup`. Name
|
|
15
25
|
* it with `label`, or leave that out inside a `Field group`, whose legend
|
|
16
26
|
* names it. */
|
|
17
|
-
export declare function SegmentedControl<T extends string>({ label, options, value, onValueChange, fill, iconOnly, testId, }: SegmentLayout & {
|
|
27
|
+
export declare function SegmentedControl<T extends string>({ label, options, value, onValueChange, fill, iconOnly, size, disabled, testId, ...rest }: SegmentedControlRootProps & SegmentLayout & {
|
|
18
28
|
label?: string | undefined;
|
|
19
29
|
options: SegmentedOption<T>[];
|
|
20
30
|
value: T;
|
|
21
31
|
onValueChange?: (value: T) => void;
|
|
32
|
+
/** None of the choices can be changed now, such as for a reader without
|
|
33
|
+
* the right to; the current one still shows. */
|
|
34
|
+
disabled?: boolean | undefined;
|
|
22
35
|
testId?: string;
|
|
23
36
|
}): import("react").JSX.Element;
|