datocms-react-ui 3.1.0-next.0 → 3.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions.d.ts +1 -0
- package/dist/Actions.js +4 -0
- package/dist/IconAvatar.d.ts +2 -0
- package/dist/IconAvatar.js +2 -0
- package/dist/ListDetail.js +2 -2
- package/dist/Pane.js +2 -1
- package/dist/SplitPane.js +2 -2
- package/dist/react-ui/src/Canvas.d.ts +2 -1
- package/dist/react-ui/src/Canvas.js +8 -6
- package/dist/react-ui/src/ContextInspector.js +2 -2
- package/dist/react-ui/src/messageText.js +1 -1
- package/dist/styles.css +330 -195
- package/dist/ui/icons/brands/gitlab.js +15 -0
- package/dist/ui/icons/custom/netlify.js +7 -29
- package/dist/ui/icons/custom/vercel.js +1 -4
- package/dist/ui/icons/index.js +206 -195
- package/dist/ui/icons/regular/command.js +16 -0
- package/dist/ui/icons/regular/keyboard.js +16 -0
- package/dist/ui/icons/regular/list-tree.js +2 -1
- package/dist/ui/icons/regular/list.js +2 -1
- package/dist/ui/icons/regular/memo.js +2 -1
- package/dist/ui/locales/en.js +10 -3
- package/dist/ui/src/BundledTexts.js +2 -2
- package/dist/ui/src/UiTextKey.d.ts +1 -1
- package/dist/ui/src/actions/Actions/ActionTooltip.js +24 -0
- package/dist/ui/src/actions/Actions/Shortcut.d.ts +23 -0
- package/dist/ui/src/actions/Actions/Shortcut.js +45 -0
- package/dist/ui/src/actions/Actions/index.d.ts +3 -0
- package/dist/ui/src/actions/Actions/index.js +3 -0
- package/dist/ui/src/actions/Actions/registry.d.ts +211 -0
- package/dist/ui/src/actions/Actions/registry.js +580 -0
- package/dist/ui/src/actions/Actions/shortcuts.d.ts +85 -0
- package/dist/ui/src/actions/Actions/shortcuts.js +284 -0
- package/dist/ui/src/actions/Button.d.ts +13 -12
- package/dist/ui/src/actions/Button.js +8 -7
- package/dist/ui/src/actions/Dropdown/DropdownContext.js +2 -1
- package/dist/ui/src/actions/Dropdown/Footer.js +1 -1
- package/dist/ui/src/actions/Dropdown/Menu.d.ts +2 -1
- package/dist/ui/src/actions/Dropdown/Menu.js +43 -37
- package/dist/ui/src/actions/Dropdown/MenuContent.js +22 -12
- package/dist/ui/src/actions/Dropdown/MenuParts.js +3 -3
- package/dist/ui/src/actions/Dropdown/Option.d.ts +20 -3
- package/dist/ui/src/actions/Dropdown/Option.js +48 -9
- package/dist/ui/src/actions/Dropdown/OptionAction.js +1 -1
- package/dist/ui/src/actions/Dropdown/Submenu.js +2 -2
- package/dist/ui/src/actions/Dropdown/index.d.ts +4 -1
- package/dist/ui/src/actions/Dropdown/index.js +6 -4
- package/dist/ui/src/actions/Dropdown/triggers/ButtonTrigger.d.ts +4 -4
- package/dist/ui/src/actions/Dropdown/triggers/ButtonTrigger.js +7 -6
- package/dist/ui/src/actions/Dropdown/triggers/PillTrigger.js +1 -1
- package/dist/ui/src/actions/Dropdown/triggers/TextualTrigger.js +1 -1
- package/dist/ui/src/actions/EditorToolbar/Button.js +2 -2
- package/dist/ui/src/actions/EditorToolbar/Buttons.js +2 -2
- package/dist/ui/src/actions/EditorToolbar/index.js +1 -1
- package/dist/ui/src/actions/MultipleSelectionActionBar.d.ts +20 -3
- package/dist/ui/src/actions/MultipleSelectionActionBar.js +25 -7
- package/dist/ui/src/actions/SplitButton/Caret.js +1 -1
- package/dist/ui/src/actions/SplitButton/index.js +1 -1
- package/dist/ui/src/actions/disabledReason.js +1 -1
- package/dist/ui/src/content/Avatar.d.ts +5 -3
- package/dist/ui/src/content/Avatar.js +4 -3
- package/dist/ui/src/content/CodeSnippet.js +1 -1
- package/dist/ui/src/content/CopyButton.js +1 -1
- package/dist/ui/src/content/CopyableId.d.ts +6 -1
- package/dist/ui/src/content/CopyableId.js +5 -2
- package/dist/ui/src/content/CopyableValue.js +2 -2
- package/dist/ui/src/content/FeedbackDot.js +1 -1
- package/dist/ui/src/content/IconAvatar.d.ts +42 -0
- package/dist/ui/src/content/IconAvatar.js +36 -0
- package/dist/ui/src/content/InitialsAvatar.js +1 -2
- package/dist/ui/src/content/Pill.js +3 -3
- package/dist/ui/src/content/SmartDate.js +1 -1
- package/dist/ui/src/content/UploadThreatTriangle.js +1 -1
- package/dist/ui/src/content/UsageMeter.d.ts +2 -1
- package/dist/ui/src/content/UsageMeter.js +3 -2
- package/dist/ui/src/content/ValidityTriangles.js +3 -3
- package/dist/ui/src/feedback/BlankSlate.js +2 -2
- package/dist/ui/src/feedback/Callout.js +2 -2
- package/dist/ui/src/feedback/ProgressBar.js +1 -1
- package/dist/ui/src/form/AutosizeInput.js +1 -1
- package/dist/ui/src/form/FieldHint.js +1 -1
- package/dist/ui/src/form/FieldWrapper.js +1 -1
- package/dist/ui/src/form/InputGroup.js +1 -1
- package/dist/ui/src/form/Label.js +2 -2
- package/dist/ui/src/form/PasswordInput.js +1 -1
- package/dist/ui/src/form/RadioGroupInput.js +1 -1
- package/dist/ui/src/form/SelectInput/SelectMenu.js +3 -3
- package/dist/ui/src/form/SelectInput/SelectMultiValueRemove.js +7 -0
- package/dist/ui/src/form/SelectInput/SelectOption.js +1 -1
- package/dist/ui/src/form/SelectInput/SortableMultiValue.js +1 -1
- package/dist/ui/src/form/StringInput.js +1 -1
- package/dist/ui/src/form/SwitchInput.d.ts +2 -0
- package/dist/ui/src/form/SwitchInput.js +4 -3
- package/dist/ui/src/form/SwitchList.js +1 -1
- package/dist/ui/src/form/TableList.js +2 -2
- package/dist/ui/src/form/TextareaInput.js +1 -1
- package/dist/ui/src/i18n.js +6 -6
- package/dist/ui/src/layout/ListOrOverview.js +3 -3
- package/dist/ui/src/layout/Page/Page.js +1 -1
- package/dist/ui/src/layout/Page/PageContent.js +1 -1
- package/dist/ui/src/layout/Page/PageGroup.js +2 -2
- package/dist/ui/src/layout/Page/PageSection.js +1 -1
- package/dist/ui/src/layout/Pane/ListFilter.js +6 -12
- package/dist/ui/src/layout/Pane/PaneHeader.js +3 -3
- package/dist/ui/src/layout/Pane/PaneRegion.d.ts +14 -0
- package/dist/ui/src/layout/Pane/PaneRegion.js +23 -0
- package/dist/ui/src/layout/Pane/index.d.ts +1 -0
- package/dist/ui/src/layout/Pane/index.js +36 -32
- package/dist/ui/src/layout/SidebarPanel.js +1 -1
- package/dist/ui/src/layout/SplitPane.d.ts +2 -0
- package/dist/ui/src/layout/SplitPane.js +79 -37
- package/dist/ui/src/layout/SplitView/SashActionButton.js +17 -9
- package/dist/ui/src/layout/SplitView/SplitView.js +1 -1
- package/dist/ui/src/layout/SplitView/SplitViewSash.js +2 -1
- package/dist/ui/src/layout/Toolbar/AddNewButton.d.ts +10 -6
- package/dist/ui/src/layout/Toolbar/AddNewButton.js +10 -23
- package/dist/ui/src/layout/Toolbar/Divider.d.ts +8 -0
- package/dist/ui/src/layout/Toolbar/Divider.js +16 -0
- package/dist/ui/src/layout/Toolbar/DotsDropdown.d.ts +8 -1
- package/dist/ui/src/layout/Toolbar/DotsDropdown.js +3 -2
- package/dist/ui/src/layout/Toolbar/Fill.js +1 -1
- package/dist/ui/src/layout/Toolbar/FilterInput.d.ts +7 -3
- package/dist/ui/src/layout/Toolbar/FilterInput.js +62 -49
- package/dist/ui/src/layout/Toolbar/FilterToggle.d.ts +6 -4
- package/dist/ui/src/layout/Toolbar/FilterToggle.js +42 -7
- package/dist/ui/src/layout/Toolbar/GoBack.d.ts +6 -1
- package/dist/ui/src/layout/Toolbar/GoBack.js +12 -5
- package/dist/ui/src/layout/Toolbar/Group.js +1 -1
- package/dist/ui/src/layout/Toolbar/Help.js +3 -3
- package/dist/ui/src/layout/Toolbar/Pagination.js +2 -2
- package/dist/ui/src/layout/Toolbar/PresetsTitle.js +3 -3
- package/dist/ui/src/layout/Toolbar/PrimaryButton.d.ts +3 -3
- package/dist/ui/src/layout/Toolbar/PrimaryButton.js +2 -2
- package/dist/ui/src/layout/Toolbar/Root.d.ts +6 -1
- package/dist/ui/src/layout/Toolbar/Root.js +13 -2
- package/dist/ui/src/layout/Toolbar/Search.d.ts +2 -1
- package/dist/ui/src/layout/Toolbar/Search.js +8 -3
- package/dist/ui/src/layout/Toolbar/context.js +2 -1
- package/dist/ui/src/layout/Toolbar/index.d.ts +5 -3
- package/dist/ui/src/layout/Toolbar/index.js +2 -0
- package/dist/ui/src/lists/CardList.d.ts +7 -2
- package/dist/ui/src/lists/CardList.js +7 -6
- package/dist/ui/src/lists/EmptySlot.js +2 -2
- package/dist/ui/src/lists/EntityRow.js +1 -1
- package/dist/ui/src/lists/InfoList.js +8 -3
- package/dist/ui/src/lists/InsertGap.js +4 -4
- package/dist/ui/src/lists/MediaCard.d.ts +10 -0
- package/dist/ui/src/lists/MediaCard.js +9 -4
- package/dist/ui/src/lists/RowList.js +2 -2
- package/dist/ui/src/lists/SettingsList.js +1 -1
- package/dist/ui/src/lists/Table/Body.js +1 -1
- package/dist/ui/src/lists/Table/Cell.js +1 -1
- package/dist/ui/src/lists/Table/ColumnsMenu.js +1 -1
- package/dist/ui/src/lists/Table/Header.js +8 -10
- package/dist/ui/src/lists/Table/HeaderCell.js +2 -2
- package/dist/ui/src/lists/Table/Row.d.ts +7 -1
- package/dist/ui/src/lists/Table/Row.js +6 -2
- package/dist/ui/src/lists/Table/Table.js +1 -1
- package/dist/ui/src/lists/Table/TreeToggle.js +1 -1
- package/dist/ui/src/lists/Table/index.d.ts +1 -1
- package/dist/ui/src/lists/Table/layout.d.ts +3 -2
- package/dist/ui/src/lists/Table/layout.js +26 -13
- package/dist/ui/src/lists/dnd/DragHandle.js +1 -1
- package/dist/ui/src/lists/dnd/DropIndicator.js +1 -1
- package/dist/ui/src/lists/dnd/SortableList.js +2 -2
- package/dist/ui/src/lists/dnd/tree/SortableTree.js +1 -1
- package/dist/ui/src/navigation/Chevron.js +2 -2
- package/dist/ui/src/navigation/SegmentedControl.d.ts +23 -4
- package/dist/ui/src/navigation/SegmentedControl.js +23 -5
- package/dist/ui/src/navigation/SettingsMenu.js +3 -3
- package/dist/ui/src/navigation/SidebarTree/SidebarTreeNode.js +3 -3
- package/dist/ui/src/navigation/SidebarTree/SidebarTreeNodeActions.js +1 -1
- package/dist/ui/src/navigation/Tabs.js +1 -1
- package/dist/ui/src/overlays/FullscreenModal.js +48 -53
- package/dist/ui/src/overlays/HoverCard.js +4 -4
- package/dist/ui/src/overlays/Modal.d.ts +7 -0
- package/dist/ui/src/overlays/Modal.js +53 -55
- package/dist/ui/src/overlays/Popover.d.ts +6 -3
- package/dist/ui/src/overlays/Popover.js +13 -8
- package/dist/ui/src/overlays/Portal.js +1 -1
- package/dist/ui/src/overlays/Tooltip.d.ts +6 -3
- package/dist/ui/src/overlays/Tooltip.js +29 -13
- package/dist/ui/src/overlays/useModalClose.js +17 -12
- package/dist/ui/src/patterns/ListDetail/Page.d.ts +9 -0
- package/dist/ui/src/patterns/ListDetail/Page.js +33 -26
- package/dist/ui/src/patterns/ListDetail/Panel.js +4 -2
- package/dist/ui/src/patterns/ListDetail/Split.d.ts +5 -0
- package/dist/ui/src/patterns/ListDetail/Split.js +75 -56
- package/dist/ui/src/patterns/ListDetail/index.d.ts +2 -2
- package/dist/ui/src/patterns/ListDetail/index.js +2 -2
- package/dist/ui/src/patterns/ListFormPage.js +2 -2
- package/dist/ui/src/semantic/Main.d.ts +4 -1
- package/dist/ui/src/semantic/Main.js +53 -3
- package/dist/ui/src/semantic/NavigationFocusProvider.js +9 -0
- package/package.json +1 -1
- package/dist/HotKey.d.ts +0 -1
- package/dist/HotKey.js +0 -2
- package/dist/ui/src/actions/HotKey.d.ts +0 -98
- package/dist/ui/src/actions/HotKey.js +0 -270
- package/dist/ui/src/actions/hotKeyContext.d.ts +0 -32
- package/dist/ui/src/actions/hotKeyContext.js +0 -15
|
@@ -11,5 +11,6 @@ var SvgListTree = (props, ref) => /* @__PURE__ */ jsx("svg", {
|
|
|
11
11
|
...props,
|
|
12
12
|
children: /* @__PURE__ */ jsx("path", { d: "M24 48C10.7 48 0 58.7 0 72v48c0 13.3 10.7 24 24 24V256 384c0 30.9 25.1 56 56 56h48c0 13.3 10.7 24 24 24h48c13.3 0 24-10.7 24-24V392c0-13.3-10.7-24-24-24H152c-13.3 0-24 10.7-24 24H80c-4.4 0-8-3.6-8-8V280h56c0 13.3 10.7 24 24 24h48c13.3 0 24-10.7 24-24V232c0-13.3-10.7-24-24-24H152c-13.3 0-24 10.7-24 24H72V144c13.3 0 24-10.7 24-24V72c0-13.3-10.7-24-24-24H24zM160 96c0 13.3 10.7 24 24 24H488c13.3 0 24-10.7 24-24s-10.7-24-24-24H184c-13.3 0-24 10.7-24 24zM288 256c0 13.3 10.7 24 24 24H488c13.3 0 24-10.7 24-24s-10.7-24-24-24H312c-13.3 0-24 10.7-24 24zm0 160c0 13.3 10.7 24 24 24H488c13.3 0 24-10.7 24-24s-10.7-24-24-24H312c-13.3 0-24 10.7-24 24z" })
|
|
13
13
|
});
|
|
14
|
-
forwardRef(SvgListTree);
|
|
14
|
+
var ForwardRef = forwardRef(SvgListTree);
|
|
15
15
|
//#endregion
|
|
16
|
+
export { ForwardRef as default };
|
|
@@ -11,5 +11,6 @@ var SvgList = (props, ref) => /* @__PURE__ */ jsx("svg", {
|
|
|
11
11
|
...props,
|
|
12
12
|
children: /* @__PURE__ */ jsx("path", { d: "M40 48C26.7 48 16 58.7 16 72v48c0 13.3 10.7 24 24 24H88c13.3 0 24-10.7 24-24V72c0-13.3-10.7-24-24-24H40zM184 72c-13.3 0-24 10.7-24 24s10.7 24 24 24H488c13.3 0 24-10.7 24-24s-10.7-24-24-24H184zm0 160c-13.3 0-24 10.7-24 24s10.7 24 24 24H488c13.3 0 24-10.7 24-24s-10.7-24-24-24H184zm0 160c-13.3 0-24 10.7-24 24s10.7 24 24 24H488c13.3 0 24-10.7 24-24s-10.7-24-24-24H184zM16 232v48c0 13.3 10.7 24 24 24H88c13.3 0 24-10.7 24-24V232c0-13.3-10.7-24-24-24H40c-13.3 0-24 10.7-24 24zM40 368c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24H88c13.3 0 24-10.7 24-24V392c0-13.3-10.7-24-24-24H40z" })
|
|
13
13
|
});
|
|
14
|
-
forwardRef(SvgList);
|
|
14
|
+
var ForwardRef = forwardRef(SvgList);
|
|
15
15
|
//#endregion
|
|
16
|
+
export { ForwardRef as default };
|
|
@@ -11,5 +11,6 @@ var SvgMemo = (props, ref) => /* @__PURE__ */ jsx("svg", {
|
|
|
11
11
|
...props,
|
|
12
12
|
children: /* @__PURE__ */ jsx("path", { d: "M64 48c-8.8 0-16 7.2-16 16V448c0 8.8 7.2 16 16 16H320c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H64zM0 64C0 28.7 28.7 0 64 0H320c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zm120 64H264c13.3 0 24 10.7 24 24s-10.7 24-24 24H120c-13.3 0-24-10.7-24-24s10.7-24 24-24zm0 96H264c13.3 0 24 10.7 24 24s-10.7 24-24 24H120c-13.3 0-24-10.7-24-24s10.7-24 24-24zm0 96h48c13.3 0 24 10.7 24 24s-10.7 24-24 24H120c-13.3 0-24-10.7-24-24s10.7-24 24-24z" })
|
|
13
13
|
});
|
|
14
|
-
forwardRef(SvgMemo);
|
|
14
|
+
var ForwardRef = forwardRef(SvgMemo);
|
|
15
15
|
//#endregion
|
|
16
|
+
export { ForwardRef as default };
|
package/dist/ui/locales/en.js
CHANGED
|
@@ -8,7 +8,10 @@ var en_default = {
|
|
|
8
8
|
"a11y.pagination.next": "Next page",
|
|
9
9
|
"a11y.pagination.perPage": "Items per page",
|
|
10
10
|
"a11y.pagination.previous": "Previous page",
|
|
11
|
+
"a11y.selectInput.remove": "Remove",
|
|
11
12
|
"a11y.table.selectAll": "Select all rows",
|
|
13
|
+
"actionGroups.general": "General",
|
|
14
|
+
"actionGroups.list": "Lists",
|
|
12
15
|
"activityLog.noResults.description": "Nothing matches your filters. Try different filters, or remove some of them.",
|
|
13
16
|
"activityLog.noResults.title": "No results",
|
|
14
17
|
"admin.listDetail.panel.close": "Hide details",
|
|
@@ -49,9 +52,6 @@ var en_default = {
|
|
|
49
52
|
"hotkeys.closeModal": "Close modal panel",
|
|
50
53
|
"hotkeys.closePopover": "Close popover",
|
|
51
54
|
"hotkeys.filterList": "Filter the list",
|
|
52
|
-
"hotkeys.info.empty": "No keys active",
|
|
53
|
-
"hotkeys.info.title": "Active hotkeys",
|
|
54
|
-
"hotkeys.toggleKeyboardShortcuts": "Show/hide available keyboard shortcuts",
|
|
55
55
|
"idText.label": "ID",
|
|
56
56
|
"itemTable.columns.available": "Available columns",
|
|
57
57
|
"itemTable.columns.displayed": "Displayed columns",
|
|
@@ -69,11 +69,18 @@ var en_default = {
|
|
|
69
69
|
"selectInput.noOptions": "No options",
|
|
70
70
|
"settingsMenu.needsAttention": "Needs attention",
|
|
71
71
|
"settingsMenu.opensNewTab": "Opens in a new tab",
|
|
72
|
+
"shortcut.or": "or",
|
|
73
|
+
"shortcut.then": "then",
|
|
74
|
+
"shortcutsPanel.close": "Close the keyboard shortcuts",
|
|
75
|
+
"shortcutsPanel.noResults": "No shortcut matches the search",
|
|
76
|
+
"shortcutsPanel.title": "Keyboard shortcuts",
|
|
72
77
|
"sidebar.actions": "Actions",
|
|
73
78
|
"sidebarEditMode.reorder": "Reorder",
|
|
74
79
|
"sidebar.hide": "Hide sidebar",
|
|
75
80
|
"sidebar.keepOpen": "Keep the sidebar open",
|
|
76
81
|
"sidebar.show": "Show sidebar",
|
|
82
|
+
"sidebar.toggleLeft": "Toggle the left sidebar",
|
|
83
|
+
"sidebar.toggleRight": "Toggle the right sidebar",
|
|
77
84
|
"slate.slash.blockquote.title": "Quote",
|
|
78
85
|
"slate.toolbarButton.bulletedList": "Bulleted list",
|
|
79
86
|
"slate.toolbarButton.code": "Mark as code",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import en_default from "../locales/en.js";
|
|
2
1
|
import { TextsProvider } from "./TextsProvider.js";
|
|
2
|
+
import en_default from "../locales/en.js";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
import { IntlMessageFormat } from "intl-messageformat";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { IntlMessageFormat } from "intl-messageformat";
|
|
6
6
|
//#region ../ui/src/BundledTexts.tsx
|
|
7
7
|
var bundledTexts = en_default;
|
|
8
8
|
var warnedKeys = /* @__PURE__ */ new Set();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** A key of a text of ui, 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.table.selectAll' | 'activityLog.noResults.description' | 'activityLog.noResults.title' | 'admin.listDetail.panel.close' | 'admin.listDetail.panel.failed.text' | 'admin.listDetail.panel.failed.title' | 'admin.listDetail.panel.loading' | 'admin.listPresets.all' | 'blankSlate.documentation' | 'clipboard.copied' | 'clipboard.copy' | 'clipboard.copyId' | 'clipboard.open' | 'date.today' | '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' | 'field.clearValue' | 'form.localizedField' | 'form.optional' | 'form.password.hide' | 'form.password.show' | 'framedImage.enlarged' | 'fullTextQuery.close' | 'fullTextQuery.placeholder' | 'hotkeys.closeModal' | 'hotkeys.closePopover' | 'hotkeys.filterList' | '
|
|
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.failed.text' | 'admin.listDetail.panel.failed.title' | 'admin.listDetail.panel.loading' | 'admin.listPresets.all' | 'blankSlate.documentation' | 'clipboard.copied' | 'clipboard.copy' | 'clipboard.copyId' | 'clipboard.open' | 'date.today' | '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' | 'field.clearValue' | 'form.localizedField' | 'form.optional' | 'form.password.hide' | 'form.password.show' | 'framedImage.enlarged' | 'fullTextQuery.close' | 'fullTextQuery.placeholder' | 'hotkeys.closeModal' | 'hotkeys.closePopover' | 'hotkeys.filterList' | 'idText.label' | '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' | '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' | 'usage.meterLabel' | 'validityTriangle.current' | 'validityTriangle.invalidVersion' | 'validityTriangle.published';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useAction } from "./registry.js";
|
|
2
|
+
import Tooltip from "../../overlays/Tooltip.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region ../ui/src/actions/Actions/ActionTooltip.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A tooltip with the name and the keys of an action of the registry.
|
|
8
|
+
* `label` takes the place of the name (the label of an icon-only button).
|
|
9
|
+
* Without `label`, an action with no keys has no tooltip: the button already
|
|
10
|
+
* shows its name.
|
|
11
|
+
*/
|
|
12
|
+
function ActionTooltip({ action: id, label, placement, hidden, children }) {
|
|
13
|
+
const action = useAction(id);
|
|
14
|
+
const shortcuts = action?.shortcuts ?? [];
|
|
15
|
+
const hasKeys = shortcuts.length > 0;
|
|
16
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
17
|
+
label: !hidden && (label ?? (hasKeys ? action?.name : void 0)),
|
|
18
|
+
shortcut: hasKeys ? shortcuts : void 0,
|
|
19
|
+
placement,
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ActionTooltip };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ActionShortcut } from './shortcuts.js';
|
|
3
|
+
export type ShortcutProps =
|
|
4
|
+
/** The keys of an action of the registry */
|
|
5
|
+
{
|
|
6
|
+
/** The id of the action. Without keys, nothing shows. */
|
|
7
|
+
action: string;
|
|
8
|
+
keys?: never;
|
|
9
|
+
}
|
|
10
|
+
/** Keys with no action */
|
|
11
|
+
| {
|
|
12
|
+
/** The keys, or a list of alternatives */
|
|
13
|
+
keys: ActionShortcut | ActionShortcut[];
|
|
14
|
+
action?: never;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The keys of a shortcut, drawn as small keycaps: ⌘ ⇧ ⌥ on a Mac, Ctrl
|
|
18
|
+
* Shift Alt on the other systems. "then" separates the keys of a sequence,
|
|
19
|
+
* "or" the alternatives. A screen reader reads a sentence with the names
|
|
20
|
+
* of the keys.
|
|
21
|
+
*/
|
|
22
|
+
export declare function Shortcut(props: ShortcutProps): React.JSX.Element | null;
|
|
23
|
+
export default Shortcut;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { isMac, strokeLabels, toList } from "./shortcuts.js";
|
|
2
|
+
import { useAction } from "./registry.js";
|
|
3
|
+
import { useTranslation } from "../../i18n.js";
|
|
4
|
+
import { Fragment } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region ../ui/src/actions/Actions/Shortcut.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The keys of a shortcut, drawn as small keycaps: ⌘ ⇧ ⌥ on a Mac, Ctrl
|
|
9
|
+
* Shift Alt on the other systems. "then" separates the keys of a sequence,
|
|
10
|
+
* "or" the alternatives. A screen reader reads a sentence with the names
|
|
11
|
+
* of the keys.
|
|
12
|
+
*/
|
|
13
|
+
function Shortcut(props) {
|
|
14
|
+
const { t } = useTranslation();
|
|
15
|
+
const action = useAction(props.action);
|
|
16
|
+
const shortcuts = props.keys ? toList(props.keys) : action?.shortcuts ?? [];
|
|
17
|
+
if (shortcuts.length === 0) return null;
|
|
18
|
+
const mac = isMac();
|
|
19
|
+
const alternatives = shortcuts.map((shortcut) => strokeLabels(shortcut, mac));
|
|
20
|
+
const then = t("shortcut.then");
|
|
21
|
+
const or = t("shortcut.or");
|
|
22
|
+
const spoken = alternatives.map((strokes) => strokes.map((keys) => keys.map((key) => key.spoken).join("+")).join(` ${then} `)).join(` ${or} `);
|
|
23
|
+
return /* @__PURE__ */ jsxs("kbd", {
|
|
24
|
+
className: "Shortcut",
|
|
25
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: "Shortcut__keys",
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
children: alternatives.map((strokes, alternativeIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [alternativeIndex > 0 && /* @__PURE__ */ jsx("span", {
|
|
29
|
+
className: "Shortcut__word",
|
|
30
|
+
children: or
|
|
31
|
+
}), strokes.map((keys, strokeIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [strokeIndex > 0 && /* @__PURE__ */ jsx("span", {
|
|
32
|
+
className: "Shortcut__word",
|
|
33
|
+
children: then
|
|
34
|
+
}), keys.map((key, keyIndex) => /* @__PURE__ */ jsx("kbd", {
|
|
35
|
+
className: "Shortcut__key",
|
|
36
|
+
children: key.visible
|
|
37
|
+
}, keyIndex))] }, strokeIndex))] }, alternativeIndex))
|
|
38
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "visually-hidden",
|
|
40
|
+
children: spoken
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Shortcut, Shortcut as default };
|
|
@@ -0,0 +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';
|
|
2
|
+
export { Shortcut, type ShortcutProps } from './Shortcut.js';
|
|
3
|
+
export type { ActionShortcut, KeyShortcut, SequenceShortcut, ShortcutKey, } from './shortcuts.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ActionLayer, ActionsProvider, GENERAL_ACTION_GROUP, LIST_ACTION_GROUP, useAction, useActiveActions, useIsPageCovered, useReadPaletteActions, useRegisterActions, useRegisteredActions, useRunAction } from "./registry.js";
|
|
2
|
+
import { Shortcut } from "./Shortcut.js";
|
|
3
|
+
export { ActionLayer, ActionsProvider, GENERAL_ACTION_GROUP, LIST_ACTION_GROUP, Shortcut, useAction, useActiveActions, useIsPageCovered, useReadPaletteActions, useRegisterActions, useRegisteredActions, useRunAction };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { type TextMessage } from '../../Message.js';
|
|
3
|
+
import { type SvgIcon } from '../../utils/types.js';
|
|
4
|
+
import { type ActionShortcut } from './shortcuts.js';
|
|
5
|
+
/** What started the action */
|
|
6
|
+
export type ActionSource = 'key' | 'menu' | 'palette';
|
|
7
|
+
/**
|
|
8
|
+
* The group of an action in the list of the shortcuts, for example
|
|
9
|
+
* "Record" or "List". The list shows the groups in the order of their
|
|
10
|
+
* first action.
|
|
11
|
+
*/
|
|
12
|
+
export type ActionGroup = {
|
|
13
|
+
/** The stable name of the group, for example `'record'` */
|
|
14
|
+
id: string;
|
|
15
|
+
/** The heading of the group */
|
|
16
|
+
name: TextMessage;
|
|
17
|
+
/** The icon of the actions of the group that have no icon of their own */
|
|
18
|
+
icon?: SvgIcon;
|
|
19
|
+
};
|
|
20
|
+
/** The group of an action that gives no group */
|
|
21
|
+
export declare const GENERAL_ACTION_GROUP: ActionGroup;
|
|
22
|
+
/** The group of the actions of a list: the filter, the selection */
|
|
23
|
+
export declare const LIST_ACTION_GROUP: ActionGroup;
|
|
24
|
+
/** A thing that the user can do, with its keys */
|
|
25
|
+
export type Action = {
|
|
26
|
+
/**
|
|
27
|
+
* The stable name of the action, for example `'record.publish'`. An
|
|
28
|
+
* action of a more specific level hides the action with the same id of a
|
|
29
|
+
* less specific level.
|
|
30
|
+
*/
|
|
31
|
+
id: string;
|
|
32
|
+
/** The text of the tooltip, of the menu row and of the list of keys */
|
|
33
|
+
name: TextMessage;
|
|
34
|
+
/**
|
|
35
|
+
* The icon of the row of the command palette. Without it, the row shows
|
|
36
|
+
* the icon of the group.
|
|
37
|
+
*/
|
|
38
|
+
icon?: SvgIcon;
|
|
39
|
+
/**
|
|
40
|
+
* The group of the action in the list of the shortcuts. An action with
|
|
41
|
+
* no group goes in the "General" group.
|
|
42
|
+
*/
|
|
43
|
+
group?: ActionGroup;
|
|
44
|
+
/** The keys of the action. Without them, the action runs from a menu. */
|
|
45
|
+
shortcut?: ActionShortcut | ActionShortcut[];
|
|
46
|
+
/** Runs the action */
|
|
47
|
+
run: (context: {
|
|
48
|
+
source: ActionSource;
|
|
49
|
+
}) => unknown;
|
|
50
|
+
/**
|
|
51
|
+
* Gives `false` when the action does not exist now: the keys do nothing
|
|
52
|
+
* and the action does not show.
|
|
53
|
+
*/
|
|
54
|
+
applicable?: () => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Gives the reason why the action cannot run now. The action still
|
|
57
|
+
* shows, and its keys show the reason in a notification.
|
|
58
|
+
*/
|
|
59
|
+
disabledReason?: () => TextMessage | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The action also works while a dialog is open: its keys run, and the
|
|
62
|
+
* command palette shows it. Use it for the keys that open the command
|
|
63
|
+
* palette and the list of the shortcuts.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
layerSafe?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The area of the app that holds the page or the action, for example
|
|
69
|
+
* "Usage" for "By project". The command palette and the list of the
|
|
70
|
+
* shortcuts show it before the name, because a short name is not clear
|
|
71
|
+
* without its menu group.
|
|
72
|
+
*/
|
|
73
|
+
parent?: TextMessage;
|
|
74
|
+
/** More words that find the action in the command palette */
|
|
75
|
+
keywords?: string[];
|
|
76
|
+
/**
|
|
77
|
+
* How the command palette shows the action. `searchOnly`: only when the
|
|
78
|
+
* search finds it, not in the list before the user types. `hidden`: never,
|
|
79
|
+
* for the keys that only make sense as keys (Escape that closes a pane).
|
|
80
|
+
* @default 'listed'
|
|
81
|
+
*/
|
|
82
|
+
palette?: 'listed' | 'searchOnly' | 'hidden';
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Where an action works: always (`app`), while its page is open (`page`),
|
|
86
|
+
* or while the pointer or the focus is in an element (`region`).
|
|
87
|
+
*/
|
|
88
|
+
export type ActionLevel = 'app' | 'page' | 'region';
|
|
89
|
+
/**
|
|
90
|
+
* A dialog hides all the actions under it, a popover hides the page. A
|
|
91
|
+
* dialog with its own `Main` hides the page, as a popover does.
|
|
92
|
+
*/
|
|
93
|
+
export type ActionLayerKind = 'dialog' | 'popover';
|
|
94
|
+
/** An action as the read hooks give it */
|
|
95
|
+
export type ActionInfo = {
|
|
96
|
+
id: string;
|
|
97
|
+
name: TextMessage;
|
|
98
|
+
parent: TextMessage | undefined;
|
|
99
|
+
icon: SvgIcon | undefined;
|
|
100
|
+
group: ActionGroup | undefined;
|
|
101
|
+
/** The keys that the registry accepts */
|
|
102
|
+
shortcuts: ActionShortcut[];
|
|
103
|
+
level: ActionLevel;
|
|
104
|
+
/** The keys of the action work now */
|
|
105
|
+
active: boolean;
|
|
106
|
+
/** The reason why the action cannot run now */
|
|
107
|
+
disabledReason: TextMessage | undefined;
|
|
108
|
+
};
|
|
109
|
+
/** An action of the command palette, as it was when the palette opened */
|
|
110
|
+
export type PaletteAction = ActionInfo & {
|
|
111
|
+
keywords: string[];
|
|
112
|
+
palette: 'listed' | 'searchOnly';
|
|
113
|
+
/**
|
|
114
|
+
* Runs the action, if its component is still mounted and the action
|
|
115
|
+
* still applies. Gives `false` when the action did not run.
|
|
116
|
+
*/
|
|
117
|
+
run: () => boolean;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Holds the actions and listens to the keys of the whole page. Put it once
|
|
121
|
+
* near the root, inside the host services: a disabled action shows its
|
|
122
|
+
* reason with them. A second provider inside the first does nothing.
|
|
123
|
+
*/
|
|
124
|
+
export declare function ActionsProvider({ children }: {
|
|
125
|
+
children: ReactNode;
|
|
126
|
+
}): React.JSX.Element;
|
|
127
|
+
/**
|
|
128
|
+
* A layer of actions, for example a dialog. While it is open, the actions
|
|
129
|
+
* under it are off: all of them under a dialog, the page and the regions
|
|
130
|
+
* under a popover. An action with `layerSafe` stays on. A dialog that opens
|
|
131
|
+
* later is on top, also when it is not inside the other dialogs in the tree.
|
|
132
|
+
*/
|
|
133
|
+
export declare function ActionLayer({ kind, actions, active, children, }: {
|
|
134
|
+
/**
|
|
135
|
+
* A dialog hides all the actions under it, a popover hides the page. A
|
|
136
|
+
* dialog with its own `Main` hides the page, as a popover does.
|
|
137
|
+
*/
|
|
138
|
+
kind: ActionLayerKind;
|
|
139
|
+
/**
|
|
140
|
+
* The actions of the layer itself, for example Escape that closes the
|
|
141
|
+
* dialog. They are on while the layer is on top.
|
|
142
|
+
*/
|
|
143
|
+
actions?: readonly Action[];
|
|
144
|
+
/**
|
|
145
|
+
* The layer is on. A layer that stays in the page while it closes (an
|
|
146
|
+
* animation) gives `false`: the keys under it work again at once.
|
|
147
|
+
* @default true
|
|
148
|
+
*/
|
|
149
|
+
active?: boolean;
|
|
150
|
+
/** The content of the layer. Its actions belong to the layer. */
|
|
151
|
+
children: ReactNode;
|
|
152
|
+
}): React.JSX.Element;
|
|
153
|
+
/** The layer covers the page. Main calls it when it is in a layer. */
|
|
154
|
+
export declare function useLayerCoversPage(): void;
|
|
155
|
+
/**
|
|
156
|
+
* Whether a layer with its own `Main` covers the page. The host makes the
|
|
157
|
+
* page inert while it does.
|
|
158
|
+
*/
|
|
159
|
+
export declare function useIsPageCovered(): boolean;
|
|
160
|
+
type RegionRef = {
|
|
161
|
+
readonly current: Element | null;
|
|
162
|
+
};
|
|
163
|
+
type RegisterOptions = {
|
|
164
|
+
/**
|
|
165
|
+
* `app`: always on. `page`: on while the component is mounted.
|
|
166
|
+
* @default "page"
|
|
167
|
+
*/
|
|
168
|
+
level?: 'app' | 'page';
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Registers actions for the life of the component. With a ref first, the
|
|
172
|
+
* actions are on only while the pointer or the focus is in the element of
|
|
173
|
+
* the ref (a row, a pane, a toolbar). An `undefined` ref gives the page
|
|
174
|
+
* level (a pane part out of a Pane). A region wins over the page, and the
|
|
175
|
+
* page wins over the app. In two nested regions, the inner one wins.
|
|
176
|
+
* Between two registrations of the same level, the later one wins.
|
|
177
|
+
*/
|
|
178
|
+
export declare function useRegisterActions(actions: readonly Action[], options?: RegisterOptions): void;
|
|
179
|
+
export declare function useRegisterActions(region: RegionRef | undefined, actions: readonly Action[]): void;
|
|
180
|
+
/**
|
|
181
|
+
* The action with this id: the active one, else the one that would win
|
|
182
|
+
* when its region or its page is on. `Button` and `Dropdown.Option` read
|
|
183
|
+
* the name, the keys and the reason with it. With an `origin` in a region
|
|
184
|
+
* that has the id, it gives the action of that region (see `find`).
|
|
185
|
+
*/
|
|
186
|
+
export declare function useAction(id: string | undefined, origin?: Element | null): ActionInfo | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* Gives a function that runs an action by its id. A disabled action shows
|
|
189
|
+
* its reason. The function gives `false` when the action did not run. The
|
|
190
|
+
* `source` is `menu` by default. A menu gives the element of its dropdown
|
|
191
|
+
* as `origin` (see `find`).
|
|
192
|
+
*/
|
|
193
|
+
export declare function useRunAction(): (id: string, { source, origin, }?: {
|
|
194
|
+
source?: ActionSource;
|
|
195
|
+
origin?: Element | null;
|
|
196
|
+
}) => boolean;
|
|
197
|
+
/** The actions that work now, grouped by level, the winner first */
|
|
198
|
+
export declare function useActiveActions(): Record<ActionLevel, ActionInfo[]>;
|
|
199
|
+
/**
|
|
200
|
+
* One action for each id, the active ones first: the actions that work
|
|
201
|
+
* now, and the actions that work when their region, their page or their
|
|
202
|
+
* layer is on. The list of the shortcuts reads it.
|
|
203
|
+
*/
|
|
204
|
+
export declare function useRegisteredActions(): ActionInfo[];
|
|
205
|
+
/**
|
|
206
|
+
* Gives a function that reads the actions for the command palette: the
|
|
207
|
+
* active actions, the winner first, without the hidden ones. Read them
|
|
208
|
+
* before the palette opens: its dialog turns off the actions under it.
|
|
209
|
+
*/
|
|
210
|
+
export declare function useReadPaletteActions(): () => PaletteAction[];
|
|
211
|
+
export {};
|