asma-ui-core 3.25.0 → 3.26.0

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 (31) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/custom/module/header-layout/DynamicToolbar.js +245 -0
  3. package/dist/components/custom/module/header-layout/DynamicToolbarLayoutContext.js +13 -0
  4. package/dist/components/custom/module/header-layout/ToolbarActionGroup.js +82 -0
  5. package/dist/components/custom/module/header-layout/ToolbarMeasurement.js +56 -0
  6. package/dist/components/custom/module/header-layout/ToolbarRows.js +131 -0
  7. package/dist/components/custom/module/header-layout/estimateToolbarLayout.js +189 -0
  8. package/dist/components/custom/module/header-layout/planToolbarActions.js +130 -0
  9. package/dist/components/custom/module/header-layout/useTranslations.js +23 -0
  10. package/dist/components/custom/widget/widget-header/StyledWidgetHeader.js +15 -12
  11. package/dist/components/utils/filter-menu/StyledFilterButton.js +22 -18
  12. package/dist/components/utils/filter-menu/StyledFilterMenu.js +20 -19
  13. package/dist/datetime/components/time-picker/TimePickerInput.js +18 -18
  14. package/dist/hooks/useElementWidthPx.js +26 -0
  15. package/dist/hooks/useWidthRegistry.js +37 -0
  16. package/dist/index.js +184 -172
  17. package/dist/src/components/custom/module/header-layout/DynamicToolbar.d.ts +25 -0
  18. package/dist/src/components/custom/module/header-layout/DynamicToolbarLayoutContext.d.ts +7 -0
  19. package/dist/src/components/custom/module/header-layout/ToolbarActionGroup.d.ts +19 -0
  20. package/dist/src/components/custom/module/header-layout/ToolbarMeasurement.d.ts +27 -0
  21. package/dist/src/components/custom/module/header-layout/ToolbarRows.d.ts +65 -0
  22. package/dist/src/components/custom/module/header-layout/estimateToolbarLayout.d.ts +95 -0
  23. package/dist/src/components/custom/module/header-layout/index.d.ts +3 -0
  24. package/dist/src/components/custom/module/header-layout/planToolbarActions.d.ts +72 -0
  25. package/dist/src/components/custom/module/header-layout/useTranslations.d.ts +17 -0
  26. package/dist/src/components/utils/filter-menu/StyledFilterButton.d.ts +1 -0
  27. package/dist/src/components/utils/filter-menu/StyledFilterMenu.d.ts +1 -0
  28. package/dist/src/hooks/useElementWidthPx.d.ts +10 -0
  29. package/dist/src/hooks/useWidthRegistry.d.ts +21 -0
  30. package/dist/src/index.d.ts +1 -0
  31. package/package.json +1 -1
@@ -0,0 +1,189 @@
1
+ import { resolveToolbarActionWidth as U } from "./planToolbarActions.js";
2
+ var l = 8, y = 12, w = 168, C = 44, G = 92, H = 44, Y = 148, D = 44, V = 168, J = 11, K = 96, B = 360, j = 12;
3
+ function m(t) {
4
+ return {
5
+ leading: t?.leadingUtilityWidthPx ?? C,
6
+ search: t?.searchWidthPx ?? w,
7
+ selectionIndicator: t?.selectionIndicatorWidthPx ?? V,
8
+ filter: (i) => i ? t?.filterIconWidthPx ?? H : t?.filterLabelWidthPx ?? G,
9
+ trailing: (i) => i ? t?.trailingIconWidthPx ?? D : t?.trailingLabelWidthPx ?? Y
10
+ };
11
+ }
12
+ function q(t) {
13
+ return t ? typeof t == "string" ? t.length : j : 0;
14
+ }
15
+ function z(t) {
16
+ const i = q(t), e = i > 0 ? i * J + 24 : 0;
17
+ return Math.min(B, Math.max(K, e));
18
+ }
19
+ function Q(t, i) {
20
+ return i != null && i > 0 ? Math.min(B, i) : z(t);
21
+ }
22
+ function v(t, i, e) {
23
+ const n = t.filter((r) => !r.hidden);
24
+ return n.length ? n.reduce((r, c) => r + U(c, i, e) + l, 0) - l : 0;
25
+ }
26
+ function E(t, i, e) {
27
+ const n = t.filter((s) => !s.hidden).sort((s, u) => (u.priority ?? 0) - (s.priority ?? 0));
28
+ if (!n.length) return 0;
29
+ const r = n.slice(0, i), c = v(r, !0, e);
30
+ return n.length === r.length ? c : c + (r.length ? l : 0) + 40;
31
+ }
32
+ function tt(t, i, e, n = 3) {
33
+ return t > 0 ? t : E(i, n, e);
34
+ }
35
+ function S(t) {
36
+ const { hasLeadingUtility: i, hasFilter: e, hasSearch: n, hasTrailingUtility: r, showPageActions: c, showBulkActions: s, filterIconOnly: u, trailingIconOnly: h, pageActionsWidthPx: I, bulkActionsWidthPx: O, searchBeforeFilter: W = !1, measured: g } = t, d = m(g);
37
+ let o = 0;
38
+ c && i && (o += d.leading + l);
39
+ const f = e ? d.filter(u) + l : 0, p = n ? d.search + l : 0;
40
+ return W ? o += p + f : o += f + p, c && (I > 0 && (o += I + l), r && (o += d.trailing(h) + l)), s && O > 0 && (o += O + l), Math.max(0, o - l);
41
+ }
42
+ function it(t) {
43
+ const { containerWidth: i, isMobile: e, isSelectionMode: n, compactBreakpointPx: r, reserveBulkActionsWidthPx: c, title: s, hasLeadingUtility: u, hasFilter: h, hasSearch: I, hasTrailingUtility: O, pageActions: W, bulkActions: g, maxVisibleBulkActions: d = 2, measured: o } = t, f = i > 0 ? i : Number.POSITIVE_INFINITY, p = !n, F = n, M = n ? 0 : c, b = m(o), _ = Q(s, o?.titleWidthPx), P = v(W, !0, o?.actionWidthPx), L = v(W, !1, o?.actionWidthPx), k = E(g, d, o?.actionWidthPx), A = (a) => S({
44
+ hasLeadingUtility: u,
45
+ hasFilter: h,
46
+ hasSearch: I,
47
+ hasTrailingUtility: O,
48
+ showPageActions: p,
49
+ showBulkActions: F,
50
+ bulkActionsWidthPx: 0,
51
+ measured: o,
52
+ ...a
53
+ });
54
+ if (e || f < r) {
55
+ const a = (x) => f >= A({
56
+ ...x,
57
+ searchBeforeFilter: !0
58
+ }), T = (x) => n ? !0 : x;
59
+ return a({
60
+ filterIconOnly: !1,
61
+ trailingIconOnly: !1,
62
+ pageActionsWidthPx: P
63
+ }) ? {
64
+ mode: "compact",
65
+ filterIconOnly: !1,
66
+ trailingIconOnly: T(!1)
67
+ } : a({
68
+ filterIconOnly: !1,
69
+ trailingIconOnly: !0,
70
+ pageActionsWidthPx: P
71
+ }) ? {
72
+ mode: "compact",
73
+ filterIconOnly: !1,
74
+ trailingIconOnly: !0
75
+ } : a({
76
+ filterIconOnly: !1,
77
+ trailingIconOnly: !0,
78
+ pageActionsWidthPx: L
79
+ }) ? {
80
+ mode: "compact",
81
+ filterIconOnly: !1,
82
+ trailingIconOnly: !0
83
+ } : {
84
+ mode: "compact",
85
+ filterIconOnly: !0,
86
+ trailingIconOnly: !0
87
+ };
88
+ }
89
+ if (n) {
90
+ const a = (R) => S({
91
+ hasLeadingUtility: !1,
92
+ hasFilter: h,
93
+ hasSearch: I,
94
+ hasTrailingUtility: !1,
95
+ showPageActions: !1,
96
+ showBulkActions: !1,
97
+ filterIconOnly: R,
98
+ trailingIconOnly: !0,
99
+ pageActionsWidthPx: 0,
100
+ bulkActionsWidthPx: 0,
101
+ measured: o
102
+ });
103
+ if (f >= _ + b.selectionIndicator + A({
104
+ filterIconOnly: !1,
105
+ trailingIconOnly: !0,
106
+ pageActionsWidthPx: 0,
107
+ bulkActionsWidthPx: k
108
+ }) + y) return {
109
+ mode: "inline",
110
+ filterIconOnly: !1,
111
+ trailingIconOnly: !0
112
+ };
113
+ const T = _ + a(!1) + y, x = b.selectionIndicator + k + y;
114
+ return f >= Math.max(T, x) ? {
115
+ mode: "selection-split",
116
+ filterIconOnly: f < _ + a(!0) + y,
117
+ trailingIconOnly: !0
118
+ } : {
119
+ mode: "compact",
120
+ filterIconOnly: !0,
121
+ trailingIconOnly: !0
122
+ };
123
+ }
124
+ const N = (a) => f >= _ + A(a) + M + y, X = [
125
+ {
126
+ filterIconOnly: !1,
127
+ trailingIconOnly: !1,
128
+ pageActionsWidthPx: P
129
+ },
130
+ {
131
+ filterIconOnly: !1,
132
+ trailingIconOnly: !0,
133
+ pageActionsWidthPx: P
134
+ },
135
+ {
136
+ filterIconOnly: !1,
137
+ trailingIconOnly: !0,
138
+ pageActionsWidthPx: L
139
+ },
140
+ {
141
+ filterIconOnly: !0,
142
+ trailingIconOnly: !0,
143
+ pageActionsWidthPx: L
144
+ }
145
+ ];
146
+ for (const a of X) if (N(a)) return {
147
+ mode: "inline",
148
+ filterIconOnly: a.filterIconOnly,
149
+ trailingIconOnly: a.trailingIconOnly
150
+ };
151
+ return f >= A({
152
+ filterIconOnly: !1,
153
+ trailingIconOnly: !1,
154
+ pageActionsWidthPx: P,
155
+ searchBeforeFilter: !0
156
+ }) ? {
157
+ mode: "stacked",
158
+ filterIconOnly: !1,
159
+ trailingIconOnly: !1
160
+ } : f >= A({
161
+ filterIconOnly: !0,
162
+ trailingIconOnly: !0,
163
+ pageActionsWidthPx: L,
164
+ searchBeforeFilter: !0
165
+ }) ? {
166
+ mode: "stacked",
167
+ filterIconOnly: !0,
168
+ trailingIconOnly: !0
169
+ } : {
170
+ mode: "compact",
171
+ filterIconOnly: !0,
172
+ trailingIconOnly: !0
173
+ };
174
+ }
175
+ function nt(t) {
176
+ const { layoutMode: i, containerWidth: e, titleWidth: n, filterIconOnly: r, trailingIconOnly: c, hasFilter: s, hasSearch: u, hasLeadingUtility: h, hasTrailingUtility: I, reserveBulkActionsWidthPx: O, measured: W } = t, g = m(W), d = (h ? g.leading + l : 0) + (s ? g.filter(r) + l : 0) + (u ? g.search + l : 0) + (I ? g.trailing(c) + l : 0);
177
+ return i === "stacked" || i === "compact" ? Math.max(80, e - d) : Math.max(80, e - n - d - y - O);
178
+ }
179
+ function et(t) {
180
+ const { layoutMode: i, containerWidth: e, titleWidth: n, filterIconOnly: r, hasFilter: c, hasSearch: s, measured: u } = t, h = m(u), I = (c ? h.filter(r) + l : 0) + (s ? h.search + l : 0);
181
+ return i === "inline" ? Math.max(120, e - n - h.selectionIndicator - I - y * 2) : Math.max(120, e - h.selectionIndicator - y);
182
+ }
183
+ export {
184
+ et as resolveBulkActionsAvailableWidth,
185
+ nt as resolvePageActionsAvailableWidth,
186
+ tt as resolveReserveBulkActionsWidthPx,
187
+ Q as resolveTitleAreaWidth,
188
+ it as resolveToolbarLayout
189
+ };
@@ -0,0 +1,130 @@
1
+ var y = 8, C = 40, I = 40, P = 42, W = 22, m = 7, _ = 26, b = 0.55;
2
+ function T(t, e) {
3
+ if (t.estimatedWidthPx) return e ? t.estimatedWidthPx : Math.max(I, Math.floor(t.estimatedWidthPx * b));
4
+ const n = t.icon ? W : 0, i = e ? Math.max(_, t.label.length * m) : 0;
5
+ return P + n + i;
6
+ }
7
+ function A(t, e, n) {
8
+ return n?.(t, e) ?? T(t, e);
9
+ }
10
+ function p(t) {
11
+ return t.length ? t.reduce((e, n) => e + n.width, 0) + (t.length - 1) * 8 : 0;
12
+ }
13
+ function g(t, e, n) {
14
+ const i = p(t);
15
+ return e ? i + (t.length ? 8 : 0) + n : i;
16
+ }
17
+ function w(t) {
18
+ return t.filter((e) => !e.hidden).sort((e, n) => (n.priority ?? 0) - (e.priority ?? 0));
19
+ }
20
+ function x(t) {
21
+ return [...t].sort((e, n) => (n.priority ?? 0) - (e.priority ?? 0));
22
+ }
23
+ function N(t, e, n) {
24
+ const i = [...t];
25
+ for (let s = i.length - 1; s >= 0 && p(i) > e; s -= 1) {
26
+ const r = i[s];
27
+ !r || !r.showLabel || r.action.canHideLabel === !1 || (i[s] = {
28
+ ...r,
29
+ showLabel: !1,
30
+ width: A(r.action, !1, n)
31
+ });
32
+ }
33
+ return i;
34
+ }
35
+ function O(t) {
36
+ const { planned: e, availableWidth: n, preOverflow: i, moreButtonWidthPx: s, ignoreKeepVisible: r = !1 } = t, o = [...e], l = [], h = () => {
37
+ let d = -1, c = Number.POSITIVE_INFINITY;
38
+ for (let u = o.length - 1; u >= 0; u -= 1) {
39
+ const v = o[u];
40
+ if (!v || !r && (v.action.keepVisible || v.action.canOverflow === !1)) continue;
41
+ const f = v.action.priority ?? 0;
42
+ f < c && (c = f, d = u);
43
+ }
44
+ return d;
45
+ }, a = () => i.length > 0 || l.length > 0;
46
+ for (; o.length && g(o, a(), s) > n; ) {
47
+ const d = h();
48
+ if (d < 0) break;
49
+ const [c] = o.splice(d, 1);
50
+ c && l.unshift(c.action);
51
+ }
52
+ return {
53
+ inlineActions: o,
54
+ overflowActions: x([...i, ...l])
55
+ };
56
+ }
57
+ function M(t) {
58
+ const { inlineActions: e, overflowActions: n, availableWidth: i, resolveActionWidth: s, allowIconOnlyPromotion: r = !0 } = t, o = n.length === 1 ? n[0] : void 0;
59
+ if (o) {
60
+ const l = (a) => ({
61
+ inlineActions: [...e, {
62
+ action: o,
63
+ showLabel: a,
64
+ width: A(o, a, s)
65
+ }],
66
+ overflowActions: [],
67
+ showMoreMenu: !1
68
+ }), h = (a) => p(l(a).inlineActions) <= i;
69
+ if (h(!0)) return l(!0);
70
+ if (r && o.canHideLabel !== !1 && h(!1)) return l(!1);
71
+ }
72
+ return {
73
+ inlineActions: e,
74
+ overflowActions: n,
75
+ showMoreMenu: n.length >= 1
76
+ };
77
+ }
78
+ function B(t) {
79
+ const { actions: e, availableWidth: n, maxInlineActions: i, collapseLabels: s = !0, resolveActionWidth: r, moreButtonWidthPx: o = 40 } = t, l = w(e), h = i ? l.slice(0, i) : l, a = i ? l.slice(i) : [], d = new Set(h.map((f) => f.id));
80
+ let c = e.filter((f) => !f.hidden && d.has(f.id)).map((f) => ({
81
+ action: f,
82
+ showLabel: !0,
83
+ width: A(f, !0, r)
84
+ }));
85
+ s && (c = N(c, n, r));
86
+ const { inlineActions: u, overflowActions: v } = O({
87
+ planned: c,
88
+ availableWidth: n,
89
+ preOverflow: a,
90
+ moreButtonWidthPx: o
91
+ });
92
+ return M({
93
+ inlineActions: u,
94
+ overflowActions: v,
95
+ availableWidth: n,
96
+ resolveActionWidth: r
97
+ });
98
+ }
99
+ function X(t) {
100
+ const { actions: e, availableWidth: n, maxVisibleBulkActions: i = 3, resolveActionWidth: s, moreButtonWidthPx: r = 40 } = t, o = w(e);
101
+ if (o.length === 0) return {
102
+ inlineActions: [],
103
+ overflowActions: [],
104
+ showMoreMenu: !1
105
+ };
106
+ const l = o.slice(0, i), h = o.slice(i), { inlineActions: a, overflowActions: d } = O({
107
+ planned: l.map((c) => ({
108
+ action: c,
109
+ showLabel: !0,
110
+ width: A(c, !0, s)
111
+ })),
112
+ availableWidth: n,
113
+ preOverflow: h,
114
+ moreButtonWidthPx: r,
115
+ ignoreKeepVisible: !0
116
+ });
117
+ return {
118
+ inlineActions: a,
119
+ overflowActions: d,
120
+ showMoreMenu: d.length >= 1
121
+ };
122
+ }
123
+ export {
124
+ y as ACTION_GAP_PX,
125
+ C as MORE_BUTTON_PX,
126
+ T as estimateToolbarActionWidth,
127
+ X as planBulkToolbarActions,
128
+ B as planToolbarActions,
129
+ A as resolveToolbarActionWidth
130
+ };
@@ -0,0 +1,23 @@
1
+ import { useMemo as t } from "react";
2
+ var r = {
3
+ en: {
4
+ more: "More",
5
+ clearSelection: "Clear selection",
6
+ selected: "selected"
7
+ },
8
+ no: {
9
+ more: "Mer",
10
+ clearSelection: "Fjern valg",
11
+ selected: "valgt"
12
+ }
13
+ };
14
+ function l(e = "en") {
15
+ return t(() => r[e] ?? r.en, [e]);
16
+ }
17
+ function a(e, n) {
18
+ return `${e} ${n.selected}`;
19
+ }
20
+ export {
21
+ a as formatSelectionLabel,
22
+ l as useToolbarTranslations
23
+ };
@@ -1,15 +1,18 @@
1
- import { cn as m } from "../../../../helpers/cn.js";
2
- import { StyledWidgetTitle as l } from "../widget-title/StyledWidgetTitle.js";
3
- import o from "./StyledWidgetHeader.module.js";
1
+ import { cn as l } from "../../../../helpers/cn.js";
2
+ import { StyledWidgetTitle as o } from "../widget-title/StyledWidgetTitle.js";
3
+ import a from "./StyledWidgetHeader.module.js";
4
4
  import "react";
5
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
6
- var h = ({ actions: r, title: d, containerClassname: t, actionsClassname: i }) => /* @__PURE__ */ a("div", {
7
- className: m(o["styled-widget-header"], t),
8
- children: [/* @__PURE__ */ e(l, { children: d }), /* @__PURE__ */ e("div", {
9
- className: i,
10
- children: r
11
- })]
12
- });
5
+ import { jsx as t, jsxs as s } from "react/jsx-runtime";
6
+ var g = ({ actions: d, title: e, containerClassname: i, actionsClassname: m }) => {
7
+ const r = e != null && e !== "";
8
+ return /* @__PURE__ */ s("div", {
9
+ className: l(a["styled-widget-header"], i, !r && d && "!block"),
10
+ children: [r && /* @__PURE__ */ t(o, { children: e }), /* @__PURE__ */ t("div", {
11
+ className: l(m, !r && "w-full"),
12
+ children: d
13
+ })]
14
+ });
15
+ };
13
16
  export {
14
- h as StyledWidgetHeader
17
+ g as StyledWidgetHeader
15
18
  };
@@ -1,21 +1,25 @@
1
- import { FilterIcon as m } from "../../icons/filter-icon/FilterIcon.js";
2
- import { StyledButton as n } from "../../inputs/button/StyledButton.js";
3
- import d from "clsx";
1
+ import { FilterIcon as d } from "../../icons/filter-icon/FilterIcon.js";
2
+ import { StyledButton as m } from "../../inputs/button/StyledButton.js";
3
+ import { useDynamicToolbarLayout as c } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
4
+ import s from "clsx";
4
5
  import { Fragment as g, jsx as r, jsxs as h } from "react/jsx-runtime";
5
- var u = ({ filterIsActive: e, label: l, hideLabel: o = !1, size: t = "large", variant: i = "outlined", ...a }) => /* @__PURE__ */ r(g, { children: /* @__PURE__ */ h("div", {
6
- className: "relative h-fit w-fit",
7
- children: [/* @__PURE__ */ r(n, {
8
- ...a,
9
- type: "button",
10
- startIcon: /* @__PURE__ */ r(m, {
11
- width: t === "large" ? 24 : 20,
12
- height: t === "large" ? 24 : 20
13
- }),
14
- variant: i,
15
- size: t,
16
- children: !o && (l ?? "Filter")
17
- }), e && /* @__PURE__ */ r("div", { className: d("absolute h-2 w-2 rounded-full bg-gama-400", t === "large" ? "right-2 top-2" : "right-1 top-1") })]
18
- }) });
6
+ var x = ({ filterIsActive: e, label: o, hideLabel: l, size: t = "large", variant: i = "outlined", ...a }) => {
7
+ const { filterIconOnly: n } = c();
8
+ return /* @__PURE__ */ r(g, { children: /* @__PURE__ */ h("div", {
9
+ className: "relative h-fit w-fit",
10
+ children: [/* @__PURE__ */ r(m, {
11
+ ...a,
12
+ type: "button",
13
+ startIcon: /* @__PURE__ */ r(d, {
14
+ width: t === "large" ? 24 : 20,
15
+ height: t === "large" ? 24 : 20
16
+ }),
17
+ variant: i,
18
+ size: t,
19
+ children: !(l ?? n) && (o ?? "Filter")
20
+ }), e && /* @__PURE__ */ r("div", { className: s("absolute h-2 w-2 rounded-full bg-gama-400", t === "large" ? "right-2 top-2" : "right-1 top-1") })]
21
+ }) });
22
+ };
19
23
  export {
20
- u as StyledFilterButton
24
+ x as StyledFilterButton
21
25
  };
@@ -1,11 +1,12 @@
1
- import { FilterIcon as p } from "../../icons/filter-icon/FilterIcon.js";
2
- import { StyledButton as A } from "../../inputs/button/StyledButton.js";
3
- import { StyledPopover as O } from "../popover/StyledPopover.js";
4
- import v from "clsx";
5
- import h, { useState as E } from "react";
6
- import { Fragment as b, jsx as e, jsxs as d } from "react/jsx-runtime";
7
- var k = () => {
8
- const [r, t] = E(null), c = (o) => {
1
+ import { FilterIcon as O } from "../../icons/filter-icon/FilterIcon.js";
2
+ import { StyledButton as b } from "../../inputs/button/StyledButton.js";
3
+ import { StyledPopover as v } from "../popover/StyledPopover.js";
4
+ import { useDynamicToolbarLayout as E } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
5
+ import k from "clsx";
6
+ import m, { useState as C } from "react";
7
+ import { Fragment as F, jsx as e, jsxs as g } from "react/jsx-runtime";
8
+ var x = () => {
9
+ const [r, t] = C(null), c = (o) => {
9
10
  t(() => o.currentTarget);
10
11
  }, l = () => {
11
12
  t(() => null);
@@ -17,28 +18,28 @@ var k = () => {
17
18
  r ? l() : c(o);
18
19
  }
19
20
  };
20
- }, C = (r) => h.isValidElement(r) || typeof r == "string" || typeof r == "number" || r === null || Array.isArray(r), I = ({ filterIsActive: r, popoverContent: t, dataTest: c, disabled: l, size: n = "large", variant: o = "outlined", popoverProps: a, anchorNode: m, label: f, hideLabel: y }) => {
21
- const { onAnchorClick: g, onClose: s, anchorEl: i } = k(), u = m?.({
21
+ }, N = (r) => m.isValidElement(r) || typeof r == "string" || typeof r == "number" || r === null || Array.isArray(r), V = ({ filterIsActive: r, popoverContent: t, dataTest: c, disabled: l, size: n = "large", variant: o = "outlined", popoverProps: a, anchorNode: h, label: f, hideLabel: y }) => {
22
+ const { onAnchorClick: u, onClose: s, anchorEl: i } = x(), { filterIconOnly: p } = E(), A = y ?? p, d = h?.({
22
23
  isOpen: !!i,
23
24
  onClose: s
24
25
  });
25
- return /* @__PURE__ */ d(b, { children: [/* @__PURE__ */ d("div", {
26
+ return /* @__PURE__ */ g(F, { children: [/* @__PURE__ */ g("div", {
26
27
  className: "relative h-fit w-fit",
27
- children: [m && h.isValidElement(u) ? h.cloneElement(u, { onClick: g }) : /* @__PURE__ */ e(A, {
28
+ children: [h && m.isValidElement(d) ? m.cloneElement(d, { onClick: u }) : /* @__PURE__ */ e(b, {
28
29
  type: "button",
29
30
  disabled: l,
30
31
  variant: o,
31
- startIcon: /* @__PURE__ */ e(p, {
32
+ startIcon: /* @__PURE__ */ e(O, {
32
33
  width: n === "large" ? 24 : 20,
33
34
  height: n === "large" ? 24 : 20
34
35
  }),
35
- onClick: g,
36
+ onClick: u,
36
37
  size: n,
37
38
  dataTest: c,
38
39
  "data-popover-open": !!i || void 0,
39
- children: !y && (f ?? "Filter")
40
- }), r && /* @__PURE__ */ e("div", { className: v("absolute h-2 w-2 rounded-full bg-gama-400", n === "large" ? "right-2 top-2" : "right-1 top-1") })]
41
- }), /* @__PURE__ */ e(O, {
40
+ children: !A && (f ?? "Filter")
41
+ }), r && /* @__PURE__ */ e("div", { className: k("absolute h-2 w-2 rounded-full bg-gama-400", n === "large" ? "right-2 top-2" : "right-1 top-1") })]
42
+ }), /* @__PURE__ */ e(v, {
42
43
  ...a,
43
44
  open: !!i,
44
45
  anchorEl: i,
@@ -52,12 +53,12 @@ var k = () => {
52
53
  horizontal: "right"
53
54
  },
54
55
  className: a?.className ?? "my-1",
55
- children: C(t) ? t : t({
56
+ children: N(t) ? t : t({
56
57
  isOpen: !!i,
57
58
  onClose: s
58
59
  })
59
60
  })] });
60
61
  };
61
62
  export {
62
- I as StyledFilterMenu
63
+ V as StyledFilterMenu
63
64
  };
@@ -2,23 +2,23 @@ import { StyledInputField as w } from "../../shared-components/StyledInputField.
2
2
  import { HelperText as y } from "./components/HelperText.js";
3
3
  import { ClockOutlineIcon as E } from "../../shared-components/ClockOutlineIcon.js";
4
4
  import { useEffect as R, useRef as v } from "react";
5
- import { jsx as r, jsxs as I } from "react/jsx-runtime";
5
+ import { jsx as o, jsxs as I } from "react/jsx-runtime";
6
6
  import { useMask as M } from "@react-input/mask";
7
7
  import "material-ui-popup-state/hooks";
8
8
  var S = (c) => {
9
- const { placeholder: f, disabled: i, inputClassName: h, dataTest: n, width: l, error: u, helperText: x, label: T, locale: k = "en", popupState: e, handleChange: C, isValidTime: s, isValidEndTime: p, localValue: b, title: m, readOnly: t } = c, g = M({
9
+ const { placeholder: f, disabled: r, inputClassName: h, dataTest: n, width: i, error: u, helperText: x, label: T, locale: k = "en", popupState: l, handleChange: C, isValidTime: s, isValidEndTime: p, localValue: b, title: m, readOnly: e } = c, g = M({
10
10
  mask: "xx:xx",
11
11
  replacement: { x: /\d/ },
12
12
  showMask: !1
13
13
  }), d = !s || !p || !!u, a = v(null);
14
14
  return R(() => {
15
- a.current && e.setAnchorEl(a.current);
16
- }, [e]), /* @__PURE__ */ I("div", {
17
- style: { height: t ? "40px" : "75px" },
18
- children: [m && /* @__PURE__ */ r("div", {
15
+ a.current && l.setAnchorEl(a.current);
16
+ }, []), /* @__PURE__ */ I("div", {
17
+ style: { height: e ? "40px" : "75px" },
18
+ children: [m && /* @__PURE__ */ o("div", {
19
19
  className: "pb-1 font-roboto font-semibold text-delta-800",
20
20
  children: m
21
- }), /* @__PURE__ */ r(w, {
21
+ }), /* @__PURE__ */ o(w, {
22
22
  inputRef: g,
23
23
  autoComplete: "off",
24
24
  type: "text",
@@ -27,7 +27,7 @@ var S = (c) => {
27
27
  placeholder: f,
28
28
  size: "small",
29
29
  error: d,
30
- helperText: /* @__PURE__ */ r(y, {
30
+ helperText: /* @__PURE__ */ o(y, {
31
31
  isValidTime: s,
32
32
  isValidEndTime: p,
33
33
  error: d,
@@ -37,25 +37,25 @@ var S = (c) => {
37
37
  onChange: C,
38
38
  slotProps: { input: {
39
39
  ref: a,
40
- onMouseDown: (o) => {
41
- !i && !t && e.open(o);
40
+ onMouseDown: (t) => {
41
+ !r && !e && l.open(t);
42
42
  },
43
- endAdornment: /* @__PURE__ */ r(E, {
43
+ endAdornment: /* @__PURE__ */ o(E, {
44
44
  width: 24,
45
45
  height: 24,
46
- onClick: (o) => {
47
- o.stopPropagation(), !i && !t && e.open(o);
46
+ onClick: (t) => {
47
+ t.stopPropagation(), !r && !e && l.open(t);
48
48
  }
49
49
  })
50
50
  } },
51
51
  value: b,
52
52
  sx: {
53
- maxWidth: l ?? 130,
54
- width: l,
55
- minWidth: l
53
+ maxWidth: i ?? 130,
54
+ width: i,
55
+ minWidth: i
56
56
  },
57
- disabled: i,
58
- readOnly: t,
57
+ disabled: r,
58
+ readOnly: e,
59
59
  className: h,
60
60
  label: T
61
61
  })]
@@ -0,0 +1,26 @@
1
+ import { useLayoutEffect as a, useRef as d, useState as l } from "react";
2
+ function h() {
3
+ const n = d(null), [s, m] = l(0);
4
+ return a(() => {
5
+ const e = n.current;
6
+ if (!e) return;
7
+ let t = 0;
8
+ const r = () => {
9
+ const c = Math.round(e.getBoundingClientRect().width);
10
+ m((i) => i === c ? i : c);
11
+ }, u = () => {
12
+ cancelAnimationFrame(t), t = requestAnimationFrame(r);
13
+ };
14
+ r();
15
+ const o = new ResizeObserver(u);
16
+ return o.observe(e), () => {
17
+ cancelAnimationFrame(t), o.disconnect();
18
+ };
19
+ }, []), {
20
+ ref: n,
21
+ widthPx: s
22
+ };
23
+ }
24
+ export {
25
+ h as useElementWidthPx
26
+ };
@@ -0,0 +1,37 @@
1
+ import { useCallback as g, useEffect as m, useRef as i, useState as p } from "react";
2
+ function M() {
3
+ const [h, R] = p({}), s = i(/* @__PURE__ */ new Map()), f = i(/* @__PURE__ */ new Map()), b = i(/* @__PURE__ */ new Map()), o = i(null), u = g((e) => {
4
+ const t = s.current.get(e);
5
+ if (!t) return;
6
+ const r = t.mode === "scroll" ? t.element.scrollWidth : t.element.getBoundingClientRect().width, c = Math.ceil(r);
7
+ R((n) => n[e] === c ? n : {
8
+ ...n,
9
+ [e]: c
10
+ });
11
+ }, []), a = g(() => (o.current ??= new ResizeObserver((e) => {
12
+ for (const { target: t } of e) {
13
+ const r = f.current.get(t);
14
+ r && u(r);
15
+ }
16
+ }), o.current), [u]), w = g((e, t = "box") => {
17
+ const r = `${e}|${t}`, c = b.current.get(r);
18
+ if (c) return c;
19
+ const n = (l) => {
20
+ const d = s.current.get(e);
21
+ d && (a().unobserve(d.element), f.current.delete(d.element), s.current.delete(e)), l && (s.current.set(e, {
22
+ element: l,
23
+ mode: t
24
+ }), f.current.set(l, e), a().observe(l), u(e));
25
+ };
26
+ return b.current.set(r, n), n;
27
+ }, [a, u]);
28
+ return m(() => () => {
29
+ o.current?.disconnect(), o.current = null;
30
+ }, []), {
31
+ register: w,
32
+ widths: h
33
+ };
34
+ }
35
+ export {
36
+ M as useWidthRegistry
37
+ };