@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.
Files changed (280) hide show
  1. package/README.md +25 -0
  2. package/dist/ai/components/AllocationSelector.d.ts +3 -4
  3. package/dist/ai/components/AllocationSelector.js +37 -33
  4. package/dist/ai/components/AttachmentManager.js +7 -7
  5. package/dist/ai/components/AttachmentUpload.js +5 -5
  6. package/dist/ai/components/BranchNavigator.js +1 -1
  7. package/dist/ai/components/ChatEmptyState.js +2 -2
  8. package/dist/ai/components/ChatInput.js +10 -8
  9. package/dist/ai/components/ChatLayout.js +4 -5
  10. package/dist/ai/components/ChatMessage.js +12 -12
  11. package/dist/ai/components/ChatMessageList.js +9 -9
  12. package/dist/ai/components/ChatSidebar.js +8 -9
  13. package/dist/ai/components/ChatThread.js +4 -4
  14. package/dist/ai/components/ComposerChrome.d.ts +2 -2
  15. package/dist/ai/components/ComposerChrome.js +3 -6
  16. package/dist/ai/components/DragOverlay.js +2 -2
  17. package/dist/ai/components/ModelSelector.d.ts +5 -3
  18. package/dist/ai/components/ModelSelector.js +102 -339
  19. package/dist/ai/components/PastedText.js +11 -11
  20. package/dist/ai/components/ProviderIssueBanner.d.ts +2 -0
  21. package/dist/ai/components/ProviderIssueBanner.js +34 -16
  22. package/dist/ai/components/Reasoning.js +4 -4
  23. package/dist/ai/components/ShareDialog.js +43 -35
  24. package/dist/ai/components/SlashMenu.d.ts +12 -2
  25. package/dist/ai/components/SlashMenu.js +29 -13
  26. package/dist/ai/components/agent/ActivityLine.js +3 -3
  27. package/dist/ai/components/agent/AgentMessageParts.js +20 -20
  28. package/dist/ai/components/agent/PermissionPicker.js +13 -11
  29. package/dist/ai/components/conversationActions.d.ts +4 -6
  30. package/dist/ai/components/conversationActions.js +9 -13
  31. package/dist/ai/core/ChatProvider.js +1 -1
  32. package/dist/ai/core/config.js +1 -1
  33. package/dist/ai/core/providerIssues.d.ts +7 -0
  34. package/dist/ai/core/providerIssues.js +9 -1
  35. package/dist/ai/core/useKeyboardShortcuts.d.ts +4 -0
  36. package/dist/ai/core/useKeyboardShortcuts.js +8 -2
  37. package/dist/ai/index.d.ts +0 -1
  38. package/dist/ai/index.js +1 -2
  39. package/dist/ai/strings.d.ts +19 -0
  40. package/dist/ai/strings.js +18 -1
  41. package/dist/ai/ui/Avatar.js +5 -5
  42. package/dist/ai/ui/ConversationSidebar.d.ts +0 -1
  43. package/dist/ai/ui/ConversationSidebar.js +6 -7
  44. package/dist/ai/ui/Markdown.js +3 -3
  45. package/dist/ai/ui/Notice.js +6 -6
  46. package/dist/ai/ui/chip.d.ts +4 -0
  47. package/dist/ai/ui/chip.js +8 -0
  48. package/dist/ai/ui/sidebar.d.ts +6 -5
  49. package/dist/ai/ui/sidebar.js +39 -43
  50. package/dist/components/ActionMenu.d.ts +13 -0
  51. package/dist/components/ActionMenu.js +30 -0
  52. package/dist/components/Avatar.js +6 -6
  53. package/dist/components/Breadcrumbs.js +1 -1
  54. package/dist/components/Button.js +10 -10
  55. package/dist/components/Callout.js +2 -2
  56. package/dist/components/Card.js +3 -3
  57. package/dist/components/Combobox.d.ts +66 -0
  58. package/dist/components/Combobox.js +393 -0
  59. package/dist/components/ConfirmModal.js +11 -11
  60. package/dist/components/ContextMenu.d.ts +23 -0
  61. package/dist/components/ContextMenu.js +89 -0
  62. package/dist/components/CopyToClipboard.js +2 -2
  63. package/dist/components/CreateModal.d.ts +17 -36
  64. package/dist/components/CreateModal.js +97 -259
  65. package/dist/components/DescriptionList.js +8 -8
  66. package/dist/components/Filter.js +2 -2
  67. package/dist/components/FilterPill.js +2 -2
  68. package/dist/components/HoverCard.d.ts +14 -0
  69. package/dist/components/HoverCard.js +33 -0
  70. package/dist/components/IconButton.d.ts +5 -5
  71. package/dist/components/IconButton.js +18 -22
  72. package/dist/components/InfoTip.d.ts +15 -0
  73. package/dist/components/InfoTip.js +60 -0
  74. package/dist/components/Input.js +5 -5
  75. package/dist/components/LetterBadge.js +2 -2
  76. package/dist/components/Loader.js +3 -3
  77. package/dist/components/Markdown.js +1 -1
  78. package/dist/components/MarkdownImpl.js +2 -2
  79. package/dist/components/Menu.d.ts +33 -0
  80. package/dist/components/Menu.js +86 -0
  81. package/dist/components/MenuEntries.d.ts +56 -0
  82. package/dist/components/MenuEntries.js +123 -0
  83. package/dist/components/Modal.d.ts +29 -0
  84. package/dist/components/Modal.js +47 -0
  85. package/dist/components/Overview.js +11 -10
  86. package/dist/components/PageHeader.d.ts +10 -16
  87. package/dist/components/PageHeader.js +69 -95
  88. package/dist/components/Pagination.js +5 -5
  89. package/dist/components/Provider.d.ts +5 -11
  90. package/dist/components/Provider.js +11 -14
  91. package/dist/components/Radio.d.ts +8 -0
  92. package/dist/components/Radio.js +16 -0
  93. package/dist/components/SectionHeader.js +2 -2
  94. package/dist/components/SegmentedControl.d.ts +6 -5
  95. package/dist/components/SegmentedControl.js +34 -30
  96. package/dist/components/Select.d.ts +27 -0
  97. package/dist/components/Select.js +78 -0
  98. package/dist/components/SettingModeOption.d.ts +5 -8
  99. package/dist/components/SettingModeOption.js +10 -12
  100. package/dist/components/SettingRow.js +4 -4
  101. package/dist/components/SettingsCard.js +4 -4
  102. package/dist/components/SettingsGroup.js +2 -2
  103. package/dist/components/Sort.js +1 -1
  104. package/dist/components/StatusBadge.js +7 -7
  105. package/dist/components/StatusIcons.js +4 -4
  106. package/dist/components/Switch.d.ts +22 -0
  107. package/dist/components/Switch.js +28 -0
  108. package/dist/components/Table.js +11 -11
  109. package/dist/components/Tooltip.d.ts +24 -20
  110. package/dist/components/Tooltip.js +58 -76
  111. package/dist/components/floating.d.ts +14 -0
  112. package/dist/components/floating.js +21 -0
  113. package/dist/components/search.d.ts +2 -0
  114. package/dist/components/search.js +14 -0
  115. package/dist/editor/Editor.js +1 -1
  116. package/dist/editor/EditorField.js +16 -21
  117. package/dist/editor/FormCodePanel.js +19 -19
  118. package/dist/editor/Monaco.js +3 -3
  119. package/dist/file-explorer/FileExplorer.js +77 -81
  120. package/dist/file-explorer/FileExplorerContext.js +2 -2
  121. package/dist/file-explorer/FilePreview/CodePreviewEditor.js +1 -1
  122. package/dist/file-explorer/FilePreview/Inline.js +1 -1
  123. package/dist/file-explorer/FilePreview/StreamedBadge.js +5 -6
  124. package/dist/file-explorer/FilePreview/Viewer.js +8 -8
  125. package/dist/file-explorer/FilePreview/index.d.ts +1 -1
  126. package/dist/file-explorer/FilePreview/index.js +49 -83
  127. package/dist/file-explorer/FileRow.d.ts +4 -3
  128. package/dist/file-explorer/FileRow.js +32 -38
  129. package/dist/file-explorer/FileRowsWindow.d.ts +3 -2
  130. package/dist/file-explorer/FileRowsWindow.js +4 -4
  131. package/dist/file-explorer/FileTable.d.ts +3 -2
  132. package/dist/file-explorer/FileTable.js +3 -3
  133. package/dist/file-explorer/LoadMoreRow.js +1 -1
  134. package/dist/file-explorer/TreeView.js +11 -16
  135. package/dist/file-explorer/helpers.js +11 -12
  136. package/dist/file-explorer/toasts.js +11 -11
  137. package/dist/form/FieldGroup.d.ts +11 -0
  138. package/dist/form/FieldGroup.js +36 -0
  139. package/dist/form/FieldWrapper.js +4 -4
  140. package/dist/form/Fields/BooleanField.js +23 -33
  141. package/dist/form/Fields/CheckboxGroupField.d.ts +1 -1
  142. package/dist/form/Fields/CheckboxGroupField.js +9 -13
  143. package/dist/form/Fields/ColorField.d.ts +1 -2
  144. package/dist/form/Fields/ColorField.js +6 -11
  145. package/dist/form/Fields/DropdownField.d.ts +3 -13
  146. package/dist/form/Fields/DropdownField.js +40 -27
  147. package/dist/form/Fields/DurationField.d.ts +1 -2
  148. package/dist/form/Fields/DurationField.js +25 -32
  149. package/dist/form/Fields/LabelField.js +2 -2
  150. package/dist/form/Fields/MultiDropdownField.d.ts +6 -12
  151. package/dist/form/Fields/MultiDropdownField.js +31 -22
  152. package/dist/form/Fields/NumberField.d.ts +1 -1
  153. package/dist/form/Fields/NumberField.js +65 -35
  154. package/dist/form/Fields/ObjectField.d.ts +1 -1
  155. package/dist/form/Fields/ObjectField.js +12 -43
  156. package/dist/form/Fields/RadioField.d.ts +1 -1
  157. package/dist/form/Fields/RadioField.js +30 -41
  158. package/dist/form/Fields/RangeField.d.ts +1 -2
  159. package/dist/form/Fields/RangeField.js +23 -16
  160. package/dist/form/Fields/StringField.d.ts +1 -2
  161. package/dist/form/Fields/StringField.js +58 -26
  162. package/dist/form/Fields/TextAreaField.js +12 -10
  163. package/dist/form/Form.d.ts +30 -48
  164. package/dist/form/Form.js +306 -412
  165. package/dist/form/FormLayout.js +9 -9
  166. package/dist/form/Wizard/WizardContainer.d.ts +1 -4
  167. package/dist/form/Wizard/WizardContainer.js +40 -56
  168. package/dist/form/Wizard/WizardNavigation.js +1 -1
  169. package/dist/form/Wizard/WizardStepContent.d.ts +1 -5
  170. package/dist/form/Wizard/WizardStepContent.js +11 -16
  171. package/dist/form/Wizard/WizardStepIndicator.js +6 -6
  172. package/dist/form/Wizard/types.d.ts +0 -14
  173. package/dist/form/fieldRegistry.d.ts +1 -1
  174. package/dist/form/fieldRegistry.js +6 -6
  175. package/dist/form/formEditing.js +1 -1
  176. package/dist/form/index.d.ts +5 -4
  177. package/dist/form/index.js +6 -7
  178. package/dist/form/types/fieldComponentTypes.d.ts +8 -10
  179. package/dist/form/useChoiceField.d.ts +20 -0
  180. package/dist/form/useChoiceField.js +49 -0
  181. package/dist/form/useFieldValue.d.ts +7 -0
  182. package/dist/form/useFieldValue.js +20 -0
  183. package/dist/form/useParsedOpts.d.ts +3 -1
  184. package/dist/form/useParsedOpts.js +12 -17
  185. package/dist/form/utils/dependentOptions.d.ts +8 -4
  186. package/dist/form/utils/dependentOptions.js +25 -17
  187. package/dist/form/utils/fieldItems.d.ts +10 -0
  188. package/dist/form/utils/fieldItems.js +11 -0
  189. package/dist/form/utils/fieldPath.d.ts +10 -0
  190. package/dist/form/utils/fieldPath.js +20 -0
  191. package/dist/form/utils/shareEqual.d.ts +6 -0
  192. package/dist/form/utils/shareEqual.js +38 -0
  193. package/dist/graph/AnnotationBanner.js +8 -8
  194. package/dist/graph/Collapse.d.ts +1 -0
  195. package/dist/graph/Collapse.js +6 -27
  196. package/dist/graph/Connectors.js +5 -5
  197. package/dist/graph/DependencyGraph.js +20 -19
  198. package/dist/graph/GraphEditor.js +30 -41
  199. package/dist/graph/GraphEditorDialogs.js +17 -17
  200. package/dist/graph/GraphNode.js +1 -1
  201. package/dist/graph/InputDialog.js +19 -22
  202. package/dist/graph/InputsEditor.js +58 -66
  203. package/dist/graph/JobSummary.js +42 -39
  204. package/dist/graph/MatrixGroup.js +1 -1
  205. package/dist/graph/ProblemsButton.js +18 -19
  206. package/dist/graph/Reveal.js +1 -1
  207. package/dist/graph/ShortcutsButton.js +15 -18
  208. package/dist/graph/SuggestionInput.d.ts +5 -10
  209. package/dist/graph/SuggestionInput.js +14 -18
  210. package/dist/graph/ToolbarPopover.d.ts +11 -6
  211. package/dist/graph/ToolbarPopover.js +35 -67
  212. package/dist/graph/TreeView.js +24 -37
  213. package/dist/graph/WorkflowSettingsDialog.js +4 -4
  214. package/dist/graph/editorChrome.js +13 -12
  215. package/dist/graph/editorFields.js +29 -29
  216. package/dist/graph/editorPrimitives.d.ts +1 -1
  217. package/dist/graph/editorPrimitives.js +10 -7
  218. package/dist/graph/editorRows.js +103 -97
  219. package/dist/graph/fieldProblems.js +2 -2
  220. package/dist/graph/graphEditorState.d.ts +4 -3
  221. package/dist/graph/inputRefs.js +9 -9
  222. package/dist/graph/settingsViews.js +6 -7
  223. package/dist/graph/stepWith.js +6 -6
  224. package/dist/index.d.ts +14 -15
  225. package/dist/index.js +15 -14
  226. package/dist/list/ActionToolbar.d.ts +6 -14
  227. package/dist/list/ActionToolbar.js +48 -96
  228. package/dist/list/ListPage.d.ts +6 -12
  229. package/dist/list/ListPage.js +46 -29
  230. package/dist/list/ListPager.js +4 -4
  231. package/dist/list/ListTable.js +5 -5
  232. package/dist/list/ListViewControls.d.ts +5 -4
  233. package/dist/list/ListViewControls.js +177 -267
  234. package/dist/list/UserHoverCard.d.ts +3 -17
  235. package/dist/list/UserHoverCard.js +21 -45
  236. package/dist/list/index.d.ts +3 -4
  237. package/dist/list/index.js +3 -4
  238. package/dist/list/listSearch.js +12 -11
  239. package/dist/list/rowMenu.d.ts +63 -0
  240. package/dist/list/rowMenu.js +134 -0
  241. package/dist/logviewer/LogViewer.js +26 -26
  242. package/dist/styles.css +1 -1
  243. package/package.json +7 -13
  244. package/dist/ai/ui/Dropdown.d.ts +0 -31
  245. package/dist/ai/ui/Dropdown.js +0 -110
  246. package/dist/components/AddMenu.d.ts +0 -18
  247. package/dist/components/AddMenu.js +0 -46
  248. package/dist/components/BareModal.d.ts +0 -17
  249. package/dist/components/BareModal.js +0 -77
  250. package/dist/components/CollapsiblePanel.d.ts +0 -27
  251. package/dist/components/CollapsiblePanel.js +0 -77
  252. package/dist/components/Dropdown.d.ts +0 -28
  253. package/dist/components/Dropdown.js +0 -355
  254. package/dist/components/Listbox.d.ts +0 -21
  255. package/dist/components/Listbox.js +0 -119
  256. package/dist/components/MultiSelect.d.ts +0 -22
  257. package/dist/components/MultiSelect.js +0 -168
  258. package/dist/components/SwitchToggle.d.ts +0 -15
  259. package/dist/components/SwitchToggle.js +0 -57
  260. package/dist/components/SwitchToggleSmall.d.ts +0 -6
  261. package/dist/components/SwitchToggleSmall.js +0 -14
  262. package/dist/components/Toggle.d.ts +0 -6
  263. package/dist/components/Toggle.js +0 -20
  264. package/dist/components/dropdownUtils.d.ts +0 -37
  265. package/dist/components/dropdownUtils.js +0 -99
  266. package/dist/form/SpecialTypes/DropdownWrapper.d.ts +0 -25
  267. package/dist/form/SpecialTypes/DropdownWrapper.js +0 -28
  268. package/dist/form/SpecialTypes/FormikCustomDropdown.d.ts +0 -51
  269. package/dist/form/SpecialTypes/FormikCustomDropdown.js +0 -119
  270. package/dist/form/SpecialTypes/FormikCustomInput.d.ts +0 -19
  271. package/dist/form/SpecialTypes/FormikCustomInput.js +0 -121
  272. package/dist/form/SpecialTypes/FormikMultiSelectDropdown.d.ts +0 -13
  273. package/dist/form/SpecialTypes/FormikMultiSelectDropdown.js +0 -31
  274. package/dist/form/SpecialTypes/FormikNumericInput.d.ts +0 -9
  275. package/dist/form/SpecialTypes/FormikNumericInput.js +0 -60
  276. package/dist/form/SpecialTypes/index.d.ts +0 -3
  277. package/dist/list/HoverCard.d.ts +0 -24
  278. package/dist/list/HoverCard.js +0 -73
  279. package/dist/list/RowContextMenu.d.ts +0 -127
  280. 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 };
@@ -1,3 +0,0 @@
1
- export { default as FormikCustomDropdown } from './FormikCustomDropdown.js';
2
- export { default as FormikCustomInput } from './FormikCustomInput.js';
3
- export { default as FormikNumericInput } from './FormikNumericInput.js';
@@ -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 {};
@@ -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;