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