@namroodinc/liquid-editorial 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -3
- package/UPGRADING.md +83 -0
- package/dist/chunks/{Board-BPA6mVhf.cjs → Board-CUt4j2-8.cjs} +2 -2
- package/dist/chunks/{Board-BPA6mVhf.cjs.map → Board-CUt4j2-8.cjs.map} +1 -1
- package/dist/chunks/{Board-CcIF7jS0.js → Board-z688-51u.js} +2 -2
- package/dist/chunks/{Board-CcIF7jS0.js.map → Board-z688-51u.js.map} +1 -1
- package/dist/chunks/{ColourField-DWdc4d9E.cjs → ColourField-Bk5O632x.cjs} +2 -2
- package/dist/chunks/{ColourField-DWdc4d9E.cjs.map → ColourField-Bk5O632x.cjs.map} +1 -1
- package/dist/chunks/{ColourField-BmHHxU6T.js → ColourField-BwDb7ydB.js} +2 -2
- package/dist/chunks/{ColourField-BmHHxU6T.js.map → ColourField-BwDb7ydB.js.map} +1 -1
- package/dist/chunks/{DatePicker-D5-LzTXS.cjs → DatePicker-BVsloqVY.cjs} +2 -2
- package/dist/chunks/{DatePicker-D5-LzTXS.cjs.map → DatePicker-BVsloqVY.cjs.map} +1 -1
- package/dist/chunks/{DatePicker-CFYwk6eA.js → DatePicker-C1zcScC3.js} +2 -2
- package/dist/chunks/{DatePicker-CFYwk6eA.js.map → DatePicker-C1zcScC3.js.map} +1 -1
- package/dist/chunks/{FormEditor-_gqfxL_g.js → FormEditor-C4PJu7ZF.js} +3 -3
- package/dist/chunks/{FormEditor-_gqfxL_g.js.map → FormEditor-C4PJu7ZF.js.map} +1 -1
- package/dist/chunks/{FormEditor-B-XLNrub.cjs → FormEditor-Dd44EMp_.cjs} +2 -2
- package/dist/chunks/{FormEditor-B-XLNrub.cjs.map → FormEditor-Dd44EMp_.cjs.map} +1 -1
- package/dist/chunks/Icon-WOhlu6Rp.cjs +2 -0
- package/dist/chunks/Icon-WOhlu6Rp.cjs.map +1 -0
- package/dist/chunks/Icon-spaFBU4S.js +85 -0
- package/dist/chunks/Icon-spaFBU4S.js.map +1 -0
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.cjs.map +1 -1
- package/dist/components/AssetCard/index.d.cts +11 -1
- package/dist/components/AssetCard/index.d.cts.map +1 -1
- package/dist/components/AssetCard/index.d.ts +11 -1
- package/dist/components/AssetCard/index.d.ts.map +1 -1
- package/dist/components/AssetCard/index.js +93 -57
- package/dist/components/AssetCard/index.js.map +1 -1
- package/dist/components/AssetCard/style.css +22 -5
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.js +1 -1
- package/dist/components/AssetGrid/style.css +2 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.d.cts +6 -0
- package/dist/components/EditLayout/index.d.cts.map +1 -1
- package/dist/components/EditLayout/index.d.ts +6 -0
- package/dist/components/EditLayout/index.d.ts.map +1 -1
- package/dist/components/EditLayout/index.js +104 -97
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EditLayout/style.css +8 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/Grid/style.css +8 -6
- package/dist/components/Icon/icons.d.cts +4 -0
- package/dist/components/Icon/icons.d.cts.map +1 -1
- package/dist/components/Icon/icons.d.ts +4 -0
- package/dist/components/Icon/icons.d.ts.map +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunks/Icon-D1kx7-1c.js +0 -81
- package/dist/chunks/Icon-D1kx7-1c.js.map +0 -1
- package/dist/chunks/Icon-D38lQXNe.cjs +0 -2
- package/dist/chunks/Icon-D38lQXNe.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"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,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;;;;OAIG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+EAA+E;IAC/E,IAAI,EAAE,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-
|
|
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
|
|
10
|
-
import { Fragment as
|
|
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
|
|
13
|
-
function
|
|
14
|
-
return e <
|
|
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
|
|
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
|
-
},
|
|
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
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
40
|
-
name:
|
|
42
|
+
i && /* @__PURE__ */ _(e, {
|
|
43
|
+
name: i,
|
|
41
44
|
className: t === "saving" ? "ds-icon--spin" : void 0
|
|
42
45
|
}),
|
|
43
|
-
t === "dirty" && /* @__PURE__ */
|
|
46
|
+
t === "dirty" && /* @__PURE__ */ _("span", {
|
|
44
47
|
className: "ds-edit-layout__dirty",
|
|
45
48
|
"aria-hidden": "true"
|
|
46
49
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
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
|
|
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__ */
|
|
63
|
+
}, []), /* @__PURE__ */ v("div", {
|
|
58
64
|
className: "ds-edit-layout__confirmation",
|
|
59
|
-
children: [/* @__PURE__ */
|
|
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
|
|
72
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
91
|
+
/* @__PURE__ */ v("div", {
|
|
86
92
|
className: "ds-edit-layout__actions",
|
|
87
|
-
children: [o ? /* @__PURE__ */
|
|
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
|
|
98
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
107
|
+
children: [/* @__PURE__ */ v("header", {
|
|
102
108
|
className: "ds-edit-layout__rail-head",
|
|
103
|
-
children: [r && /* @__PURE__ */
|
|
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__ */
|
|
122
|
+
}), r ? /* @__PURE__ */ _("div", {
|
|
117
123
|
id: n,
|
|
118
124
|
ref: s,
|
|
119
125
|
className: "ds-edit-layout__rail-content"
|
|
120
|
-
}) : /* @__PURE__ */
|
|
126
|
+
}) : /* @__PURE__ */ _("div", {
|
|
121
127
|
className: "ds-edit-layout__rail-icons",
|
|
122
|
-
children: c ? c(l) : /* @__PURE__ */
|
|
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
|
|
134
|
-
let
|
|
135
|
-
|
|
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(
|
|
138
|
-
let n =
|
|
139
|
-
n !== e && (e = 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
|
-
|
|
148
|
+
H && o(H, z.current ?? B.current, V.current);
|
|
143
149
|
}), l(() => {
|
|
144
|
-
let e =
|
|
145
|
-
e && r(e) && r(document.activeElement) &&
|
|
150
|
+
let e = V.current;
|
|
151
|
+
e && r(e) && r(document.activeElement) && R.current?.focus({ preventScroll: !0 });
|
|
146
152
|
}, [
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
153
|
+
U,
|
|
154
|
+
Q,
|
|
155
|
+
K
|
|
150
156
|
]);
|
|
151
|
-
let
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
return /* @__PURE__ */
|
|
155
|
-
...
|
|
156
|
-
ref:
|
|
157
|
-
className: ["ds-edit-layout",
|
|
158
|
-
"data-compact":
|
|
159
|
-
"data-tight":
|
|
160
|
-
"data-expanded":
|
|
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
|
-
|
|
169
|
+
V.current = e.target, se?.(e);
|
|
164
170
|
},
|
|
165
171
|
children: [
|
|
166
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ v("div", {
|
|
167
173
|
className: "ds-edit-layout__main",
|
|
168
|
-
children: [/* @__PURE__ */
|
|
174
|
+
children: [/* @__PURE__ */ _(D, {
|
|
169
175
|
backLabel: e,
|
|
170
176
|
onBack: c,
|
|
171
|
-
compact:
|
|
172
|
-
status: /* @__PURE__ */
|
|
173
|
-
saveState:
|
|
174
|
-
|
|
177
|
+
compact: X,
|
|
178
|
+
status: /* @__PURE__ */ _(E, {
|
|
179
|
+
saveState: g,
|
|
180
|
+
statusLabel: y,
|
|
181
|
+
savedAgo: b
|
|
175
182
|
}),
|
|
176
|
-
actions:
|
|
183
|
+
actions: x,
|
|
177
184
|
confirmLeave: A,
|
|
178
|
-
confirmation: /* @__PURE__ */
|
|
179
|
-
text:
|
|
180
|
-
bodyRef:
|
|
181
|
-
onKeepEditing:
|
|
185
|
+
confirmation: /* @__PURE__ */ _(ne, {
|
|
186
|
+
text: j,
|
|
187
|
+
bodyRef: L,
|
|
188
|
+
onKeepEditing: M
|
|
182
189
|
}),
|
|
183
|
-
onLeave:
|
|
184
|
-
detailsToggle: /* @__PURE__ */
|
|
185
|
-
ref:
|
|
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":
|
|
197
|
+
"aria-label": w,
|
|
191
198
|
"aria-haspopup": "dialog",
|
|
192
|
-
"aria-expanded":
|
|
193
|
-
"aria-controls":
|
|
194
|
-
onClick:
|
|
199
|
+
"aria-expanded": K,
|
|
200
|
+
"aria-controls": Y,
|
|
201
|
+
onClick: $
|
|
195
202
|
})
|
|
196
|
-
}), /* @__PURE__ */
|
|
197
|
-
ref:
|
|
203
|
+
}), /* @__PURE__ */ _("div", {
|
|
204
|
+
ref: L,
|
|
198
205
|
className: "ds-edit-layout__body",
|
|
199
|
-
children: /* @__PURE__ */
|
|
206
|
+
children: /* @__PURE__ */ _("div", {
|
|
200
207
|
className: "ds-edit-layout__content",
|
|
201
|
-
children:
|
|
208
|
+
children: ae
|
|
202
209
|
})
|
|
203
210
|
})]
|
|
204
211
|
}),
|
|
205
|
-
!
|
|
206
|
-
label:
|
|
207
|
-
detailsId:
|
|
208
|
-
expanded:
|
|
209
|
-
opensSheet:
|
|
210
|
-
sheetOpen:
|
|
211
|
-
toggleRef:
|
|
212
|
-
contentRef:
|
|
213
|
-
collapsed:
|
|
214
|
-
onToggle:
|
|
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__ */
|
|
217
|
-
id:
|
|
218
|
-
dir:
|
|
219
|
-
isOpen:
|
|
220
|
-
onClose: () =>
|
|
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:
|
|
224
|
-
closeLabel: `Close ${
|
|
230
|
+
title: w,
|
|
231
|
+
closeLabel: `Close ${w}`,
|
|
225
232
|
className: "ds-edit-layout__sheet",
|
|
226
|
-
children:
|
|
227
|
-
ref:
|
|
233
|
+
children: Z && /* @__PURE__ */ _("div", {
|
|
234
|
+
ref: B,
|
|
228
235
|
className: "ds-edit-layout__rail-content"
|
|
229
236
|
})
|
|
230
237
|
}),
|
|
231
|
-
|
|
238
|
+
H && m(ue, H)
|
|
232
239
|
]
|
|
233
240
|
});
|
|
234
241
|
});
|
|
235
242
|
//#endregion
|
|
236
|
-
export {
|
|
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,QAAgB;EACd,EAAO,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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,CACGA,KAAU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BAAepB,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
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Field/index.cjs"),require("../Container/index.cjs");const e=require("../../chunks/FormEditor-Dd44EMp_.cjs");exports.FormEditor=e.t,exports.validateFormValues=e.n;
|
|
@@ -58,12 +58,17 @@
|
|
|
58
58
|
--grid-row-gap: var(--space-12);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
/* The list reset has no specificity, so a component or consumer class on a
|
|
62
|
+
* Grid or Stack sets its own margin and padding whatever the load order. */
|
|
63
|
+
:where(.ds-grid, .ds-stack) {
|
|
64
64
|
margin: 0;
|
|
65
65
|
padding: 0;
|
|
66
66
|
list-style: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ds-grid {
|
|
70
|
+
display: grid;
|
|
71
|
+
gap: var(--grid-row-gap, var(--grid-gap)) var(--grid-gap);
|
|
67
72
|
container-type: inline-size;
|
|
68
73
|
}
|
|
69
74
|
|
|
@@ -172,9 +177,6 @@
|
|
|
172
177
|
.ds-stack {
|
|
173
178
|
display: flex;
|
|
174
179
|
gap: var(--grid-gap);
|
|
175
|
-
margin: 0;
|
|
176
|
-
padding: 0;
|
|
177
|
-
list-style: none;
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
.ds-stack--vertical {
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
export declare const icons: {
|
|
6
6
|
readonly "alert-triangle": import("lucide-react").LucideIcon;
|
|
7
7
|
readonly archive: import("lucide-react").LucideIcon;
|
|
8
|
+
readonly blocks: import("lucide-react").LucideIcon;
|
|
9
|
+
readonly film: import("lucide-react").LucideIcon;
|
|
10
|
+
readonly "audio-lines": import("lucide-react").LucideIcon;
|
|
8
11
|
readonly bold: import("lucide-react").LucideIcon;
|
|
9
12
|
readonly code: import("lucide-react").LucideIcon;
|
|
10
13
|
readonly "heading-2": import("lucide-react").LucideIcon;
|
|
@@ -49,6 +52,7 @@ export declare const icons: {
|
|
|
49
52
|
readonly image: import("lucide-react").LucideIcon;
|
|
50
53
|
readonly info: import("lucide-react").LucideIcon;
|
|
51
54
|
readonly link: import("lucide-react").LucideIcon;
|
|
55
|
+
readonly "key-round": import("lucide-react").LucideIcon;
|
|
52
56
|
readonly spinner: import("lucide-react").LucideIcon;
|
|
53
57
|
readonly "more-horizontal": import("lucide-react").LucideIcon;
|
|
54
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":"
|
|
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"}
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
export declare const icons: {
|
|
6
6
|
readonly "alert-triangle": import("lucide-react").LucideIcon;
|
|
7
7
|
readonly archive: import("lucide-react").LucideIcon;
|
|
8
|
+
readonly blocks: import("lucide-react").LucideIcon;
|
|
9
|
+
readonly film: import("lucide-react").LucideIcon;
|
|
10
|
+
readonly "audio-lines": import("lucide-react").LucideIcon;
|
|
8
11
|
readonly bold: import("lucide-react").LucideIcon;
|
|
9
12
|
readonly code: import("lucide-react").LucideIcon;
|
|
10
13
|
readonly "heading-2": import("lucide-react").LucideIcon;
|
|
@@ -49,6 +52,7 @@ export declare const icons: {
|
|
|
49
52
|
readonly image: import("lucide-react").LucideIcon;
|
|
50
53
|
readonly info: import("lucide-react").LucideIcon;
|
|
51
54
|
readonly link: import("lucide-react").LucideIcon;
|
|
55
|
+
readonly "key-round": import("lucide-react").LucideIcon;
|
|
52
56
|
readonly spinner: import("lucide-react").LucideIcon;
|
|
53
57
|
readonly "more-horizontal": import("lucide-react").LucideIcon;
|
|
54
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":"
|
|
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-
|
|
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-
|
|
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("../../chunks/Icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-WOhlu6Rp.cjs"),t=require("../Button/index.cjs");;/* empty css */const n=require("../FieldAffix/index.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=(0,r.forwardRef)(function({size:a=`md`,isDisabled:o=!1,onClear:s,className:c,placeholder:l=`Search`,value:u,disabled:d,onKeyDown:f,...p},m){let h=(0,r.useRef)(null),g=u!==void 0&&String(u).length>0;return(0,i.jsx)(n.FieldAffix,{className:c,lead:(0,i.jsx)(e.t,{name:`search`,size:16}),isTrailInteractive:!0,trail:g&&s?(0,i.jsx)(t.Button,{variant:`simple`,size:`xs`,isIconOnly:!0,iconStart:`x`,"aria-label":`Clear search`,isDisabled:o||d,onClick:()=>{s(),h.current?.focus()}}):void 0,children:(0,i.jsx)(`input`,{ref:e=>{h.current=e,typeof m==`function`?m(e):m&&(m.current=e)},type:`search`,value:u,placeholder:l,disabled:o||d,"data-size":a,className:`ds-field-skin ds-search__input`,onKeyDown:e=>{e.key===`Escape`&&s&&s(),f?.(e)},...p})})});exports.SearchField=a;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|