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.
Files changed (201) hide show
  1. package/dist/Actions.d.ts +1 -0
  2. package/dist/Actions.js +4 -0
  3. package/dist/IconAvatar.d.ts +2 -0
  4. package/dist/IconAvatar.js +2 -0
  5. package/dist/ListDetail.js +2 -2
  6. package/dist/Pane.js +2 -1
  7. package/dist/SplitPane.js +2 -2
  8. package/dist/react-ui/src/Canvas.d.ts +2 -1
  9. package/dist/react-ui/src/Canvas.js +8 -6
  10. package/dist/react-ui/src/ContextInspector.js +2 -2
  11. package/dist/react-ui/src/messageText.js +1 -1
  12. package/dist/styles.css +330 -195
  13. package/dist/ui/icons/brands/gitlab.js +15 -0
  14. package/dist/ui/icons/custom/netlify.js +7 -29
  15. package/dist/ui/icons/custom/vercel.js +1 -4
  16. package/dist/ui/icons/index.js +206 -195
  17. package/dist/ui/icons/regular/command.js +16 -0
  18. package/dist/ui/icons/regular/keyboard.js +16 -0
  19. package/dist/ui/icons/regular/list-tree.js +2 -1
  20. package/dist/ui/icons/regular/list.js +2 -1
  21. package/dist/ui/icons/regular/memo.js +2 -1
  22. package/dist/ui/locales/en.js +10 -3
  23. package/dist/ui/src/BundledTexts.js +2 -2
  24. package/dist/ui/src/UiTextKey.d.ts +1 -1
  25. package/dist/ui/src/actions/Actions/ActionTooltip.js +24 -0
  26. package/dist/ui/src/actions/Actions/Shortcut.d.ts +23 -0
  27. package/dist/ui/src/actions/Actions/Shortcut.js +45 -0
  28. package/dist/ui/src/actions/Actions/index.d.ts +3 -0
  29. package/dist/ui/src/actions/Actions/index.js +3 -0
  30. package/dist/ui/src/actions/Actions/registry.d.ts +211 -0
  31. package/dist/ui/src/actions/Actions/registry.js +580 -0
  32. package/dist/ui/src/actions/Actions/shortcuts.d.ts +85 -0
  33. package/dist/ui/src/actions/Actions/shortcuts.js +284 -0
  34. package/dist/ui/src/actions/Button.d.ts +13 -12
  35. package/dist/ui/src/actions/Button.js +8 -7
  36. package/dist/ui/src/actions/Dropdown/DropdownContext.js +2 -1
  37. package/dist/ui/src/actions/Dropdown/Footer.js +1 -1
  38. package/dist/ui/src/actions/Dropdown/Menu.d.ts +2 -1
  39. package/dist/ui/src/actions/Dropdown/Menu.js +43 -37
  40. package/dist/ui/src/actions/Dropdown/MenuContent.js +22 -12
  41. package/dist/ui/src/actions/Dropdown/MenuParts.js +3 -3
  42. package/dist/ui/src/actions/Dropdown/Option.d.ts +20 -3
  43. package/dist/ui/src/actions/Dropdown/Option.js +48 -9
  44. package/dist/ui/src/actions/Dropdown/OptionAction.js +1 -1
  45. package/dist/ui/src/actions/Dropdown/Submenu.js +2 -2
  46. package/dist/ui/src/actions/Dropdown/index.d.ts +4 -1
  47. package/dist/ui/src/actions/Dropdown/index.js +6 -4
  48. package/dist/ui/src/actions/Dropdown/triggers/ButtonTrigger.d.ts +4 -4
  49. package/dist/ui/src/actions/Dropdown/triggers/ButtonTrigger.js +7 -6
  50. package/dist/ui/src/actions/Dropdown/triggers/PillTrigger.js +1 -1
  51. package/dist/ui/src/actions/Dropdown/triggers/TextualTrigger.js +1 -1
  52. package/dist/ui/src/actions/EditorToolbar/Button.js +2 -2
  53. package/dist/ui/src/actions/EditorToolbar/Buttons.js +2 -2
  54. package/dist/ui/src/actions/EditorToolbar/index.js +1 -1
  55. package/dist/ui/src/actions/MultipleSelectionActionBar.d.ts +20 -3
  56. package/dist/ui/src/actions/MultipleSelectionActionBar.js +25 -7
  57. package/dist/ui/src/actions/SplitButton/Caret.js +1 -1
  58. package/dist/ui/src/actions/SplitButton/index.js +1 -1
  59. package/dist/ui/src/actions/disabledReason.js +1 -1
  60. package/dist/ui/src/content/Avatar.d.ts +5 -3
  61. package/dist/ui/src/content/Avatar.js +4 -3
  62. package/dist/ui/src/content/CodeSnippet.js +1 -1
  63. package/dist/ui/src/content/CopyButton.js +1 -1
  64. package/dist/ui/src/content/CopyableId.d.ts +6 -1
  65. package/dist/ui/src/content/CopyableId.js +5 -2
  66. package/dist/ui/src/content/CopyableValue.js +2 -2
  67. package/dist/ui/src/content/FeedbackDot.js +1 -1
  68. package/dist/ui/src/content/IconAvatar.d.ts +42 -0
  69. package/dist/ui/src/content/IconAvatar.js +36 -0
  70. package/dist/ui/src/content/InitialsAvatar.js +1 -2
  71. package/dist/ui/src/content/Pill.js +3 -3
  72. package/dist/ui/src/content/SmartDate.js +1 -1
  73. package/dist/ui/src/content/UploadThreatTriangle.js +1 -1
  74. package/dist/ui/src/content/UsageMeter.d.ts +2 -1
  75. package/dist/ui/src/content/UsageMeter.js +3 -2
  76. package/dist/ui/src/content/ValidityTriangles.js +3 -3
  77. package/dist/ui/src/feedback/BlankSlate.js +2 -2
  78. package/dist/ui/src/feedback/Callout.js +2 -2
  79. package/dist/ui/src/feedback/ProgressBar.js +1 -1
  80. package/dist/ui/src/form/AutosizeInput.js +1 -1
  81. package/dist/ui/src/form/FieldHint.js +1 -1
  82. package/dist/ui/src/form/FieldWrapper.js +1 -1
  83. package/dist/ui/src/form/InputGroup.js +1 -1
  84. package/dist/ui/src/form/Label.js +2 -2
  85. package/dist/ui/src/form/PasswordInput.js +1 -1
  86. package/dist/ui/src/form/RadioGroupInput.js +1 -1
  87. package/dist/ui/src/form/SelectInput/SelectMenu.js +3 -3
  88. package/dist/ui/src/form/SelectInput/SelectMultiValueRemove.js +7 -0
  89. package/dist/ui/src/form/SelectInput/SelectOption.js +1 -1
  90. package/dist/ui/src/form/SelectInput/SortableMultiValue.js +1 -1
  91. package/dist/ui/src/form/StringInput.js +1 -1
  92. package/dist/ui/src/form/SwitchInput.d.ts +2 -0
  93. package/dist/ui/src/form/SwitchInput.js +4 -3
  94. package/dist/ui/src/form/SwitchList.js +1 -1
  95. package/dist/ui/src/form/TableList.js +2 -2
  96. package/dist/ui/src/form/TextareaInput.js +1 -1
  97. package/dist/ui/src/i18n.js +6 -6
  98. package/dist/ui/src/layout/ListOrOverview.js +3 -3
  99. package/dist/ui/src/layout/Page/Page.js +1 -1
  100. package/dist/ui/src/layout/Page/PageContent.js +1 -1
  101. package/dist/ui/src/layout/Page/PageGroup.js +2 -2
  102. package/dist/ui/src/layout/Page/PageSection.js +1 -1
  103. package/dist/ui/src/layout/Pane/ListFilter.js +6 -12
  104. package/dist/ui/src/layout/Pane/PaneHeader.js +3 -3
  105. package/dist/ui/src/layout/Pane/PaneRegion.d.ts +14 -0
  106. package/dist/ui/src/layout/Pane/PaneRegion.js +23 -0
  107. package/dist/ui/src/layout/Pane/index.d.ts +1 -0
  108. package/dist/ui/src/layout/Pane/index.js +36 -32
  109. package/dist/ui/src/layout/SidebarPanel.js +1 -1
  110. package/dist/ui/src/layout/SplitPane.d.ts +2 -0
  111. package/dist/ui/src/layout/SplitPane.js +79 -37
  112. package/dist/ui/src/layout/SplitView/SashActionButton.js +17 -9
  113. package/dist/ui/src/layout/SplitView/SplitView.js +1 -1
  114. package/dist/ui/src/layout/SplitView/SplitViewSash.js +2 -1
  115. package/dist/ui/src/layout/Toolbar/AddNewButton.d.ts +10 -6
  116. package/dist/ui/src/layout/Toolbar/AddNewButton.js +10 -23
  117. package/dist/ui/src/layout/Toolbar/Divider.d.ts +8 -0
  118. package/dist/ui/src/layout/Toolbar/Divider.js +16 -0
  119. package/dist/ui/src/layout/Toolbar/DotsDropdown.d.ts +8 -1
  120. package/dist/ui/src/layout/Toolbar/DotsDropdown.js +3 -2
  121. package/dist/ui/src/layout/Toolbar/Fill.js +1 -1
  122. package/dist/ui/src/layout/Toolbar/FilterInput.d.ts +7 -3
  123. package/dist/ui/src/layout/Toolbar/FilterInput.js +62 -49
  124. package/dist/ui/src/layout/Toolbar/FilterToggle.d.ts +6 -4
  125. package/dist/ui/src/layout/Toolbar/FilterToggle.js +42 -7
  126. package/dist/ui/src/layout/Toolbar/GoBack.d.ts +6 -1
  127. package/dist/ui/src/layout/Toolbar/GoBack.js +12 -5
  128. package/dist/ui/src/layout/Toolbar/Group.js +1 -1
  129. package/dist/ui/src/layout/Toolbar/Help.js +3 -3
  130. package/dist/ui/src/layout/Toolbar/Pagination.js +2 -2
  131. package/dist/ui/src/layout/Toolbar/PresetsTitle.js +3 -3
  132. package/dist/ui/src/layout/Toolbar/PrimaryButton.d.ts +3 -3
  133. package/dist/ui/src/layout/Toolbar/PrimaryButton.js +2 -2
  134. package/dist/ui/src/layout/Toolbar/Root.d.ts +6 -1
  135. package/dist/ui/src/layout/Toolbar/Root.js +13 -2
  136. package/dist/ui/src/layout/Toolbar/Search.d.ts +2 -1
  137. package/dist/ui/src/layout/Toolbar/Search.js +8 -3
  138. package/dist/ui/src/layout/Toolbar/context.js +2 -1
  139. package/dist/ui/src/layout/Toolbar/index.d.ts +5 -3
  140. package/dist/ui/src/layout/Toolbar/index.js +2 -0
  141. package/dist/ui/src/lists/CardList.d.ts +7 -2
  142. package/dist/ui/src/lists/CardList.js +7 -6
  143. package/dist/ui/src/lists/EmptySlot.js +2 -2
  144. package/dist/ui/src/lists/EntityRow.js +1 -1
  145. package/dist/ui/src/lists/InfoList.js +8 -3
  146. package/dist/ui/src/lists/InsertGap.js +4 -4
  147. package/dist/ui/src/lists/MediaCard.d.ts +10 -0
  148. package/dist/ui/src/lists/MediaCard.js +9 -4
  149. package/dist/ui/src/lists/RowList.js +2 -2
  150. package/dist/ui/src/lists/SettingsList.js +1 -1
  151. package/dist/ui/src/lists/Table/Body.js +1 -1
  152. package/dist/ui/src/lists/Table/Cell.js +1 -1
  153. package/dist/ui/src/lists/Table/ColumnsMenu.js +1 -1
  154. package/dist/ui/src/lists/Table/Header.js +8 -10
  155. package/dist/ui/src/lists/Table/HeaderCell.js +2 -2
  156. package/dist/ui/src/lists/Table/Row.d.ts +7 -1
  157. package/dist/ui/src/lists/Table/Row.js +6 -2
  158. package/dist/ui/src/lists/Table/Table.js +1 -1
  159. package/dist/ui/src/lists/Table/TreeToggle.js +1 -1
  160. package/dist/ui/src/lists/Table/index.d.ts +1 -1
  161. package/dist/ui/src/lists/Table/layout.d.ts +3 -2
  162. package/dist/ui/src/lists/Table/layout.js +26 -13
  163. package/dist/ui/src/lists/dnd/DragHandle.js +1 -1
  164. package/dist/ui/src/lists/dnd/DropIndicator.js +1 -1
  165. package/dist/ui/src/lists/dnd/SortableList.js +2 -2
  166. package/dist/ui/src/lists/dnd/tree/SortableTree.js +1 -1
  167. package/dist/ui/src/navigation/Chevron.js +2 -2
  168. package/dist/ui/src/navigation/SegmentedControl.d.ts +23 -4
  169. package/dist/ui/src/navigation/SegmentedControl.js +23 -5
  170. package/dist/ui/src/navigation/SettingsMenu.js +3 -3
  171. package/dist/ui/src/navigation/SidebarTree/SidebarTreeNode.js +3 -3
  172. package/dist/ui/src/navigation/SidebarTree/SidebarTreeNodeActions.js +1 -1
  173. package/dist/ui/src/navigation/Tabs.js +1 -1
  174. package/dist/ui/src/overlays/FullscreenModal.js +48 -53
  175. package/dist/ui/src/overlays/HoverCard.js +4 -4
  176. package/dist/ui/src/overlays/Modal.d.ts +7 -0
  177. package/dist/ui/src/overlays/Modal.js +53 -55
  178. package/dist/ui/src/overlays/Popover.d.ts +6 -3
  179. package/dist/ui/src/overlays/Popover.js +13 -8
  180. package/dist/ui/src/overlays/Portal.js +1 -1
  181. package/dist/ui/src/overlays/Tooltip.d.ts +6 -3
  182. package/dist/ui/src/overlays/Tooltip.js +29 -13
  183. package/dist/ui/src/overlays/useModalClose.js +17 -12
  184. package/dist/ui/src/patterns/ListDetail/Page.d.ts +9 -0
  185. package/dist/ui/src/patterns/ListDetail/Page.js +33 -26
  186. package/dist/ui/src/patterns/ListDetail/Panel.js +4 -2
  187. package/dist/ui/src/patterns/ListDetail/Split.d.ts +5 -0
  188. package/dist/ui/src/patterns/ListDetail/Split.js +75 -56
  189. package/dist/ui/src/patterns/ListDetail/index.d.ts +2 -2
  190. package/dist/ui/src/patterns/ListDetail/index.js +2 -2
  191. package/dist/ui/src/patterns/ListFormPage.js +2 -2
  192. package/dist/ui/src/semantic/Main.d.ts +4 -1
  193. package/dist/ui/src/semantic/Main.js +53 -3
  194. package/dist/ui/src/semantic/NavigationFocusProvider.js +9 -0
  195. package/package.json +1 -1
  196. package/dist/HotKey.d.ts +0 -1
  197. package/dist/HotKey.js +0 -2
  198. package/dist/ui/src/actions/HotKey.d.ts +0 -98
  199. package/dist/ui/src/actions/HotKey.js +0 -270
  200. package/dist/ui/src/actions/hotKeyContext.d.ts +0 -32
  201. package/dist/ui/src/actions/hotKeyContext.js +0 -15
@@ -1,12 +1,12 @@
1
+ import { Generic } from "../../icons/index.js";
2
+ import { ActionLayer } from "../actions/Actions/registry.js";
1
3
  import { useTranslation } from "../i18n.js";
2
4
  import NewZIndex from "./NewZIndex.js";
3
5
  import Button from "../actions/Button.js";
4
6
  import Portal from "./Portal.js";
5
- import { HotKeyListener, HotKeyStack } from "../actions/HotKey.js";
6
- import { Generic } from "../../icons/index.js";
7
- import { ModalCloseContext, useDialogLayer, useModalClose } from "./useModalClose.js";
7
+ import { ModalCloseContext, closeAction, useDialogLayer, useModalClose } from "./useModalClose.js";
8
8
  import React, { useContext, useState } from "react";
9
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
10
  //#region ../ui/src/overlays/FullscreenModal.tsx
11
11
  var FullscreenModalTitleContext = React.createContext(null);
12
12
  /**
@@ -18,7 +18,7 @@ var FullscreenModalTitleContext = React.createContext(null);
18
18
  function useFullscreenModalTitle() {
19
19
  const { tc } = useTranslation();
20
20
  const title = useContext(FullscreenModalTitleContext);
21
- return title ? /* @__PURE__ */ jsx(Fragment, { children: tc(title) }) : null;
21
+ return title ? /* @__PURE__ */ jsx(Fragment$1, { children: tc(title) }) : null;
22
22
  }
23
23
  var nextTitleId = 0;
24
24
  /**
@@ -30,56 +30,51 @@ var FullscreenModal = React.memo(function FullscreenModal({ title, ariaLabel, on
30
30
  const [titleId] = useState(() => `FullscreenModal__title-${++nextTitleId}`);
31
31
  const layer = useDialogLayer();
32
32
  const { didMount, dialogRef, locale, handleClose, contextValue } = useModalClose({ onClose });
33
- return /* @__PURE__ */ jsx(HotKeyStack, {
34
- forceStackPriority: layer.hotKeyPriority,
35
- children: /* @__PURE__ */ jsx(HotKeyListener, {
36
- hotKey: "escape",
37
- description: { id: "hotkeys.closeModal" },
38
- trigger: handleClose,
39
- enabled: !!onClose,
40
- children: /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(FullscreenModalTitleContext.Provider, {
41
- value: title ?? null,
42
- children: /* @__PURE__ */ jsx(ModalCloseContext.Provider, {
43
- value: contextValue,
44
- children: /* @__PURE__ */ jsx(NewZIndex, {
45
- forcedValue: layer.zIndex,
46
- children: (zIndex) => /* @__PURE__ */ jsxs("div", {
47
- className: "Modal Modal--fullscreen",
48
- style: { zIndex },
49
- children: [/* @__PURE__ */ jsx("div", { className: "Modal__backdrop" }), /* @__PURE__ */ jsxs("div", {
50
- ref: dialogRef,
51
- role: "dialog",
52
- "aria-modal": "true",
53
- lang: locale,
54
- className: "Modal__content",
55
- "aria-labelledby": title ? titleId : void 0,
56
- "aria-label": ariaLabel ? tm(ariaLabel) : void 0,
57
- children: [
58
- title && /* @__PURE__ */ jsx("span", {
59
- id: titleId,
60
- hidden: true,
61
- children: tc(title)
62
- }),
63
- onClose && /* @__PURE__ */ jsx(Button, {
64
- tone: "ghost",
65
- size: "large",
66
- iconOnly: true,
67
- icon: Generic.CloseIcon,
68
- label: { id: "modal.close" },
69
- className: "Modal__close",
70
- onClick: handleClose
71
- }),
72
- /* @__PURE__ */ jsx("div", {
73
- className: "Modal__content__inner",
74
- children: didMount && children
75
- })
76
- ]
77
- })]
78
- })
33
+ return /* @__PURE__ */ jsx(ActionLayer, {
34
+ kind: "dialog",
35
+ actions: onClose ? [closeAction(handleClose)] : void 0,
36
+ children: /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(FullscreenModalTitleContext.Provider, {
37
+ value: title ?? null,
38
+ children: /* @__PURE__ */ jsx(ModalCloseContext.Provider, {
39
+ value: contextValue,
40
+ children: /* @__PURE__ */ jsx(NewZIndex, {
41
+ forcedValue: layer.zIndex,
42
+ children: (zIndex) => /* @__PURE__ */ jsxs("div", {
43
+ className: "Modal Modal--fullscreen",
44
+ style: { zIndex },
45
+ children: [/* @__PURE__ */ jsx("div", { className: "Modal__backdrop" }), /* @__PURE__ */ jsxs("div", {
46
+ ref: dialogRef,
47
+ role: "dialog",
48
+ "aria-modal": "true",
49
+ lang: locale,
50
+ className: "Modal__content",
51
+ "aria-labelledby": title ? titleId : void 0,
52
+ "aria-label": ariaLabel ? tm(ariaLabel) : void 0,
53
+ children: [
54
+ title && /* @__PURE__ */ jsx("span", {
55
+ id: titleId,
56
+ hidden: true,
57
+ children: tc(title)
58
+ }),
59
+ onClose && /* @__PURE__ */ jsx(Button, {
60
+ tone: "ghost",
61
+ size: "large",
62
+ iconOnly: true,
63
+ icon: Generic.CloseIcon,
64
+ label: { id: "modal.close" },
65
+ className: "Modal__close",
66
+ onClick: handleClose
67
+ }),
68
+ /* @__PURE__ */ jsx("div", {
69
+ className: "Modal__content__inner",
70
+ children: didMount && children
71
+ })
72
+ ]
73
+ })]
79
74
  })
80
75
  })
81
- }) })
82
- })
76
+ })
77
+ }) })
83
78
  });
84
79
  });
85
80
  //#endregion
@@ -1,9 +1,9 @@
1
- import NewZIndex from "./NewZIndex.js";
2
1
  import { cloneTrigger } from "./floatingTrigger.js";
3
- import { floatingMiddleware } from "./Popover.js";
2
+ import NewZIndex from "./NewZIndex.js";
4
3
  import Portal from "./Portal.js";
4
+ import { floatingMiddleware } from "./Popover.js";
5
5
  import { useState } from "react";
6
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { autoUpdate, safePolygon, useDismiss, useFloating, useFocus, useHover, useInteractions } from "@floating-ui/react";
8
8
  //#region ../ui/src/overlays/HoverCard.tsx
9
9
  var HOVER_CARD_DELAY = {
@@ -37,7 +37,7 @@ function HoverCard({ children, content, placement = "top", offset = { mainAxis:
37
37
  useFocus(context, { enabled }),
38
38
  useDismiss(context, { enabled })
39
39
  ]);
40
- return /* @__PURE__ */ jsxs(Fragment, { children: [cloneTrigger(children, refs.setReference, getReferenceProps), isOpen && enabled && /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(NewZIndex, { children: (zIndex) => /* @__PURE__ */ jsx("div", {
40
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [cloneTrigger(children, refs.setReference, getReferenceProps), isOpen && enabled && /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(NewZIndex, { children: (zIndex) => /* @__PURE__ */ jsx("div", {
41
41
  ref: refs.setFloating,
42
42
  className: "HoverCard",
43
43
  style: {
@@ -30,6 +30,13 @@ export type ModalProps = ModalName & {
30
30
  * @default false
31
31
  */
32
32
  freeContent?: boolean;
33
+ /**
34
+ * `false`: the dialog has no cross. Escape and a click out of the panel
35
+ * close it. For a dialog whose field keeps the focus, for example the
36
+ * command palette.
37
+ * @default true
38
+ */
39
+ closeButton?: boolean;
33
40
  /**
34
41
  * The maximum width: "s" (600px), "m" (700px), "l" (900px) or "xl"
35
42
  * (1010px). A number of pixels is only for a plugin that gives the width of
@@ -1,13 +1,13 @@
1
+ import { Generic } from "../../icons/index.js";
2
+ import { ActionLayer } from "../actions/Actions/registry.js";
1
3
  import { useTranslation } from "../i18n.js";
2
4
  import NewZIndex from "./NewZIndex.js";
3
5
  import Button from "../actions/Button.js";
4
6
  import Portal from "./Portal.js";
5
- import { HotKeyListener, HotKeyStack } from "../actions/HotKey.js";
6
- import { Generic } from "../../icons/index.js";
7
7
  import Root from "../layout/Toolbar/Root.js";
8
8
  import Title from "../layout/Toolbar/Title.js";
9
9
  import Space from "../layout/Toolbar/Space.js";
10
- import { ModalCloseContext, useDialogLayer, useModalClose } from "./useModalClose.js";
10
+ import { ModalCloseContext, closeAction, useDialogLayer, useModalClose } from "./useModalClose.js";
11
11
  import React, { useContext, useState } from "react";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
13
  //#region ../ui/src/overlays/Modal.tsx
@@ -22,14 +22,14 @@ var nextTitleId = 0;
22
22
  * A dialog over the page, with a header, a body and a footer. For a task
23
23
  * that needs all the screen, use FullscreenModal.
24
24
  */
25
- var Modal = React.memo(function Modal({ onClose, children, title, ariaLabel, freeContent = false, width }) {
25
+ var Modal = React.memo(function Modal({ onClose, children, title, ariaLabel, freeContent = false, closeButton: showCloseButton = true, width }) {
26
26
  const { tc, tm } = useTranslation();
27
27
  const [titleId] = useState(() => `Modal__header-${++nextTitleId}`);
28
28
  const layer = useDialogLayer();
29
29
  const { didMount, dialogRef, locale, handleClose, contextValue } = useModalClose({ onClose });
30
30
  const maxWidth = typeof width === "number" ? width : widthShortcuts[width ?? "s"];
31
31
  const hasHeader = Boolean(title);
32
- const closeButton = onClose && /* @__PURE__ */ jsx(Button, {
32
+ const closeButton = onClose && showCloseButton && /* @__PURE__ */ jsx(Button, {
33
33
  tone: "ghost",
34
34
  size: "micro",
35
35
  iconOnly: true,
@@ -38,57 +38,55 @@ var Modal = React.memo(function Modal({ onClose, children, title, ariaLabel, fre
38
38
  className: hasHeader ? "Modal__header__close" : "Modal__floating-close",
39
39
  onClick: handleClose
40
40
  });
41
- return /* @__PURE__ */ jsx(HotKeyStack, {
42
- forceStackPriority: layer.hotKeyPriority,
43
- children: /* @__PURE__ */ jsx(HotKeyListener, {
44
- hotKey: "escape",
45
- description: { id: "hotkeys.closeModal" },
46
- trigger: handleClose,
47
- enabled: !!onClose,
48
- children: /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(NewZIndex, {
49
- forcedValue: layer.zIndex,
50
- children: (zIndex) => /* @__PURE__ */ jsx(ModalCloseContext.Provider, {
51
- value: contextValue,
52
- children: /* @__PURE__ */ jsxs("div", {
53
- className: "Modal Modal--dialog",
54
- style: { zIndex },
55
- children: [/* @__PURE__ */ jsx("div", { className: "Modal__backdrop" }), /* @__PURE__ */ jsx("div", {
56
- ref: dialogRef,
57
- role: "dialog",
58
- "aria-modal": "true",
59
- lang: locale,
60
- className: "Modal__content",
61
- "aria-labelledby": hasHeader ? titleId : void 0,
62
- "aria-label": ariaLabel ? tm(ariaLabel) : void 0,
63
- style: { maxWidth: `${maxWidth}px` },
64
- children: /* @__PURE__ */ jsxs("div", {
65
- className: "Modal__content__inner",
66
- children: [
67
- hasHeader ? /* @__PURE__ */ jsxs(Root, {
68
- borderBottom: true,
69
- className: "Modal__header",
70
- children: [
71
- /* @__PURE__ */ jsx(Title, {
72
- level: 1,
73
- id: titleId,
74
- children: title && tc(title)
75
- }),
76
- /* @__PURE__ */ jsx(Space, {}),
77
- closeButton
78
- ]
79
- }) : closeButton,
80
- freeContent && didMount && children,
81
- !freeContent && didMount && /* @__PURE__ */ jsx("div", {
82
- className: "Modal__body",
83
- children
84
- })
85
- ]
86
- })
87
- })]
88
- })
41
+ return /* @__PURE__ */ jsx(ActionLayer, {
42
+ kind: "dialog",
43
+ actions: onClose ? [closeAction(handleClose)] : void 0,
44
+ children: /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(NewZIndex, {
45
+ forcedValue: layer.zIndex,
46
+ children: (zIndex) => /* @__PURE__ */ jsx(ModalCloseContext.Provider, {
47
+ value: contextValue,
48
+ children: /* @__PURE__ */ jsxs("div", {
49
+ className: "Modal Modal--dialog",
50
+ style: { zIndex },
51
+ onClick: onClose && !showCloseButton ? (event) => {
52
+ if (event.target === event.currentTarget) handleClose(event);
53
+ } : void 0,
54
+ children: [/* @__PURE__ */ jsx("div", { className: "Modal__backdrop" }), /* @__PURE__ */ jsx("div", {
55
+ ref: dialogRef,
56
+ role: "dialog",
57
+ "aria-modal": "true",
58
+ lang: locale,
59
+ className: "Modal__content",
60
+ "aria-labelledby": hasHeader ? titleId : void 0,
61
+ "aria-label": ariaLabel ? tm(ariaLabel) : void 0,
62
+ style: { maxWidth: `${maxWidth}px` },
63
+ children: /* @__PURE__ */ jsxs("div", {
64
+ className: "Modal__content__inner",
65
+ children: [
66
+ hasHeader ? /* @__PURE__ */ jsxs(Root, {
67
+ borderBottom: true,
68
+ className: "Modal__header",
69
+ children: [
70
+ /* @__PURE__ */ jsx(Title, {
71
+ level: 1,
72
+ id: titleId,
73
+ children: title && tc(title)
74
+ }),
75
+ /* @__PURE__ */ jsx(Space, {}),
76
+ closeButton
77
+ ]
78
+ }) : closeButton,
79
+ freeContent && didMount && children,
80
+ !freeContent && didMount && /* @__PURE__ */ jsx("div", {
81
+ className: "Modal__body",
82
+ children
83
+ })
84
+ ]
85
+ })
86
+ })]
89
87
  })
90
- }) })
91
- })
88
+ })
89
+ }) })
92
90
  });
93
91
  });
94
92
  /**
@@ -32,10 +32,13 @@ export type PopoverProps = {
32
32
  /**
33
33
  * The focus goes into the popover when it opens, and comes back to where
34
34
  * it was when the popover closes. Give it when the user opens the popover
35
- * with a button or a key. Do not give it when the popover opens from a
36
- * field where the user types.
35
+ * with a button or a key. Do not give `true` when the popover opens from a
36
+ * field where the user types: give a selector, and the focus goes to the
37
+ * first element of the popover that matches it, for example `"input"`. The
38
+ * user goes on typing there. When no element matches, the focus stays where
39
+ * it is.
37
40
  */
38
- autoFocus?: boolean;
41
+ autoFocus?: boolean | string;
39
42
  };
40
43
  export declare function floatingMiddleware(offsetOptions: OffsetOptions): Middleware[];
41
44
  /**
@@ -1,8 +1,8 @@
1
- import { useClickOutside } from "../hooks/useClickOutside.js";
1
+ import { ActionLayer } from "../actions/Actions/registry.js";
2
2
  import { useTranslation } from "../i18n.js";
3
3
  import NewZIndex from "./NewZIndex.js";
4
+ import { useClickOutside } from "../hooks/useClickOutside.js";
4
5
  import Portal from "./Portal.js";
5
- import { HotKeyListener, HotKeyStack } from "../actions/HotKey.js";
6
6
  import { useEffect, useRef } from "react";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  import mergeRefs from "@react-hook/merged-ref";
@@ -43,7 +43,7 @@ function Popover({ anchorElement, placement = "top", offset: offsetOptions = { m
43
43
  useEffect(() => {
44
44
  if (!autoFocus) return;
45
45
  const previous = document.activeElement;
46
- dialogRef.current?.focus({ preventScroll: true });
46
+ (typeof autoFocus === "string" ? dialogRef.current?.querySelector(autoFocus) : dialogRef.current)?.focus({ preventScroll: true });
47
47
  return () => {
48
48
  if (!document.activeElement || document.activeElement === document.body) previous?.focus?.();
49
49
  };
@@ -61,12 +61,17 @@ function Popover({ anchorElement, placement = "top", offset: offsetOptions = { m
61
61
  children
62
62
  }) }) });
63
63
  if (!onClose) return content;
64
- return /* @__PURE__ */ jsx(HotKeyStack, { children: /* @__PURE__ */ jsx(HotKeyListener, {
65
- hotKey: "escape",
66
- description: { id: "hotkeys.closePopover" },
67
- trigger: onClose,
64
+ return /* @__PURE__ */ jsx(ActionLayer, {
65
+ kind: "popover",
66
+ actions: [{
67
+ id: "popover.close",
68
+ name: { id: "hotkeys.closePopover" },
69
+ shortcut: { key: "escape" },
70
+ palette: "hidden",
71
+ run: onClose
72
+ }],
68
73
  children: content
69
- }) });
74
+ });
70
75
  }
71
76
  //#endregion
72
77
  export { Popover as default, floatingMiddleware };
@@ -1,6 +1,6 @@
1
+ import { usePortalWrapper } from "./PortalWrapper.js";
1
2
  import { ButtonSizeContext } from "../actions/Button.js";
2
3
  import { InToolbarContext } from "../layout/Toolbar/context.js";
3
- import { usePortalWrapper } from "./PortalWrapper.js";
4
4
  import React, { useLayoutEffect, useRef } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import ReactDOM from "react-dom";
@@ -1,5 +1,6 @@
1
1
  import { type OffsetOptions, type Placement } from '@floating-ui/react';
2
2
  import React, { ReactNode } from 'react';
3
+ import { type ActionShortcut } from '../actions/Actions/shortcuts.js';
3
4
  import { type Message } from '../Message.js';
4
5
  import { type FloatingTrigger } from './floatingTrigger.js';
5
6
  export type TooltipProps = {
@@ -16,10 +17,12 @@ export type TooltipProps = {
16
17
  */
17
18
  label: Message | false | null | undefined;
18
19
  /**
19
- * The keys of a keyboard shortcut, shown after the label, for example
20
- * "mod+s". "mod" is Cmd on a Mac and Ctrl on other systems.
20
+ * The keys of a keyboard shortcut, shown after the label: the keys of an
21
+ * action (`{ key: 's', mod: true }`), or a string in the format of
22
+ * `is-hotkey` ("mod+s"), as the text editors give them. "mod" is Cmd on a
23
+ * Mac and Ctrl on other systems.
21
24
  */
22
- shortcut?: string;
25
+ shortcut?: string | ActionShortcut | ActionShortcut[];
23
26
  /**
24
27
  * Use it for a paragraph or a list: the text is aligned at the start and
25
28
  * the tooltip is wider.
@@ -1,19 +1,27 @@
1
+ import { parseShortcut } from "../actions/Actions/shortcuts.js";
1
2
  import { useTranslation } from "../i18n.js";
2
- import NewZIndex from "./NewZIndex.js";
3
+ import { Shortcut } from "../actions/Actions/Shortcut.js";
3
4
  import { cloneTrigger } from "./floatingTrigger.js";
4
- import { floatingMiddleware } from "./Popover.js";
5
+ import NewZIndex from "./NewZIndex.js";
5
6
  import Portal from "./Portal.js";
6
- import { HotKey } from "../actions/HotKey.js";
7
+ import { floatingMiddleware } from "./Popover.js";
7
8
  import React, { useState } from "react";
8
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  import classNames from "classnames";
10
- import { NextFloatingDelayGroup, autoUpdate, useDismiss, useFloating, useFocus, useHover, useInteractions, useNextDelayGroup, useRole } from "@floating-ui/react";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
+ import { NextFloatingDelayGroup, autoUpdate, useDismiss, useFloating, useFocus, useHover, useInteractions, useNextDelayGroup, useRole, useTransitionStatus } from "@floating-ui/react";
11
12
  //#region ../ui/src/overlays/Tooltip.tsx
12
13
  var TOOLTIP_DELAY = {
13
- open: 250,
14
+ open: 450,
14
15
  close: 0
15
16
  };
16
17
  var TOOLTIP_GROUP_TIMEOUT = 300;
18
+ var TOOLTIP_FADE_OUT_MS = 200;
19
+ var TRANSFORM_ORIGIN = {
20
+ top: "50% 100%",
21
+ bottom: "50% 0",
22
+ left: "100% 50%",
23
+ right: "0 50%"
24
+ };
17
25
  /**
18
26
  * A small dark label about its trigger. It opens on hover and on keyboard
19
27
  * focus, and Escape closes it. It has no interactive content: for content
@@ -23,14 +31,20 @@ function Tooltip({ children, label, shortcut, long, placement = "top", offset =
23
31
  const { tc } = useTranslation();
24
32
  const [isOpen, setIsOpen] = useState(false);
25
33
  const enabled = Boolean(label);
26
- const { refs, floatingStyles, context } = useFloating({
34
+ const keys = typeof shortcut === "string" ? parseShortcut(shortcut) : shortcut;
35
+ const { refs, floatingStyles, context, placement: finalPlacement } = useFloating({
27
36
  open: isOpen && enabled,
28
37
  onOpenChange: setIsOpen,
29
38
  placement,
30
39
  whileElementsMounted: autoUpdate,
40
+ transform: false,
31
41
  middleware: floatingMiddleware(offset)
32
42
  });
33
- const { delayRef, hasProvider } = useNextDelayGroup(context, { enabled });
43
+ const { delayRef, hasProvider, isInstantPhase } = useNextDelayGroup(context, { enabled });
44
+ const { isMounted, status } = useTransitionStatus(context, { duration: {
45
+ open: 0,
46
+ close: isInstantPhase ? 0 : TOOLTIP_FADE_OUT_MS
47
+ } });
34
48
  const triggerProps = React.Children.only(children).props;
35
49
  const labelIsAccessibleName = typeof label === "string" && triggerProps["aria-label"] === label;
36
50
  const { getReferenceProps, getFloatingProps } = useInteractions([
@@ -45,21 +59,23 @@ function Tooltip({ children, label, shortcut, long, placement = "top", offset =
45
59
  role: "tooltip"
46
60
  })
47
61
  ]);
48
- return /* @__PURE__ */ jsxs(Fragment, { children: [cloneTrigger(children, refs.setReference, getReferenceProps), isOpen && enabled && /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(NewZIndex, { children: (zIndex) => /* @__PURE__ */ jsx("div", {
62
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [cloneTrigger(children, refs.setReference, getReferenceProps), isMounted && enabled && /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(NewZIndex, { children: (zIndex) => /* @__PURE__ */ jsx("div", {
49
63
  ref: refs.setFloating,
50
64
  className: classNames("Tooltip", {
51
65
  "Tooltip--long": long,
52
- "Tooltip--with-shortcut": shortcut
66
+ "Tooltip--with-shortcut": keys !== void 0,
67
+ "Tooltip--closing": status === "close"
53
68
  }),
54
69
  style: {
55
70
  ...floatingStyles,
56
- zIndex
71
+ zIndex,
72
+ transformOrigin: TRANSFORM_ORIGIN[finalPlacement.split("-")[0]]
57
73
  },
58
74
  ...getFloatingProps(),
59
- children: shortcut ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
75
+ children: keys ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
60
76
  className: "Tooltip__label",
61
77
  children: tc(label)
62
- }), /* @__PURE__ */ jsx(HotKey, { hotkey: shortcut })] }) : tc(label)
78
+ }), /* @__PURE__ */ jsx(Shortcut, { keys })] }) : tc(label)
63
79
  }) }) })] });
64
80
  }
65
81
  /**
@@ -1,6 +1,5 @@
1
1
  import { useHostServices } from "../HostServicesProvider.js";
2
2
  import { ZIndexContext } from "./NewZIndex.js";
3
- import { HotKeyContext } from "../actions/hotKeyContext.js";
4
3
  import { confirmQuestion, confirmTexts } from "./confirmQuestion.js";
5
4
  import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
6
5
  //#region ../ui/src/overlays/useModalClose.ts
@@ -10,19 +9,15 @@ var ModalCloseContext = React.createContext({
10
9
  });
11
10
  var openDialogLayers = [];
12
11
  /**
13
- * Gives a dialog its z-index and its hotkey priority. A dialog shows over its
14
- * parent layer and over all the dialogs that are open, also when it is not
15
- * inside them in the React tree (for example a dialog that opens from the
16
- * root of the app). Thus the last dialog that opens is on top and gets the
17
- * keys.
12
+ * Gives a dialog its z-index. A dialog shows over its parent layer and over
13
+ * all the dialogs that are open, also when it is not inside them in the
14
+ * React tree (for example a dialog that opens from the root of the app).
15
+ * Thus the last dialog that opens is on top. Its `ActionLayer` gets the
16
+ * keys in the same order.
18
17
  */
19
18
  function useDialogLayer() {
20
19
  const parentZIndex = useContext(ZIndexContext);
21
- const { currentStackPriority } = useContext(HotKeyContext);
22
- const [layer] = useState(() => ({
23
- zIndex: Math.max(parentZIndex, ...openDialogLayers.map((l) => l.zIndex)) + 10,
24
- hotKeyPriority: Math.max(currentStackPriority, ...openDialogLayers.map((l) => l.hotKeyPriority)) + 1
25
- }));
20
+ const [layer] = useState(() => ({ zIndex: Math.max(parentZIndex, ...openDialogLayers.map((l) => l.zIndex)) + 10 }));
26
21
  useLayoutEffect(() => {
27
22
  openDialogLayers.push(layer);
28
23
  return () => {
@@ -31,6 +26,16 @@ function useDialogLayer() {
31
26
  }, [layer]);
32
27
  return layer;
33
28
  }
29
+ /** The Escape of a dialog, for the `actions` of its `ActionLayer` */
30
+ function closeAction(close) {
31
+ return {
32
+ id: "modal.close",
33
+ name: { id: "hotkeys.closeModal" },
34
+ shortcut: { key: "escape" },
35
+ palette: "hidden",
36
+ run: () => close()
37
+ };
38
+ }
34
39
  /**
35
40
  * The focus of a dialog. When the dialog opens, the focus goes to the first
36
41
  * element that matches `initialFocus`, or to the dialog. When the dialog
@@ -126,4 +131,4 @@ React.memo(function ModalPrompt({ when, message, onConfirm }) {
126
131
  return null;
127
132
  });
128
133
  //#endregion
129
- export { ModalCloseContext, useDialogFocus, useDialogLayer, useModalClose };
134
+ export { ModalCloseContext, closeAction, useDialogFocus, useDialogLayer, useModalClose };
@@ -45,6 +45,7 @@ export type ListDetailPageProps = {
45
45
  open: boolean;
46
46
  onOpen: () => void;
47
47
  onToggle: () => void;
48
+ onClose: () => void;
48
49
  };
49
50
  form: ReactNode;
50
51
  };
@@ -99,6 +100,8 @@ export default _default;
99
100
  * of the id, for example "\\d+") when other routes are under the base URL:
100
101
  * then a route under the open row (for example "<baseUrl>/12/delete") keeps
101
102
  * the row open. It needs a host with a location (see NavigationProvider).
103
+ * `reopen` opens the last open row again, while no row is open: give it to
104
+ * `onReopen` of the detail.
102
105
  */
103
106
  export declare function useOpenRowRoute(baseUrl: string, idPattern?: string): {
104
107
  id: string | undefined;
@@ -106,4 +109,10 @@ export declare function useOpenRowRoute(baseUrl: string, idPattern?: string): {
106
109
  id: string;
107
110
  }) => void;
108
111
  close: () => void;
112
+ reopen: (() => void) | undefined;
109
113
  };
114
+ /**
115
+ * Opens the last open row again, for `onReopen` of the detail. It gives
116
+ * `undefined` while a row is open or before the first row opens.
117
+ */
118
+ export declare function useReopenLastRow(openId: string | undefined, open: (id: string) => void): (() => void) | undefined;