qaema-ui 0.0.26 → 0.0.27
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/DropDownWithTable/DropDownWithTable.js +69 -64
- package/dist/components/DropDownWithTable/DropDownWithTable.types.d.ts +1 -0
- package/dist/styles/Dropdown.styles.d.ts +1 -0
- package/dist/styles/Dropdown.styles.js +18 -11
- package/package.json +1 -1
- package/dist/node_modules/react-bootstrap/esm/Spinner.js +0 -26
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { j as t } from "../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useRef as g, useState as v, useCallback as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { FaTimes as k, FaAngleDown as
|
|
5
|
-
import { useTheme as
|
|
6
|
-
import { HelperTextWrapper as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import Ce from "
|
|
13
|
-
import
|
|
14
|
-
const
|
|
2
|
+
import { useRef as g, useState as v, useCallback as re, useEffect as D } from "react";
|
|
3
|
+
import { createPortal as oe } from "react-dom";
|
|
4
|
+
import { FaTimes as k, FaAngleDown as le } from "../../node_modules/react-icons/fa/index.js";
|
|
5
|
+
import { useTheme as ie } from "styled-components";
|
|
6
|
+
import { HelperTextWrapper as se } from "../PhoneInputField.js";
|
|
7
|
+
import ae from "../SearchBar.js";
|
|
8
|
+
import ce from "../Spinner.js";
|
|
9
|
+
import de from "../Typography.js";
|
|
10
|
+
import ue from "../../hooks/useZIndex.js";
|
|
11
|
+
import { useQaemaCoreTranslation as fe } from "../../i18n/i18n.js";
|
|
12
|
+
import { StyledDropDownContainer as me, StyledlabelContainer as he, StyledDropDown as pe, StyledDropDownToggle as xe, StyledDropDownTitle as Se, IconsContainer as je, StyledDropDownMenu as we, SearchContainer as ye, StyledOptionsContainer as ge, SpinnerRow as ve, SelectedTagsContainer as Ce, SelectedTag as be } from "../../styles/Dropdown.styles.js";
|
|
13
|
+
import De from "./Table/Table.js";
|
|
14
|
+
const Me = (d) => {
|
|
15
15
|
const {
|
|
16
16
|
label: T,
|
|
17
|
-
options:
|
|
18
|
-
placeholder:
|
|
17
|
+
options: R,
|
|
18
|
+
placeholder: P = "Select Something",
|
|
19
19
|
optional: W = !1,
|
|
20
20
|
error: s = "",
|
|
21
21
|
disabled: S = !1,
|
|
@@ -26,21 +26,22 @@ const He = (d) => {
|
|
|
26
26
|
icon: F,
|
|
27
27
|
allowSearch: H,
|
|
28
28
|
searchHandler: M,
|
|
29
|
-
searchPlaceholder:
|
|
29
|
+
searchPlaceholder: N,
|
|
30
30
|
onToggle: i,
|
|
31
31
|
multiSelect: f = !1,
|
|
32
|
-
isLoading:
|
|
32
|
+
isLoading: B = !1,
|
|
33
33
|
currentSelectedOptions: h = [],
|
|
34
|
-
isInteractive:
|
|
34
|
+
isInteractive: E = !1,
|
|
35
35
|
//Table related props
|
|
36
36
|
columns: A,
|
|
37
37
|
isTableHeadVisible: V = !1,
|
|
38
38
|
getDisplayValue: y,
|
|
39
|
-
isRowDisabled: Q
|
|
40
|
-
|
|
39
|
+
isRowDisabled: Q,
|
|
40
|
+
rowClassName: X
|
|
41
|
+
} = d, p = ie(), { t: I } = fe(), C = g(null), a = g(null), Y = g(null), Z = g(d.currentSelectedOptions !== void 0), [u, b] = v(!1), [q, G] = v(0), [L, J] = v({ top: 0, left: 0 }), [l, x] = v(h), O = F ?? /* @__PURE__ */ t.jsx(t.Fragment, {}), K = ue("dropdown"), m = re(() => {
|
|
41
42
|
if (a != null && a.current) {
|
|
42
43
|
const e = a.current.getBoundingClientRect();
|
|
43
|
-
|
|
44
|
+
G(a.current.offsetWidth / 16), J({
|
|
44
45
|
top: e.bottom + window.scrollY,
|
|
45
46
|
left: e.left + window.scrollX
|
|
46
47
|
});
|
|
@@ -49,24 +50,24 @@ const He = (d) => {
|
|
|
49
50
|
D(() => (u && (m(), window.addEventListener("resize", m), window.addEventListener("scroll", m, !0)), () => {
|
|
50
51
|
window.removeEventListener("resize", m), window.removeEventListener("scroll", m, !0);
|
|
51
52
|
}), [u, m]), D(() => {
|
|
52
|
-
if (!
|
|
53
|
+
if (!Z.current) return;
|
|
53
54
|
(h.length !== l.length || h.some((n, o) => {
|
|
54
55
|
var c;
|
|
55
56
|
return n[r] !== ((c = l[o]) == null ? void 0 : c[r]);
|
|
56
57
|
})) && x(h);
|
|
57
58
|
}, [h]);
|
|
58
|
-
const
|
|
59
|
+
const U = (e, n, o, c = "default") => o ? p.colors.grey.n400 : e ? p.colors.state.error.n450 : n ? p.colors.primary.dark.n600 : c === "light-primary" ? p.colors.primary.purple.n450 : p.colors.grey.n300, $ = (e) => l.some((n) => typeof n == "object" && typeof e == "object" ? n[r] === e[r] : n.value === e.value), _ = (e) => {
|
|
59
60
|
if (f) {
|
|
60
|
-
const n =
|
|
61
|
+
const n = $(e);
|
|
61
62
|
let o;
|
|
62
63
|
n ? o = l.filter((c) => typeof c == "object" && typeof e == "object" ? c[r] !== e[r] : c.value !== e.value) : o = [...l, e], x(o), w(o);
|
|
63
64
|
} else
|
|
64
65
|
x([e]), w(e), b(!1), i == null || i(!1);
|
|
65
|
-
},
|
|
66
|
+
}, ee = (e) => {
|
|
66
67
|
const n = l.filter((o) => typeof o == "object" && typeof e == "object" ? o[r] !== e[r] : o.value !== e.value);
|
|
67
68
|
x(n), w(n);
|
|
68
|
-
},
|
|
69
|
-
if (e.length === 0) return
|
|
69
|
+
}, te = (e) => {
|
|
70
|
+
if (e.length === 0) return P;
|
|
70
71
|
if (!f) {
|
|
71
72
|
const n = e[0];
|
|
72
73
|
if (y)
|
|
@@ -76,7 +77,7 @@ const He = (d) => {
|
|
|
76
77
|
if (r)
|
|
77
78
|
return String(n == null ? void 0 : n[r]);
|
|
78
79
|
}
|
|
79
|
-
return `${e.length} ${
|
|
80
|
+
return `${e.length} ${I("SELECTED")}`;
|
|
80
81
|
};
|
|
81
82
|
D(() => {
|
|
82
83
|
const e = (n) => {
|
|
@@ -86,14 +87,14 @@ const He = (d) => {
|
|
|
86
87
|
document.removeEventListener("mousedown", e);
|
|
87
88
|
};
|
|
88
89
|
}, [u, i]);
|
|
89
|
-
const
|
|
90
|
-
return /* @__PURE__ */ t.jsxs(
|
|
91
|
-
T && /* @__PURE__ */ t.jsxs(
|
|
90
|
+
const ne = () => E || (s == null ? void 0 : s.length) === 0 ? null : /* @__PURE__ */ t.jsx(se, { error: s, children: s });
|
|
91
|
+
return /* @__PURE__ */ t.jsxs(me, { children: [
|
|
92
|
+
T && /* @__PURE__ */ t.jsxs(he, { children: [
|
|
92
93
|
/* @__PURE__ */ t.jsx("label", { children: T }),
|
|
93
|
-
W && /* @__PURE__ */ t.jsx("span", { children:
|
|
94
|
+
W && /* @__PURE__ */ t.jsx("span", { children: I("OPTIONAL") })
|
|
94
95
|
] }),
|
|
95
96
|
/* @__PURE__ */ t.jsxs(
|
|
96
|
-
|
|
97
|
+
pe,
|
|
97
98
|
{
|
|
98
99
|
show: u,
|
|
99
100
|
onToggle: () => {
|
|
@@ -102,20 +103,20 @@ const He = (d) => {
|
|
|
102
103
|
placement: "bottom-start",
|
|
103
104
|
autoClose: f ? "outside" : !0,
|
|
104
105
|
children: [
|
|
105
|
-
/* @__PURE__ */ t.jsx(
|
|
106
|
+
/* @__PURE__ */ t.jsx(xe, { disabled: S, ref: a, $valid: !s, $variant: d.variant || "default", children: /* @__PURE__ */ t.jsx(Se, { $valid: !s, $isInteractive: E, children: /* @__PURE__ */ t.jsxs("div", { className: "title-container", children: [
|
|
106
107
|
/* @__PURE__ */ t.jsxs("div", { className: "heading-container", children: [
|
|
107
|
-
z && typeof
|
|
108
|
+
z && typeof O == "function" && /* @__PURE__ */ t.jsx(O, {}),
|
|
108
109
|
/* @__PURE__ */ t.jsx(
|
|
109
|
-
|
|
110
|
+
de,
|
|
110
111
|
{
|
|
111
112
|
component: "span",
|
|
112
113
|
variant: "mdText",
|
|
113
|
-
color:
|
|
114
|
-
children:
|
|
114
|
+
color: U(s, l.length > 0, S, d.variant || "default"),
|
|
115
|
+
children: te(l)
|
|
115
116
|
}
|
|
116
117
|
)
|
|
117
118
|
] }),
|
|
118
|
-
/* @__PURE__ */ t.jsxs(
|
|
119
|
+
/* @__PURE__ */ t.jsxs(je, { children: [
|
|
119
120
|
!f && l.length > 0 && !S && /* @__PURE__ */ t.jsx(
|
|
120
121
|
k,
|
|
121
122
|
{
|
|
@@ -125,43 +126,47 @@ const He = (d) => {
|
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
),
|
|
128
|
-
!S && /* @__PURE__ */ t.jsx(
|
|
129
|
+
!S && /* @__PURE__ */ t.jsx(le, {})
|
|
129
130
|
] })
|
|
130
131
|
] }) }) }),
|
|
131
|
-
u &&
|
|
132
|
+
u && oe(
|
|
132
133
|
/* @__PURE__ */ t.jsxs(
|
|
133
|
-
|
|
134
|
+
we,
|
|
134
135
|
{
|
|
135
136
|
ref: C,
|
|
136
|
-
$menuWidth:
|
|
137
|
-
$zIndex:
|
|
137
|
+
$menuWidth: q,
|
|
138
|
+
$zIndex: K,
|
|
138
139
|
style: {
|
|
139
140
|
position: "fixed",
|
|
140
141
|
top: `${L.top}px`,
|
|
141
142
|
left: `${L.left}px`
|
|
142
143
|
},
|
|
143
144
|
children: [
|
|
144
|
-
H && /* @__PURE__ */ t.jsx(
|
|
145
|
-
/* @__PURE__ */ t.
|
|
146
|
-
|
|
145
|
+
H && /* @__PURE__ */ t.jsx(ye, { children: /* @__PURE__ */ t.jsx(ae, { placeholder: N, onSearch: M }) }),
|
|
146
|
+
/* @__PURE__ */ t.jsxs(
|
|
147
|
+
ge,
|
|
147
148
|
{
|
|
148
|
-
ref:
|
|
149
|
+
ref: Y,
|
|
149
150
|
onScroll: (e) => {
|
|
150
151
|
var n;
|
|
151
152
|
(n = d.onScroll) == null || n.call(d, e);
|
|
152
153
|
},
|
|
153
|
-
children:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ t.jsx(
|
|
156
|
+
De,
|
|
157
|
+
{
|
|
158
|
+
keyField: r,
|
|
159
|
+
data: R,
|
|
160
|
+
columns: A,
|
|
161
|
+
onRowClick: (e) => _(e),
|
|
162
|
+
isRowSelected: (e) => $(e),
|
|
163
|
+
isTableHeadVisible: V,
|
|
164
|
+
isRowDisabled: Q,
|
|
165
|
+
rowClassName: X
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
B && /* @__PURE__ */ t.jsx(ve, { children: /* @__PURE__ */ t.jsx(ce, {}) })
|
|
169
|
+
]
|
|
165
170
|
}
|
|
166
171
|
)
|
|
167
172
|
]
|
|
@@ -172,13 +177,13 @@ const He = (d) => {
|
|
|
172
177
|
]
|
|
173
178
|
}
|
|
174
179
|
),
|
|
175
|
-
f && l.length > 0 && /* @__PURE__ */ t.jsx(
|
|
180
|
+
f && l.length > 0 && /* @__PURE__ */ t.jsx(Ce, { children: l.map((e) => /* @__PURE__ */ t.jsxs(be, { children: [
|
|
176
181
|
y ? y(e) : String(j ? e[j] : e[r]),
|
|
177
|
-
/* @__PURE__ */ t.jsx(k, { onClick: () =>
|
|
182
|
+
/* @__PURE__ */ t.jsx(k, { onClick: () => ee(e) })
|
|
178
183
|
] }, String(e[r]))) }),
|
|
179
|
-
|
|
184
|
+
ne()
|
|
180
185
|
] });
|
|
181
186
|
};
|
|
182
187
|
export {
|
|
183
|
-
|
|
188
|
+
Me as default
|
|
184
189
|
};
|
|
@@ -35,6 +35,7 @@ export declare const StyledDropItem: import('styled-components/dist/types').ISty
|
|
|
35
35
|
}, {
|
|
36
36
|
$selected: boolean;
|
|
37
37
|
}>> & string & Omit<import('react-bootstrap/esm/helpers').BsPrefixRefForwardingComponent<"a", import('react-bootstrap').DropdownItemProps>, keyof import('react').Component<any, {}, any>>;
|
|
38
|
+
export declare const SpinnerRow: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
38
39
|
export declare const TypographyContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
39
40
|
export declare const IconsContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
40
41
|
export declare const SearchContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import r, { css as n } from "styled-components";
|
|
2
2
|
import { Scrollbar as i } from "./Scrollbar.styles.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import t from "../node_modules/react-bootstrap/esm/Dropdown.js";
|
|
4
|
+
import s from "../node_modules/react-bootstrap/esm/DropdownToggle.js";
|
|
5
5
|
import a from "../node_modules/react-bootstrap/esm/DropdownMenu.js";
|
|
6
6
|
import l from "../node_modules/react-bootstrap/esm/DropdownItem.js";
|
|
7
7
|
const x = r.div`
|
|
@@ -30,7 +30,7 @@ const x = r.div`
|
|
|
30
30
|
flex-wrap: wrap;
|
|
31
31
|
gap: ${({ theme: o }) => o.spacing.xs};
|
|
32
32
|
margin-top: ${({ theme: o }) => o.spacing.xs};
|
|
33
|
-
`,
|
|
33
|
+
`, w = r.div`
|
|
34
34
|
display: flex;
|
|
35
35
|
align-items: center;
|
|
36
36
|
background-color: ${({ theme: o }) => o.colors.grey.n100};
|
|
@@ -47,11 +47,11 @@ const x = r.div`
|
|
|
47
47
|
color: ${({ theme: o }) => o.colors.state.error.n450};
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
`,
|
|
50
|
+
`, u = r(t)`
|
|
51
51
|
width: 100%;
|
|
52
52
|
max-height: 3.5rem;
|
|
53
53
|
min-width: 5rem !important;
|
|
54
|
-
`, f = r(
|
|
54
|
+
`, f = r(s)`
|
|
55
55
|
width: 100%;
|
|
56
56
|
box-shadow: ${({ $valid: o }) => o ? "0px 1px 2px 0px rgba(0, 0, 0, 0.06), 0px 1px 3px 0px rgba(0, 0, 0, 0.1);" : "none"};
|
|
57
57
|
padding: 0px;
|
|
@@ -150,6 +150,12 @@ const x = r.div`
|
|
|
150
150
|
&:hover {
|
|
151
151
|
background-color: ${({ theme: o }) => o.colors.grey.n100};
|
|
152
152
|
}
|
|
153
|
+
`, k = r.div`
|
|
154
|
+
display: flex;
|
|
155
|
+
justify-content: center;
|
|
156
|
+
align-items: center;
|
|
157
|
+
padding: ${({ theme: o }) => o.spacing.sm};
|
|
158
|
+
width: 100%;
|
|
153
159
|
`;
|
|
154
160
|
r.div`
|
|
155
161
|
overflow: hidden;
|
|
@@ -157,13 +163,13 @@ r.div`
|
|
|
157
163
|
white-space: nowrap;
|
|
158
164
|
width: 100%;
|
|
159
165
|
`;
|
|
160
|
-
const
|
|
166
|
+
const z = r.div`
|
|
161
167
|
display: flex;
|
|
162
168
|
flex-direction: row;
|
|
163
169
|
align-items: center;
|
|
164
170
|
justify-content: flex-end;
|
|
165
171
|
gap: ${({ theme: o }) => o.spacing.xs};
|
|
166
|
-
`,
|
|
172
|
+
`, C = r.div`
|
|
167
173
|
display: flex;
|
|
168
174
|
align-items: center;
|
|
169
175
|
column-gap: 0.625rem;
|
|
@@ -171,11 +177,12 @@ const k = r.div`
|
|
|
171
177
|
padding: ${({ theme: o }) => o.spacing.xs} 1.25rem;
|
|
172
178
|
`;
|
|
173
179
|
export {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
180
|
+
z as IconsContainer,
|
|
181
|
+
C as SearchContainer,
|
|
182
|
+
w as SelectedTag,
|
|
177
183
|
h as SelectedTagsContainer,
|
|
178
|
-
|
|
184
|
+
k as SpinnerRow,
|
|
185
|
+
u as StyledDropDown,
|
|
179
186
|
x as StyledDropDownContainer,
|
|
180
187
|
v as StyledDropDownMenu,
|
|
181
188
|
b as StyledDropDownTitle,
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import i from "../../../_virtual/index.js";
|
|
2
|
-
import * as f from "react";
|
|
3
|
-
import { useBootstrapPrefix as c } from "./ThemeProvider.js";
|
|
4
|
-
import { j as d } from "../../../_virtual/jsx-runtime.js";
|
|
5
|
-
const x = /* @__PURE__ */ f.forwardRef(({
|
|
6
|
-
bsPrefix: r,
|
|
7
|
-
variant: e,
|
|
8
|
-
animation: t = "border",
|
|
9
|
-
size: o,
|
|
10
|
-
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
|
|
11
|
-
as: a = "div",
|
|
12
|
-
className: m,
|
|
13
|
-
...p
|
|
14
|
-
}, n) => {
|
|
15
|
-
r = c(r, "spinner");
|
|
16
|
-
const s = `${r}-${t}`;
|
|
17
|
-
return /* @__PURE__ */ d.jsx(a, {
|
|
18
|
-
ref: n,
|
|
19
|
-
...p,
|
|
20
|
-
className: i(m, s, o && `${s}-${o}`, e && `text-${e}`)
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
x.displayName = "Spinner";
|
|
24
|
-
export {
|
|
25
|
-
x as default
|
|
26
|
-
};
|