@parallelworks/ui 0.41.0 → 0.42.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 +25 -0
- package/dist/ai/components/AllocationSelector.d.ts +3 -4
- package/dist/ai/components/AllocationSelector.js +37 -33
- package/dist/ai/components/AttachmentManager.js +7 -7
- package/dist/ai/components/AttachmentUpload.js +5 -5
- package/dist/ai/components/BranchNavigator.js +1 -1
- package/dist/ai/components/ChatEmptyState.js +2 -2
- package/dist/ai/components/ChatInput.js +10 -8
- package/dist/ai/components/ChatLayout.js +4 -5
- package/dist/ai/components/ChatMessage.js +12 -12
- package/dist/ai/components/ChatMessageList.js +9 -9
- package/dist/ai/components/ChatSidebar.js +8 -9
- package/dist/ai/components/ChatThread.js +4 -4
- package/dist/ai/components/ComposerChrome.d.ts +2 -2
- package/dist/ai/components/ComposerChrome.js +3 -6
- package/dist/ai/components/DragOverlay.js +2 -2
- package/dist/ai/components/ModelSelector.d.ts +5 -3
- package/dist/ai/components/ModelSelector.js +102 -339
- package/dist/ai/components/PastedText.js +11 -11
- package/dist/ai/components/ProviderIssueBanner.d.ts +2 -0
- package/dist/ai/components/ProviderIssueBanner.js +34 -16
- package/dist/ai/components/Reasoning.js +4 -4
- package/dist/ai/components/ShareDialog.js +43 -35
- package/dist/ai/components/SlashMenu.d.ts +12 -2
- package/dist/ai/components/SlashMenu.js +29 -13
- package/dist/ai/components/agent/ActivityLine.js +3 -3
- package/dist/ai/components/agent/AgentMessageParts.js +20 -20
- package/dist/ai/components/agent/PermissionPicker.js +13 -11
- package/dist/ai/components/conversationActions.d.ts +4 -6
- package/dist/ai/components/conversationActions.js +9 -13
- package/dist/ai/core/ChatProvider.js +1 -1
- package/dist/ai/core/config.js +1 -1
- package/dist/ai/core/providerIssues.d.ts +7 -0
- package/dist/ai/core/providerIssues.js +9 -1
- package/dist/ai/core/useKeyboardShortcuts.d.ts +4 -0
- package/dist/ai/core/useKeyboardShortcuts.js +8 -2
- package/dist/ai/index.d.ts +0 -1
- package/dist/ai/index.js +1 -2
- package/dist/ai/strings.d.ts +19 -0
- package/dist/ai/strings.js +18 -1
- package/dist/ai/ui/Avatar.js +5 -5
- package/dist/ai/ui/ConversationSidebar.d.ts +0 -1
- package/dist/ai/ui/ConversationSidebar.js +6 -7
- package/dist/ai/ui/Markdown.js +3 -3
- package/dist/ai/ui/Notice.js +6 -6
- package/dist/ai/ui/chip.d.ts +4 -0
- package/dist/ai/ui/chip.js +8 -0
- package/dist/ai/ui/sidebar.d.ts +6 -5
- package/dist/ai/ui/sidebar.js +39 -43
- package/dist/components/ActionMenu.d.ts +13 -0
- package/dist/components/ActionMenu.js +30 -0
- package/dist/components/Avatar.js +6 -6
- package/dist/components/Breadcrumbs.js +1 -1
- package/dist/components/Button.js +10 -10
- package/dist/components/Callout.js +2 -2
- package/dist/components/Card.js +3 -3
- package/dist/components/Combobox.d.ts +66 -0
- package/dist/components/Combobox.js +393 -0
- package/dist/components/ConfirmModal.js +11 -11
- package/dist/components/ContextMenu.d.ts +23 -0
- package/dist/components/ContextMenu.js +89 -0
- package/dist/components/CopyToClipboard.js +2 -2
- package/dist/components/CreateModal.d.ts +17 -36
- package/dist/components/CreateModal.js +97 -259
- package/dist/components/DescriptionList.js +8 -8
- package/dist/components/Filter.js +2 -2
- package/dist/components/FilterPill.js +2 -2
- package/dist/components/HoverCard.d.ts +14 -0
- package/dist/components/HoverCard.js +33 -0
- package/dist/components/IconButton.d.ts +5 -5
- package/dist/components/IconButton.js +18 -22
- package/dist/components/InfoTip.d.ts +15 -0
- package/dist/components/InfoTip.js +60 -0
- package/dist/components/Input.js +5 -5
- package/dist/components/LetterBadge.js +2 -2
- package/dist/components/Loader.js +3 -3
- package/dist/components/Markdown.js +1 -1
- package/dist/components/MarkdownImpl.js +2 -2
- package/dist/components/Menu.d.ts +33 -0
- package/dist/components/Menu.js +86 -0
- package/dist/components/MenuEntries.d.ts +56 -0
- package/dist/components/MenuEntries.js +123 -0
- package/dist/components/Modal.d.ts +29 -0
- package/dist/components/Modal.js +47 -0
- package/dist/components/Overview.js +11 -10
- package/dist/components/PageHeader.d.ts +10 -16
- package/dist/components/PageHeader.js +69 -95
- package/dist/components/Pagination.js +5 -5
- package/dist/components/Provider.d.ts +5 -11
- package/dist/components/Provider.js +11 -14
- package/dist/components/Radio.d.ts +8 -0
- package/dist/components/Radio.js +16 -0
- package/dist/components/SectionHeader.js +2 -2
- package/dist/components/SegmentedControl.d.ts +6 -5
- package/dist/components/SegmentedControl.js +34 -30
- package/dist/components/Select.d.ts +27 -0
- package/dist/components/Select.js +78 -0
- package/dist/components/SettingModeOption.d.ts +5 -8
- package/dist/components/SettingModeOption.js +10 -12
- package/dist/components/SettingRow.js +4 -4
- package/dist/components/SettingsCard.js +4 -4
- package/dist/components/SettingsGroup.js +2 -2
- package/dist/components/Sort.js +1 -1
- package/dist/components/StatusBadge.js +7 -7
- package/dist/components/StatusIcons.js +4 -4
- package/dist/components/Switch.d.ts +22 -0
- package/dist/components/Switch.js +28 -0
- package/dist/components/Table.js +11 -11
- package/dist/components/Tooltip.d.ts +24 -20
- package/dist/components/Tooltip.js +58 -76
- package/dist/components/floating.d.ts +14 -0
- package/dist/components/floating.js +21 -0
- package/dist/components/search.d.ts +2 -0
- package/dist/components/search.js +14 -0
- package/dist/editor/Editor.js +1 -1
- package/dist/editor/EditorField.js +16 -21
- package/dist/editor/FormCodePanel.js +19 -19
- package/dist/editor/Monaco.js +3 -3
- package/dist/file-explorer/FileExplorer.js +77 -81
- package/dist/file-explorer/FileExplorerContext.js +2 -2
- package/dist/file-explorer/FilePreview/CodePreviewEditor.js +1 -1
- package/dist/file-explorer/FilePreview/Inline.js +1 -1
- package/dist/file-explorer/FilePreview/StreamedBadge.js +5 -6
- package/dist/file-explorer/FilePreview/Viewer.js +8 -8
- package/dist/file-explorer/FilePreview/index.d.ts +1 -1
- package/dist/file-explorer/FilePreview/index.js +49 -83
- package/dist/file-explorer/FileRow.d.ts +4 -3
- package/dist/file-explorer/FileRow.js +32 -38
- package/dist/file-explorer/FileRowsWindow.d.ts +3 -2
- package/dist/file-explorer/FileRowsWindow.js +4 -4
- package/dist/file-explorer/FileTable.d.ts +3 -2
- package/dist/file-explorer/FileTable.js +3 -3
- package/dist/file-explorer/LoadMoreRow.js +1 -1
- package/dist/file-explorer/TreeView.js +11 -16
- package/dist/file-explorer/helpers.js +11 -12
- package/dist/file-explorer/toasts.js +11 -11
- package/dist/form/FieldGroup.d.ts +11 -0
- package/dist/form/FieldGroup.js +36 -0
- package/dist/form/FieldWrapper.js +4 -4
- package/dist/form/Fields/BooleanField.js +23 -33
- package/dist/form/Fields/CheckboxGroupField.d.ts +1 -1
- package/dist/form/Fields/CheckboxGroupField.js +9 -13
- package/dist/form/Fields/ColorField.d.ts +1 -2
- package/dist/form/Fields/ColorField.js +6 -11
- package/dist/form/Fields/DropdownField.d.ts +3 -13
- package/dist/form/Fields/DropdownField.js +40 -27
- package/dist/form/Fields/DurationField.d.ts +1 -2
- package/dist/form/Fields/DurationField.js +25 -32
- package/dist/form/Fields/LabelField.js +2 -2
- package/dist/form/Fields/MultiDropdownField.d.ts +6 -12
- package/dist/form/Fields/MultiDropdownField.js +31 -22
- package/dist/form/Fields/NumberField.d.ts +1 -1
- package/dist/form/Fields/NumberField.js +65 -35
- package/dist/form/Fields/ObjectField.d.ts +1 -1
- package/dist/form/Fields/ObjectField.js +12 -43
- package/dist/form/Fields/RadioField.d.ts +1 -1
- package/dist/form/Fields/RadioField.js +30 -41
- package/dist/form/Fields/RangeField.d.ts +1 -2
- package/dist/form/Fields/RangeField.js +23 -16
- package/dist/form/Fields/StringField.d.ts +1 -2
- package/dist/form/Fields/StringField.js +58 -26
- package/dist/form/Fields/TextAreaField.js +12 -10
- package/dist/form/Form.d.ts +30 -48
- package/dist/form/Form.js +306 -412
- package/dist/form/FormLayout.js +9 -9
- package/dist/form/Wizard/WizardContainer.d.ts +1 -4
- package/dist/form/Wizard/WizardContainer.js +40 -56
- package/dist/form/Wizard/WizardNavigation.js +1 -1
- package/dist/form/Wizard/WizardStepContent.d.ts +1 -5
- package/dist/form/Wizard/WizardStepContent.js +11 -16
- package/dist/form/Wizard/WizardStepIndicator.js +6 -6
- package/dist/form/Wizard/types.d.ts +0 -14
- package/dist/form/fieldRegistry.d.ts +1 -1
- package/dist/form/fieldRegistry.js +6 -6
- package/dist/form/formEditing.js +1 -1
- package/dist/form/index.d.ts +5 -4
- package/dist/form/index.js +6 -7
- package/dist/form/types/fieldComponentTypes.d.ts +8 -10
- package/dist/form/useChoiceField.d.ts +20 -0
- package/dist/form/useChoiceField.js +49 -0
- package/dist/form/useFieldValue.d.ts +7 -0
- package/dist/form/useFieldValue.js +20 -0
- package/dist/form/useParsedOpts.d.ts +3 -1
- package/dist/form/useParsedOpts.js +12 -17
- package/dist/form/utils/dependentOptions.d.ts +8 -4
- package/dist/form/utils/dependentOptions.js +25 -17
- package/dist/form/utils/fieldItems.d.ts +10 -0
- package/dist/form/utils/fieldItems.js +11 -0
- package/dist/form/utils/fieldPath.d.ts +10 -0
- package/dist/form/utils/fieldPath.js +20 -0
- package/dist/form/utils/shareEqual.d.ts +6 -0
- package/dist/form/utils/shareEqual.js +38 -0
- package/dist/graph/AnnotationBanner.js +8 -8
- package/dist/graph/Collapse.d.ts +1 -0
- package/dist/graph/Collapse.js +6 -27
- package/dist/graph/Connectors.js +5 -5
- package/dist/graph/DependencyGraph.js +20 -19
- package/dist/graph/GraphEditor.js +30 -41
- package/dist/graph/GraphEditorDialogs.js +17 -17
- package/dist/graph/GraphNode.js +1 -1
- package/dist/graph/InputDialog.js +19 -22
- package/dist/graph/InputsEditor.js +58 -66
- package/dist/graph/JobSummary.js +42 -39
- package/dist/graph/MatrixGroup.js +1 -1
- package/dist/graph/ProblemsButton.js +18 -19
- package/dist/graph/Reveal.js +1 -1
- package/dist/graph/ShortcutsButton.js +15 -18
- package/dist/graph/SuggestionInput.d.ts +5 -10
- package/dist/graph/SuggestionInput.js +14 -18
- package/dist/graph/ToolbarPopover.d.ts +11 -6
- package/dist/graph/ToolbarPopover.js +35 -67
- package/dist/graph/TreeView.js +24 -37
- package/dist/graph/WorkflowSettingsDialog.js +4 -4
- package/dist/graph/editorChrome.js +13 -12
- package/dist/graph/editorFields.js +29 -29
- package/dist/graph/editorPrimitives.d.ts +1 -1
- package/dist/graph/editorPrimitives.js +10 -7
- package/dist/graph/editorRows.js +103 -97
- package/dist/graph/fieldProblems.js +2 -2
- package/dist/graph/graphEditorState.d.ts +4 -3
- package/dist/graph/inputRefs.js +9 -9
- package/dist/graph/settingsViews.js +6 -7
- package/dist/graph/stepWith.js +6 -6
- package/dist/index.d.ts +14 -15
- package/dist/index.js +15 -14
- package/dist/list/ActionToolbar.d.ts +6 -14
- package/dist/list/ActionToolbar.js +48 -96
- package/dist/list/ListPage.d.ts +6 -12
- package/dist/list/ListPage.js +46 -29
- package/dist/list/ListPager.js +4 -4
- package/dist/list/ListTable.js +5 -5
- package/dist/list/ListViewControls.d.ts +5 -4
- package/dist/list/ListViewControls.js +177 -267
- package/dist/list/UserHoverCard.d.ts +3 -17
- package/dist/list/UserHoverCard.js +21 -45
- package/dist/list/index.d.ts +3 -4
- package/dist/list/index.js +3 -4
- package/dist/list/listSearch.js +12 -11
- package/dist/list/rowMenu.d.ts +63 -0
- package/dist/list/rowMenu.js +134 -0
- package/dist/logviewer/LogViewer.js +26 -26
- package/dist/styles.css +1 -1
- package/package.json +7 -13
- package/dist/ai/ui/Dropdown.d.ts +0 -31
- package/dist/ai/ui/Dropdown.js +0 -110
- package/dist/components/AddMenu.d.ts +0 -18
- package/dist/components/AddMenu.js +0 -46
- package/dist/components/BareModal.d.ts +0 -17
- package/dist/components/BareModal.js +0 -77
- package/dist/components/CollapsiblePanel.d.ts +0 -27
- package/dist/components/CollapsiblePanel.js +0 -77
- package/dist/components/Dropdown.d.ts +0 -28
- package/dist/components/Dropdown.js +0 -355
- package/dist/components/Listbox.d.ts +0 -21
- package/dist/components/Listbox.js +0 -119
- package/dist/components/MultiSelect.d.ts +0 -22
- package/dist/components/MultiSelect.js +0 -168
- package/dist/components/SwitchToggle.d.ts +0 -15
- package/dist/components/SwitchToggle.js +0 -57
- package/dist/components/SwitchToggleSmall.d.ts +0 -6
- package/dist/components/SwitchToggleSmall.js +0 -14
- package/dist/components/Toggle.d.ts +0 -6
- package/dist/components/Toggle.js +0 -20
- package/dist/components/dropdownUtils.d.ts +0 -37
- package/dist/components/dropdownUtils.js +0 -99
- package/dist/form/SpecialTypes/DropdownWrapper.d.ts +0 -25
- package/dist/form/SpecialTypes/DropdownWrapper.js +0 -28
- package/dist/form/SpecialTypes/FormikCustomDropdown.d.ts +0 -51
- package/dist/form/SpecialTypes/FormikCustomDropdown.js +0 -119
- package/dist/form/SpecialTypes/FormikCustomInput.d.ts +0 -19
- package/dist/form/SpecialTypes/FormikCustomInput.js +0 -121
- package/dist/form/SpecialTypes/FormikMultiSelectDropdown.d.ts +0 -13
- package/dist/form/SpecialTypes/FormikMultiSelectDropdown.js +0 -31
- package/dist/form/SpecialTypes/FormikNumericInput.d.ts +0 -9
- package/dist/form/SpecialTypes/FormikNumericInput.js +0 -60
- package/dist/form/SpecialTypes/index.d.ts +0 -3
- package/dist/list/HoverCard.d.ts +0 -24
- package/dist/list/HoverCard.js +0 -73
- package/dist/list/RowContextMenu.d.ts +0 -127
- package/dist/list/RowContextMenu.js +0 -515
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parallelworks/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "React UI components: a theme contract, icons, primitives, lists, forms, a job graph, a code editor, a log viewer, a file explorer and an AI chat, each on its own subpath",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -75,31 +75,25 @@
|
|
|
75
75
|
"dist"
|
|
76
76
|
],
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"formik": "^2.4.9",
|
|
79
78
|
"monaco-editor": "^0.57.0",
|
|
80
79
|
"react": "^19.0.0",
|
|
81
|
-
"react-dom": "^19.0.0"
|
|
80
|
+
"react-dom": "^19.0.0",
|
|
81
|
+
"react-hook-form": "^7.90.0"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@
|
|
84
|
+
"@base-ui/react": "^1.9.0",
|
|
85
85
|
"@streamdown/code": "^2.0.0",
|
|
86
86
|
"@streamdown/math": "^1.0.3",
|
|
87
87
|
"@streamdown/mermaid": "^1.0.3",
|
|
88
88
|
"@tanstack/react-virtual": "^3.14.13",
|
|
89
89
|
"@types/luxon": "^3.7.6",
|
|
90
90
|
"anser": "^2.3.5",
|
|
91
|
-
"
|
|
91
|
+
"clsx": "^2.1.1",
|
|
92
92
|
"css-tree": "^3.2.1",
|
|
93
|
-
"
|
|
94
|
-
"framer-motion": "^14.0.0",
|
|
93
|
+
"dequal": "^2.0.3",
|
|
95
94
|
"luxon": "^3.7.2",
|
|
96
95
|
"re-resizable": "^6.11.2",
|
|
97
|
-
"react-animate-height": "^3.2.4",
|
|
98
96
|
"react-icons": "5.7.0",
|
|
99
|
-
"react-loading-skeleton": "^3.5.0",
|
|
100
|
-
"react-number-format": "^5.4.5",
|
|
101
|
-
"react-popper": "^2.3.0",
|
|
102
|
-
"react-tooltip": "^6.0.8",
|
|
103
97
|
"react-zoom-pan-pinch": "^4.2.0",
|
|
104
98
|
"shiki": "^4.5.0",
|
|
105
99
|
"streamdown": "^2.7.0",
|
|
@@ -120,7 +114,6 @@
|
|
|
120
114
|
"@types/react": "19.3.0",
|
|
121
115
|
"@types/react-dom": "19.3.0",
|
|
122
116
|
"@vitejs/plugin-react": "^6.1.1",
|
|
123
|
-
"formik": "^2.4.9",
|
|
124
117
|
"jsdom": "^30.1.1",
|
|
125
118
|
"monaco-editor": "^0.57.0",
|
|
126
119
|
"path-browserify": "^1.0.1",
|
|
@@ -128,6 +121,7 @@
|
|
|
128
121
|
"publint": "^0.3.25",
|
|
129
122
|
"react": "19.3.0",
|
|
130
123
|
"react-dom": "19.3.0",
|
|
124
|
+
"react-hook-form": "^7.90.0",
|
|
131
125
|
"storybook": "10.6.1",
|
|
132
126
|
"tailwindcss": "^4.3.3",
|
|
133
127
|
"typescript": "^7.0.2",
|
package/dist/ai/ui/Dropdown.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
export interface DropdownOption {
|
|
3
|
-
label: string;
|
|
4
|
-
value: string;
|
|
5
|
-
/** A second line under the label, for choices that need explaining. */
|
|
6
|
-
description?: string;
|
|
7
|
-
/** Rendered as a plain option; the trailing checkmark and bold never apply. */
|
|
8
|
-
muted?: boolean;
|
|
9
|
-
}
|
|
10
|
-
interface DropdownProps {
|
|
11
|
-
options: DropdownOption[];
|
|
12
|
-
value: string;
|
|
13
|
-
onChange: (value: string) => void;
|
|
14
|
-
placeholder?: string;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
/** 'bare' drops the input background and text colour, for a trigger that
|
|
17
|
-
* reads as a chip or as toolbar text. */
|
|
18
|
-
variant?: 'default' | 'bare';
|
|
19
|
-
/** Leading content in the trigger, before the label. */
|
|
20
|
-
icon?: ReactNode;
|
|
21
|
-
/** Shown in the trigger instead of the selected option's label. */
|
|
22
|
-
valueLabel?: string;
|
|
23
|
-
ariaLabel?: string;
|
|
24
|
-
/** Tooltip on the closed trigger. */
|
|
25
|
-
hint?: string;
|
|
26
|
-
wrapperClassName?: string;
|
|
27
|
-
textBoxClassName?: string;
|
|
28
|
-
listClassName?: string;
|
|
29
|
-
}
|
|
30
|
-
export default function Dropdown({ options, value, onChange, placeholder, disabled, variant, icon, valueLabel, ariaLabel, hint, wrapperClassName, textBoxClassName, listClassName, }: DropdownProps): import("react").JSX.Element;
|
|
31
|
-
export {};
|
package/dist/ai/ui/Dropdown.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { FaChevronDown } from "../../icons/fa/FaChevronDown.js";
|
|
2
|
-
import { TOOLTIP_ID } from "../../components/Tooltip.js";
|
|
3
|
-
import cx from "classnames";
|
|
4
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { createPortal } from "react-dom";
|
|
7
|
-
//#region src/ai/ui/Dropdown.tsx
|
|
8
|
-
/** Matches the list's max-h-60, so the flip decision matches what renders. */
|
|
9
|
-
var MAX_LIST_HEIGHT_PX = 240;
|
|
10
|
-
function Dropdown({ options, value, onChange, placeholder = "", disabled = false, variant = "default", icon, valueLabel, ariaLabel, hint, wrapperClassName, textBoxClassName, listClassName }) {
|
|
11
|
-
const [open, setOpen] = useState(false);
|
|
12
|
-
const wrapperRef = useRef(null);
|
|
13
|
-
const listRef = useRef(null);
|
|
14
|
-
const [position, setPosition] = useState({
|
|
15
|
-
top: 0,
|
|
16
|
-
bottom: 0,
|
|
17
|
-
left: 0,
|
|
18
|
-
width: 0,
|
|
19
|
-
flipped: false
|
|
20
|
-
});
|
|
21
|
-
const updatePosition = useCallback(() => {
|
|
22
|
-
const rect = wrapperRef.current?.getBoundingClientRect();
|
|
23
|
-
if (!rect) return;
|
|
24
|
-
const below = window.innerHeight - rect.bottom;
|
|
25
|
-
const flipped = below < MAX_LIST_HEIGHT_PX && rect.top > below;
|
|
26
|
-
setPosition({
|
|
27
|
-
top: rect.bottom + 4,
|
|
28
|
-
bottom: window.innerHeight - rect.top + 4,
|
|
29
|
-
left: rect.left,
|
|
30
|
-
width: rect.width,
|
|
31
|
-
flipped
|
|
32
|
-
});
|
|
33
|
-
}, []);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!open) return;
|
|
36
|
-
updatePosition();
|
|
37
|
-
const onPointerDown = (e) => {
|
|
38
|
-
const target = e.target;
|
|
39
|
-
if (!wrapperRef.current?.contains(target) && !listRef.current?.contains(target)) setOpen(false);
|
|
40
|
-
};
|
|
41
|
-
const onKey = (e) => {
|
|
42
|
-
if (e.key === "Escape") setOpen(false);
|
|
43
|
-
};
|
|
44
|
-
window.addEventListener("mousedown", onPointerDown);
|
|
45
|
-
window.addEventListener("keydown", onKey);
|
|
46
|
-
window.addEventListener("scroll", updatePosition, true);
|
|
47
|
-
window.addEventListener("resize", updatePosition);
|
|
48
|
-
return () => {
|
|
49
|
-
window.removeEventListener("mousedown", onPointerDown);
|
|
50
|
-
window.removeEventListener("keydown", onKey);
|
|
51
|
-
window.removeEventListener("scroll", updatePosition, true);
|
|
52
|
-
window.removeEventListener("resize", updatePosition);
|
|
53
|
-
};
|
|
54
|
-
}, [open, updatePosition]);
|
|
55
|
-
const selected = options.find((o) => o.value === value);
|
|
56
|
-
const shown = valueLabel ?? selected?.label;
|
|
57
|
-
const tooltip = hint && !open ? {
|
|
58
|
-
"data-tooltip-id": TOOLTIP_ID,
|
|
59
|
-
"data-tooltip-content": hint
|
|
60
|
-
} : {};
|
|
61
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
62
|
-
ref: wrapperRef,
|
|
63
|
-
className: cx("relative", wrapperClassName),
|
|
64
|
-
children: [/* @__PURE__ */ jsxs("button", {
|
|
65
|
-
type: "button",
|
|
66
|
-
disabled,
|
|
67
|
-
onClick: () => setOpen((o) => !o),
|
|
68
|
-
"aria-haspopup": "listbox",
|
|
69
|
-
"aria-expanded": open,
|
|
70
|
-
"aria-label": ariaLabel,
|
|
71
|
-
...tooltip,
|
|
72
|
-
className: cx("flex items-center justify-between gap-2 cursor-pointer", variant === "default" && "bg-(--theme-input-bg,#f9fafb) text-(--theme-input,#000000)", "disabled:opacity-50 disabled:cursor-not-allowed", textBoxClassName || "text-sm border border-(--theme-border,#d1d5db) rounded px-2 py-1.5 w-full"),
|
|
73
|
-
children: [
|
|
74
|
-
icon,
|
|
75
|
-
/* @__PURE__ */ jsx("span", {
|
|
76
|
-
className: cx("truncate", !shown && "text-(--theme-muted-text-color,#6c757d)"),
|
|
77
|
-
children: shown || placeholder
|
|
78
|
-
}),
|
|
79
|
-
/* @__PURE__ */ jsx(FaChevronDown, { className: "h-3 w-3 shrink-0 opacity-60" })
|
|
80
|
-
]
|
|
81
|
-
}), open && createPortal(/* @__PURE__ */ jsx("ul", {
|
|
82
|
-
ref: listRef,
|
|
83
|
-
style: {
|
|
84
|
-
position: "fixed",
|
|
85
|
-
...position.flipped ? { bottom: position.bottom } : { top: position.top },
|
|
86
|
-
left: position.left,
|
|
87
|
-
minWidth: position.width,
|
|
88
|
-
zIndex: 300
|
|
89
|
-
},
|
|
90
|
-
className: cx("max-h-60 overflow-auto rounded-md border border-(--theme-border,#e5e7eb) bg-(--theme-panel-bg,#ffffff) py-1 shadow-lg", listClassName),
|
|
91
|
-
children: options.map((option) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
|
|
92
|
-
type: "button",
|
|
93
|
-
onClick: () => {
|
|
94
|
-
onChange(option.value);
|
|
95
|
-
setOpen(false);
|
|
96
|
-
},
|
|
97
|
-
className: cx("w-full cursor-pointer px-3 py-1.5 text-left text-sm hover:bg-(--theme-hover,#f3f4f6)", option.muted ? "text-(--theme-muted-text-color,#6c757d)" : "text-(--theme-panel,#000000)", option.value === value && !option.muted && "font-semibold"),
|
|
98
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
99
|
-
className: "block truncate",
|
|
100
|
-
children: option.label
|
|
101
|
-
}), option.description && /* @__PURE__ */ jsx("span", {
|
|
102
|
-
className: "mt-0.5 block text-xs font-normal leading-snug text-(--theme-muted-text-color,#6c757d)",
|
|
103
|
-
children: option.description
|
|
104
|
-
})]
|
|
105
|
-
}) }, option.value))
|
|
106
|
-
}), document.body)]
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
export { Dropdown as default };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export interface HeaderAddMenuItem {
|
|
3
|
-
label: string;
|
|
4
|
-
icon?: ReactNode;
|
|
5
|
-
to?: string;
|
|
6
|
-
onSelect?: () => void;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
hint?: string | undefined;
|
|
9
|
-
separatorAbove?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare function AddMenu({ items, label, buttonClassName, zClassName, children, }: {
|
|
12
|
-
items: HeaderAddMenuItem[];
|
|
13
|
-
label: string;
|
|
14
|
-
buttonClassName?: string;
|
|
15
|
-
/** Raise above modals when needed (e.g. z-[9999]). */
|
|
16
|
-
zClassName?: string;
|
|
17
|
-
children: ReactNode;
|
|
18
|
-
}): import("react").JSX.Element;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useLink } from "./Provider.js";
|
|
2
|
-
import { TOOLTIP_ID } from "./Tooltip.js";
|
|
3
|
-
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
|
|
4
|
-
import cx from "classnames";
|
|
5
|
-
import { Fragment } from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
//#region src/components/AddMenu.tsx
|
|
8
|
-
var addMenuItemClasses = "flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-(--theme-app) data-[focus]:bg-(--theme-muted-panel-bg) cursor-pointer";
|
|
9
|
-
function itemButtonProps(item) {
|
|
10
|
-
if (!item.disabled) return { onClick: item.onSelect };
|
|
11
|
-
return {
|
|
12
|
-
"aria-disabled": true,
|
|
13
|
-
...item.hint ? {
|
|
14
|
-
"aria-label": `${item.label}. ${item.hint}`,
|
|
15
|
-
"data-tooltip-id": TOOLTIP_ID,
|
|
16
|
-
"data-tooltip-content": item.hint
|
|
17
|
-
} : {}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function AddMenu({ items, label, buttonClassName, zClassName = "z-50", children }) {
|
|
21
|
-
const Link = useLink();
|
|
22
|
-
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuButton, {
|
|
23
|
-
"aria-label": label,
|
|
24
|
-
title: label,
|
|
25
|
-
className: buttonClassName,
|
|
26
|
-
children
|
|
27
|
-
}), /* @__PURE__ */ jsx(MenuItems, {
|
|
28
|
-
anchor: "bottom start",
|
|
29
|
-
className: cx("mt-1 min-w-52 rounded-lg border border-(--theme-border) bg-(--theme-app-bg) py-1 shadow-lg focus:outline-none", zClassName),
|
|
30
|
-
children: items.map((item) => /* @__PURE__ */ jsxs(Fragment, { children: [item.separatorAbove && /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-(--theme-border)" }), /* @__PURE__ */ jsx(MenuItem, {
|
|
31
|
-
disabled: item.disabled ?? false,
|
|
32
|
-
children: item.to && !item.disabled ? /* @__PURE__ */ jsxs(Link, {
|
|
33
|
-
to: item.to,
|
|
34
|
-
className: addMenuItemClasses,
|
|
35
|
-
children: [item.icon, item.label]
|
|
36
|
-
}) : /* @__PURE__ */ jsxs("button", {
|
|
37
|
-
type: "button",
|
|
38
|
-
...itemButtonProps(item),
|
|
39
|
-
className: cx(addMenuItemClasses, item.disabled && "opacity-50 cursor-not-allowed"),
|
|
40
|
-
children: [item.icon, item.label]
|
|
41
|
-
})
|
|
42
|
-
})] }, item.label))
|
|
43
|
-
})] });
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
export { AddMenu };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { KeyboardEvent as ReactKeyboardEvent, MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
2
|
-
/** Omit when the content supplies its own panel styling. */
|
|
3
|
-
export declare const modalPanelClasses = "rounded-xl border border-(--theme-border) bg-(--theme-app-bg) text-(--theme-app) shadow-2xl";
|
|
4
|
-
export declare function BareModal({ open, onClose, ariaLabel, className, onPanelKeyDown, onPanelMouseDown, align, preventClose, children, }: {
|
|
5
|
-
open: boolean;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
ariaLabel?: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
onPanelKeyDown?: (e: ReactKeyboardEvent<HTMLDivElement>) => void;
|
|
10
|
-
onPanelMouseDown?: (e: ReactMouseEvent<HTMLDivElement>) => void;
|
|
11
|
-
/** Vertical placement of the panel. Defaults to the ds top-anchored position. */
|
|
12
|
-
align?: 'top' | 'center';
|
|
13
|
-
/** Block the accidental-dismiss paths (backdrop click, Escape) so typed
|
|
14
|
-
* input isn't lost. The explicit close controls still work. */
|
|
15
|
-
preventClose?: boolean;
|
|
16
|
-
children: ReactNode;
|
|
17
|
-
}): import("react").ReactPortal | null;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import cx from "classnames";
|
|
2
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { createPortal } from "react-dom";
|
|
5
|
-
//#region src/components/BareModal.tsx
|
|
6
|
-
/** Omit when the content supplies its own panel styling. */
|
|
7
|
-
var modalPanelClasses = "rounded-xl border border-(--theme-border) bg-(--theme-app-bg) text-(--theme-app) shadow-2xl";
|
|
8
|
-
var FOCUSABLE = "a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex=\"-1\"])";
|
|
9
|
-
function BareModal({ open, onClose, ariaLabel, className, onPanelKeyDown, onPanelMouseDown, align = "top", preventClose = false, children }) {
|
|
10
|
-
const panelRef = useRef(null);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (!open || preventClose) return;
|
|
13
|
-
const onKeyDown = (e) => {
|
|
14
|
-
if (e.key === "Escape") onClose();
|
|
15
|
-
};
|
|
16
|
-
document.addEventListener("keydown", onKeyDown);
|
|
17
|
-
return () => document.removeEventListener("keydown", onKeyDown);
|
|
18
|
-
}, [
|
|
19
|
-
open,
|
|
20
|
-
onClose,
|
|
21
|
-
preventClose
|
|
22
|
-
]);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (!open) return;
|
|
25
|
-
const previouslyFocused = document.activeElement;
|
|
26
|
-
const previousOverflow = document.body.style.overflow;
|
|
27
|
-
document.body.style.overflow = "hidden";
|
|
28
|
-
return () => {
|
|
29
|
-
document.body.style.overflow = previousOverflow;
|
|
30
|
-
previouslyFocused?.focus?.();
|
|
31
|
-
};
|
|
32
|
-
}, [open]);
|
|
33
|
-
const trapFocus = useCallback((e) => {
|
|
34
|
-
const panel = panelRef.current;
|
|
35
|
-
if (e.key !== "Tab" || !panel || !panel.contains(document.activeElement)) {
|
|
36
|
-
onPanelKeyDown?.(e);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const focusable = panel.querySelectorAll(FOCUSABLE);
|
|
40
|
-
const first = focusable[0];
|
|
41
|
-
const last = focusable[focusable.length - 1];
|
|
42
|
-
if (!first || !last) {
|
|
43
|
-
e.preventDefault();
|
|
44
|
-
onPanelKeyDown?.(e);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (e.shiftKey && document.activeElement === first) {
|
|
48
|
-
e.preventDefault();
|
|
49
|
-
last.focus();
|
|
50
|
-
} else if (!e.shiftKey && document.activeElement === last) {
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
first.focus();
|
|
53
|
-
}
|
|
54
|
-
onPanelKeyDown?.(e);
|
|
55
|
-
}, [onPanelKeyDown]);
|
|
56
|
-
if (!open) return null;
|
|
57
|
-
return createPortal(/* @__PURE__ */ jsx("div", {
|
|
58
|
-
"data-testid": "modal-backdrop",
|
|
59
|
-
role: "none",
|
|
60
|
-
className: cx("fixed inset-0 z-[9990] flex justify-center px-4 pb-8", align === "center" ? "items-center" : "items-start pt-[14vh]"),
|
|
61
|
-
style: { backgroundColor: "rgba(0, 0, 0, 0.4)" },
|
|
62
|
-
onClick: preventClose ? void 0 : onClose,
|
|
63
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
64
|
-
ref: panelRef,
|
|
65
|
-
role: "dialog",
|
|
66
|
-
"aria-modal": "true",
|
|
67
|
-
"aria-label": ariaLabel,
|
|
68
|
-
className,
|
|
69
|
-
onClick: (e) => e.stopPropagation(),
|
|
70
|
-
onKeyDown: trapFocus,
|
|
71
|
-
onMouseDown: onPanelMouseDown,
|
|
72
|
-
children
|
|
73
|
-
})
|
|
74
|
-
}), document.body);
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
export { BareModal, modalPanelClasses };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface IControlledCollapsiblePanelProps {
|
|
3
|
-
title?: string | React.ReactNode | ((open: boolean, setOpen: React.Dispatch<React.SetStateAction<boolean>>) => React.ReactNode);
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
open: boolean | undefined;
|
|
6
|
-
setOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
|
-
onClick?: (() => void) | undefined;
|
|
8
|
-
wrapperElement?: React.ElementType | undefined;
|
|
9
|
-
customizedButton?: React.ReactNode;
|
|
10
|
-
/** Rendered right after the title, outside the toggle button. */
|
|
11
|
-
titleAction?: React.ReactNode;
|
|
12
|
-
className?: string | undefined;
|
|
13
|
-
}
|
|
14
|
-
export declare function ControlledCollapsiblePanel({ title, children, open, setOpen, onClick, wrapperElement, customizedButton, titleAction, className, }: IControlledCollapsiblePanelProps): React.JSX.Element;
|
|
15
|
-
export declare function UncontrolledCollapsiblePanel({ title, children, onClick, wrapperElement, initialState, className, customizedButton, titleAction, }: Omit<IControlledCollapsiblePanelProps, 'setOpen' | 'open'> & {
|
|
16
|
-
initialState?: boolean | undefined;
|
|
17
|
-
}): React.JSX.Element;
|
|
18
|
-
type MaybeCollapsibleProps = {
|
|
19
|
-
className?: string;
|
|
20
|
-
initialState?: boolean;
|
|
21
|
-
children: React.ReactNode;
|
|
22
|
-
title?: React.ReactNode;
|
|
23
|
-
customizedButton?: React.ReactNode;
|
|
24
|
-
collapsible?: boolean | undefined;
|
|
25
|
-
};
|
|
26
|
-
export declare function MaybeCollapsible({ className, initialState, children, title, customizedButton, collapsible, }: MaybeCollapsibleProps): React.JSX.Element;
|
|
27
|
-
export {};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { FaAngleRight } from "../icons/fa/FaAngleRight.js";
|
|
2
|
-
import cx from "classnames";
|
|
3
|
-
import React, { useCallback } from "react";
|
|
4
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import AnimateHeight from "react-animate-height";
|
|
6
|
-
//#region src/components/CollapsiblePanel.tsx
|
|
7
|
-
function ControlledCollapsiblePanel({ title = "", children, open, setOpen, onClick, wrapperElement, customizedButton = null, titleAction, className }) {
|
|
8
|
-
const toggleOpen = useCallback(() => {
|
|
9
|
-
onClick?.();
|
|
10
|
-
setOpen?.((open) => !open);
|
|
11
|
-
}, [setOpen, onClick]);
|
|
12
|
-
const contentId = React.useId();
|
|
13
|
-
const Wrapper = wrapperElement ?? React.Fragment;
|
|
14
|
-
return React.isValidElement(title) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [title, /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(AnimateHeight, {
|
|
15
|
-
duration: 300,
|
|
16
|
-
height: open ? "auto" : 0,
|
|
17
|
-
children
|
|
18
|
-
}) })] }) : /* @__PURE__ */ jsxs("div", {
|
|
19
|
-
className: cx("border border-solid rounded-2xl border-(--theme-border) bg-(--theme-panel-bg) text-(--theme-panel) mb-1 w-full", className),
|
|
20
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
21
|
-
className: cx(!open && "text-(--theme-muted-text-color)", "w-full flex items-center transform ease-in transition text-sm py-3 px-2 cursor-pointer"),
|
|
22
|
-
children: [
|
|
23
|
-
/* @__PURE__ */ jsxs("button", {
|
|
24
|
-
type: "button",
|
|
25
|
-
"aria-expanded": !!open,
|
|
26
|
-
"aria-controls": contentId,
|
|
27
|
-
className: cx("flex items-center text-left cursor-pointer", !titleAction && "w-full"),
|
|
28
|
-
onClick: toggleOpen,
|
|
29
|
-
children: [/* @__PURE__ */ jsx(FaAngleRight, { className: cx(open && "transform rotate-90", "px-1 ml-1 text-[1.25rem] transition ease-in") }), /* @__PURE__ */ jsx("span", {
|
|
30
|
-
className: "px-2 font-bold select-none",
|
|
31
|
-
children: title?.toString()
|
|
32
|
-
})]
|
|
33
|
-
}),
|
|
34
|
-
titleAction,
|
|
35
|
-
/* @__PURE__ */ jsx("div", {
|
|
36
|
-
className: "ml-auto",
|
|
37
|
-
children: customizedButton
|
|
38
|
-
})
|
|
39
|
-
]
|
|
40
|
-
}), /* @__PURE__ */ jsx(AnimateHeight, {
|
|
41
|
-
id: contentId,
|
|
42
|
-
duration: 300,
|
|
43
|
-
height: open ? "auto" : 0,
|
|
44
|
-
children
|
|
45
|
-
})]
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function UncontrolledCollapsiblePanel({ title, children, onClick, wrapperElement, initialState = true, className, customizedButton = null, titleAction }) {
|
|
49
|
-
const [open, setOpen] = React.useState(initialState);
|
|
50
|
-
const passTitle = typeof title === "function" ? title(open, setOpen) : title;
|
|
51
|
-
return /* @__PURE__ */ jsx(ControlledCollapsiblePanel, {
|
|
52
|
-
title: passTitle,
|
|
53
|
-
open,
|
|
54
|
-
setOpen,
|
|
55
|
-
onClick,
|
|
56
|
-
wrapperElement,
|
|
57
|
-
className,
|
|
58
|
-
customizedButton,
|
|
59
|
-
titleAction,
|
|
60
|
-
children
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function MaybeCollapsible({ className, initialState, children, title, customizedButton, collapsible }) {
|
|
64
|
-
if (collapsible) return /* @__PURE__ */ jsx(UncontrolledCollapsiblePanel, {
|
|
65
|
-
className,
|
|
66
|
-
initialState,
|
|
67
|
-
title,
|
|
68
|
-
customizedButton,
|
|
69
|
-
children
|
|
70
|
-
});
|
|
71
|
-
return /* @__PURE__ */ jsx("div", {
|
|
72
|
-
className,
|
|
73
|
-
children
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
export { ControlledCollapsiblePanel, MaybeCollapsible, UncontrolledCollapsiblePanel };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type SetStateAction } from 'react';
|
|
2
|
-
import { type ICategory, type IOptions } from './dropdownUtils.js';
|
|
3
|
-
export interface IProps {
|
|
4
|
-
options: (ICategory | IOptions | string)[];
|
|
5
|
-
onActiveChange?: (option: unknown) => void;
|
|
6
|
-
onChange: React.Dispatch<SetStateAction<unknown>>;
|
|
7
|
-
value: IOptions | string | Record<string, unknown>;
|
|
8
|
-
id?: string | undefined;
|
|
9
|
-
ariaLabel?: string | undefined;
|
|
10
|
-
'aria-describedby'?: string | undefined;
|
|
11
|
-
required?: boolean | undefined;
|
|
12
|
-
className?: string;
|
|
13
|
-
wrapperClassName?: string;
|
|
14
|
-
textBoxClassName?: string;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
placeholder?: string | undefined;
|
|
17
|
-
loading?: boolean;
|
|
18
|
-
allowCustomValue?: boolean;
|
|
19
|
-
customValueLabel?: string | undefined;
|
|
20
|
-
/** Label for the toggle row hiding a category's collapsible options. */
|
|
21
|
-
collapsedLabel?: (count: number) => string;
|
|
22
|
-
portalEl?: HTMLElement;
|
|
23
|
-
/** Smaller option rows and text, for dense toolbars. */
|
|
24
|
-
compact?: boolean | undefined;
|
|
25
|
-
/** False hides the caret, for a field that has nothing to pick from yet. */
|
|
26
|
-
showCaret?: boolean | undefined;
|
|
27
|
-
}
|
|
28
|
-
export default function Dropdown(props: IProps): import("react").JSX.Element;
|