asma-ui-core 3.134.1 → 3.134.3

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 (34) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/feedback/dialog/StyledDialog.js +174 -149
  3. package/dist/components/feedback/dialog/StyledDialog.module.js +1 -1
  4. package/dist/components/feedback/dialog/StyledDialogActions.js +4 -3
  5. package/dist/components/feedback/dialog/StyledDialogContent.js +9 -8
  6. package/dist/components/feedback/dialog/StyledDialogTitle.js +23 -21
  7. package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +1 -0
  8. package/dist/components/feedback/dialog/dialogHeaderStyles.js +13 -0
  9. package/dist/components/feedback/dialog/useDialogHeaderPinning.js +56 -0
  10. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +200 -182
  11. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +143 -131
  12. package/dist/components/inputs/full-screen-picker/FullScreenPicker.js +1 -1
  13. package/dist/components/inputs/full-screen-picker/useReleaseFieldOnKeyboardDismiss.js +13 -12
  14. package/dist/hooks/useElementHeightPx.js +26 -0
  15. package/dist/hooks/useLayoutViewportHeight.js +5 -0
  16. package/dist/hooks/useMediaQuery.hook.js +9 -8
  17. package/dist/hooks/useOnScreenKeyboard.js +24 -0
  18. package/dist/index.js +366 -352
  19. package/dist/src/components/feedback/dialog/StyledDialog.d.ts +4 -3
  20. package/dist/src/components/feedback/dialog/StyledDialogTitle.d.ts +4 -0
  21. package/dist/src/components/feedback/dialog/dialogHeaderStyles.d.ts +39 -0
  22. package/dist/src/components/feedback/dialog/dialogTitleContext.d.ts +5 -0
  23. package/dist/src/components/feedback/dialog/useDialogHeaderPinning.d.ts +33 -0
  24. package/dist/src/hooks/useElementHeightPx.d.ts +16 -0
  25. package/dist/src/hooks/useLayoutViewportHeight.d.ts +6 -0
  26. package/dist/src/hooks/useMediaQuery.hook.d.ts +6 -0
  27. package/dist/src/hooks/useOnScreenKeyboard.d.ts +21 -0
  28. package/dist/src/index.d.ts +6 -0
  29. package/dist/table/components/StyledTableIndex.js +5 -5
  30. package/package.json +1 -1
  31. package/dist/src/table/components/columns/helpers/useElementHeightPx.d.ts +0 -7
  32. package/dist/table/components/columns/helpers/useElementHeightPx.js +0 -26
  33. /package/dist/{components/inputs/full-screen-picker → hooks}/useVisualViewportHeight.js +0 -0
  34. /package/dist/src/{components/inputs/full-screen-picker → hooks}/useVisualViewportHeight.d.ts +0 -0
@@ -1,210 +1,235 @@
1
- import { cn as c } from "../../../helpers/cn.js";
2
- import { resolveSx as K } from "../../../helpers/sx.js";
3
- import { registerOpenModalDialog as he } from "../../../hooks/useTopLayer.hook.js";
4
- import { CloseIcon as we } from "../../icons/close-icon/CloseIcon.js";
5
- import { DialogBusyContext as pe, useDialogBusyBoundary as ye } from "./DialogBusyContext.js";
6
- import { StyledButton as ve } from "../../inputs/button/StyledButton.js";
7
- import { OverlayBackOwnerContext as ge, isOverlayBackEnabled as T, requestCloseTopOverlayBack as D, useBackCloses as be } from "../../../hooks/useBackCloses.hook.js";
8
- import { useMobileMediaQuery as ke } from "../../../hooks/useMediaQuery.hook.js";
9
- import { warnUnnamedDialog as Ce } from "../../../helpers/warnUnnamedDialog.js";
10
- import Ee from "./StyledDialog.module.js";
11
- import { StyledDialogTitleContext as Be } from "./dialogTitleContext.js";
12
- import { useEffect as d, useId as I, useLayoutEffect as U, useMemo as De, useRef as s, useState as X } from "react";
13
- import { jsx as a, jsxs as m } from "react/jsx-runtime";
14
- var Ie = {
1
+ import { cn as g } from "../../../helpers/cn.js";
2
+ import { resolveSx as J } from "../../../helpers/sx.js";
3
+ import { registerOpenModalDialog as Ce } from "../../../hooks/useTopLayer.hook.js";
4
+ import { CloseIcon as Se } from "../../icons/close-icon/CloseIcon.js";
5
+ import { DialogBusyContext as De, useDialogBusyBoundary as Re } from "./DialogBusyContext.js";
6
+ import { StyledButton as Ie } from "../../inputs/button/StyledButton.js";
7
+ import { OverlayBackOwnerContext as _e, isOverlayBackEnabled as Y, requestCloseTopOverlayBack as B, useBackCloses as Be } from "../../../hooks/useBackCloses.hook.js";
8
+ import { useMobileMediaQuery as Ne } from "../../../hooks/useMediaQuery.hook.js";
9
+ import { warnUnnamedDialog as Oe } from "../../../helpers/warnUnnamedDialog.js";
10
+ import Le from "./StyledDialog.module.js";
11
+ import { StyledDialogTitleContext as Ae } from "./dialogTitleContext.js";
12
+ import { useDialogHeaderPinning as He } from "./useDialogHeaderPinning.js";
13
+ import { dialogContentFlowClasses as Pe, dialogScrollerStyle as qe } from "./dialogHeaderStyles.js";
14
+ import { useEffect as s, useId as N, useLayoutEffect as Z, useMemo as Me, useRef as l, useState as O } from "react";
15
+ import { jsx as o, jsxs as c } from "react/jsx-runtime";
16
+ var Te = {
15
17
  xs: 444,
16
18
  sm: 600,
17
19
  md: 900,
18
20
  lg: 1200,
19
21
  xl: 1536
20
- }, Fe = ({ open: t, onClose: R, children: S, dataTest: f, maxWidth: N = "sm", fullWidth: G, fullScreen: Q, scroll: V = "paper", disableEscapeKeyDown: H, className: $, style: J, sx: Y, classes: O, PaperProps: Z, slotProps: x, busyReason: ee, locale: te = "en", onCloseText: q, showCloseIcon: M = !0, dialogLabel: i, dialogTitle: h, dialogHeaderNode: re, ariaLabel: b }) => {
21
- const w = I(), P = I(), [ne, oe] = X(), se = De(() => ({
22
- titleId: w,
23
- setTitleId: oe
24
- }), [w]), p = h ? w : ne ?? (i ? P : void 0), ae = ke(), l = s(null), k = s(null), C = s(!1), E = s(!1), u = s(!1), _ = s(t);
25
- d(() => {
26
- _.current = t;
22
+ }, lt = ({ open: t, onClose: L, children: A, dataTest: u, maxWidth: H = "sm", fullWidth: ee, fullScreen: te, scroll: ne = "paper", disableEscapeKeyDown: P, className: re, style: oe, sx: le, classes: q, PaperProps: ae, slotProps: f, busyReason: ie, locale: se = "en", onCloseText: M, showCloseIcon: b = !0, dialogLabel: m, dialogTitle: h, dialogHeaderNode: k, ariaLabel: E }) => {
23
+ const p = N(), T = N(), [W, de] = O(), [j, ce] = O(null), ue = Me(() => ({
24
+ titleId: p,
25
+ setTitleId: de,
26
+ titleSlot: j
27
+ }), [p, j]), z = !!m || b || !!k, w = h ? p : W ?? (m ? T : void 0), fe = Ne(), i = l(null), F = l(null), { headerRef: me, pinned: C, hidden: S, scrollPaddingTop: he, scrollPaddingBottom: pe } = He(F), D = l(null), R = l(!1), I = l(!1), d = l(!1), G = l(t);
28
+ s(() => {
29
+ G.current = t;
27
30
  }, [t]);
28
- const j = s(t), y = Q ?? ae, { busy: v, busyReason: le, contextValue: ie } = ye(ee, te), L = I(), [g, ce] = X(), W = s(!1);
29
- U(() => {
30
- const e = l.current, r = !!p || !!b, n = e && t && !r ? e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]') : null;
31
- n && !n.id && (n.id = L);
32
- const o = n?.id;
33
- o !== g && ce(o), e && t && !r && !n && !W.current && (W.current = !0, Ce(f));
31
+ const K = l(t), x = te ?? fe, { busy: y, busyReason: we, contextValue: xe } = Re(ie, se), U = N(), [v, ye] = O(), X = l(!1);
32
+ Z(() => {
33
+ const e = i.current, n = !!w || !!E, r = e && t && !n ? e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]') : null;
34
+ r && !r.id && (r.id = U);
35
+ const a = r?.id;
36
+ a !== v && ye(a), e && t && !n && !r && !X.current && (X.current = !0, Oe(u));
34
37
  }, [
35
38
  t,
36
- p,
37
- b,
38
- S,
39
- g,
40
- L,
41
- f
42
- ]), d(() => {
43
- j.current && !t && x?.transition?.onExited?.(), j.current = t;
44
- }, [t, x]), U(() => {
45
- const e = l.current;
39
+ w,
40
+ E,
41
+ A,
42
+ v,
43
+ U,
44
+ u
45
+ ]), s(() => {
46
+ K.current && !t && f?.transition?.onExited?.(), K.current = t;
47
+ }, [t, f]), Z(() => {
48
+ const e = i.current;
46
49
  if (!e || !t) return;
47
- e.open || (k.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
48
- const r = he(e);
50
+ e.open || (D.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
51
+ const n = Ce(e);
49
52
  return () => {
50
- r(), k.current?.isConnected && k.current.focus({ preventScroll: !0 });
53
+ n(), D.current?.isConnected && D.current.focus({ preventScroll: !0 });
51
54
  };
52
- }, [t]), d(() => {
55
+ }, [t]), s(() => {
53
56
  if (!t) return;
54
- const e = document.body.style.overflow, r = document.documentElement.style.overflow;
57
+ const e = document.body.style.overflow, n = document.documentElement.style.overflow;
55
58
  return document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", () => {
56
- document.body.style.overflow = e, document.documentElement.style.overflow = r;
59
+ document.body.style.overflow = e, document.documentElement.style.overflow = n;
57
60
  };
58
61
  }, [t]);
59
- const B = {
60
- ...Z,
61
- ...x?.paper
62
- }, z = N === !1 ? void 0 : Ie[N], { className: de, style: ue, onClick: me, ...fe } = x?.backdrop ?? {}, A = (e, r) => {
63
- if (v || u.current) return;
64
- const n = R?.(e, r);
65
- if (n && typeof n.then == "function") {
66
- u.current = !0;
67
- const o = () => {
68
- u.current = !1;
62
+ const _ = {
63
+ ...ae,
64
+ ...f?.paper
65
+ }, Q = H === !1 ? void 0 : Te[H], { className: ve, style: ge, onClick: be, ...ke } = f?.backdrop ?? {}, V = (e, n) => {
66
+ if (y || d.current) return;
67
+ const r = L?.(e, n);
68
+ if (r && typeof r.then == "function") {
69
+ d.current = !0;
70
+ const a = () => {
71
+ d.current = !1;
69
72
  };
70
- n.then(o, o);
73
+ r.then(a, a);
71
74
  }
72
- return n;
73
- }, F = (e) => C.current ? !1 : (C.current = !0, window.setTimeout(() => {
74
- C.current = !1;
75
- }, 0), A(e, "escapeKeyDown"));
76
- be({
75
+ return r;
76
+ }, $ = (e) => R.current ? !1 : (R.current = !0, window.setTimeout(() => {
77
+ R.current = !1;
78
+ }, 0), V(e, "escapeKeyDown"));
79
+ Be({
77
80
  active: t,
78
- requestClose: (e) => !R || H || v || u.current ? !1 : F(e ?? new Event("overlayBack")),
79
- ownerRef: l
81
+ requestClose: (e) => !L || P || y || d.current ? !1 : $(e ?? new Event("overlayBack")),
82
+ ownerRef: i
80
83
  });
81
- const xe = (e) => {
82
- e.cancelable && e.preventDefault(), !E.current && T() && D();
84
+ const Ee = (e) => {
85
+ e.cancelable && e.preventDefault(), !I.current && Y() && B();
83
86
  };
84
- return d(() => {
85
- const e = l.current;
87
+ return s(() => {
88
+ const e = i.current;
86
89
  if (!e || !t) return;
87
- let r = !1;
88
- const n = () => {
90
+ let n = !1;
91
+ const r = () => {
89
92
  requestAnimationFrame(() => {
90
- r = !1, _.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
93
+ n = !1, G.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
91
94
  });
92
- }, o = () => {
93
- r || (r = !0, T() && !u.current && D(), n());
95
+ }, a = () => {
96
+ n || (n = !0, Y() && !d.current && B(), r());
94
97
  };
95
- return e.addEventListener("close", o), () => e.removeEventListener("close", o);
96
- }, [t]), d(() => {
97
- if (!t || H) return;
98
- const e = (r) => {
99
- r.key !== "Escape" || r.defaultPrevented || (r.preventDefault(), r.stopImmediatePropagation(), D(r));
98
+ return e.addEventListener("close", a), () => e.removeEventListener("close", a);
99
+ }, [t]), s(() => {
100
+ if (!t || P) return;
101
+ const e = (n) => {
102
+ n.key !== "Escape" || n.defaultPrevented || (n.preventDefault(), n.stopImmediatePropagation(), B(n));
100
103
  };
101
104
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
102
- }), d(() => {
105
+ }), s(() => {
103
106
  if (!t) return;
104
- const e = (r) => {
105
- r.key === "Escape" && (E.current = !0, window.setTimeout(() => {
106
- E.current = !1;
107
+ const e = (n) => {
108
+ n.key === "Escape" && (I.current = !0, window.setTimeout(() => {
109
+ I.current = !1;
107
110
  }, 0));
108
111
  };
109
112
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
110
- }, [t]), t ? /* @__PURE__ */ m("dialog", {
111
- ref: l,
113
+ }, [t]), t ? /* @__PURE__ */ c("dialog", {
114
+ ref: i,
112
115
  tabIndex: -1,
113
- "data-testid": f,
114
- "aria-labelledby": p ?? g,
115
- "aria-label": p || g ? void 0 : b,
116
- onCancel: xe,
116
+ "data-testid": u,
117
+ "aria-labelledby": w ?? v,
118
+ "aria-label": w || v ? void 0 : E,
119
+ onCancel: Ee,
117
120
  onKeyDown: (e) => {
118
- !v || e.key !== "Escape" || e.target.closest("dialog[open]") === l.current && e.preventDefault();
121
+ !y || e.key !== "Escape" || e.target.closest("dialog[open]") === i.current && e.preventDefault();
119
122
  },
120
- className: c(Ee.StyledDialog, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none items-center justify-center overflow-hidden border-0 bg-transparent p-0 outline-none open:flex", V === "body" && "overflow-y-auto", $, O?.root),
123
+ className: g(Le.StyledDialog, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none items-center justify-center overflow-hidden border-0 bg-transparent p-0 outline-none open:flex", ne === "body" && "overflow-y-auto", re, q?.root),
121
124
  style: {
122
125
  zIndex: 999,
123
- ...K(Y),
124
- ...J
126
+ ...J(le),
127
+ ...oe
125
128
  },
126
- children: [/* @__PURE__ */ a("div", {
127
- ...fe,
128
- className: c("absolute inset-0 bg-[#626e7eb2]", de),
129
- style: ue,
129
+ children: [/* @__PURE__ */ o("div", {
130
+ ...ke,
131
+ className: g("absolute inset-0 bg-[#626e7eb2]", ve),
132
+ style: ge,
130
133
  onClick: (e) => {
131
- me?.(e), e.defaultPrevented || A(e, "backdropClick");
134
+ be?.(e), e.defaultPrevented || V(e, "backdropClick");
132
135
  }
133
- }), /* @__PURE__ */ m("div", {
134
- className: c("relative z-[1] flex flex-col overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", y && "rounded-none", B.className, O?.paper),
136
+ }), /* @__PURE__ */ o("div", {
137
+ className: g("relative z-[1] flex flex-col overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", x && "rounded-none", _.className, q?.paper),
135
138
  style: {
136
139
  minWidth: 0,
137
140
  minHeight: 0,
138
- ...!y && z ? { maxWidth: z } : {},
139
- ...y ? {
141
+ ...!x && Q ? { maxWidth: Q } : {},
142
+ ...x ? {
140
143
  width: "100%",
141
144
  maxWidth: "100%",
142
145
  height: "100%",
143
146
  maxHeight: "100%"
144
147
  } : {
145
- width: G ? "calc(100% - 64px)" : "auto",
148
+ width: ee ? "calc(100% - 64px)" : "auto",
146
149
  maxHeight: "100%"
147
150
  },
148
- ...K(B.sx),
149
- ...B.style,
150
- ...y ? {
151
+ ...J(_.sx),
152
+ ..._.style,
153
+ ...x ? {
151
154
  width: "100%",
152
155
  maxWidth: "100%",
153
156
  height: "100%",
154
157
  maxHeight: "100%"
155
158
  } : { maxHeight: "calc(100% - 64px)" }
156
159
  },
157
- children: [(!!i || !!h || M) && /* @__PURE__ */ m("div", {
158
- className: c("box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4", "max-xs:flex-wrap-reverse max-xs:items-center max-xs:gap-x-2 max-xs:gap-y-0.5"),
159
- children: [/* @__PURE__ */ m("div", {
160
- className: "flex min-w-0 flex-1 flex-col justify-start gap-0.5 max-xs:contents",
161
- children: [i && /* @__PURE__ */ a("div", {
162
- id: P,
163
- className: c("flex h-8 items-center text-sm font-normal leading-5 text-delta-600", "max-xs:h-auto max-xs:min-h-8 max-xs:min-w-0 max-xs:flex-auto max-xs:hyphens-auto max-xs:![overflow-wrap:anywhere]"),
164
- children: i
165
- }), h && /* @__PURE__ */ a("div", {
166
- id: w,
167
- className: c("flex text-2xl font-semibold leading-8 text-delta-800", "max-xs:hyphens-auto", i && "max-xs:order-first max-xs:basis-full max-xs:![overflow-wrap:anywhere]", !i && "max-xs:block max-xs:min-w-[min(100%,5rem)] max-xs:grow max-xs:basis-[min-content] max-xs:break-words"),
168
- children: h
169
- })]
170
- }), M && /* @__PURE__ */ m("div", {
171
- className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2 max-xs:ml-auto max-xs:flex-wrap max-xs:gap-y-2 max-xs:self-end",
172
- children: [re, /* @__PURE__ */ a(ve, {
173
- dataTest: `close-button-${f}`,
174
- "aria-label": q ? void 0 : "Close",
175
- variant: "textGray",
176
- size: "small",
177
- endIcon: /* @__PURE__ */ a(we, {
178
- width: 20,
179
- height: 20
160
+ children: /* @__PURE__ */ c("div", {
161
+ ref: F,
162
+ "data-dialog-body": "",
163
+ className: "flex min-h-0 w-full min-w-0 flex-auto flex-col overflow-y-auto overflow-x-hidden overscroll-contain",
164
+ style: qe(he, pe),
165
+ children: [(z || !!h || !!W) && /* @__PURE__ */ c("div", {
166
+ ref: me,
167
+ "data-dialog-header": "",
168
+ "data-header-pinned": C ? "true" : "false",
169
+ "aria-hidden": S || void 0,
170
+ hidden: S,
171
+ className: g("box-border w-full min-w-0 max-w-full shrink-0 bg-white px-4 pb-3 pt-4", C && "sticky top-0 z-[2]", S && "hidden"),
172
+ children: [
173
+ z && /* @__PURE__ */ c("div", {
174
+ className: "flex min-h-11 w-full min-w-0 items-center justify-between gap-x-2 max-xs:flex-wrap max-xs:gap-y-1",
175
+ children: [m && /* @__PURE__ */ o("div", {
176
+ id: T,
177
+ className: "min-w-0 flex-auto hyphens-auto text-sm font-normal leading-5 text-delta-600 [overflow-wrap:anywhere]",
178
+ children: m
179
+ }), (b || !!k) && /* @__PURE__ */ c("div", {
180
+ className: "ml-auto flex min-w-0 max-w-full shrink-0 items-center justify-end gap-2 max-xs:flex-wrap max-xs:gap-y-2",
181
+ children: [k, b && /* @__PURE__ */ o(Ie, {
182
+ dataTest: `close-button-${u}`,
183
+ "aria-label": M ? void 0 : "Close",
184
+ variant: "textGray",
185
+ size: "small",
186
+ endIcon: /* @__PURE__ */ o(Se, {
187
+ width: 20,
188
+ height: 20
189
+ }),
190
+ className: "max-w-full shrink-0 whitespace-nowrap",
191
+ disabled: y,
192
+ disabledReason: we,
193
+ onClick: (e) => {
194
+ $(e);
195
+ },
196
+ style: {
197
+ color: "var(--colors-delta-800)",
198
+ paddingRight: "6px",
199
+ paddingLeft: "6px"
200
+ },
201
+ children: M
202
+ })]
203
+ })]
180
204
  }),
181
- className: "max-w-full shrink-0 whitespace-nowrap",
182
- disabled: v,
183
- disabledReason: le,
184
- onClick: (e) => {
185
- F(e);
186
- },
187
- style: {
188
- color: "var(--colors-delta-800)",
189
- paddingRight: "6px",
190
- paddingLeft: "6px"
191
- },
192
- children: q
193
- })]
194
- })]
195
- }), /* @__PURE__ */ a(ge.Provider, {
196
- value: l,
197
- children: /* @__PURE__ */ a(Be.Provider, {
198
- value: se,
199
- children: /* @__PURE__ */ a(pe.Provider, {
200
- value: ie,
201
- children: S
205
+ h && /* @__PURE__ */ o("div", {
206
+ id: p,
207
+ className: "my-0 block min-w-0 whitespace-normal text-[20px] font-bold leading-[26px] text-delta-800 [overflow-wrap:anywhere] hyphens-auto min-[744px]:text-lg min-[744px]:leading-6",
208
+ children: h
209
+ }),
210
+ /* @__PURE__ */ o("div", {
211
+ ref: ce,
212
+ className: "contents"
213
+ })
214
+ ]
215
+ }), /* @__PURE__ */ o("div", {
216
+ "data-dialog-content-flow": "",
217
+ className: Pe(C),
218
+ children: /* @__PURE__ */ o(_e.Provider, {
219
+ value: i,
220
+ children: /* @__PURE__ */ o(Ae.Provider, {
221
+ value: ue,
222
+ children: /* @__PURE__ */ o(De.Provider, {
223
+ value: xe,
224
+ children: A
225
+ })
226
+ })
202
227
  })
203
- })
204
- })]
228
+ })]
229
+ })
205
230
  })]
206
231
  }) : null;
207
232
  };
208
233
  export {
209
- Fe as StyledDialog
234
+ lt as StyledDialog
210
235
  };
@@ -1,4 +1,4 @@
1
- var l = "_StyledDialog_1gbsy_1", a = { StyledDialog: l };
1
+ var l = "_StyledDialog_1np5t_1", a = { StyledDialog: l };
2
2
  export {
3
3
  a as default
4
4
  };
@@ -2,8 +2,9 @@ import { resolveSx as r } from "../../../helpers/sx.js";
2
2
  import o from "clsx";
3
3
  import "react";
4
4
  import { jsx as s } from "react/jsx-runtime";
5
- var x = ({ children: e, className: a, sx: i, style: l, classes: c, disableSpacing: d, ...t }) => /* @__PURE__ */ s("div", {
5
+ var x = ({ children: a, className: e, sx: i, style: l, classes: d, disableSpacing: c, ...t }) => /* @__PURE__ */ s("div", {
6
6
  "data-testid": "styled-dialog-actions",
7
+ "data-dialog-footer": "",
7
8
  className: "m-0 flex shrink-0 justify-center p-0",
8
9
  style: {
9
10
  ...r(i),
@@ -11,8 +12,8 @@ var x = ({ children: e, className: a, sx: i, style: l, classes: c, disableSpacin
11
12
  },
12
13
  ...t,
13
14
  children: /* @__PURE__ */ s("div", {
14
- className: o("flex w-full justify-end gap-2 p-4 max-xs:flex-wrap", a),
15
- children: e
15
+ className: o("flex w-full justify-end gap-2 p-4 max-xs:flex-wrap", e),
16
+ children: a
16
17
  })
17
18
  });
18
19
  export {
@@ -1,17 +1,18 @@
1
1
  import { resolveSx as d } from "../../../helpers/sx.js";
2
- import m from "clsx";
2
+ import n from "clsx";
3
3
  import { jsx as i } from "react/jsx-runtime";
4
- var p = ({ children: e, className: o, sx: r, style: t, dividers: l, classes: n, ...s }) => {
5
- const a = {
6
- ...d(r),
7
- ...t
4
+ var p = ({ children: e, className: o, sx: t, style: r, dividers: l, classes: m, ...a }) => {
5
+ const s = {
6
+ ...d(t),
7
+ ...r
8
8
  };
9
9
  return /* @__PURE__ */ i("div", {
10
10
  "data-test": "styled-dialog-content",
11
11
  tabIndex: 0,
12
- className: m("min-h-0 w-full min-w-0 flex-auto overflow-auto px-6 py-4", l && "border-y border-solid border-[rgba(0,0,0,0.12)]", o),
13
- style: a,
14
- ...s,
12
+ className: n("min-h-0 w-full min-w-0 flex-auto overflow-auto px-6 py-4", l && "border-y border-solid border-[rgba(0,0,0,0.12)]", o),
13
+ style: s,
14
+ ...a,
15
+ "data-dialog-content": "",
15
16
  children: e
16
17
  });
17
18
  };
@@ -1,31 +1,33 @@
1
- import { resolveSx as n } from "../../../helpers/sx.js";
2
- import { StyledDialogTitleContext as x } from "./dialogTitleContext.js";
3
- import f from "clsx";
4
- import { useContext as p, useLayoutEffect as u } from "react";
1
+ import { resolveSx as p } from "../../../helpers/sx.js";
2
+ import { StyledDialogTitleContext as S } from "./dialogTitleContext.js";
3
+ import { DIALOG_TITLE_CLASSES as u } from "./dialogHeaderStyles.js";
4
+ import x from "clsx";
5
+ import { useContext as g, useLayoutEffect as T } from "react";
5
6
  import { jsx as y } from "react/jsx-runtime";
6
- var I = ({ children: e, className: l, sx: r, style: i, id: a, classes: c, ...m }) => {
7
- const t = p(x), s = !!e, o = a ?? t?.titleId;
8
- if (u(() => {
9
- if (!(!s || !t))
10
- return t.setTitleId(o), () => t.setTitleId(void 0);
7
+ import { createPortal as I } from "react-dom";
8
+ var j = ({ children: e, className: a, sx: m, style: n, id: d, classes: C, ...c }) => {
9
+ const o = g(S), r = !!e, l = d ?? o?.titleId, t = o?.setTitleId;
10
+ if (T(() => {
11
+ if (!(!r || !t))
12
+ return t(l), () => t(void 0);
11
13
  }, [
12
- s,
14
+ r,
13
15
  t,
14
- o
16
+ l
15
17
  ]), !e) return null;
16
- const d = {
17
- ...n(r),
18
- ...i
19
- };
20
- return /* @__PURE__ */ y("h2", {
18
+ const f = {
19
+ ...p(m),
20
+ ...n
21
+ }, i = o?.titleSlot, s = /* @__PURE__ */ y("h2", {
21
22
  "data-testid": "styled-dialog-title",
22
- id: o,
23
- className: f("mx-3 p-4 text-[20px] font-semibold leading-[20px]", "max-xs:hyphens-auto max-xs:![overflow-wrap:anywhere]", l),
24
- style: d,
25
- ...m,
23
+ id: l,
24
+ className: x(u, !i && "mx-3 p-4", a),
25
+ style: f,
26
+ ...c,
26
27
  children: e
27
28
  });
29
+ return i ? I(s, i) : s;
28
30
  };
29
31
  export {
30
- I as StyledDialogTitle
32
+ j as StyledDialogTitle
31
33
  };
@@ -76,6 +76,7 @@ function Ce({ leftActions: n = [], leadingSlot: l, secondaryAction: f, primaryAc
76
76
  return /* @__PURE__ */ m("div", {
77
77
  ref: D,
78
78
  "data-testid": h,
79
+ "data-dialog-footer": "",
79
80
  className: w("flex items-center justify-end self-stretch border-0 border-t border-solid border-delta-200 bg-white", "max-xs:flex-wrap max-xs:gap-y-2", a ? "gap-2 p-2" : "gap-4 p-4", W && "rounded-b-lg", L && "sticky bottom-0 z-[1]", S),
80
81
  children: [/* @__PURE__ */ o("div", {
81
82
  className: "flex shrink-0 flex-nowrap items-center gap-2 max-xs:mr-auto max-xs:min-w-0 max-xs:shrink",
@@ -0,0 +1,13 @@
1
+ var x = "box-border w-full min-w-0 max-w-full shrink-0 bg-white px-4 pb-3 pt-4", a = (e) => e ? "isolate flex min-h-0 min-w-0 flex-[1_1_0%] flex-col" : "isolate flex min-w-0 flex-[1_0_auto] flex-col [&>:only-child]:flex-grow", t = (e, l) => ({
2
+ scrollPaddingTop: e,
3
+ scrollPaddingBottom: l,
4
+ "--dialog-header-offset": `${e}px`,
5
+ "--dialog-footer-offset": `${l}px`
6
+ }), o = "flex min-h-11 w-full min-w-0 items-center justify-between gap-x-2 max-xs:flex-wrap max-xs:gap-y-1", i = "my-0 block min-w-0 whitespace-normal text-[20px] font-bold leading-[26px] text-delta-800 [overflow-wrap:anywhere] hyphens-auto min-[744px]:text-lg min-[744px]:leading-6";
7
+ export {
8
+ o as DIALOG_HEADER_ACTIONS_ROW_CLASSES,
9
+ x as DIALOG_HEADER_CLASSES,
10
+ i as DIALOG_TITLE_CLASSES,
11
+ a as dialogContentFlowClasses,
12
+ t as dialogScrollerStyle
13
+ };
@@ -0,0 +1,56 @@
1
+ import { useShortScreenMediaQuery as y } from "../../../hooks/useMediaQuery.hook.js";
2
+ import { useElementHeightPx as m } from "../../../hooks/useElementHeightPx.js";
3
+ import { useLayoutViewportHeight as S } from "../../../hooks/useLayoutViewportHeight.js";
4
+ import { useOnScreenKeyboardOpen as F } from "../../../hooks/useOnScreenKeyboard.js";
5
+ import { useCallback as P, useLayoutEffect as d, useRef as g, useState as h } from "react";
6
+ var T = 0.25, R = (e) => {
7
+ const [r, i] = h(void 0);
8
+ return d(() => {
9
+ if (!e) return;
10
+ const t = (n) => i(n.target), o = (n) => i(n.relatedTarget);
11
+ return document.addEventListener("focusin", t), document.addEventListener("focusout", o), () => {
12
+ document.removeEventListener("focusin", t), document.removeEventListener("focusout", o), i(void 0);
13
+ };
14
+ }, [e]), e ? r === void 0 ? document.activeElement : r : null;
15
+ }, L = (e) => getComputedStyle(e).position === "sticky" ? Math.round(e.getBoundingClientRect().height) : 0, O = (e) => e.hidden ? null : Math.round(e.getBoundingClientRect().height), M = (e) => Array.from(e.querySelectorAll("[data-dialog-footer]")).find((r) => r.closest("[data-dialog-body]") === e) ?? null, k = (e) => {
16
+ const { ref: r, heightPx: i } = m(L), t = g(null);
17
+ return d(() => {
18
+ const o = e.current;
19
+ if (t.current?.scroller === o) return;
20
+ if (t.current?.observer?.disconnect(), t.current = null, !o) return r(null);
21
+ const n = () => r(M(o));
22
+ n();
23
+ const c = typeof MutationObserver > "u" ? void 0 : new MutationObserver(n);
24
+ c?.observe(o, {
25
+ childList: !0,
26
+ subtree: !0
27
+ }), t.current = {
28
+ scroller: o,
29
+ observer: c
30
+ };
31
+ }), d(() => () => t.current?.observer?.disconnect(), []), i;
32
+ }, _ = (e) => {
33
+ const r = y(), i = S(), t = F(), { ref: o, heightPx: n } = m(O), [c, E] = h(null), H = k(e), p = P((u) => {
34
+ E(u), o(u);
35
+ }, [o]), a = !r && n <= i * 0.25, f = R(a && t), b = !!c && !!f && c.contains(f), s = a && t && !b;
36
+ d(() => {
37
+ c?.toggleAttribute("inert", s);
38
+ }, [c, s]);
39
+ const v = g(s);
40
+ return d(() => {
41
+ if (v.current === s) return;
42
+ v.current = s;
43
+ const u = e.current, l = document.activeElement;
44
+ u && l instanceof HTMLElement && l !== u && l.closest("[data-dialog-body]") === u && l.scrollIntoView({ block: "nearest" });
45
+ }, [s, e]), {
46
+ headerRef: p,
47
+ pinned: a,
48
+ hidden: s,
49
+ scrollPaddingTop: a && !s ? n : 0,
50
+ scrollPaddingBottom: H
51
+ };
52
+ };
53
+ export {
54
+ T as PINNED_HEADER_MAX_VIEWPORT_SHARE,
55
+ _ as useDialogHeaderPinning
56
+ };