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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/custom/module/header-layout/DynamicToolbar.js +245 -0
- package/dist/components/custom/module/header-layout/DynamicToolbarLayoutContext.js +13 -0
- package/dist/components/custom/module/header-layout/ToolbarActionGroup.js +82 -0
- package/dist/components/custom/module/header-layout/ToolbarMeasurement.js +56 -0
- package/dist/components/custom/module/header-layout/ToolbarRows.js +131 -0
- package/dist/components/custom/module/header-layout/estimateToolbarLayout.js +189 -0
- package/dist/components/custom/module/header-layout/planToolbarActions.js +130 -0
- package/dist/components/custom/module/header-layout/useTranslations.js +23 -0
- package/dist/components/custom/widget/widget-header/StyledWidgetHeader.js +15 -12
- package/dist/components/utils/filter-menu/StyledFilterButton.js +22 -18
- package/dist/components/utils/filter-menu/StyledFilterMenu.js +20 -19
- package/dist/datetime/components/time-picker/TimePickerInput.js +18 -18
- package/dist/hooks/useElementWidthPx.js +26 -0
- package/dist/hooks/useWidthRegistry.js +37 -0
- package/dist/index.js +184 -172
- package/dist/src/components/custom/module/header-layout/DynamicToolbar.d.ts +25 -0
- package/dist/src/components/custom/module/header-layout/DynamicToolbarLayoutContext.d.ts +7 -0
- package/dist/src/components/custom/module/header-layout/ToolbarActionGroup.d.ts +19 -0
- package/dist/src/components/custom/module/header-layout/ToolbarMeasurement.d.ts +27 -0
- package/dist/src/components/custom/module/header-layout/ToolbarRows.d.ts +65 -0
- package/dist/src/components/custom/module/header-layout/estimateToolbarLayout.d.ts +95 -0
- package/dist/src/components/custom/module/header-layout/index.d.ts +3 -0
- package/dist/src/components/custom/module/header-layout/planToolbarActions.d.ts +72 -0
- package/dist/src/components/custom/module/header-layout/useTranslations.d.ts +17 -0
- package/dist/src/components/utils/filter-menu/StyledFilterButton.d.ts +1 -0
- package/dist/src/components/utils/filter-menu/StyledFilterMenu.d.ts +1 -0
- package/dist/src/hooks/useElementWidthPx.d.ts +10 -0
- package/dist/src/hooks/useWidthRegistry.d.ts +21 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { cn as le } from "../../../../helpers/cn.js";
|
|
2
|
+
import { useMobileMediaQuery as se } from "../../../../hooks/useMediaQuery.hook.js";
|
|
3
|
+
import { DynamicToolbarLayoutContext as ae } from "./DynamicToolbarLayoutContext.js";
|
|
4
|
+
import { useElementWidthPx as re } from "../../../../hooks/useElementWidthPx.js";
|
|
5
|
+
import { useWidthRegistry as ce } from "../../../../hooks/useWidthRegistry.js";
|
|
6
|
+
import { planBulkToolbarActions as de, planToolbarActions as me } from "./planToolbarActions.js";
|
|
7
|
+
import { resolveBulkActionsAvailableWidth as he, resolvePageActionsAvailableWidth as ue, resolveReserveBulkActionsWidthPx as fe, resolveTitleAreaWidth as Ae, resolveToolbarLayout as xe } from "./estimateToolbarLayout.js";
|
|
8
|
+
import { useToolbarTranslations as ve } from "./useTranslations.js";
|
|
9
|
+
import { SearchSlot as be, SelectionIndicator as pe, SelectionRow as we, TitleBlock as X, TitleText as Pe, UtilityCluster as H } from "./ToolbarRows.js";
|
|
10
|
+
import { KEY_MORE_BUTTON as Te, KEY_SEARCH as Q, KEY_SELECTION_INDICATOR as We, KEY_TITLE as $, ToolbarMeasurementStrip as Me, actionKey as ye, filterKey as N } from "./ToolbarMeasurement.js";
|
|
11
|
+
import { useCallback as Be, useMemo as o } from "react";
|
|
12
|
+
import { Fragment as q, jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
13
|
+
var ge = 744, Se = 0, _e = 3, ke = [
|
|
14
|
+
{
|
|
15
|
+
minWidth: 361,
|
|
16
|
+
maxVisible: 2
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
minWidth: 256,
|
|
20
|
+
maxVisible: 1
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
minWidth: 0,
|
|
24
|
+
maxVisible: 0
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
function Ie(B, n) {
|
|
28
|
+
const A = ke.find((x) => B >= x.minWidth);
|
|
29
|
+
return Math.min(A?.maxVisible ?? 0, n);
|
|
30
|
+
}
|
|
31
|
+
var z = {
|
|
32
|
+
inlineActions: [],
|
|
33
|
+
overflowActions: [],
|
|
34
|
+
showMoreMenu: !1
|
|
35
|
+
};
|
|
36
|
+
function Xe(B) {
|
|
37
|
+
const { title: n, helperText: A, beforeFilterActions: x = [], filter: v, search: a, afterSearchActions: E = [], selectedCount: T = 0, onClearSelection: g, bulkActions: r = [], maxVisibleBulkActions: L = _e, locale: G = "en", className: J, style: Z, dataTest: ee = "dynamic-toolbar" } = B, b = ve(G), { ref: te, widthPx: c } = re(), { register: W, widths: l } = ce(), R = se(), p = o(() => Ie(c, L), [c, L]), d = T > 0, C = !d, w = o(() => [...x, ...E], [x, E]), m = Be((e, i) => l[ye(e.id, i)], [l]), s = o(() => ({
|
|
38
|
+
titleWidthPx: l[$],
|
|
39
|
+
searchWidthPx: l[Q],
|
|
40
|
+
filterLabelWidthPx: l[N(!1)],
|
|
41
|
+
filterIconWidthPx: l[N(!0)],
|
|
42
|
+
selectionIndicatorWidthPx: l[We],
|
|
43
|
+
moreButtonWidthPx: l[Te],
|
|
44
|
+
actionWidthPx: m
|
|
45
|
+
}), [l, m]), S = o(() => fe(Se, r, m, p), [
|
|
46
|
+
r,
|
|
47
|
+
m,
|
|
48
|
+
p
|
|
49
|
+
]), { mode: u, filterIconOnly: P, trailingIconOnly: M } = o(() => xe({
|
|
50
|
+
containerWidth: c,
|
|
51
|
+
isMobile: R,
|
|
52
|
+
isSelectionMode: d,
|
|
53
|
+
compactBreakpointPx: ge,
|
|
54
|
+
reserveBulkActionsWidthPx: S,
|
|
55
|
+
title: n,
|
|
56
|
+
hasLeadingUtility: !1,
|
|
57
|
+
hasFilter: v != null,
|
|
58
|
+
hasSearch: a != null,
|
|
59
|
+
hasTrailingUtility: !1,
|
|
60
|
+
pageActions: w,
|
|
61
|
+
bulkActions: r,
|
|
62
|
+
maxVisibleBulkActions: p,
|
|
63
|
+
measured: s
|
|
64
|
+
}), [
|
|
65
|
+
r,
|
|
66
|
+
c,
|
|
67
|
+
S,
|
|
68
|
+
v,
|
|
69
|
+
R,
|
|
70
|
+
d,
|
|
71
|
+
p,
|
|
72
|
+
s,
|
|
73
|
+
w,
|
|
74
|
+
a,
|
|
75
|
+
n
|
|
76
|
+
]), ie = o(() => ({
|
|
77
|
+
containerWidth: c,
|
|
78
|
+
filterIconOnly: P,
|
|
79
|
+
trailingIconOnly: M
|
|
80
|
+
}), [
|
|
81
|
+
c,
|
|
82
|
+
P,
|
|
83
|
+
M
|
|
84
|
+
]), O = Ae(n, s.titleWidthPx), U = ue({
|
|
85
|
+
layoutMode: u,
|
|
86
|
+
containerWidth: c,
|
|
87
|
+
titleWidth: O,
|
|
88
|
+
filterIconOnly: P,
|
|
89
|
+
trailingIconOnly: M,
|
|
90
|
+
hasFilter: v != null,
|
|
91
|
+
hasSearch: a != null,
|
|
92
|
+
hasLeadingUtility: !1,
|
|
93
|
+
hasTrailingUtility: !1,
|
|
94
|
+
reserveBulkActionsWidthPx: d ? 0 : S,
|
|
95
|
+
measured: s
|
|
96
|
+
}), V = he({
|
|
97
|
+
layoutMode: u,
|
|
98
|
+
containerWidth: c,
|
|
99
|
+
titleWidth: O,
|
|
100
|
+
filterIconOnly: P,
|
|
101
|
+
hasFilter: v != null,
|
|
102
|
+
hasSearch: a != null,
|
|
103
|
+
measured: s
|
|
104
|
+
}), f = o(() => me({
|
|
105
|
+
actions: w,
|
|
106
|
+
availableWidth: U,
|
|
107
|
+
collapseLabels: !0,
|
|
108
|
+
resolveActionWidth: m,
|
|
109
|
+
moreButtonWidthPx: s.moreButtonWidthPx
|
|
110
|
+
}), [
|
|
111
|
+
w,
|
|
112
|
+
U,
|
|
113
|
+
m,
|
|
114
|
+
s.moreButtonWidthPx
|
|
115
|
+
]), y = o(() => new Set(x.map((e) => e.id)), [x]), F = o(() => {
|
|
116
|
+
const e = f.inlineActions.filter((i) => y.has(i.action.id));
|
|
117
|
+
return e.length ? {
|
|
118
|
+
inlineActions: e,
|
|
119
|
+
overflowActions: [],
|
|
120
|
+
showMoreMenu: !1
|
|
121
|
+
} : z;
|
|
122
|
+
}, [y, f]), K = o(() => {
|
|
123
|
+
const e = f.inlineActions.filter((i) => !y.has(i.action.id));
|
|
124
|
+
return !e.length && !f.showMoreMenu ? z : {
|
|
125
|
+
inlineActions: e,
|
|
126
|
+
overflowActions: f.overflowActions,
|
|
127
|
+
showMoreMenu: f.showMoreMenu
|
|
128
|
+
};
|
|
129
|
+
}, [y, f]), D = o(() => de({
|
|
130
|
+
actions: r,
|
|
131
|
+
availableWidth: V,
|
|
132
|
+
maxVisibleBulkActions: p,
|
|
133
|
+
resolveActionWidth: m,
|
|
134
|
+
moreButtonWidthPx: s.moreButtonWidthPx
|
|
135
|
+
}), [
|
|
136
|
+
r,
|
|
137
|
+
V,
|
|
138
|
+
p,
|
|
139
|
+
m,
|
|
140
|
+
s.moreButtonWidthPx
|
|
141
|
+
]), oe = o(() => {
|
|
142
|
+
const e = /* @__PURE__ */ new Map();
|
|
143
|
+
for (const i of [...w, ...r]) !i.hidden && !e.has(i.id) && e.set(i.id, i);
|
|
144
|
+
return [...e.values()];
|
|
145
|
+
}, [w, r]), _ = W($, "scroll"), Y = W(Q), k = v != null ? /* @__PURE__ */ t("span", {
|
|
146
|
+
ref: W(N(P)),
|
|
147
|
+
className: "inline-flex shrink-0 items-center",
|
|
148
|
+
children: v
|
|
149
|
+
}) : void 0, ne = /* @__PURE__ */ t(Me, {
|
|
150
|
+
actions: oe,
|
|
151
|
+
register: W,
|
|
152
|
+
overflowMenuLabel: b.more,
|
|
153
|
+
selectionIndicator: d ? {
|
|
154
|
+
selectedCount: T,
|
|
155
|
+
hasClear: g != null,
|
|
156
|
+
translations: b
|
|
157
|
+
} : void 0
|
|
158
|
+
}), j = /* @__PURE__ */ t(we, {
|
|
159
|
+
selectedCount: T,
|
|
160
|
+
onClearSelection: g,
|
|
161
|
+
translations: b,
|
|
162
|
+
bulkActionsPlan: D
|
|
163
|
+
}), I = (e, i) => /* @__PURE__ */ t(ae.Provider, {
|
|
164
|
+
value: ie,
|
|
165
|
+
children: /* @__PURE__ */ h("div", {
|
|
166
|
+
ref: te,
|
|
167
|
+
"data-testid": ee,
|
|
168
|
+
"data-layout": i,
|
|
169
|
+
"data-filter-icon-only": P ? "true" : "false",
|
|
170
|
+
"data-trailing-icon-only": M ? "true" : "false",
|
|
171
|
+
className: le("relative flex w-full flex-col gap-2", J),
|
|
172
|
+
style: Z,
|
|
173
|
+
children: [ne, e]
|
|
174
|
+
})
|
|
175
|
+
});
|
|
176
|
+
return u === "compact" || u === "stacked" ? I(/* @__PURE__ */ h(q, { children: [
|
|
177
|
+
/* @__PURE__ */ t(X, {
|
|
178
|
+
title: n,
|
|
179
|
+
helperText: A,
|
|
180
|
+
titleMeasureRef: _
|
|
181
|
+
}),
|
|
182
|
+
/* @__PURE__ */ t(H, {
|
|
183
|
+
variant: "utility-row",
|
|
184
|
+
beforeFilterActionsPlan: F,
|
|
185
|
+
filter: k,
|
|
186
|
+
search: a,
|
|
187
|
+
afterSearchActionsPlan: K,
|
|
188
|
+
showPageActions: C,
|
|
189
|
+
overflowMenuLabel: b.more,
|
|
190
|
+
align: u === "compact" ? "start" : "end"
|
|
191
|
+
}),
|
|
192
|
+
d && j
|
|
193
|
+
] }), u) : u === "selection-split" ? I(/* @__PURE__ */ h(q, { children: [/* @__PURE__ */ h("div", {
|
|
194
|
+
className: "flex w-full min-w-0 flex-nowrap items-center justify-between gap-3",
|
|
195
|
+
children: [/* @__PURE__ */ t("div", {
|
|
196
|
+
className: "min-w-0 flex-1 overflow-hidden",
|
|
197
|
+
children: /* @__PURE__ */ t(X, {
|
|
198
|
+
title: n,
|
|
199
|
+
helperText: A,
|
|
200
|
+
titleMeasureRef: _
|
|
201
|
+
})
|
|
202
|
+
}), /* @__PURE__ */ h("div", {
|
|
203
|
+
className: "flex shrink-0 flex-nowrap items-center gap-2",
|
|
204
|
+
children: [k, a != null && /* @__PURE__ */ t(be, {
|
|
205
|
+
search: a,
|
|
206
|
+
measureRef: Y
|
|
207
|
+
})]
|
|
208
|
+
})]
|
|
209
|
+
}), j] }), "selection-split") : I(/* @__PURE__ */ h("div", {
|
|
210
|
+
className: "flex w-full min-w-0 flex-col gap-1",
|
|
211
|
+
children: [/* @__PURE__ */ h("div", {
|
|
212
|
+
className: "flex w-full min-w-0 flex-nowrap items-center gap-3",
|
|
213
|
+
children: [/* @__PURE__ */ h("div", {
|
|
214
|
+
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
215
|
+
children: [n && /* @__PURE__ */ t(Pe, {
|
|
216
|
+
title: n,
|
|
217
|
+
measureRef: _
|
|
218
|
+
}), d && /* @__PURE__ */ t(pe, {
|
|
219
|
+
selectedCount: T,
|
|
220
|
+
onClearSelection: g,
|
|
221
|
+
translations: b
|
|
222
|
+
})]
|
|
223
|
+
}), /* @__PURE__ */ t("div", {
|
|
224
|
+
className: "min-w-0 shrink-0",
|
|
225
|
+
children: /* @__PURE__ */ t(H, {
|
|
226
|
+
variant: d ? "inline-selection" : "inline-normal",
|
|
227
|
+
beforeFilterActionsPlan: F,
|
|
228
|
+
filter: k,
|
|
229
|
+
search: a,
|
|
230
|
+
afterSearchActionsPlan: K,
|
|
231
|
+
bulkActionsPlan: D,
|
|
232
|
+
showPageActions: C,
|
|
233
|
+
overflowMenuLabel: b.more,
|
|
234
|
+
searchMeasureRef: Y
|
|
235
|
+
})
|
|
236
|
+
})]
|
|
237
|
+
}), A && /* @__PURE__ */ t("div", {
|
|
238
|
+
className: "text-sm text-delta-700",
|
|
239
|
+
children: A
|
|
240
|
+
})]
|
|
241
|
+
}), "inline");
|
|
242
|
+
}
|
|
243
|
+
export {
|
|
244
|
+
Xe as DynamicToolbar
|
|
245
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext as t, useContext as o } from "react";
|
|
2
|
+
var n = t({
|
|
3
|
+
containerWidth: 0,
|
|
4
|
+
filterIconOnly: !1,
|
|
5
|
+
trailingIconOnly: !1
|
|
6
|
+
});
|
|
7
|
+
function a() {
|
|
8
|
+
return o(n);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
n as DynamicToolbarLayoutContext,
|
|
12
|
+
a as useDynamicToolbarLayout
|
|
13
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { cn as m } from "../../../../helpers/cn.js";
|
|
2
|
+
import { DotsVerticalIcon as p } from "../../../icons/dots-vertical-icon/DotsVerticalIcon.js";
|
|
3
|
+
import { StyledButton as u } from "../../../inputs/button/StyledButton.js";
|
|
4
|
+
import { StyledMenu as g } from "../../../navigation/menu/StyledMenu.js";
|
|
5
|
+
import { StyledMenuItem as b } from "../../../navigation/menu/StyledMenuItem.js";
|
|
6
|
+
import { useState as v } from "react";
|
|
7
|
+
import { Fragment as x, jsx as n, jsxs as a } from "react/jsx-runtime";
|
|
8
|
+
function S(e) {
|
|
9
|
+
return e != null && (e.inlineActions.length > 0 || e.showMoreMenu);
|
|
10
|
+
}
|
|
11
|
+
function A({ action: e, showLabel: t, selectionTone: l = !1 }) {
|
|
12
|
+
if (e.render) return e.render({ showLabel: t });
|
|
13
|
+
const o = e.ariaLabel ?? e.label;
|
|
14
|
+
return /* @__PURE__ */ n(u, {
|
|
15
|
+
dataTest: e.dataTest ?? `dynamic-toolbar-action-${e.id}`,
|
|
16
|
+
variant: e.variant ?? (l ? "text" : "outlined"),
|
|
17
|
+
error: e.tone === "danger",
|
|
18
|
+
size: e.size ?? "small",
|
|
19
|
+
disabled: e.disabled,
|
|
20
|
+
startIcon: e.icon,
|
|
21
|
+
onClick: e.onClick,
|
|
22
|
+
"aria-label": t ? void 0 : o,
|
|
23
|
+
children: t ? e.label : void 0
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function T({ overflowMenuLabel: e, onOpen: t }) {
|
|
27
|
+
return /* @__PURE__ */ n(u, {
|
|
28
|
+
dataTest: "dynamic-toolbar-overflow-actions",
|
|
29
|
+
variant: "text",
|
|
30
|
+
size: "small",
|
|
31
|
+
endIcon: /* @__PURE__ */ n(p, {
|
|
32
|
+
width: 20,
|
|
33
|
+
height: 20
|
|
34
|
+
}),
|
|
35
|
+
onClick: (l) => t?.(l.currentTarget),
|
|
36
|
+
"aria-label": e,
|
|
37
|
+
"aria-haspopup": "menu",
|
|
38
|
+
children: e
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function w({ plan: e, overflowMenuLabel: t, className: l, selectionTone: o = !1 }) {
|
|
42
|
+
const [s, i] = v(null), { inlineActions: d, overflowActions: h, showMoreMenu: c } = e;
|
|
43
|
+
return !d.length && !c ? null : /* @__PURE__ */ a("div", {
|
|
44
|
+
className: m("flex shrink-0 flex-nowrap items-center gap-2", l),
|
|
45
|
+
children: [d.map(({ action: r, showLabel: f }) => /* @__PURE__ */ n(A, {
|
|
46
|
+
action: r,
|
|
47
|
+
showLabel: f,
|
|
48
|
+
selectionTone: o
|
|
49
|
+
}, r.id)), c && /* @__PURE__ */ a(x, { children: [/* @__PURE__ */ n(T, {
|
|
50
|
+
overflowMenuLabel: t,
|
|
51
|
+
onOpen: i
|
|
52
|
+
}), /* @__PURE__ */ n(g, {
|
|
53
|
+
anchorEl: s,
|
|
54
|
+
open: !!s,
|
|
55
|
+
onClose: () => i(null),
|
|
56
|
+
anchorOrigin: {
|
|
57
|
+
vertical: "bottom",
|
|
58
|
+
horizontal: "right"
|
|
59
|
+
},
|
|
60
|
+
transformOrigin: {
|
|
61
|
+
vertical: "top",
|
|
62
|
+
horizontal: "right"
|
|
63
|
+
},
|
|
64
|
+
children: h.map((r) => /* @__PURE__ */ n(b, {
|
|
65
|
+
disabled: r.disabled,
|
|
66
|
+
onClick: () => {
|
|
67
|
+
i(null), r.onClick();
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ a("div", {
|
|
70
|
+
className: m("flex items-center gap-2", r.tone === "danger" ? "text-beta-500" : "text-delta-700"),
|
|
71
|
+
children: [r.icon, /* @__PURE__ */ n("span", { children: r.label })]
|
|
72
|
+
})
|
|
73
|
+
}, r.id))
|
|
74
|
+
})] })]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
T as MoreTriggerButton,
|
|
79
|
+
A as ToolbarActionButton,
|
|
80
|
+
w as ToolbarActionGroup,
|
|
81
|
+
S as hasPlannedActions
|
|
82
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { MoreTriggerButton as c, ToolbarActionButton as a } from "./ToolbarActionGroup.js";
|
|
2
|
+
import { SelectionIndicator as d } from "./ToolbarRows.js";
|
|
3
|
+
import { Fragment as f } from "react";
|
|
4
|
+
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
var N = "title", T = "slot:search", b = "selection-indicator", h = "more-button", w = (n) => `slot:filter:${n ? "icon" : "label"}`, s = (n, r) => `action:${n}:${r ? "label" : "icon"}`, m = { inert: "" };
|
|
6
|
+
function x({ actions: n, register: r, overflowMenuLabel: t, selectionIndicator: l }) {
|
|
7
|
+
return /* @__PURE__ */ e("div", {
|
|
8
|
+
"aria-hidden": !0,
|
|
9
|
+
...m,
|
|
10
|
+
className: "pointer-events-none invisible absolute left-0 top-0 h-0 overflow-hidden",
|
|
11
|
+
children: /* @__PURE__ */ o("div", {
|
|
12
|
+
className: "flex h-0 flex-nowrap items-center overflow-hidden",
|
|
13
|
+
children: [
|
|
14
|
+
n.map((i) => /* @__PURE__ */ o(f, { children: [/* @__PURE__ */ e("span", {
|
|
15
|
+
ref: r(s(i.id, !0)),
|
|
16
|
+
className: "inline-flex shrink-0 whitespace-nowrap",
|
|
17
|
+
children: /* @__PURE__ */ e(a, {
|
|
18
|
+
action: i,
|
|
19
|
+
showLabel: !0
|
|
20
|
+
})
|
|
21
|
+
}), /* @__PURE__ */ e("span", {
|
|
22
|
+
ref: r(s(i.id, !1)),
|
|
23
|
+
className: "inline-flex shrink-0",
|
|
24
|
+
children: /* @__PURE__ */ e(a, {
|
|
25
|
+
action: i,
|
|
26
|
+
showLabel: !1
|
|
27
|
+
})
|
|
28
|
+
})] }, i.id)),
|
|
29
|
+
/* @__PURE__ */ e("span", {
|
|
30
|
+
ref: r(h),
|
|
31
|
+
className: "inline-flex shrink-0",
|
|
32
|
+
children: /* @__PURE__ */ e(c, { overflowMenuLabel: t })
|
|
33
|
+
}),
|
|
34
|
+
l && /* @__PURE__ */ e("span", {
|
|
35
|
+
ref: r("selection-indicator"),
|
|
36
|
+
className: "inline-flex shrink-0 whitespace-nowrap",
|
|
37
|
+
children: /* @__PURE__ */ e(d, {
|
|
38
|
+
selectedCount: l.selectedCount,
|
|
39
|
+
onClearSelection: l.hasClear ? () => {
|
|
40
|
+
} : void 0,
|
|
41
|
+
translations: l.translations
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
h as KEY_MORE_BUTTON,
|
|
50
|
+
T as KEY_SEARCH,
|
|
51
|
+
b as KEY_SELECTION_INDICATOR,
|
|
52
|
+
N as KEY_TITLE,
|
|
53
|
+
x as ToolbarMeasurementStrip,
|
|
54
|
+
s as actionKey,
|
|
55
|
+
w as filterKey
|
|
56
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { cn as f } from "../../../../helpers/cn.js";
|
|
2
|
+
import { CloseIcon as g } from "../../../icons/close-icon/CloseIcon.js";
|
|
3
|
+
import { StyledButton as j } from "../../../inputs/button/StyledButton.js";
|
|
4
|
+
import { ToolbarActionGroup as c, hasPlannedActions as u } from "./ToolbarActionGroup.js";
|
|
5
|
+
import { formatSelectionLabel as k } from "./useTranslations.js";
|
|
6
|
+
import { Fragment as o, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
7
|
+
function F({ selectedCount: e, onClearSelection: i, translations: t }) {
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
className: "flex shrink-0 items-center whitespace-nowrap",
|
|
10
|
+
"aria-live": "polite",
|
|
11
|
+
"aria-atomic": "true",
|
|
12
|
+
children: /* @__PURE__ */ n(j, {
|
|
13
|
+
dataTest: "dynamic-toolbar-clear-selection",
|
|
14
|
+
variant: "text",
|
|
15
|
+
size: "small",
|
|
16
|
+
className: "!min-w-0 !px-1 !font-semibold",
|
|
17
|
+
startIcon: i ? /* @__PURE__ */ n(g, {
|
|
18
|
+
width: 20,
|
|
19
|
+
height: 20
|
|
20
|
+
}) : void 0,
|
|
21
|
+
onClick: i,
|
|
22
|
+
"aria-label": t.clearSelection,
|
|
23
|
+
children: k(e, t)
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function G({ selectedCount: e, onClearSelection: i, translations: t, bulkActionsPlan: l }) {
|
|
28
|
+
return /* @__PURE__ */ r("div", {
|
|
29
|
+
className: "flex w-full min-w-0 flex-nowrap items-center justify-between gap-3",
|
|
30
|
+
children: [/* @__PURE__ */ n(F, {
|
|
31
|
+
selectedCount: e,
|
|
32
|
+
onClearSelection: i,
|
|
33
|
+
translations: t
|
|
34
|
+
}), /* @__PURE__ */ n(c, {
|
|
35
|
+
plan: l,
|
|
36
|
+
overflowMenuLabel: t.more,
|
|
37
|
+
selectionTone: !0
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function y({ search: e, expanded: i, measureRef: t }) {
|
|
42
|
+
return /* @__PURE__ */ n("div", {
|
|
43
|
+
ref: i ? void 0 : t,
|
|
44
|
+
className: f("[&_.MuiFormControl-root]:w-full", i ? "min-w-0 flex-1 [&_.MuiFormControl-root]:max-w-none" : "w-[min(240px,40vw)] max-w-[280px] shrink-0"),
|
|
45
|
+
children: e
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function S({ visible: e, children: i }) {
|
|
49
|
+
return /* @__PURE__ */ n("div", {
|
|
50
|
+
className: f("overflow-hidden whitespace-nowrap transition-[max-width,opacity] duration-200 ease-in-out", e ? "max-w-[2000px] opacity-100" : "pointer-events-none max-w-0 opacity-0"),
|
|
51
|
+
"aria-hidden": !e,
|
|
52
|
+
children: /* @__PURE__ */ n("div", {
|
|
53
|
+
className: "inline-flex items-center gap-2",
|
|
54
|
+
children: i
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function T({ title: e, measureRef: i }) {
|
|
59
|
+
return /* @__PURE__ */ n("div", {
|
|
60
|
+
ref: i,
|
|
61
|
+
className: "min-w-0 truncate text-2xl font-semibold text-delta-800",
|
|
62
|
+
children: e
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function M({ title: e, helperText: i, titleMeasureRef: t }) {
|
|
66
|
+
return !e && !i ? null : /* @__PURE__ */ r("div", {
|
|
67
|
+
className: "min-w-0 max-w-full",
|
|
68
|
+
children: [e && /* @__PURE__ */ n(T, {
|
|
69
|
+
title: e,
|
|
70
|
+
measureRef: t
|
|
71
|
+
}), i && /* @__PURE__ */ n("div", {
|
|
72
|
+
className: "mt-1 text-sm text-delta-700",
|
|
73
|
+
children: i
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function U({ variant: e, beforeFilterActionsPlan: i, filter: t, search: l, afterSearchActionsPlan: p, bulkActionsPlan: a, showPageActions: w, overflowMenuLabel: s, searchMeasureRef: B, align: b = "end" }) {
|
|
78
|
+
const m = w && u(i), d = w && u(p), x = e === "inline-selection" && u(a);
|
|
79
|
+
if (!(t != null || l != null) && !m && !d && !x) return null;
|
|
80
|
+
const h = m ? /* @__PURE__ */ n(S, {
|
|
81
|
+
visible: m,
|
|
82
|
+
children: /* @__PURE__ */ n(c, {
|
|
83
|
+
plan: i,
|
|
84
|
+
overflowMenuLabel: s
|
|
85
|
+
})
|
|
86
|
+
}) : null, v = d ? /* @__PURE__ */ n(S, {
|
|
87
|
+
visible: d,
|
|
88
|
+
children: /* @__PURE__ */ n("div", {
|
|
89
|
+
className: "flex flex-nowrap items-center gap-2",
|
|
90
|
+
children: /* @__PURE__ */ n(c, {
|
|
91
|
+
plan: p,
|
|
92
|
+
overflowMenuLabel: s
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
}) : null, N = /* @__PURE__ */ r(o, { children: [t, l != null && /* @__PURE__ */ n(y, {
|
|
96
|
+
search: l,
|
|
97
|
+
measureRef: B
|
|
98
|
+
})] });
|
|
99
|
+
return /* @__PURE__ */ r("div", {
|
|
100
|
+
className: f("flex w-full min-w-0 flex-nowrap items-center gap-2", b === "end" ? "justify-end" : "justify-start"),
|
|
101
|
+
children: [
|
|
102
|
+
e === "inline-selection" && /* @__PURE__ */ r(o, { children: [x && a && /* @__PURE__ */ n(c, {
|
|
103
|
+
plan: a,
|
|
104
|
+
overflowMenuLabel: s,
|
|
105
|
+
selectionTone: !0
|
|
106
|
+
}), N] }),
|
|
107
|
+
e === "inline-normal" && /* @__PURE__ */ r(o, { children: [
|
|
108
|
+
h,
|
|
109
|
+
N,
|
|
110
|
+
v
|
|
111
|
+
] }),
|
|
112
|
+
e === "utility-row" && /* @__PURE__ */ r(o, { children: [
|
|
113
|
+
h,
|
|
114
|
+
l != null && /* @__PURE__ */ n(y, {
|
|
115
|
+
search: l,
|
|
116
|
+
expanded: !0
|
|
117
|
+
}),
|
|
118
|
+
t,
|
|
119
|
+
v
|
|
120
|
+
] })
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
y as SearchSlot,
|
|
126
|
+
F as SelectionIndicator,
|
|
127
|
+
G as SelectionRow,
|
|
128
|
+
M as TitleBlock,
|
|
129
|
+
T as TitleText,
|
|
130
|
+
U as UtilityCluster
|
|
131
|
+
};
|