@namroodinc/liquid-editorial 0.6.3 → 0.6.5

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 (142) hide show
  1. package/README.md +74 -2
  2. package/UPGRADING.md +128 -0
  3. package/dist/chunks/{Avatar-C1q2AUD-.js → Avatar-BtblwihO.js} +2 -2
  4. package/dist/chunks/{Avatar-C1q2AUD-.js.map → Avatar-BtblwihO.js.map} +1 -1
  5. package/dist/chunks/{Avatar-BTKqaJLP.cjs → Avatar-C9ublbzK.cjs} +2 -2
  6. package/dist/chunks/{Avatar-BTKqaJLP.cjs.map → Avatar-C9ublbzK.cjs.map} +1 -1
  7. package/dist/chunks/{Board-Ct1t69ot.cjs → Board-CUt4j2-8.cjs} +2 -2
  8. package/dist/chunks/{Board-Ct1t69ot.cjs.map → Board-CUt4j2-8.cjs.map} +1 -1
  9. package/dist/chunks/{Board-BYPzybjf.js → Board-z688-51u.js} +2 -2
  10. package/dist/chunks/{Board-BYPzybjf.js.map → Board-z688-51u.js.map} +1 -1
  11. package/dist/chunks/ColourField-BqhYB4ZE.cjs +2 -0
  12. package/dist/chunks/ColourField-BqhYB4ZE.cjs.map +1 -0
  13. package/dist/chunks/{ColourField-Do0rHk-Y.js → ColourField-DXGpNP08.js} +7 -3
  14. package/dist/chunks/ColourField-DXGpNP08.js.map +1 -0
  15. package/dist/chunks/DatePicker-01sor8iD.cjs +2 -0
  16. package/dist/chunks/DatePicker-01sor8iD.cjs.map +1 -0
  17. package/dist/chunks/{DatePicker-B8L-oodC.js → DatePicker-DJAqXUDJ.js} +3 -3
  18. package/dist/chunks/DatePicker-DJAqXUDJ.js.map +1 -0
  19. package/dist/chunks/{FormEditor-a3kHVLQB.cjs → FormEditor-BbsvbufQ.cjs} +2 -2
  20. package/dist/chunks/{FormEditor-a3kHVLQB.cjs.map → FormEditor-BbsvbufQ.cjs.map} +1 -1
  21. package/dist/chunks/{FormEditor-CwQN8tRw.js → FormEditor-C5XtP-N7.js} +3 -3
  22. package/dist/chunks/{FormEditor-CwQN8tRw.js.map → FormEditor-C5XtP-N7.js.map} +1 -1
  23. package/dist/chunks/{Icon-D7GrTtqc.cjs → Icon-WOhlu6Rp.cjs} +2 -2
  24. package/dist/chunks/Icon-WOhlu6Rp.cjs.map +1 -0
  25. package/dist/chunks/{Icon-BZjGAu8D.js → Icon-spaFBU4S.js} +34 -33
  26. package/dist/chunks/Icon-spaFBU4S.js.map +1 -0
  27. package/dist/chunks/Message-CaX8Y1Xb.js +74 -0
  28. package/dist/chunks/Message-CaX8Y1Xb.js.map +1 -0
  29. package/dist/chunks/Message-DU31JAb3.cjs +2 -0
  30. package/dist/chunks/Message-DU31JAb3.cjs.map +1 -0
  31. package/dist/chunks/{useTooltip-D6cJji8v.js → useTooltip-C5gvEoYk.js} +2 -1
  32. package/dist/chunks/{useTooltip-D6cJji8v.js.map → useTooltip-C5gvEoYk.js.map} +1 -1
  33. package/dist/chunks/{useTooltip-CCf79zE9.cjs → useTooltip-bTE_a2Xn.cjs} +2 -2
  34. package/dist/chunks/{useTooltip-CCf79zE9.cjs.map → useTooltip-bTE_a2Xn.cjs.map} +1 -1
  35. package/dist/components/AssetCard/index.cjs +1 -1
  36. package/dist/components/AssetCard/index.js +1 -1
  37. package/dist/components/AssetGrid/index.cjs +1 -1
  38. package/dist/components/AssetGrid/index.js +1 -1
  39. package/dist/components/Avatar/index.cjs +1 -1
  40. package/dist/components/Avatar/index.js +1 -1
  41. package/dist/components/Banner/index.cjs +2 -0
  42. package/dist/components/Banner/index.cjs.map +1 -0
  43. package/dist/components/Banner/index.d.cts +6 -0
  44. package/dist/components/Banner/index.d.cts.map +1 -0
  45. package/dist/components/Banner/index.d.ts +6 -0
  46. package/dist/components/Banner/index.d.ts.map +1 -0
  47. package/dist/components/Banner/index.js +18 -0
  48. package/dist/components/Banner/index.js.map +1 -0
  49. package/dist/components/Banner/style.css +6 -0
  50. package/dist/components/Board/index.cjs +1 -1
  51. package/dist/components/Board/index.js +1 -1
  52. package/dist/components/Button/index.cjs +1 -1
  53. package/dist/components/Button/index.js +1 -1
  54. package/dist/components/ColourField/index.cjs +1 -1
  55. package/dist/components/ColourField/index.js +1 -1
  56. package/dist/components/DatePicker/index.cjs +1 -1
  57. package/dist/components/DatePicker/index.js +1 -1
  58. package/dist/components/Drawer/index.cjs +1 -1
  59. package/dist/components/Drawer/index.cjs.map +1 -1
  60. package/dist/components/Drawer/index.js +5 -1
  61. package/dist/components/Drawer/index.js.map +1 -1
  62. package/dist/components/EditLayout/index.cjs +1 -1
  63. package/dist/components/EditLayout/index.cjs.map +1 -1
  64. package/dist/components/EditLayout/index.d.cts +6 -0
  65. package/dist/components/EditLayout/index.d.cts.map +1 -1
  66. package/dist/components/EditLayout/index.d.ts +6 -0
  67. package/dist/components/EditLayout/index.d.ts.map +1 -1
  68. package/dist/components/EditLayout/index.js +104 -97
  69. package/dist/components/EditLayout/index.js.map +1 -1
  70. package/dist/components/EditLayout/style.css +8 -1
  71. package/dist/components/EntryPicker/index.cjs +1 -1
  72. package/dist/components/EntryPicker/index.js +1 -1
  73. package/dist/components/FormEditor/index.cjs +1 -1
  74. package/dist/components/FormEditor/index.js +1 -1
  75. package/dist/components/Icon/icons.d.cts +1 -0
  76. package/dist/components/Icon/icons.d.cts.map +1 -1
  77. package/dist/components/Icon/icons.d.ts +1 -0
  78. package/dist/components/Icon/icons.d.ts.map +1 -1
  79. package/dist/components/Icon/index.cjs +1 -1
  80. package/dist/components/Icon/index.js +1 -1
  81. package/dist/components/Menu/index.cjs +1 -1
  82. package/dist/components/Menu/index.cjs.map +1 -1
  83. package/dist/components/Menu/index.js +1 -1
  84. package/dist/components/Menu/index.js.map +1 -1
  85. package/dist/components/Modal/index.cjs +1 -1
  86. package/dist/components/Modal/index.cjs.map +1 -1
  87. package/dist/components/Modal/index.js +5 -1
  88. package/dist/components/Modal/index.js.map +1 -1
  89. package/dist/components/Popover/style.css +2 -1
  90. package/dist/components/Popover/useTooltip.d.cts.map +1 -1
  91. package/dist/components/Popover/useTooltip.d.ts.map +1 -1
  92. package/dist/components/SearchField/index.cjs +1 -1
  93. package/dist/components/SearchField/index.js +1 -1
  94. package/dist/components/Select/index.cjs +1 -1
  95. package/dist/components/Select/index.cjs.map +1 -1
  96. package/dist/components/Select/index.js +2 -2
  97. package/dist/components/Select/index.js.map +1 -1
  98. package/dist/components/SideNav/index.cjs +1 -1
  99. package/dist/components/SideNav/index.js +1 -1
  100. package/dist/components/SortableList/index.cjs +1 -1
  101. package/dist/components/SortableList/index.js +1 -1
  102. package/dist/components/Stepper/index.cjs +1 -1
  103. package/dist/components/Stepper/index.js +1 -1
  104. package/dist/components/SubNav/index.cjs +1 -1
  105. package/dist/components/SubNav/index.js +1 -1
  106. package/dist/components/Table/index.cjs +1 -1
  107. package/dist/components/Table/index.cjs.map +1 -1
  108. package/dist/components/Table/index.js +2 -2
  109. package/dist/components/Table/index.js.map +1 -1
  110. package/dist/components/Time/index.cjs +1 -1
  111. package/dist/components/Time/index.js +1 -1
  112. package/dist/components/Toast/index.cjs +1 -1
  113. package/dist/components/Toast/index.cjs.map +1 -1
  114. package/dist/components/Toast/index.d.cts.map +1 -1
  115. package/dist/components/Toast/index.d.ts.map +1 -1
  116. package/dist/components/Toast/index.js +35 -60
  117. package/dist/components/Toast/index.js.map +1 -1
  118. package/dist/components/Toast/style.css +5 -50
  119. package/dist/components/TopNav/index.cjs +1 -1
  120. package/dist/components/TopNav/index.js +1 -1
  121. package/dist/index.cjs +1 -1
  122. package/dist/index.d.cts +2 -0
  123. package/dist/index.d.cts.map +1 -1
  124. package/dist/index.d.ts +2 -0
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +16 -15
  127. package/dist/internal/Message.d.cts +23 -0
  128. package/dist/internal/Message.d.cts.map +1 -0
  129. package/dist/internal/Message.d.ts +23 -0
  130. package/dist/internal/Message.d.ts.map +1 -0
  131. package/dist/message.css +122 -0
  132. package/dist/styles.css +2 -0
  133. package/dist/tokens.css +36 -12
  134. package/package.json +1 -1
  135. package/dist/chunks/ColourField-DDGuWWNH.cjs +0 -2
  136. package/dist/chunks/ColourField-DDGuWWNH.cjs.map +0 -1
  137. package/dist/chunks/ColourField-Do0rHk-Y.js.map +0 -1
  138. package/dist/chunks/DatePicker-B8L-oodC.js.map +0 -1
  139. package/dist/chunks/DatePicker-hjpY6Sti.cjs +0 -2
  140. package/dist/chunks/DatePicker-hjpY6Sti.cjs.map +0 -1
  141. package/dist/chunks/Icon-BZjGAu8D.js.map +0 -1
  142. package/dist/chunks/Icon-D7GrTtqc.cjs.map +0 -1
@@ -4,6 +4,12 @@ export interface EditLayoutProps extends HTMLAttributes<HTMLDivElement> {
4
4
  backLabel: string;
5
5
  onBack: () => void;
6
6
  saveState?: EditSaveState;
7
+ /**
8
+ * Replaces the `clean` or `dirty` message, for example on a read-only record.
9
+ * Saving, saved, error and offline keep their standard messages, and
10
+ * `saveState` always controls the indicator and colour. Empty values are ignored.
11
+ */
12
+ statusLabel?: ReactNode;
7
13
  savedAgo?: ReactNode;
8
14
  actions?: ReactNode;
9
15
  /** A render slot can close the Details sheet before opening another dialog. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/EditLayout/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAUf,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzF,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,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SAAS,GAAG,CAAC,CAAC,YAAY,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC,CAAC;IAC5D,sEAAsE;IACtE,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAsQD,sFAAsF;AACtF,eAAO,MAAM,UAAU,4GAwLrB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../chunks/Icon-BZjGAu8D.js";
1
+ import { t as e } from "../../chunks/Icon-spaFBU4S.js";
2
2
  import { Button as t } from "../Button/index.js";
3
3
  import { t as n } from "../../chunks/mergeRefs-DGM402mE.js";
4
4
  import { i as r } from "../../chunks/portalScope-AzzPM54i.js";
@@ -6,57 +6,63 @@ import { Drawer as i } from "../Drawer/index.js";
6
6
  import { t as a } from "../../chunks/observeElementWidth-BlQOlW2t.js";
7
7
  import { n as o, t as s } from "../../chunks/movableHost-NJj_FsAu.js";
8
8
  import { forwardRef as c, useEffect as l, useId as u, useLayoutEffect as d, useMemo as ee, useRef as f, useState as p } from "react";
9
- import { createPortal as te, flushSync as m } from "react-dom";
10
- import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
9
+ import { createPortal as m, flushSync as h } from "react-dom";
10
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
11
11
  //#region src/components/EditLayout/index.tsx
12
- var v = 360, y = 600, b = 900;
13
- function ne(e) {
14
- return e < v ? "tight" : e < y ? "compact" : e < b ? "narrow" : "wide";
12
+ var y = 360, b = 600, x = 900;
13
+ function te(e) {
14
+ return e < y ? "tight" : e < b ? "compact" : e < x ? "narrow" : "wide";
15
15
  }
16
- var x = {
16
+ var S = {
17
17
  clean: "No changes",
18
18
  dirty: "Unsaved changes",
19
19
  saving: "Saving…",
20
20
  saved: "Saved",
21
21
  error: "Couldn't save",
22
22
  offline: "Offline · kept in this tab"
23
- }, S = {
23
+ }, C = {
24
24
  clean: void 0,
25
25
  dirty: void 0,
26
26
  saving: "spinner",
27
27
  saved: "check",
28
28
  error: "alert-triangle",
29
29
  offline: "clock"
30
- };
31
- function C({ saveState: t, savedAgo: n }) {
32
- let r = S[t];
33
- return /* @__PURE__ */ _("div", {
30
+ }, w = /* @__PURE__ */ new Set(["clean", "dirty"]);
31
+ function T(e) {
32
+ return typeof e == "string" ? e.trim() !== "" : e != null && typeof e != "boolean";
33
+ }
34
+ function E({ saveState: t, savedAgo: n, statusLabel: r }) {
35
+ let i = C[t], a = w.has(t) && T(r) ? r : void 0;
36
+ return /* @__PURE__ */ v("div", {
34
37
  className: "ds-edit-layout__status",
35
38
  "data-state": t,
36
39
  role: "status",
37
40
  "aria-live": "polite",
38
41
  children: [
39
- r && /* @__PURE__ */ g(e, {
40
- name: r,
42
+ i && /* @__PURE__ */ _(e, {
43
+ name: i,
41
44
  className: t === "saving" ? "ds-icon--spin" : void 0
42
45
  }),
43
- t === "dirty" && /* @__PURE__ */ g("span", {
46
+ t === "dirty" && /* @__PURE__ */ _("span", {
44
47
  className: "ds-edit-layout__dirty",
45
48
  "aria-hidden": "true"
46
49
  }),
47
- /* @__PURE__ */ _("span", { children: [x[t], t === "saved" && n ? /* @__PURE__ */ _(h, { children: [" ", n] }) : null] })
50
+ /* @__PURE__ */ v("span", {
51
+ title: typeof a == "string" ? a : void 0,
52
+ children: [a ?? S[t], t === "saved" && n ? /* @__PURE__ */ v(g, { children: [" ", n] }) : null]
53
+ })
48
54
  ]
49
55
  });
50
56
  }
51
- function w({ text: e, bodyRef: n, onKeepEditing: r }) {
57
+ function ne({ text: e, bodyRef: n, onKeepEditing: r }) {
52
58
  let i = f(null), a = f(null);
53
59
  return l(() => {
54
60
  a.current = document.activeElement;
55
61
  let e = requestAnimationFrame(() => i.current?.focus({ preventScroll: !0 }));
56
62
  return () => cancelAnimationFrame(e);
57
- }, []), /* @__PURE__ */ _("div", {
63
+ }, []), /* @__PURE__ */ v("div", {
58
64
  className: "ds-edit-layout__confirmation",
59
- children: [/* @__PURE__ */ g("strong", { children: e }), /* @__PURE__ */ g(t, {
65
+ children: [/* @__PURE__ */ _("strong", { children: e }), /* @__PURE__ */ _(t, {
60
66
  ref: i,
61
67
  size: "xs",
62
68
  onClick: () => {
@@ -68,11 +74,11 @@ function w({ text: e, bodyRef: n, onKeepEditing: r }) {
68
74
  })]
69
75
  });
70
76
  }
71
- function T({ backLabel: e, onBack: n, compact: r, status: i, actions: a, confirmLeave: o, confirmation: s, onLeave: c, detailsToggle: l }) {
72
- return /* @__PURE__ */ _("header", {
77
+ function D({ backLabel: e, onBack: n, compact: r, status: i, actions: a, confirmLeave: o, confirmation: s, onLeave: c, detailsToggle: l }) {
78
+ return /* @__PURE__ */ v("header", {
73
79
  className: "ds-edit-layout__bar",
74
80
  children: [
75
- /* @__PURE__ */ g(t, {
81
+ /* @__PURE__ */ _(t, {
76
82
  variant: "simple",
77
83
  size: "sm",
78
84
  iconStart: "arrow-left",
@@ -82,9 +88,9 @@ function T({ backLabel: e, onBack: n, compact: r, status: i, actions: a, confirm
82
88
  children: e
83
89
  }),
84
90
  o ? s : i,
85
- /* @__PURE__ */ _("div", {
91
+ /* @__PURE__ */ v("div", {
86
92
  className: "ds-edit-layout__actions",
87
- children: [o ? /* @__PURE__ */ g(t, {
93
+ children: [o ? /* @__PURE__ */ _(t, {
88
94
  variant: "danger",
89
95
  size: "sm",
90
96
  onClick: c,
@@ -94,13 +100,13 @@ function T({ backLabel: e, onBack: n, compact: r, status: i, actions: a, confirm
94
100
  ]
95
101
  });
96
102
  }
97
- function E({ label: e, detailsId: n, expanded: r, opensSheet: i, sheetOpen: a, toggleRef: o, contentRef: s, collapsed: c, onToggle: l }) {
98
- return /* @__PURE__ */ _("aside", {
103
+ function re({ label: e, detailsId: n, expanded: r, opensSheet: i, sheetOpen: a, toggleRef: o, contentRef: s, collapsed: c, onToggle: l }) {
104
+ return /* @__PURE__ */ v("aside", {
99
105
  className: "ds-edit-layout__rail",
100
106
  "aria-label": e,
101
- children: [/* @__PURE__ */ _("header", {
107
+ children: [/* @__PURE__ */ v("header", {
102
108
  className: "ds-edit-layout__rail-head",
103
- children: [r && /* @__PURE__ */ g("span", { children: e }), /* @__PURE__ */ g(t, {
109
+ children: [r && /* @__PURE__ */ _("span", { children: e }), /* @__PURE__ */ _(t, {
104
110
  ref: o,
105
111
  variant: "simple",
106
112
  size: "sm",
@@ -113,13 +119,13 @@ function E({ label: e, detailsId: n, expanded: r, opensSheet: i, sheetOpen: a, t
113
119
  "aria-haspopup": i ? "dialog" : void 0,
114
120
  onClick: l
115
121
  })]
116
- }), r ? /* @__PURE__ */ g("div", {
122
+ }), r ? /* @__PURE__ */ _("div", {
117
123
  id: n,
118
124
  ref: s,
119
125
  className: "ds-edit-layout__rail-content"
120
- }) : /* @__PURE__ */ g("div", {
126
+ }) : /* @__PURE__ */ _("div", {
121
127
  className: "ds-edit-layout__rail-icons",
122
- children: c ? c(l) : /* @__PURE__ */ g(t, {
128
+ children: c ? c(l) : /* @__PURE__ */ _(t, {
123
129
  variant: "simple",
124
130
  size: "sm",
125
131
  isIconOnly: !0,
@@ -130,109 +136,110 @@ function E({ label: e, detailsId: n, expanded: r, opensSheet: i, sheetOpen: a, t
130
136
  })]
131
137
  });
132
138
  }
133
- var D = c(function({ backLabel: e, onBack: c, saveState: h = "clean", savedAgo: v, actions: y, rail: b, railCollapsed: x, railLabel: S = "Details", railOpen: D, defaultRailOpen: O = !0, onRailToggle: k, confirmLeave: A = !1, confirmText: re = "Leave without saving?", onKeepEditing: ie, onLeave: ae, children: oe, className: se, onFocus: ce, ...j }, M) {
134
- let N = f(null), P = ee(() => n(N, M), [M]), F = f(null), I = f(null), L = f(null), R = f(null), z = f(null), [B] = p(() => s("ds-edit-layout__rail-host")), [V, H] = p("wide"), [U, W] = p(O), [G, K] = p(!1), [le, q] = p(!1), J = u(), Y = V === "tight" || V === "compact", X = V !== "wide", Z = !X && (D ?? U);
135
- G && (A || !X) && K(!1), d(() => {
139
+ var O = c(function({ backLabel: e, onBack: c, saveState: g = "clean", statusLabel: y, savedAgo: b, actions: x, rail: S, railCollapsed: C, railLabel: w = "Details", railOpen: T, defaultRailOpen: O = !0, onRailToggle: k, confirmLeave: A = !1, confirmText: j = "Leave without saving?", onKeepEditing: M, onLeave: ie, children: ae, className: oe, onFocus: se, ...N }, P) {
140
+ let F = f(null), I = ee(() => n(F, P), [P]), L = f(null), R = f(null), z = f(null), B = f(null), V = f(null), [H] = p(() => s("ds-edit-layout__rail-host")), [U, W] = p("wide"), [G, ce] = p(O), [K, q] = p(!1), [le, J] = p(!1), Y = u(), X = U === "tight" || U === "compact", Z = U !== "wide", Q = !Z && (T ?? G);
141
+ K && (A || !Z) && q(!1), d(() => {
136
142
  let e;
137
- return a(N.current, (t) => {
138
- let n = ne(t);
139
- n !== e && (e = n, q(!1), H(n));
143
+ return a(F.current, (t) => {
144
+ let n = te(t);
145
+ n !== e && (e = n, J(!1), W(n));
140
146
  });
141
147
  }, []), d(() => {
142
- B && o(B, L.current ?? R.current, z.current);
148
+ H && o(H, z.current ?? B.current, V.current);
143
149
  }), l(() => {
144
- let e = z.current;
145
- e && r(e) && r(document.activeElement) && I.current?.focus({ preventScroll: !0 });
150
+ let e = V.current;
151
+ e && r(e) && r(document.activeElement) && R.current?.focus({ preventScroll: !0 });
146
152
  }, [
147
- V,
148
- Z,
149
- G
153
+ U,
154
+ Q,
155
+ K
150
156
  ]);
151
- let Q = () => {
152
- X ? K(!0) : (q(!0), W(!Z), k?.(!Z));
153
- }, $ = typeof b == "function" ? b(() => m(() => K(!1))) : b;
154
- return /* @__PURE__ */ _("div", {
155
- ...j,
156
- ref: P,
157
- className: ["ds-edit-layout", se].filter(Boolean).join(" "),
158
- "data-compact": Y || void 0,
159
- "data-tight": V === "tight" || void 0,
160
- "data-expanded": Z || void 0,
157
+ let $ = () => {
158
+ Z ? q(!0) : (J(!0), ce(!Q), k?.(!Q));
159
+ }, ue = typeof S == "function" ? S(() => h(() => q(!1))) : S;
160
+ return /* @__PURE__ */ v("div", {
161
+ ...N,
162
+ ref: I,
163
+ className: ["ds-edit-layout", oe].filter(Boolean).join(" "),
164
+ "data-compact": X || void 0,
165
+ "data-tight": U === "tight" || void 0,
166
+ "data-expanded": Q || void 0,
161
167
  "data-animate": le || void 0,
162
168
  onFocus: (e) => {
163
- z.current = e.target, ce?.(e);
169
+ V.current = e.target, se?.(e);
164
170
  },
165
171
  children: [
166
- /* @__PURE__ */ _("div", {
172
+ /* @__PURE__ */ v("div", {
167
173
  className: "ds-edit-layout__main",
168
- children: [/* @__PURE__ */ g(T, {
174
+ children: [/* @__PURE__ */ _(D, {
169
175
  backLabel: e,
170
176
  onBack: c,
171
- compact: Y,
172
- status: /* @__PURE__ */ g(C, {
173
- saveState: h,
174
- savedAgo: v
177
+ compact: X,
178
+ status: /* @__PURE__ */ _(E, {
179
+ saveState: g,
180
+ statusLabel: y,
181
+ savedAgo: b
175
182
  }),
176
- actions: y,
183
+ actions: x,
177
184
  confirmLeave: A,
178
- confirmation: /* @__PURE__ */ g(w, {
179
- text: re,
180
- bodyRef: F,
181
- onKeepEditing: ie
185
+ confirmation: /* @__PURE__ */ _(ne, {
186
+ text: j,
187
+ bodyRef: L,
188
+ onKeepEditing: M
182
189
  }),
183
- onLeave: ae,
184
- detailsToggle: /* @__PURE__ */ g(t, {
185
- ref: I,
190
+ onLeave: ie,
191
+ detailsToggle: /* @__PURE__ */ _(t, {
192
+ ref: R,
186
193
  variant: "simple",
187
194
  size: "sm",
188
195
  isIconOnly: !0,
189
196
  iconStart: "info",
190
- "aria-label": S,
197
+ "aria-label": w,
191
198
  "aria-haspopup": "dialog",
192
- "aria-expanded": G,
193
- "aria-controls": J,
194
- onClick: Q
199
+ "aria-expanded": K,
200
+ "aria-controls": Y,
201
+ onClick: $
195
202
  })
196
- }), /* @__PURE__ */ g("div", {
197
- ref: F,
203
+ }), /* @__PURE__ */ _("div", {
204
+ ref: L,
198
205
  className: "ds-edit-layout__body",
199
- children: /* @__PURE__ */ g("div", {
206
+ children: /* @__PURE__ */ _("div", {
200
207
  className: "ds-edit-layout__content",
201
- children: oe
208
+ children: ae
202
209
  })
203
210
  })]
204
211
  }),
205
- !Y && /* @__PURE__ */ g(E, {
206
- label: S,
207
- detailsId: J,
208
- expanded: Z,
209
- opensSheet: X,
210
- sheetOpen: G,
211
- toggleRef: I,
212
- contentRef: L,
213
- collapsed: x,
214
- onToggle: Q
212
+ !X && /* @__PURE__ */ _(re, {
213
+ label: w,
214
+ detailsId: Y,
215
+ expanded: Q,
216
+ opensSheet: Z,
217
+ sheetOpen: K,
218
+ toggleRef: R,
219
+ contentRef: z,
220
+ collapsed: C,
221
+ onToggle: $
215
222
  }),
216
- /* @__PURE__ */ g(i, {
217
- id: X ? J : void 0,
218
- dir: j.dir,
219
- isOpen: G,
220
- onClose: () => K(!1),
223
+ /* @__PURE__ */ _(i, {
224
+ id: Z ? Y : void 0,
225
+ dir: N.dir,
226
+ isOpen: K,
227
+ onClose: () => q(!1),
221
228
  side: "end",
222
229
  size: "md",
223
- title: S,
224
- closeLabel: `Close ${S}`,
230
+ title: w,
231
+ closeLabel: `Close ${w}`,
225
232
  className: "ds-edit-layout__sheet",
226
- children: X && /* @__PURE__ */ g("div", {
227
- ref: R,
233
+ children: Z && /* @__PURE__ */ _("div", {
234
+ ref: B,
228
235
  className: "ds-edit-layout__rail-content"
229
236
  })
230
237
  }),
231
- B && te($, B)
238
+ H && m(ue, H)
232
239
  ]
233
240
  });
234
241
  });
235
242
  //#endregion
236
- export { D as EditLayout };
243
+ export { O as EditLayout };
237
244
 
238
245
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_Fragment","Icon","mergeRefs","cannotHoldFocus","observeElementWidth","moveHost","createMovableHost","Fragment$1","TIGHT_WIDTH","COMPACT_WIDTH","WIDE_WIDTH","layoutMode","width","statusLabels","statusIcons","SaveStatus","icon","saveState","savedAgo","LeaveConfirmation","keepRef","useRef","origin","useEffect","frame","text","Button","onKeepEditing","bodyRef","EditActionBar","compact","backLabel","onBack","confirmLeave","confirmation","status","onLeave","actions","detailsToggle","DetailsRail","label","expanded","toggleRef","sheetOpen","detailsId","opensSheet","onToggle","contentRef","collapsed","EditLayout","forwardRef","rest","rootRef","mergedRef","useMemo","ref","railSlotRef","sheetSlotRef","lastFocus","railHost","useState","mode","setMode","localOpen","setLocalOpen","defaultRailOpen","sheet","setSheet","animate","setAnimate","useId","narrow","railOpen","useLayoutEffect","current","next","last","toggle","onRailToggle","railContent","rail","flushSync","className","event","onFocus","confirmText","railLabel","railCollapsed","Drawer","createPortal"],"sources":["../../../src/components/EditLayout/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal, flushSync } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { Drawer } from \"../Drawer\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport { cannotHoldFocus } from \"../../internal/dialogFocus\";\nimport { createMovableHost, moveHost } from \"../../internal/movableHost\";\nimport \"./style.css\";\n\nexport type EditSaveState = \"clean\" | \"dirty\" | \"saving\" | \"saved\" | \"error\" | \"offline\";\n\nexport interface EditLayoutProps extends HTMLAttributes<HTMLDivElement> {\n backLabel: string;\n onBack: () => void;\n saveState?: EditSaveState;\n savedAgo?: ReactNode;\n actions?: ReactNode;\n /** A render slot can close the Details sheet before opening another dialog. */\n rail: ReactNode | ((closeDetails: () => void) => ReactNode);\n /** Custom collapsed controls receive the accessible expand action. */\n railCollapsed?: (expand: () => void) => ReactNode;\n railLabel?: string;\n railOpen?: boolean;\n defaultRailOpen?: boolean;\n onRailToggle?: (open: boolean) => void;\n confirmLeave?: boolean;\n confirmText?: string;\n onKeepEditing?: () => void;\n onLeave?: () => void;\n children?: ReactNode;\n}\n\n/** Below this width, the action bar's gaps and padding contract. */\nconst TIGHT_WIDTH = 360;\n/** Below this width, Details opens from the action bar. */\nconst COMPACT_WIDTH = 600;\n/** From this width, the rail follows the open/closed preference. */\nconst WIDE_WIDTH = 900;\n\ntype LayoutMode = \"tight\" | \"compact\" | \"narrow\" | \"wide\";\n\nfunction layoutMode(width: number): LayoutMode {\n if (width < TIGHT_WIDTH) {\n return \"tight\";\n }\n if (width < COMPACT_WIDTH) {\n return \"compact\";\n }\n if (width < WIDE_WIDTH) {\n return \"narrow\";\n }\n return \"wide\";\n}\n\nconst statusLabels: Record<EditSaveState, string> = {\n clean: \"No changes\",\n dirty: \"Unsaved changes\",\n saving: \"Saving…\",\n saved: \"Saved\",\n error: \"Couldn't save\",\n offline: \"Offline · kept in this tab\",\n};\n\nconst statusIcons: Record<EditSaveState, IconName | undefined> = {\n clean: undefined,\n dirty: undefined,\n saving: \"spinner\",\n saved: \"check\",\n error: \"alert-triangle\",\n offline: \"clock\",\n};\n\ninterface SaveStatusProps {\n saveState: EditSaveState;\n savedAgo?: ReactNode;\n}\n\nfunction SaveStatus({ saveState, savedAgo }: SaveStatusProps) {\n const icon = statusIcons[saveState];\n return (\n <div\n className=\"ds-edit-layout__status\"\n data-state={saveState}\n role=\"status\"\n aria-live=\"polite\"\n >\n {icon && (\n <Icon\n name={icon}\n className={saveState === \"saving\" ? \"ds-icon--spin\" : undefined}\n />\n )}\n {saveState === \"dirty\" && (\n <span\n className=\"ds-edit-layout__dirty\"\n aria-hidden=\"true\"\n />\n )}\n <span>\n {statusLabels[saveState]}\n {saveState === \"saved\" && savedAgo ? <> {savedAgo}</> : null}\n </span>\n </div>\n );\n}\n\ninterface LeaveConfirmationProps {\n text: string;\n /** Keep editing falls back to the first control here when its origin is gone. */\n bodyRef: RefObject<HTMLDivElement | null>;\n onKeepEditing?: () => void;\n}\n\n/** Takes focus while shown; Keep editing returns it to where the user was. */\nfunction LeaveConfirmation({ text, bodyRef, onKeepEditing }: LeaveConfirmationProps) {\n const keepRef = useRef<HTMLButtonElement>(null);\n const origin = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n origin.current = document.activeElement as HTMLElement | null;\n const frame = requestAnimationFrame(() => keepRef.current?.focus({ preventScroll: true }));\n return () => cancelAnimationFrame(frame);\n }, []);\n\n const keepEditing = () => {\n onKeepEditing?.();\n requestAnimationFrame(() => {\n const destination = origin.current?.isConnected\n ? origin.current\n : bodyRef.current?.querySelector<HTMLElement>(\n \"input, textarea, button, [contenteditable='true']\",\n );\n destination?.focus({ preventScroll: true });\n });\n };\n\n return (\n <div className=\"ds-edit-layout__confirmation\">\n <strong>{text}</strong>\n <Button\n ref={keepRef}\n size=\"xs\"\n onClick={keepEditing}\n >\n Keep editing\n </Button>\n </div>\n );\n}\n\ninterface EditActionBarProps {\n backLabel: string;\n onBack: () => void;\n compact: boolean;\n status: ReactNode;\n actions?: ReactNode;\n /** Replaces the status and actions while set. */\n confirmLeave: boolean;\n confirmation: ReactNode;\n onLeave?: () => void;\n /** Shown only in compact layouts, where Details opens as a sheet. */\n detailsToggle: ReactNode;\n}\n\nfunction EditActionBar({\n backLabel,\n onBack,\n compact,\n status,\n actions,\n confirmLeave,\n confirmation,\n onLeave,\n detailsToggle,\n}: EditActionBarProps) {\n return (\n <header className=\"ds-edit-layout__bar\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"arrow-left\"\n isIconOnly={compact}\n aria-label={`Back to ${backLabel}`}\n onClick={onBack}\n >\n {backLabel}\n </Button>\n {confirmLeave ? confirmation : status}\n <div className=\"ds-edit-layout__actions\">\n {confirmLeave ? (\n <Button\n variant=\"danger\"\n size=\"sm\"\n onClick={onLeave}\n >\n Leave anyway\n </Button>\n ) : (\n actions\n )}\n {compact && detailsToggle}\n </div>\n </header>\n );\n}\n\ninterface DetailsRailProps {\n label: string;\n detailsId: string;\n expanded: boolean;\n /** Below the wide breakpoint, the toggle opens the Details sheet instead. */\n opensSheet: boolean;\n sheetOpen: boolean;\n toggleRef: RefObject<HTMLButtonElement | null>;\n /** Receives the rail content while the rail is expanded. */\n contentRef: RefObject<HTMLDivElement | null>;\n collapsed?: (expand: () => void) => ReactNode;\n onToggle: () => void;\n}\n\nfunction DetailsRail({\n label,\n detailsId,\n expanded,\n opensSheet,\n sheetOpen,\n toggleRef,\n contentRef,\n collapsed,\n onToggle,\n}: DetailsRailProps) {\n return (\n <aside\n className=\"ds-edit-layout__rail\"\n aria-label={label}\n >\n <header className=\"ds-edit-layout__rail-head\">\n {expanded && <span>{label}</span>}\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart={expanded ? \"chevrons-right\" : \"chevrons-left\"}\n className=\"ds-edit-layout__toggle\"\n aria-label={`${expanded ? \"Collapse\" : \"Expand\"} ${label}`}\n aria-expanded={expanded || sheetOpen}\n aria-controls={detailsId}\n aria-haspopup={opensSheet ? \"dialog\" : undefined}\n onClick={onToggle}\n />\n </header>\n {expanded ? (\n <div\n id={detailsId}\n ref={contentRef}\n className=\"ds-edit-layout__rail-content\"\n />\n ) : (\n <div className=\"ds-edit-layout__rail-icons\">\n {collapsed ? (\n collapsed(onToggle)\n ) : (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={`Show ${label}`}\n onClick={onToggle}\n />\n )}\n </div>\n )}\n </aside>\n );\n}\n\n/** Presentation only: the consumer owns saving, routing and persisted preferences. */\nexport const EditLayout = forwardRef<HTMLDivElement, EditLayoutProps>(function EditLayout(\n {\n backLabel,\n onBack,\n saveState = \"clean\",\n savedAgo,\n actions,\n rail,\n railCollapsed,\n railLabel = \"Details\",\n railOpen,\n defaultRailOpen = true,\n onRailToggle,\n confirmLeave = false,\n confirmText = \"Leave without saving?\",\n onKeepEditing,\n onLeave,\n children,\n className,\n onFocus,\n ...rest\n },\n ref,\n) {\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMemo(() => mergeRefs(rootRef, ref), [ref]);\n const bodyRef = useRef<HTMLDivElement>(null);\n const toggleRef = useRef<HTMLButtonElement>(null);\n const railSlotRef = useRef<HTMLDivElement>(null);\n const sheetSlotRef = useRef<HTMLDivElement>(null);\n const lastFocus = useRef<Element | null>(null);\n // Rail content renders once, into a node that moves between the rail and\n // the sheet, so uncontrolled fields keep their values across modes.\n const [railHost] = useState(() => createMovableHost(\"ds-edit-layout__rail-host\"));\n const [mode, setMode] = useState<LayoutMode>(\"wide\");\n const [localOpen, setLocalOpen] = useState(defaultRailOpen);\n const [sheet, setSheet] = useState(false);\n const [animate, setAnimate] = useState(false);\n const detailsId = useId();\n const compact = mode === \"tight\" || mode === \"compact\";\n const narrow = mode !== \"wide\";\n const expanded = !narrow && (railOpen ?? localOpen);\n\n // Leave confirmation and the wide rail both replace the Details sheet.\n if (sheet && (confirmLeave || !narrow)) {\n setSheet(false);\n }\n\n // Measure before the first paint, then re-render only when a breakpoint is crossed.\n useLayoutEffect(() => {\n let current: LayoutMode | undefined;\n return observeElementWidth(rootRef.current!, (width) => {\n const next = layoutMode(width);\n if (next === current) {\n return;\n }\n current = next;\n // Crossing a breakpoint is not a deliberate toggle, so it doesn't animate.\n setAnimate(false);\n setMode(next);\n });\n }, []);\n\n // Moving a node drops its focus; keep the user in the field they were in.\n useLayoutEffect(() => {\n if (railHost) {\n moveHost(railHost, railSlotRef.current ?? sheetSlotRef.current, lastFocus.current);\n }\n });\n\n // A breakpoint, a collapse or a closing sheet can remove the focused control.\n // Hand focus to the Details toggle that replaced it.\n useEffect(() => {\n const last = lastFocus.current;\n if (last && cannotHoldFocus(last) && cannotHoldFocus(document.activeElement)) {\n toggleRef.current?.focus({ preventScroll: true });\n }\n }, [mode, expanded, sheet]);\n\n const toggle = () => {\n if (narrow) {\n setSheet(true);\n return;\n }\n setAnimate(true);\n setLocalOpen(!expanded);\n onRailToggle?.(!expanded);\n };\n const closeDetails = () => flushSync(() => setSheet(false));\n const railContent = typeof rail === \"function\" ? rail(closeDetails) : rail;\n\n return (\n <div\n {...rest}\n ref={mergedRef}\n className={[\"ds-edit-layout\", className].filter(Boolean).join(\" \")}\n data-compact={compact || undefined}\n data-tight={mode === \"tight\" || undefined}\n data-expanded={expanded || undefined}\n data-animate={animate || undefined}\n onFocus={(event) => {\n lastFocus.current = event.target;\n onFocus?.(event);\n }}\n >\n <div className=\"ds-edit-layout__main\">\n <EditActionBar\n backLabel={backLabel}\n onBack={onBack}\n compact={compact}\n status={\n <SaveStatus\n saveState={saveState}\n savedAgo={savedAgo}\n />\n }\n actions={actions}\n confirmLeave={confirmLeave}\n confirmation={\n <LeaveConfirmation\n text={confirmText}\n bodyRef={bodyRef}\n onKeepEditing={onKeepEditing}\n />\n }\n onLeave={onLeave}\n detailsToggle={\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={railLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={sheet}\n aria-controls={detailsId}\n onClick={toggle}\n />\n }\n />\n <div\n ref={bodyRef}\n className=\"ds-edit-layout__body\"\n >\n <div className=\"ds-edit-layout__content\">{children}</div>\n </div>\n </div>\n {!compact && (\n <DetailsRail\n label={railLabel}\n detailsId={detailsId}\n expanded={expanded}\n opensSheet={narrow}\n sheetOpen={sheet}\n toggleRef={toggleRef}\n contentRef={railSlotRef}\n collapsed={railCollapsed}\n onToggle={toggle}\n />\n )}\n <Drawer\n id={narrow ? detailsId : undefined}\n dir={rest.dir}\n isOpen={sheet}\n onClose={() => setSheet(false)}\n side=\"end\"\n size=\"md\"\n title={railLabel}\n closeLabel={`Close ${railLabel}`}\n className=\"ds-edit-layout__sheet\"\n >\n {narrow && (\n <div\n ref={sheetSlotRef}\n className=\"ds-edit-layout__rail-content\"\n />\n )}\n </Drawer>\n {railHost && createPortal(railContent, railHost)}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;AA+CA,IAAMQ,IAAc,KAEdC,IAAgB,KAEhBC,IAAa;AAInB,SAASC,GAAW,GAA2B;CAU7C,OATIC,IAAQJ,IACH,UAELI,IAAQH,IACH,YAELG,IAAQF,IACH,WAEF;AACT;AAEA,IAAMG,IAA8C;CAClD,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,OAAO;CACP,SAAS;AACX,GAEMC,IAA2D;CAC/D,OAAO,KAAA;CACP,OAAO,KAAA;CACP,QAAQ;CACR,OAAO;CACP,OAAO;CACP,SAAS;AACX;AAOA,SAASC,EAAW,EAAE,cAAW,eAA6B;CAC5D,IAAMC,IAAOF,EAAYG;CACzB,OACE,kBAAC,OAAD;EACE,WAAU;EACV,cAAYA;EACZ,MAAK;EACL,aAAU;EAJZ,UAAA;GAMGD,KACC,kBAACf,GAAD;IACE,MAAMe;IACN,WAAWC,MAAc,WAAW,kBAAkB,KAAA;GACvD,CAAA;GAEFA,MAAc,WACb,kBAAC,QAAD;IACE,WAAU;IACV,eAAY;GACb,CAAA;GAEH,kBAAC,QAAD,EAAA,UAAA,CACGJ,EAAaI,IACbA,MAAc,WAAWC,IAAW,kBAAAlB,GAAA,EAAA,UAAA,CAAE,KAAEkB,CAAW,EAAA,CAAA,IAAI,IACpD,EAAA,CAAA;EACH;;AAET;AAUA,SAASC,EAAkB,EAAE,SAAM,YAAS,oBAAyC;CACnF,IAAMC,IAAUC,EAA0B,IAAI,GACxCC,IAASD,EAA2B,IAAI;CAoB9C,OAlBAE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AA;KAEM;KACK;KACd,cACE,kBAACI,GAAD;MACE,MAAMkE;MACG;MACM;KAChB,CAAA;KAEM;KACT,eACE,kBAAC3D,GAAD;MACE,KAAKgB;MACL,SAAQ;MACR,MAAK;MACL,YAAA;MACA,WAAU;MACV,cAAY4C;MACZ,iBAAc;MACd,iBAAepB;MACf,iBAAetB;MACf,SAASiC;KACV,CAAA;IAEJ,CAAA,GACD,kBAAC,OAAD;KACE,KAAKjD;KACL,WAAU;KAEV,UAAA,kBAAC,OAAD;MAAK,WAAU;MAA2B;KAAc,CAAA;IACrD,CAAA,CACF;;GACJ,CAACE,KACA,kBAACS,GAAD;IACE,OAAO+C;IACI;IACD;IACV,YAAYf;IACZ,WAAWL;IACA;IACX,YAAYV;IACZ,WAAW+B;IACX,UAAUV;GACX,CAAA;GAEH,kBAACW,GAAD;IACE,IAAIjB,IAAS3B,IAAY,KAAA;IACzB,KAAKO,EAAK;IACV,QAAQe;IACR,eAAeC,EAAS,EAAK;IAC7B,MAAK;IACL,MAAK;IACL,OAAOmB;IACP,YAAY,SAASA;IACrB,WAAU;IAET,UAAAf,KACC,kBAAC,OAAD;KACE,KAAKd;KACL,WAAU;IACX,CAAA;GAEG,CAAA;GACPE,KAAY8B,GAAaV,GAAapB,CAAQ;EAC5C;;AAET,CAAC"}
1
+ {"version":3,"file":"index.js","names":["_Fragment","Icon","mergeRefs","cannotHoldFocus","observeElementWidth","moveHost","createMovableHost","Fragment$1","TIGHT_WIDTH","COMPACT_WIDTH","WIDE_WIDTH","layoutMode","width","statusLabels","statusIcons","relabelledStates","hasContent","node","SaveStatus","icon","saveState","custom","statusLabel","savedAgo","LeaveConfirmation","keepRef","useRef","origin","useEffect","frame","text","Button","onKeepEditing","bodyRef","EditActionBar","compact","backLabel","onBack","confirmLeave","confirmation","status","onLeave","actions","detailsToggle","DetailsRail","label","expanded","toggleRef","sheetOpen","detailsId","opensSheet","onToggle","contentRef","collapsed","EditLayout","forwardRef","rest","rootRef","mergedRef","useMemo","ref","railSlotRef","sheetSlotRef","lastFocus","railHost","useState","mode","setMode","localOpen","setLocalOpen","defaultRailOpen","sheet","setSheet","animate","setAnimate","useId","narrow","railOpen","useLayoutEffect","current","next","last","toggle","onRailToggle","railContent","rail","flushSync","className","event","onFocus","confirmText","railLabel","railCollapsed","Drawer","createPortal"],"sources":["../../../src/components/EditLayout/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal, flushSync } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { Drawer } from \"../Drawer\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport { cannotHoldFocus } from \"../../internal/dialogFocus\";\nimport { createMovableHost, moveHost } from \"../../internal/movableHost\";\nimport \"./style.css\";\n\nexport type EditSaveState = \"clean\" | \"dirty\" | \"saving\" | \"saved\" | \"error\" | \"offline\";\n\nexport interface EditLayoutProps extends HTMLAttributes<HTMLDivElement> {\n backLabel: string;\n onBack: () => void;\n saveState?: EditSaveState;\n /**\n * Replaces the `clean` or `dirty` message, for example on a read-only record.\n * Saving, saved, error and offline keep their standard messages, and\n * `saveState` always controls the indicator and colour. Empty values are ignored.\n */\n statusLabel?: ReactNode;\n savedAgo?: ReactNode;\n actions?: ReactNode;\n /** A render slot can close the Details sheet before opening another dialog. */\n rail: ReactNode | ((closeDetails: () => void) => ReactNode);\n /** Custom collapsed controls receive the accessible expand action. */\n railCollapsed?: (expand: () => void) => ReactNode;\n railLabel?: string;\n railOpen?: boolean;\n defaultRailOpen?: boolean;\n onRailToggle?: (open: boolean) => void;\n confirmLeave?: boolean;\n confirmText?: string;\n onKeepEditing?: () => void;\n onLeave?: () => void;\n children?: ReactNode;\n}\n\n/** Below this width, the action bar's gaps and padding contract. */\nconst TIGHT_WIDTH = 360;\n/** Below this width, Details opens from the action bar. */\nconst COMPACT_WIDTH = 600;\n/** From this width, the rail follows the open/closed preference. */\nconst WIDE_WIDTH = 900;\n\ntype LayoutMode = \"tight\" | \"compact\" | \"narrow\" | \"wide\";\n\nfunction layoutMode(width: number): LayoutMode {\n if (width < TIGHT_WIDTH) {\n return \"tight\";\n }\n if (width < COMPACT_WIDTH) {\n return \"compact\";\n }\n if (width < WIDE_WIDTH) {\n return \"narrow\";\n }\n return \"wide\";\n}\n\nconst statusLabels: Record<EditSaveState, string> = {\n clean: \"No changes\",\n dirty: \"Unsaved changes\",\n saving: \"Saving…\",\n saved: \"Saved\",\n error: \"Couldn't save\",\n offline: \"Offline · kept in this tab\",\n};\n\nconst statusIcons: Record<EditSaveState, IconName | undefined> = {\n clean: undefined,\n dirty: undefined,\n saving: \"spinner\",\n saved: \"check\",\n error: \"alert-triangle\",\n offline: \"clock\",\n};\n\n/** Save progress, outcomes and connection loss always keep their standard messages. */\nconst relabelledStates: ReadonlySet<EditSaveState> = new Set([\"clean\", \"dirty\"]);\n\nfunction hasContent(node: ReactNode) {\n if (typeof node === \"string\") {\n return node.trim() !== \"\";\n }\n return node !== null && node !== undefined && typeof node !== \"boolean\";\n}\n\ninterface SaveStatusProps {\n saveState: EditSaveState;\n statusLabel?: ReactNode;\n savedAgo?: ReactNode;\n}\n\nfunction SaveStatus({ saveState, savedAgo, statusLabel }: SaveStatusProps) {\n const icon = statusIcons[saveState];\n const custom =\n relabelledStates.has(saveState) && hasContent(statusLabel) ? statusLabel : undefined;\n return (\n <div\n className=\"ds-edit-layout__status\"\n data-state={saveState}\n role=\"status\"\n aria-live=\"polite\"\n >\n {icon && (\n <Icon\n name={icon}\n className={saveState === \"saving\" ? \"ds-icon--spin\" : undefined}\n />\n )}\n {saveState === \"dirty\" && (\n <span\n className=\"ds-edit-layout__dirty\"\n aria-hidden=\"true\"\n />\n )}\n {/* The title recovers a custom string clipped beyond two lines. */}\n <span title={typeof custom === \"string\" ? custom : undefined}>\n {custom ?? statusLabels[saveState]}\n {saveState === \"saved\" && savedAgo ? <> {savedAgo}</> : null}\n </span>\n </div>\n );\n}\n\ninterface LeaveConfirmationProps {\n text: string;\n /** Keep editing falls back to the first control here when its origin is gone. */\n bodyRef: RefObject<HTMLDivElement | null>;\n onKeepEditing?: () => void;\n}\n\n/** Takes focus while shown; Keep editing returns it to where the user was. */\nfunction LeaveConfirmation({ text, bodyRef, onKeepEditing }: LeaveConfirmationProps) {\n const keepRef = useRef<HTMLButtonElement>(null);\n const origin = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n origin.current = document.activeElement as HTMLElement | null;\n const frame = requestAnimationFrame(() => keepRef.current?.focus({ preventScroll: true }));\n return () => cancelAnimationFrame(frame);\n }, []);\n\n const keepEditing = () => {\n onKeepEditing?.();\n requestAnimationFrame(() => {\n const destination = origin.current?.isConnected\n ? origin.current\n : bodyRef.current?.querySelector<HTMLElement>(\n \"input, textarea, button, [contenteditable='true']\",\n );\n destination?.focus({ preventScroll: true });\n });\n };\n\n return (\n <div className=\"ds-edit-layout__confirmation\">\n <strong>{text}</strong>\n <Button\n ref={keepRef}\n size=\"xs\"\n onClick={keepEditing}\n >\n Keep editing\n </Button>\n </div>\n );\n}\n\ninterface EditActionBarProps {\n backLabel: string;\n onBack: () => void;\n compact: boolean;\n status: ReactNode;\n actions?: ReactNode;\n /** Replaces the status and actions while set. */\n confirmLeave: boolean;\n confirmation: ReactNode;\n onLeave?: () => void;\n /** Shown only in compact layouts, where Details opens as a sheet. */\n detailsToggle: ReactNode;\n}\n\nfunction EditActionBar({\n backLabel,\n onBack,\n compact,\n status,\n actions,\n confirmLeave,\n confirmation,\n onLeave,\n detailsToggle,\n}: EditActionBarProps) {\n return (\n <header className=\"ds-edit-layout__bar\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"arrow-left\"\n isIconOnly={compact}\n aria-label={`Back to ${backLabel}`}\n onClick={onBack}\n >\n {backLabel}\n </Button>\n {confirmLeave ? confirmation : status}\n <div className=\"ds-edit-layout__actions\">\n {confirmLeave ? (\n <Button\n variant=\"danger\"\n size=\"sm\"\n onClick={onLeave}\n >\n Leave anyway\n </Button>\n ) : (\n actions\n )}\n {compact && detailsToggle}\n </div>\n </header>\n );\n}\n\ninterface DetailsRailProps {\n label: string;\n detailsId: string;\n expanded: boolean;\n /** Below the wide breakpoint, the toggle opens the Details sheet instead. */\n opensSheet: boolean;\n sheetOpen: boolean;\n toggleRef: RefObject<HTMLButtonElement | null>;\n /** Receives the rail content while the rail is expanded. */\n contentRef: RefObject<HTMLDivElement | null>;\n collapsed?: (expand: () => void) => ReactNode;\n onToggle: () => void;\n}\n\nfunction DetailsRail({\n label,\n detailsId,\n expanded,\n opensSheet,\n sheetOpen,\n toggleRef,\n contentRef,\n collapsed,\n onToggle,\n}: DetailsRailProps) {\n return (\n <aside\n className=\"ds-edit-layout__rail\"\n aria-label={label}\n >\n <header className=\"ds-edit-layout__rail-head\">\n {expanded && <span>{label}</span>}\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart={expanded ? \"chevrons-right\" : \"chevrons-left\"}\n className=\"ds-edit-layout__toggle\"\n aria-label={`${expanded ? \"Collapse\" : \"Expand\"} ${label}`}\n aria-expanded={expanded || sheetOpen}\n aria-controls={detailsId}\n aria-haspopup={opensSheet ? \"dialog\" : undefined}\n onClick={onToggle}\n />\n </header>\n {expanded ? (\n <div\n id={detailsId}\n ref={contentRef}\n className=\"ds-edit-layout__rail-content\"\n />\n ) : (\n <div className=\"ds-edit-layout__rail-icons\">\n {collapsed ? (\n collapsed(onToggle)\n ) : (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={`Show ${label}`}\n onClick={onToggle}\n />\n )}\n </div>\n )}\n </aside>\n );\n}\n\n/** Presentation only: the consumer owns saving, routing and persisted preferences. */\nexport const EditLayout = forwardRef<HTMLDivElement, EditLayoutProps>(function EditLayout(\n {\n backLabel,\n onBack,\n saveState = \"clean\",\n statusLabel,\n savedAgo,\n actions,\n rail,\n railCollapsed,\n railLabel = \"Details\",\n railOpen,\n defaultRailOpen = true,\n onRailToggle,\n confirmLeave = false,\n confirmText = \"Leave without saving?\",\n onKeepEditing,\n onLeave,\n children,\n className,\n onFocus,\n ...rest\n },\n ref,\n) {\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMemo(() => mergeRefs(rootRef, ref), [ref]);\n const bodyRef = useRef<HTMLDivElement>(null);\n const toggleRef = useRef<HTMLButtonElement>(null);\n const railSlotRef = useRef<HTMLDivElement>(null);\n const sheetSlotRef = useRef<HTMLDivElement>(null);\n const lastFocus = useRef<Element | null>(null);\n // Rail content renders once, into a node that moves between the rail and\n // the sheet, so uncontrolled fields keep their values across modes.\n const [railHost] = useState(() => createMovableHost(\"ds-edit-layout__rail-host\"));\n const [mode, setMode] = useState<LayoutMode>(\"wide\");\n const [localOpen, setLocalOpen] = useState(defaultRailOpen);\n const [sheet, setSheet] = useState(false);\n const [animate, setAnimate] = useState(false);\n const detailsId = useId();\n const compact = mode === \"tight\" || mode === \"compact\";\n const narrow = mode !== \"wide\";\n const expanded = !narrow && (railOpen ?? localOpen);\n\n // Leave confirmation and the wide rail both replace the Details sheet.\n if (sheet && (confirmLeave || !narrow)) {\n setSheet(false);\n }\n\n // Measure before the first paint, then re-render only when a breakpoint is crossed.\n useLayoutEffect(() => {\n let current: LayoutMode | undefined;\n return observeElementWidth(rootRef.current!, (width) => {\n const next = layoutMode(width);\n if (next === current) {\n return;\n }\n current = next;\n // Crossing a breakpoint is not a deliberate toggle, so it doesn't animate.\n setAnimate(false);\n setMode(next);\n });\n }, []);\n\n // Moving a node drops its focus; keep the user in the field they were in.\n useLayoutEffect(() => {\n if (railHost) {\n moveHost(railHost, railSlotRef.current ?? sheetSlotRef.current, lastFocus.current);\n }\n });\n\n // A breakpoint, a collapse or a closing sheet can remove the focused control.\n // Hand focus to the Details toggle that replaced it.\n useEffect(() => {\n const last = lastFocus.current;\n if (last && cannotHoldFocus(last) && cannotHoldFocus(document.activeElement)) {\n toggleRef.current?.focus({ preventScroll: true });\n }\n }, [mode, expanded, sheet]);\n\n const toggle = () => {\n if (narrow) {\n setSheet(true);\n return;\n }\n setAnimate(true);\n setLocalOpen(!expanded);\n onRailToggle?.(!expanded);\n };\n const closeDetails = () => flushSync(() => setSheet(false));\n const railContent = typeof rail === \"function\" ? rail(closeDetails) : rail;\n\n return (\n <div\n {...rest}\n ref={mergedRef}\n className={[\"ds-edit-layout\", className].filter(Boolean).join(\" \")}\n data-compact={compact || undefined}\n data-tight={mode === \"tight\" || undefined}\n data-expanded={expanded || undefined}\n data-animate={animate || undefined}\n onFocus={(event) => {\n lastFocus.current = event.target;\n onFocus?.(event);\n }}\n >\n <div className=\"ds-edit-layout__main\">\n <EditActionBar\n backLabel={backLabel}\n onBack={onBack}\n compact={compact}\n status={\n <SaveStatus\n saveState={saveState}\n statusLabel={statusLabel}\n savedAgo={savedAgo}\n />\n }\n actions={actions}\n confirmLeave={confirmLeave}\n confirmation={\n <LeaveConfirmation\n text={confirmText}\n bodyRef={bodyRef}\n onKeepEditing={onKeepEditing}\n />\n }\n onLeave={onLeave}\n detailsToggle={\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={railLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={sheet}\n aria-controls={detailsId}\n onClick={toggle}\n />\n }\n />\n <div\n ref={bodyRef}\n className=\"ds-edit-layout__body\"\n >\n <div className=\"ds-edit-layout__content\">{children}</div>\n </div>\n </div>\n {!compact && (\n <DetailsRail\n label={railLabel}\n detailsId={detailsId}\n expanded={expanded}\n opensSheet={narrow}\n sheetOpen={sheet}\n toggleRef={toggleRef}\n contentRef={railSlotRef}\n collapsed={railCollapsed}\n onToggle={toggle}\n />\n )}\n <Drawer\n id={narrow ? detailsId : undefined}\n dir={rest.dir}\n isOpen={sheet}\n onClose={() => setSheet(false)}\n side=\"end\"\n size=\"md\"\n title={railLabel}\n closeLabel={`Close ${railLabel}`}\n className=\"ds-edit-layout__sheet\"\n >\n {narrow && (\n <div\n ref={sheetSlotRef}\n className=\"ds-edit-layout__rail-content\"\n />\n )}\n </Drawer>\n {railHost && createPortal(railContent, railHost)}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;AAqDA,IAAMQ,IAAc,KAEdC,IAAgB,KAEhBC,IAAa;AAInB,SAASC,GAAW,GAA2B;CAU7C,OATIC,IAAQJ,IACH,UAELI,IAAQH,IACH,YAELG,IAAQF,IACH,WAEF;AACT;AAEA,IAAMG,IAA8C;CAClD,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,OAAO;CACP,SAAS;AACX,GAEMC,IAA2D;CAC/D,OAAO,KAAA;CACP,OAAO,KAAA;CACP,QAAQ;CACR,OAAO;CACP,OAAO;CACP,SAAS;AACX,GAGMC,oBAA+C,IAAI,IAAI,CAAC,SAAS,OAAO,CAAC;AAE/E,SAASC,EAAW,GAAiB;CAInC,OAHI,OAAOC,KAAS,WACXA,EAAK,KAAK,MAAM,KAElBA,KAAS,QAA8B,OAAOA,KAAS;AAChE;AAQA,SAASC,EAAW,EAAE,cAAW,aAAU,kBAAgC;CACzE,IAAMC,IAAOL,EAAYM,IACnBC,IACJN,EAAiB,IAAIK,CAAS,KAAKJ,EAAWM,CAAW,IAAIA,IAAc,KAAA;CAC7E,OACE,kBAAC,OAAD;EACE,WAAU;EACV,cAAYF;EACZ,MAAK;EACL,aAAU;EAJZ,UAAA;GAMGD,KACC,kBAAClB,GAAD;IACE,MAAMkB;IACN,WAAWC,MAAc,WAAW,kBAAkB,KAAA;GACvD,CAAA;GAEFA,MAAc,WACb,kBAAC,QAAD;IACE,WAAU;IACV,eAAY;GACb,CAAA;GAGH,kBAAC,QAAD;IAAM,OAAO,OAAOC,KAAW,WAAWA,IAAS,KAAA;IAAnD,UAAA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AAA;EAChC,iBAAepB,KAAY,KAAA;EAC3B,gBAAc2B,MAAW,KAAA;EACzB,UAAU,MAAU;GAElB,AADA,EAAU,UAAUe,EAAM,QAC1BC,KAAUD,CAAK;EACjB;EAXF,UAAA;GAaE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACtD,GAAD;KACa;KACH;KACC;KACT,QACE,kBAAChB,GAAD;MACa;MACE;MACH;KACX,CAAA;KAEM;KACK;KACd,cACE,kBAACM,IAAD;MACE,MAAMkE;MACG;MACM;KAChB,CAAA;KAEM;KACT,eACE,kBAAC3D,GAAD;MACE,KAAKgB;MACL,SAAQ;MACR,MAAK;MACL,YAAA;MACA,WAAU;MACV,cAAY4C;MACZ,iBAAc;MACd,iBAAepB;MACf,iBAAetB;MACf,SAASiC;KACV,CAAA;IAEJ,CAAA,GACD,kBAAC,OAAD;KACE,KAAKjD;KACL,WAAU;KAEV,UAAA,kBAAC,OAAD;MAAK,WAAU;MAA2B;KAAc,CAAA;IACrD,CAAA,CACF;;GACJ,CAACE,KACA,kBAACS,IAAD;IACE,OAAO+C;IACI;IACD;IACV,YAAYf;IACZ,WAAWL;IACA;IACX,YAAYV;IACZ,WAAW+B;IACX,UAAUV;GACX,CAAA;GAEH,kBAACW,GAAD;IACE,IAAIjB,IAAS3B,IAAY,KAAA;IACzB,KAAKO,EAAK;IACV,QAAQe;IACR,eAAeC,EAAS,EAAK;IAC7B,MAAK;IACL,MAAK;IACL,OAAOmB;IACP,YAAY,SAASA;IACrB,WAAU;IAET,UAAAf,KACC,kBAAC,OAAD;KACE,KAAKd;KACL,WAAU;IACX,CAAA;GAEG,CAAA;GACPE,KAAY8B,EAAaV,IAAapB,CAAQ;EAC5C;;AAET,CAAC"}
@@ -93,9 +93,16 @@
93
93
  white-space: nowrap;
94
94
  overflow: hidden;
95
95
 
96
+ /* Longer labels wrap onto a second line before truncating. */
96
97
  > span:last-child {
98
+ display: -webkit-box;
99
+ -webkit-box-orient: vertical;
100
+ -webkit-line-clamp: 2;
97
101
  overflow: hidden;
98
- text-overflow: ellipsis;
102
+ line-height: var(--line-height-tight);
103
+ text-align: center;
104
+ white-space: normal;
105
+ overflow-wrap: break-word;
99
106
  }
100
107
 
101
108
  .ds-icon {
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-D7GrTtqc.cjs"),t=require("../Button/index.cjs"),n=require("../Modal/index.cjs"),r=require("../../chunks/group-pKDQtq-9.cjs"),i=require("../SearchField/index.cjs"),a=require("../SortableList/index.cjs");let o=require("react"),s=require("react/jsx-runtime");function c(...e){return e.filter(Boolean).join(` `)}function l(e,t){return!t||[e.title,e.subtitle,...e.keywords??[]].filter(Boolean).join(` `).toLowerCase().includes(t.toLowerCase())}function u({item:t}){return(0,s.jsx)(`span`,{className:`ds-entry__thumb`,children:t.imageUrl?(0,s.jsx)(`img`,{src:t.imageUrl,alt:``,loading:`lazy`}):(0,s.jsx)(e.t,{name:`file-text`,size:20})})}function d({items:d,value:f,defaultValue:p=[],onValueChange:m,mode:h=`multiple`,max:g,label:_=`Entries`,emptyLabel:v=`Nothing selected yet.`,addLabel:y=`Choose entries`,itemLabel:b=`entry`,itemsLabel:x=`entries`,isReorderable:S=!0,isDisabled:C=!1,className:w,...T}){let[E,D]=(0,o.useState)(p),O=f??E,[k,A]=(0,o.useState)(!1),[j,M]=(0,o.useState)(``),N=(0,o.useMemo)(()=>new Map(d.map(e=>[e.id,e])),[d]),P=(0,o.useMemo)(()=>d.filter(e=>l(e,j)),[d,j]),F=h===`multiple`&&g!==void 0&&O.length>=g,I=e=>{C||(f===void 0&&D(e),m?.(e))},L=e=>{h===`single`?(I(O[0]===e?[]:[e]),A(!1)):O.includes(e)?I(O.filter(t=>t!==e)):F||I([...O,e])},R=O.map(e=>N.get(e)??{id:e,title:e}),z=S&&h===`multiple`&&R.length>1,B=e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u,{item:e}),(0,s.jsxs)(`span`,{className:`ds-entry__body`,children:[(0,s.jsx)(`span`,{className:`ds-entry__title`,children:e.title}),e.subtitle&&(0,s.jsx)(`span`,{className:`ds-entry__subtitle`,children:e.subtitle})]})]});return(0,s.jsxs)(r.t,{...T,className:c(`ds-entry-picker`,w),label:_,count:O.length,children:[R.length===0?(0,s.jsx)(`p`,{className:`ds-entry-picker__empty`,children:v}):z?(0,s.jsx)(a.SortableList,{items:O,onReorder:I,isDisabled:C,children:R.map(e=>(0,s.jsx)(a.SortableListItem,{id:e.id,label:e.title,action:(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Remove ${e.title}`,isDisabled:C,onClick:()=>I(O.filter(t=>t!==e.id))}),children:(0,s.jsx)(`div`,{className:`ds-entry`,children:B(e)})},e.id))}):(0,s.jsx)(`ul`,{className:`ds-entry-picker__list`,children:R.map(e=>(0,s.jsxs)(`li`,{className:`ds-entry-picker__row`,children:[(0,s.jsx)(`div`,{className:`ds-entry`,children:B(e)}),(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Remove ${e.title}`,isDisabled:C,onClick:()=>I(O.filter(t=>t!==e.id))})]},e.id))}),(0,s.jsxs)(`div`,{className:`ds-entry-picker__actions`,children:[(0,s.jsx)(t.Button,{variant:`neutral`,size:`sm`,iconStart:`plus`,isDisabled:C,onClick:()=>A(!0),children:y}),O.length>0&&(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isDisabled:C,onClick:()=>I([]),children:`Clear`})]}),(0,s.jsxs)(n.Modal,{isOpen:k,onClose:()=>A(!1),title:y,description:h===`single`?`Choose one ${b}.`:g===void 0?`Choose as many ${x} as you need.`:`Choose up to ${g} ${x}.`,footer:(0,s.jsx)(t.Button,{variant:`primary`,onClick:()=>A(!1),children:`Done`}),children:[(0,s.jsx)(`div`,{className:`ds-entry-picker__search`,children:(0,s.jsx)(i.SearchField,{value:j,placeholder:`Search ${x}`,onChange:e=>M(e.target.value),onClear:()=>M(``)})}),(0,s.jsxs)(`ul`,{className:`ds-entry-picker__results`,children:[P.map(n=>{let r=O.includes(n.id),i=C||n.isDisabled||!r&&F;return(0,s.jsx)(`li`,{children:(0,s.jsxs)(t.Button,{variant:r?`active`:`simple`,size:`lg`,className:`ds-entry-picker__result`,"aria-pressed":r,isDisabled:!!i,onClick:()=>L(n.id),children:[(0,s.jsx)(`span`,{className:`ds-entry`,children:B(n)}),r&&(0,s.jsx)(e.t,{name:`check`,size:20})]})},n.id)}),P.length===0&&(0,s.jsxs)(`li`,{className:`ds-entry-picker__no-results`,children:[`No `,x,` match “`,j,`”.`]})]})]})]})}exports.EntryPicker=d;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-WOhlu6Rp.cjs"),t=require("../Button/index.cjs"),n=require("../Modal/index.cjs"),r=require("../../chunks/group-pKDQtq-9.cjs"),i=require("../SearchField/index.cjs"),a=require("../SortableList/index.cjs");let o=require("react"),s=require("react/jsx-runtime");function c(...e){return e.filter(Boolean).join(` `)}function l(e,t){return!t||[e.title,e.subtitle,...e.keywords??[]].filter(Boolean).join(` `).toLowerCase().includes(t.toLowerCase())}function u({item:t}){return(0,s.jsx)(`span`,{className:`ds-entry__thumb`,children:t.imageUrl?(0,s.jsx)(`img`,{src:t.imageUrl,alt:``,loading:`lazy`}):(0,s.jsx)(e.t,{name:`file-text`,size:20})})}function d({items:d,value:f,defaultValue:p=[],onValueChange:m,mode:h=`multiple`,max:g,label:_=`Entries`,emptyLabel:v=`Nothing selected yet.`,addLabel:y=`Choose entries`,itemLabel:b=`entry`,itemsLabel:x=`entries`,isReorderable:S=!0,isDisabled:C=!1,className:w,...T}){let[E,D]=(0,o.useState)(p),O=f??E,[k,A]=(0,o.useState)(!1),[j,M]=(0,o.useState)(``),N=(0,o.useMemo)(()=>new Map(d.map(e=>[e.id,e])),[d]),P=(0,o.useMemo)(()=>d.filter(e=>l(e,j)),[d,j]),F=h===`multiple`&&g!==void 0&&O.length>=g,I=e=>{C||(f===void 0&&D(e),m?.(e))},L=e=>{h===`single`?(I(O[0]===e?[]:[e]),A(!1)):O.includes(e)?I(O.filter(t=>t!==e)):F||I([...O,e])},R=O.map(e=>N.get(e)??{id:e,title:e}),z=S&&h===`multiple`&&R.length>1,B=e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u,{item:e}),(0,s.jsxs)(`span`,{className:`ds-entry__body`,children:[(0,s.jsx)(`span`,{className:`ds-entry__title`,children:e.title}),e.subtitle&&(0,s.jsx)(`span`,{className:`ds-entry__subtitle`,children:e.subtitle})]})]});return(0,s.jsxs)(r.t,{...T,className:c(`ds-entry-picker`,w),label:_,count:O.length,children:[R.length===0?(0,s.jsx)(`p`,{className:`ds-entry-picker__empty`,children:v}):z?(0,s.jsx)(a.SortableList,{items:O,onReorder:I,isDisabled:C,children:R.map(e=>(0,s.jsx)(a.SortableListItem,{id:e.id,label:e.title,action:(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Remove ${e.title}`,isDisabled:C,onClick:()=>I(O.filter(t=>t!==e.id))}),children:(0,s.jsx)(`div`,{className:`ds-entry`,children:B(e)})},e.id))}):(0,s.jsx)(`ul`,{className:`ds-entry-picker__list`,children:R.map(e=>(0,s.jsxs)(`li`,{className:`ds-entry-picker__row`,children:[(0,s.jsx)(`div`,{className:`ds-entry`,children:B(e)}),(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Remove ${e.title}`,isDisabled:C,onClick:()=>I(O.filter(t=>t!==e.id))})]},e.id))}),(0,s.jsxs)(`div`,{className:`ds-entry-picker__actions`,children:[(0,s.jsx)(t.Button,{variant:`neutral`,size:`sm`,iconStart:`plus`,isDisabled:C,onClick:()=>A(!0),children:y}),O.length>0&&(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isDisabled:C,onClick:()=>I([]),children:`Clear`})]}),(0,s.jsxs)(n.Modal,{isOpen:k,onClose:()=>A(!1),title:y,description:h===`single`?`Choose one ${b}.`:g===void 0?`Choose as many ${x} as you need.`:`Choose up to ${g} ${x}.`,footer:(0,s.jsx)(t.Button,{variant:`primary`,onClick:()=>A(!1),children:`Done`}),children:[(0,s.jsx)(`div`,{className:`ds-entry-picker__search`,children:(0,s.jsx)(i.SearchField,{value:j,placeholder:`Search ${x}`,onChange:e=>M(e.target.value),onClear:()=>M(``)})}),(0,s.jsxs)(`ul`,{className:`ds-entry-picker__results`,children:[P.map(n=>{let r=O.includes(n.id),i=C||n.isDisabled||!r&&F;return(0,s.jsx)(`li`,{children:(0,s.jsxs)(t.Button,{variant:r?`active`:`simple`,size:`lg`,className:`ds-entry-picker__result`,"aria-pressed":r,isDisabled:!!i,onClick:()=>L(n.id),children:[(0,s.jsx)(`span`,{className:`ds-entry`,children:B(n)}),r&&(0,s.jsx)(e.t,{name:`check`,size:20})]})},n.id)}),P.length===0&&(0,s.jsxs)(`li`,{className:`ds-entry-picker__no-results`,children:[`No `,x,` match “`,j,`”.`]})]})]})]})}exports.EntryPicker=d;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../chunks/Icon-BZjGAu8D.js";
1
+ import { t as e } from "../../chunks/Icon-spaFBU4S.js";
2
2
  import { Button as t } from "../Button/index.js";
3
3
  import { Modal as n } from "../Modal/index.js";
4
4
  import { t as r } from "../../chunks/group-CzbacuAY.js";
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Field/index.cjs"),require("../Container/index.cjs");const e=require("../../chunks/FormEditor-a3kHVLQB.cjs");exports.FormEditor=e.t,exports.validateFormValues=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Field/index.cjs"),require("../Container/index.cjs");const e=require("../../chunks/FormEditor-BbsvbufQ.cjs");exports.FormEditor=e.t,exports.validateFormValues=e.n;
@@ -1,3 +1,3 @@
1
1
  import "../Field/index.js";
2
2
  import "../Container/index.js";
3
- export { t as FormEditor, n as validateFormValues } from "../../chunks/FormEditor-CwQN8tRw.js";
3
+ export { t as FormEditor, n as validateFormValues } from "../../chunks/FormEditor-C5XtP-N7.js";
@@ -52,6 +52,7 @@ export declare const icons: {
52
52
  readonly image: import("lucide-react").LucideIcon;
53
53
  readonly info: import("lucide-react").LucideIcon;
54
54
  readonly link: import("lucide-react").LucideIcon;
55
+ readonly "key-round": import("lucide-react").LucideIcon;
55
56
  readonly spinner: import("lucide-react").LucideIcon;
56
57
  readonly "more-horizontal": import("lucide-react").LucideIcon;
57
58
  readonly pencil: import("lucide-react").LucideIcon;
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.cts","sourceRoot":"","sources":["../../../src/components/Icon/icons.ts"],"names":[],"mappings":"AAiEA;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DR,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAE1C,eAAO,MAAM,SAAS,EAAyB,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"icons.d.cts","sourceRoot":"","sources":["../../../src/components/Icon/icons.ts"],"names":[],"mappings":"AAkEA;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgER,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAE1C,eAAO,MAAM,SAAS,EAAyB,QAAQ,EAAE,CAAC"}
@@ -52,6 +52,7 @@ export declare const icons: {
52
52
  readonly image: import("lucide-react").LucideIcon;
53
53
  readonly info: import("lucide-react").LucideIcon;
54
54
  readonly link: import("lucide-react").LucideIcon;
55
+ readonly "key-round": import("lucide-react").LucideIcon;
55
56
  readonly spinner: import("lucide-react").LucideIcon;
56
57
  readonly "more-horizontal": import("lucide-react").LucideIcon;
57
58
  readonly pencil: import("lucide-react").LucideIcon;
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/icons.ts"],"names":[],"mappings":"AAiEA;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DR,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAE1C,eAAO,MAAM,SAAS,EAAyB,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/icons.ts"],"names":[],"mappings":"AAkEA;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgER,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAE1C,eAAO,MAAM,SAAS,EAAyB,QAAQ,EAAE,CAAC"}
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-D7GrTtqc.cjs");exports.Icon=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-WOhlu6Rp.cjs");exports.Icon=e.t;
@@ -1 +1 @@
1
- export { t as Icon } from "../../chunks/Icon-BZjGAu8D.js";
1
+ export { t as Icon } from "../../chunks/Icon-spaFBU4S.js";
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../Popover/index.cjs");let n=require("react"),r=require("react/jsx-runtime");function i(...e){return e.filter(Boolean).join(` `)}var a=(0,n.forwardRef)(function({trigger:e,align:a=`start`,className:o,children:s,onClick:c,onKeyDown:l,...u},d){let[f,p]=(0,n.useState)(!1),m=(0,n.useRef)(null),h=(0,n.useRef)(null),g=(0,n.useRef)(null),_=(0,n.useId)(),v=(0,n.useCallback)(()=>p(!1),[]),y=(0,n.useCallback)(()=>{(h.current?.querySelector(`button, [href], [tabindex]`)??h.current)?.focus()},[]);(0,n.useEffect)(()=>{let e=f?g.current:null;typeof d==`function`?d(e):d&&(d.current=e)},[f,d]),(0,n.useEffect)(()=>{if(!f)return;let e=e=>{let t=e.target;!m.current?.contains(t)&&!g.current?.contains(t)&&v()},t=e=>{e.key===`Escape`&&(e.preventDefault(),v(),y())};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),g.current?.querySelector(`button:not(:disabled)`)?.focus(),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[f,v,y]);let b=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Array.from(g.current?.querySelectorAll(`button:not(:disabled)`)??[]);if(t.length===0)return;let n=t.indexOf(document.activeElement);(e.key===`ArrowDown`?t[(n+1)%t.length]:t[(n-1+t.length)%t.length])?.focus()};return(0,r.jsxs)(`div`,{className:`ds-menu-root`,ref:m,children:[(0,r.jsx)(`span`,{ref:h,className:`ds-menu-root`,children:e({"aria-haspopup":`menu`,"aria-expanded":f,"aria-controls":f?_:void 0,onClick:()=>p(e=>!e)})}),(0,r.jsx)(t.Popover,{anchorRef:h,isOpen:f,align:a,offset:8,id:_,role:`menu`,className:i(`ds-surface-raised`,`ds-menu`,o),panelRef:g,children:(0,r.jsx)(`div`,{className:`ds-menu__list`,onKeyDown:e=>{l?.(e),e.defaultPrevented||b(e)},onClick:e=>{c?.(e),e.defaultPrevented||(v(),y())},...u,children:s})})]})}),o=(0,n.forwardRef)(function({icon:t,tone:n=`neutral`,shortcut:a,isDisabled:o=!1,className:s,children:c,...l},u){return(0,r.jsxs)(e.Button,{ref:u,variant:n===`danger`?`danger`:`simple`,size:`sm`,iconStart:t,role:`menuitem`,isDisabled:o,"data-tone":n===`danger`?`danger`:void 0,className:i(`ds-menu-item`,s),...l,children:[c,a&&(0,r.jsx)(`span`,{className:`ds-menu-item__shortcut`,children:a})]})});function s(){return(0,r.jsx)(`div`,{className:`ds-menu-separator`,role:`separator`})}function c({children:e}){return(0,r.jsx)(`div`,{className:`ds-menu-label`,children:e})}exports.Menu=a,exports.MenuItem=o,exports.MenuLabel=c,exports.MenuSeparator=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../Popover/index.cjs");let n=require("react"),r=require("react/jsx-runtime");function i(...e){return e.filter(Boolean).join(` `)}var a=(0,n.forwardRef)(function({trigger:e,align:a=`start`,className:o,children:s,onClick:c,onKeyDown:l,...u},d){let[f,p]=(0,n.useState)(!1),m=(0,n.useRef)(null),h=(0,n.useRef)(null),g=(0,n.useRef)(null),_=(0,n.useId)(),v=(0,n.useCallback)(()=>p(!1),[]),y=(0,n.useCallback)(()=>{(h.current?.querySelector(`button, [href], [tabindex]`)??h.current)?.focus()},[]);(0,n.useEffect)(()=>{let e=f?g.current:null;typeof d==`function`?d(e):d&&(d.current=e)},[f,d]),(0,n.useEffect)(()=>{if(!f)return;let e=e=>{let t=e.target;!m.current?.contains(t)&&!g.current?.contains(t)&&v()},t=e=>{e.key===`Escape`&&(e.preventDefault(),v(),y())};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),g.current?.querySelector(`button:not(:disabled)`)?.focus(),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[f,v,y]);let b=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Array.from(g.current?.querySelectorAll(`button:not(:disabled)`)??[]);if(t.length===0)return;let n=t.indexOf(document.activeElement);(e.key===`ArrowDown`?t[(n+1)%t.length]:t[(n-1+t.length)%t.length])?.focus()};return(0,r.jsxs)(`div`,{className:`ds-menu-root`,ref:m,children:[(0,r.jsx)(`span`,{ref:h,className:`ds-menu-root`,children:e({"aria-haspopup":`menu`,"aria-expanded":f,"aria-controls":f?_:void 0,onClick:()=>p(e=>!e)})}),(0,r.jsx)(t.Popover,{anchorRef:h,isOpen:f,align:a,offset:8,id:_,role:`menu`,className:i(`ds-surface-raised`,`ds-field-surface`,`ds-menu`,o),panelRef:g,children:(0,r.jsx)(`div`,{className:`ds-menu__list`,onKeyDown:e=>{l?.(e),e.defaultPrevented||b(e)},onClick:e=>{c?.(e),e.defaultPrevented||(v(),y())},...u,children:s})})]})}),o=(0,n.forwardRef)(function({icon:t,tone:n=`neutral`,shortcut:a,isDisabled:o=!1,className:s,children:c,...l},u){return(0,r.jsxs)(e.Button,{ref:u,variant:n===`danger`?`danger`:`simple`,size:`sm`,iconStart:t,role:`menuitem`,isDisabled:o,"data-tone":n===`danger`?`danger`:void 0,className:i(`ds-menu-item`,s),...l,children:[c,a&&(0,r.jsx)(`span`,{className:`ds-menu-item__shortcut`,children:a})]})});function s(){return(0,r.jsx)(`div`,{className:`ds-menu-separator`,role:`separator`})}function c({children:e}){return(0,r.jsx)(`div`,{className:`ds-menu-label`,children:e})}exports.Menu=a,exports.MenuItem=o,exports.MenuLabel=c,exports.MenuSeparator=s;
2
2
  //# sourceMappingURL=index.cjs.map