@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
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import MultiSelectDropdown from "../../components/MultiSelect.js";
|
|
2
|
-
import { useFieldLabelledByProps, useFieldRequired } from "../fieldContext.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { useField, useFormikContext } from "formik";
|
|
5
|
-
//#region src/form/SpecialTypes/FormikMultiSelectDropdown.tsx
|
|
6
|
-
function FormikMultiSelectDropdown({ name, options, setFormDirty, onChange, disabled = false, loading = false, invalid = false, placeholder, compareBy }) {
|
|
7
|
-
const [field] = useField(name);
|
|
8
|
-
const required = useFieldRequired();
|
|
9
|
-
const labelledByProps = useFieldLabelledByProps();
|
|
10
|
-
const { setFieldValue, setFieldTouched } = useFormikContext();
|
|
11
|
-
const handleChange = (next) => {
|
|
12
|
-
setFieldValue(name, next);
|
|
13
|
-
setFieldTouched(name, true);
|
|
14
|
-
setFormDirty(true);
|
|
15
|
-
onChange?.(next);
|
|
16
|
-
};
|
|
17
|
-
return /* @__PURE__ */ jsx(MultiSelectDropdown, {
|
|
18
|
-
...labelledByProps,
|
|
19
|
-
textBoxClassName: invalid ? "invalid" : void 0,
|
|
20
|
-
options,
|
|
21
|
-
required,
|
|
22
|
-
value: Array.isArray(field.value) ? field.value : [],
|
|
23
|
-
onChange: handleChange,
|
|
24
|
-
disabled,
|
|
25
|
-
loading,
|
|
26
|
-
placeholder,
|
|
27
|
-
compareBy
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { FormikMultiSelectDropdown as default };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export default function FormikNumericInput({ name, placeholder, onChange, disabled, min, max, invalid, }: {
|
|
2
|
-
name: string;
|
|
3
|
-
placeholder?: string;
|
|
4
|
-
onChange?: (val: number | undefined) => void;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
min?: number | undefined;
|
|
7
|
-
max?: number | undefined;
|
|
8
|
-
invalid?: boolean;
|
|
9
|
-
}): import("react").JSX.Element;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useFieldControlProps, useFieldRequired } from "../fieldContext.js";
|
|
2
|
-
import cx from "classnames";
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { useField, useFormikContext } from "formik";
|
|
6
|
-
import { NumericFormat } from "react-number-format";
|
|
7
|
-
//#region src/form/SpecialTypes/FormikNumericInput.tsx
|
|
8
|
-
var DEBOUNCE_MS = 500;
|
|
9
|
-
function FormikNumericInput({ name, placeholder, onChange, disabled, min, max, invalid = false }) {
|
|
10
|
-
const [field] = useField(name);
|
|
11
|
-
const required = useFieldRequired();
|
|
12
|
-
const controlProps = useFieldControlProps();
|
|
13
|
-
const { setFieldValue, setFieldTouched } = useFormikContext();
|
|
14
|
-
const [localValue, setLocalValue] = useState(field.value);
|
|
15
|
-
const isFocused = useRef(false);
|
|
16
|
-
const debounceRef = useRef(null);
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (!isFocused.current) setLocalValue(field.value);
|
|
19
|
-
}, [field.value]);
|
|
20
|
-
const flush = (val) => {
|
|
21
|
-
onChange?.(val);
|
|
22
|
-
setFieldTouched(name, true);
|
|
23
|
-
setFieldValue(name, val);
|
|
24
|
-
};
|
|
25
|
-
const handleBlur = () => {
|
|
26
|
-
isFocused.current = false;
|
|
27
|
-
clearTimeout(debounceRef.current ?? void 0);
|
|
28
|
-
let val = localValue;
|
|
29
|
-
if (val !== void 0) {
|
|
30
|
-
if (min !== void 0 && val < min) val = min;
|
|
31
|
-
if (max !== void 0 && val > max) val = max;
|
|
32
|
-
}
|
|
33
|
-
setLocalValue(val);
|
|
34
|
-
flush(val);
|
|
35
|
-
};
|
|
36
|
-
return /* @__PURE__ */ jsx(NumericFormat, {
|
|
37
|
-
...controlProps,
|
|
38
|
-
"data-1p-ignore": true,
|
|
39
|
-
className: cx("w-full", disabled && "disabled", invalid && "invalid"),
|
|
40
|
-
name,
|
|
41
|
-
...localValue === void 0 ? {} : { value: localValue },
|
|
42
|
-
"aria-required": required || void 0,
|
|
43
|
-
thousandSeparator: ",",
|
|
44
|
-
decimalScale: 20,
|
|
45
|
-
allowNegative: true,
|
|
46
|
-
disabled,
|
|
47
|
-
placeholder,
|
|
48
|
-
onValueChange: (v) => {
|
|
49
|
-
setLocalValue(v.floatValue);
|
|
50
|
-
clearTimeout(debounceRef.current ?? void 0);
|
|
51
|
-
debounceRef.current = setTimeout(() => flush(v.floatValue), DEBOUNCE_MS);
|
|
52
|
-
},
|
|
53
|
-
onFocus: () => {
|
|
54
|
-
isFocused.current = true;
|
|
55
|
-
},
|
|
56
|
-
onBlur: handleBlur
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
export { FormikNumericInput as default };
|
package/dist/list/HoverCard.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
type HoverCoords = {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
};
|
|
6
|
-
export declare function useHoverCard<T extends HTMLElement>(): {
|
|
7
|
-
triggerRef: import("react").RefObject<T | null>;
|
|
8
|
-
coords: HoverCoords | null;
|
|
9
|
-
scheduleOpen: () => void;
|
|
10
|
-
scheduleClose: () => void;
|
|
11
|
-
keepOpen: () => void;
|
|
12
|
-
};
|
|
13
|
-
export declare function HoverCardSurface({ x, y, widthClassName, padded, relayoutKey, onKeepOpen, onLeave, children, }: {
|
|
14
|
-
x: number;
|
|
15
|
-
y: number;
|
|
16
|
-
widthClassName: string;
|
|
17
|
-
/** Pass false when the card paints its own edge-to-edge header. */
|
|
18
|
-
padded?: boolean;
|
|
19
|
-
relayoutKey?: unknown;
|
|
20
|
-
onKeepOpen: () => void;
|
|
21
|
-
onLeave: () => void;
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
}): import("react").ReactPortal;
|
|
24
|
-
export {};
|
package/dist/list/HoverCard.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import cx from "classnames";
|
|
2
|
-
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { createPortal } from "react-dom";
|
|
5
|
-
//#region src/list/HoverCard.tsx
|
|
6
|
-
function useHoverCard() {
|
|
7
|
-
const triggerRef = useRef(null);
|
|
8
|
-
const [coords, setCoords] = useState(null);
|
|
9
|
-
const openTimer = useRef(void 0);
|
|
10
|
-
const closeTimer = useRef(void 0);
|
|
11
|
-
useEffect(() => () => {
|
|
12
|
-
clearTimeout(openTimer.current);
|
|
13
|
-
clearTimeout(closeTimer.current);
|
|
14
|
-
}, []);
|
|
15
|
-
const scheduleOpen = () => {
|
|
16
|
-
clearTimeout(closeTimer.current);
|
|
17
|
-
openTimer.current = setTimeout(() => {
|
|
18
|
-
const rect = triggerRef.current?.getBoundingClientRect();
|
|
19
|
-
if (rect) setCoords({
|
|
20
|
-
x: rect.left,
|
|
21
|
-
y: rect.bottom
|
|
22
|
-
});
|
|
23
|
-
}, 350);
|
|
24
|
-
};
|
|
25
|
-
const scheduleClose = () => {
|
|
26
|
-
clearTimeout(openTimer.current);
|
|
27
|
-
closeTimer.current = setTimeout(() => setCoords(null), 150);
|
|
28
|
-
};
|
|
29
|
-
const keepOpen = () => clearTimeout(closeTimer.current);
|
|
30
|
-
return {
|
|
31
|
-
triggerRef,
|
|
32
|
-
coords,
|
|
33
|
-
scheduleOpen,
|
|
34
|
-
scheduleClose,
|
|
35
|
-
keepOpen
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function HoverCardSurface({ x, y, widthClassName, padded = true, relayoutKey, onKeepOpen, onLeave, children }) {
|
|
39
|
-
const ref = useRef(null);
|
|
40
|
-
const [pos, setPos] = useState(null);
|
|
41
|
-
useLayoutEffect(() => {
|
|
42
|
-
if (!ref.current) return;
|
|
43
|
-
const { width, height } = ref.current.getBoundingClientRect();
|
|
44
|
-
const pad = 8;
|
|
45
|
-
const left = Math.max(pad, Math.min(x, window.innerWidth - width - pad));
|
|
46
|
-
const top = y + 8 + height + pad > window.innerHeight ? Math.max(pad, y - 8 - height) : y + 8;
|
|
47
|
-
setPos({
|
|
48
|
-
left,
|
|
49
|
-
top
|
|
50
|
-
});
|
|
51
|
-
}, [
|
|
52
|
-
x,
|
|
53
|
-
y,
|
|
54
|
-
relayoutKey
|
|
55
|
-
]);
|
|
56
|
-
return createPortal(/* @__PURE__ */ jsx("div", {
|
|
57
|
-
ref,
|
|
58
|
-
role: "none",
|
|
59
|
-
onMouseEnter: onKeepOpen,
|
|
60
|
-
onMouseLeave: onLeave,
|
|
61
|
-
onFocus: onKeepOpen,
|
|
62
|
-
onBlur: onLeave,
|
|
63
|
-
className: cx("fixed z-[9999] overflow-hidden rounded-xl border border-(--theme-border) bg-(--theme-panel-bg) shadow-xl backdrop-blur-xl", padded && "p-3", widthClassName),
|
|
64
|
-
style: {
|
|
65
|
-
left: pos?.left ?? x,
|
|
66
|
-
top: pos?.top ?? y + 8,
|
|
67
|
-
visibility: pos ? "visible" : "hidden"
|
|
68
|
-
},
|
|
69
|
-
children
|
|
70
|
-
}), document.querySelector(".ds-root") ?? document.body);
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
73
|
-
export { HoverCardSurface, useHoverCard };
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type { ComponentType, MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
2
|
-
export type RowMenuItem = {
|
|
3
|
-
kind: 'link';
|
|
4
|
-
label: string;
|
|
5
|
-
to: string;
|
|
6
|
-
icon?: ReactNode;
|
|
7
|
-
destructive?: boolean | undefined;
|
|
8
|
-
/** Load the page instead of routing, for paths this app doesn't serve. */
|
|
9
|
-
reloadDocument?: boolean | undefined;
|
|
10
|
-
} | {
|
|
11
|
-
kind: 'action';
|
|
12
|
-
label: string;
|
|
13
|
-
onSelect?: (() => void) | undefined;
|
|
14
|
-
icon?: ReactNode;
|
|
15
|
-
destructive?: boolean | undefined;
|
|
16
|
-
disabled?: boolean | undefined;
|
|
17
|
-
/** Shown on hover when the item is disabled, explaining why. */
|
|
18
|
-
tooltip?: string | undefined;
|
|
19
|
-
/** Trailing checkmark, e.g. the active option in a radio-style submenu. */
|
|
20
|
-
selected?: boolean;
|
|
21
|
-
/** Declarative clipboard copy: the menu performs it and notifies, so
|
|
22
|
-
* builders like useCopySubmenu need no toast or clipboard access. */
|
|
23
|
-
copy?: {
|
|
24
|
-
text: string;
|
|
25
|
-
label: string;
|
|
26
|
-
};
|
|
27
|
-
/** More text a menu's search matches, beside the label. */
|
|
28
|
-
keywords?: string;
|
|
29
|
-
} | {
|
|
30
|
-
kind: 'submenu';
|
|
31
|
-
label: string;
|
|
32
|
-
icon?: ReactNode;
|
|
33
|
-
items: RowMenuItem[];
|
|
34
|
-
search?: MenuSearch | undefined;
|
|
35
|
-
} | {
|
|
36
|
-
kind: 'divider';
|
|
37
|
-
};
|
|
38
|
-
/** A field atop a menu that narrows it, submenus included, to the items it matches. */
|
|
39
|
-
export interface MenuSearch {
|
|
40
|
-
placeholder: string;
|
|
41
|
-
/** Shown when nothing matches. */
|
|
42
|
-
empty: string;
|
|
43
|
-
}
|
|
44
|
-
export type OpenMenu = (x: number, y: number, items: RowMenuItem[], onClose?: () => void, search?: MenuSearch) => void;
|
|
45
|
-
/** The shared shape every entity action hook's per-row actions boil down to.
|
|
46
|
-
* Each hook's bespoke `*RowAction` type is structurally assignable to this. */
|
|
47
|
-
export interface RowAction {
|
|
48
|
-
key: string;
|
|
49
|
-
label: string;
|
|
50
|
-
icon: ReactNode;
|
|
51
|
-
onSelect?: (() => void) | undefined;
|
|
52
|
-
to?: string | undefined;
|
|
53
|
-
disabled?: boolean | undefined;
|
|
54
|
-
destructive?: boolean | undefined;
|
|
55
|
-
/** Shown on hover when the action is disabled, explaining why. */
|
|
56
|
-
tooltip?: string | undefined;
|
|
57
|
-
}
|
|
58
|
-
/** Converts a single row action to a menu item: a `to` makes it a link, otherwise an action. */
|
|
59
|
-
export declare function toRowMenuItem(action: RowAction): RowMenuItem;
|
|
60
|
-
/** Bridges a toolbar action (icon component, `onClick`/`href`) onto the shared
|
|
61
|
-
* `RowAction` shape. Typed structurally so any toolbar action shape matching
|
|
62
|
-
* these fields is assignable. */
|
|
63
|
-
export declare function toolbarActionToRowAction(action: {
|
|
64
|
-
key: string;
|
|
65
|
-
label: string;
|
|
66
|
-
icon: ComponentType<{
|
|
67
|
-
className?: string;
|
|
68
|
-
}>;
|
|
69
|
-
onClick?: (() => void) | undefined;
|
|
70
|
-
href?: string | undefined;
|
|
71
|
-
disabled?: boolean | undefined;
|
|
72
|
-
disabledTooltip?: string | undefined;
|
|
73
|
-
}): RowAction;
|
|
74
|
-
/** Assembles a row's context menu in the shared order: leading link(s) → middle
|
|
75
|
-
* actions → extra items → Copy submenu → trailing (destructive) actions last. */
|
|
76
|
-
export declare function assembleRowMenu({ lead, actions, exclude, order, trailing, extra, copy, }: {
|
|
77
|
-
/** Pre-built leading link(s), e.g. "View details". */
|
|
78
|
-
lead?: RowMenuItem[];
|
|
79
|
-
/** The row's full action list. */
|
|
80
|
-
actions: RowAction[];
|
|
81
|
-
/** Keys already rendered in `lead`/`extra`; dropped from the middle. */
|
|
82
|
-
exclude?: string[];
|
|
83
|
-
/** Explicit middle order; keys absent from `actions` are skipped, keys absent from `order` are dropped. */
|
|
84
|
-
order?: string[];
|
|
85
|
-
/** Keys rendered last, in this order (default `['delete']`). */
|
|
86
|
-
trailing?: string[];
|
|
87
|
-
/** Items inserted after the middle actions and before Copy, e.g. a marketplace link. */
|
|
88
|
-
extra?: RowMenuItem[];
|
|
89
|
-
/** The Copy submenu from `useCopySubmenu()`. */
|
|
90
|
-
copy?: RowMenuItem | undefined;
|
|
91
|
-
}): RowMenuItem[];
|
|
92
|
-
export declare function useRowMenu(zClassName?: string): {
|
|
93
|
-
openMenu: OpenMenu;
|
|
94
|
-
contextMenu: import("react").JSX.Element;
|
|
95
|
-
};
|
|
96
|
-
/** The full-screen menu overlay drops CSS :hover on the triggering row; wrap openMenu here to substitute a JS-driven `active` highlight. */
|
|
97
|
-
export declare function useRowMenuActive(openMenu: OpenMenu): {
|
|
98
|
-
active: boolean;
|
|
99
|
-
openMenu: OpenMenu;
|
|
100
|
-
};
|
|
101
|
-
export declare function rowContextMenuProps(openMenu: OpenMenu, items: RowMenuItem[]): {
|
|
102
|
-
onContextMenu: (e: ReactMouseEvent) => void;
|
|
103
|
-
};
|
|
104
|
-
export interface CopyFields {
|
|
105
|
-
name?: string | null | undefined;
|
|
106
|
-
/** Overrides the "name" label (raw, pre-translated) for entities whose primary field isn't a name, e.g. "domain". */
|
|
107
|
-
nameLabel?: string;
|
|
108
|
-
email?: string | null | undefined;
|
|
109
|
-
username?: string | null | undefined;
|
|
110
|
-
uid?: string | number | null | undefined;
|
|
111
|
-
id?: string | null | undefined;
|
|
112
|
-
url?: string | null | undefined;
|
|
113
|
-
extra?: {
|
|
114
|
-
label: string;
|
|
115
|
-
value?: string | null | undefined;
|
|
116
|
-
icon?: ReactNode;
|
|
117
|
-
}[] | undefined;
|
|
118
|
-
}
|
|
119
|
-
export type CopySubmenu = (fields: CopyFields) => RowMenuItem;
|
|
120
|
-
/** Returns a builder for the Copy submenu, labeled from the provider's strings. */
|
|
121
|
-
export declare function useCopySubmenu(): CopySubmenu;
|
|
122
|
-
/** Stays visible while active (menu open) so it doesn't vanish behind the overlay. */
|
|
123
|
-
export declare function MoreButton({ onOpen, active, className, }: {
|
|
124
|
-
onOpen: (x: number, y: number) => void;
|
|
125
|
-
active?: boolean;
|
|
126
|
-
className?: string | undefined;
|
|
127
|
-
}): import("react").JSX.Element;
|