datocms-react-ui 3.1.0-next.10 → 3.1.0-next.11

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 (46) hide show
  1. package/dist/InsertGap.js +2 -2
  2. package/dist/styles.css +364 -52
  3. package/dist/ui-public/icons/index.js +304 -300
  4. package/dist/ui-public/icons/lucide/arrow-down-wide-narrow.js +28 -0
  5. package/dist/ui-public/icons/lucide/arrow-up-narrow-wide.js +28 -0
  6. package/dist/ui-public/locales/en.js +1 -0
  7. package/dist/ui-public/src/UiTextKey.d.ts +1 -1
  8. package/dist/ui-public/src/actions/Actions/index.d.ts +1 -1
  9. package/dist/ui-public/src/actions/Actions/registry.d.ts +23 -1
  10. package/dist/ui-public/src/actions/Actions/registry.js +38 -6
  11. package/dist/ui-public/src/form/SelectInput/SelectMenu.js +1 -1
  12. package/dist/ui-public/src/form/SelectInput/SortableMultiValue.js +1 -1
  13. package/dist/ui-public/src/form/SwitchInput.d.ts +17 -2
  14. package/dist/ui-public/src/form/SwitchInput.js +57 -38
  15. package/dist/ui-public/src/form/SwitchList.d.ts +2 -1
  16. package/dist/ui-public/src/form/SwitchList.js +2 -1
  17. package/dist/ui-public/src/layout/SidebarPanel.d.ts +15 -1
  18. package/dist/ui-public/src/layout/SidebarPanel.js +30 -17
  19. package/dist/ui-public/src/layout/SplitPane/index.js +1 -0
  20. package/dist/ui-public/src/layout/Toolbar/FilterToggle.d.ts +2 -2
  21. package/dist/ui-public/src/layout/Toolbar/FilterToggle.js +6 -6
  22. package/dist/ui-public/src/layout/Toolbar/Help.d.ts +7 -1
  23. package/dist/ui-public/src/layout/Toolbar/Help.js +5 -4
  24. package/dist/ui-public/src/layout/Toolbar/index.d.ts +1 -1
  25. package/dist/ui-public/src/layout/Toolbar/index.js +1 -1
  26. package/dist/ui-public/src/lists/InfoList/Value.d.ts +22 -2
  27. package/dist/ui-public/src/lists/InfoList/Value.js +25 -1
  28. package/dist/ui-public/src/lists/InfoList/index.d.ts +2 -1
  29. package/dist/ui-public/src/lists/InsertGap/index.d.ts +31 -1
  30. package/dist/ui-public/src/lists/InsertGap/index.js +23 -3
  31. package/dist/ui-public/src/lists/InsertGap/parts.d.ts +2 -1
  32. package/dist/ui-public/src/lists/InsertGap/parts.js +60 -27
  33. package/dist/ui-public/src/lists/Table/cells/TimeCell.d.ts +1 -1
  34. package/dist/ui-public/src/lists/Table/cells/TimeCell.js +8 -5
  35. package/dist/ui-public/src/lists/Table/layout.js +3 -3
  36. package/dist/ui-public/src/lists/Table/types.d.ts +6 -0
  37. package/dist/ui-public/src/lists/UploadCard.js +7 -4
  38. package/dist/ui-public/src/overlays/Modal/Layer.d.ts +18 -0
  39. package/dist/ui-public/src/overlays/Modal/Layer.js +3 -2
  40. package/dist/ui-public/src/overlays/Modal/index.d.ts +10 -1
  41. package/dist/ui-public/src/overlays/Modal/index.js +2 -1
  42. package/dist/ui-public/src/overlays/Popover.js +4 -1
  43. package/dist/ui-public/src/patterns/ListDetail/Split.js +1 -0
  44. package/dist/ui-public/src/utils/pointerNearGap.d.ts +23 -0
  45. package/dist/ui-public/src/utils/pointerNearGap.js +211 -11
  46. package/package.json +1 -1
@@ -0,0 +1,28 @@
1
+ import { forwardRef } from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ //#region ../../node_modules/lucide-static/icons/arrow-down-wide-narrow.svg?react
4
+ var SvgArrowDownWideNarrow = (props, ref) => /* @__PURE__ */ jsxs("svg", {
5
+ className: "lucide lucide-arrow-down-wide-narrow",
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ width: "1em",
8
+ height: "1em",
9
+ viewBox: "0 0 24 24",
10
+ fill: "none",
11
+ stroke: "currentColor",
12
+ strokeWidth: 2,
13
+ strokeLinecap: "round",
14
+ strokeLinejoin: "round",
15
+ "aria-hidden": "true",
16
+ ref,
17
+ ...props,
18
+ children: [
19
+ /* @__PURE__ */ jsx("path", { d: "m3 16 4 4 4-4" }),
20
+ /* @__PURE__ */ jsx("path", { d: "M7 20V4" }),
21
+ /* @__PURE__ */ jsx("path", { d: "M11 4h10" }),
22
+ /* @__PURE__ */ jsx("path", { d: "M11 8h7" }),
23
+ /* @__PURE__ */ jsx("path", { d: "M11 12h4" })
24
+ ]
25
+ });
26
+ var ForwardRef = forwardRef(SvgArrowDownWideNarrow);
27
+ //#endregion
28
+ export { ForwardRef as default };
@@ -0,0 +1,28 @@
1
+ import { forwardRef } from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ //#region ../../node_modules/lucide-static/icons/arrow-up-narrow-wide.svg?react
4
+ var SvgArrowUpNarrowWide = (props, ref) => /* @__PURE__ */ jsxs("svg", {
5
+ className: "lucide lucide-arrow-up-narrow-wide",
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ width: "1em",
8
+ height: "1em",
9
+ viewBox: "0 0 24 24",
10
+ fill: "none",
11
+ stroke: "currentColor",
12
+ strokeWidth: 2,
13
+ strokeLinecap: "round",
14
+ strokeLinejoin: "round",
15
+ "aria-hidden": "true",
16
+ ref,
17
+ ...props,
18
+ children: [
19
+ /* @__PURE__ */ jsx("path", { d: "m3 8 4-4 4 4" }),
20
+ /* @__PURE__ */ jsx("path", { d: "M7 4v16" }),
21
+ /* @__PURE__ */ jsx("path", { d: "M11 12h4" }),
22
+ /* @__PURE__ */ jsx("path", { d: "M11 16h7" }),
23
+ /* @__PURE__ */ jsx("path", { d: "M11 20h10" })
24
+ ]
25
+ });
26
+ var ForwardRef = forwardRef(SvgArrowUpNarrowWide);
27
+ //#endregion
28
+ export { ForwardRef as default };
@@ -156,6 +156,7 @@ var en_default = {
156
156
  "sidebar.show": "Show sidebar",
157
157
  "sidebar.toggleLeft": "Toggle the left sidebar",
158
158
  "sidebar.toggleRight": "Toggle the right sidebar",
159
+ "sidebarPanel.help": "About this section",
159
160
  "slate.slash.blockquote.title": "Quote",
160
161
  "slate.toolbarButton.bulletedList": "Bulleted list",
161
162
  "slate.toolbarButton.code": "Mark as code",
@@ -1,2 +1,2 @@
1
1
  /** A key of a text of ui-public, as in `locales/en.json` */
2
- export type UiTextKey = 'MultipleSelectionActionBar.changeSelection' | 'MultipleSelectionActionBar.deselectAll' | 'a11y.filterToggle' | 'a11y.pagination.goToPage' | 'a11y.pagination.label' | 'a11y.pagination.next' | 'a11y.pagination.perPage' | 'a11y.pagination.previous' | 'a11y.selectInput.remove' | 'a11y.table.selectAll' | 'actionGroups.general' | 'actionGroups.list' | 'activityLog.noResults.description' | 'activityLog.noResults.title' | 'admin.listDetail.panel.close' | 'admin.listDetail.panel.empty.description' | 'admin.listDetail.panel.empty.title' | 'admin.listDetail.panel.failed.text' | 'admin.listDetail.panel.failed.title' | 'admin.listDetail.panel.loading' | 'admin.listPresets.all' | 'audioPlayer.pause' | 'audioPlayer.play' | 'blankSlate.documentation' | 'clipboard.copied' | 'clipboard.copy' | 'clipboard.copyId' | 'clipboard.open' | 'colorInput.noColorSet' | 'colorInput.openPicker' | 'colorInput.pickFromScreen' | 'date.today' | 'dateTimeInput.calendar' | 'dateTimeInput.currentMonth' | 'dateTimeInput.nextMonth' | 'dateTimeInput.openCalendar' | 'dateTimeInput.previousMonth' | 'dateTimeInput.time' | 'dateTimeInput.timezone' | 'dateTimeRangeInput.apply' | 'dateTimeRangeInput.custom' | 'dateTimeRangeInput.end' | 'dateTimeRangeInput.endTime' | 'dateTimeRangeInput.from' | 'dateTimeRangeInput.start' | 'dateTimeRangeInput.startTime' | 'dateTimeRangeInput.until' | 'dropdown.search' | 'dropdown.selectOption' | 'editorToolbar.addImage' | 'editorToolbar.addTable' | 'editorToolbar.alignCenter' | 'editorToolbar.alignJustify' | 'editorToolbar.alignLeft' | 'editorToolbar.alignRight' | 'editorToolbar.closeFullscreen' | 'editorToolbar.indent' | 'editorToolbar.label' | 'editorToolbar.openFullscreen' | 'editorToolbar.outdent' | 'editorToolbar.redo' | 'editorToolbar.source' | 'editorToolbar.undo' | 'environment.primary' | 'environment.sandbox' | 'field.clearValue' | 'fieldGroup.boolean.title' | 'fieldGroup.color.title' | 'fieldGroup.datetime.title' | 'fieldGroup.json.title' | 'fieldGroup.location.title' | 'fieldGroup.media.title' | 'fieldGroup.number.title' | 'fieldGroup.reference.title' | 'fieldGroup.rich_text.title' | 'fieldGroup.seo.title' | 'fieldGroup.text.title' | 'fieldType.boolean' | 'fieldType.color' | 'fieldType.date' | 'fieldType.date_time' | 'fieldType.file' | 'fieldType.float' | 'fieldType.gallery' | 'fieldType.integer' | 'fieldType.json' | 'fieldType.lat_lon' | 'fieldType.link' | 'fieldType.links' | 'fieldType.rich_text' | 'fieldType.seo' | 'fieldType.single_block' | 'fieldType.slug' | 'fieldType.string' | 'fieldType.structured_text' | 'fieldType.text' | 'fieldType.video' | 'filterBuilder.add' | 'filterBuilder.addMenu' | 'filterBuilder.argument' | 'filterBuilder.clear' | 'filterBuilder.condition' | 'filterBuilder.empty' | 'filterBuilder.field' | 'filterBuilder.operator' | 'filterBuilder.remove' | 'filterBuilder.value' | 'form.localizedField' | 'form.optional' | 'form.password.hide' | 'form.password.show' | 'framedImage.enlarged' | 'fullTextQuery.close' | 'fullTextQuery.placeholder' | 'hotkeys.closeModal' | 'hotkeys.closePopover' | 'hotkeys.filterList' | 'idText.label' | 'imageMetadata.analyzingUpload' | 'imageMetadata.cancelUpload' | 'imageMetadata.noMetadata' | 'imageMetadata.uploadInProgress' | 'item.shortStatus.draft' | 'item.shortStatus.new' | 'item.shortStatus.published' | 'item.shortStatus.updated' | 'itemTable.columns.available' | 'itemTable.columns.displayed' | 'itemTable.columns.hide' | 'keyValueList.value' | 'listFilter.noResults.description' | 'listFilter.noResults.title' | 'messages.confirm.defaultCancel' | 'modal.close' | 'pagination.next' | 'pagination.previous' | 'pagination.show' | 'recordRow.fallbackTitle' | 'recordRow.loading' | 'selectInput.create' | 'selectInput.loading' | 'selectInput.noOptions' | 'settingsMenu.needsAttention' | 'settingsMenu.opensNewTab' | 'shortcut.or' | 'shortcut.then' | 'shortcutsPanel.close' | 'shortcutsPanel.noResults' | 'shortcutsPanel.title' | 'sidebar.actions' | 'sidebar.hide' | 'sidebar.keepOpen' | 'sidebar.show' | 'sidebar.toggleLeft' | 'sidebar.toggleRight' | 'sidebarEditMode.reorder' | 'slate.slash.blockquote.title' | 'slate.toolbarButton.bulletedList' | 'slate.toolbarButton.code' | 'slate.toolbarButton.emphasis' | 'slate.toolbarButton.link' | 'slate.toolbarButton.numberedList' | 'slate.toolbarButton.strikethrough' | 'slate.toolbarButton.strong' | 'spinner.label' | 'splitButton.moreActions' | 'table.row.loading' | 'tableList.removeRow' | 'toolbar.goBack' | 'toolbar.help' | 'toolbar.learnMore' | 'upload.threatDetected' | 'uploadCard.fallbackTitle' | 'uploadCard.loading' | 'uploadPreview.encodingVideo' | 'usage.meterLabel' | 'userType.account' | 'userType.apiToken' | 'userType.organization' | 'userType.siteInvitation' | 'userType.ssoUser' | 'userType.user' | 'validityTriangle.current' | 'validityTriangle.invalidVersion' | 'validityTriangle.published';
2
+ export type UiTextKey = 'MultipleSelectionActionBar.changeSelection' | 'MultipleSelectionActionBar.deselectAll' | 'a11y.filterToggle' | 'a11y.pagination.goToPage' | 'a11y.pagination.label' | 'a11y.pagination.next' | 'a11y.pagination.perPage' | 'a11y.pagination.previous' | 'a11y.selectInput.remove' | 'a11y.table.selectAll' | 'actionGroups.general' | 'actionGroups.list' | 'activityLog.noResults.description' | 'activityLog.noResults.title' | 'admin.listDetail.panel.close' | 'admin.listDetail.panel.empty.description' | 'admin.listDetail.panel.empty.title' | 'admin.listDetail.panel.failed.text' | 'admin.listDetail.panel.failed.title' | 'admin.listDetail.panel.loading' | 'admin.listPresets.all' | 'audioPlayer.pause' | 'audioPlayer.play' | 'blankSlate.documentation' | 'clipboard.copied' | 'clipboard.copy' | 'clipboard.copyId' | 'clipboard.open' | 'colorInput.noColorSet' | 'colorInput.openPicker' | 'colorInput.pickFromScreen' | 'date.today' | 'dateTimeInput.calendar' | 'dateTimeInput.currentMonth' | 'dateTimeInput.nextMonth' | 'dateTimeInput.openCalendar' | 'dateTimeInput.previousMonth' | 'dateTimeInput.time' | 'dateTimeInput.timezone' | 'dateTimeRangeInput.apply' | 'dateTimeRangeInput.custom' | 'dateTimeRangeInput.end' | 'dateTimeRangeInput.endTime' | 'dateTimeRangeInput.from' | 'dateTimeRangeInput.start' | 'dateTimeRangeInput.startTime' | 'dateTimeRangeInput.until' | 'dropdown.search' | 'dropdown.selectOption' | 'editorToolbar.addImage' | 'editorToolbar.addTable' | 'editorToolbar.alignCenter' | 'editorToolbar.alignJustify' | 'editorToolbar.alignLeft' | 'editorToolbar.alignRight' | 'editorToolbar.closeFullscreen' | 'editorToolbar.indent' | 'editorToolbar.label' | 'editorToolbar.openFullscreen' | 'editorToolbar.outdent' | 'editorToolbar.redo' | 'editorToolbar.source' | 'editorToolbar.undo' | 'environment.primary' | 'environment.sandbox' | 'field.clearValue' | 'fieldGroup.boolean.title' | 'fieldGroup.color.title' | 'fieldGroup.datetime.title' | 'fieldGroup.json.title' | 'fieldGroup.location.title' | 'fieldGroup.media.title' | 'fieldGroup.number.title' | 'fieldGroup.reference.title' | 'fieldGroup.rich_text.title' | 'fieldGroup.seo.title' | 'fieldGroup.text.title' | 'fieldType.boolean' | 'fieldType.color' | 'fieldType.date' | 'fieldType.date_time' | 'fieldType.file' | 'fieldType.float' | 'fieldType.gallery' | 'fieldType.integer' | 'fieldType.json' | 'fieldType.lat_lon' | 'fieldType.link' | 'fieldType.links' | 'fieldType.rich_text' | 'fieldType.seo' | 'fieldType.single_block' | 'fieldType.slug' | 'fieldType.string' | 'fieldType.structured_text' | 'fieldType.text' | 'fieldType.video' | 'filterBuilder.add' | 'filterBuilder.addMenu' | 'filterBuilder.argument' | 'filterBuilder.clear' | 'filterBuilder.condition' | 'filterBuilder.empty' | 'filterBuilder.field' | 'filterBuilder.operator' | 'filterBuilder.remove' | 'filterBuilder.value' | 'form.localizedField' | 'form.optional' | 'form.password.hide' | 'form.password.show' | 'framedImage.enlarged' | 'fullTextQuery.close' | 'fullTextQuery.placeholder' | 'hotkeys.closeModal' | 'hotkeys.closePopover' | 'hotkeys.filterList' | 'idText.label' | 'imageMetadata.analyzingUpload' | 'imageMetadata.cancelUpload' | 'imageMetadata.noMetadata' | 'imageMetadata.uploadInProgress' | 'item.shortStatus.draft' | 'item.shortStatus.new' | 'item.shortStatus.published' | 'item.shortStatus.updated' | 'itemTable.columns.available' | 'itemTable.columns.displayed' | 'itemTable.columns.hide' | 'keyValueList.value' | 'listFilter.noResults.description' | 'listFilter.noResults.title' | 'messages.confirm.defaultCancel' | 'modal.close' | 'pagination.next' | 'pagination.previous' | 'pagination.show' | 'recordRow.fallbackTitle' | 'recordRow.loading' | 'selectInput.create' | 'selectInput.loading' | 'selectInput.noOptions' | 'settingsMenu.needsAttention' | 'settingsMenu.opensNewTab' | 'shortcut.or' | 'shortcut.then' | 'shortcutsPanel.close' | 'shortcutsPanel.noResults' | 'shortcutsPanel.title' | 'sidebar.actions' | 'sidebar.hide' | 'sidebar.keepOpen' | 'sidebar.show' | 'sidebar.toggleLeft' | 'sidebar.toggleRight' | 'sidebarEditMode.reorder' | 'sidebarPanel.help' | 'slate.slash.blockquote.title' | 'slate.toolbarButton.bulletedList' | 'slate.toolbarButton.code' | 'slate.toolbarButton.emphasis' | 'slate.toolbarButton.link' | 'slate.toolbarButton.numberedList' | 'slate.toolbarButton.strikethrough' | 'slate.toolbarButton.strong' | 'spinner.label' | 'splitButton.moreActions' | 'table.row.loading' | 'tableList.removeRow' | 'toolbar.goBack' | 'toolbar.help' | 'toolbar.learnMore' | 'upload.threatDetected' | 'uploadCard.fallbackTitle' | 'uploadCard.loading' | 'uploadPreview.encodingVideo' | 'usage.meterLabel' | 'userType.account' | 'userType.apiToken' | 'userType.organization' | 'userType.siteInvitation' | 'userType.ssoUser' | 'userType.user' | 'validityTriangle.current' | 'validityTriangle.invalidVersion' | 'validityTriangle.published';
@@ -1,3 +1,3 @@
1
- export { type Action, type ActionGroup, type ActionInfo, ActionLayer, type ActionLayerKind, type ActionLevel, type ActionSource, ActionsProvider, GENERAL_ACTION_GROUP, LIST_ACTION_GROUP, type PaletteAction, useAction, useActiveActions, useIsPageCovered, useReadPaletteActions, useRegisterActions, useRegisteredActions, useRunAction, } from './registry.js';
1
+ export { type Action, type ActionGroup, type ActionInfo, ActionLayer, type ActionLayerKind, type ActionLevel, type ActionSource, ActionsProvider, type ActionTarget, GENERAL_ACTION_GROUP, LIST_ACTION_GROUP, type PaletteAction, useAction, useActiveActions, useIsPageCovered, useReadPaletteActions, useRegisterActions, useRegisteredActions, useRunAction, } from './registry.js';
2
2
  export { Shortcut, type ShortcutProps } from './Shortcut.js';
3
3
  export type { ActionShortcut, KeyShortcut, SequenceShortcut, ShortcutKey, } from './shortcuts.js';
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { type TextMessage } from '../../Message.js';
2
+ import { type Message, type TextMessage } from '../../Message.js';
3
3
  import { type SvgIcon } from '../../utils/types.js';
4
4
  import { type ActionShortcut } from './shortcuts.js';
5
5
  /** What started the action */
@@ -21,6 +21,20 @@ export type ActionGroup = {
21
21
  export declare const GENERAL_ACTION_GROUP: ActionGroup;
22
22
  /** The group of the actions of a list: the filter, the selection */
23
23
  export declare const LIST_ACTION_GROUP: ActionGroup;
24
+ /**
25
+ * The entity that an action changes, for example the open record or the
26
+ * row with the focus. The command palette lists the actions of the
27
+ * entity first, with the `label` as their heading.
28
+ */
29
+ export type ActionTarget = {
30
+ /**
31
+ * The stable name of the entity, for example `'record.123'`. The actions
32
+ * with the same `id` go together under the label.
33
+ */
34
+ id: string;
35
+ /** The entity as the command palette shows it, for example its title */
36
+ label: Message;
37
+ };
24
38
  /** A thing that the user can do, with its keys */
25
39
  export type Action = {
26
40
  /**
@@ -80,6 +94,12 @@ export type Action = {
80
94
  * @default 'listed'
81
95
  */
82
96
  palette?: 'listed' | 'searchOnly' | 'hidden';
97
+ /**
98
+ * The entity that the action changes. When more entities have actions,
99
+ * the command palette shows the most specific one: a row wins over the
100
+ * page.
101
+ */
102
+ target?: ActionTarget;
83
103
  };
84
104
  /**
85
105
  * Where an action works: always (`app`), while its page is open (`page`),
@@ -110,6 +130,7 @@ export type ActionInfo = {
110
130
  export type PaletteAction = ActionInfo & {
111
131
  keywords: string[];
112
132
  palette: 'listed' | 'searchOnly';
133
+ target: ActionTarget | undefined;
113
134
  /**
114
135
  * Runs the action, if its component is still mounted and the action
115
136
  * still applies. Gives `false` when the action did not run.
@@ -206,6 +227,7 @@ export declare function useRegisteredActions(): ActionInfo[];
206
227
  * Gives a function that reads the actions for the command palette: the
207
228
  * active actions, the winner first, without the hidden ones. Read them
208
229
  * before the palette opens: its dialog turns off the actions under it.
230
+ * The pointer does not pick the actions of a region: see `paletteEntries`.
209
231
  */
210
232
  export declare function useReadPaletteActions(): () => PaletteAction[];
211
233
  export {};
@@ -156,10 +156,10 @@ var ActionsRegistry = class {
156
156
  keepsAppActions(layer) {
157
157
  return layer.kind === "popover" || this.coveringLayerIds.has(layer.id);
158
158
  }
159
- isActive(entry) {
159
+ isActive(entry, { anyRegion = false } = {}) {
160
160
  const { action, registration } = entry;
161
161
  const { region, layer, level } = registration;
162
- if (region && !region.hovered && !region.focused) return false;
162
+ if (!anyRegion && region && !region.hovered && !region.focused) return false;
163
163
  if (action.applicable && !action.applicable()) return false;
164
164
  if (layer !== ROOT_LAYER && !this.layers.includes(layer)) return false;
165
165
  const above = this.layers.filter((l) => isAbove(l, layer));
@@ -177,10 +177,14 @@ var ActionsRegistry = class {
177
177
  }
178
178
  return entries.sort(byPrecedence);
179
179
  }
180
- /** The active actions, the winner first. A winner hides its id below. */
181
- activeEntries() {
180
+ /**
181
+ * The active actions, the winner first. A winner hides its id below.
182
+ * Without `pointerRegions`, a region is active only while the focus is in
183
+ * it.
184
+ */
185
+ activeEntries({ pointerRegions = true } = {}) {
182
186
  const seen = /* @__PURE__ */ new Set();
183
- const inActiveRegion = ({ registration: { region } }) => !region || region.hovered || region.focused;
187
+ const inActiveRegion = ({ registration: { region } }) => !region || region.focused || pointerRegions && region.hovered;
184
188
  return this.entries(inActiveRegion).filter((entry) => {
185
189
  if (seen.has(entry.action.id) || !this.isActive(entry)) return false;
186
190
  seen.add(entry.action.id);
@@ -188,6 +192,32 @@ var ActionsRegistry = class {
188
192
  });
189
193
  }
190
194
  /**
195
+ * The actions for the command palette, the winner first. A region is in
196
+ * when the focus is in it. We do not read the region under the pointer,
197
+ * because the user then gets the actions of a row that the pointer was on
198
+ * by chance. A region without the focus gives only the actions that no
199
+ * other region has: the selection of the list of a pane is in, and the
200
+ * actions of a row are out, because each row has them.
201
+ */
202
+ paletteEntries() {
203
+ const focused = this.activeEntries({ pointerRegions: false });
204
+ const taken = new Set(focused.map((entry) => entry.action.id));
205
+ const others = /* @__PURE__ */ new Map();
206
+ for (const registration of Array.from(this.registrations)) {
207
+ if (!registration.region || registration.region.focused) continue;
208
+ for (const action of registration.actions()) {
209
+ const entry = {
210
+ action,
211
+ registration
212
+ };
213
+ if (taken.has(action.id) || !this.isActive(entry, { anyRegion: true })) continue;
214
+ others.set(action.id, [...others.get(action.id) ?? [], entry]);
215
+ }
216
+ }
217
+ const alone = Array.from(others.values()).flatMap((entries) => entries.length === 1 ? entries : []);
218
+ return [...focused, ...alone];
219
+ }
220
+ /**
191
221
  * One action for each id, the active one first: the winner among the
192
222
  * active actions, else the action that would win. The actions that do not
193
223
  * apply now are out.
@@ -562,16 +592,18 @@ function useRegisteredActions() {
562
592
  * Gives a function that reads the actions for the command palette: the
563
593
  * active actions, the winner first, without the hidden ones. Read them
564
594
  * before the palette opens: its dialog turns off the actions under it.
595
+ * The pointer does not pick the actions of a region: see `paletteEntries`.
565
596
  */
566
597
  function useReadPaletteActions() {
567
598
  const registry = useContext(RegistryContext);
568
- return useCallback(() => registry ? registry.activeEntries().flatMap((entry) => {
599
+ return useCallback(() => registry ? registry.paletteEntries().flatMap((entry) => {
569
600
  const palette = entry.action.palette ?? "listed";
570
601
  if (palette === "hidden") return [];
571
602
  return [{
572
603
  ...infoOf(entry, true),
573
604
  keywords: entry.action.keywords ?? [],
574
605
  palette,
606
+ target: entry.action.target,
575
607
  run: () => registry.rerun(entry, "palette")
576
608
  }];
577
609
  }) : [], [registry]);
@@ -1,8 +1,8 @@
1
1
  import { Navigation } from "../../../icons/index.js";
2
2
  import { useTranslation } from "../../i18n.js";
3
3
  import RawButton from "../../semantic/RawButton.js";
4
- import { stopPropagation } from "../../utils/events.js";
5
4
  import { Dropdown } from "../../actions/Dropdown/index.js";
5
+ import { stopPropagation } from "../../utils/events.js";
6
6
  import React, { createContext, useContext, useMemo } from "react";
7
7
  import classNames from "classnames";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
- import { stopPropagation } from "../../utils/events.js";
2
1
  import { SortableItem } from "../../lists/dnd/SortableList.js";
3
2
  import "../../lists/dnd/index.js";
3
+ import { stopPropagation } from "../../utils/events.js";
4
4
  import Context_default from "./Context.js";
5
5
  import { memo, useContext } from "react";
6
6
  import classNames from "classnames";
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { type Message } from '../Message.js';
1
+ import React, { type ReactNode } from 'react';
2
+ import { type Message, type TextMessage } from '../Message.js';
3
3
  import { BaseInputComponentPropsFieldWithReadOnly } from './inputProps.js';
4
4
  /** The props of `SwitchInput`. */
5
5
  export type SwitchInputProps = BaseInputComponentPropsFieldWithReadOnly<boolean | null> & {
@@ -10,6 +10,21 @@ export type SwitchInputProps = BaseInputComponentPropsFieldWithReadOnly<boolean
10
10
  * Do not give a `label` to a `FieldWrapper` around the switch.
11
11
  */
12
12
  label: Message;
13
+ /** The parts of the label that are not its text */
14
+ labelExtras?: {
15
+ /**
16
+ * Renders a control at the end of the label, for example a button that
17
+ * opens the details of the setting. A click on it does not flip the
18
+ * switch, and its name is not a part of the name of the switch.
19
+ */
20
+ renderInfo?: () => ReactNode;
21
+ };
22
+ /**
23
+ * A tooltip for the switch, for example the reason why it is disabled. In
24
+ * a `SwitchList`, it shows on the whole row. It is also a part of the
25
+ * description of the switch for a screen reader.
26
+ */
27
+ tooltip?: TextMessage | null;
13
28
  /**
14
29
  * Another setting forces the value to true, for example a permission that
15
30
  * a role gets from another role. An off switch then shows as on and faded,
@@ -1,4 +1,5 @@
1
1
  import { useTranslation } from "../i18n.js";
2
+ import Tooltip from "../overlays/Tooltip/index.js";
2
3
  import { useAutoincrementIntegerId } from "../hooks/useAutoincrementIntegerId.js";
3
4
  import { useFieldInput } from "./FieldWrapper.js";
4
5
  import { getEditState } from "./getEditState.js";
@@ -8,8 +9,8 @@ import classNames from "classnames";
8
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
10
  //#region ../ui-public/src/form/SwitchInput.tsx
10
11
  var SwitchInput = React.memo(function SwitchInput(props) {
11
- const { tc } = useTranslation();
12
- const { label, value, name, forcedOn, onChange, onBlur } = props;
12
+ const { tc, tm } = useTranslation();
13
+ const { label, labelExtras, tooltip, value, name, forcedOn, onChange, onBlur } = props;
13
14
  const { id, "aria-labelledby": ariaLabelledBy, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, "aria-required": ariaRequired } = useFieldInput(props);
14
15
  const uid = useAutoincrementIntegerId();
15
16
  const { disabled, showsReadOnly } = getEditState(props);
@@ -27,9 +28,17 @@ var SwitchInput = React.memo(function SwitchInput(props) {
27
28
  const preventFocus = useCallback((e) => {
28
29
  e.preventDefault();
29
30
  }, []);
31
+ const info = !isValidElement(label) && labelExtras?.renderInfo?.();
32
+ const labelTextId = info ? `${checkboxId}-label` : void 0;
30
33
  const showsForcedOn = Boolean(forcedOn && !value);
31
34
  const reasonId = `${checkboxId}-forced-reason`;
32
- const describedBy = [ariaDescribedBy, showsForcedOn && reasonId].filter(Boolean).join(" ") || void 0;
35
+ const tooltipText = tooltip ? tm(tooltip) : void 0;
36
+ const tooltipId = `${checkboxId}-tooltip`;
37
+ const describedBy = [
38
+ ariaDescribedBy,
39
+ showsForcedOn && reasonId,
40
+ tooltipText && tooltipId
41
+ ].filter(Boolean).join(" ") || void 0;
33
42
  const reasonElement = showsForcedOn && forcedOn && /* @__PURE__ */ jsx("div", {
34
43
  id: reasonId,
35
44
  className: inList ? "SwitchInput__reason" : "form__hint",
@@ -37,48 +46,58 @@ var SwitchInput = React.memo(function SwitchInput(props) {
37
46
  });
38
47
  const labelElement = label && /* @__PURE__ */ jsx("span", {
39
48
  className: "SwitchInput__label",
40
- children: isValidElement(label) ? label : /* @__PURE__ */ jsx("label", {
49
+ children: isValidElement(label) ? label : /* @__PURE__ */ jsxs("label", {
41
50
  htmlFor: checkboxId,
42
51
  className: "form__label",
43
- children: /* @__PURE__ */ jsx("span", {
52
+ children: [/* @__PURE__ */ jsx("span", {
44
53
  className: "form__label__text",
54
+ id: labelTextId,
45
55
  children: tc(label)
46
- })
56
+ }), info]
47
57
  })
48
58
  });
49
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
50
- className: classNames("SwitchInput", inList && "SwitchInput--row"),
51
- children: [
52
- inList && /* @__PURE__ */ jsxs("div", {
53
- className: "SwitchInput__text",
54
- children: [labelElement, reasonElement]
55
- }),
56
- /* @__PURE__ */ jsx("input", {
57
- type: "checkbox",
58
- id: checkboxId,
59
- name,
60
- className: "SwitchInput__checkbox",
61
- checked: value ?? false,
62
- onChange: handleChange,
63
- disabled,
64
- readOnly: showsReadOnly,
65
- "aria-readonly": showsReadOnly || void 0,
66
- "aria-labelledby": ariaLabelledBy,
67
- "aria-invalid": ariaInvalid,
68
- "aria-describedby": describedBy,
69
- "aria-required": ariaRequired
70
- }),
71
- /* @__PURE__ */ jsx("label", {
72
- htmlFor: checkboxId,
73
- onMouseDown: preventFocus,
74
- className: classNames("SwitchInput__switch", {
75
- "SwitchInput__switch--forced-on": showsForcedOn,
76
- "SwitchInput__switch--disabled": disabled,
77
- "SwitchInput__switch--read-only": showsReadOnly
59
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Tooltip, {
60
+ label: tooltipText,
61
+ placement: inList ? "top-end" : "top-start",
62
+ children: /* @__PURE__ */ jsxs("div", {
63
+ className: classNames("SwitchInput", inList && "SwitchInput--row"),
64
+ children: [
65
+ inList && /* @__PURE__ */ jsxs("div", {
66
+ className: "SwitchInput__text",
67
+ children: [labelElement, reasonElement]
68
+ }),
69
+ /* @__PURE__ */ jsx("input", {
70
+ type: "checkbox",
71
+ id: checkboxId,
72
+ name,
73
+ className: "SwitchInput__checkbox",
74
+ checked: value ?? false,
75
+ onChange: handleChange,
76
+ disabled,
77
+ readOnly: showsReadOnly,
78
+ "aria-readonly": showsReadOnly || void 0,
79
+ "aria-labelledby": ariaLabelledBy ?? labelTextId,
80
+ "aria-invalid": ariaInvalid,
81
+ "aria-describedby": describedBy,
82
+ "aria-required": ariaRequired
83
+ }),
84
+ /* @__PURE__ */ jsx("label", {
85
+ htmlFor: checkboxId,
86
+ onMouseDown: preventFocus,
87
+ className: classNames("SwitchInput__switch", {
88
+ "SwitchInput__switch--forced-on": showsForcedOn,
89
+ "SwitchInput__switch--disabled": disabled,
90
+ "SwitchInput__switch--read-only": showsReadOnly
91
+ })
92
+ }),
93
+ !inList && labelElement,
94
+ tooltipText && /* @__PURE__ */ jsx("span", {
95
+ id: tooltipId,
96
+ className: "visually-hidden",
97
+ children: tooltipText
78
98
  })
79
- }),
80
- !inList && labelElement
81
- ]
99
+ ]
100
+ })
82
101
  }), !inList && reasonElement] });
83
102
  });
84
103
  var SwitchInput_default = Object.assign(SwitchInput, { fieldLabel: "inside" });
@@ -10,7 +10,8 @@ export type SwitchListProps = {
10
10
  /**
11
11
  * A list of related switches, for example the permissions of a role. Each
12
12
  * switch is an inset row: the label on the left, the switch on the right,
13
- * and a box that shows on hover. Put one list in a `Page.Group` for each topic.
13
+ * and a box that shows on hover. Put one list in a `Page.Group` for each
14
+ * topic, or in a `SidebarPanel` of a detail panel.
14
15
  */
15
16
  export declare function SwitchList({ children, className }: SwitchListProps): React.JSX.Element;
16
17
  export default SwitchList;
@@ -10,7 +10,8 @@ function useInSwitchList() {
10
10
  /**
11
11
  * A list of related switches, for example the permissions of a role. Each
12
12
  * switch is an inset row: the label on the left, the switch on the right,
13
- * and a box that shows on hover. Put one list in a `Page.Group` for each topic.
13
+ * and a box that shows on hover. Put one list in a `Page.Group` for each
14
+ * topic, or in a `SidebarPanel` of a detail panel.
14
15
  */
15
16
  function SwitchList({ children, className }) {
16
17
  return /* @__PURE__ */ jsx(SwitchListContext.Provider, {
@@ -3,6 +3,15 @@ import { type ButtonProps } from '../actions/Button.js';
3
3
  import type { Message } from '../Message.js';
4
4
  import { type HeadingLevel } from '../semantic/Heading.js';
5
5
  import { type SvgIcon } from '../utils/types.js';
6
+ export type SidebarPanelHelp = {
7
+ /** The text: two short sentences, plain text */
8
+ text: ReactNode;
9
+ /**
10
+ * The page of the documentation about the subject. A "Learn more" link to
11
+ * it comes after the text.
12
+ */
13
+ docsUrl?: string;
14
+ };
6
15
  export type SidebarPanelCommonProps = {
7
16
  /** The title of the panel, for example `{ id: 'itemForm.links' }` */
8
17
  title: Message;
@@ -18,6 +27,11 @@ export type SidebarPanelCommonProps = {
18
27
  * does not show it when it is 0.
19
28
  */
20
29
  count?: number;
30
+ /**
31
+ * The text that says what the panel is for. A "?" button shows after the
32
+ * title, and a click on it opens the text.
33
+ */
34
+ help?: SidebarPanelHelp;
21
35
  /** The content of the panel, for example an InfoList */
22
36
  children: ReactNode;
23
37
  /**
@@ -64,7 +78,7 @@ export type SidebarPanelProps = SidebarPanelCommonProps & SidebarPanelOpenMode;
64
78
  * A section of a sidebar or of a detail panel. The title is a heading with a
65
79
  * button in it, and the button opens and closes the content.
66
80
  */
67
- declare function BaseSidebarPanel({ startOpen, collapse, title, titleLevel, count, children, flush, maxHeight, }: SidebarPanelProps): React.JSX.Element;
81
+ declare function BaseSidebarPanel({ startOpen, collapse, title, titleLevel, help, count, children, flush, maxHeight, }: SidebarPanelProps): React.JSX.Element;
68
82
  export type SidebarPanelBlankProps = {
69
83
  /** The text, for example `{ id: 'sidebar.noLinks' }` */
70
84
  message: Message;
@@ -3,6 +3,7 @@ import RawButton from "../semantic/RawButton.js";
3
3
  import Button from "../actions/Button.js";
4
4
  import Heading from "../semantic/Heading.js";
5
5
  import { DisclosureChevron } from "../navigation/Chevron.js";
6
+ import Help_default from "./Toolbar/Help.js";
6
7
  import { useInMemorySidebarPanelOpen, useLocalStorageSidebarPanelOpen } from "./sidebarPanelStorage.js";
7
8
  import { useMemo, useState } from "react";
8
9
  import classNames from "classnames";
@@ -13,7 +14,7 @@ var nextContentId = 0;
13
14
  * A section of a sidebar or of a detail panel. The title is a heading with a
14
15
  * button in it, and the button opens and closes the content.
15
16
  */
16
- function BaseSidebarPanel({ startOpen = true, collapse, title, titleLevel = 3, count, children, flush, maxHeight }) {
17
+ function BaseSidebarPanel({ startOpen = true, collapse, title, titleLevel = 3, help, count, children, flush, maxHeight }) {
17
18
  const { tc } = useTranslation();
18
19
  const [contentId] = useState(() => `SidebarPanel__content-${++nextContentId}`);
19
20
  const [uncontrolledOpen, setUncontrolledOpen] = useState(startOpen);
@@ -22,23 +23,35 @@ function BaseSidebarPanel({ startOpen = true, collapse, title, titleLevel = 3, c
22
23
  const contentStyle = useMemo(() => maxHeight === void 0 ? void 0 : { maxHeight }, [maxHeight]);
23
24
  return /* @__PURE__ */ jsxs("div", {
24
25
  className: "SidebarPanel",
25
- children: [/* @__PURE__ */ jsx(Heading, {
26
- level: titleLevel,
27
- children: /* @__PURE__ */ jsxs(RawButton, {
28
- className: "SidebarPanel__header",
29
- expandable: {
26
+ children: [/* @__PURE__ */ jsxs("div", {
27
+ className: "SidebarPanel__header",
28
+ children: [
29
+ /* @__PURE__ */ jsx(Heading, {
30
+ level: titleLevel,
31
+ className: "SidebarPanel__header__heading",
32
+ children: /* @__PURE__ */ jsxs(RawButton, {
33
+ className: "SidebarPanel__header__title",
34
+ expandable: {
35
+ open,
36
+ controls: contentId
37
+ },
38
+ onClick: () => setOpen(!open),
39
+ children: [tc(title), count !== void 0 && count > 0 && /* @__PURE__ */ jsx("span", {
40
+ className: "SidebarPanel__header__count",
41
+ children: count
42
+ })]
43
+ })
44
+ }),
45
+ help && /* @__PURE__ */ jsx(Help_default, {
46
+ docsUrl: help.docsUrl,
47
+ ariaLabel: { id: "sidebarPanel.help" },
48
+ children: help.text
49
+ }),
50
+ /* @__PURE__ */ jsx(DisclosureChevron, {
30
51
  open,
31
- controls: contentId
32
- },
33
- onClick: () => setOpen(!open),
34
- children: [/* @__PURE__ */ jsxs("span", {
35
- className: "SidebarPanel__header__title",
36
- children: [tc(title), count !== void 0 && count > 0 && /* @__PURE__ */ jsx("span", {
37
- className: "SidebarPanel__header__count",
38
- children: count
39
- })]
40
- }), /* @__PURE__ */ jsx(DisclosureChevron, { open })]
41
- })
52
+ className: "SidebarPanel__header__chevron"
53
+ })
54
+ ]
42
55
  }), open && /* @__PURE__ */ jsx("div", {
43
56
  id: contentId,
44
57
  className: classNames("SidebarPanel__content", flush && "SidebarPanel__content--flush", maxHeight !== void 0 && "SidebarPanel__content--scrollable"),
@@ -148,6 +148,7 @@ function SplitPane({ mode = "split", minSize: minSizeProp = 200, maxSize, size:
148
148
  name: { id: secondarySide === "left" ? "sidebar.toggleLeft" : "sidebar.toggleRight" },
149
149
  icon: secondarySide === "left" ? Generic.SidebarIcon : Misc.SidebarFlipIcon,
150
150
  shortcut: { key: secondarySide === "left" ? "[" : "]" },
151
+ palette: "searchOnly",
151
152
  run: () => {
152
153
  if (secondaryHostRef.current?.contains(document.activeElement)) focusRailOnCollapse();
153
154
  handleSecondaryClick();
@@ -5,8 +5,8 @@ export type FilterToggleProps = {
5
5
  /** Opens or closes the filter ("onToggle" of useFilterToolbar) */
6
6
  onClick: () => void;
7
7
  /**
8
- * Opens the filter ("onOpen" of useFilterToolbar). `F` and `/` run it while
9
- * the pointer or the focus is in the Pane, and the tooltip shows the keys.
8
+ * Opens the filter ("onOpen" of useFilterToolbar). `F` runs it while
9
+ * the pointer or the focus is in the Pane, and the tooltip shows the key.
10
10
  */
11
11
  onOpen?: () => void;
12
12
  };
@@ -10,11 +10,10 @@ import { jsx } from "react/jsx-runtime";
10
10
  var FILTER_LIST_ACTION_ID = "list.filter";
11
11
  var FILTER_FIELD = "input, textarea, select";
12
12
  /**
13
- * Registers `F` and `/`, the keys that open the filter of the list and move
14
- * the focus to it, while the pointer or the focus is in the Pane of the
15
- * list. When the list is at the side of a split, the keys are on in all the
16
- * split. Out of a Pane, the keys are on for the page. `undefined` registers
17
- * nothing.
13
+ * Registers `F`, the key that opens the filter of the list and moves the
14
+ * focus to it, while the pointer or the focus is in the Pane of the list.
15
+ * When the list is at the side of a split, the key is on in all the split.
16
+ * Out of a Pane, the key is on for the page. `undefined` registers nothing.
18
17
  */
19
18
  function useFilterListAction(open) {
20
19
  const pane = usePaneRegion();
@@ -35,7 +34,8 @@ function useFilterListAction(open) {
35
34
  name: { id: "hotkeys.filterList" },
36
35
  icon: Generic.SearchIcon,
37
36
  group: LIST_ACTION_GROUP,
38
- shortcut: [{ key: "f" }, { key: "/" }],
37
+ shortcut: { key: "f" },
38
+ palette: "searchOnly",
39
39
  run
40
40
  }];
41
41
  }, [open, pane]);
@@ -1,4 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
+ import type { TextMessage } from '../../Message.js';
2
3
  export type HelpProps = {
3
4
  /** The text that says what the page is for: two short sentences, plain text */
4
5
  children: ReactNode;
@@ -7,12 +8,17 @@ export type HelpProps = {
7
8
  * it comes after the text.
8
9
  */
9
10
  docsUrl?: string;
11
+ /**
12
+ * The name of the "?" button, when the help is not about a page. The
13
+ * default is "About this page".
14
+ */
15
+ ariaLabel?: TextMessage;
10
16
  };
11
17
  /**
12
18
  * A "?" button that opens the text that says what the page is for. Give
13
19
  * Help to the "help" prop of Toolbar.Title, not as a sibling of the title.
14
20
  */
15
- declare function Help({ children, docsUrl }: HelpProps): React.JSX.Element;
21
+ declare function Help({ children, docsUrl, ariaLabel }: HelpProps): React.JSX.Element;
16
22
  /**
17
23
  * The text of a Help, without the "?" button. Help shows it in its popover.
18
24
  * A title that opens a menu (Toolbar.PresetsTitle) shows it at the bottom of