@parallelworks/ui 0.51.0 → 0.53.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 +197 -17
- package/dist/ai/agent/toolStrings.d.ts +2 -0
- package/dist/ai/agent/toolStrings.js +20 -18
- package/dist/ai/ai.css +17 -3
- package/dist/ai/components/AllocationSelector.js +5 -1
- package/dist/ai/components/AttachmentManager.js +51 -42
- package/dist/ai/components/AttachmentUpload.d.ts +4 -2
- package/dist/ai/components/AttachmentUpload.js +9 -9
- package/dist/ai/components/BlockedGroupBanner.js +8 -14
- package/dist/ai/components/BranchNavigator.js +11 -12
- package/dist/ai/components/ChatEmptyState.js +12 -19
- package/dist/ai/components/ChatInput.d.ts +4 -3
- package/dist/ai/components/ChatInput.js +27 -13
- package/dist/ai/components/ChatMessage.js +45 -121
- package/dist/ai/components/ChatMessageList.d.ts +5 -2
- package/dist/ai/components/ChatMessageList.js +89 -51
- package/dist/ai/components/ChatSidebar.js +11 -7
- package/dist/ai/components/ChatThread.js +1 -13
- package/dist/ai/components/DragOverlay.js +3 -3
- package/dist/ai/components/MessageAttachments.d.ts +10 -0
- package/dist/ai/components/MessageAttachments.js +78 -0
- package/dist/ai/components/ModelSelector.js +3 -3
- package/dist/ai/components/PastedText.js +2 -2
- package/dist/ai/components/ProviderIssueBanner.js +19 -23
- package/dist/ai/components/ShareDialog.js +2 -2
- package/dist/ai/components/agent/ActivityLine.d.ts +0 -2
- package/dist/ai/components/agent/ActivityLine.js +8 -51
- package/dist/ai/components/agent/AgentMessageParts.js +114 -53
- package/dist/ai/core/ChatProvider.d.ts +16 -5
- package/dist/ai/core/ChatProvider.js +41 -8
- package/dist/ai/core/config.js +4 -3
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +3 -3
- package/dist/ai/strings.d.ts +29 -3
- package/dist/ai/strings.js +80 -26
- package/dist/ai/types.d.ts +4 -0
- package/dist/ai/ui/Notice.d.ts +2 -2
- package/dist/ai/ui/Notice.js +29 -62
- package/dist/ai/ui/sidebar.d.ts +5 -3
- package/dist/ai/ui/sidebar.js +22 -10
- package/dist/components/ActionMenu.d.ts +1 -0
- package/dist/components/ActionMenu.js +6 -1
- package/dist/components/AppLink.d.ts +26 -0
- package/dist/components/AppLink.js +51 -0
- package/dist/components/Avatar.d.ts +2 -1
- package/dist/components/Avatar.js +4 -2
- package/dist/components/Button.d.ts +15 -5
- package/dist/components/Button.js +47 -40
- package/dist/components/Callout.d.ts +31 -7
- package/dist/components/Callout.js +50 -19
- package/dist/components/Card.d.ts +11 -6
- package/dist/components/Card.js +14 -8
- package/dist/components/Checkbox.js +2 -1
- package/dist/components/ColorInput.js +5 -3
- package/dist/components/Combobox.js +49 -19
- package/dist/components/ConfirmModal.d.ts +19 -8
- package/dist/components/ConfirmModal.js +31 -53
- package/dist/components/CopyButton.d.ts +38 -0
- package/dist/components/CopyButton.js +68 -0
- package/dist/components/CreateModal.js +118 -111
- package/dist/components/DatePicker.js +12 -8
- package/dist/components/DescriptionList.d.ts +25 -5
- package/dist/components/DescriptionList.js +56 -22
- package/dist/components/Disclosure.js +1 -1
- package/dist/components/Drawer.js +10 -16
- package/dist/components/Field.d.ts +16 -5
- package/dist/components/Field.js +63 -8
- package/dist/components/IconButton.d.ts +14 -5
- package/dist/components/IconButton.js +25 -14
- package/dist/components/InfoTip.d.ts +12 -1
- package/dist/components/InfoTip.js +13 -2
- package/dist/components/Input.d.ts +14 -8
- package/dist/components/Input.js +46 -31
- package/dist/components/Loader.js +1 -1
- package/dist/components/MarkdownImpl.d.ts +1 -0
- package/dist/components/MarkdownImpl.js +1 -0
- package/dist/components/MenuEntries.d.ts +4 -0
- package/dist/components/MenuEntries.js +11 -12
- package/dist/components/Meter.js +5 -4
- package/dist/components/Modal.d.ts +28 -4
- package/dist/components/Modal.js +37 -14
- package/dist/components/Overview.d.ts +20 -12
- package/dist/components/Overview.js +14 -9
- package/dist/components/PageHeader.d.ts +47 -65
- package/dist/components/PageHeader.js +275 -153
- package/dist/components/PageHeaderAction.d.ts +67 -0
- package/dist/components/PageHeaderAction.js +107 -0
- package/dist/components/Pagination.js +6 -16
- package/dist/components/Popover.d.ts +4 -1
- package/dist/components/Popover.js +5 -3
- package/dist/components/Provider.d.ts +79 -19
- package/dist/components/Provider.js +140 -130
- package/dist/components/Radio.js +2 -1
- package/dist/components/RefreshButton.js +7 -8
- package/dist/components/RequiredMark.js +1 -1
- package/dist/components/Section.js +1 -1
- package/dist/components/Select.d.ts +4 -9
- package/dist/components/Select.js +24 -11
- package/dist/components/SettingModeOption.d.ts +1 -1
- package/dist/components/SettingModeOption.js +7 -1
- package/dist/components/SettingsCard.d.ts +5 -3
- package/dist/components/SettingsCard.js +27 -20
- package/dist/components/Slider.js +1 -1
- package/dist/components/StatusBadge.js +2 -2
- package/dist/components/Switch.js +5 -4
- package/dist/components/Table.d.ts +30 -20
- package/dist/components/Table.js +50 -73
- package/dist/components/Tabs.d.ts +3 -7
- package/dist/components/Tabs.js +6 -10
- package/dist/components/ThemeEditor.js +18 -8
- package/dist/components/Toast.d.ts +11 -3
- package/dist/components/Toast.js +45 -20
- package/dist/components/buttonClasses.js +1 -1
- package/dist/components/comboboxItems.d.ts +4 -0
- package/dist/components/comboboxItems.js +6 -1
- package/dist/components/dismiss.d.ts +12 -0
- package/dist/components/dismiss.js +19 -0
- package/dist/components/fieldBox.d.ts +4 -0
- package/dist/components/fieldBox.js +7 -3
- package/dist/components/floating.d.ts +3 -3
- package/dist/components/floating.js +1 -1
- package/dist/components/focus.d.ts +5 -0
- package/dist/components/focus.js +21 -1
- package/dist/components/markdownCodeBreaks.js +3 -4
- package/dist/components/pageHeaderStore.d.ts +41 -0
- package/dist/components/pageHeaderStore.js +67 -0
- package/dist/components/pathBreaks.d.ts +8 -0
- package/dist/components/pathBreaks.js +28 -0
- package/dist/components/segmented.js +1 -1
- package/dist/components/shortcutKey.d.ts +2 -1
- package/dist/components/shortcutKey.js +19 -2
- package/dist/components/splitter.js +1 -1
- package/dist/components/useCssIsDark.js +40 -18
- package/dist/components/useTheme.js +9 -10
- package/dist/dev.d.ts +9 -0
- package/dist/dev.js +14 -0
- package/dist/editor/Editor.d.ts +3 -2
- package/dist/editor/Editor.js +24 -5
- package/dist/editor/EditorField.d.ts +2 -1
- package/dist/editor/EditorField.js +11 -29
- package/dist/editor/FormCodePanel.d.ts +7 -3
- package/dist/editor/FormCodePanel.js +14 -7
- package/dist/editor/Monaco.d.ts +22 -6
- package/dist/editor/Monaco.js +177 -113
- package/dist/editor/editorModel.d.ts +1 -1
- package/dist/editor/editorModel.js +1 -1
- package/dist/editor/index.d.ts +6 -5
- package/dist/editor/index.js +5 -4
- package/dist/editor/languages.d.ts +24 -0
- package/dist/editor/languages.js +31 -0
- package/dist/editor/monacoFeatures.d.ts +7 -0
- package/dist/editor/monacoFeatures.js +19 -0
- package/dist/editor/themes.d.ts +8 -5
- package/dist/editor/themes.js +65 -32
- package/dist/editor/workers.d.ts +3 -3
- package/dist/editor/workers.js +8 -4
- package/dist/editor/yaml.d.ts +6 -2
- package/dist/editor/yaml.js +11 -2
- package/dist/editor/yamlLanguage.js +55 -38
- package/dist/file-explorer/FileExplorer.d.ts +18 -4
- package/dist/file-explorer/FileExplorer.js +204 -142
- package/dist/file-explorer/FileExplorerContext.js +1 -1
- package/dist/file-explorer/FilePreview/StreamedBadge.js +3 -1
- package/dist/file-explorer/FilePreview/Viewer.js +14 -10
- package/dist/file-explorer/FilePreview/index.js +4 -4
- package/dist/file-explorer/FileRow.d.ts +6 -2
- package/dist/file-explorer/FileRow.js +35 -17
- package/dist/file-explorer/FileRowsWindow.d.ts +2 -1
- package/dist/file-explorer/FileRowsWindow.js +36 -4
- package/dist/file-explorer/FileTable.d.ts +3 -1
- package/dist/file-explorer/FileTable.js +6 -3
- package/dist/file-explorer/TreeView.d.ts +5 -1
- package/dist/file-explorer/TreeView.js +86 -39
- package/dist/file-explorer/helpers.d.ts +2 -1
- package/dist/file-explorer/helpers.js +24 -23
- package/dist/file-explorer/lib/utils.d.ts +3 -0
- package/dist/file-explorer/lib/utils.js +6 -1
- package/dist/file-explorer/toasts.js +27 -19
- package/dist/file-explorer/treeRows.d.ts +6 -0
- package/dist/file-explorer/treeRows.js +19 -1
- package/dist/file-explorer/useNearEnd.js +3 -6
- package/dist/form/Fields/CheckboxGroupField.js +12 -5
- package/dist/form/Fields/DurationField.js +1 -1
- package/dist/form/Fields/LabelField.js +1 -1
- package/dist/form/Fields/ObjectField.d.ts +1 -1
- package/dist/form/Fields/ObjectField.js +3 -2
- package/dist/form/Fields/StringField.js +16 -29
- package/dist/form/Fields/TextAreaField.js +3 -4
- package/dist/form/Form.js +3 -8
- package/dist/form/Wizard/WizardNavigation.js +0 -3
- package/dist/form/Wizard/utils.js +2 -1
- package/dist/form/fieldFrame.d.ts +1 -1
- package/dist/form/fieldFrame.js +2 -2
- package/dist/form/types/fieldComponentTypes.d.ts +2 -1
- package/dist/graph/AnnotationBanner.d.ts +1 -2
- package/dist/graph/AnnotationBanner.js +30 -32
- package/dist/graph/Connectors.js +4 -1
- package/dist/graph/DependencyGraph.js +2 -2
- package/dist/graph/GraphEditor.js +11 -9
- package/dist/graph/GraphEditorDialogs.js +1 -1
- package/dist/graph/GraphNode.js +7 -4
- package/dist/graph/InputDialog.js +1 -1
- package/dist/graph/InputsEditor.js +14 -11
- package/dist/graph/MatrixGroup.js +9 -3
- package/dist/graph/Reveal.js +18 -10
- package/dist/graph/ShortcutsButton.d.ts +11 -2
- package/dist/graph/ShortcutsButton.js +14 -3
- package/dist/graph/TreeView.js +35 -18
- package/dist/graph/WorkflowSettingsDialog.js +1 -1
- package/dist/graph/editorFields.js +1 -1
- package/dist/graph/editorRows.js +16 -10
- package/dist/graph/editorStrings.d.ts +7 -0
- package/dist/graph/editorStrings.js +8 -1
- package/dist/graph/inputRefs.js +1 -1
- package/dist/graph/settingsViews.js +11 -18
- package/dist/graph/stepWith.js +1 -1
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +4 -2
- package/dist/index.d.ts +12 -12
- package/dist/index.js +16 -16
- package/dist/list/ActionToolbar.d.ts +42 -6
- package/dist/list/ActionToolbar.js +298 -101
- package/dist/list/ListPage.d.ts +15 -23
- package/dist/list/ListPage.js +42 -43
- package/dist/list/ListTable.d.ts +37 -7
- package/dist/list/ListTable.js +52 -12
- package/dist/list/ListViewControls.js +1 -1
- package/dist/list/UserHoverCard.js +7 -15
- package/dist/list/index.d.ts +2 -2
- package/dist/list/index.js +2 -2
- package/dist/list/listSearch.js +12 -10
- package/dist/list/listView.d.ts +10 -1
- package/dist/list/listView.js +15 -1
- package/dist/logviewer/LogViewer.d.ts +4 -2
- package/dist/logviewer/LogViewer.js +87 -69
- package/dist/logviewer/logviewer.css +3 -2
- package/dist/reducedMotion.d.ts +5 -0
- package/dist/reducedMotion.js +20 -0
- package/dist/safeUrl.d.ts +1 -1
- package/dist/safeUrl.js +4 -2
- package/dist/styles.css +1 -1
- package/package.json +5 -2
- package/dist/components/Breadcrumbs.d.ts +0 -37
- package/dist/components/Breadcrumbs.js +0 -90
- package/dist/components/CopyToClipboard.d.ts +0 -17
- package/dist/components/CopyToClipboard.js +0 -66
- package/dist/components/Sort.d.ts +0 -9
- package/dist/components/Sort.js +0 -42
- package/dist/file-explorer/FilePreview/CodePreviewEditor.d.ts +0 -6
- package/dist/file-explorer/FilePreview/CodePreviewEditor.js +0 -64
|
@@ -1,73 +1,51 @@
|
|
|
1
1
|
import { useStrings } from "./Provider.js";
|
|
2
2
|
import { Button } from "./Button.js";
|
|
3
|
-
import { Modal
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
3
|
+
import { Modal } from "./Modal.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useRef, useState } from "react";
|
|
6
6
|
//#region src/components/ConfirmModal.tsx
|
|
7
|
+
/** Asks before an action: its title the question, its description what follows,
|
|
8
|
+
* and Cancel beside a confirm button named for the action. */
|
|
7
9
|
function ConfirmModal({ open, onClose, title, description, children, confirmLabel, onConfirm, confirmDisabled = false, destructive = false, align = "top", cancelLabel, closeOnConfirm = true }) {
|
|
8
10
|
const { common } = useStrings();
|
|
9
11
|
const [pending, setPending] = useState(false);
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
const onCloseRef = useRef(onClose);
|
|
15
|
-
onCloseRef.current = onClose;
|
|
16
|
-
const runConfirm = useCallback(async () => {
|
|
17
|
-
if (firedRef.current) return;
|
|
18
|
-
firedRef.current = true;
|
|
12
|
+
const running = useRef(false);
|
|
13
|
+
const runConfirm = async () => {
|
|
14
|
+
if (running.current) return;
|
|
15
|
+
running.current = true;
|
|
19
16
|
setPending(true);
|
|
20
17
|
try {
|
|
21
18
|
await onConfirm();
|
|
22
|
-
if (closeOnConfirm)
|
|
23
|
-
else firedRef.current = false;
|
|
24
|
-
} catch (error) {
|
|
25
|
-
firedRef.current = false;
|
|
26
|
-
throw error;
|
|
19
|
+
if (closeOnConfirm) onClose();
|
|
27
20
|
} finally {
|
|
21
|
+
running.current = false;
|
|
28
22
|
setPending(false);
|
|
29
23
|
}
|
|
30
|
-
}
|
|
31
|
-
return /* @__PURE__ */
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsx(Modal, {
|
|
32
26
|
alert: destructive,
|
|
33
27
|
open,
|
|
34
28
|
onClose,
|
|
35
29
|
align,
|
|
36
30
|
dismissible: !pending,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
className: "mt-5 flex items-center justify-end gap-2 border-t border-(--theme-border) px-5 py-3",
|
|
56
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
57
|
-
variant: "ghost",
|
|
58
|
-
size: "sm",
|
|
59
|
-
onClick: onClose,
|
|
60
|
-
disabled: pending,
|
|
61
|
-
children: cancelLabel ?? common.cancel
|
|
62
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
63
|
-
variant: destructive ? "danger" : "primary",
|
|
64
|
-
size: "sm",
|
|
65
|
-
onClick: runConfirm,
|
|
66
|
-
disabled: confirmDisabled,
|
|
67
|
-
loading: pending,
|
|
68
|
-
children: confirmLabel
|
|
69
|
-
})]
|
|
70
|
-
})]
|
|
31
|
+
size: "md",
|
|
32
|
+
title,
|
|
33
|
+
description,
|
|
34
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
|
|
35
|
+
variant: "ghost",
|
|
36
|
+
size: "sm",
|
|
37
|
+
onClick: onClose,
|
|
38
|
+
disabled: pending,
|
|
39
|
+
children: cancelLabel ?? common.cancel
|
|
40
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
41
|
+
variant: destructive ? "danger" : "primary",
|
|
42
|
+
size: "sm",
|
|
43
|
+
onClick: runConfirm,
|
|
44
|
+
disabled: confirmDisabled,
|
|
45
|
+
loading: pending,
|
|
46
|
+
children: confirmLabel
|
|
47
|
+
})] }),
|
|
48
|
+
children
|
|
71
49
|
});
|
|
72
50
|
}
|
|
73
51
|
//#endregion
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { type ButtonSize, type ButtonVariant } from './buttonClasses.js';
|
|
3
|
+
export interface CopyButtonProps extends Omit<ComponentPropsWithRef<'button'>, 'onClick' | 'children' | 'type'> {
|
|
4
|
+
variant?: ButtonVariant | undefined;
|
|
5
|
+
size?: ButtonSize | undefined;
|
|
6
|
+
/** What it copies, or a function that reads it when pressed, such as from the page. */
|
|
7
|
+
text: string | (() => string);
|
|
8
|
+
/** Names what it copies, such as "email address": the button reads "Copy email
|
|
9
|
+
* address" and the toast "Copied email address". Without it, both say only "Copy". */
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
/** No toast, for a copy the reader can see succeed some other way. The button's
|
|
12
|
+
* check shows either way, and a failure still says so. */
|
|
13
|
+
quiet?: boolean | undefined;
|
|
14
|
+
/** Shows "Copy" (then "Copied") beside the icon, for a copy that is a toolbar's
|
|
15
|
+
* command rather than a detail beside a value. */
|
|
16
|
+
showLabel?: boolean | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** The one copy control: a button that copies its text, turns into a check for a
|
|
19
|
+
* moment, and says so in a toast, which screen readers announce. */
|
|
20
|
+
export declare function CopyButton({ text, label, quiet, showLabel, variant, size, ...props }: CopyButtonProps): import("react").JSX.Element;
|
|
21
|
+
export interface CopyCodeBlockProps {
|
|
22
|
+
/** What the button copies: the code as the reader would type it. */
|
|
23
|
+
text: string;
|
|
24
|
+
/** Names what it copies, as CopyButton's `label` does, such as "install command". */
|
|
25
|
+
label?: string | undefined;
|
|
26
|
+
/** The code as shown, which may be masked or highlighted. */
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
/** Adds an eye button that shows or hides the value; the caller masks `children`
|
|
29
|
+
* while `revealed` is false. */
|
|
30
|
+
secret?: boolean | undefined;
|
|
31
|
+
revealed?: boolean | undefined;
|
|
32
|
+
onRevealedChange?: ((revealed: boolean) => void) | undefined;
|
|
33
|
+
className?: string | undefined;
|
|
34
|
+
}
|
|
35
|
+
/** A block of code, such as a command to run, with a button that copies it. The
|
|
36
|
+
* buttons show while the pointer is over the block or focus is in it, and always
|
|
37
|
+
* where there is no hover to reveal them. */
|
|
38
|
+
export declare function CopyCodeBlock({ text, label, children, secret, revealed, onRevealedChange, className, }: CopyCodeBlockProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { cx } from "../cx.js";
|
|
2
|
+
import { buttonClasses } from "./buttonClasses.js";
|
|
3
|
+
import { CheckIcon, CopyIcon, EyeIcon, EyeOffIcon } from "../icons.js";
|
|
4
|
+
import { useStrings } from "./Provider.js";
|
|
5
|
+
import { useCopy } from "./useCopy.js";
|
|
6
|
+
import { IconButton } from "./IconButton.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/CopyButton.tsx
|
|
9
|
+
/** The one copy control: a button that copies its text, turns into a check for a
|
|
10
|
+
* moment, and says so in a toast, which screen readers announce. */
|
|
11
|
+
function CopyButton({ text, label, quiet = false, showLabel = false, variant = showLabel ? "outline" : "ghost", size = "sm", ...props }) {
|
|
12
|
+
const { common: t } = useStrings();
|
|
13
|
+
const { copy, copied } = useCopy();
|
|
14
|
+
const name = label ? copied ? t.copiedThing(label) : t.copyThing(label) : copied ? t.copied : t.copy;
|
|
15
|
+
const icon = copied ? /* @__PURE__ */ jsx(CheckIcon, { className: "text-(--theme-success)" }) : /* @__PURE__ */ jsx(CopyIcon, {});
|
|
16
|
+
const onClick = () => void copy(typeof text === "function" ? text() : text, {
|
|
17
|
+
label,
|
|
18
|
+
quiet
|
|
19
|
+
});
|
|
20
|
+
if (showLabel) return /* @__PURE__ */ jsxs("button", {
|
|
21
|
+
type: "button",
|
|
22
|
+
...props,
|
|
23
|
+
"aria-label": props["aria-label"] ?? name,
|
|
24
|
+
onClick,
|
|
25
|
+
className: cx(buttonClasses({
|
|
26
|
+
variant,
|
|
27
|
+
size
|
|
28
|
+
}), props.className),
|
|
29
|
+
children: [icon, copied ? t.copied : t.copy]
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
32
|
+
...props,
|
|
33
|
+
variant,
|
|
34
|
+
size,
|
|
35
|
+
label: name,
|
|
36
|
+
icon,
|
|
37
|
+
onClick
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** A block of code, such as a command to run, with a button that copies it. The
|
|
41
|
+
* buttons show while the pointer is over the block or focus is in it, and always
|
|
42
|
+
* where there is no hover to reveal them. */
|
|
43
|
+
function CopyCodeBlock({ text, label, children, secret = false, revealed = false, onRevealedChange, className }) {
|
|
44
|
+
const { common: t } = useStrings();
|
|
45
|
+
const reveal = "opacity-0 group-hover/code:opacity-100 group-focus-within/code:opacity-100 pointer-coarse:opacity-100";
|
|
46
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: cx("group/code relative", className),
|
|
48
|
+
children: [/* @__PURE__ */ jsx("pre", {
|
|
49
|
+
className: cx("m-0 overflow-x-auto rounded-lg border border-(--theme-border) bg-(--theme-muted-panel-bg) p-4 text-left font-mono text-sm text-(--theme-app)", secret ? "pr-20" : "pr-12"),
|
|
50
|
+
children
|
|
51
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
52
|
+
className: "absolute top-2 right-2 flex items-center gap-1",
|
|
53
|
+
children: [secret && /* @__PURE__ */ jsx(IconButton, {
|
|
54
|
+
label: t.showValue,
|
|
55
|
+
icon: revealed ? /* @__PURE__ */ jsx(EyeIcon, {}) : /* @__PURE__ */ jsx(EyeOffIcon, {}),
|
|
56
|
+
pressed: revealed,
|
|
57
|
+
onClick: () => onRevealedChange?.(!revealed),
|
|
58
|
+
className: cx("bg-(--theme-muted-panel-bg)", reveal)
|
|
59
|
+
}), /* @__PURE__ */ jsx(CopyButton, {
|
|
60
|
+
text,
|
|
61
|
+
label,
|
|
62
|
+
className: cx("bg-(--theme-muted-panel-bg)", reveal)
|
|
63
|
+
})]
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { CopyButton, CopyCodeBlock };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cx } from "../cx.js";
|
|
2
|
-
import { ChevronDownIcon, FavoriteIcon, FavoriteOutlineIcon } from "../icons.js";
|
|
3
2
|
import { buttonClasses } from "./buttonClasses.js";
|
|
3
|
+
import { ChevronDownIcon, FavoriteIcon, FavoriteOutlineIcon } from "../icons.js";
|
|
4
4
|
import { Tooltip } from "./Tooltip.js";
|
|
5
5
|
import { useStrings } from "./Provider.js";
|
|
6
6
|
import { ActionMenu } from "./ActionMenu.js";
|
|
@@ -11,7 +11,7 @@ import { Modal } from "./Modal.js";
|
|
|
11
11
|
import { Disclosure } from "./Disclosure.js";
|
|
12
12
|
import { Switch } from "./Switch.js";
|
|
13
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import {
|
|
14
|
+
import { useId, useRef, useState } from "react";
|
|
15
15
|
import { Toggle } from "@base-ui/react/toggle";
|
|
16
16
|
//#region src/components/CreateModal.tsx
|
|
17
17
|
/** Submits on Enter in the name field or ⌘/Ctrl+Enter from anywhere in the panel. */
|
|
@@ -21,7 +21,7 @@ function CreateModal({ open, onClose, typeIcon, typeLabel, typeMenu, namePlaceho
|
|
|
21
21
|
const submitText = submitLabel ?? common.create;
|
|
22
22
|
const submittingText = submittingLabel ?? t.creating;
|
|
23
23
|
const descriptionText = descriptionPlaceholder ?? t.addDescription;
|
|
24
|
-
const [name, setName] = useState("");
|
|
24
|
+
const [name, setName] = useState(initialName ?? "");
|
|
25
25
|
const [description, setDescription] = useState("");
|
|
26
26
|
const [submitting, setSubmitting] = useState(false);
|
|
27
27
|
const [favorite, setFavorite] = useState(false);
|
|
@@ -29,16 +29,20 @@ function CreateModal({ open, onClose, typeIcon, typeLabel, typeMenu, namePlaceho
|
|
|
29
29
|
const [nameTouched, setNameTouched] = useState(false);
|
|
30
30
|
const [interacted, setInteracted] = useState(false);
|
|
31
31
|
const nameRef = useRef(null);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const nameMessageId = useId();
|
|
33
|
+
const session = open ? initialName ?? "" : null;
|
|
34
|
+
const [shownSession, setShownSession] = useState(session);
|
|
35
|
+
if (session !== shownSession) {
|
|
36
|
+
setShownSession(session);
|
|
37
|
+
if (session !== null) {
|
|
38
|
+
setName(session);
|
|
35
39
|
setDescription("");
|
|
36
40
|
setSubmitting(false);
|
|
37
41
|
setFavorite(false);
|
|
38
42
|
setNameTouched(false);
|
|
39
43
|
setInteracted(false);
|
|
40
44
|
}
|
|
41
|
-
}
|
|
45
|
+
}
|
|
42
46
|
const nameError = name.trim() ? validateName?.(name.trim()) ?? null : null;
|
|
43
47
|
const hint = !nameError && name.trim() ? nameHint?.(name.trim()) : null;
|
|
44
48
|
const canSubmit = (hideName || nameOptional || name.trim().length > 0) && !nameError && !submitting && !submitDisabled;
|
|
@@ -66,11 +70,11 @@ function CreateModal({ open, onClose, typeIcon, typeLabel, typeMenu, namePlaceho
|
|
|
66
70
|
}
|
|
67
71
|
if (close) onClose();
|
|
68
72
|
};
|
|
69
|
-
return /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ jsx(Modal, {
|
|
70
74
|
open,
|
|
71
75
|
onClose,
|
|
72
76
|
"aria-label": `${submitText}: ${typeLabel}`,
|
|
73
|
-
|
|
77
|
+
size: "lg",
|
|
74
78
|
dismissible: !isDirty,
|
|
75
79
|
initialFocus: () => nameRef.current ?? true,
|
|
76
80
|
onKeyDown: (e) => {
|
|
@@ -79,84 +83,117 @@ function CreateModal({ open, onClose, typeIcon, typeLabel, typeMenu, namePlaceho
|
|
|
79
83
|
onMouseDown: (e) => {
|
|
80
84
|
if (e.target instanceof Element && !e.target.closest("input, textarea, button, a, select, label, code, pre, .select-all")) e.preventDefault();
|
|
81
85
|
},
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
87
|
+
showFavorite && /* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: "me-auto",
|
|
89
|
+
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
90
|
+
content: favorite ? t.favoriteHintOn : t.favoriteHintOff,
|
|
91
|
+
children: /* @__PURE__ */ jsxs(Toggle, {
|
|
92
|
+
pressed: favorite,
|
|
93
|
+
onPressedChange: setFavorite,
|
|
94
|
+
"aria-label": t.favorite,
|
|
95
|
+
className: buttonClasses({
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
size: "sm"
|
|
98
|
+
}),
|
|
99
|
+
children: [favorite ? /* @__PURE__ */ jsx(FavoriteIcon, { className: "text-(--theme-favorite)" }) : /* @__PURE__ */ jsx(FavoriteOutlineIcon, {}), favorite ? t.favorited : t.favorite]
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsx(Button, {
|
|
104
|
+
variant: "ghost",
|
|
105
|
+
size: "sm",
|
|
106
|
+
onClick: onClose,
|
|
107
|
+
children: hideSubmit ? common.close : common.cancel
|
|
108
|
+
}),
|
|
109
|
+
!hideSubmit && /* @__PURE__ */ jsx(Button, {
|
|
110
|
+
variant: "primary",
|
|
111
|
+
size: "sm",
|
|
112
|
+
onClick: handleSubmit,
|
|
113
|
+
"aria-disabled": !canSubmit,
|
|
114
|
+
loading: submitting,
|
|
115
|
+
children: submitting ? submittingText : submitText
|
|
116
|
+
})
|
|
117
|
+
] }),
|
|
118
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
84
119
|
onChangeCapture: () => setInteracted(true),
|
|
85
120
|
children: [
|
|
86
|
-
/* @__PURE__ */ jsxs("div", {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
121
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
122
|
+
typeMenu && typeMenu.length > 0 ? /* @__PURE__ */ jsxs(ActionMenu, {
|
|
123
|
+
items: typeMenu,
|
|
124
|
+
label: typeLabel,
|
|
125
|
+
triggerClassName: "inline-flex items-center gap-1.5 px-1.5 py-1 rounded-md bg-(--theme-muted-panel-bg) text-xs font-medium text-(--theme-muted-text-color) transition-colors hover:text-(--theme-app)",
|
|
126
|
+
children: [
|
|
127
|
+
typeIcon,
|
|
128
|
+
typeLabel,
|
|
129
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "w-3 h-3 opacity-60" })
|
|
130
|
+
]
|
|
131
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
132
|
+
className: "inline-flex items-center gap-1.5 px-1.5 py-1 rounded-md bg-(--theme-muted-panel-bg) text-xs font-medium text-(--theme-muted-text-color)",
|
|
133
|
+
children: [typeIcon, typeLabel]
|
|
134
|
+
}),
|
|
135
|
+
hideName ? /* @__PURE__ */ jsx("div", { className: "mt-3" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
136
|
+
/* @__PURE__ */ jsx("input", {
|
|
137
|
+
ref: nameRef,
|
|
138
|
+
type: "text",
|
|
139
|
+
autoComplete: "off",
|
|
140
|
+
"data-1p-ignore": true,
|
|
141
|
+
value: name,
|
|
142
|
+
onChange: (e) => {
|
|
143
|
+
const next = sanitizeName ? sanitizeName(e.target.value) : e.target.value;
|
|
144
|
+
setName(next);
|
|
145
|
+
onNameChange?.(next);
|
|
146
|
+
},
|
|
147
|
+
onBlur: (e) => {
|
|
148
|
+
if (!e.target.value.trim()) setNameTouched(true);
|
|
149
|
+
},
|
|
150
|
+
onKeyDown: (e) => {
|
|
151
|
+
if (e.key === "Enter" && !e.nativeEvent.isComposing && !e.metaKey && !e.ctrlKey) {
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
e.stopPropagation();
|
|
154
|
+
handleSubmit();
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
placeholder: namePlaceholder,
|
|
158
|
+
"aria-label": namePlaceholder,
|
|
159
|
+
"aria-required": !nameOptional,
|
|
160
|
+
"aria-invalid": nameMissing || !!nameError,
|
|
161
|
+
"aria-describedby": nameError || hint ? nameMessageId : void 0,
|
|
162
|
+
onAnimationEnd: () => setNameFlash(false),
|
|
163
|
+
className: cx("mt-2 -mb-1 -mx-1.5 w-[calc(100%+0.75rem)] rounded-md border-0 px-1.5 py-1 bg-transparent shadow-none text-lg font-medium text-(--theme-app) placeholder:text-(--theme-placeholder) focus:outline-none", nameFlash && "animate-field-flash", nameMissing ? "ring-1 ring-(--theme-error)" : "focus:ring-0")
|
|
101
164
|
}),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}),
|
|
129
|
-
nameError && /* @__PURE__ */ jsx("p", {
|
|
130
|
-
className: "mt-1 text-xs text-(--theme-error-text)",
|
|
131
|
-
children: nameError
|
|
132
|
-
}),
|
|
133
|
-
hint && /* @__PURE__ */ jsx("p", {
|
|
134
|
-
className: "mt-1 text-xs text-(--theme-muted-text-color)",
|
|
135
|
-
children: hint
|
|
136
|
-
}),
|
|
137
|
-
showDescription ? /* @__PURE__ */ jsx("textarea", {
|
|
138
|
-
autoComplete: "off",
|
|
139
|
-
"data-1p-ignore": true,
|
|
140
|
-
value: description,
|
|
141
|
-
onChange: (e) => setDescription(e.target.value),
|
|
142
|
-
placeholder: descriptionText,
|
|
143
|
-
"aria-label": descriptionText,
|
|
144
|
-
rows: 3,
|
|
145
|
-
className: "mt-1.5 w-full border-0 p-0 bg-transparent shadow-none resize-none text-sm text-(--theme-app) placeholder:text-(--theme-placeholder) focus:outline-none focus:ring-0"
|
|
146
|
-
}) : /* @__PURE__ */ jsx("div", { className: "mt-3" })
|
|
147
|
-
] }),
|
|
148
|
-
children && /* @__PURE__ */ jsx("div", {
|
|
149
|
-
className: "mb-3 flex flex-col gap-3",
|
|
150
|
-
children
|
|
151
|
-
})
|
|
152
|
-
]
|
|
153
|
-
}),
|
|
165
|
+
nameError && /* @__PURE__ */ jsx("p", {
|
|
166
|
+
id: nameMessageId,
|
|
167
|
+
className: "mt-1 text-xs text-(--theme-error-text)",
|
|
168
|
+
children: nameError
|
|
169
|
+
}),
|
|
170
|
+
hint && /* @__PURE__ */ jsx("p", {
|
|
171
|
+
id: nameMessageId,
|
|
172
|
+
className: "mt-1 text-xs text-(--theme-muted-text-color)",
|
|
173
|
+
children: hint
|
|
174
|
+
}),
|
|
175
|
+
showDescription ? /* @__PURE__ */ jsx("textarea", {
|
|
176
|
+
autoComplete: "off",
|
|
177
|
+
"data-1p-ignore": true,
|
|
178
|
+
value: description,
|
|
179
|
+
onChange: (e) => setDescription(e.target.value),
|
|
180
|
+
placeholder: descriptionText,
|
|
181
|
+
"aria-label": descriptionText,
|
|
182
|
+
rows: 3,
|
|
183
|
+
className: "mt-1.5 w-full border-0 p-0 bg-transparent shadow-none resize-none text-sm text-(--theme-app) placeholder:text-(--theme-placeholder) focus:outline-none focus:ring-0"
|
|
184
|
+
}) : /* @__PURE__ */ jsx("div", { className: "mt-3" })
|
|
185
|
+
] }),
|
|
186
|
+
children && /* @__PURE__ */ jsx("div", {
|
|
187
|
+
className: "mb-3 flex flex-col gap-3",
|
|
188
|
+
children
|
|
189
|
+
})
|
|
190
|
+
] }),
|
|
154
191
|
properties && /* @__PURE__ */ jsx("div", {
|
|
155
|
-
className: "flex flex-wrap items-center gap-1.5
|
|
192
|
+
className: "flex flex-wrap items-center gap-1.5 pt-1 pb-3",
|
|
156
193
|
children: properties
|
|
157
194
|
}),
|
|
158
195
|
advanced && /* @__PURE__ */ jsx("div", {
|
|
159
|
-
className: "
|
|
196
|
+
className: "pb-3",
|
|
160
197
|
children: /* @__PURE__ */ jsx(Disclosure, {
|
|
161
198
|
summary: t.advanced,
|
|
162
199
|
summaryClassName: "text-xs font-medium text-(--theme-muted-text-color) transition-colors hover:text-(--theme-app)",
|
|
@@ -165,37 +202,7 @@ function CreateModal({ open, onClose, typeIcon, typeLabel, typeMenu, namePlaceho
|
|
|
165
202
|
})
|
|
166
203
|
})
|
|
167
204
|
]
|
|
168
|
-
})
|
|
169
|
-
className: "shrink-0 flex items-center justify-between gap-2 px-4 py-3",
|
|
170
|
-
children: [showFavorite ? /* @__PURE__ */ jsx(Tooltip, {
|
|
171
|
-
content: favorite ? t.favoriteHintOn : t.favoriteHintOff,
|
|
172
|
-
children: /* @__PURE__ */ jsxs(Toggle, {
|
|
173
|
-
pressed: favorite,
|
|
174
|
-
onPressedChange: setFavorite,
|
|
175
|
-
"aria-label": t.favorite,
|
|
176
|
-
className: buttonClasses({
|
|
177
|
-
variant: "ghost",
|
|
178
|
-
size: "md"
|
|
179
|
-
}),
|
|
180
|
-
children: [favorite ? /* @__PURE__ */ jsx(FavoriteIcon, { className: "text-(--theme-favorite)" }) : /* @__PURE__ */ jsx(FavoriteOutlineIcon, {}), favorite ? t.favorited : t.favorite]
|
|
181
|
-
})
|
|
182
|
-
}) : /* @__PURE__ */ jsx("span", {}), /* @__PURE__ */ jsxs("div", {
|
|
183
|
-
className: "flex items-center gap-2",
|
|
184
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
185
|
-
variant: "ghost",
|
|
186
|
-
size: "sm",
|
|
187
|
-
onClick: onClose,
|
|
188
|
-
children: hideSubmit ? common.close : common.cancel
|
|
189
|
-
}), !hideSubmit && /* @__PURE__ */ jsx(Button, {
|
|
190
|
-
variant: "primary",
|
|
191
|
-
size: "sm",
|
|
192
|
-
onClick: handleSubmit,
|
|
193
|
-
"aria-disabled": !canSubmit,
|
|
194
|
-
loading: submitting,
|
|
195
|
-
children: submitting ? submittingText : submitText
|
|
196
|
-
})]
|
|
197
|
-
})]
|
|
198
|
-
})]
|
|
205
|
+
})
|
|
199
206
|
});
|
|
200
207
|
}
|
|
201
208
|
var pillClasses = (set) => buttonClasses({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { cx } from "../cx.js";
|
|
2
|
+
import { buttonClasses } from "./buttonClasses.js";
|
|
2
3
|
import { CalendarIcon, ChevronLeftIcon, ChevronRightIcon } from "../icons.js";
|
|
3
4
|
import { panelClassName, positionerClassName } from "./floating.js";
|
|
4
|
-
import { buttonClasses } from "./buttonClasses.js";
|
|
5
5
|
import { useStrings } from "./Provider.js";
|
|
6
6
|
import { fieldBox } from "./fieldBox.js";
|
|
7
|
+
import { useFieldControl, useFieldLabelId } from "./Field.js";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { useState } from "react";
|
|
9
10
|
import { Popover } from "@base-ui/react/popover";
|
|
@@ -37,6 +38,7 @@ var caption = new Intl.DateTimeFormat(void 0, {
|
|
|
37
38
|
var weekday = new Intl.DateTimeFormat(void 0, { weekday: "narrow" });
|
|
38
39
|
var longDay = new Intl.DateTimeFormat(void 0, { dateStyle: "full" });
|
|
39
40
|
var shownDay = new Intl.DateTimeFormat(void 0, { dateStyle: "medium" });
|
|
41
|
+
var longWeekday = new Intl.DateTimeFormat(void 0, { weekday: "long" });
|
|
40
42
|
var calendarClassNames = {
|
|
41
43
|
root: "relative p-3",
|
|
42
44
|
months: "flex flex-col",
|
|
@@ -59,7 +61,7 @@ var calendarClassNames = {
|
|
|
59
61
|
weekday: "size-9 text-center text-xs font-normal text-(--theme-muted-text-color)",
|
|
60
62
|
week: "",
|
|
61
63
|
day: "size-9 p-0 text-center text-sm",
|
|
62
|
-
day_button: "size-9 rounded-md cursor-pointer
|
|
64
|
+
day_button: "size-9 rounded-md cursor-pointer hover:bg-(--theme-hover) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--theme-focus) disabled:cursor-not-allowed disabled:hover:bg-transparent",
|
|
63
65
|
selected: "[&>button]:bg-(--theme-accent) [&>button]:text-(--theme-accent-text) [&>button]:hover:bg-(--theme-accent)",
|
|
64
66
|
today: "font-semibold [&>button]:underline [&>button]:underline-offset-4",
|
|
65
67
|
outside: "text-(--theme-muted-text-color) opacity-60",
|
|
@@ -74,6 +76,8 @@ var triggerClassName = (size) => cx(fieldBox({ size }), "flex flex-1 cursor-poin
|
|
|
74
76
|
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 }) {
|
|
75
77
|
const t = useStrings().datePicker;
|
|
76
78
|
const { common } = useStrings();
|
|
79
|
+
const field = useFieldControl();
|
|
80
|
+
const fieldLabelId = useFieldLabelId();
|
|
77
81
|
const [open, setOpen] = useState(false);
|
|
78
82
|
const [weekStartsOn] = useState(firstWeekday);
|
|
79
83
|
const day = parseDay(value);
|
|
@@ -103,10 +107,10 @@ function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep
|
|
|
103
107
|
id,
|
|
104
108
|
disabled,
|
|
105
109
|
"aria-label": ariaLabel,
|
|
106
|
-
"aria-labelledby": ariaLabelledBy,
|
|
107
|
-
"aria-describedby": ariaDescribedBy,
|
|
108
|
-
"aria-invalid": ariaInvalid ||
|
|
109
|
-
"aria-required": ariaRequired ||
|
|
110
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel ? void 0 : fieldLabelId),
|
|
111
|
+
"aria-describedby": ariaDescribedBy ?? field?.["aria-describedby"],
|
|
112
|
+
"aria-invalid": ariaInvalid || field?.["aria-invalid"],
|
|
113
|
+
"aria-required": ariaRequired || field?.["aria-required"],
|
|
110
114
|
className: triggerClassName(size),
|
|
111
115
|
children: [/* @__PURE__ */ jsx(CalendarIcon, {
|
|
112
116
|
"aria-hidden": "true",
|
|
@@ -150,7 +154,7 @@ function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep
|
|
|
150
154
|
labelPrevious: () => t.previousMonth,
|
|
151
155
|
labelNext: () => t.nextMonth,
|
|
152
156
|
labelGrid: (month) => caption.format(month),
|
|
153
|
-
labelWeekday: (date) =>
|
|
157
|
+
labelWeekday: (date) => longWeekday.format(date)
|
|
154
158
|
},
|
|
155
159
|
components: { Chevron: ({ orientation }) => orientation === "left" ? /* @__PURE__ */ jsx(ChevronLeftIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { "aria-hidden": "true" }) }
|
|
156
160
|
}), !required && day && /* @__PURE__ */ jsx("div", {
|
|
@@ -178,7 +182,7 @@ function DatePicker({ value, onValueChange, withTime = false, min, max, timeStep
|
|
|
178
182
|
min: sameDay(min) ? timeOf(min) : void 0,
|
|
179
183
|
max: sameDay(max) ? timeOf(max) : void 0,
|
|
180
184
|
disabled,
|
|
181
|
-
"aria-invalid": ariaInvalid ||
|
|
185
|
+
"aria-invalid": ariaInvalid || field?.["aria-invalid"],
|
|
182
186
|
onChange: (event) => {
|
|
183
187
|
const next = event.target.value;
|
|
184
188
|
if (next) emit(day ?? earliest ?? /* @__PURE__ */ new Date(), next);
|
|
@@ -2,10 +2,16 @@ import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
|
2
2
|
/** `plain` sets rows apart by space alone; `divided` rules a line between them; `card`
|
|
3
3
|
* also frames them in a panel. */
|
|
4
4
|
export type DescriptionListVariant = 'plain' | 'divided' | 'card';
|
|
5
|
-
export interface DescriptionListProps extends Omit<ComponentPropsWithoutRef<'dl'>, 'className'> {
|
|
5
|
+
export interface DescriptionListProps extends Omit<ComponentPropsWithoutRef<'dl'>, 'className' | 'title'> {
|
|
6
6
|
variant?: DescriptionListVariant | undefined;
|
|
7
|
+
/** A heading over the list, which names it, such as "Actor" among a record's
|
|
8
|
+
* details. */
|
|
9
|
+
title?: ReactNode;
|
|
10
|
+
/** The title's level in the page's outline. */
|
|
11
|
+
headingLevel?: 2 | 3 | 4 | undefined;
|
|
7
12
|
/** Puts each label over its value at any width. Without it they stack only when the
|
|
8
|
-
* list is too narrow for both side by side.
|
|
13
|
+
* list is too narrow for both side by side. In a DescriptionListGroup, the group's
|
|
14
|
+
* `stacked` decides. */
|
|
9
15
|
stacked?: boolean | undefined;
|
|
10
16
|
/** Styles the box around the list, such as its margins or width. */
|
|
11
17
|
className?: string | undefined;
|
|
@@ -13,11 +19,25 @@ export interface DescriptionListProps extends Omit<ComponentPropsWithoutRef<'dl'
|
|
|
13
19
|
/** Names and their values, such as the details of a record in a drawer or a card. The
|
|
14
20
|
* label column is as wide as its longest label, up to two fifths of the list, so a
|
|
15
21
|
* long label wraps rather than squeezing the values; each label sits over its value
|
|
16
|
-
* when the list is narrow.
|
|
17
|
-
|
|
22
|
+
* when the list is narrow. Lists side by side in one panel share their label column
|
|
23
|
+
* inside a `DescriptionListGroup`. */
|
|
24
|
+
export default function DescriptionList({ variant, title, headingLevel, stacked, className, children, ...props }: DescriptionListProps): import("react").JSX.Element;
|
|
25
|
+
/** Description lists in one panel, such as a record's Overview, Actor and Target, that
|
|
26
|
+
* share one label column: it fits the longest label across all of them, so their
|
|
27
|
+
* values start at one edge down the panel. Each list keeps its own title and variant;
|
|
28
|
+
* all of them stack together when the panel is narrow. */
|
|
29
|
+
export declare function DescriptionListGroup({ stacked, className, children, }: {
|
|
30
|
+
/** Puts each label over its value at any width. */
|
|
31
|
+
stacked?: boolean | undefined;
|
|
32
|
+
/** Styles the box around the group, such as its margins or width. */
|
|
33
|
+
className?: string | undefined;
|
|
34
|
+
/** `DescriptionList`s. */
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
}): import("react").JSX.Element;
|
|
18
37
|
export interface DescriptionListItemProps {
|
|
19
38
|
label: ReactNode;
|
|
20
|
-
/** The value. Nothing, an empty string or `false` shows the library's empty mark.
|
|
39
|
+
/** The value. Nothing, an empty string or `false` shows the library's empty mark.
|
|
40
|
+
* A path or URL in it, or in a link that is it, wraps after its slashes. */
|
|
21
41
|
children?: ReactNode;
|
|
22
42
|
/** Help behind an info button beside the label. */
|
|
23
43
|
tooltip?: string | undefined;
|