@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.
Files changed (87) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_commonjsHelpers.js +6 -0
  3. package/dist/_virtual/index.js +4 -0
  4. package/dist/client.d.ts +7 -0
  5. package/dist/client.js +16 -0
  6. package/dist/components/Logo/Logo.js +121 -0
  7. package/dist/components/Logo3d/Logo3d.js +61 -0
  8. package/dist/components/checkbox/Checked.js +47 -0
  9. package/dist/components/checkbox/Unchecked.js +70 -0
  10. package/dist/components/chip-list/ChipList.js +97 -0
  11. package/dist/components/container-grid/ContainerGrid.js +110 -0
  12. package/dist/components/date-picker/DatePicker/DatePicker.js +62 -0
  13. package/dist/components/date-picker/PeriodPicker/PeriodPicker.js +374 -0
  14. package/dist/components/date-picker/utils.js +27 -0
  15. package/dist/components/filters/Checked.js +26 -0
  16. package/dist/components/filters/FilterList.js +121 -0
  17. package/dist/components/filters/Unchecked.js +26 -0
  18. package/dist/components/index.d.ts +0 -9
  19. package/dist/components/radio/Checked.js +34 -0
  20. package/dist/components/radio/Unchecked.js +48 -0
  21. package/dist/components/trending-chip/TrendingChip.js +93 -0
  22. package/dist/helpers/suitCx.js +17 -0
  23. package/dist/helpers/utils.js +11 -0
  24. package/dist/hooks/useContainerDimension.js +23 -0
  25. package/dist/index.d.ts +3 -2
  26. package/dist/index.js +13 -37197
  27. package/dist/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js +42 -0
  28. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/addLeadingZeros.js +7 -0
  29. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js +7 -0
  30. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/formatters.js +515 -0
  31. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/lightFormatters.js +59 -0
  32. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/longFormatters.js +52 -0
  33. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +18 -0
  34. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js +11 -0
  35. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/protectedTokens.js +20 -0
  36. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constants.js +6 -0
  37. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js +8 -0
  38. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js +16 -0
  39. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/format.js +59 -0
  40. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDayOfYear.js +11 -0
  41. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeek.js +12 -0
  42. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js +15 -0
  43. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeek.js +12 -0
  44. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeekYear.js +17 -0
  45. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js +7 -0
  46. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameDay.js +14 -0
  47. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameMonth.js +13 -0
  48. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isSameYear.js +13 -0
  49. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js +9 -0
  50. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
  51. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +18 -0
  52. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js +31 -0
  53. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +15 -0
  54. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +70 -0
  55. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatLong.js +33 -0
  56. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
  57. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/localize.js +155 -0
  58. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/match.js +110 -0
  59. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js +21 -0
  60. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js +9 -0
  61. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js +8 -0
  62. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js +11 -0
  63. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js +11 -0
  64. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeekYear.js +13 -0
  65. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfYear.js +9 -0
  66. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js +8 -0
  67. package/dist/styles/alert/alert.js +70 -0
  68. package/dist/styles/button/button.js +195 -0
  69. package/dist/styles/card/card.js +16 -0
  70. package/dist/styles/checkbox/checkbox.js +46 -0
  71. package/dist/styles/chip/chip.js +115 -0
  72. package/dist/styles/colors.js +435 -0
  73. package/dist/styles/dialog/dialog.js +34 -0
  74. package/dist/styles/form/form.js +18 -0
  75. package/dist/styles/index.js +53 -0
  76. package/dist/styles/input/input.js +127 -0
  77. package/dist/styles/list/list.js +42 -0
  78. package/dist/styles/palette.js +150 -0
  79. package/dist/styles/radio/radio.js +37 -0
  80. package/dist/styles/slider/slider.js +55 -0
  81. package/dist/styles/switch/switch.js +63 -0
  82. package/dist/styles/tab/tab.js +70 -0
  83. package/dist/styles/tooltip/tooltip.js +19 -0
  84. package/dist/styles/typography.js +139 -0
  85. package/dist/themes.js +35 -0
  86. package/package.json +6 -1
  87. /package/dist/components/{TrendingChip → trending-chip}/TrendingChip.d.ts +0 -0
@@ -0,0 +1,47 @@
1
+ import { styled as C } from "@mui/material/styles";
2
+ import v from "./Unchecked.js";
3
+ import { primitives as h } from "../../styles/colors.js";
4
+ const x = (r, o) => `<svg xmlns='http://www.w3.org/2000/svg' width='${r}' height='${o}' viewBox='0 0 16 12' fill='none'><path d='M14.3333 1L5.16667 10.1667L1 6' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>`, p = (r, o) => `url("data:image/svg+xml;utf8,${encodeURIComponent(x(r, o))}")`, M = C(v)(({ theme: r }) => {
5
+ var o, a, e, l, n, t, c, i, d, s, u, g, b, k;
6
+ return {
7
+ backgroundColor: (o = r.vars) == null ? void 0 : o.palette.background.secondaryPaper,
8
+ backgroundImage: p(16, 12),
9
+ backgroundRepeat: "no-repeat",
10
+ backgroundPosition: "center",
11
+ borderWidth: 2,
12
+ borderColor: (a = r.vars) == null ? void 0 : a.palette.primary.light,
13
+ ".MuiCheckbox-root[variant='rounded'] &": {
14
+ borderRadius: h.borderRadius.full
15
+ },
16
+ ".MuiCheckbox-sizeSmall &": {
17
+ backgroundImage: p(12, 8)
18
+ },
19
+ ".MuiCheckbox-colorNeutral &": {
20
+ borderColor: (e = r.vars) == null ? void 0 : e.palette.neutral.main,
21
+ backgroundColor: (l = r.vars) == null ? void 0 : l.palette.neutral.light
22
+ },
23
+ ".MuiCheckbox-colorSecondary &": {
24
+ borderColor: (n = r.vars) == null ? void 0 : n.palette.secondary.main,
25
+ backgroundColor: (t = r.vars) == null ? void 0 : t.palette.background.alphaBrown
26
+ },
27
+ ".MuiCheckbox-colorInfo &": {
28
+ borderColor: (c = r.vars) == null ? void 0 : c.palette.info.main,
29
+ backgroundColor: (i = r.vars) == null ? void 0 : i.palette.info.lighter
30
+ },
31
+ ".MuiCheckbox-colorError &": {
32
+ borderColor: (d = r.vars) == null ? void 0 : d.palette.error.main,
33
+ backgroundColor: (s = r.vars) == null ? void 0 : s.palette.error.lighter
34
+ },
35
+ ".MuiCheckbox-colorSuccess &": {
36
+ borderColor: (u = r.vars) == null ? void 0 : u.palette.success.main,
37
+ backgroundColor: (g = r.vars) == null ? void 0 : g.palette.success.lighter
38
+ },
39
+ ".MuiCheckbox-colorWarning &": {
40
+ borderColor: (b = r.vars) == null ? void 0 : b.palette.warning.main,
41
+ backgroundColor: (k = r.vars) == null ? void 0 : k.palette.warning.lighter
42
+ }
43
+ };
44
+ }), y = M;
45
+ export {
46
+ y as default
47
+ };
@@ -0,0 +1,70 @@
1
+ import { styled as x } from "@mui/material/styles";
2
+ import { primitives as h } from "../../styles/colors.js";
3
+ const M = x("span")(({ theme: r }) => {
4
+ var o, a, e, l, c, i, n, t, u, d, s, b, p, k, C, g, v;
5
+ return {
6
+ borderRadius: h.borderRadius.default,
7
+ width: 24,
8
+ height: 24,
9
+ border: "2px solid",
10
+ borderColor: (o = r.vars) == null ? void 0 : o.palette.primary.light,
11
+ backgroundColor: (a = r.vars) == null ? void 0 : a.palette.background.paper,
12
+ ".MuiCheckbox-root[variant='rounded'] &": {
13
+ borderRadius: h.borderRadius.full
14
+ },
15
+ ".Mui-focusVisible &": {
16
+ outline: `2px auto ${(e = r.vars) == null ? void 0 : e.palette.neutral.lighter}`,
17
+ outlineOffset: 2
18
+ },
19
+ ".MuiCheckbox-sizeSmall &": {
20
+ width: 20,
21
+ height: 20
22
+ },
23
+ "input:hover ~ &": {
24
+ backgroundColor: (l = r.vars) == null ? void 0 : l.palette.background.secondaryPaper
25
+ },
26
+ "input:disabled ~ &": {
27
+ boxShadow: "none",
28
+ background: (c = r.vars) == null ? void 0 : c.palette.background.alphaBrown
29
+ },
30
+ ".MuiCheckbox-colorNeutral &": {
31
+ borderColor: (i = r.vars) == null ? void 0 : i.palette.neutral.main
32
+ },
33
+ ".MuiCheckbox-colorNeutral:hover &": {
34
+ backgroundColor: (n = r.vars) == null ? void 0 : n.palette.neutral.lighter
35
+ },
36
+ ".MuiCheckbox-colorSecondary &": {
37
+ borderColor: (t = r.vars) == null ? void 0 : t.palette.secondary.main
38
+ },
39
+ ".MuiCheckbox-colorSecondary:hover &": {
40
+ backgroundColor: (u = r.vars) == null ? void 0 : u.palette.background.alphaBrown
41
+ },
42
+ ".MuiCheckbox-colorInfo &": {
43
+ borderColor: (d = r.vars) == null ? void 0 : d.palette.info.main
44
+ },
45
+ ".MuiCheckbox-colorInfo:hover &": {
46
+ backgroundColor: (s = r.vars) == null ? void 0 : s.palette.info.lighter
47
+ },
48
+ ".MuiCheckbox-colorError &": {
49
+ borderColor: (b = r.vars) == null ? void 0 : b.palette.error.main
50
+ },
51
+ ".MuiCheckbox-colorError:hover &": {
52
+ backgroundColor: (p = r.vars) == null ? void 0 : p.palette.error.lighter
53
+ },
54
+ ".MuiCheckbox-colorSuccess &": {
55
+ borderColor: (k = r.vars) == null ? void 0 : k.palette.success.main
56
+ },
57
+ ".MuiCheckbox-colorSuccess:hover &": {
58
+ backgroundColor: (C = r.vars) == null ? void 0 : C.palette.success.lighter
59
+ },
60
+ ".MuiCheckbox-colorWarning &": {
61
+ borderColor: (g = r.vars) == null ? void 0 : g.palette.warning.main
62
+ },
63
+ ".MuiCheckbox-colorWarning:hover &": {
64
+ backgroundColor: (v = r.vars) == null ? void 0 : v.palette.warning.lighter
65
+ }
66
+ };
67
+ }), y = M;
68
+ export {
69
+ y as default
70
+ };
@@ -0,0 +1,97 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useState as C, useEffect as g } from "react";
3
+ import { suitCx as k } from "../../helpers/suitCx.js";
4
+ import { Box as w, Tooltip as R, Chip as L } from "@mui/material";
5
+ import { primitives as f } from "../../styles/colors.js";
6
+ const j = ({
7
+ options: b,
8
+ onSelect: d,
9
+ initialValue: o,
10
+ disabled: i,
11
+ dataTestId: p = "chipList",
12
+ size: m,
13
+ className: v
14
+ }) => {
15
+ const l = b.map((e) => ({
16
+ ...e,
17
+ label: e.label || e.value,
18
+ tooltip: e.tooltip
19
+ })) ?? [], [t, c] = C(o), s = k(
20
+ {
21
+ name: "ChipList",
22
+ states: ["disabled"]
23
+ },
24
+ {
25
+ disabled: i
26
+ },
27
+ v
28
+ ), h = (e) => {
29
+ c(e), d && d(e);
30
+ };
31
+ g(() => {
32
+ Promise.resolve().then(() => {
33
+ o && o !== t && c(o);
34
+ });
35
+ }, [o]);
36
+ const x = /* @__PURE__ */ a(
37
+ w,
38
+ {
39
+ role: "listbox",
40
+ className: s("periods"),
41
+ sx: {
42
+ backgroundColor: (e) => {
43
+ var r;
44
+ return (r = e.vars) == null ? void 0 : r.palette.background.alphaBrown;
45
+ },
46
+ borderRadius: f.borderRadius.full,
47
+ padding: 2,
48
+ display: "flex",
49
+ flexDirection: "row",
50
+ gap: 4,
51
+ ".MuiChip-icon": {
52
+ fill: (e) => {
53
+ var r;
54
+ return (r = e.vars) == null ? void 0 : r.palette.text.primary;
55
+ }
56
+ }
57
+ },
58
+ "data-testid": p + "_Options",
59
+ children: l == null ? void 0 : l.map((e, r) => /* @__PURE__ */ a(
60
+ "div",
61
+ {
62
+ className: s("periods-item"),
63
+ role: "option",
64
+ "aria-selected": e.value === t,
65
+ children: /* @__PURE__ */ a(R, { arrow: !0, placement: "top", title: e.tooltip ?? "", children: /* @__PURE__ */ a(
66
+ L,
67
+ {
68
+ sx: {
69
+ px: 2,
70
+ backgroundColor: (n) => {
71
+ var u;
72
+ return e.value === t ? (u = n.vars) == null ? void 0 : u.palette.background.default : "transparent";
73
+ },
74
+ borderRadius: f.borderRadius.full,
75
+ border: "none",
76
+ width: "auto"
77
+ },
78
+ size: m,
79
+ disabled: i,
80
+ label: e.label,
81
+ icon: e.icon,
82
+ "data-selected": e.value === t,
83
+ "data-value": e.value,
84
+ onClick: (n) => h(e.value)
85
+ }
86
+ ) })
87
+ },
88
+ "period-" + r
89
+ ))
90
+ }
91
+ );
92
+ return /* @__PURE__ */ a("div", { "data-testid": p, className: s(), children: x });
93
+ };
94
+ export {
95
+ j as ChipList,
96
+ j as default
97
+ };
@@ -0,0 +1,110 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { createContext as N, useState as C, useRef as w, useEffect as $, useContext as P } from "react";
3
+ import { suitCx as F } from "../../helpers/suitCx.js";
4
+ import { useContainerDimensions as W } from "../../hooks/useContainerDimension.js";
5
+ import { Box as G } from "@mui/material";
6
+ import { theme as x } from "../../styles/index.js";
7
+ const I = N(null), y = ({
8
+ spacing: s,
9
+ breakpoints: e,
10
+ className: r,
11
+ children: c,
12
+ sx: t
13
+ }) => {
14
+ const [i, n] = C(void 0), m = w(null), { width: o } = W(m), d = F(
15
+ {
16
+ name: "ContainerGrid",
17
+ modifiers: ["container", "size"]
18
+ },
19
+ { container: !0, size: i },
20
+ r
21
+ );
22
+ return $(() => {
23
+ Promise.resolve().then(() => {
24
+ var l, u, f, S, v, g, p, h, z;
25
+ o && (o >= Number.parseInt(
26
+ ((e == null ? void 0 : e.lg) ?? ((f = (u = (l = x) == null ? void 0 : l.breakpoints) == null ? void 0 : u.values) == null ? void 0 : f.lg) ?? 1200).toString()
27
+ ) ? n("lg") : o >= Number.parseInt(
28
+ ((e == null ? void 0 : e.md) ?? ((g = (v = (S = x) == null ? void 0 : S.breakpoints) == null ? void 0 : v.values) == null ? void 0 : g.md) ?? 900).toString()
29
+ ) ? n("md") : o >= Number.parseInt(
30
+ ((e == null ? void 0 : e.sm) ?? ((z = (h = (p = x) == null ? void 0 : p.breakpoints) == null ? void 0 : h.values) == null ? void 0 : z.sm) ?? 600).toString()
31
+ ) ? n("sm") : n("xs"));
32
+ });
33
+ }, [o]), /* @__PURE__ */ a(
34
+ I.Provider,
35
+ {
36
+ value: {
37
+ containerSizeFromContext: i,
38
+ spacingFromContext: s
39
+ },
40
+ children: /* @__PURE__ */ a(
41
+ G,
42
+ {
43
+ gap: `${s}px`,
44
+ sx: { display: "flex", flexWrap: "wrap", ...t },
45
+ className: d(),
46
+ ref: m,
47
+ children: c
48
+ }
49
+ )
50
+ }
51
+ );
52
+ }, R = ({
53
+ className: s,
54
+ children: e,
55
+ size: r,
56
+ sx: c
57
+ }) => {
58
+ const { containerSizeFromContext: t, spacingFromContext: i } = P(I), [n, m] = C(100), [o, d] = C(void 0), l = F(
59
+ {
60
+ name: "ContainerGrid-column",
61
+ modifiers: ["size"]
62
+ },
63
+ { size: o },
64
+ s
65
+ );
66
+ return $(() => {
67
+ Promise.resolve().then(() => {
68
+ if (t && o !== t) {
69
+ d(t);
70
+ const u = (r == null ? void 0 : r[t]) ?? 12, f = parseInt(`${u ?? 1}`);
71
+ m(Math.round(f / 12 * 100));
72
+ }
73
+ });
74
+ }, [t]), /* @__PURE__ */ a(
75
+ G,
76
+ {
77
+ sx: {
78
+ display: "block",
79
+ width: `calc(${n}% - ${i}px)`,
80
+ ...c
81
+ },
82
+ className: l(),
83
+ children: e
84
+ }
85
+ );
86
+ };
87
+ function q({
88
+ container: s,
89
+ spacing: e,
90
+ size: r,
91
+ breakpoints: c,
92
+ className: t,
93
+ children: i,
94
+ sx: n
95
+ }) {
96
+ const m = `${e ?? 0}`;
97
+ return s ? /* @__PURE__ */ a(
98
+ y,
99
+ {
100
+ className: t,
101
+ spacing: m,
102
+ sx: n,
103
+ breakpoints: c,
104
+ children: i
105
+ }
106
+ ) : /* @__PURE__ */ a(R, { className: t, size: r, sx: n, children: i });
107
+ }
108
+ export {
109
+ q as ContainerGrid
110
+ };
@@ -0,0 +1,62 @@
1
+ import { jsx as P } from "react/jsx-runtime";
2
+ import { useState as k, useMemo as x } from "react";
3
+ import { suitCx as v } from "../../../helpers/suitCx.js";
4
+ import { DatePicker as h } from "@mui/x-date-pickers/DatePicker";
5
+ const w = ({
6
+ label: a = void 0,
7
+ disabled: t = !1,
8
+ dataTestId: s = "DatePicker",
9
+ className: o,
10
+ value: i,
11
+ minDateErrorText: n,
12
+ maxDateErrorText: c,
13
+ errorText: e = "Your date is not valid",
14
+ size: l,
15
+ sx: m,
16
+ ...u
17
+ }) => {
18
+ const [r, d] = k(null), f = x(() => {
19
+ switch (r) {
20
+ case "maxDate":
21
+ return c ?? e;
22
+ case "minDate":
23
+ return n ?? e;
24
+ case "invalidDate":
25
+ return e;
26
+ default:
27
+ return null;
28
+ }
29
+ }, [r]), D = v(
30
+ {
31
+ name: "DatePicker",
32
+ modifiers: ["disabled"]
33
+ },
34
+ {
35
+ disabled: t
36
+ },
37
+ o
38
+ );
39
+ return /* @__PURE__ */ P(
40
+ h,
41
+ {
42
+ ...u,
43
+ onError: (p) => d(p),
44
+ value: i,
45
+ label: a,
46
+ slotProps: {
47
+ textField: {
48
+ helperText: f,
49
+ size: l
50
+ }
51
+ },
52
+ disabled: t,
53
+ className: D(),
54
+ "data-testid": s,
55
+ sx: m
56
+ }
57
+ );
58
+ };
59
+ export {
60
+ w as DatePicker,
61
+ w as default
62
+ };