asma-ui-core 3.136.0 → 3.136.2

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.
@@ -1,62 +1,62 @@
1
- import { cn as u } from "../../../../helpers/cn.js";
1
+ import { cn as f } from "../../../../helpers/cn.js";
2
2
  import { firstTabbable as q } from "../../../../helpers/focusable.js";
3
- import { StyledTooltip as de } from "../../../data-display/tooltip/StyledTooltip.js";
4
- import { DialogBusyContext as V, useDialogBusyBoundary as ce } from "../../dialog/DialogBusyContext.js";
5
- import { OverlayBackOwnerContext as me, isOverlayBackNavigationPending as ue, useBackCloses as fe } from "../../../../hooks/useBackCloses.hook.js";
6
- import { useFocusTrap as pe } from "../../../../hooks/useFocusTrap.hook.js";
3
+ import { StyledTooltip as ce } from "../../../data-display/tooltip/StyledTooltip.js";
4
+ import { DialogBusyContext as G, useDialogBusyBoundary as me } from "../../dialog/DialogBusyContext.js";
5
+ import { OverlayBackOwnerContext as ue, isOverlayBackNavigationPending as fe, useBackCloses as pe } from "../../../../hooks/useBackCloses.hook.js";
6
+ import { useFocusTrap as he } from "../../../../hooks/useFocusTrap.hook.js";
7
7
  import { useMobileMediaQuery as ve } from "../../../../hooks/useMediaQuery.hook.js";
8
- import { useDialogHeaderPinning as he } from "../../dialog/useDialogHeaderPinning.js";
9
- import { DIALOG_HEADER_ACTIONS_ROW_CLASSES as xe, DIALOG_HEADER_CLASSES as ge, DIALOG_TITLE_CLASSES as be, dialogContentFlowClasses as ye, dialogScrollerStyle as we } from "../../dialog/dialogHeaderStyles.js";
10
- import { fullScreenFieldWidthVars as Ce } from "../../../inputs/field-styles.js";
11
- import { CloseBtn as W } from "../components/CloseBtn.js";
8
+ import { useDialogHeaderPinning as xe } from "../../dialog/useDialogHeaderPinning.js";
9
+ import { DIALOG_HEADER_ACTIONS_ROW_CLASSES as ge, DIALOG_HEADER_CLASSES as be, DIALOG_HEADER_TITLE_ROW_CLASSES as ye, DIALOG_TITLE_CLASSES as Se, dialogContentFlowClasses as we, dialogScrollerStyle as Ce } from "../../dialog/dialogHeaderStyles.js";
10
+ import { fullScreenFieldWidthVars as Re } from "../../../inputs/field-styles.js";
11
+ import { CloseBtn as V } from "../components/CloseBtn.js";
12
12
  import { MinimizeBtn as $ } from "../components/MinimizeBtn.js";
13
- import { FullScreenBtn as Se } from "../components/FullscreenBtn.js";
14
- import f from "./MinimizableDialogV2.module.js";
13
+ import { FullScreenBtn as _e } from "../components/FullscreenBtn.js";
14
+ import p from "./MinimizableDialogV2.module.js";
15
15
  import { useTranslations as ze } from "./useTranslations.js";
16
- import { useControlledProps as Re } from "./useControlledProps.js";
17
- import Ne from "clsx";
18
- import { useId as G, useLayoutEffect as Q, useRef as l } from "react";
19
- import { Fragment as Be, jsx as e, jsxs as r } from "react/jsx-runtime";
20
- var Je = (R) => {
21
- const { showCloseIcon: N = !0, showMinimizeIcon: U = !0, showExpandIcon: J = !0, enableFullscreen: K = !0, fullscreenLockedReason: B, title: p, label: v, children: X, open: i, onClose: Y, classNameOverrides: h = {
16
+ import { useControlledProps as Ee } from "./useControlledProps.js";
17
+ import Ie from "clsx";
18
+ import { useId as Q, useLayoutEffect as U, useRef as l } from "react";
19
+ import { Fragment as Ne, jsx as e, jsxs as r } from "react/jsx-runtime";
20
+ var Ye = (_) => {
21
+ const { showCloseIcon: z = !0, showMinimizeIcon: X = !0, showExpandIcon: J = !0, enableFullscreen: K = !0, fullscreenLockedReason: E, title: h, label: a, children: Y, open: i, onClose: Z, classNameOverrides: v = {
22
22
  maximized: "",
23
23
  minimized: "",
24
24
  fullscreen: ""
25
- }, dataTest: Z, actionNode: ee, locale: te = "en", busyReason: ie, style: I, initialFocusRef: _ } = R, x = ve(), o = ze(te), n = l(null), c = l(null), k = l(null), E = l(null), g = l(!1), b = l(null), y = G(), F = G(), T = l(null), { headerRef: oe, pinned: w, hidden: C, scrollPaddingTop: ne, scrollPaddingBottom: le } = he(T), { minimized: t, setMinimized: A, fullScreen: a, setFullScreen: D } = Re(R), s = a && !t, L = !!B, { busy: S, busyReason: O, contextValue: M } = ce(ie ?? o.waitUntilSaved), m = () => {
26
- if (S) return !1;
27
- A(!1), Y();
25
+ }, dataTest: ee, actionNode: te, locale: ie = "en", busyReason: oe, style: I, initialFocusRef: N } = _, x = ve(), o = ze(ie), n = l(null), m = l(null), A = l(null), T = l(null), g = l(!1), b = l(null), y = Q(), B = Q(), L = l(null), { headerRef: ne, pinned: S, hidden: w, scrollPaddingTop: le, scrollPaddingBottom: re } = xe(L), { minimized: t, setMinimized: O, fullScreen: s, setFullScreen: k } = Ee(_), d = s && !t, D = !!E, { busy: C, busyReason: F, contextValue: M } = me(oe ?? o.waitUntilSaved), u = () => {
26
+ if (C) return !1;
27
+ O(!1), Z();
28
28
  };
29
- Q(() => {
30
- n.current?.toggleAttribute("inert", t), c.current?.toggleAttribute("inert", !t);
31
- }, [t]), Q(() => {
32
- const z = i && !g.current, d = !i && g.current;
33
- if (g.current = i, d) {
34
- const H = b.current;
35
- b.current = null, (!document.activeElement || document.activeElement === document.body) && H?.isConnected && H.focus({ preventScroll: !0 });
29
+ U(() => {
30
+ n.current?.toggleAttribute("inert", t), m.current?.toggleAttribute("inert", !t);
31
+ }, [t]), U(() => {
32
+ const R = i && !g.current, c = !i && g.current;
33
+ if (g.current = i, c) {
34
+ const W = b.current;
35
+ b.current = null, (!document.activeElement || document.activeElement === document.body) && W?.isConnected && W.focus({ preventScroll: !0 });
36
36
  return;
37
37
  }
38
- if (!z) return;
38
+ if (!R) return;
39
39
  b.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
40
- const j = t ? c.current : n.current, se = t ? E.current : k.current;
41
- (_?.current ?? se ?? (j ? q(j) : void 0))?.focus({ preventScroll: !0 });
40
+ const j = t ? m.current : n.current, de = t ? T.current : A.current;
41
+ (N?.current ?? de ?? (j ? q(j) : void 0))?.focus({ preventScroll: !0 });
42
42
  }, [
43
- _,
43
+ N,
44
44
  t,
45
45
  i
46
46
  ]);
47
47
  const P = () => {
48
- const z = t ? n : c;
49
- A(!t), requestAnimationFrame(() => {
50
- const d = z.current;
51
- d && (d.querySelector('[data-testid="toggle-minimize-btn"]') ?? q(d))?.focus({ preventScroll: !0 });
48
+ const R = t ? n : m;
49
+ O(!t), requestAnimationFrame(() => {
50
+ const c = R.current;
51
+ c && (c.querySelector('[data-testid="toggle-minimize-btn"]') ?? q(c))?.focus({ preventScroll: !0 });
52
52
  });
53
53
  };
54
- pe(i && s, n, m), fe({
54
+ he(i && d, n, u), pe({
55
55
  active: i && !t,
56
- requestClose: () => !s && ue() ? !1 : m(),
56
+ requestClose: () => !d && fe() ? !1 : u(),
57
57
  ownerRef: n
58
58
  });
59
- const re = s ? x ? {
59
+ const ae = d ? x ? {
60
60
  inset: 0,
61
61
  maxHeight: "100dvh",
62
62
  maxWidth: "100dvw",
@@ -72,31 +72,35 @@ var Je = (R) => {
72
72
  width: "min(1000px, calc(100vw - 32px))",
73
73
  maxWidth: "min(1000px, calc(100vw - 32px))",
74
74
  height: "95dvh",
75
- ...Ce
75
+ ...Re
76
76
  } : void 0;
77
77
  if (!i) return null;
78
- const ae = v ? `${F} ${y}` : y;
79
- return /* @__PURE__ */ r(Be, { children: [
78
+ const se = a ? `${B} ${y}` : y, H = /* @__PURE__ */ e("div", {
79
+ id: y,
80
+ className: Se,
81
+ children: h
82
+ });
83
+ return /* @__PURE__ */ r(Ne, { children: [
80
84
  /* @__PURE__ */ e("div", {
81
- ref: c,
85
+ ref: m,
82
86
  style: {
83
87
  zIndex: 51,
84
88
  ...I
85
89
  },
86
- className: u(f["minimized-dialog"], !t && f.hidden, h.minimized),
90
+ className: f(p["minimized-dialog"], !t && p.hidden, v.minimized),
87
91
  children: /* @__PURE__ */ r("div", {
88
- className: Ne("flex items-center justify-between", !t && "hidden"),
89
- "data-testid": Z,
92
+ className: Ie("flex items-center justify-between", !t && "hidden"),
93
+ "data-testid": ee,
90
94
  children: [/* @__PURE__ */ e("div", {
91
95
  className: "min-w-0 max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
92
- children: /* @__PURE__ */ e(de, {
93
- title: p,
96
+ children: /* @__PURE__ */ e(ce, {
97
+ title: h,
94
98
  placement: "top",
95
99
  children: /* @__PURE__ */ e("div", {
96
100
  tabIndex: 0,
97
101
  "data-testid": "minimized-title",
98
102
  className: "truncate focus-visible:[outline-offset:-2px]",
99
- children: p
103
+ children: h
100
104
  })
101
105
  })
102
106
  }), /* @__PURE__ */ r("div", {
@@ -106,95 +110,98 @@ var Je = (R) => {
106
110
  visibility: J,
107
111
  onClick: P,
108
112
  tooltipTitle: o.expand
109
- }), /* @__PURE__ */ e(W, {
110
- buttonRef: E,
111
- showCloseIcon: N,
112
- onClick: m,
113
- disabledReason: S ? O : void 0,
113
+ }), /* @__PURE__ */ e(V, {
114
+ buttonRef: T,
115
+ showCloseIcon: z,
116
+ onClick: u,
117
+ disabledReason: C ? F : void 0,
114
118
  tooltipTitle: o.close
115
119
  })]
116
120
  })]
117
121
  })
118
122
  }),
119
- s && /* @__PURE__ */ e("div", {
123
+ d && /* @__PURE__ */ e("div", {
120
124
  className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
121
125
  onClick: () => {
122
- L || D(!1);
126
+ D || k(!1);
123
127
  }
124
128
  }),
125
129
  /* @__PURE__ */ e("div", {
126
130
  style: {
127
131
  zIndex: 51,
128
132
  ...I,
129
- ...re
133
+ ...ae
130
134
  },
131
135
  ref: n,
132
136
  role: "dialog",
133
- "aria-modal": s ? !0 : void 0,
134
- "aria-labelledby": ae,
135
- className: u(f.dialog, t && f.hidden, !a && h.maximized, a && h.fullscreen, s && "fixed z-[53] duration-0"),
136
- children: /* @__PURE__ */ e(me.Provider, {
137
+ "aria-modal": d ? !0 : void 0,
138
+ "aria-labelledby": se,
139
+ className: f(p.dialog, t && p.hidden, !s && v.maximized, s && v.fullscreen, d && "fixed z-[53] duration-0"),
140
+ children: /* @__PURE__ */ e(ue.Provider, {
137
141
  value: n,
138
142
  children: /* @__PURE__ */ r("div", {
139
- ref: T,
143
+ ref: L,
140
144
  "data-dialog-body": "",
141
- className: u(t && "hidden", "flex min-h-0 flex-grow flex-col overflow-y-auto overscroll-contain", "[&>[data-dialog-content-flow]>[data-dialog-content]]:!flex-[1_0_auto]", "[&_[data-dialog-footer]]:sticky [&_[data-dialog-footer]]:bottom-0 [&_[data-dialog-footer]]:z-[2] [&_[data-dialog-footer]]:bg-white"),
142
- style: we(ne, le),
145
+ className: f(t && "hidden", "flex min-h-0 flex-grow flex-col overflow-y-auto overscroll-contain", "[&>[data-dialog-content-flow]>[data-dialog-content]]:!flex-[1_0_auto]", "[&_[data-dialog-footer]]:sticky [&_[data-dialog-footer]]:bottom-0 [&_[data-dialog-footer]]:z-[2] [&_[data-dialog-footer]]:bg-white"),
146
+ style: Ce(le, re),
143
147
  children: [/* @__PURE__ */ r("div", {
144
- ref: oe,
148
+ ref: ne,
145
149
  "data-dialog-header": "",
146
- "data-header-pinned": w ? "true" : "false",
147
- "aria-hidden": C || void 0,
148
- hidden: C,
149
- className: u(ge, "border-b-[1px] border-delta-200 sm:rounded-t-lg", w && "sticky top-0 z-[2]", C && "hidden"),
150
+ "data-header-pinned": S ? "true" : "false",
151
+ "aria-hidden": w || void 0,
152
+ hidden: w,
153
+ className: f(be, "border-b-[1px] border-delta-200 sm:rounded-t-lg", S && "sticky top-0 z-[2]", w && "hidden"),
150
154
  children: [/* @__PURE__ */ r("div", {
151
- className: xe,
152
- children: [v && /* @__PURE__ */ e("div", {
153
- id: F,
154
- className: "min-w-0 flex-auto hyphens-auto text-sm text-delta-700 [overflow-wrap:anywhere]",
155
- children: v
156
- }), /* @__PURE__ */ r("div", {
157
- className: "ml-auto flex items-center gap-x-1 max-xs:flex-wrap max-xs:justify-end max-xs:gap-y-2",
158
- children: [
159
- /* @__PURE__ */ e(V.Provider, {
160
- value: M,
161
- children: ee
162
- }),
163
- /* @__PURE__ */ e($, {
164
- visibility: U && !x,
165
- type: "minimize",
166
- onClick: P,
167
- tooltipTitle: o.minimize
168
- }),
169
- /* @__PURE__ */ e(Se, {
170
- showFullScreenIcon: (K || L) && !x,
171
- disabledReason: B,
172
- fullScreen: a,
173
- onClick: () => {
174
- D(!a);
175
- },
176
- tooltipTitle: a ? o.exitFullscreen : o.fullscreen
177
- }),
178
- /* @__PURE__ */ e(W, {
179
- buttonRef: k,
180
- showCloseIcon: N,
181
- onClick: m,
182
- disabledReason: S ? O : void 0,
183
- tooltipTitle: o.close
184
- })
185
- ]
186
- })]
187
- }), /* @__PURE__ */ e("div", {
188
- id: y,
189
- className: be,
190
- children: p
191
- })]
155
+ className: a ? ge : ye,
156
+ children: [
157
+ a && /* @__PURE__ */ e("div", {
158
+ id: B,
159
+ className: "min-w-0 flex-auto hyphens-auto text-sm text-delta-700 [overflow-wrap:anywhere]",
160
+ children: a
161
+ }),
162
+ !a && /* @__PURE__ */ e("div", {
163
+ className: "min-w-0 flex-auto py-[9px] min-[744px]:py-1.5",
164
+ children: H
165
+ }),
166
+ /* @__PURE__ */ r("div", {
167
+ className: "ml-auto flex min-h-11 items-center gap-x-1 max-xs:flex-wrap max-xs:justify-end max-xs:gap-y-2",
168
+ children: [
169
+ /* @__PURE__ */ e(G.Provider, {
170
+ value: M,
171
+ children: te
172
+ }),
173
+ /* @__PURE__ */ e($, {
174
+ visibility: X && !x,
175
+ type: "minimize",
176
+ onClick: P,
177
+ tooltipTitle: o.minimize
178
+ }),
179
+ /* @__PURE__ */ e(_e, {
180
+ showFullScreenIcon: (K || D) && !x,
181
+ disabledReason: E,
182
+ fullScreen: s,
183
+ onClick: () => {
184
+ k(!s);
185
+ },
186
+ tooltipTitle: s ? o.exitFullscreen : o.fullscreen
187
+ }),
188
+ /* @__PURE__ */ e(V, {
189
+ buttonRef: A,
190
+ showCloseIcon: z,
191
+ onClick: u,
192
+ disabledReason: C ? F : void 0,
193
+ tooltipTitle: o.close
194
+ })
195
+ ]
196
+ })
197
+ ]
198
+ }), a && H]
192
199
  }), /* @__PURE__ */ e("div", {
193
200
  "data-dialog-content-flow": "",
194
- className: ye(w),
195
- children: /* @__PURE__ */ e(V.Provider, {
201
+ className: we(S),
202
+ children: /* @__PURE__ */ e(G.Provider, {
196
203
  value: M,
197
- children: X
204
+ children: Y
198
205
  })
199
206
  })]
200
207
  })
@@ -203,5 +210,5 @@ var Je = (R) => {
203
210
  ] });
204
211
  };
205
212
  export {
206
- Je as MinimizableDialogV2
213
+ Ye as MinimizableDialogV2
207
214
  };