@fluidattacks/design 9.9.2 → 10.0.1
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/components/card/card-with-input/index.js +2 -3
- package/dist/components/filters/filters-menu/index.js +23 -24
- package/dist/components/filters/options-menu/options/index.js +37 -38
- package/dist/components/modal/footer/index.js +15 -14
- package/dist/components/modal/header/index.d.ts +1 -1
- package/dist/components/modal/header/index.js +58 -40
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/index.stories.d.ts +17 -5
- package/dist/components/modal/styles.js +22 -13
- package/dist/components/modal/types.d.ts +23 -3
- package/dist/components/slider/index.js +2 -3
- package/dist/components/table/styles.js +1 -1
- package/package.json +5 -5
|
@@ -12,7 +12,6 @@ import "react-dom";
|
|
|
12
12
|
import "../../typography/heading/index.js";
|
|
13
13
|
import "../../typography/span/index.js";
|
|
14
14
|
import "../../typography/text/index.js";
|
|
15
|
-
import "../../inputs/styles.js";
|
|
16
15
|
import "../../container/index.js";
|
|
17
16
|
import "../../icon-button/index.js";
|
|
18
17
|
import "../../../_virtual/dayjs.min.js";
|
|
@@ -21,7 +20,7 @@ import "../../layout/categories/buttons/index.js";
|
|
|
21
20
|
import { InputNumber as S } from "../../inputs/fields/number/index.js";
|
|
22
21
|
import "../../inputs/utils/action-button/index.js";
|
|
23
22
|
import "../../../node_modules/react-international-phone/dist/index.js";
|
|
24
|
-
const
|
|
23
|
+
const it = ({
|
|
25
24
|
control: u,
|
|
26
25
|
description: B,
|
|
27
26
|
disabled: t,
|
|
@@ -142,5 +141,5 @@ const pt = ({
|
|
|
142
141
|
);
|
|
143
142
|
};
|
|
144
143
|
export {
|
|
145
|
-
|
|
144
|
+
it as CardWithInput
|
|
146
145
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as a, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import I from "../../../_virtual/snakeCase.js";
|
|
3
|
-
import { forwardRef as O, useContext as $, useMemo as B, useCallback as
|
|
3
|
+
import { forwardRef as O, useContext as $, useMemo as B, useCallback as h, Fragment as L } from "react";
|
|
4
4
|
import { useTheme as R } from "styled-components";
|
|
5
5
|
import { FiltersContext as A } from "../context/index.js";
|
|
6
6
|
import { NoMatches as P } from "../search/no-matches/index.js";
|
|
@@ -15,7 +15,6 @@ import "react-dom";
|
|
|
15
15
|
import "../../typography/heading/index.js";
|
|
16
16
|
import "../../typography/span/index.js";
|
|
17
17
|
import { Text as M } from "../../typography/text/index.js";
|
|
18
|
-
import "../../inputs/styles.js";
|
|
19
18
|
import { Tag as K } from "../../tag/index.js";
|
|
20
19
|
import "../../../_virtual/dayjs.min.js";
|
|
21
20
|
import "../../icon-button/index.js";
|
|
@@ -27,8 +26,8 @@ import { parseTextFilterValue as U, parseCheckboxesFilterValue as X, parseInclud
|
|
|
27
26
|
const Z = (c, d) => {
|
|
28
27
|
if (d?.some((t) => t.type === "text") ?? !1)
|
|
29
28
|
return U(c ?? "").text ? "1" : "0";
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
29
|
+
const l = new Set(d?.map((t) => t.type) ?? []);
|
|
30
|
+
if (l.size === 1 && l.has("checkboxes"))
|
|
32
31
|
return X(
|
|
33
32
|
c ?? ""
|
|
34
33
|
).values.length.toString();
|
|
@@ -39,11 +38,11 @@ const Z = (c, d) => {
|
|
|
39
38
|
return (t.length + f.length).toString();
|
|
40
39
|
}
|
|
41
40
|
return (c ?? "").split(",").filter((t) => t && t !== "-").length.toString();
|
|
42
|
-
},
|
|
41
|
+
}, ke = O(function({
|
|
43
42
|
includeSearch: d = !1,
|
|
44
43
|
groupedFilters: g,
|
|
45
|
-
handleChangeId:
|
|
46
|
-
pinnedFilters:
|
|
44
|
+
handleChangeId: l,
|
|
45
|
+
pinnedFilters: p
|
|
47
46
|
}, b) {
|
|
48
47
|
const t = R(), {
|
|
49
48
|
id: f,
|
|
@@ -52,16 +51,16 @@ const Z = (c, d) => {
|
|
|
52
51
|
values: s,
|
|
53
52
|
updateSearch: v,
|
|
54
53
|
setValues: u
|
|
55
|
-
} = $(A), C = q(g, y), w = B(() => Object.values(s).filter(Boolean).length > 0, [s]), S =
|
|
54
|
+
} = $(A), C = q(g, y), w = B(() => Object.values(s).filter(Boolean).length > 0, [s]), S = p.length > 0, V = h(
|
|
56
55
|
(e) => () => {
|
|
57
|
-
|
|
56
|
+
l(e), v({ previousValue: s[e] ?? "" }), m({ searchFilter: "", searchGlobal: "" });
|
|
58
57
|
},
|
|
59
|
-
[
|
|
60
|
-
), j =
|
|
58
|
+
[l, v, m, s]
|
|
59
|
+
), j = h(() => {
|
|
61
60
|
u(
|
|
62
61
|
(e) => Object.keys(e).reduce((n, r) => ({ ...n, [r]: "" }), {})
|
|
63
|
-
),
|
|
64
|
-
}, [u,
|
|
62
|
+
), l("");
|
|
63
|
+
}, [u, l]), z = h(
|
|
65
64
|
(e) => {
|
|
66
65
|
m((n) => ({
|
|
67
66
|
...n,
|
|
@@ -69,7 +68,7 @@ const Z = (c, d) => {
|
|
|
69
68
|
}));
|
|
70
69
|
},
|
|
71
70
|
[m]
|
|
72
|
-
), E =
|
|
71
|
+
), E = h(
|
|
73
72
|
(e) => (n) => {
|
|
74
73
|
u((r) => ({ ...r, [e]: n }));
|
|
75
74
|
},
|
|
@@ -108,7 +107,7 @@ const Z = (c, d) => {
|
|
|
108
107
|
scroll: "y",
|
|
109
108
|
width: "100%",
|
|
110
109
|
children: [
|
|
111
|
-
S ? /* @__PURE__ */ o(k, { "data-testid": "menu-pinned", children:
|
|
110
|
+
S ? /* @__PURE__ */ o(k, { "data-testid": "menu-pinned", children: p.map((e) => {
|
|
112
111
|
const n = e.options?.[0]?.items?.map((r) => ({
|
|
113
112
|
name: r.label ?? r.value,
|
|
114
113
|
value: r.value
|
|
@@ -141,17 +140,17 @@ const Z = (c, d) => {
|
|
|
141
140
|
children: e
|
|
142
141
|
}
|
|
143
142
|
) : void 0,
|
|
144
|
-
n.map((
|
|
145
|
-
const G = s[
|
|
143
|
+
n.map((i) => {
|
|
144
|
+
const G = s[i.id], F = Z(
|
|
146
145
|
G,
|
|
147
|
-
|
|
146
|
+
i.options
|
|
148
147
|
);
|
|
149
148
|
return /* @__PURE__ */ o(L, { children: /* @__PURE__ */ a(
|
|
150
149
|
N,
|
|
151
150
|
{
|
|
152
151
|
as: "button",
|
|
153
|
-
"data-testid":
|
|
154
|
-
onClick: V(
|
|
152
|
+
"data-testid": i.id,
|
|
153
|
+
onClick: V(i.id),
|
|
155
154
|
children: [
|
|
156
155
|
/* @__PURE__ */ o(
|
|
157
156
|
T,
|
|
@@ -162,7 +161,7 @@ const Z = (c, d) => {
|
|
|
162
161
|
iconType: "fa-light"
|
|
163
162
|
}
|
|
164
163
|
),
|
|
165
|
-
|
|
164
|
+
i.label,
|
|
166
165
|
/* @__PURE__ */ a(
|
|
167
166
|
x,
|
|
168
167
|
{
|
|
@@ -171,7 +170,7 @@ const Z = (c, d) => {
|
|
|
171
170
|
gap: 0.5,
|
|
172
171
|
style: { marginLeft: "auto" },
|
|
173
172
|
children: [
|
|
174
|
-
f ===
|
|
173
|
+
f === i.id ? /* @__PURE__ */ o(
|
|
175
174
|
T,
|
|
176
175
|
{
|
|
177
176
|
icon: "chevron-right",
|
|
@@ -186,7 +185,7 @@ const Z = (c, d) => {
|
|
|
186
185
|
)
|
|
187
186
|
]
|
|
188
187
|
}
|
|
189
|
-
) },
|
|
188
|
+
) }, i.id);
|
|
190
189
|
})
|
|
191
190
|
]
|
|
192
191
|
},
|
|
@@ -198,5 +197,5 @@ const Z = (c, d) => {
|
|
|
198
197
|
] });
|
|
199
198
|
});
|
|
200
199
|
export {
|
|
201
|
-
|
|
200
|
+
ke as FiltersMenu
|
|
202
201
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, Fragment as q, jsxs as w } from "react/jsx-runtime";
|
|
2
2
|
import { useVirtualizer as H } from "../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
|
|
3
3
|
import J from "../../../../_virtual/dayjs.min.js";
|
|
4
4
|
import E from "../../../../_virtual/isNaN.js";
|
|
@@ -16,16 +16,15 @@ import "react-dom";
|
|
|
16
16
|
import "../../../typography/heading/index.js";
|
|
17
17
|
import { Span as ee } from "../../../typography/span/index.js";
|
|
18
18
|
import "../../../typography/text/index.js";
|
|
19
|
-
import "../../../inputs/styles.js";
|
|
20
19
|
import "../../../container/index.js";
|
|
21
20
|
import { Tag as te } from "../../../tag/index.js";
|
|
22
21
|
import "../../../icon-button/index.js";
|
|
23
22
|
import "../../../button/index.js";
|
|
24
23
|
import { InputDateRange as oe } from "../../../inputs/fields/date-range/index.js";
|
|
25
|
-
import { TextInput as
|
|
24
|
+
import { TextInput as ne } from "../../../inputs/fields/text-input/index.js";
|
|
26
25
|
import "../../../layout/categories/buttons/index.js";
|
|
27
26
|
import "../../../inputs/utils/action-button/index.js";
|
|
28
|
-
import { InputNumberRange as
|
|
27
|
+
import { InputNumberRange as re } from "../../../inputs/fields/number-range/index.js";
|
|
29
28
|
import "../../../../node_modules/react-international-phone/dist/index.js";
|
|
30
29
|
import { useDebouncedCallback as le } from "../../../../hooks/use-debounced-callback.js";
|
|
31
30
|
import { useMountEffect as ae } from "../../../../hooks/use-mount-effect.js";
|
|
@@ -37,11 +36,11 @@ const ce = ({
|
|
|
37
36
|
onTextValue: t,
|
|
38
37
|
checkboxLabel: s,
|
|
39
38
|
onCheckboxChange: e,
|
|
40
|
-
debounceMs:
|
|
39
|
+
debounceMs: n
|
|
41
40
|
}) => {
|
|
42
41
|
const { text: c, checked: f } = se(
|
|
43
42
|
l ?? ""
|
|
44
|
-
), [u, d] = T(c), [g, R] = T(c), h = Number.isFinite(
|
|
43
|
+
), [u, d] = T(c), [g, R] = T(c), h = Number.isFinite(n) && (n ?? 0) >= 0 ? Math.min(n ?? 0, 5e3) : 0, b = le(t, h);
|
|
45
44
|
c !== g && (R(c), d(c), b.cancel());
|
|
46
45
|
const k = p(
|
|
47
46
|
(x) => {
|
|
@@ -61,7 +60,7 @@ const ce = ({
|
|
|
61
60
|
width: "100%"
|
|
62
61
|
},
|
|
63
62
|
children: [
|
|
64
|
-
s ? /* @__PURE__ */
|
|
63
|
+
s ? /* @__PURE__ */ r(
|
|
65
64
|
O,
|
|
66
65
|
{
|
|
67
66
|
checked: f,
|
|
@@ -71,8 +70,8 @@ const ce = ({
|
|
|
71
70
|
value: "textCheck"
|
|
72
71
|
}
|
|
73
72
|
) : void 0,
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
73
|
+
/* @__PURE__ */ r(
|
|
74
|
+
ne,
|
|
76
75
|
{
|
|
77
76
|
name: i,
|
|
78
77
|
onChange: k,
|
|
@@ -91,12 +90,12 @@ const ce = ({
|
|
|
91
90
|
onTextValue: t,
|
|
92
91
|
checkboxLabel: s,
|
|
93
92
|
onCheckboxChange: e,
|
|
94
|
-
debounceMs:
|
|
95
|
-
}) => t === void 0 ? null : /* @__PURE__ */
|
|
93
|
+
debounceMs: n
|
|
94
|
+
}) => t === void 0 ? null : /* @__PURE__ */ r(
|
|
96
95
|
ce,
|
|
97
96
|
{
|
|
98
97
|
checkboxLabel: s,
|
|
99
|
-
debounceMs:
|
|
98
|
+
debounceMs: n,
|
|
100
99
|
filterValue: l,
|
|
101
100
|
id: i,
|
|
102
101
|
label: a,
|
|
@@ -111,7 +110,7 @@ const ce = ({
|
|
|
111
110
|
listRef: t,
|
|
112
111
|
ref: s,
|
|
113
112
|
scrollMargin: e,
|
|
114
|
-
totalSize:
|
|
113
|
+
totalSize: n,
|
|
115
114
|
onChange: c
|
|
116
115
|
}) => {
|
|
117
116
|
const f = new Set(
|
|
@@ -119,19 +118,19 @@ const ce = ({
|
|
|
119
118
|
);
|
|
120
119
|
return l.length > 0 ? (
|
|
121
120
|
// Positioning context for the absolute rows, and it reserves their height
|
|
122
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ r(
|
|
123
122
|
"div",
|
|
124
123
|
{
|
|
125
124
|
"data-testid": "options-virtual-list",
|
|
126
125
|
ref: t,
|
|
127
126
|
style: {
|
|
128
|
-
height: `${
|
|
127
|
+
height: `${n}px`,
|
|
129
128
|
position: "relative",
|
|
130
129
|
width: "100%"
|
|
131
130
|
},
|
|
132
131
|
children: l.map((u) => {
|
|
133
132
|
const d = i[u.index], g = f.has(d?.value);
|
|
134
|
-
return /* @__PURE__ */
|
|
133
|
+
return /* @__PURE__ */ r(
|
|
135
134
|
"div",
|
|
136
135
|
{
|
|
137
136
|
"data-index": u.index,
|
|
@@ -142,7 +141,7 @@ const ce = ({
|
|
|
142
141
|
left: 0,
|
|
143
142
|
width: "100%"
|
|
144
143
|
},
|
|
145
|
-
children: /* @__PURE__ */
|
|
144
|
+
children: /* @__PURE__ */ r(y, { "aria-selected": g, children: /* @__PURE__ */ r(
|
|
146
145
|
O,
|
|
147
146
|
{
|
|
148
147
|
checked: g,
|
|
@@ -158,7 +157,7 @@ const ce = ({
|
|
|
158
157
|
})
|
|
159
158
|
}
|
|
160
159
|
)
|
|
161
|
-
) : /* @__PURE__ */
|
|
160
|
+
) : /* @__PURE__ */ r(X, {});
|
|
162
161
|
},
|
|
163
162
|
combobox: ({
|
|
164
163
|
id: i,
|
|
@@ -166,14 +165,14 @@ const ce = ({
|
|
|
166
165
|
filterValue: a,
|
|
167
166
|
label: t,
|
|
168
167
|
onSelectChange: s
|
|
169
|
-
}) => /* @__PURE__ */
|
|
168
|
+
}) => /* @__PURE__ */ r(
|
|
170
169
|
Z,
|
|
171
170
|
{
|
|
172
171
|
items: l,
|
|
173
172
|
name: i,
|
|
174
173
|
onSelect: s,
|
|
175
174
|
placeholder: `Search ${t}`,
|
|
176
|
-
selected: a?.split(",").map((e) => e.trim()).find((e) => l.some((
|
|
175
|
+
selected: a?.split(",").map((e) => e.trim()).find((e) => l.some((n) => n.value === e)) ?? null
|
|
177
176
|
}
|
|
178
177
|
),
|
|
179
178
|
list: ({ items: i, filterValue: l, onListChange: a }) => i.map((t) => /* @__PURE__ */ w(
|
|
@@ -183,7 +182,7 @@ const ce = ({
|
|
|
183
182
|
as: "button",
|
|
184
183
|
onClick: a?.(t.value),
|
|
185
184
|
children: [
|
|
186
|
-
t.icon ? /* @__PURE__ */
|
|
185
|
+
t.icon ? /* @__PURE__ */ r(
|
|
187
186
|
z,
|
|
188
187
|
{
|
|
189
188
|
icon: t.icon,
|
|
@@ -192,7 +191,7 @@ const ce = ({
|
|
|
192
191
|
iconType: t.iconType ?? "fa-light"
|
|
193
192
|
}
|
|
194
193
|
) : void 0,
|
|
195
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ r(
|
|
196
195
|
ee,
|
|
197
196
|
{
|
|
198
197
|
color: L.palette.gray[800],
|
|
@@ -205,15 +204,15 @@ const ce = ({
|
|
|
205
204
|
children: t.label
|
|
206
205
|
}
|
|
207
206
|
),
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
t.count === void 0 ? void 0 : /* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ r("span", { className: "filter-item" }),
|
|
208
|
+
t.count === void 0 ? void 0 : /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r(
|
|
210
209
|
te,
|
|
211
210
|
{
|
|
212
211
|
tagLabel: t.count.toLocaleString("en-US"),
|
|
213
212
|
variant: "default"
|
|
214
213
|
}
|
|
215
214
|
) }),
|
|
216
|
-
l?.split(",").includes(t?.value) ? /* @__PURE__ */
|
|
215
|
+
l?.split(",").includes(t?.value) ? /* @__PURE__ */ r("div", { style: { marginLeft: "auto" }, children: /* @__PURE__ */ r(
|
|
217
216
|
z,
|
|
218
217
|
{
|
|
219
218
|
icon: "check",
|
|
@@ -232,8 +231,8 @@ const ce = ({
|
|
|
232
231
|
onRangeChange: a,
|
|
233
232
|
updateCalendarState: t
|
|
234
233
|
}) => {
|
|
235
|
-
const [s, e] = l?.split(",").filter((
|
|
236
|
-
return /* @__PURE__ */
|
|
234
|
+
const [s, e] = l?.split(",").filter((n) => J(n).isValid() || n === "-") ?? [];
|
|
235
|
+
return /* @__PURE__ */ r(y, { children: /* @__PURE__ */ r(
|
|
237
236
|
oe,
|
|
238
237
|
{
|
|
239
238
|
name: i,
|
|
@@ -259,9 +258,9 @@ const ce = ({
|
|
|
259
258
|
maxValue: t,
|
|
260
259
|
onRangeNumberChange: s
|
|
261
260
|
}) => {
|
|
262
|
-
const e = l?.split(",") ?? [],
|
|
263
|
-
return /* @__PURE__ */
|
|
264
|
-
|
|
261
|
+
const e = l?.split(",") ?? [], n = e[0]?.trim(), c = e[1]?.trim(), f = n && n !== "" && n !== "-" && !E(Number(n)) ? Number(n) : void 0, u = c && c !== "" && c !== "-" && !E(Number(c)) ? Number(c) : void 0;
|
|
262
|
+
return /* @__PURE__ */ r(y, { children: /* @__PURE__ */ r(
|
|
263
|
+
re,
|
|
265
264
|
{
|
|
266
265
|
name: i,
|
|
267
266
|
propsMax: {
|
|
@@ -284,7 +283,7 @@ const ce = ({
|
|
|
284
283
|
}
|
|
285
284
|
) });
|
|
286
285
|
}
|
|
287
|
-
},
|
|
286
|
+
}, Ge = ({
|
|
288
287
|
id: i,
|
|
289
288
|
filteredItems: l,
|
|
290
289
|
filterValue: a,
|
|
@@ -292,7 +291,7 @@ const ce = ({
|
|
|
292
291
|
option: s,
|
|
293
292
|
onChange: e
|
|
294
293
|
}) => {
|
|
295
|
-
const { type:
|
|
294
|
+
const { type: n, minValue: c, maxValue: f, checkboxLabel: u, debounceMs: d } = s ?? {}, g = n && me[n], {
|
|
296
295
|
calendarState: { updateCalendarState: R },
|
|
297
296
|
scrollState: h
|
|
298
297
|
} = K(W), b = p(() => 36, []), k = p(
|
|
@@ -333,9 +332,9 @@ const ce = ({
|
|
|
333
332
|
useFlushSync: !1
|
|
334
333
|
}), D = N.getVirtualItems(), F = p(
|
|
335
334
|
(o) => {
|
|
336
|
-
o.stopPropagation(), o.preventDefault(), e(o.target.value,
|
|
335
|
+
o.stopPropagation(), o.preventDefault(), e(o.target.value, n ?? "");
|
|
337
336
|
},
|
|
338
|
-
[e,
|
|
337
|
+
[e, n]
|
|
339
338
|
), P = p(
|
|
340
339
|
(o) => (m) => {
|
|
341
340
|
e(m, "dateRange", o);
|
|
@@ -363,11 +362,11 @@ const ce = ({
|
|
|
363
362
|
[e]
|
|
364
363
|
), G = p(
|
|
365
364
|
(o) => {
|
|
366
|
-
e(o,
|
|
365
|
+
e(o, n ?? "text");
|
|
367
366
|
},
|
|
368
|
-
[e,
|
|
367
|
+
[e, n]
|
|
369
368
|
), U = N.getTotalSize();
|
|
370
|
-
return /* @__PURE__ */
|
|
369
|
+
return /* @__PURE__ */ r(q, { children: g?.({
|
|
371
370
|
items: l,
|
|
372
371
|
label: t,
|
|
373
372
|
virtualItems: D,
|
|
@@ -392,6 +391,6 @@ const ce = ({
|
|
|
392
391
|
}) ?? null });
|
|
393
392
|
};
|
|
394
393
|
export {
|
|
395
|
-
|
|
394
|
+
Ge as Options,
|
|
396
395
|
ce as TextFilterRenderer
|
|
397
396
|
};
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { l as x } from "../../../_virtual/lodash.js";
|
|
3
|
-
import { useCallback as
|
|
3
|
+
import { useCallback as l } from "react";
|
|
4
4
|
import { Footer as C } from "../styles.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Container as
|
|
5
|
+
import { Button as s } from "../../button/index.js";
|
|
6
|
+
import { Container as f } from "../../container/index.js";
|
|
7
7
|
const w = ({
|
|
8
8
|
alert: p,
|
|
9
9
|
modalRef: a,
|
|
10
10
|
confirmButton: i = void 0,
|
|
11
11
|
cancelButton: r = void 0
|
|
12
12
|
}) => {
|
|
13
|
-
const { close: o } = a, h =
|
|
13
|
+
const { close: o } = a, h = l(() => {
|
|
14
14
|
r?.onClick && r.onClick(), o();
|
|
15
|
-
}, [r, o]),
|
|
15
|
+
}, [r, o]), m = l(() => {
|
|
16
16
|
i?.onClick && i.onClick(), o();
|
|
17
17
|
}, [i, o]);
|
|
18
18
|
return [i, r].some(
|
|
19
|
-
(
|
|
20
|
-
) ? /* @__PURE__ */
|
|
21
|
-
|
|
19
|
+
(t) => !x.isEmpty(t)
|
|
20
|
+
) ? /* @__PURE__ */ d(
|
|
21
|
+
f,
|
|
22
22
|
{
|
|
23
23
|
display: "flex",
|
|
24
24
|
flexDirection: "column",
|
|
25
25
|
gap: 0.625,
|
|
26
|
+
id: "modal-footer",
|
|
26
27
|
position: "sticky",
|
|
27
28
|
px: 1.25,
|
|
28
29
|
py: 1.25,
|
|
29
30
|
children: [
|
|
30
31
|
p,
|
|
31
|
-
/* @__PURE__ */ e(C, { children: /* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ d("div", { children: [
|
|
32
33
|
r && /* @__PURE__ */ e(
|
|
33
|
-
|
|
34
|
+
s,
|
|
34
35
|
{
|
|
35
36
|
id: r.id,
|
|
36
37
|
onClick: h,
|
|
37
|
-
variant: "tertiary",
|
|
38
|
+
variant: i ? "tertiary" : "primary",
|
|
38
39
|
width: "100%",
|
|
39
40
|
children: r.text
|
|
40
41
|
}
|
|
41
42
|
),
|
|
42
43
|
i && /* @__PURE__ */ e(
|
|
43
|
-
|
|
44
|
+
s,
|
|
44
45
|
{
|
|
45
46
|
id: i.id,
|
|
46
|
-
onClick:
|
|
47
|
+
onClick: m,
|
|
47
48
|
variant: "primary",
|
|
48
49
|
width: "100%",
|
|
49
50
|
children: i.text
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IModalHeaderProps } from '../types';
|
|
2
|
-
declare const Header: ({ title, description, dismissable,
|
|
2
|
+
declare const Header: ({ title, description, dismissable, headerActions, modalRef, onClose, }: Readonly<IModalHeaderProps>) => JSX.Element;
|
|
3
3
|
export { Header };
|
|
@@ -1,67 +1,85 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { l as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { Header as
|
|
6
|
-
import { IconButton as
|
|
7
|
-
import { Heading as
|
|
8
|
-
import { Span as
|
|
9
|
-
import { Text as
|
|
10
|
-
const
|
|
11
|
-
title:
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { l as c } from "../../../_virtual/lodash.js";
|
|
3
|
+
import { useCallback as w, useEffect as u } from "react";
|
|
4
|
+
import { useTheme as k } from "styled-components";
|
|
5
|
+
import { Header as v, Title as x } from "../styles.js";
|
|
6
|
+
import { IconButton as f } from "../../icon-button/index.js";
|
|
7
|
+
import { Heading as E } from "../../typography/heading/index.js";
|
|
8
|
+
import { Span as T } from "../../typography/span/index.js";
|
|
9
|
+
import { Text as z } from "../../typography/text/index.js";
|
|
10
|
+
const N = ({
|
|
11
|
+
title: i,
|
|
12
12
|
description: e,
|
|
13
|
-
dismissable:
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
dismissable: n = !0,
|
|
14
|
+
headerActions: h,
|
|
15
|
+
modalRef: l,
|
|
16
16
|
onClose: d
|
|
17
17
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
d?.(),
|
|
20
|
-
}, [
|
|
21
|
-
return
|
|
22
|
-
if (!
|
|
18
|
+
const t = k(), a = w(() => {
|
|
19
|
+
d?.(), l.close();
|
|
20
|
+
}, [l, d]);
|
|
21
|
+
return u(() => {
|
|
22
|
+
if (!n) return () => {
|
|
23
23
|
};
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const o = (m) => {
|
|
25
|
+
m.key === "Escape" && a();
|
|
26
26
|
};
|
|
27
|
-
return window.addEventListener("keydown",
|
|
28
|
-
window.removeEventListener("keydown",
|
|
27
|
+
return window.addEventListener("keydown", o), () => {
|
|
28
|
+
window.removeEventListener("keydown", o);
|
|
29
29
|
};
|
|
30
|
-
}, [
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
typeof
|
|
33
|
-
|
|
30
|
+
}, [n, a]), /* @__PURE__ */ s(v, { children: [
|
|
31
|
+
/* @__PURE__ */ s(x, { children: [
|
|
32
|
+
typeof i == "string" ? /* @__PURE__ */ r(
|
|
33
|
+
E,
|
|
34
34
|
{
|
|
35
35
|
fontWeight: "bold",
|
|
36
36
|
mr: 1,
|
|
37
37
|
size: "sm",
|
|
38
38
|
wordBreak: "break-word",
|
|
39
|
-
children:
|
|
39
|
+
children: i
|
|
40
40
|
}
|
|
41
|
-
) :
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
) : i,
|
|
42
|
+
/* @__PURE__ */ s("div", { className: "items-center flex gap-3", children: [
|
|
43
|
+
h?.filter(({ visible: o = !0 }) => o).map(({ icon: o, id: m, label: p, onClick: g, tooltip: y }) => /* @__PURE__ */ r(
|
|
44
|
+
f,
|
|
45
|
+
{
|
|
46
|
+
"aria-label": p,
|
|
47
|
+
icon: o,
|
|
48
|
+
iconColor: t.palette.gray[700],
|
|
49
|
+
iconSize: "sm",
|
|
50
|
+
iconType: "fa-light",
|
|
51
|
+
id: m,
|
|
52
|
+
onClick: g,
|
|
53
|
+
px: 0.25,
|
|
54
|
+
py: 0.25,
|
|
55
|
+
tooltip: y,
|
|
56
|
+
variant: "ghost",
|
|
57
|
+
width: t.spacing[1.25]
|
|
58
|
+
},
|
|
59
|
+
p
|
|
60
|
+
)),
|
|
61
|
+
n && /* @__PURE__ */ r(
|
|
62
|
+
f,
|
|
46
63
|
{
|
|
47
64
|
icon: "close",
|
|
48
|
-
iconColor:
|
|
49
|
-
iconSize: "
|
|
65
|
+
iconColor: t.palette.gray[700],
|
|
66
|
+
iconSize: "sm",
|
|
50
67
|
iconTransform: "grow-2",
|
|
51
68
|
iconType: "fa-light",
|
|
52
69
|
id: "modal-close",
|
|
53
|
-
onClick:
|
|
70
|
+
onClick: a,
|
|
54
71
|
px: 0.25,
|
|
55
72
|
py: 0.25,
|
|
56
|
-
variant: "ghost"
|
|
73
|
+
variant: "ghost",
|
|
74
|
+
width: t.spacing[1.25]
|
|
57
75
|
}
|
|
58
76
|
)
|
|
59
77
|
] })
|
|
60
78
|
] }),
|
|
61
|
-
e &&
|
|
62
|
-
e && !
|
|
79
|
+
e && c.isString(e) && !c.isEmpty(e) ? /* @__PURE__ */ r(z, { mt: 0.5, size: "md", children: e }) : void 0,
|
|
80
|
+
e && !c.isString(e) && /* @__PURE__ */ r(T, { display: "block", mt: 0.5, size: "md", children: e })
|
|
63
81
|
] });
|
|
64
82
|
};
|
|
65
83
|
export {
|
|
66
|
-
|
|
84
|
+
N as Header
|
|
67
85
|
};
|
|
@@ -2,6 +2,6 @@ import { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { ModalFooter } from './footer';
|
|
3
3
|
import { ModalConfirm } from './modal-confirm';
|
|
4
4
|
import { IModalProps } from './types';
|
|
5
|
-
declare const Modal: ({ _portal, alert, cancelButton, children, confirmButton, content, description, dismissable,
|
|
5
|
+
declare const Modal: ({ _portal, alert, cancelButton, children, confirmButton, content, description, dismissable, headerActions, modalRef, onClose, tabItems, title, size, id, }: Readonly<PropsWithChildren<IModalProps>>) => JSX.Element | null;
|
|
6
6
|
export { Modal, ModalConfirm, ModalFooter };
|
|
7
7
|
export { ColumnsModal } from './columns-modal';
|
|
@@ -24,8 +24,8 @@ const oi = ({
|
|
|
24
24
|
content: i = void 0,
|
|
25
25
|
description: M = void 0,
|
|
26
26
|
dismissable: O = !0,
|
|
27
|
+
headerActions: T = void 0,
|
|
27
28
|
modalRef: e,
|
|
28
|
-
otherActions: T = void 0,
|
|
29
29
|
onClose: j = void 0,
|
|
30
30
|
tabItems: t = void 0,
|
|
31
31
|
title: s = void 0,
|
|
@@ -55,9 +55,9 @@ const oi = ({
|
|
|
55
55
|
{
|
|
56
56
|
description: M,
|
|
57
57
|
dismissable: O,
|
|
58
|
+
headerActions: T,
|
|
58
59
|
modalRef: e,
|
|
59
60
|
onClose: j,
|
|
60
|
-
otherActions: T,
|
|
61
61
|
title: s
|
|
62
62
|
}
|
|
63
63
|
),
|
|
@@ -2,14 +2,26 @@ import { Meta } from '@storybook/react-vite';
|
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { IModalProps } from './types';
|
|
4
4
|
declare const config: Meta;
|
|
5
|
-
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IModalProps & {
|
|
5
|
+
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
6
6
|
id: string;
|
|
7
|
-
}
|
|
8
|
-
declare const
|
|
7
|
+
}>>;
|
|
8
|
+
declare const WithForm: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
9
|
+
id: string;
|
|
10
|
+
}>>;
|
|
11
|
+
declare const ScrollableContent: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
12
|
+
id: string;
|
|
13
|
+
}>>;
|
|
14
|
+
declare const SingleAction: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
9
15
|
id: string;
|
|
10
|
-
}
|
|
16
|
+
}>>;
|
|
17
|
+
declare const WithoutFooter: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
18
|
+
id: string;
|
|
19
|
+
}>>;
|
|
20
|
+
declare const ImageModal: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
21
|
+
id: string;
|
|
22
|
+
}>>;
|
|
11
23
|
declare const WithTabs: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, React.PropsWithChildren<IModalProps & {
|
|
12
24
|
id: string;
|
|
13
25
|
}>>;
|
|
14
26
|
export default config;
|
|
15
|
-
export { Default, ImageModal, WithTabs };
|
|
27
|
+
export { Default, ImageModal, WithTabs, ScrollableContent, SingleAction, WithoutFooter, WithForm, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled as a } from "styled-components";
|
|
2
|
-
import { variantBuilder as
|
|
2
|
+
import { variantBuilder as n } from "../@core/variants/utils.js";
|
|
3
3
|
import { Container as t } from "../container/index.js";
|
|
4
|
-
const { getVariant: r } =
|
|
4
|
+
const { getVariant: r } = n(
|
|
5
5
|
(i) => ({
|
|
6
6
|
fixed: `
|
|
7
7
|
height: auto;
|
|
@@ -31,7 +31,7 @@ const { getVariant: r } = o(
|
|
|
31
31
|
}
|
|
32
32
|
`
|
|
33
33
|
})
|
|
34
|
-
),
|
|
34
|
+
), l = a.div.attrs({
|
|
35
35
|
className: "comp-modal fixed inset-0 overflow-auto"
|
|
36
36
|
})`
|
|
37
37
|
align-items: center;
|
|
@@ -39,8 +39,8 @@ const { getVariant: r } = o(
|
|
|
39
39
|
display: flex;
|
|
40
40
|
justify-content: center;
|
|
41
41
|
z-index: 99999;
|
|
42
|
-
`,
|
|
43
|
-
${({ theme: i, $size:
|
|
42
|
+
`, c = a(t)`
|
|
43
|
+
${({ theme: i, $size: o }) => `
|
|
44
44
|
background-color: ${i.palette.white};
|
|
45
45
|
border: 1px solid ${i.palette.gray[200]};
|
|
46
46
|
border-radius: ${i.spacing[0.25]};
|
|
@@ -49,12 +49,16 @@ const { getVariant: r } = o(
|
|
|
49
49
|
font-family: ${i.typography.type.primary};
|
|
50
50
|
font-size: ${i.typography.text.md};
|
|
51
51
|
max-height: 80%;
|
|
52
|
-
min-height:
|
|
52
|
+
min-height: 32%;
|
|
53
53
|
box-shadow: ${i.shadows.lg};
|
|
54
54
|
margin: auto;
|
|
55
55
|
white-space: pre-line;
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
> #modal-footer {
|
|
58
|
+
margin-top: auto;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
${r(i, o)}
|
|
58
62
|
`}
|
|
59
63
|
`, p = a.div`
|
|
60
64
|
${({ theme: i }) => `
|
|
@@ -62,6 +66,7 @@ const { getVariant: r } = o(
|
|
|
62
66
|
border-radius: 0 0 ${i.spacing[0.25]} ${i.spacing[0.25]};
|
|
63
67
|
display: flex;
|
|
64
68
|
flex-direction: column;
|
|
69
|
+
flex-grow: 1;
|
|
65
70
|
overflow: hidden auto;
|
|
66
71
|
padding: 0 ${i.spacing[1.5]} ${i.spacing[1.5]} ${i.spacing[1.5]};
|
|
67
72
|
scrollbar-color: ${i.palette.gray[600]} ${i.palette.gray[100]};
|
|
@@ -71,6 +76,10 @@ const { getVariant: r } = o(
|
|
|
71
76
|
flex-direction: unset;
|
|
72
77
|
overflow: hidden;
|
|
73
78
|
padding: 0;
|
|
79
|
+
|
|
80
|
+
> form > div {
|
|
81
|
+
flex-grow: 1;
|
|
82
|
+
}
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
&:has(#footer) {
|
|
@@ -95,9 +104,9 @@ const { getVariant: r } = o(
|
|
|
95
104
|
padding-bottom: ${({ theme: i }) => `${i.spacing[1.5]}`};
|
|
96
105
|
position: sticky;
|
|
97
106
|
z-index: 1;
|
|
98
|
-
`,
|
|
107
|
+
`, f = a.div.attrs({
|
|
99
108
|
className: "flex items-center justify-between"
|
|
100
|
-
})``,
|
|
109
|
+
})``, $ = a.div`
|
|
101
110
|
${({ theme: i }) => `
|
|
102
111
|
border-radius: 0 0 ${i.spacing[0.25]} ${i.spacing[0.25]};
|
|
103
112
|
display: flex;
|
|
@@ -146,11 +155,11 @@ const { getVariant: r } = o(
|
|
|
146
155
|
}
|
|
147
156
|
`;
|
|
148
157
|
export {
|
|
149
|
-
|
|
158
|
+
$ as Footer,
|
|
150
159
|
g as Header,
|
|
151
160
|
x as ImageContainer,
|
|
152
|
-
|
|
161
|
+
c as ModalContainer,
|
|
153
162
|
p as ModalContent,
|
|
154
|
-
|
|
155
|
-
|
|
163
|
+
l as ModalWrapper,
|
|
164
|
+
f as Title
|
|
156
165
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IIconModifiable } from '../@core/types';
|
|
1
2
|
import { ITabProps } from '../tabs/types';
|
|
2
3
|
import { IUseModal } from '../../hooks';
|
|
3
4
|
type TSize = "fixed" | "lg" | "md" | "sm";
|
|
@@ -35,20 +36,39 @@ interface IDialogProps {
|
|
|
35
36
|
id?: string;
|
|
36
37
|
label: string;
|
|
37
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Modal header action props.
|
|
41
|
+
* @interface IModalHeaderAction
|
|
42
|
+
* @property { IconName } icon - The icon the button shows.
|
|
43
|
+
* @property { string } [id] - The id of the button.
|
|
44
|
+
* @property { string } label - The name screen readers announce for the button, unique among the actions.
|
|
45
|
+
* @property { Function } onClick - The function to call when the button is clicked.
|
|
46
|
+
* @property { string } [tooltip] - The text shown when hovering the button.
|
|
47
|
+
* @property { boolean } [visible] - Whether the button is shown. Defaults to true.
|
|
48
|
+
*/
|
|
49
|
+
interface IModalHeaderAction {
|
|
50
|
+
icon: IIconModifiable["icon"];
|
|
51
|
+
id?: string;
|
|
52
|
+
label: string;
|
|
53
|
+
onClick: () => void;
|
|
54
|
+
tooltip?: string;
|
|
55
|
+
visible?: boolean;
|
|
56
|
+
}
|
|
57
|
+
type TModalHeaderActions = readonly [IModalHeaderAction, IModalHeaderAction, IModalHeaderAction] | readonly [IModalHeaderAction, IModalHeaderAction] | readonly [IModalHeaderAction];
|
|
38
58
|
/**
|
|
39
59
|
* Modal header component props.
|
|
40
60
|
* @interface IModalHeaderProps
|
|
41
61
|
* @property { React.ReactNode | string } [description] - The description of the modal.
|
|
62
|
+
* @property { TModalHeaderActions } [headerActions] - Up to three buttons shown left of the close button.
|
|
42
63
|
* @property { IUseModal } [modalRef] - The modal reference.
|
|
43
|
-
* @property { React.ReactNode } [otherActions] - The other actions of the modal.
|
|
44
64
|
* @property { Function } [onClose] - The function to call when the modal is closed.
|
|
45
65
|
* @property { React.ReactNode | string } [title] - The title of the modal.
|
|
46
66
|
*/
|
|
47
67
|
interface IModalHeaderProps {
|
|
48
68
|
description?: React.ReactNode | string;
|
|
49
69
|
dismissable?: boolean;
|
|
70
|
+
headerActions?: TModalHeaderActions;
|
|
50
71
|
modalRef: IModalProps["modalRef"];
|
|
51
|
-
otherActions?: React.ReactNode;
|
|
52
72
|
onClose?: () => void;
|
|
53
73
|
title?: React.ReactNode | string;
|
|
54
74
|
}
|
|
@@ -102,4 +122,4 @@ interface IModalConfirmProps {
|
|
|
102
122
|
txtCancel?: string;
|
|
103
123
|
txtConfirm?: React.ReactNode | string;
|
|
104
124
|
}
|
|
105
|
-
export type { IDialogProps, IModalProps, IModalContent, IModalConfirmProps, IModalFooterProps, IModalHeaderProps, TSize, };
|
|
125
|
+
export type { IDialogProps, IModalHeaderAction, TModalHeaderActions, IModalProps, IModalContent, IModalConfirmProps, IModalFooterProps, IModalHeaderProps, TSize, };
|
|
@@ -9,7 +9,6 @@ import { Thumb as k } from "./thumb/index.js";
|
|
|
9
9
|
import { normalizeValue as v } from "./utils.js";
|
|
10
10
|
import { Container as w } from "../container/index.js";
|
|
11
11
|
import { OutlineContainer as y } from "../inputs/outline-container/index.js";
|
|
12
|
-
import "../inputs/styles.js";
|
|
13
12
|
import "../checkbox/index.js";
|
|
14
13
|
import "../icon/index.js";
|
|
15
14
|
import "../../_virtual/lodash.js";
|
|
@@ -23,7 +22,7 @@ import "react-dom";
|
|
|
23
22
|
import "../layout/categories/buttons/index.js";
|
|
24
23
|
import "../inputs/utils/action-button/index.js";
|
|
25
24
|
import "../../node_modules/react-international-phone/dist/index.js";
|
|
26
|
-
const
|
|
25
|
+
const ee = (o) => {
|
|
27
26
|
const p = S(), m = $(null), { label: s, minValue: i = 0, maxValue: n = 100, name: r, setValue: d, watch: c } = o, a = x(), t = V({
|
|
28
27
|
...o,
|
|
29
28
|
numberFormatter: a,
|
|
@@ -76,6 +75,6 @@ const re = (o) => {
|
|
|
76
75
|
) });
|
|
77
76
|
};
|
|
78
77
|
export {
|
|
79
|
-
|
|
78
|
+
ee as Slider,
|
|
80
79
|
x as useNumberFormatter
|
|
81
80
|
};
|
package/package.json
CHANGED
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@types/react-dom": "18.3.0",
|
|
43
43
|
"@types/react-syntax-highlighter": "15.5.13",
|
|
44
44
|
"@vitejs/plugin-react-swc": "4.3.1",
|
|
45
|
-
"@vitest/browser-playwright": "4.1.
|
|
46
|
-
"@vitest/coverage-v8": "4.1.
|
|
45
|
+
"@vitest/browser-playwright": "4.1.12",
|
|
46
|
+
"@vitest/coverage-v8": "4.1.12",
|
|
47
47
|
"eslint": "9.31.0",
|
|
48
48
|
"eslint-config-prettier": "10.0.1",
|
|
49
49
|
"eslint-import-resolver-typescript": "3.8.0",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"tailwindcss": "4.3.0",
|
|
71
71
|
"typescript": "6.0.3",
|
|
72
72
|
"typescript-eslint": "8.59.4",
|
|
73
|
-
"vite": "6.4.
|
|
73
|
+
"vite": "6.4.5",
|
|
74
74
|
"vite-plugin-dts": "5.0.3",
|
|
75
75
|
"vite-plugin-lib-inject-css": "2.2.2",
|
|
76
|
-
"vitest": "4.1.
|
|
76
|
+
"vitest": "4.1.12"
|
|
77
77
|
},
|
|
78
78
|
"eslintConfig": {
|
|
79
79
|
"extends": [
|
|
@@ -135,5 +135,5 @@
|
|
|
135
135
|
"./dist/index.js"
|
|
136
136
|
],
|
|
137
137
|
"typings": "./dist/index.d.ts",
|
|
138
|
-
"version": "
|
|
138
|
+
"version": "10.0.1"
|
|
139
139
|
}
|