@parallelworks/ui 0.76.0 → 0.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/README.md +30 -5
  2. package/dist/access/AccessDrawer.d.ts +28 -7
  3. package/dist/access/AccessDrawer.js +216 -35
  4. package/dist/access/AccessList.d.ts +19 -1
  5. package/dist/access/AccessList.js +220 -9
  6. package/dist/access/GrantView.d.ts +3 -1
  7. package/dist/access/GrantView.js +17 -4
  8. package/dist/access/PrincipalPicker.js +5 -5
  9. package/dist/access/focus.js +1 -1
  10. package/dist/access/index.d.ts +2 -2
  11. package/dist/access/index.js +2 -2
  12. package/dist/access/strings.d.ts +18 -0
  13. package/dist/access/strings.js +20 -2
  14. package/dist/access/types.d.ts +26 -0
  15. package/dist/ai/adapter/types.d.ts +1 -0
  16. package/dist/ai/components/AllocationSelector.js +1 -1
  17. package/dist/ai/components/AttachmentManager.js +5 -5
  18. package/dist/ai/components/AttachmentUpload.js +2 -2
  19. package/dist/ai/components/BranchNavigator.js +1 -1
  20. package/dist/ai/components/ChatActivity.d.ts +2 -0
  21. package/dist/ai/components/ChatActivity.js +31 -0
  22. package/dist/ai/components/ChatEmptyState.js +3 -3
  23. package/dist/ai/components/ChatInput.js +3 -5
  24. package/dist/ai/components/ChatLayout.js +1 -1
  25. package/dist/ai/components/ChatMessage.js +1 -1
  26. package/dist/ai/components/ChatMessageList.js +2 -2
  27. package/dist/ai/components/ChatSidebar.js +3 -3
  28. package/dist/ai/components/ChatThread.js +4 -4
  29. package/dist/ai/components/ComposerAddMenu.js +9 -20
  30. package/dist/ai/components/ModelSelector.js +3 -3
  31. package/dist/ai/components/PastedText.js +5 -5
  32. package/dist/ai/components/SessionView.js +5 -2
  33. package/dist/ai/components/ShareDialog.js +3 -3
  34. package/dist/ai/components/SlashMenu.d.ts +31 -4
  35. package/dist/ai/components/SlashMenu.js +36 -63
  36. package/dist/ai/components/agent/ActivityLine.js +1 -1
  37. package/dist/ai/components/agent/AgentMessageParts.d.ts +1 -1
  38. package/dist/ai/components/agent/AgentMessageParts.js +44 -18
  39. package/dist/ai/components/conversationActions.js +3 -3
  40. package/dist/ai/core/ChatProvider.js +11 -2
  41. package/dist/ai/core/config.d.ts +10 -1
  42. package/dist/ai/core/config.js +1 -1
  43. package/dist/ai/index.d.ts +1 -1
  44. package/dist/ai/strings.d.ts +2 -0
  45. package/dist/ai/strings.js +2 -1
  46. package/dist/ai/types.d.ts +3 -0
  47. package/dist/ai/ui/ConversationSidebar.js +3 -3
  48. package/dist/ai/ui/sidebar.js +3 -3
  49. package/dist/assets/yaml.worker-DOBV2lND.js +884 -0
  50. package/dist/components/ActionMenu.d.ts +38 -9
  51. package/dist/components/ActionMenu.js +48 -22
  52. package/dist/components/Avatar.d.ts +66 -6
  53. package/dist/components/Avatar.js +130 -18
  54. package/dist/components/Breadcrumbs.d.ts +4 -0
  55. package/dist/components/Breadcrumbs.js +26 -10
  56. package/dist/components/Button.d.ts +3 -2
  57. package/dist/components/Button.js +11 -1
  58. package/dist/components/Callout.d.ts +3 -2
  59. package/dist/components/Callout.js +3 -2
  60. package/dist/components/Card.d.ts +33 -9
  61. package/dist/components/Card.js +24 -8
  62. package/dist/components/Checkbox.d.ts +3 -1
  63. package/dist/components/Checkbox.js +4 -2
  64. package/dist/components/ColorInput.js +1 -1
  65. package/dist/components/Combobox.d.ts +23 -0
  66. package/dist/components/Combobox.js +252 -86
  67. package/dist/components/ConfirmModal.d.ts +26 -2
  68. package/dist/components/ConfirmModal.js +81 -15
  69. package/dist/components/ContextMenu.d.ts +29 -2
  70. package/dist/components/ContextMenu.js +60 -8
  71. package/dist/components/CopyButton.d.ts +21 -8
  72. package/dist/components/CopyButton.js +29 -9
  73. package/dist/components/CreateModal.d.ts +16 -4
  74. package/dist/components/CreateModal.js +27 -16
  75. package/dist/components/DatePicker.d.ts +31 -1
  76. package/dist/components/DatePicker.js +178 -47
  77. package/dist/components/DescriptionList.d.ts +13 -3
  78. package/dist/components/DescriptionList.js +43 -11
  79. package/dist/components/Disclosure.d.ts +10 -2
  80. package/dist/components/Disclosure.js +18 -7
  81. package/dist/components/Drawer.js +5 -5
  82. package/dist/components/EmptyState.d.ts +12 -4
  83. package/dist/components/EmptyState.js +18 -10
  84. package/dist/components/ErrorPage.d.ts +40 -0
  85. package/dist/components/ErrorPage.js +101 -0
  86. package/dist/components/ExternalLink.d.ts +4 -1
  87. package/dist/components/ExternalLink.js +4 -5
  88. package/dist/components/Field.d.ts +21 -6
  89. package/dist/components/Field.js +32 -16
  90. package/dist/components/FileButton.d.ts +19 -0
  91. package/dist/components/FileButton.js +32 -0
  92. package/dist/components/HoverCard.d.ts +26 -6
  93. package/dist/components/HoverCard.js +11 -5
  94. package/dist/components/IconButton.js +4 -2
  95. package/dist/components/InfoTip.js +3 -3
  96. package/dist/components/Input.d.ts +33 -3
  97. package/dist/components/Input.js +149 -14
  98. package/dist/components/Kbd.d.ts +40 -0
  99. package/dist/components/Kbd.js +168 -0
  100. package/dist/components/Listbox.d.ts +103 -0
  101. package/dist/components/Listbox.js +190 -0
  102. package/dist/components/Loader.d.ts +8 -2
  103. package/dist/components/Loader.js +16 -1
  104. package/dist/components/Markdown.js +1 -1
  105. package/dist/components/MarkdownImpl.js +1 -1
  106. package/dist/components/Menu.d.ts +20 -2
  107. package/dist/components/Menu.js +48 -19
  108. package/dist/components/MenuEntries.d.ts +38 -2
  109. package/dist/components/MenuEntries.js +266 -39
  110. package/dist/components/Meter.d.ts +50 -11
  111. package/dist/components/Meter.js +71 -21
  112. package/dist/components/Modal.d.ts +9 -3
  113. package/dist/components/Modal.js +68 -29
  114. package/dist/components/OneTimeCodeInput.js +1 -1
  115. package/dist/components/PageHeader.js +111 -7
  116. package/dist/components/PageHeaderAction.d.ts +8 -3
  117. package/dist/components/PageHeaderAction.js +122 -34
  118. package/dist/components/Pagination.d.ts +13 -1
  119. package/dist/components/Pagination.js +90 -19
  120. package/dist/components/Popover.d.ts +13 -2
  121. package/dist/components/Popover.js +20 -21
  122. package/dist/components/Provider.d.ts +140 -3
  123. package/dist/components/Provider.js +142 -12
  124. package/dist/components/RefreshButton.d.ts +13 -6
  125. package/dist/components/RefreshButton.js +17 -9
  126. package/dist/components/RunStatusIcon.d.ts +16 -7
  127. package/dist/components/RunStatusIcon.js +21 -8
  128. package/dist/components/Section.d.ts +11 -4
  129. package/dist/components/Section.js +33 -22
  130. package/dist/components/SegmentedControl.d.ts +16 -3
  131. package/dist/components/SegmentedControl.js +7 -3
  132. package/dist/components/Select.d.ts +19 -3
  133. package/dist/components/Select.js +114 -68
  134. package/dist/components/SelectionCopy.d.ts +10 -0
  135. package/dist/components/SelectionCopy.js +105 -0
  136. package/dist/components/SettingModeOption.js +1 -1
  137. package/dist/components/SettingsCard.js +1 -1
  138. package/dist/components/Skeleton.js +1 -1
  139. package/dist/components/StatusBadge.d.ts +55 -10
  140. package/dist/components/StatusBadge.js +91 -15
  141. package/dist/components/StickyBar.js +1 -1
  142. package/dist/components/Table.d.ts +22 -4
  143. package/dist/components/Table.js +46 -24
  144. package/dist/components/Tabs.d.ts +9 -4
  145. package/dist/components/Tabs.js +9 -4
  146. package/dist/components/Tag.d.ts +49 -0
  147. package/dist/components/Tag.js +199 -0
  148. package/dist/components/ThemeEditor.js +1 -1
  149. package/dist/components/Toast.js +1 -1
  150. package/dist/components/ToggleGroup.d.ts +4 -1
  151. package/dist/components/ToggleGroup.js +30 -13
  152. package/dist/components/Tooltip.d.ts +9 -3
  153. package/dist/components/Tooltip.js +55 -39
  154. package/dist/components/buttonClasses.d.ts +5 -2
  155. package/dist/components/buttonClasses.js +11 -10
  156. package/dist/components/chart.d.ts +69 -0
  157. package/dist/components/chart.js +145 -0
  158. package/dist/components/comboboxItems.d.ts +7 -1
  159. package/dist/components/comboboxItems.js +6 -2
  160. package/dist/components/dismiss.d.ts +5 -1
  161. package/dist/components/dismiss.js +6 -2
  162. package/dist/components/floating.d.ts +4 -4
  163. package/dist/components/floating.js +5 -5
  164. package/dist/components/headerActionsFit.d.ts +37 -0
  165. package/dist/components/headerActionsFit.js +81 -0
  166. package/dist/components/pageHeaderStore.d.ts +3 -0
  167. package/dist/components/pageHeaderStore.js +3 -0
  168. package/dist/components/pathBreaks.js +2 -2
  169. package/dist/components/popupContainer.d.ts +17 -0
  170. package/dist/components/popupContainer.js +69 -0
  171. package/dist/components/relativeTime.d.ts +21 -10
  172. package/dist/components/relativeTime.js +50 -22
  173. package/dist/components/segmented.d.ts +18 -4
  174. package/dist/components/segmented.js +48 -6
  175. package/dist/components/typedDate.d.ts +5 -0
  176. package/dist/components/typedDate.js +50 -0
  177. package/dist/components/useClosingValue.d.ts +4 -0
  178. package/dist/components/useClosingValue.js +12 -0
  179. package/dist/components/useCopy.d.ts +6 -0
  180. package/dist/components/useCopy.js +3 -3
  181. package/dist/components/useNarrow.d.ts +2 -0
  182. package/dist/components/useNarrow.js +16 -0
  183. package/dist/editor/Editor.js +1 -1
  184. package/dist/editor/FormCodePanel.js +1 -1
  185. package/dist/editor/Monaco.js +1 -1
  186. package/dist/editor/workers.js +1 -1
  187. package/dist/file-explorer/FileExplorer.js +16 -15
  188. package/dist/file-explorer/FileExplorerContext.js +2 -2
  189. package/dist/file-explorer/FilePreview/Viewer.js +3 -3
  190. package/dist/file-explorer/FilePreview/index.js +2 -2
  191. package/dist/file-explorer/FileRowsWindow.js +3 -3
  192. package/dist/file-explorer/FileTable.js +1 -1
  193. package/dist/file-explorer/LoadMoreRow.js +1 -1
  194. package/dist/file-explorer/TreeView.js +5 -5
  195. package/dist/file-explorer/helpers.js +2 -2
  196. package/dist/file-explorer/toasts.js +2 -2
  197. package/dist/form/Fields/CheckboxGroupField.js +1 -1
  198. package/dist/form/Fields/DropdownField.js +1 -1
  199. package/dist/form/Fields/DurationField.js +2 -2
  200. package/dist/form/Fields/MultiDropdownField.js +1 -1
  201. package/dist/form/Fields/NumberField.js +1 -1
  202. package/dist/form/Fields/ObjectField.js +1 -1
  203. package/dist/form/Fields/RangeField.js +1 -1
  204. package/dist/form/Fields/StringField.js +1 -1
  205. package/dist/form/Form.js +3 -3
  206. package/dist/form/FormLayout.js +1 -1
  207. package/dist/form/Wizard/WizardContainer.js +1 -1
  208. package/dist/form/Wizard/WizardNavigation.js +1 -1
  209. package/dist/form/Wizard/WizardStepContent.js +1 -1
  210. package/dist/form/fieldRegistry.js +1 -1
  211. package/dist/form/formEditing.js +1 -1
  212. package/dist/format.d.ts +17 -7
  213. package/dist/format.js +39 -16
  214. package/dist/graph/AnnotationBanner.js +2 -2
  215. package/dist/graph/Connectors.js +5 -5
  216. package/dist/graph/DependencyGraph.js +10 -9
  217. package/dist/graph/GraphEditor.js +4 -4
  218. package/dist/graph/GraphEditorDialogs.js +13 -12
  219. package/dist/graph/GraphNode.js +1 -1
  220. package/dist/graph/InputDialog.js +5 -5
  221. package/dist/graph/InputsEditor.js +7 -7
  222. package/dist/graph/MatrixGroup.js +2 -2
  223. package/dist/graph/ProblemsButton.js +3 -3
  224. package/dist/graph/Reveal.js +1 -1
  225. package/dist/graph/RunWarningsList.js +1 -1
  226. package/dist/graph/ShortcutsButton.js +25 -8
  227. package/dist/graph/StepSummaries.js +1 -1
  228. package/dist/graph/TreeView.js +2 -2
  229. package/dist/graph/WorkflowSettingsDialog.js +3 -3
  230. package/dist/graph/editorFields.js +3 -3
  231. package/dist/graph/editorPrimitives.js +1 -1
  232. package/dist/graph/editorRows.js +5 -5
  233. package/dist/graph/fieldProblems.js +2 -2
  234. package/dist/graph/inputRefs.js +7 -6
  235. package/dist/graph/stepWith.js +2 -2
  236. package/dist/index.d.ts +30 -21
  237. package/dist/index.js +20 -12
  238. package/dist/list/ActionToolbar.d.ts +4 -0
  239. package/dist/list/ActionToolbar.js +35 -12
  240. package/dist/list/ListFilterBar.d.ts +42 -0
  241. package/dist/list/ListFilterBar.js +789 -0
  242. package/dist/list/ListPage.d.ts +42 -4
  243. package/dist/list/ListPage.js +56 -22
  244. package/dist/list/ListTable.d.ts +27 -3
  245. package/dist/list/ListTable.js +48 -23
  246. package/dist/list/ListToolbar.d.ts +31 -0
  247. package/dist/list/ListToolbar.js +43 -0
  248. package/dist/list/ListViewControls.d.ts +8 -4
  249. package/dist/list/ListViewControls.js +22 -14
  250. package/dist/list/UserHoverCard.d.ts +8 -2
  251. package/dist/list/UserHoverCard.js +26 -13
  252. package/dist/list/filterModel.d.ts +122 -0
  253. package/dist/list/filterModel.js +308 -0
  254. package/dist/list/index.d.ts +6 -2
  255. package/dist/list/index.js +6 -2
  256. package/dist/list/listSearch.d.ts +1 -1
  257. package/dist/list/listSearch.js +8 -4
  258. package/dist/list/listView.d.ts +24 -2
  259. package/dist/list/listView.js +47 -45
  260. package/dist/list/rowMenu.d.ts +10 -5
  261. package/dist/list/rowMenu.js +17 -7
  262. package/dist/list/useListFilters.d.ts +68 -0
  263. package/dist/list/useListFilters.js +252 -0
  264. package/dist/logviewer/LogViewer.js +4 -4
  265. package/dist/styles/theme.css +94 -0
  266. package/dist/styles.css +1 -1
  267. package/package.json +11 -11
  268. package/dist/assets/yaml.worker-k9AdOqzf.js +0 -1441
  269. package/dist/components/fullscreen.d.ts +0 -4
  270. package/dist/components/fullscreen.js +0 -18
@@ -1,5 +1,6 @@
1
1
  export interface LoaderProps {
2
- /** The spinner's size, in pixels or any CSS length. */
2
+ /** The spinner's size, in pixels or any CSS length: 48 by default, and 40
3
+ * when it fills a page or a section. */
3
4
  size?: number | string;
4
5
  /** Shown under the spinner, and its accessible name. Without one, the
5
6
  * loader is named with the provider's `loading` string. */
@@ -12,7 +13,12 @@ export interface LoaderProps {
12
13
  /** Beside text that already says what is happening, such as a busy button's
13
14
  * label: hidden from assistive technology, and in the text's color. */
14
15
  decorative?: boolean;
16
+ /** Centers it in the room it stands for, so the page needs no box of its
17
+ * own: `screen` the whole window, such as while the app starts; `page` the
18
+ * page's scrolling region, such as while a route loads; `section` a pane
19
+ * or a card with no height of its own. */
20
+ fill?: 'screen' | 'page' | 'section' | undefined;
15
21
  }
16
22
  /** Something on the way that has no shape to sketch yet. When its shape is
17
23
  * known, such as rows of a list, sketch it with `Skeleton` instead. */
18
- export declare function Loader({ size, label, variant, inline, color, decorative, }: LoaderProps): import("react").JSX.Element;
24
+ export declare function Loader({ fill, ...props }: LoaderProps): import("react").JSX.Element;
@@ -10,9 +10,24 @@ var LOGO_RINGS = [
10
10
  "M9.25,52.35V32.14A22.9,22.9,0,1,1,32.14,55H24.89",
11
11
  "M62.68,32.14A30.54,30.54,0,1,1,1.6,32.14,30.54,30.54,0,1,1,62.68,32.14"
12
12
  ];
13
+ var fillClasses = {
14
+ screen: "flex min-h-dvh w-full items-center justify-center",
15
+ page: "flex h-dvh max-h-full w-full items-center justify-center",
16
+ section: "flex w-full items-center justify-center py-16"
17
+ };
13
18
  /** Something on the way that has no shape to sketch yet. When its shape is
14
19
  * known, such as rows of a list, sketch it with `Skeleton` instead. */
15
- function Loader({ size = 48, label, variant = "spinner", inline = false, color, decorative = false }) {
20
+ function Loader({ fill, ...props }) {
21
+ if (!fill) return /* @__PURE__ */ jsx(LoaderMark, { ...props });
22
+ return /* @__PURE__ */ jsx("div", {
23
+ className: fillClasses[fill],
24
+ children: /* @__PURE__ */ jsx(LoaderMark, {
25
+ ...props,
26
+ size: props.size ?? (fill === "screen" ? 48 : 40)
27
+ })
28
+ });
29
+ }
30
+ function LoaderMark({ size = 48, label, variant = "spinner", inline = false, color, decorative = false }) {
16
31
  const { loading } = useStrings().common;
17
32
  const dimension = typeof size === "number" ? `${size}px` : size;
18
33
  const spinner = /* @__PURE__ */ jsx(RunningIcon, {
@@ -1,6 +1,6 @@
1
1
  import { cx } from "../cx.js";
2
- import { jsx } from "react/jsx-runtime";
3
2
  import { Suspense, lazy } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
4
  //#region src/components/Markdown.tsx
5
5
  var MarkdownImpl = lazy(() => import("./MarkdownImpl.js"));
6
6
  /** Markdown, with highlighted code, math and mermaid diagrams. Links leave in a
@@ -4,8 +4,8 @@ import { readIsDark } from "./useCssIsDark.js";
4
4
  import { CODE_THEMES } from "./codeTheme.js";
5
5
  import { rehypeHttpsImagesOnly } from "./httpsImages.js";
6
6
  import { rehypeCodeBreaks } from "./markdownCodeBreaks.js";
7
- import { jsx } from "react/jsx-runtime";
8
7
  import { useEffect, useState } from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
9
  import { code } from "@streamdown/code";
10
10
  import { math } from "@streamdown/math";
11
11
  import "katex/dist/katex.min.css";
@@ -1,10 +1,13 @@
1
1
  import { Menu as BaseMenu } from '@base-ui/react/menu';
2
- import type { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  type Styled<Props> = Omit<Props, 'className'> & {
4
4
  className?: string | undefined;
5
5
  };
6
+ /** A menu's rows: `md` is the standard 14px row, `sm` a 12px one for a compact toolbar. */
7
+ export type MenuSize = 'md' | 'sm';
6
8
  export interface MenuPopupProps {
7
9
  children: ReactNode;
10
+ /** On this popup alone, such as a wider floor: `min-w-64`. */
8
11
  className?: string | undefined;
9
12
  side?: BaseMenu.Positioner.Props['side'];
10
13
  align?: BaseMenu.Positioner.Props['align'];
@@ -12,9 +15,24 @@ export interface MenuPopupProps {
12
15
  anchor?: BaseMenu.Positioner.Props['anchor'];
13
16
  /** Keeps the popup's children mounted while closed, so state they own survives. */
14
17
  keepMounted?: boolean;
18
+ /** The rows' size; a submenu takes its parent's. */
19
+ size?: MenuSize | undefined;
20
+ /** Classes on this popup and every submenu it opens, such as token overrides that give a
21
+ * terminal's menus its own colors: `[--theme-app-bg:#111827] [--theme-app:#f9fafb]`. */
22
+ themeClassName?: string | undefined;
23
+ /** At least as wide as the element it opens from. */
24
+ matchAnchorWidth?: boolean | undefined;
25
+ /** Names the menu, where its trigger's text doesn't. */
26
+ label?: string | undefined;
27
+ /** Lines above the rows that aren't choices, such as who is signed in. They stay in view
28
+ * as the rows scroll, ruled off from them. */
29
+ header?: ReactNode;
30
+ /** Rows under the scrolling ones, ruled off from them and always in view, such as "See all".
31
+ * The arrow keys reach them last. */
32
+ footer?: ReactNode;
15
33
  }
16
34
  /** The portal, positioner and popup every menu needs. */
17
- export declare function MenuPopup({ children, className, side, align, anchor, keepMounted, }: MenuPopupProps): import("react").JSX.Element;
35
+ export declare function MenuPopup({ children, className, side, align, anchor, keepMounted, size, themeClassName, matchAnchorWidth, label, header, footer, }: MenuPopupProps): import("react").JSX.Element;
18
36
  export declare function MenuItem({ className, ...props }: Styled<BaseMenu.Item.Props>): import("react").JSX.Element;
19
37
  /** A navigation row; give it `render` for a router link. Closes the menu like any item. */
20
38
  export declare function MenuLinkItem({ className, ...props }: Styled<BaseMenu.LinkItem.Props>): import("react").JSX.Element;
@@ -1,26 +1,55 @@
1
1
  import { cx } from "../cx.js";
2
2
  import { CheckIcon, ChevronRightIcon } from "../icons.js";
3
3
  import { panelClassName, panelItemClassName, positionerClassName } from "./floating.js";
4
- import { useFullscreenContainer } from "./fullscreen.js";
4
+ import { usePopupContainer } from "./popupContainer.js";
5
5
  import { Menu } from "@base-ui/react/menu";
6
- import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { createContext, use } from "react";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
8
  //#region src/components/Menu.tsx
8
- var itemClassName = panelItemClassName;
9
+ var itemClassName = cx(panelItemClassName, "in-data-[size=sm]:gap-1.5 in-data-[size=sm]:px-1.5 in-data-[size=sm]:py-1");
10
+ var MenuLookContext = createContext({
11
+ size: "md",
12
+ themeClassName: void 0
13
+ });
9
14
  /** The portal, positioner and popup every menu needs. */
10
- function MenuPopup({ children, className, side = "bottom", align = "start", anchor, keepMounted = false }) {
11
- const fullscreen = useFullscreenContainer();
12
- return /* @__PURE__ */ jsx(Menu.Portal, {
13
- container: fullscreen,
14
- keepMounted,
15
- children: /* @__PURE__ */ jsx(Menu.Positioner, {
16
- side,
17
- align,
18
- anchor,
19
- sideOffset: 4,
20
- className: positionerClassName,
21
- children: /* @__PURE__ */ jsx(Menu.Popup, {
22
- className: cx("min-w-44 max-h-(--available-height) overflow-y-auto", "p-1", panelClassName, className),
23
- children
15
+ function MenuPopup({ children, className, side = "bottom", align = "start", anchor, keepMounted = false, size, themeClassName, matchAnchorWidth = false, label, header, footer }) {
16
+ const portal = usePopupContainer();
17
+ const inherited = use(MenuLookContext);
18
+ const look = {
19
+ size: size ?? inherited.size,
20
+ themeClassName: themeClassName ?? inherited.themeClassName
21
+ };
22
+ const pinned = header !== void 0 || footer !== void 0;
23
+ return /* @__PURE__ */ jsx(MenuLookContext, {
24
+ value: look,
25
+ children: /* @__PURE__ */ jsx(Menu.Portal, {
26
+ ...portal,
27
+ keepMounted,
28
+ children: /* @__PURE__ */ jsx(Menu.Positioner, {
29
+ side,
30
+ align,
31
+ anchor,
32
+ sideOffset: 4,
33
+ className: positionerClassName,
34
+ children: /* @__PURE__ */ jsx(Menu.Popup, {
35
+ "data-size": look.size,
36
+ "aria-label": label,
37
+ className: cx("min-w-44 max-h-(--available-height)", pinned ? "flex flex-col" : ["overflow-y-auto", "p-1"], panelClassName, look.size === "sm" && "text-xs", look.themeClassName, className, matchAnchorWidth && "min-w-[max(11rem,var(--anchor-width))]"),
38
+ children: pinned ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
39
+ header !== void 0 && /* @__PURE__ */ jsx("div", {
40
+ className: "shrink-0 border-b border-(--theme-border) px-3 py-2",
41
+ children: header
42
+ }),
43
+ /* @__PURE__ */ jsx("div", {
44
+ className: cx("min-h-0 flex-1 overflow-y-auto", "p-1"),
45
+ children
46
+ }),
47
+ footer !== void 0 && /* @__PURE__ */ jsx("div", {
48
+ className: cx("shrink-0 border-t border-(--theme-border)", "p-1"),
49
+ children: footer
50
+ })
51
+ ] }) : children
52
+ })
24
53
  })
25
54
  })
26
55
  });
@@ -58,7 +87,7 @@ function MenuCheckboxItem({ className, children, ...props }) {
58
87
  ...props,
59
88
  className: cx(itemClassName, className),
60
89
  children: [children, /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, {
61
- className: "ml-auto",
90
+ className: "ms-auto flex h-5 shrink-0 items-center ps-2 in-data-[size=sm]:h-4",
62
91
  children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5 opacity-80" })
63
92
  })]
64
93
  });
@@ -79,7 +108,7 @@ function MenuSeparator({ className }) {
79
108
  }
80
109
  function MenuGroupLabel({ children }) {
81
110
  return /* @__PURE__ */ jsx(Menu.GroupLabel, {
82
- className: "px-2 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-wide text-(--theme-muted-text-color)",
111
+ className: "px-2 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-wide text-(--theme-muted-text-color) in-data-[size=sm]:px-1.5",
83
112
  children
84
113
  });
85
114
  }
@@ -1,7 +1,17 @@
1
1
  import { type ReactNode } from 'react';
2
2
  interface MenuActionBase {
3
3
  label: string;
4
+ /** Before the label: an icon, or a mark such as a label's color dot. It stays when the
5
+ * row is checked, since the check sits at the row's end. */
4
6
  icon?: ReactNode;
7
+ /** A second, muted line under the label, such as what a product holds. A search matches it. */
8
+ description?: string | undefined;
9
+ /** The key that does the same from the page, such as `S` or `⌘K`, in plain text at the
10
+ * row's end. The menu doesn't bind it; the host does. */
11
+ shortcut?: string | undefined;
12
+ /** A small mark at the row's end, such as a dot for something unseen. It is hidden from
13
+ * screen readers, so say what it means in `label`. */
14
+ badge?: ReactNode;
5
15
  disabled?: boolean | undefined;
6
16
  /** Why the action is disabled, shown on hover and read with its name. */
7
17
  disabledReason?: string | undefined;
@@ -17,6 +27,7 @@ interface MenuClickAction extends MenuActionBase {
17
27
  href?: never;
18
28
  reloadDocument?: never;
19
29
  target?: never;
30
+ current?: never;
20
31
  copy?: never;
21
32
  }
22
33
  /** Navigates to `href`. */
@@ -24,8 +35,12 @@ interface MenuLinkAction extends MenuActionBase {
24
35
  href: string;
25
36
  /** Loads the page instead of routing, for paths the host's router doesn't serve. */
26
37
  reloadDocument?: boolean | undefined;
27
- /** `_blank` opens it in a new tab, such as a page outside the app. */
38
+ /** `_blank` opens it in a new tab, such as a page outside the app: a small arrow at the
39
+ * row's end shows it, and screen readers hear it. */
28
40
  target?: '_blank' | undefined;
41
+ /** The page the reader is on, such as the current organization in a switcher: checked at
42
+ * the row's end and announced as the current page. */
43
+ current?: boolean | undefined;
29
44
  onClick?: never;
30
45
  checked?: never;
31
46
  copy?: never;
@@ -41,6 +56,7 @@ interface MenuCopyAction extends MenuActionBase {
41
56
  href?: never;
42
57
  reloadDocument?: never;
43
58
  target?: never;
59
+ current?: never;
44
60
  }
45
61
  /** Something a menu row does: runs `onClick`, navigates to `href`, or copies
46
62
  * `copy`. Exactly one, so a row that does nothing when chosen doesn't compile.
@@ -52,11 +68,24 @@ export interface MenuSubmenu {
52
68
  icon?: ReactNode;
53
69
  items: MenuEntry[];
54
70
  search?: MenuSearch | undefined;
71
+ /** The key that opens it from the page, in plain text by the chevron. */
72
+ shortcut?: string | undefined;
73
+ /** Can't be opened, such as Labels where there are none. */
74
+ disabled?: boolean | undefined;
75
+ /** Why it can't be opened, shown on hover and read with its name. */
76
+ disabledReason?: string | undefined;
77
+ /** More text a menu's search matches, beside the label; a match shows all its rows. */
78
+ keywords?: string | undefined;
79
+ }
80
+ /** Rows under a heading, which names them for screen readers too. */
81
+ export interface MenuGroup {
82
+ group: string;
83
+ items: MenuEntry[];
55
84
  }
56
85
  export interface MenuDivider {
57
86
  divider: true;
58
87
  }
59
- export type MenuEntry = MenuAction | MenuSubmenu | MenuDivider;
88
+ export type MenuEntry = MenuAction | MenuSubmenu | MenuGroup | MenuDivider;
60
89
  export declare const menuDivider: MenuDivider;
61
90
  /** A field atop a menu that narrows it, submenus included, to the actions it matches. */
62
91
  export interface MenuSearch {
@@ -65,6 +94,7 @@ export interface MenuSearch {
65
94
  empty: string;
66
95
  }
67
96
  export declare const isMenuDivider: (entry: MenuEntry) => entry is MenuDivider;
97
+ export declare const isMenuGroup: (entry: MenuEntry) => entry is MenuGroup;
68
98
  export declare const isMenuSubmenu: (entry: MenuEntry) => entry is MenuSubmenu;
69
99
  /** Gives a menu root its search's filter; `children` renders the root with the query. */
70
100
  export declare function MenuFilter({ search, children, }: {
@@ -78,10 +108,16 @@ export declare function MenuEntries({ entries, search, query, }: {
78
108
  /** The search's text, from the MenuFilter around the menu's root. */
79
109
  query?: string;
80
110
  }): import("react").JSX.Element;
111
+ /** A key as `aria-keyshortcuts` spells it: `⌘K` reads Meta+K, `⇧P` Shift+P. */
112
+ export declare function ariaKeyShortcut(shortcut: string | undefined): string | undefined;
81
113
  /** Warns in development when an action has no behavior. The types rule that
82
114
  * out, but a JavaScript caller or a cast still can, and its row renders fine
83
115
  * and silently does nothing. */
84
116
  export declare function warnIfInert(action: MenuAction, where: string): void;
85
117
  /** Runs an action that isn't a link: copies its text or calls its onClick. */
86
118
  export declare function useRunAction(): (action: MenuAction) => void;
119
+ /** One action as a menu row: a link, an on/off choice, or a plain item. */
120
+ export declare function ActionRow({ action }: {
121
+ action: MenuAction;
122
+ }): import("react").JSX.Element;
87
123
  export {};