@mgamadeus/ddd-admin-ui 0.1.0-rc.4 → 0.1.0-rc.6

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 (213) hide show
  1. package/.claude/skills/ddd-admin-ui-specialist/SKILL.md +39 -4
  2. package/CHANGELOG.md +111 -0
  3. package/README.md +34 -10
  4. package/STANDARDS.md +118 -22
  5. package/dist/components.css +2 -2
  6. package/dist/form/DrawerFooter.d.ts +9 -1
  7. package/dist/form/DrawerFooter.d.ts.map +1 -1
  8. package/dist/form/DrawerFooter.js +33 -32
  9. package/dist/form/DrawerFooter.js.map +1 -1
  10. package/dist/form/FormActions.d.ts +18 -13
  11. package/dist/form/FormActions.d.ts.map +1 -1
  12. package/dist/form/FormActions.js +110 -33
  13. package/dist/form/FormActions.js.map +1 -1
  14. package/dist/form/FormDialog.d.ts +51 -0
  15. package/dist/form/FormDialog.d.ts.map +1 -0
  16. package/dist/form/FormDialog.js +75 -0
  17. package/dist/form/FormDialog.js.map +1 -0
  18. package/dist/form/FormHeader.d.ts +6 -1
  19. package/dist/form/FormHeader.d.ts.map +1 -1
  20. package/dist/form/FormHeader.js +1 -1
  21. package/dist/form/FormHeader.js.map +1 -1
  22. package/dist/form/FormSubmitButton.d.ts +6 -1
  23. package/dist/form/FormSubmitButton.d.ts.map +1 -1
  24. package/dist/form/FormSubmitButton.js +5 -2
  25. package/dist/form/FormSubmitButton.js.map +1 -1
  26. package/dist/form/index.d.ts +2 -0
  27. package/dist/form/index.d.ts.map +1 -1
  28. package/dist/form/index.js +1 -0
  29. package/dist/form/index.js.map +1 -1
  30. package/dist/form/linkSubmitButtons.d.ts +7 -0
  31. package/dist/form/linkSubmitButtons.d.ts.map +1 -0
  32. package/dist/form/linkSubmitButtons.js +27 -0
  33. package/dist/form/linkSubmitButtons.js.map +1 -0
  34. package/dist/form/saveShortcut.d.ts +25 -0
  35. package/dist/form/saveShortcut.d.ts.map +1 -0
  36. package/dist/form/saveShortcut.js +59 -0
  37. package/dist/form/saveShortcut.js.map +1 -0
  38. package/dist/form/useConfirmDialog.d.ts +3 -2
  39. package/dist/form/useConfirmDialog.d.ts.map +1 -1
  40. package/dist/form/useConfirmDialog.js +21 -18
  41. package/dist/form/useConfirmDialog.js.map +1 -1
  42. package/dist/i18n/hints.json +13 -7
  43. package/dist/i18n-keys.json +64 -10
  44. package/dist/list/Combobox.d.ts +33 -3
  45. package/dist/list/Combobox.d.ts.map +1 -1
  46. package/dist/list/Combobox.js +71 -13
  47. package/dist/list/Combobox.js.map +1 -1
  48. package/dist/list/CopyButton.d.ts +23 -0
  49. package/dist/list/CopyButton.d.ts.map +1 -0
  50. package/dist/list/CopyButton.js +28 -0
  51. package/dist/list/CopyButton.js.map +1 -0
  52. package/dist/list/EntityListBody.d.ts +2 -2
  53. package/dist/list/EntityListBody.d.ts.map +1 -1
  54. package/dist/list/EntityListBody.js +2 -2
  55. package/dist/list/EntityListBody.js.map +1 -1
  56. package/dist/list/EntityListBulkBar.d.ts +7 -1
  57. package/dist/list/EntityListBulkBar.d.ts.map +1 -1
  58. package/dist/list/EntityListBulkBar.js +5 -1
  59. package/dist/list/EntityListBulkBar.js.map +1 -1
  60. package/dist/list/EntityListEmpty.d.ts +6 -1
  61. package/dist/list/EntityListEmpty.d.ts.map +1 -1
  62. package/dist/list/EntityListEmpty.js +4 -1
  63. package/dist/list/EntityListEmpty.js.map +1 -1
  64. package/dist/list/EntityListTable.d.ts +3 -1
  65. package/dist/list/EntityListTable.d.ts.map +1 -1
  66. package/dist/list/EntityListTable.js +4 -4
  67. package/dist/list/EntityListTable.js.map +1 -1
  68. package/dist/list/filters.d.ts +8 -1
  69. package/dist/list/filters.d.ts.map +1 -1
  70. package/dist/list/filters.js +5 -2
  71. package/dist/list/filters.js.map +1 -1
  72. package/dist/list/index.d.ts +2 -0
  73. package/dist/list/index.d.ts.map +1 -1
  74. package/dist/list/index.js +1 -0
  75. package/dist/list/index.js.map +1 -1
  76. package/dist/logic/browser/storage.d.ts +17 -0
  77. package/dist/logic/browser/storage.d.ts.map +1 -0
  78. package/dist/logic/browser/storage.js +40 -0
  79. package/dist/logic/browser/storage.js.map +1 -0
  80. package/dist/logic/index.d.ts +14 -0
  81. package/dist/logic/index.d.ts.map +1 -1
  82. package/dist/logic/index.js +8 -0
  83. package/dist/logic/index.js.map +1 -1
  84. package/dist/logic/pure/confirm.d.ts +16 -0
  85. package/dist/logic/pure/confirm.d.ts.map +1 -1
  86. package/dist/logic/pure/confirm.js +12 -0
  87. package/dist/logic/pure/confirm.js.map +1 -1
  88. package/dist/logic/pure/confirmQueue.d.ts +27 -0
  89. package/dist/logic/pure/confirmQueue.d.ts.map +1 -0
  90. package/dist/logic/pure/confirmQueue.js +52 -0
  91. package/dist/logic/pure/confirmQueue.js.map +1 -0
  92. package/dist/logic/pure/dateInput.d.ts +21 -0
  93. package/dist/logic/pure/dateInput.d.ts.map +1 -0
  94. package/dist/logic/pure/dateInput.js +79 -0
  95. package/dist/logic/pure/dateInput.js.map +1 -0
  96. package/dist/logic/pure/stickyParams.d.ts +10 -0
  97. package/dist/logic/pure/stickyParams.d.ts.map +1 -0
  98. package/dist/logic/pure/stickyParams.js +31 -0
  99. package/dist/logic/pure/stickyParams.js.map +1 -0
  100. package/dist/logic/pure/writeAccess.d.ts +18 -0
  101. package/dist/logic/pure/writeAccess.d.ts.map +1 -0
  102. package/dist/logic/pure/writeAccess.js +14 -0
  103. package/dist/logic/pure/writeAccess.js.map +1 -0
  104. package/dist/logic/react/useConfirm.d.ts +14 -0
  105. package/dist/logic/react/useConfirm.d.ts.map +1 -0
  106. package/dist/logic/react/useConfirm.js +16 -0
  107. package/dist/logic/react/useConfirm.js.map +1 -0
  108. package/dist/logic/react/useLatestSearch.d.ts +18 -0
  109. package/dist/logic/react/useLatestSearch.d.ts.map +1 -0
  110. package/dist/logic/react/useLatestSearch.js +37 -0
  111. package/dist/logic/react/useLatestSearch.js.map +1 -0
  112. package/dist/logic/react/useRowSelection.d.ts +12 -2
  113. package/dist/logic/react/useRowSelection.d.ts.map +1 -1
  114. package/dist/logic/react/useRowSelection.js +16 -8
  115. package/dist/logic/react/useRowSelection.js.map +1 -1
  116. package/dist/logic/react/writeAccess.d.ts +18 -0
  117. package/dist/logic/react/writeAccess.d.ts.map +1 -0
  118. package/dist/logic/react/writeAccess.js +18 -0
  119. package/dist/logic/react/writeAccess.js.map +1 -0
  120. package/dist/next/storage.d.ts +2 -10
  121. package/dist/next/storage.d.ts.map +1 -1
  122. package/dist/next/storage.js +2 -33
  123. package/dist/next/storage.js.map +1 -1
  124. package/dist/page/DefinitionList.d.ts +7 -2
  125. package/dist/page/DefinitionList.d.ts.map +1 -1
  126. package/dist/page/DefinitionList.js +4 -1
  127. package/dist/page/DefinitionList.js.map +1 -1
  128. package/dist/page/DetailHeader.d.ts +6 -1
  129. package/dist/page/DetailHeader.d.ts.map +1 -1
  130. package/dist/page/DetailHeader.js +3 -3
  131. package/dist/page/DetailHeader.js.map +1 -1
  132. package/dist/page/EntityDetailShell.d.ts +8 -2
  133. package/dist/page/EntityDetailShell.d.ts.map +1 -1
  134. package/dist/page/EntityDetailShell.js +6 -4
  135. package/dist/page/EntityDetailShell.js.map +1 -1
  136. package/dist/page/EntityListPage.d.ts +3 -1
  137. package/dist/page/EntityListPage.d.ts.map +1 -1
  138. package/dist/page/EntityListPage.js +1 -1
  139. package/dist/page/EntityListPage.js.map +1 -1
  140. package/dist/page/EntityTabs.d.ts +2 -2
  141. package/dist/page/EntityTabs.d.ts.map +1 -1
  142. package/dist/page/EntityTabs.js +3 -2
  143. package/dist/page/EntityTabs.js.map +1 -1
  144. package/dist/page/PageFrame.d.ts +6 -1
  145. package/dist/page/PageFrame.d.ts.map +1 -1
  146. package/dist/page/PageFrame.js +1 -1
  147. package/dist/page/PageFrame.js.map +1 -1
  148. package/dist/page/PageToolbar.d.ts +4 -3
  149. package/dist/page/PageToolbar.d.ts.map +1 -1
  150. package/dist/page/PageToolbar.js +9 -4
  151. package/dist/page/PageToolbar.js.map +1 -1
  152. package/dist/page/SectionHeader.d.ts +1 -1
  153. package/dist/page/SectionHeader.d.ts.map +1 -1
  154. package/dist/page/links.d.ts +2 -17
  155. package/dist/page/links.d.ts.map +1 -1
  156. package/dist/page/links.js +3 -3
  157. package/dist/page/links.js.map +1 -1
  158. package/dist/primitives/alert.d.ts +1 -1
  159. package/dist/primitives/badge.d.ts +1 -1
  160. package/dist/primitives/breadcrumb.d.ts.map +1 -1
  161. package/dist/primitives/breadcrumb.js +7 -0
  162. package/dist/primitives/breadcrumb.js.map +1 -1
  163. package/dist/primitives/command.js +1 -1
  164. package/dist/primitives/command.js.map +1 -1
  165. package/dist/primitives/confirmDialogView.d.ts +29 -0
  166. package/dist/primitives/confirmDialogView.d.ts.map +1 -0
  167. package/dist/primitives/confirmDialogView.js +63 -0
  168. package/dist/primitives/confirmDialogView.js.map +1 -0
  169. package/dist/primitives/formActionsSlot.d.ts +24 -0
  170. package/dist/primitives/formActionsSlot.d.ts.map +1 -0
  171. package/dist/primitives/formActionsSlot.js +51 -0
  172. package/dist/primitives/formActionsSlot.js.map +1 -0
  173. package/dist/primitives/index.d.ts +3 -0
  174. package/dist/primitives/index.d.ts.map +1 -1
  175. package/dist/primitives/index.js +2 -0
  176. package/dist/primitives/index.js.map +1 -1
  177. package/dist/primitives/link.d.ts +28 -0
  178. package/dist/primitives/link.d.ts.map +1 -0
  179. package/dist/primitives/link.js +15 -0
  180. package/dist/primitives/link.js.map +1 -0
  181. package/dist/primitives/segmented-control.d.ts +8 -0
  182. package/dist/primitives/segmented-control.d.ts.map +1 -1
  183. package/dist/primitives/segmented-control.js +24 -6
  184. package/dist/primitives/segmented-control.js.map +1 -1
  185. package/dist/provider/AdminUiProvider.d.ts +4 -3
  186. package/dist/provider/AdminUiProvider.d.ts.map +1 -1
  187. package/dist/provider/AdminUiProvider.js +12 -5
  188. package/dist/provider/AdminUiProvider.js.map +1 -1
  189. package/dist/provider/ConfirmHost.d.ts +10 -0
  190. package/dist/provider/ConfirmHost.d.ts.map +1 -0
  191. package/dist/provider/ConfirmHost.js +19 -0
  192. package/dist/provider/ConfirmHost.js.map +1 -0
  193. package/dist/provider/types.d.ts +12 -0
  194. package/dist/provider/types.d.ts.map +1 -1
  195. package/dist/showcase/coverage.d.ts.map +1 -1
  196. package/dist/showcase/coverage.js +6 -3
  197. package/dist/showcase/coverage.js.map +1 -1
  198. package/dist/showcase/sections/FormShowcase.d.ts.map +1 -1
  199. package/dist/showcase/sections/FormShowcase.js +41 -5
  200. package/dist/showcase/sections/FormShowcase.js.map +1 -1
  201. package/dist/showcase/sections/ListShowcase.d.ts.map +1 -1
  202. package/dist/showcase/sections/ListShowcase.js +36 -6
  203. package/dist/showcase/sections/ListShowcase.js.map +1 -1
  204. package/dist/showcase/sections/PageShowcase.d.ts.map +1 -1
  205. package/dist/showcase/sections/PageShowcase.js +5 -1
  206. package/dist/showcase/sections/PageShowcase.js.map +1 -1
  207. package/dist/showcase/sections/PrimitivesShowcase.d.ts.map +1 -1
  208. package/dist/showcase/sections/PrimitivesShowcase.js +2 -2
  209. package/dist/showcase/sections/PrimitivesShowcase.js.map +1 -1
  210. package/dist/translations/TranslationControls.d.ts.map +1 -1
  211. package/dist/translations/TranslationControls.js +8 -6
  212. package/dist/translations/TranslationControls.js.map +1 -1
  213. package/package.json +2 -2
@@ -1,47 +1,48 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useContext, useId, useLayoutEffect, useRef, useState } from 'react';
3
+ import { useCallback, useContext, useId, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import { DrawerFooterSlotContext } from "./drawerSlots.js";
6
- /**
7
- * Pins its content (a form's Save and Cancel) to the bottom of the `FormDrawer` it is rendered in; outside a drawer (a page, a dialog opened from the drawer) it renders where it is written.
8
- *
9
- * The portalled footer sits outside the `<form>` in the DOM, so every submit button in it is linked back to its form
10
- * with the `form` attribute: Save, and Enter in a field, still submit the form.
11
- */
12
- export const DrawerFooter = ({ children, className, inlineClassName, inlineProps }) => {
6
+ import { useLinkedSubmitButtons } from "./linkSubmitButtons.js";
7
+ /** `DrawerFooter` with the anchor and a second portal target, for `FormActions`. */
8
+ export const DrawerFooterView = ({ children, className, inlineClassName, inlineProps, anchorRef: externalAnchorRef, portalInto, }) => {
13
9
  const slot = useContext(DrawerFooterSlotContext);
14
10
  const fallbackFormId = useId();
15
11
  const anchorRef = useRef(null);
16
- const contentRef = useRef(null);
12
+ const [content, setContent] = useState(null);
17
13
  const [target, setTarget] = useState(null);
14
+ const setAnchor = useCallback((element) => {
15
+ anchorRef.current = element;
16
+ if (typeof externalAnchorRef === 'function')
17
+ externalAnchorRef(element);
18
+ else if (externalAnchorRef)
19
+ externalAnchorRef.current = element;
20
+ }, [externalAnchorRef]);
18
21
  useLayoutEffect(() => {
19
22
  const anchor = anchorRef.current;
20
- // A dialog opened from inside the drawer still sees the drawer's context, but its DOM is portalled to <body>.
21
- if (!slot || !anchor || !slot.bodyElement.contains(anchor)) {
23
+ if (!anchor) {
22
24
  setTarget(null);
23
25
  return;
24
26
  }
25
- setTarget({ footerElement: slot.footerElement, formElement: anchor.closest('form') });
26
- }, [slot]);
27
- const formElement = target?.formElement ?? null;
28
- useLayoutEffect(() => {
29
- const content = contentRef.current;
30
- if (!formElement || !content)
31
- return;
32
- if (!formElement.id)
33
- formElement.id = fallbackFormId;
34
- const linkSubmitButtons = () => {
35
- for (const button of content.querySelectorAll('button')) {
36
- if (button.type === 'submit' && !button.hasAttribute('form'))
37
- button.setAttribute('form', formElement.id);
38
- }
39
- };
40
- linkSubmitButtons();
41
- const observer = new MutationObserver(linkSubmitButtons);
42
- observer.observe(content, { childList: true, subtree: true });
43
- return () => observer.disconnect();
44
- }, [formElement, fallbackFormId]);
45
- return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, hidden: true }), target ? (createPortal(_jsx("div", { ref: contentRef, className: className, children: children }), target.footerElement)) : (_jsx("div", { className: inlineClassName, ...inlineProps, children: children }))] }));
27
+ // A dialog opened from inside the drawer still sees the drawer's context, but its DOM is portalled to <body>.
28
+ if (slot && slot.bodyElement.contains(anchor)) {
29
+ setTarget({ footerElement: slot.footerElement, formElement: anchor.closest('form') });
30
+ }
31
+ else if (portalInto) {
32
+ setTarget({ footerElement: portalInto, formElement: anchor.closest('form') });
33
+ }
34
+ else {
35
+ setTarget(null);
36
+ }
37
+ }, [slot, portalInto]);
38
+ useLinkedSubmitButtons(content, target?.formElement ?? null, fallbackFormId);
39
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: setAnchor, hidden: true }), target ? (createPortal(_jsx("div", { ref: setContent, className: className, children: children }), target.footerElement)) : (_jsx("div", { className: inlineClassName, ...inlineProps, children: children }))] }));
46
40
  };
41
+ /**
42
+ * Pins its content (a form's Save and Cancel) to the bottom of the `FormDrawer` it is rendered in; outside a drawer (a page, a dialog opened from the drawer) it renders where it is written.
43
+ *
44
+ * The portalled footer sits outside the `<form>` in the DOM, so every submit button in it is linked back to its form
45
+ * with the `form` attribute: Save, and Enter in a field, still submit the form.
46
+ */
47
+ export const DrawerFooter = ({ children, className, inlineClassName, inlineProps }) => (_jsx(DrawerFooterView, { className: className, inlineClassName: inlineClassName, inlineProps: inlineProps, children: children }));
47
48
  //# sourceMappingURL=DrawerFooter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerFooter.js","sourceRoot":"","sources":["../../src/form/DrawerFooter.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAiB3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,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U,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;IAEvB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC;IAE7E,OAAO,CACL,8BACE,eAAM,GAAG,EAAE,SAAS,EAAE,MAAM,SAAG,EAC9B,MAAM,CAAC,CAAC,CAAC,CACR,YAAY,CACV,cAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,YACvC,QAAQ,GACL,EACN,MAAM,CAAC,aAAa,CACrB,CACF,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAE,eAAe,KAAM,WAAW,YAC7C,QAAQ,GACL,CACP,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAqB,EAAE,EAAE,CAAC,CACxG,KAAC,gBAAgB,IAAC,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,YAC/F,QAAQ,GACQ,CACpB,CAAC"}
@@ -4,32 +4,37 @@ export interface FormActionsProps {
4
4
  secondary?: ReactNode;
5
5
  tertiary?: ReactNode;
6
6
  /**
7
- * On a page: the glass action pill at the top right of the form, sticky under the header (default);
8
- * `false` keeps a plain row (a dialog). Ignored in a drawer: its pinned footer gets the plain row with
9
- * the change status.
7
+ * On a page: the glass action pill at the top right of the form, sticky under the header (default); `false` keeps a
8
+ * plain row. Inside a dialog (`[role="dialog"]` / `[role="alertdialog"]`, not a `FormDrawer`) the plain row is the
9
+ * default; `true` keeps the pill there. Ignored in a drawer: its pinned footer gets the plain row with the change
10
+ * status.
10
11
  */
11
12
  sticky?: boolean;
12
13
  /**
13
- * Where the sticky pill sits from `md` up: `auto` (default) moves it up beside the tabs when the page has an
14
- * `EntityTabs` row (`data-entity-tabs`) and keeps a row of its own on pages without tabs (create pages, plain details),
15
- * where it would otherwise cover the page header; `row` always keeps its own row (a tab row too wide to share).
14
+ * Where the sticky pill sits: `auto` (default) moves it into the header slot closest above the form
15
+ * (`FormActionsSlot`, e.g. `EntityDetailShell formActionsSlot`) when one is mounted, and otherwise, from `md` up,
16
+ * beside the tabs when the page has an `EntityTabs` row (`data-entity-tabs`), else into a row of its own (create
17
+ * pages, plain details, where it would cover the page header); `header` asks for the slot (without one: as `auto`);
18
+ * `row` always keeps its own row (a tab row too wide to share), never the slot.
16
19
  */
17
- placement?: 'auto' | 'row';
20
+ placement?: 'auto' | 'row' | 'header';
18
21
  /**
19
22
  * The change status for a form without react-hook-form (state-based forms): shows "Unsaved changes" / "No changes"
20
23
  * like an RHF form does. Ignored inside an RHF form (its own dirty state wins). ⌘S works in either case as long as
21
- * the actions sit inside a `<form>` with a `type="submit"` primary.
24
+ * the actions are written inside a `<form>` that owns a `type="submit"` button.
22
25
  */
23
26
  isDirty?: boolean;
24
27
  /** Applies where the actions are written; dropped once they move into a drawer's footer. */
25
28
  className?: string;
26
29
  }
27
30
  /**
28
- * A form's Save / Cancel actions — the one standard of every entity create / edit screen. On a
29
- * page: a glass pill at the top right of the form, sticky under the header, with the change status ("Unsaved
30
- * changes" / "No changes", from the surrounding RHF form), tertiary, secondary (Cancel) and the primary next to each
31
- * other, primary last; ⌘S / Ctrl+S submits. Inside a `FormDrawer` the buttons move into the drawer's pinned footer;
32
- * `sticky={false}` is a plain row.
31
+ * A form's Save / Cancel actions — the one standard of every entity create / edit screen. On a page: a glass pill at
32
+ * the top right of the form, sticky under the header, with the change status ("Unsaved changes" / "No changes", from
33
+ * the surrounding RHF form), tertiary, secondary (Cancel) and the primary next to each other, primary last; in a
34
+ * header slot (`placement`) the same pill in the header. Inside a `FormDrawer` the buttons move into the drawer's
35
+ * pinned footer; inside another dialog, and with `sticky={false}`, a plain row. ⌘S / Ctrl+S submits
36
+ * (`useSaveShortcut`: in a dialog or drawer anywhere inside it; on a page with focus in the form, on the actions or
37
+ * nowhere).
33
38
  */
34
39
  export declare const FormActions: ({ primary, secondary, tertiary, sticky, placement, isDirty, className, }: FormActionsProps) => import("react").JSX.Element;
35
40
  //# sourceMappingURL=FormActions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormActions.d.ts","sourceRoot":"","sources":["../../src/form/FormActions.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAS1D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,0EAQzB,gBAAgB,gCAiDlB,CAAC"}
1
+ {"version":3,"file":"FormActions.d.ts","sourceRoot":"","sources":["../../src/form/FormActions.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAA4E,MAAM,OAAO,CAAC;AAWjH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IACtC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0JD;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAI,0EAQzB,gBAAgB,gCA6ElB,CAAC"}
@@ -1,17 +1,24 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef } from 'react';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useCallback, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { useFormContext } from 'react-hook-form';
5
5
  import { useTranslate } from "../i18n/index.js";
6
6
  import { cn } from "../primitives/cn.js";
7
- import { DrawerFooter } from "./DrawerFooter.js";
7
+ import { useFormActionsSlotFor } from "../primitives/formActionsSlot.js";
8
+ import { DrawerFooterView } from "./DrawerFooter.js";
8
9
  import { useIsInDrawer } from "./drawerSlots.js";
10
+ import { SAVE_SHORTCUT_CONTAINER_SELECTOR, useSaveShortcut } from "./saveShortcut.js";
9
11
  import { useFormDirty } from "../logic/react/useFormDirty.js";
12
+ /**
13
+ * The value of the bar's `data-form-actions` attribute: `components.css` selects exactly this value, so a host's own
14
+ * action bar with a bare `data-form-actions` is not restyled by the package.
15
+ */
16
+ const FORM_ACTIONS_MARKER = 'admin-ui';
10
17
  /** Below `sm` the buttons share the row; from `sm` up each keeps its own width. */
11
18
  const ACTION_CLASS = 'flex-1 min-w-fit *:w-full sm:flex-none sm:*:w-auto';
12
19
  /**
13
20
  * The page action pill (host CSS `.glass-bar`): compact, right-aligned at the top of the form and sticky under the
14
- * fixed chrome (`--nav-h`) while the form scrolls. Forms write `<FormActions>` last; `data-form-actions` + the host
21
+ * fixed chrome (`--nav-h`) while the form scrolls. Forms write `<FormActions>` last; `data-form-actions="admin-ui"` + the host
15
22
  * CSS move it first (`order: -1`), so the DOM / tab order is unchanged everywhere.
16
23
  */
17
24
  // No row of its own where the page has tabs: the wrapper is 0 px tall and pulled 3.5 rem up (and as
@@ -36,45 +43,115 @@ const ChangeStatus = ({ control, isDirty }) => {
36
43
  return _jsx(DirtyStatusLabel, { isDirty: isDirty });
37
44
  return null;
38
45
  };
39
- /** ⌘S / Ctrl+S inside the form submits it (the primary is `type="submit"`, so the form's own validation runs). */
40
- const useSaveShortcut = (anchor) => {
41
- useEffect(() => {
42
- const form = anchor.current?.closest('form');
43
- if (!form)
44
- return;
45
- const onKeyDown = (event) => {
46
- if (event.key.toLowerCase() !== 's' || !(event.metaKey || event.ctrlKey) || event.altKey)
46
+ /** Measures `--nav-h` in px (0 without it): a hidden probe of that height. */
47
+ const useNavHeightProbe = () => {
48
+ const probe = useRef(null);
49
+ useLayoutEffect(() => {
50
+ const element = document.createElement('div');
51
+ element.setAttribute('aria-hidden', 'true');
52
+ element.style.cssText = 'position:fixed;top:0;left:0;width:0;height:var(--nav-h,0px);visibility:hidden;pointer-events:none';
53
+ document.body.append(element);
54
+ probe.current = element;
55
+ return () => {
56
+ element.remove();
57
+ probe.current = null;
58
+ };
59
+ }, []);
60
+ return useCallback(() => probe.current?.offsetHeight ?? 0, []);
61
+ };
62
+ /**
63
+ * The pill in a header slot: in the header while it is in view; once the header scrolls under the top bar
64
+ * (`--nav-h`), fixed under the bar at the slot's right edge while the form is still in view, the slot keeping its size
65
+ * so the header does not move.
66
+ */
67
+ const SlotPill = ({ children, pillRef, anchorRef }) => {
68
+ const holder = useRef(null);
69
+ const pill = useRef(null);
70
+ const [floating, setFloating] = useState(null);
71
+ const navHeight = useNavHeightProbe();
72
+ useLayoutEffect(() => {
73
+ let frame = 0;
74
+ const update = () => {
75
+ frame = 0;
76
+ const holderElement = holder.current;
77
+ const pillElement = pill.current;
78
+ if (!holderElement || !pillElement)
47
79
  return;
48
- event.preventDefault();
49
- // In a drawer the buttons sit in the portalled footer, linked back to the form by its `form` attribute.
50
- const submit = form.querySelector('button[type="submit"]') ??
51
- (form.id ? document.querySelector(`button[type="submit"][form="${CSS.escape(form.id)}"]`) : null);
52
- if (submit && !submit.disabled)
53
- form.requestSubmit(submit);
80
+ const box = holderElement.getBoundingClientRect();
81
+ // the pill's own top offset under the bar: 0.5rem, as the sticky pill on pages
82
+ const gap = parseFloat(getComputedStyle(document.documentElement).fontSize || '16') * 0.5;
83
+ const top = navHeight() + gap;
84
+ const formElement = anchorRef.current?.closest('form') ?? anchorRef.current?.parentElement ?? null;
85
+ const formBottom = formElement ? formElement.getBoundingClientRect().bottom : Number.POSITIVE_INFINITY;
86
+ const shouldFloat = box.top < top && formBottom > top + pillElement.offsetHeight;
87
+ setFloating(current => {
88
+ if (!shouldFloat)
89
+ return null;
90
+ const size = current ?? { width: pillElement.offsetWidth, height: pillElement.offsetHeight, right: 0 };
91
+ const right = Math.max(0, document.documentElement.clientWidth - box.right);
92
+ return current && current.right === right ? current : { ...size, right };
93
+ });
54
94
  };
55
- form.addEventListener('keydown', onKeyDown);
56
- return () => form.removeEventListener('keydown', onKeyDown);
57
- }, [anchor]);
95
+ const schedule = () => {
96
+ if (frame === 0)
97
+ frame = requestAnimationFrame(update);
98
+ };
99
+ update();
100
+ window.addEventListener('scroll', schedule, { capture: true, passive: true });
101
+ window.addEventListener('resize', schedule);
102
+ return () => {
103
+ if (frame !== 0)
104
+ cancelAnimationFrame(frame);
105
+ window.removeEventListener('scroll', schedule, { capture: true });
106
+ window.removeEventListener('resize', schedule);
107
+ };
108
+ }, [navHeight, anchorRef]);
109
+ const setPill = useCallback((element) => {
110
+ pill.current = element;
111
+ if (typeof pillRef === 'function')
112
+ pillRef(element);
113
+ else if (pillRef)
114
+ pillRef.current = element;
115
+ }, [pillRef]);
116
+ return (_jsx("div", { ref: holder, "data-form-actions": FORM_ACTIONS_MARKER, "data-form-actions-placement": "header", style: floating ? { width: floating.width, height: floating.height } : undefined, children: _jsx("div", { ref: setPill, "data-form-actions-floating": floating ? '' : undefined, className: cn(STICKY_PILL_CLASS, 'max-sm:w-auto', floating && 'fixed top-[calc(var(--nav-h)+0.5rem)] z-(--layer-sticky)'), style: floating ? { right: floating.right } : undefined, children: children }) }));
58
117
  };
59
118
  /**
60
- * A form's Save / Cancel actions — the one standard of every entity create / edit screen. On a
61
- * page: a glass pill at the top right of the form, sticky under the header, with the change status ("Unsaved
62
- * changes" / "No changes", from the surrounding RHF form), tertiary, secondary (Cancel) and the primary next to each
63
- * other, primary last; ⌘S / Ctrl+S submits. Inside a `FormDrawer` the buttons move into the drawer's pinned footer;
64
- * `sticky={false}` is a plain row.
119
+ * A form's Save / Cancel actions — the one standard of every entity create / edit screen. On a page: a glass pill at
120
+ * the top right of the form, sticky under the header, with the change status ("Unsaved changes" / "No changes", from
121
+ * the surrounding RHF form), tertiary, secondary (Cancel) and the primary next to each other, primary last; in a
122
+ * header slot (`placement`) the same pill in the header. Inside a `FormDrawer` the buttons move into the drawer's
123
+ * pinned footer; inside another dialog, and with `sticky={false}`, a plain row. ⌘S / Ctrl+S submits
124
+ * (`useSaveShortcut`: in a dialog or drawer anywhere inside it; on a page with focus in the form, on the actions or
125
+ * nowhere).
65
126
  */
66
- export const FormActions = ({ primary, secondary, tertiary, sticky = true, placement = 'auto', isDirty, className, }) => {
127
+ export const FormActions = ({ primary, secondary, tertiary, sticky, placement = 'auto', isDirty, className, }) => {
67
128
  const formContext = useFormContext();
68
129
  const isInDrawer = useIsInDrawer();
69
- const anchor = useRef(null);
70
- useSaveShortcut(anchor);
130
+ const anchorRef = useRef(null);
131
+ const actionsRef = useRef(null);
132
+ const [anchor, setAnchorState] = useState(null);
133
+ const [isInDialog, setIsInDialog] = useState(false);
134
+ const setAnchor = useCallback((element) => {
135
+ anchorRef.current = element;
136
+ setAnchorState(element);
137
+ }, []);
138
+ useLayoutEffect(() => {
139
+ setIsInDialog(anchor?.closest(SAVE_SHORTCUT_CONTAINER_SELECTOR) != null);
140
+ }, [anchor]);
141
+ useSaveShortcut(() => ({ form: anchorRef.current?.closest('form') ?? null, actions: actionsRef.current }));
142
+ const slotElement = useFormActionsSlotFor(placement === 'row' ? null : anchor);
143
+ const status = _jsx(ChangeStatus, { control: formContext?.control, isDirty: isDirty });
71
144
  if (isInDrawer) {
72
145
  // The drawer's pinned footer: the change status left, the buttons right, primary last.
73
- return (_jsx(DrawerFooter, { inlineClassName: cn('pt-6', className), children: _jsxs("div", { ref: anchor, className: "flex flex-wrap-reverse items-center gap-2", children: [(formContext || isDirty !== undefined) && (_jsx("div", { className: "mr-auto", children: _jsx(ChangeStatus, { control: formContext?.control, isDirty: isDirty }) })), tertiary && _jsx("div", { className: ACTION_CLASS, children: tertiary }), secondary && _jsx("div", { className: ACTION_CLASS, children: secondary }), primary && _jsx("div", { className: ACTION_CLASS, children: primary })] }) }));
146
+ return (_jsx(DrawerFooterView, { anchorRef: setAnchor, inlineClassName: cn('pt-6', className), children: _jsxs("div", { ref: actionsRef, className: "flex flex-wrap-reverse items-center gap-2", children: [(formContext || isDirty !== undefined) && _jsx("div", { className: "mr-auto", children: status }), tertiary && _jsx("div", { className: ACTION_CLASS, children: tertiary }), secondary && _jsx("div", { className: ACTION_CLASS, children: secondary }), primary && _jsx("div", { className: ACTION_CLASS, children: primary })] }) }));
147
+ }
148
+ if (sticky === false || (sticky === undefined && isInDialog)) {
149
+ return (_jsx(DrawerFooterView, { anchorRef: setAnchor, inlineClassName: cn('pt-6', className), children: _jsxs("div", { ref: actionsRef, className: "flex flex-wrap-reverse items-center gap-2", children: [secondary && _jsx("div", { className: ACTION_CLASS, children: secondary }), tertiary && _jsx("div", { className: ACTION_CLASS, children: tertiary }), primary && _jsx("div", { className: cn(ACTION_CLASS, 'sm:ml-auto'), children: primary })] }) }));
74
150
  }
75
- if (!sticky) {
76
- return (_jsx(DrawerFooter, { inlineClassName: cn('pt-6', className), children: _jsxs("div", { ref: anchor, className: "flex flex-wrap-reverse items-center gap-2", children: [secondary && _jsx("div", { className: ACTION_CLASS, children: secondary }), tertiary && _jsx("div", { className: ACTION_CLASS, children: tertiary }), primary && _jsx("div", { className: cn(ACTION_CLASS, 'sm:ml-auto'), children: primary })] }) }));
151
+ const buttons = (_jsxs(_Fragment, { children: [status, tertiary && _jsx("div", { className: ACTION_CLASS, children: tertiary }), secondary && _jsx("div", { className: ACTION_CLASS, children: secondary }), primary && _jsx("div", { className: ACTION_CLASS, children: primary })] }));
152
+ if (slotElement) {
153
+ return (_jsx(DrawerFooterView, { anchorRef: setAnchor, portalInto: slotElement, className: className, children: _jsx(SlotPill, { pillRef: actionsRef, anchorRef: anchorRef, children: buttons }) }));
77
154
  }
78
- return (_jsx(DrawerFooter, { inlineClassName: cn(STICKY_WRAPPER_CLASS, placement === 'auto' && BESIDE_TABS_CLASS, className), inlineProps: { 'data-form-actions': '' }, children: _jsxs("div", { ref: anchor, className: STICKY_PILL_CLASS, children: [_jsx(ChangeStatus, { control: formContext?.control, isDirty: isDirty }), tertiary && _jsx("div", { className: ACTION_CLASS, children: tertiary }), secondary && _jsx("div", { className: ACTION_CLASS, children: secondary }), primary && _jsx("div", { className: ACTION_CLASS, children: primary })] }) }));
155
+ return (_jsx(DrawerFooterView, { anchorRef: setAnchor, inlineClassName: cn(STICKY_WRAPPER_CLASS, placement !== 'row' && BESIDE_TABS_CLASS, className), inlineProps: { 'data-form-actions': FORM_ACTIONS_MARKER }, children: _jsx("div", { ref: actionsRef, className: STICKY_PILL_CLASS, children: buttons }) }));
79
156
  };
80
157
  //# sourceMappingURL=FormActions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormActions.js","sourceRoot":"","sources":["../../src/form/FormActions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO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,EAAC,2CAA2C,aACxE,SAAS,IAAI,cAAK,SAAS,EAAE,YAAY,YAAG,SAAS,GAAO,EAC5D,QAAQ,IAAI,cAAK,SAAS,EAAE,YAAY,YAAG,QAAQ,GAAO,EAC1D,OAAO,IAAI,cAAK,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,YAAG,OAAO,GAAO,IACvE,GACW,CACpB,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,CACd,8BACG,MAAM,EACN,QAAQ,IAAI,cAAK,SAAS,EAAE,YAAY,YAAG,QAAQ,GAAO,EAC1D,SAAS,IAAI,cAAK,SAAS,EAAE,YAAY,YAAG,SAAS,GAAO,EAC5D,OAAO,IAAI,cAAK,SAAS,EAAE,YAAY,YAAG,OAAO,GAAO,IACxD,CACJ,CAAC;IAEF,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CACL,KAAC,gBAAgB,IAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,YACnF,KAAC,QAAQ,IAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,YAChD,OAAO,GACC,GACM,CACpB,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,gBAAgB,IACf,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,EAAE,CAAC,oBAAoB,EAAE,SAAS,KAAK,KAAK,IAAI,iBAAiB,EAAE,SAAS,CAAC,EAC9F,WAAW,EAAE,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,YAEzD,cAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,YAC/C,OAAO,GACJ,GACW,CACpB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { type FormEvent, type ReactNode } from 'react';
2
+ import { type FieldValues, type SubmitHandler, type UseFormReturn } from 'react-hook-form';
3
+ interface FormDialogBaseProps {
4
+ open: boolean;
5
+ /** `false` for a close request the dialog accepted (Escape, backdrop, Cancel; never while pending). */
6
+ onOpenChange: (open: boolean) => void;
7
+ title: ReactNode;
8
+ description?: ReactNode;
9
+ /** The fields; with `form`, `FormField` and the other bound fields work inside. */
10
+ children: ReactNode;
11
+ /** The submit button's label (`Save`, `Create project`, `Delete`), already translated. */
12
+ submitLabel: ReactNode;
13
+ /** The submit button's label while pending (`Saving…`). */
14
+ pendingLabel?: ReactNode;
15
+ /** The Cancel button's label; default "Cancel". */
16
+ cancelLabel?: ReactNode;
17
+ /**
18
+ * The save runs (a mutation's pending state): the submit button is disabled and relabelled, Cancel is disabled, and
19
+ * every close request is ignored. A promise returned by `onSubmit` counts as pending too, until it settles.
20
+ */
21
+ isPending: boolean;
22
+ /** Unsaved changes: a close request asks "Discard changes?" first (the provider's `useConfirm`, else its own dialog). */
23
+ isDirty?: boolean;
24
+ /** The submit button is off (nothing to save yet, a blocker of the screen). */
25
+ submitDisabled?: boolean;
26
+ /** `destructive` for a dialog whose submit cannot be undone. */
27
+ submitVariant?: 'default' | 'destructive';
28
+ /** A submit that only reads: not disabled by `WriteAccessProvider`. */
29
+ ignoreWriteAccess?: boolean;
30
+ /** Classes of the dialog content (width: `sm:max-w-xl`). */
31
+ className?: string;
32
+ }
33
+ export type FormDialogProps<TFieldValues extends FieldValues = FieldValues, TTransformed = TFieldValues> = FormDialogBaseProps & ({
34
+ /** A react-hook-form instance: the dialog provides it, validates through it and passes the parsed values. */
35
+ form: UseFormReturn<TFieldValues, unknown, TTransformed>;
36
+ onSubmit: SubmitHandler<TTransformed>;
37
+ } | {
38
+ form?: undefined;
39
+ /** Called on submit (the default is prevented); read the values from state or `event.currentTarget`. */
40
+ onSubmit: (event: FormEvent<HTMLFormElement>) => unknown;
41
+ });
42
+ /**
43
+ * A form in a dialog, with or without a form library: title, description, the fields, Cancel and the submit button in
44
+ * a real `<form>`, so Enter in a text field and ⌘S / Ctrl+S submit it. Close requests (Escape, backdrop, Cancel) are
45
+ * ignored while pending; after a failed submit (the handler shows its error) the dialog is usable again. The caller
46
+ * closes it after a successful save (`onOpenChange(false)` or its own state). A dialog opened from it is its own
47
+ * form: its submit never reaches this one.
48
+ */
49
+ export declare const FormDialog: <TFieldValues extends FieldValues = FieldValues, TTransformed = TFieldValues>(props: FormDialogProps<TFieldValues, TTransformed>) => import("react").JSX.Element;
50
+ export {};
51
+ //# sourceMappingURL=FormDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormDialog.d.ts","sourceRoot":"","sources":["../../src/form/FormDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAgC,MAAM,OAAO,CAAC;AACrF,OAAO,EAAE,KAAK,WAAW,EAAgB,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAqBzG,UAAU,mBAAmB;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,uGAAuG;IACvG,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,mFAAmF;IACnF,QAAQ,EAAE,SAAS,CAAC;IACpB,0FAA0F;IAC1F,WAAW,EAAE,SAAS,CAAC;IACvB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,mDAAmD;IACnD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,yHAAyH;IACzH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gEAAgE;IAChE,aAAa,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IAC1C,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,eAAe,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,EAAE,YAAY,GAAG,YAAY,IAAI,mBAAmB,GAC5H,CACI;IACE,6GAA6G;IAC7G,IAAI,EAAE,aAAa,CAAC,YAAY,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACzD,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACvC,GACD;IACE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wGAAwG;IACxG,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,KAAK,OAAO,CAAC;CAC1D,CACJ,CAAC;AAKJ;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,YAAY,SAAS,WAAW,GAAG,WAAW,EAAE,YAAY,GAAG,YAAY,EACpG,OAAO,eAAe,CAAC,YAAY,EAAE,YAAY,CAAC,gCAqHnD,CAAC"}
@@ -0,0 +1,75 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useContext, useRef, useState } from 'react';
4
+ import { FormProvider } from 'react-hook-form';
5
+ import { useTranslate } from "../i18n/index.js";
6
+ import { ConfirmContext } from "../logic/react/useConfirm.js";
7
+ import { UnsavedChangesContext, useDiscardChangesConfirm } from "../logic/react/useUnsavedChangesGuard.js";
8
+ import { useWriteAccess } from "../logic/react/writeAccess.js";
9
+ import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../primitives/index.js";
10
+ import { cn } from "../primitives/cn.js";
11
+ import { DrawerFooterSlotContext, DrawerSurfaceContext } from "./drawerSlots.js";
12
+ import { FormFieldLabelsContext } from "./fieldLabels.js";
13
+ import { useSaveShortcut } from "./saveShortcut.js";
14
+ import { useConfirmDialog } from "./useConfirmDialog.js";
15
+ const isPromiseLike = (value) => typeof value === 'object' && value !== null && typeof value.then === 'function';
16
+ /**
17
+ * A form in a dialog, with or without a form library: title, description, the fields, Cancel and the submit button in
18
+ * a real `<form>`, so Enter in a text field and ⌘S / Ctrl+S submit it. Close requests (Escape, backdrop, Cancel) are
19
+ * ignored while pending; after a failed submit (the handler shows its error) the dialog is usable again. The caller
20
+ * closes it after a successful save (`onOpenChange(false)` or its own state). A dialog opened from it is its own
21
+ * form: its submit never reaches this one.
22
+ */
23
+ export const FormDialog = (props) => {
24
+ const { open, onOpenChange, title, description, children, submitLabel, pendingLabel, cancelLabel, isPending, isDirty = false, submitDisabled = false, submitVariant = 'default', ignoreWriteAccess = false, className, } = props;
25
+ const { t } = useTranslate();
26
+ const writeAccess = useWriteAccess();
27
+ const providerConfirm = useContext(ConfirmContext);
28
+ const ownConfirm = useConfirmDialog();
29
+ const confirm = providerConfirm ?? ownConfirm.confirm;
30
+ const discardConfirm = useDiscardChangesConfirm();
31
+ const [fieldLabels] = useState(() => new Map());
32
+ const [submitting, setSubmitting] = useState(false);
33
+ const formRef = useRef(null);
34
+ const footerRef = useRef(null);
35
+ const busy = isPending || submitting;
36
+ // opened without a Radix trigger: the element that had the focus when it opened gets it back on close
37
+ const returnFocus = useRef(null);
38
+ const wasOpen = useRef(false);
39
+ if (open && !wasOpen.current && typeof document !== 'undefined') {
40
+ returnFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
41
+ }
42
+ wasOpen.current = open;
43
+ const focusTarget = returnFocus.current;
44
+ const writeBlocked = !ignoreWriteAccess && !writeAccess.allowed;
45
+ useSaveShortcut(() => ({ form: open ? formRef.current : null, actions: footerRef.current }));
46
+ const requestClose = async () => {
47
+ if (busy)
48
+ return;
49
+ if (isDirty && !(await confirm(discardConfirm)))
50
+ return;
51
+ onOpenChange(false);
52
+ };
53
+ const handleSubmit = (event) => {
54
+ // a form in a dialog opened from this one is portalled out of it, but React still bubbles its submit up here
55
+ if (event.target !== event.currentTarget)
56
+ return;
57
+ event.preventDefault();
58
+ event.stopPropagation();
59
+ if (busy)
60
+ return;
61
+ const result = props.form ? props.form.handleSubmit(props.onSubmit)(event) : props.onSubmit(event);
62
+ if (!isPromiseLike(result))
63
+ return;
64
+ setSubmitting(true);
65
+ // a rejection stays unhandled (the error is the handler's to show); the dialog is usable again either way
66
+ void Promise.resolve(result).finally(() => setSubmitting(false));
67
+ };
68
+ const body = (_jsxs("form", { ref: formRef, noValidate: props.form !== undefined, onSubmit: handleSubmit, "aria-busy": busy || undefined, className: "grid gap-4", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: title }), description && _jsx(DialogDescription, { children: description })] }), children, _jsxs(DialogFooter, { ref: footerRef, children: [_jsx(Button, { type: "button", variant: "outline", disabled: busy, onClick: () => void requestClose(), children: cancelLabel ?? t('Cancel', { context: 'form-dialog' }) }), _jsx(Button, { type: "submit", variant: submitVariant === 'destructive' ? 'destructive' : 'default', disabled: busy || submitDisabled || writeBlocked, title: writeBlocked ? writeAccess.reason : undefined, children: busy && pendingLabel ? pendingLabel : submitLabel })] })] }));
69
+ return (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: open, onOpenChange: next => (next ? onOpenChange(true) : void requestClose()), children: _jsx(DialogContent, { className: cn('sm:max-w-lg', className), onEscapeKeyDown: event => busy && event.preventDefault(), onInteractOutside: event => busy && event.preventDefault(), onCloseAutoFocus: event => {
70
+ event.preventDefault();
71
+ if (focusTarget?.isConnected)
72
+ focusTarget.focus();
73
+ }, ...(description ? {} : { 'aria-describedby': undefined }), children: _jsx(DrawerSurfaceContext.Provider, { value: false, children: _jsx(DrawerFooterSlotContext.Provider, { value: null, children: _jsx(UnsavedChangesContext.Provider, { value: null, children: _jsx(FormFieldLabelsContext.Provider, { value: fieldLabels, children: props.form ? _jsx(FormProvider, { ...props.form, children: body }) : body }) }) }) }) }) }), providerConfirm ? null : ownConfirm.dialog] }));
74
+ };
75
+ //# sourceMappingURL=FormDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormDialog.js","sourceRoot":"","sources":["../../src/form/FormDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;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,WAAW;4BAAE,WAAW,CAAC,KAAK,EAAE,CAAC;oBACpD,CAAC,KACG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,SAAS,EAAE,CAAC,YAG1D,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACzC,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAC3C,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YACzC,KAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,YAChD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,YAAY,OAAK,KAAK,CAAC,IAAI,YAAG,IAAI,GAAgB,CAAC,CAAC,CAAC,IAAI,GACxC,GACH,GACA,GACL,GAClB,GACT,EACR,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,IAC1C,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -9,6 +9,11 @@ export interface FormHeaderProps {
9
9
  actions?: ReactNode;
10
10
  /** A form inside another entity's detail shell (a track of an account): `h2` title, the shell keeps the `h1`. */
11
11
  nested?: boolean;
12
+ /**
13
+ * The form's `FormActions` move into this header (a `FormActionsSlot` after `actions`). Wrap the header and the form
14
+ * in one `FormActionsSlotProvider` (`./primitives`).
15
+ */
16
+ formActionsSlot?: boolean;
12
17
  className?: string;
13
18
  }
14
19
  /**
@@ -16,5 +21,5 @@ export interface FormHeaderProps {
16
21
  * right — the same header as the entity's detail page (`EntityDetailShell`). A `FormDrawer` brings its own header; a
17
22
  * form inside another entity's detail shell passes `nested` (an `h2`, never a second page title).
18
23
  */
19
- export declare const FormHeader: ({ title, description, leading, actions, nested, className }: FormHeaderProps) => import("react").JSX.Element;
24
+ export declare const FormHeader: ({ title, description, leading, actions, nested, formActionsSlot, className }: FormHeaderProps) => import("react").JSX.Element;
20
25
  //# sourceMappingURL=FormHeader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormHeader.d.ts","sourceRoot":"","sources":["../../src/form/FormHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sEAAsE;IACtE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,iHAAiH;IACjH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,6DAA6D,eAAe,gCAStG,CAAC"}
1
+ {"version":3,"file":"FormHeader.d.ts","sourceRoot":"","sources":["../../src/form/FormHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sEAAsE;IACtE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,iHAAiH;IACjH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,8EAA8E,eAAe,gCAUvH,CAAC"}
@@ -5,5 +5,5 @@ import { DetailHeader } from "../page/DetailHeader.js";
5
5
  * right — the same header as the entity's detail page (`EntityDetailShell`). A `FormDrawer` brings its own header; a
6
6
  * form inside another entity's detail shell passes `nested` (an `h2`, never a second page title).
7
7
  */
8
- export const FormHeader = ({ title, description, leading, actions, nested, className }) => (_jsx(DetailHeader, { back: leading, title: title, description: description, aside: actions, nested: nested, className: className }));
8
+ export const FormHeader = ({ title, description, leading, actions, nested, formActionsSlot, className }) => (_jsx(DetailHeader, { back: leading, title: title, description: description, aside: actions, nested: nested, formActionsSlot: formActionsSlot, className: className }));
9
9
  //# sourceMappingURL=FormHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormHeader.js","sourceRoot":"","sources":["../../src/form/FormHeader.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAA0B,CAAC;AAexD;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAmB,EAAE,EAAE,CAAC,CAC1G,KAAC,YAAY,IACX,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GACpB,CACH,CAAC"}
1
+ {"version":3,"file":"FormHeader.js","sourceRoot":"","sources":["../../src/form/FormHeader.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAA0B,CAAC;AAoBxD;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAmB,EAAE,EAAE,CAAC,CAC3H,KAAC,YAAY,IACX,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,GACpB,CACH,CAAC"}
@@ -7,11 +7,16 @@ export interface FormSubmitButtonProps {
7
7
  disabled?: boolean;
8
8
  /** Extra pending source outside the submit handler (a mutation still loading). */
9
9
  isPending?: boolean;
10
+ /**
11
+ * A submit that only reads (a search, a preview): not disabled by `WriteAccessProvider`. Without it the button is
12
+ * disabled while writes are not allowed, with the reason as its title.
13
+ */
14
+ ignoreWriteAccess?: boolean;
10
15
  className?: string;
11
16
  }
12
17
  /**
13
18
  * The form's primary button: `type="submit"`, disabled and relabelled while the submit is pending. Label standard:
14
19
  * `Save` / `Saving…` on edit, `Create <Entity>` / `Creating <Entity>…` on create.
15
20
  */
16
- export declare const FormSubmitButton: ({ children, pendingLabel, disabled, isPending, className, }: FormSubmitButtonProps) => import("react").JSX.Element;
21
+ export declare const FormSubmitButton: ({ children, pendingLabel, disabled, isPending, ignoreWriteAccess, className, }: FormSubmitButtonProps) => import("react").JSX.Element;
17
22
  //# sourceMappingURL=FormSubmitButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormSubmitButton.d.ts","sourceRoot":"","sources":["../../src/form/FormSubmitButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,6FAA6F;IAC7F,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,6DAM9B,qBAAqB,gCAQvB,CAAC"}
1
+ {"version":3,"file":"FormSubmitButton.d.ts","sourceRoot":"","sources":["../../src/form/FormSubmitButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,6FAA6F;IAC7F,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,gFAO9B,qBAAqB,gCAevB,CAAC"}