qaema-ui 0.0.56 → 0.0.57
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/_virtual/index7.js +2 -3
- package/dist/_virtual/index8.js +3 -2
- package/dist/components/Badge.js +14 -9
- package/dist/components/DropDown.js +88 -93
- package/dist/hooks/useBadgeVariant.js +3 -3
- package/dist/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/ReactUtils.js +1 -1
- package/dist/styles/Dropdown.styles.js +2 -2
- package/package.json +1 -1
package/dist/_virtual/index7.js
CHANGED
package/dist/_virtual/index8.js
CHANGED
package/dist/components/Badge.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as e } from "../_virtual/jsx-runtime.js";
|
|
2
2
|
import { IoClose as p } from "../node_modules/react-icons/io5/index.js";
|
|
3
3
|
import i from "styled-components";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import g from "../hooks/useBadgeVariant.js";
|
|
5
|
+
import m from "./Typography.js";
|
|
6
6
|
const u = i.div`
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: center;
|
|
@@ -12,7 +12,7 @@ const u = i.div`
|
|
|
12
12
|
background-color: ${({ bgColor: r, $variantStyles: o }) => r ?? o.backgroundColor};
|
|
13
13
|
gap: ${({ theme: r }) => r.spacing.xs};
|
|
14
14
|
height: 1.5rem;
|
|
15
|
-
`,
|
|
15
|
+
`, h = i.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
justify-content: center;
|
|
@@ -23,19 +23,24 @@ const u = i.div`
|
|
|
23
23
|
&:hover {
|
|
24
24
|
opacity: 0.8;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
svg {
|
|
27
|
+
width: ${({ theme: r }) => r.spacing.s} !important;
|
|
28
|
+
height: ${({ theme: r }) => r.spacing.s} !important;
|
|
29
|
+
color: ${({ $variantStyles: r }) => r.color} !important;
|
|
30
|
+
}
|
|
31
|
+
`, f = i.img`
|
|
27
32
|
width: 1.25rem;
|
|
28
33
|
height: 1.25rem;
|
|
29
34
|
border-radius: ${({ theme: r }) => r.borderRadius.circle};
|
|
30
35
|
object-fit: cover;
|
|
31
36
|
flex-shrink: 0;
|
|
32
|
-
`, v = ({ bgColor: r, color: o, label: s, weight:
|
|
33
|
-
const t =
|
|
37
|
+
`, v = ({ bgColor: r, color: o, label: s, weight: c, variant: d, onClose: a, children: l, image: n }) => {
|
|
38
|
+
const t = g(d ?? "default");
|
|
34
39
|
return /* @__PURE__ */ e.jsxs(u, { bgColor: r, $variantStyles: t, children: [
|
|
35
|
-
|
|
36
|
-
s && /* @__PURE__ */ e.jsx(
|
|
40
|
+
n && /* @__PURE__ */ e.jsx(f, { src: n, alt: "badge-image" }),
|
|
41
|
+
s && /* @__PURE__ */ e.jsx(m, { variant: "span", color: o ?? t.color, weight: c, children: s }),
|
|
37
42
|
l,
|
|
38
|
-
a && /* @__PURE__ */ e.jsx(
|
|
43
|
+
a && /* @__PURE__ */ e.jsx(h, { onClick: a, $variantStyles: t, children: /* @__PURE__ */ e.jsx(p, { color: o ?? t.color, size: "0.75rem" }) })
|
|
39
44
|
] });
|
|
40
45
|
};
|
|
41
46
|
export {
|
|
@@ -1,139 +1,147 @@
|
|
|
1
1
|
import { j as r } from "../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useRef as g, useState as
|
|
3
|
-
import { FaTimes as
|
|
2
|
+
import { useRef as g, useState as b, useCallback as Y, useEffect as w } from "react";
|
|
3
|
+
import { FaTimes as _, FaAngleDown as ee } from "../node_modules/react-icons/fa/index.js";
|
|
4
4
|
import { ImCheckboxChecked as re, ImCheckboxUnchecked as ne } from "../node_modules/react-icons/im/index.js";
|
|
5
5
|
import { useTheme as te } from "styled-components";
|
|
6
6
|
import le from "../hooks/useZIndex.js";
|
|
7
|
-
import { useQaemaCoreTranslation as
|
|
8
|
-
import { StyledDropDownContainer as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
7
|
+
import { useQaemaCoreTranslation as oe } from "../i18n/i18n.js";
|
|
8
|
+
import { StyledDropDownContainer as ae, StyledlabelContainer as se, StyledDropDown as ce, StyledDropDownToggle as ie, StyledDropDownTitle as ue, IconsContainer as de, StyledDropDownMenu as fe, SearchContainer as pe, StyledOptionsContainer as he, StyledDropItem as L } from "../styles/Dropdown.styles.js";
|
|
9
|
+
import ve from "./Badge.js";
|
|
10
|
+
import { HelperTextWrapper as xe } from "./PhoneInputField.js";
|
|
11
|
+
import je from "./SearchBar.js";
|
|
11
12
|
import me from "./Spinner.js";
|
|
12
|
-
import
|
|
13
|
-
const Le = (
|
|
13
|
+
import W from "./Typography.js";
|
|
14
|
+
const Le = (f) => {
|
|
14
15
|
const {
|
|
15
|
-
label:
|
|
16
|
-
options:
|
|
16
|
+
label: C,
|
|
17
|
+
options: y,
|
|
17
18
|
// value,
|
|
18
|
-
placeholder:
|
|
19
|
-
optional:
|
|
20
|
-
error:
|
|
21
|
-
disabled:
|
|
22
|
-
selectIdentifier:
|
|
23
|
-
keyIdentifier:
|
|
24
|
-
selectCallBack:
|
|
25
|
-
showLeadIcon:
|
|
26
|
-
icon:
|
|
27
|
-
allowSearch:
|
|
28
|
-
searchHandler:
|
|
29
|
-
searchPlaceholder:
|
|
30
|
-
onToggle:
|
|
31
|
-
multiSelect:
|
|
32
|
-
isLoading:
|
|
33
|
-
currentSelectedOptions:
|
|
34
|
-
isInteractive:
|
|
35
|
-
endIcon:
|
|
36
|
-
} =
|
|
19
|
+
placeholder: z = "Select Something",
|
|
20
|
+
optional: P = !1,
|
|
21
|
+
error: s = "",
|
|
22
|
+
disabled: p = !1,
|
|
23
|
+
selectIdentifier: B,
|
|
24
|
+
keyIdentifier: h = "id",
|
|
25
|
+
selectCallBack: x,
|
|
26
|
+
showLeadIcon: F,
|
|
27
|
+
icon: H,
|
|
28
|
+
allowSearch: M,
|
|
29
|
+
searchHandler: N,
|
|
30
|
+
searchPlaceholder: R,
|
|
31
|
+
onToggle: c,
|
|
32
|
+
multiSelect: i = !1,
|
|
33
|
+
isLoading: A = !1,
|
|
34
|
+
currentSelectedOptions: S = [],
|
|
35
|
+
isInteractive: D = !1,
|
|
36
|
+
endIcon: I
|
|
37
|
+
} = f, u = g(null), j = g(null), o = te(), { t: k } = oe(), Q = g(null), [l, v] = b(S), [d, O] = b(!1), [U, Z] = b(0), T = H ?? /* @__PURE__ */ r.jsx(r.Fragment, {}), q = le("dropdown"), m = Y(() => {
|
|
37
38
|
var e, n;
|
|
38
|
-
(e =
|
|
39
|
+
(e = u == null ? void 0 : u.current) != null && e.offsetWidth && j.current && Z(((n = u.current) == null ? void 0 : n.offsetWidth) / 16);
|
|
39
40
|
}, []);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const n =
|
|
41
|
+
w(() => (d && (m(), window.addEventListener("resize", m)), () => window.removeEventListener("resize", m)), [d, m]), w(() => {
|
|
42
|
+
v(S);
|
|
43
|
+
}, [S]);
|
|
44
|
+
const G = (e, n, t, a = "default") => t ? o.colors.grey.n400 : e ? o.colors.state.error.n450 : n ? o.colors.primary.dark.n600 : a === "light-primary" ? o.colors.primary.purple.n450 : o.colors.grey.n300, $ = (e) => l.some((n) => typeof n.value == "object" && typeof e.value == "object" ? n.value[h] === e.value[h] : n.value === e.value), J = (e) => {
|
|
45
|
+
if (i) {
|
|
46
|
+
const n = $(e);
|
|
46
47
|
let t;
|
|
47
|
-
n ? t =
|
|
48
|
+
n ? t = l.filter((a) => typeof a.value == "object" && typeof e.value == "object" ? a.value[h] !== e.value[h] : a.value !== e.value) : t = [...l, e], v(t), x(t.map((a) => a.value));
|
|
48
49
|
} else
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
const n =
|
|
52
|
-
|
|
53
|
-
},
|
|
50
|
+
v([e]), x(e.value);
|
|
51
|
+
}, K = (e) => {
|
|
52
|
+
const n = l.filter((t) => typeof t.value == "object" && typeof e.value == "object" ? t.value[h] !== e.value[h] : t.value !== e.value);
|
|
53
|
+
v(n), x(n.map((t) => t.value));
|
|
54
|
+
}, V = () => {
|
|
54
55
|
var e;
|
|
55
|
-
return
|
|
56
|
+
return l.length === 0 ? z : i ? `${l.length} ${k("SELECTED")}` : (e = l[0]) == null ? void 0 : e.label;
|
|
56
57
|
};
|
|
57
|
-
|
|
58
|
+
w(() => {
|
|
58
59
|
const e = (n) => {
|
|
59
|
-
|
|
60
|
+
j.current && u.current && !j.current.contains(n.target) && !u.current.contains(n.target) && (O(!1), c == null || c(!1));
|
|
60
61
|
};
|
|
61
62
|
return d && document.addEventListener("mousedown", e), () => {
|
|
62
63
|
document.removeEventListener("mousedown", e);
|
|
63
64
|
};
|
|
64
|
-
}, [d,
|
|
65
|
-
const
|
|
66
|
-
return /* @__PURE__ */ r.jsxs(
|
|
67
|
-
|
|
68
|
-
/* @__PURE__ */ r.jsx("label", { children:
|
|
69
|
-
|
|
65
|
+
}, [d, c]);
|
|
66
|
+
const X = () => D ? null : /* @__PURE__ */ r.jsx(xe, { error: s || "", children: s && s });
|
|
67
|
+
return /* @__PURE__ */ r.jsxs(ae, { children: [
|
|
68
|
+
C && /* @__PURE__ */ r.jsxs(se, { children: [
|
|
69
|
+
/* @__PURE__ */ r.jsx("label", { children: C }),
|
|
70
|
+
P && /* @__PURE__ */ r.jsx("span", { children: k("OPTIONAL") })
|
|
70
71
|
] }),
|
|
71
72
|
/* @__PURE__ */ r.jsxs(
|
|
72
73
|
ce,
|
|
73
74
|
{
|
|
74
75
|
show: d,
|
|
75
76
|
onToggle: () => {
|
|
76
|
-
|
|
77
|
+
c == null || c(!d), O((e) => !e);
|
|
77
78
|
},
|
|
78
79
|
placement: "bottom-start",
|
|
79
|
-
autoClose:
|
|
80
|
+
autoClose: i ? "outside" : !0,
|
|
80
81
|
children: [
|
|
81
|
-
/* @__PURE__ */ r.jsx(
|
|
82
|
+
/* @__PURE__ */ r.jsx(ie, { disabled: p, ref: u, $valid: !s, $variant: f.variant || "default", children: /* @__PURE__ */ r.jsx(ue, { $valid: !s, $isInteractive: D, $hasDyncWidth: !p, children: /* @__PURE__ */ r.jsxs("div", { className: "title-container", children: [
|
|
82
83
|
/* @__PURE__ */ r.jsxs("div", { className: "heading-container", children: [
|
|
83
|
-
|
|
84
|
-
/* @__PURE__ */ r.jsx(
|
|
85
|
-
|
|
84
|
+
F && typeof T == "function" && /* @__PURE__ */ r.jsx(T, {}),
|
|
85
|
+
i && l.length > 0 ? /* @__PURE__ */ r.jsx(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
style: { display: "flex", gap: o.spacing.sm, alignItems: "center", flexWrap: "wrap" },
|
|
89
|
+
onClick: (e) => e.stopPropagation(),
|
|
90
|
+
children: l.map((e) => /* @__PURE__ */ r.jsx(ve, { variant: "black", label: e.label, onClose: () => K(e) }, e.label))
|
|
91
|
+
}
|
|
92
|
+
) : /* @__PURE__ */ r.jsx(
|
|
93
|
+
W,
|
|
86
94
|
{
|
|
87
95
|
component: "span",
|
|
88
96
|
variant: "mdText",
|
|
89
|
-
color:
|
|
90
|
-
children:
|
|
97
|
+
color: G(s, l.length > 0, p, f.variant || "default"),
|
|
98
|
+
children: V()
|
|
91
99
|
}
|
|
92
100
|
)
|
|
93
101
|
] }),
|
|
94
|
-
(
|
|
95
|
-
|
|
96
|
-
!
|
|
97
|
-
|
|
102
|
+
(I || !p) && /* @__PURE__ */ r.jsxs(de, { children: [
|
|
103
|
+
I,
|
|
104
|
+
!i && l.length > 0 && !p && /* @__PURE__ */ r.jsx(
|
|
105
|
+
_,
|
|
98
106
|
{
|
|
99
107
|
style: { cursor: "pointer", marginLeft: "0.5rem" },
|
|
100
108
|
onClick: (e) => {
|
|
101
|
-
e.stopPropagation(),
|
|
109
|
+
e.stopPropagation(), v([]), x(i ? [] : "");
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
112
|
),
|
|
105
|
-
!
|
|
113
|
+
!p && /* @__PURE__ */ r.jsx(ee, { color: s ? o.colors.state.error.n450 : o.colors.grey.n300 })
|
|
106
114
|
] })
|
|
107
115
|
] }) }) }),
|
|
108
|
-
d && /* @__PURE__ */ r.jsxs(fe, { ref:
|
|
109
|
-
|
|
116
|
+
d && /* @__PURE__ */ r.jsxs(fe, { ref: j, $menuWidth: U, $zIndex: q, children: [
|
|
117
|
+
M && /* @__PURE__ */ r.jsx(pe, { children: /* @__PURE__ */ r.jsx(je, { placeholder: R, onSearch: N }) }),
|
|
110
118
|
/* @__PURE__ */ r.jsxs(
|
|
111
|
-
|
|
119
|
+
he,
|
|
112
120
|
{
|
|
113
|
-
ref:
|
|
121
|
+
ref: Q,
|
|
114
122
|
onScroll: (e) => {
|
|
115
123
|
var n;
|
|
116
|
-
(n =
|
|
124
|
+
(n = f.onScroll) == null || n.call(f, e);
|
|
117
125
|
},
|
|
118
126
|
children: [
|
|
119
|
-
|
|
120
|
-
var t,
|
|
121
|
-
const n =
|
|
127
|
+
y == null ? void 0 : y.map((e) => {
|
|
128
|
+
var t, a, E;
|
|
129
|
+
const n = $(e);
|
|
122
130
|
return /* @__PURE__ */ r.jsxs(
|
|
123
|
-
|
|
131
|
+
L,
|
|
124
132
|
{
|
|
125
|
-
onClick: () =>
|
|
133
|
+
onClick: () => J(e),
|
|
126
134
|
$selected: n,
|
|
127
135
|
children: [
|
|
128
|
-
|
|
136
|
+
i && (n ? /* @__PURE__ */ r.jsx(re, { color: o.colors.primary.purple.n500 }) : /* @__PURE__ */ r.jsx(ne, { color: o.colors.primary.purple.n450 })),
|
|
129
137
|
" ",
|
|
130
|
-
/* @__PURE__ */ r.jsx(
|
|
138
|
+
/* @__PURE__ */ r.jsx(W, { variant: "smText", children: e == null ? void 0 : e.label })
|
|
131
139
|
]
|
|
132
140
|
},
|
|
133
|
-
typeof (e == null ? void 0 : e.value) == "object" && (e == null ? void 0 : e.value) !== null ? (
|
|
141
|
+
typeof (e == null ? void 0 : e.value) == "object" && (e == null ? void 0 : e.value) !== null ? (a = (t = e == null ? void 0 : e.value) == null ? void 0 : t[B]) == null ? void 0 : a.toString() : (E = e == null ? void 0 : e.value) == null ? void 0 : E.toString()
|
|
134
142
|
);
|
|
135
143
|
}),
|
|
136
|
-
|
|
144
|
+
A && /* @__PURE__ */ r.jsx(L, { $selected: !1, children: /* @__PURE__ */ r.jsx(me, {}) })
|
|
137
145
|
]
|
|
138
146
|
}
|
|
139
147
|
)
|
|
@@ -141,20 +149,7 @@ const Le = (i) => {
|
|
|
141
149
|
]
|
|
142
150
|
}
|
|
143
151
|
),
|
|
144
|
-
|
|
145
|
-
var n, t, l;
|
|
146
|
-
return /* @__PURE__ */ r.jsxs(
|
|
147
|
-
je,
|
|
148
|
-
{
|
|
149
|
-
children: [
|
|
150
|
-
e.label,
|
|
151
|
-
/* @__PURE__ */ r.jsx(W, { onClick: () => V(e) })
|
|
152
|
-
]
|
|
153
|
-
},
|
|
154
|
-
typeof (e == null ? void 0 : e.value) == "object" ? (t = (n = e == null ? void 0 : e.value) == null ? void 0 : n[D]) == null ? void 0 : t.toString() : (l = e == null ? void 0 : e.value) == null ? void 0 : l.toString()
|
|
155
|
-
);
|
|
156
|
-
}) }),
|
|
157
|
-
Y()
|
|
152
|
+
X()
|
|
158
153
|
] });
|
|
159
154
|
};
|
|
160
155
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo as a } from "react";
|
|
2
2
|
import { useTheme as p } from "styled-components";
|
|
3
|
-
const
|
|
3
|
+
const u = (n) => {
|
|
4
4
|
const r = p(), e = a(() => {
|
|
5
5
|
const o = (l, s, c) => ({
|
|
6
6
|
backgroundColor: l,
|
|
@@ -15,11 +15,11 @@ const y = (n) => {
|
|
|
15
15
|
pink: o(r.colors.secondary.pink.n100, r.colors.secondary.pink.n450),
|
|
16
16
|
yellow: o(r.colors.secondary.orange.n100, r.colors.secondary.orange.n500),
|
|
17
17
|
green: o(r.colors.primary.green.n100, r.colors.primary.green.n500),
|
|
18
|
-
black: o(r.colors.grey.n100, r.colors.grey.n650)
|
|
18
|
+
black: o(r.colors.grey.n100, r.colors.grey.n650, r.colors.grey.n200)
|
|
19
19
|
};
|
|
20
20
|
}, [r]);
|
|
21
21
|
return e[n] ?? e.default;
|
|
22
22
|
};
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
u as default
|
|
25
25
|
};
|
|
@@ -4,7 +4,7 @@ import P from "../../../../_virtual/isString.js";
|
|
|
4
4
|
import D from "../../../../_virtual/isFunction.js";
|
|
5
5
|
import j from "../../../../_virtual/isObject.js";
|
|
6
6
|
import { Children as p, isValidElement as w } from "react";
|
|
7
|
-
import { r as B } from "../../../../_virtual/
|
|
7
|
+
import { r as B } from "../../../../_virtual/index8.js";
|
|
8
8
|
import { isNumber as b } from "./DataUtils.js";
|
|
9
9
|
import { shallowEqual as d } from "./ShallowEqual.js";
|
|
10
10
|
import { SVGElementPropKeys as G, EventKeys as F, FilteredElementKeyMap as s } from "./types.js";
|
|
@@ -106,7 +106,7 @@ const x = r.div`
|
|
|
106
106
|
align-items: center;
|
|
107
107
|
gap: ${({ theme: o }) => `${o.spacing.s}`};
|
|
108
108
|
width: ${({ $hasDyncWidth: o }) => o ? "calc(100% - 2.688rem)" : "100%"};
|
|
109
|
-
span {
|
|
109
|
+
> span {
|
|
110
110
|
display: block;
|
|
111
111
|
width: 100%;
|
|
112
112
|
margin: 0px;
|
|
@@ -115,7 +115,7 @@ const x = r.div`
|
|
|
115
115
|
text-overflow: ellipsis;
|
|
116
116
|
text-align: start;
|
|
117
117
|
}
|
|
118
|
-
svg {
|
|
118
|
+
> svg {
|
|
119
119
|
width: 1.5rem;
|
|
120
120
|
height: 1.5rem;
|
|
121
121
|
color: ${({ theme: o, $valid: e }) => `${e ? o.colors.grey.n300 : o.colors.state.error.n450}`} !important;
|