@spesia/ui 1.8.21 → 1.9.7
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/README.md +1 -1
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/client.d.ts +7 -0
- package/dist/client.js +16 -0
- package/dist/components/Logo/Logo.js +121 -0
- package/dist/components/Logo3d/Logo3d.js +61 -0
- package/dist/components/checkbox/Checked.js +47 -0
- package/dist/components/checkbox/Unchecked.js +70 -0
- package/dist/components/chip-list/ChipList.js +97 -0
- package/dist/components/container-grid/ContainerGrid.js +110 -0
- package/dist/components/date-picker/DatePicker/DatePicker.js +62 -0
- package/dist/components/date-picker/PeriodPicker/PeriodPicker.js +374 -0
- package/dist/components/date-picker/utils.js +27 -0
- package/dist/components/filters/Checked.js +26 -0
- package/dist/components/filters/FilterList.js +121 -0
- package/dist/components/filters/Unchecked.js +26 -0
- package/dist/components/index.d.ts +0 -9
- package/dist/components/radio/Checked.js +34 -0
- package/dist/components/radio/Unchecked.js +48 -0
- package/dist/components/trending-chip/TrendingChip.js +93 -0
- package/dist/helpers/suitCx.js +17 -0
- package/dist/helpers/utils.js +11 -0
- package/dist/hooks/useContainerDimension.js +23 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +13 -37197
- package/dist/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js +42 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/addLeadingZeros.js +7 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js +7 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/formatters.js +515 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/lightFormatters.js +59 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/longFormatters.js +52 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +18 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js +11 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/protectedTokens.js +20 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constants.js +6 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js +8 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js +16 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/format.js +59 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDayOfYear.js +11 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeek.js +12 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js +15 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeek.js +12 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeekYear.js +17 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js +7 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameDay.js +14 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameMonth.js +13 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameYear.js +13 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js +9 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +18 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js +31 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +15 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +70 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatLong.js +33 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/localize.js +155 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/match.js +110 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js +21 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js +9 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js +8 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js +11 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js +11 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeekYear.js +13 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfYear.js +9 -0
- package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js +8 -0
- package/dist/styles/alert/alert.js +70 -0
- package/dist/styles/button/button.js +195 -0
- package/dist/styles/card/card.js +16 -0
- package/dist/styles/checkbox/checkbox.js +46 -0
- package/dist/styles/chip/chip.js +115 -0
- package/dist/styles/colors.js +435 -0
- package/dist/styles/dialog/dialog.js +34 -0
- package/dist/styles/form/form.js +18 -0
- package/dist/styles/index.js +53 -0
- package/dist/styles/input/input.js +127 -0
- package/dist/styles/list/list.js +42 -0
- package/dist/styles/palette.js +150 -0
- package/dist/styles/radio/radio.js +37 -0
- package/dist/styles/slider/slider.js +55 -0
- package/dist/styles/switch/switch.js +63 -0
- package/dist/styles/tab/tab.js +70 -0
- package/dist/styles/tooltip/tooltip.js +19 -0
- package/dist/styles/typography.js +139 -0
- package/dist/themes.js +35 -0
- package/package.json +6 -1
- /package/dist/components/{TrendingChip → trending-chip}/TrendingChip.d.ts +0 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { jsx as t, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as W, useState as p, useEffect as _ } from "react";
|
|
3
|
+
import ee from "lodash/isNil";
|
|
4
|
+
import { suitCx as ke } from "../../../helpers/suitCx.js";
|
|
5
|
+
import { Box as f, Chip as le, Tooltip as Ne, Button as re, TextField as Re, InputAdornment as Se, IconButton as _e } from "@mui/material";
|
|
6
|
+
import Ee from "@mui/material/Popover";
|
|
7
|
+
import { DateCalendar as te } from "@mui/x-date-pickers/DateCalendar";
|
|
8
|
+
import { setInitialValue as Me } from "../utils.js";
|
|
9
|
+
import { Clear as Ve } from "@mui/icons-material";
|
|
10
|
+
import { primitives as ae } from "../../../styles/colors.js";
|
|
11
|
+
const De = ({
|
|
12
|
+
inline: a,
|
|
13
|
+
format: se = "dd MMM",
|
|
14
|
+
yearFormat: ne = "dd MMM yyyy",
|
|
15
|
+
options: o,
|
|
16
|
+
onSelect: A,
|
|
17
|
+
initialFromDate: c,
|
|
18
|
+
initialToDate: u,
|
|
19
|
+
initialPeriod: i,
|
|
20
|
+
required: oe,
|
|
21
|
+
onClose: O,
|
|
22
|
+
disabled: E,
|
|
23
|
+
block: L,
|
|
24
|
+
maxDate: U,
|
|
25
|
+
size: q,
|
|
26
|
+
minDate: z,
|
|
27
|
+
id: ce,
|
|
28
|
+
dataTestId: d = "periodPicker",
|
|
29
|
+
placeholder: ue = "Select period",
|
|
30
|
+
cancelButtonText: de = "Cancel",
|
|
31
|
+
saveButtonText: fe = "Save",
|
|
32
|
+
invalidPeriodHelperText: ie = "Invalid period",
|
|
33
|
+
validation: D,
|
|
34
|
+
className: me
|
|
35
|
+
}) => {
|
|
36
|
+
const m = o.map((e) => ({
|
|
37
|
+
...e,
|
|
38
|
+
label: e.label || e.key,
|
|
39
|
+
tooltip: e.tooltip
|
|
40
|
+
})) ?? [], M = W(!1), he = W(null), G = W(null), V = m.length > 0, I = (e) => e ? new Date(e) : null, [v, b] = p(
|
|
41
|
+
I(u)
|
|
42
|
+
), [C, x] = p(
|
|
43
|
+
I(c)
|
|
44
|
+
), [l, k] = p(
|
|
45
|
+
o == null ? void 0 : o.find((e) => e.value === i)
|
|
46
|
+
), [P, H] = p(!1), [N, J] = p(!1), [g, R] = p("empty"), [pe, K] = p(null), s = ke(
|
|
47
|
+
{
|
|
48
|
+
name: "PeriodPicker",
|
|
49
|
+
modifiers: ["required", "block", "withPredefined", "rightSided"],
|
|
50
|
+
states: ["disabled", "error", "filled", "success", "focus", "open"]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
filled: g === "filled",
|
|
54
|
+
error: g === "error",
|
|
55
|
+
success: g === "success",
|
|
56
|
+
focus: g === "focus",
|
|
57
|
+
rightSided: P,
|
|
58
|
+
withPredefined: V,
|
|
59
|
+
open: N,
|
|
60
|
+
disabled: E,
|
|
61
|
+
required: oe,
|
|
62
|
+
block: L
|
|
63
|
+
},
|
|
64
|
+
me
|
|
65
|
+
), Q = (e, r) => {
|
|
66
|
+
e === "toDate" ? b(r) : x(r);
|
|
67
|
+
}, X = (e) => {
|
|
68
|
+
M.current || (J(!0), document.addEventListener("keydown", $, !1), K(e.target), Y()), M.current = !1;
|
|
69
|
+
}, Y = () => {
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
if (N) {
|
|
72
|
+
const e = G && G.current;
|
|
73
|
+
if (!e) return !1;
|
|
74
|
+
const n = e.getBoundingClientRect().right <= window.innerWidth;
|
|
75
|
+
H(!n && !P);
|
|
76
|
+
}
|
|
77
|
+
}, 10);
|
|
78
|
+
}, ve = () => {
|
|
79
|
+
x(c ? new Date(c) : null), b(u ? new Date(u) : null), k(o == null ? void 0 : o.find((e) => e.value === i));
|
|
80
|
+
}, be = (e, r, n) => {
|
|
81
|
+
R(e ? r ? "success" : "error" : n ? "filled" : "empty");
|
|
82
|
+
}, S = (e, r) => {
|
|
83
|
+
const n = (e == null ? void 0 : e.value) === "custom" && !(e.from || e.to);
|
|
84
|
+
let h;
|
|
85
|
+
if (a || (M.current = !0), !r || n)
|
|
86
|
+
ve(), R("empty"), k(null), x(null), b(null), h = null;
|
|
87
|
+
else {
|
|
88
|
+
e || (e = l);
|
|
89
|
+
const B = !!D, T = B && D(e);
|
|
90
|
+
be(B, T, e), B && !T ? h = null : h = e;
|
|
91
|
+
}
|
|
92
|
+
A && A(h), j();
|
|
93
|
+
}, Z = (e, r) => {
|
|
94
|
+
k(e), e.value !== "custom" ? (x(null), b(null), S(e, !0)) : (a && X(r), Y());
|
|
95
|
+
}, Ce = () => {
|
|
96
|
+
const e = {
|
|
97
|
+
label: "Custom",
|
|
98
|
+
value: "custom",
|
|
99
|
+
from: C,
|
|
100
|
+
to: v
|
|
101
|
+
};
|
|
102
|
+
k(e), S(e, !0);
|
|
103
|
+
}, $ = (e) => {
|
|
104
|
+
e.key === "Esc" && (e.target.blur(), S(null, !0));
|
|
105
|
+
}, xe = () => {
|
|
106
|
+
S(null, !1);
|
|
107
|
+
}, j = () => {
|
|
108
|
+
J(!1), K(null), document.removeEventListener("keydown", $, !1), O && O();
|
|
109
|
+
};
|
|
110
|
+
_(() => {
|
|
111
|
+
Promise.resolve().then(() => {
|
|
112
|
+
ee(c) && x(null), c && c !== C && x(c);
|
|
113
|
+
});
|
|
114
|
+
}, [c]), _(() => {
|
|
115
|
+
Promise.resolve().then(() => {
|
|
116
|
+
ee(u) && b(null), u && u !== v && b(u);
|
|
117
|
+
});
|
|
118
|
+
}, [u]), _(() => {
|
|
119
|
+
Promise.resolve().then(() => {
|
|
120
|
+
i && i !== l && k(o == null ? void 0 : o.find((e) => e.value === i));
|
|
121
|
+
});
|
|
122
|
+
}, [i]), _(() => {
|
|
123
|
+
Promise.resolve().then(() => {
|
|
124
|
+
(c || u || i) && R("filled");
|
|
125
|
+
});
|
|
126
|
+
}, []);
|
|
127
|
+
const F = Me(
|
|
128
|
+
l,
|
|
129
|
+
C,
|
|
130
|
+
v,
|
|
131
|
+
se,
|
|
132
|
+
ne
|
|
133
|
+
), y = (e) => {
|
|
134
|
+
if (e)
|
|
135
|
+
return new Date(e);
|
|
136
|
+
}, ge = /* @__PURE__ */ t(f, { className: s("predefined"), sx: { p: a ? 0 : 4 }, children: /* @__PURE__ */ t(
|
|
137
|
+
f,
|
|
138
|
+
{
|
|
139
|
+
role: "listbox",
|
|
140
|
+
className: s("periods"),
|
|
141
|
+
sx: {
|
|
142
|
+
display: "flex",
|
|
143
|
+
flexDirection: a ? "row" : "column",
|
|
144
|
+
gap: 4,
|
|
145
|
+
flexWrap: a ? "wrap" : void 0
|
|
146
|
+
},
|
|
147
|
+
"data-testid": d + "_Predefined",
|
|
148
|
+
children: m == null ? void 0 : m.map((e, r) => /* @__PURE__ */ t(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
className: s("periods-item"),
|
|
152
|
+
role: "option",
|
|
153
|
+
"aria-selected": e.value === (l == null ? void 0 : l.value),
|
|
154
|
+
children: /* @__PURE__ */ t(
|
|
155
|
+
le,
|
|
156
|
+
{
|
|
157
|
+
sx: {
|
|
158
|
+
px: 3,
|
|
159
|
+
borderRadius: 3,
|
|
160
|
+
width: a ? "auto" : "100%"
|
|
161
|
+
},
|
|
162
|
+
label: e.label,
|
|
163
|
+
icon: e.icon,
|
|
164
|
+
"data-selected": e.label === (l == null ? void 0 : l.label),
|
|
165
|
+
"data-value": e.value,
|
|
166
|
+
color: e.label === (l == null ? void 0 : l.label) ? "primary" : void 0,
|
|
167
|
+
onClick: (n) => Z(e, n)
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
},
|
|
171
|
+
"period-" + r
|
|
172
|
+
))
|
|
173
|
+
}
|
|
174
|
+
) }), ye = /* @__PURE__ */ t(f, { className: s("predefined"), sx: { p: a ? 0 : 4 }, children: /* @__PURE__ */ t(
|
|
175
|
+
f,
|
|
176
|
+
{
|
|
177
|
+
role: "listbox",
|
|
178
|
+
className: s("periods"),
|
|
179
|
+
sx: {
|
|
180
|
+
backgroundColor: (e) => {
|
|
181
|
+
var r;
|
|
182
|
+
return (r = e.vars) == null ? void 0 : r.palette.background.alphaBrown;
|
|
183
|
+
},
|
|
184
|
+
borderRadius: ae.borderRadius.full,
|
|
185
|
+
padding: 2,
|
|
186
|
+
display: "flex",
|
|
187
|
+
flexDirection: a ? "row" : "column",
|
|
188
|
+
gap: 4,
|
|
189
|
+
".MuiChip-icon": {
|
|
190
|
+
fill: (e) => {
|
|
191
|
+
var r;
|
|
192
|
+
return (r = e.vars) == null ? void 0 : r.palette.text.primary;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"data-testid": d + "_Predefined",
|
|
197
|
+
children: m == null ? void 0 : m.map((e, r) => /* @__PURE__ */ t(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
className: s("periods-item"),
|
|
201
|
+
role: "option",
|
|
202
|
+
"aria-selected": e.value === (l == null ? void 0 : l.value),
|
|
203
|
+
children: /* @__PURE__ */ t(
|
|
204
|
+
Ne,
|
|
205
|
+
{
|
|
206
|
+
arrow: !0,
|
|
207
|
+
placement: a ? "top" : "right",
|
|
208
|
+
title: e.tooltip,
|
|
209
|
+
children: /* @__PURE__ */ t(
|
|
210
|
+
le,
|
|
211
|
+
{
|
|
212
|
+
sx: {
|
|
213
|
+
px: 3,
|
|
214
|
+
backgroundColor: (n) => {
|
|
215
|
+
var h;
|
|
216
|
+
return e.label === (l == null ? void 0 : l.label) ? (h = n.vars) == null ? void 0 : h.palette.background.default : "transparent";
|
|
217
|
+
},
|
|
218
|
+
borderRadius: ae.borderRadius.full,
|
|
219
|
+
border: "none",
|
|
220
|
+
width: a ? "auto" : "100%"
|
|
221
|
+
},
|
|
222
|
+
size: q,
|
|
223
|
+
disabled: E,
|
|
224
|
+
label: e.label,
|
|
225
|
+
icon: e.icon,
|
|
226
|
+
"data-selected": e.label === (l == null ? void 0 : l.label),
|
|
227
|
+
"data-value": e.value,
|
|
228
|
+
onClick: (n) => Z(e, n)
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
},
|
|
234
|
+
"period-" + r
|
|
235
|
+
))
|
|
236
|
+
}
|
|
237
|
+
) }), we = /* @__PURE__ */ w(f, { className: s("custom"), "data-testid": d + "_Calendars", children: [
|
|
238
|
+
/* @__PURE__ */ w(
|
|
239
|
+
f,
|
|
240
|
+
{
|
|
241
|
+
sx: {
|
|
242
|
+
display: "flex",
|
|
243
|
+
alignItems: "top",
|
|
244
|
+
justifyContent: "space-between"
|
|
245
|
+
},
|
|
246
|
+
className: s("calendars"),
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ t(
|
|
249
|
+
te,
|
|
250
|
+
{
|
|
251
|
+
value: y(C),
|
|
252
|
+
"data-testid": d + "_Calendars_From",
|
|
253
|
+
onChange: (e) => Q("fromDate", e),
|
|
254
|
+
maxDate: y(v ?? U),
|
|
255
|
+
minDate: y(z)
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
/* @__PURE__ */ t(
|
|
259
|
+
te,
|
|
260
|
+
{
|
|
261
|
+
value: y(v),
|
|
262
|
+
"data-testid": d + "_Calendars_To",
|
|
263
|
+
onChange: (e) => Q("toDate", e),
|
|
264
|
+
maxDate: y(U),
|
|
265
|
+
minDate: y(C ?? z)
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
/* @__PURE__ */ w(
|
|
272
|
+
f,
|
|
273
|
+
{
|
|
274
|
+
className: s("save"),
|
|
275
|
+
sx: { display: "flex", alignItems: "center", gap: 4, p: 4 },
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ t(
|
|
278
|
+
re,
|
|
279
|
+
{
|
|
280
|
+
onClick: j,
|
|
281
|
+
fullWidth: !0,
|
|
282
|
+
color: "inherit",
|
|
283
|
+
variant: "contained",
|
|
284
|
+
"data-testid": d + "_Calendars_Cancel",
|
|
285
|
+
children: de
|
|
286
|
+
}
|
|
287
|
+
),
|
|
288
|
+
/* @__PURE__ */ t(
|
|
289
|
+
re,
|
|
290
|
+
{
|
|
291
|
+
onClick: Ce,
|
|
292
|
+
color: "primary",
|
|
293
|
+
variant: "contained",
|
|
294
|
+
fullWidth: !0,
|
|
295
|
+
disabled: !(v && C),
|
|
296
|
+
"data-testid": d + "_Calendars_Save",
|
|
297
|
+
children: fe
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
] });
|
|
304
|
+
return /* @__PURE__ */ w("div", { "data-testid": d, className: s(), children: [
|
|
305
|
+
/* @__PURE__ */ w("div", { ref: he, children: [
|
|
306
|
+
a && (V ? ye : null),
|
|
307
|
+
!a && /* @__PURE__ */ t(
|
|
308
|
+
Re,
|
|
309
|
+
{
|
|
310
|
+
type: "text",
|
|
311
|
+
id: ce,
|
|
312
|
+
fullWidth: L,
|
|
313
|
+
autoComplete: "off",
|
|
314
|
+
value: F,
|
|
315
|
+
size: q,
|
|
316
|
+
disabled: E,
|
|
317
|
+
placeholder: ue,
|
|
318
|
+
error: g === "error",
|
|
319
|
+
slotProps: {
|
|
320
|
+
input: {
|
|
321
|
+
readOnly: !0,
|
|
322
|
+
endAdornment: F && /* @__PURE__ */ t(Se, { position: "end", children: /* @__PURE__ */ t(
|
|
323
|
+
_e,
|
|
324
|
+
{
|
|
325
|
+
"aria-label": "Clear",
|
|
326
|
+
onClick: xe,
|
|
327
|
+
edge: "end",
|
|
328
|
+
children: /* @__PURE__ */ t(Ve, {})
|
|
329
|
+
}
|
|
330
|
+
) })
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
helperText: g === "error" ? ie : null,
|
|
334
|
+
onFocus: (e) => X(e),
|
|
335
|
+
className: s("input")
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
] }),
|
|
339
|
+
/* @__PURE__ */ t(
|
|
340
|
+
Ee,
|
|
341
|
+
{
|
|
342
|
+
id: N ? "simple-popover" : void 0,
|
|
343
|
+
open: N,
|
|
344
|
+
anchorEl: pe,
|
|
345
|
+
disableAutoFocus: !0,
|
|
346
|
+
disableEnforceFocus: !0,
|
|
347
|
+
onClose: j,
|
|
348
|
+
anchorOrigin: {
|
|
349
|
+
vertical: "bottom",
|
|
350
|
+
horizontal: P ? "right" : "left"
|
|
351
|
+
},
|
|
352
|
+
children: /* @__PURE__ */ w(
|
|
353
|
+
f,
|
|
354
|
+
{
|
|
355
|
+
className: s("dropdown-calendar"),
|
|
356
|
+
sx: {
|
|
357
|
+
display: "flex",
|
|
358
|
+
alignItems: "top",
|
|
359
|
+
justifyContent: "space-between"
|
|
360
|
+
},
|
|
361
|
+
children: [
|
|
362
|
+
!a && (V ? ge : null),
|
|
363
|
+
(!a && (l == null ? void 0 : l.value) === "custom" || a) && we
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
)
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
] });
|
|
370
|
+
};
|
|
371
|
+
export {
|
|
372
|
+
De as PeriodPicker,
|
|
373
|
+
De as default
|
|
374
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isSameDay as $ } from "../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameDay.js";
|
|
2
|
+
import { isSameMonth as S } from "../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameMonth.js";
|
|
3
|
+
import { isSameYear as f } from "../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameYear.js";
|
|
4
|
+
import { formatDate as a } from "../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/format.js";
|
|
5
|
+
const c = (e, t, n, s) => f(e, t) ? a(new Date(t), s) : a(new Date(t), n), Y = (e, t, n, s, l) => f(e, t) ? `${a(new Date(t), "dd")} - ${a(new Date(n), s)}` : `${a(new Date(t), "dd")} - ${a(new Date(n), l)}`, b = (e, t, n, s, l) => f(e, t) ? `${a(new Date(t), s)} - ${a(new Date(n), s)}` : `${a(new Date(t), s)} - ${a(new Date(n), l)}`, h = (e, t, n) => `${a(new Date(e), n)} - ${a(new Date(t), n)}`, x = (e, t, n, s, l) => {
|
|
6
|
+
let u = "";
|
|
7
|
+
if ((e == null ? void 0 : e.value) === "custom" && t && n) {
|
|
8
|
+
const D = new Date(t), w = new Date(n), i = /* @__PURE__ */ new Date();
|
|
9
|
+
$(D, w) ? u = c(i, D, s, l) : S(D, w) ? u = Y(
|
|
10
|
+
i,
|
|
11
|
+
D,
|
|
12
|
+
w,
|
|
13
|
+
s,
|
|
14
|
+
l
|
|
15
|
+
) : f(D, w) ? u = b(
|
|
16
|
+
i,
|
|
17
|
+
D,
|
|
18
|
+
w,
|
|
19
|
+
s,
|
|
20
|
+
l
|
|
21
|
+
) : u = h(D, w, l);
|
|
22
|
+
} else e != null && e.label && e.value !== "custom" && (u = e.label);
|
|
23
|
+
return u;
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
x as setInitialValue
|
|
27
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { colors as i } from "../../styles/colors.js";
|
|
3
|
+
const h = () => /* @__PURE__ */ o(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
className: "Checkbox-icon Checkbox-icon--checked",
|
|
7
|
+
width: "14",
|
|
8
|
+
height: "14",
|
|
9
|
+
viewBox: "0 0 14 14",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ e(
|
|
14
|
+
"path",
|
|
15
|
+
{
|
|
16
|
+
d: "M0 4C0 1.79086 1.79086 0 4 0H10C12.2091 0 14 1.79086 14 4V10C14 12.2091 12.2091 14 10 14H4C1.79086 14 0 12.2091 0 10V4Z",
|
|
17
|
+
fill: i.primary.coral[100]
|
|
18
|
+
}
|
|
19
|
+
),
|
|
20
|
+
/* @__PURE__ */ e("rect", { x: "4", y: "4", width: "6", height: "6", rx: "3", fill: "white" })
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
export {
|
|
25
|
+
h as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useEffect as y } from "react";
|
|
3
|
+
import { suitCx as C } from "../../helpers/suitCx.js";
|
|
4
|
+
import { Box as b, Tooltip as w, FormControlLabel as g, Checkbox as A } from "@mui/material";
|
|
5
|
+
import { primitives as F } from "../../styles/colors.js";
|
|
6
|
+
import L from "./Checked.js";
|
|
7
|
+
import S from "./Unchecked.js";
|
|
8
|
+
function z(n, d) {
|
|
9
|
+
if (n.size !== d.size) return !1;
|
|
10
|
+
for (const l of n)
|
|
11
|
+
if (!d.has(l)) return !1;
|
|
12
|
+
return !0;
|
|
13
|
+
}
|
|
14
|
+
const D = ({
|
|
15
|
+
options: n,
|
|
16
|
+
onSelect: d,
|
|
17
|
+
disabled: l,
|
|
18
|
+
initialValues: t,
|
|
19
|
+
dataTestId: i = "FilterList",
|
|
20
|
+
className: m
|
|
21
|
+
}) => {
|
|
22
|
+
const f = n.map((e) => ({
|
|
23
|
+
...e,
|
|
24
|
+
label: e.label || e.value,
|
|
25
|
+
tooltip: e.tooltip
|
|
26
|
+
})) ?? [], [a, u] = x(
|
|
27
|
+
new Set(
|
|
28
|
+
Array.isArray(t) ? t : t ? [t] : []
|
|
29
|
+
)
|
|
30
|
+
), p = C(
|
|
31
|
+
{
|
|
32
|
+
name: "FilterList",
|
|
33
|
+
states: ["disabled"]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
disabled: l
|
|
37
|
+
},
|
|
38
|
+
m
|
|
39
|
+
), v = (e) => {
|
|
40
|
+
u((s) => {
|
|
41
|
+
const r = new Set(s);
|
|
42
|
+
return r.has(e) ? r.delete(e) : r.add(e), d(Array.from(r)), r;
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
y(() => {
|
|
46
|
+
if (t === void 0)
|
|
47
|
+
return;
|
|
48
|
+
const e = new Set(
|
|
49
|
+
Array.isArray(t) ? t : t ? [t] : []
|
|
50
|
+
);
|
|
51
|
+
z(e, a) || Promise.resolve().then(() => {
|
|
52
|
+
u(e);
|
|
53
|
+
});
|
|
54
|
+
}, []);
|
|
55
|
+
const k = /* @__PURE__ */ o(
|
|
56
|
+
b,
|
|
57
|
+
{
|
|
58
|
+
role: "group",
|
|
59
|
+
className: p("filters"),
|
|
60
|
+
sx: {
|
|
61
|
+
display: "flex",
|
|
62
|
+
flexDirection: "row",
|
|
63
|
+
gap: 2,
|
|
64
|
+
".MuiChip-icon": {
|
|
65
|
+
fill: (e) => {
|
|
66
|
+
var s;
|
|
67
|
+
return (s = e.vars) == null ? void 0 : s.palette.text.primary;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"data-testid": i + "_Options",
|
|
72
|
+
children: f == null ? void 0 : f.map((e, s) => /* @__PURE__ */ o(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
className: p("filters-item"),
|
|
76
|
+
"aria-checked": a.has(e.value),
|
|
77
|
+
children: /* @__PURE__ */ o(w, { arrow: !0, placement: "top", title: e.tooltip ?? "", children: /* @__PURE__ */ o(
|
|
78
|
+
g,
|
|
79
|
+
{
|
|
80
|
+
disabled: l,
|
|
81
|
+
sx: {
|
|
82
|
+
px: 2,
|
|
83
|
+
fontWeight: 500,
|
|
84
|
+
backgroundColor: (r) => {
|
|
85
|
+
var c;
|
|
86
|
+
return a.has(e.value) ? (c = r.vars) == null ? void 0 : c.palette.background.default : "transparent";
|
|
87
|
+
},
|
|
88
|
+
opacity: () => a.has(e.value) ? 1 : 0.5,
|
|
89
|
+
color: (r) => {
|
|
90
|
+
var c, h;
|
|
91
|
+
return a.has(e.value) ? (c = r.vars) == null ? void 0 : c.palette.primary.dark : (h = r.vars) == null ? void 0 : h.palette.text.primary;
|
|
92
|
+
},
|
|
93
|
+
borderRadius: F.borderRadius.full,
|
|
94
|
+
width: "auto"
|
|
95
|
+
},
|
|
96
|
+
label: e.label,
|
|
97
|
+
control: /* @__PURE__ */ o(
|
|
98
|
+
A,
|
|
99
|
+
{
|
|
100
|
+
disabled: l,
|
|
101
|
+
size: "small",
|
|
102
|
+
checkedIcon: /* @__PURE__ */ o(L, {}),
|
|
103
|
+
icon: /* @__PURE__ */ o(S, {}),
|
|
104
|
+
value: e.value,
|
|
105
|
+
checked: a.has(e.value),
|
|
106
|
+
onChange: () => v(e.value)
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
) })
|
|
111
|
+
},
|
|
112
|
+
"filter-" + s
|
|
113
|
+
))
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
return /* @__PURE__ */ o("div", { "data-testid": i, className: p(), children: k });
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
D as FilterList,
|
|
120
|
+
D as default
|
|
121
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { styled as d } from "@mui/material/styles";
|
|
2
|
+
import { primitives as i } from "../../styles/colors.js";
|
|
3
|
+
const n = d("span")(({ theme: r }) => {
|
|
4
|
+
var a, o, e, t;
|
|
5
|
+
return {
|
|
6
|
+
borderRadius: i.borderRadius.default,
|
|
7
|
+
width: 20,
|
|
8
|
+
height: 20,
|
|
9
|
+
border: 0,
|
|
10
|
+
backgroundColor: (a = r.vars) == null ? void 0 : a.palette.primary.main,
|
|
11
|
+
".Mui-focusVisible &": {
|
|
12
|
+
outline: `2px auto ${(o = r.vars) == null ? void 0 : o.palette.secondary.light}`,
|
|
13
|
+
outlineOffset: 2
|
|
14
|
+
},
|
|
15
|
+
"input:hover ~ &": {
|
|
16
|
+
backgroundColor: (e = r.vars) == null ? void 0 : e.palette.primary.dark
|
|
17
|
+
},
|
|
18
|
+
"input:disabled ~ &": {
|
|
19
|
+
boxShadow: "none",
|
|
20
|
+
background: (t = r.vars) == null ? void 0 : t.palette.background.alphaBrown
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}), p = n;
|
|
24
|
+
export {
|
|
25
|
+
p as default
|
|
26
|
+
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { default as Logo } from './Logo/Logo';
|
|
2
|
-
export { default as Logo3d } from './Logo3d/Logo3d';
|
|
3
|
-
export { type LogoProps } from './Logo/Logo';
|
|
4
|
-
export { ContainerGrid } from './container-grid/ContainerGrid';
|
|
5
|
-
export { PeriodPicker } from './date-picker/PeriodPicker/PeriodPicker';
|
|
6
|
-
export { DatePicker } from './date-picker/DatePicker/DatePicker';
|
|
7
|
-
export { ChipList } from './chip-list/ChipList';
|
|
8
|
-
export { FilterList } from './filters/FilterList';
|
|
9
|
-
export { TrendingChip } from './TrendingChip/TrendingChip';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { styled as e } from "@mui/material/styles";
|
|
2
|
+
import d from "./Unchecked.js";
|
|
3
|
+
const l = e(d)(({ theme: o }) => {
|
|
4
|
+
var r, a;
|
|
5
|
+
return {
|
|
6
|
+
backgroundColor: (r = o.vars) == null ? void 0 : r.palette.background.paper,
|
|
7
|
+
borderWidth: 8,
|
|
8
|
+
borderColor: (a = o.vars) == null ? void 0 : a.palette.primary.dark,
|
|
9
|
+
"input:hover ~ &": {
|
|
10
|
+
opacity: 0.5
|
|
11
|
+
},
|
|
12
|
+
".MuiRadio-colorNeutral &": {
|
|
13
|
+
borderColor: o.palette.neutral.main
|
|
14
|
+
},
|
|
15
|
+
".MuiRadio-colorSecondary &": {
|
|
16
|
+
borderColor: o.palette.secondary.main
|
|
17
|
+
},
|
|
18
|
+
".MuiRadio-colorInfo &": {
|
|
19
|
+
borderColor: o.palette.secondary.main
|
|
20
|
+
},
|
|
21
|
+
".MuiRadio-colorError &": {
|
|
22
|
+
borderColor: o.palette.error.main
|
|
23
|
+
},
|
|
24
|
+
".MuiRadio-colorSuccess &": {
|
|
25
|
+
borderColor: o.palette.success.main
|
|
26
|
+
},
|
|
27
|
+
".MuiRadio-colorWarning &": {
|
|
28
|
+
borderColor: o.palette.warning.main
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}), t = l;
|
|
32
|
+
export {
|
|
33
|
+
t as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { styled as n } from "@mui/material/styles";
|
|
2
|
+
const t = n("span")(({ theme: o }) => {
|
|
3
|
+
var r, a, l, e;
|
|
4
|
+
return {
|
|
5
|
+
borderRadius: "50%",
|
|
6
|
+
width: 24,
|
|
7
|
+
height: 24,
|
|
8
|
+
border: "2px solid",
|
|
9
|
+
borderColor: (r = o.vars) == null ? void 0 : r.palette.primary.light,
|
|
10
|
+
backgroundColor: (a = o.vars) == null ? void 0 : a.palette.background.paper,
|
|
11
|
+
".Mui-focusVisible &": {
|
|
12
|
+
outline: `2px auto ${(l = o.vars) == null ? void 0 : l.palette.secondary.light}`,
|
|
13
|
+
outlineOffset: 2
|
|
14
|
+
},
|
|
15
|
+
".MuiRadio-sizeSmall &": {
|
|
16
|
+
width: 20,
|
|
17
|
+
height: 20
|
|
18
|
+
},
|
|
19
|
+
"input:hover ~ &": {
|
|
20
|
+
opacity: 0.5
|
|
21
|
+
},
|
|
22
|
+
"input:disabled ~ &": {
|
|
23
|
+
boxShadow: "none",
|
|
24
|
+
background: (e = o.vars) == null ? void 0 : e.palette.background.alphaBrown
|
|
25
|
+
},
|
|
26
|
+
"label[color='neutral'] &": {
|
|
27
|
+
borderColor: o.palette.neutral.main
|
|
28
|
+
},
|
|
29
|
+
"label[color='secondary'] &": {
|
|
30
|
+
borderColor: o.palette.secondary.main
|
|
31
|
+
},
|
|
32
|
+
"label[color='info'] &": {
|
|
33
|
+
borderColor: o.palette.info.main
|
|
34
|
+
},
|
|
35
|
+
"label[color='error'] &": {
|
|
36
|
+
borderColor: o.palette.error.main
|
|
37
|
+
},
|
|
38
|
+
"label[color='success'] &": {
|
|
39
|
+
borderColor: o.palette.success.main
|
|
40
|
+
},
|
|
41
|
+
"label[color='warning'] &": {
|
|
42
|
+
borderColor: o.palette.warning.main
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}), d = t;
|
|
46
|
+
export {
|
|
47
|
+
d as default
|
|
48
|
+
};
|