@eyesee/ui-components 0.1.0 → 0.1.2
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 +291 -37
- package/dist/components/Button/Button.js +31 -30
- package/dist/components/Button/Button.module.scss.js +36 -34
- package/dist/components/Checkbox/Checkbox.js +18 -19
- package/dist/components/DropdownList/DropdownList.js +20 -17
- package/dist/components/Fields/InputField/InputField.module.scss.js +16 -16
- package/dist/components/Fields/SelectField/SelectField.js +216 -186
- package/dist/components/Fields/SelectField/useSelectFieldDropdownPosition.js +42 -0
- package/dist/components/Fields/TextField/TextField.module.scss.js +6 -6
- package/dist/components/ListItem/ListItem.js +21 -19
- package/dist/components/icons-v2/PackseeIcon.js +39 -0
- package/dist/components/icons-v2/createIcon.js +19 -15
- package/dist/components/icons-v2/index.js +134 -132
- package/dist/style.css +1 -1
- package/package.json +65 -56
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const _ = "
|
|
1
|
+
const _ = "_field_m5w59_1", n = "_lg_m5w59_5", c = "_md_m5w59_9", t = "_sm_m5w59_13", s = "_xs_m5w59_17", o = "_icon_m5w59_21", e = "_clickable_m5w59_27", m = "_content_m5w59_34", l = "_hiddenInput_m5w59_42", d = {
|
|
2
2
|
field: _,
|
|
3
3
|
lg: n,
|
|
4
|
-
md:
|
|
5
|
-
sm:
|
|
6
|
-
xs:
|
|
7
|
-
icon:
|
|
8
|
-
clickable:
|
|
9
|
-
content:
|
|
10
|
-
hiddenInput:
|
|
4
|
+
md: c,
|
|
5
|
+
sm: t,
|
|
6
|
+
xs: s,
|
|
7
|
+
icon: o,
|
|
8
|
+
clickable: e,
|
|
9
|
+
content: m,
|
|
10
|
+
hiddenInput: l
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
e as clickable,
|
|
14
|
+
m as content,
|
|
15
|
+
d as default,
|
|
16
16
|
_ as field,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
l as hiddenInput,
|
|
18
|
+
o as icon,
|
|
19
19
|
n as lg,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
c as md,
|
|
21
|
+
t as sm,
|
|
22
|
+
s as xs
|
|
23
23
|
};
|
|
@@ -1,220 +1,250 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import { DropdownList as
|
|
12
|
-
import { ExpandableItem as
|
|
13
|
-
import { renderOptionRow as
|
|
14
|
-
import { SelectFieldTags as
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import { jsx as n, jsxs as H, Fragment as ye } from "react/jsx-runtime";
|
|
2
|
+
import { useState as j, useRef as G, useLayoutEffect as xe, useEffect as Ie, useMemo as h } from "react";
|
|
3
|
+
import { createPortal as we } from "react-dom";
|
|
4
|
+
import Q from "./SelectField.module.scss.js";
|
|
5
|
+
import { createField as Oe } from "../InputFieldContainer.js";
|
|
6
|
+
import { InputFieldContent as J } from "../InputField/InputField.js";
|
|
7
|
+
import { ChevronDownIcon as Te } from "../../icons-v2/ChevronDownIcon.js";
|
|
8
|
+
import { ChevronUpIcon as be } from "../../icons-v2/ChevronUpIcon.js";
|
|
9
|
+
import { LoadingIcon as De } from "../../icons-v2/LoadingIcon.js";
|
|
10
|
+
import { SearchIcon as Ee } from "../../icons-v2/SearchIcon.js";
|
|
11
|
+
import { DropdownList as Fe } from "../../DropdownList/DropdownList.js";
|
|
12
|
+
import { ExpandableItem as Ce } from "../../ExpandableItem/ExpandableItem.js";
|
|
13
|
+
import { renderOptionRow as Re } from "./selectOptionRow.js";
|
|
14
|
+
import { SelectFieldTags as ke } from "./SelectFieldTags.js";
|
|
15
|
+
import { useSelectFieldDropdownPosition as Be } from "./useSelectFieldDropdownPosition.js";
|
|
16
|
+
import { normalizeSelectOptions as Le, getEffectiveSelectValue as Ae, getSelectedOptions as Ve, getSelectFieldDisplayValue as $e, filterOptionsByQuery as Y, toArrayValue as X, emitSelectChange as Me, filterSectionsByQuery as We, getNextToggleAllValues as ze, getResolvedListItemType as Ke, isOptionSelected as Ne, areAllOptionsSelected as je } from "./selectUtils.js";
|
|
17
|
+
const Qe = ({ isOpen: s }) => s ? /* @__PURE__ */ n(be, {}) : /* @__PURE__ */ n(Te, {}), He = ({
|
|
18
|
+
withSections: s,
|
|
19
|
+
sections: f,
|
|
20
|
+
flatOptionList: c,
|
|
21
|
+
searchValue: r,
|
|
22
|
+
listItemType: k,
|
|
23
|
+
value: i,
|
|
24
|
+
selectAllLabel: I,
|
|
25
|
+
onSelectOption: B,
|
|
26
|
+
onToggleAll: w
|
|
26
27
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
() =>
|
|
29
|
-
[
|
|
30
|
-
),
|
|
31
|
-
() =>
|
|
32
|
-
[
|
|
33
|
-
),
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
|
|
36
|
-
{ label:
|
|
28
|
+
const p = h(
|
|
29
|
+
() => We(f, r),
|
|
30
|
+
[f, r]
|
|
31
|
+
), O = h(
|
|
32
|
+
() => Y(c, r),
|
|
33
|
+
[c, r]
|
|
34
|
+
), L = (o) => Ne(i, o), y = (o, a = k, T = L, m = !1) => Re(o, a, T, B, w, m);
|
|
35
|
+
return /* @__PURE__ */ H(ye, { children: [
|
|
36
|
+
I ? y(
|
|
37
|
+
{ label: I },
|
|
37
38
|
"checkbox",
|
|
38
|
-
() =>
|
|
39
|
+
() => je(i, c),
|
|
39
40
|
!0
|
|
40
41
|
) : null,
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
s ? p.map((o) => /* @__PURE__ */ n(
|
|
43
|
+
Ce,
|
|
43
44
|
{
|
|
44
|
-
title:
|
|
45
|
+
title: o.sectionTitle,
|
|
45
46
|
defaultOpen: !0,
|
|
46
47
|
arrowPositionEnd: !0,
|
|
47
|
-
children:
|
|
48
|
+
children: o.options.map((a) => /* @__PURE__ */ n("div", { children: y(a) }, `${o.sectionTitle}-${String(a.value)}`))
|
|
48
49
|
},
|
|
49
|
-
|
|
50
|
-
)) :
|
|
50
|
+
o.sectionTitle
|
|
51
|
+
)) : O.map((o) => /* @__PURE__ */ n("div", { children: y(o) }, String(o.value)))
|
|
51
52
|
] });
|
|
52
|
-
},
|
|
53
|
-
id:
|
|
54
|
-
name:
|
|
55
|
-
value:
|
|
56
|
-
defaultValue:
|
|
57
|
-
placeholder:
|
|
58
|
-
disabled:
|
|
59
|
-
onChange:
|
|
53
|
+
}, Pe = ({
|
|
54
|
+
id: s,
|
|
55
|
+
name: f,
|
|
56
|
+
value: c,
|
|
57
|
+
defaultValue: r,
|
|
58
|
+
placeholder: k = "Select",
|
|
59
|
+
disabled: i = !1,
|
|
60
|
+
onChange: I = () => {
|
|
60
61
|
},
|
|
61
|
-
ariaLabel:
|
|
62
|
-
label:
|
|
63
|
-
inputProps:
|
|
64
|
-
options:
|
|
65
|
-
size:
|
|
66
|
-
startIcon:
|
|
67
|
-
onEndIconClick:
|
|
68
|
-
containerFieldClassName:
|
|
69
|
-
multiSelect:
|
|
70
|
-
tags:
|
|
71
|
-
tagsWrap:
|
|
72
|
-
search:
|
|
73
|
-
onSearchChange:
|
|
62
|
+
ariaLabel: B,
|
|
63
|
+
label: w,
|
|
64
|
+
inputProps: p = {},
|
|
65
|
+
options: O = [],
|
|
66
|
+
size: L = "lg",
|
|
67
|
+
startIcon: y,
|
|
68
|
+
onEndIconClick: o,
|
|
69
|
+
containerFieldClassName: a,
|
|
70
|
+
multiSelect: T = !1,
|
|
71
|
+
tags: m = !1,
|
|
72
|
+
tagsWrap: Z = !1,
|
|
73
|
+
search: _ = !1,
|
|
74
|
+
onSearchChange: A = () => {
|
|
74
75
|
},
|
|
75
|
-
onLoadMore:
|
|
76
|
-
optionsLoading:
|
|
77
|
-
selectAllLabel:
|
|
78
|
-
listItemType:
|
|
79
|
-
dir:
|
|
80
|
-
dropdownMaxHeight:
|
|
76
|
+
onLoadMore: ee,
|
|
77
|
+
optionsLoading: te = !1,
|
|
78
|
+
selectAllLabel: oe = null,
|
|
79
|
+
listItemType: ne = null,
|
|
80
|
+
dir: P = "down",
|
|
81
|
+
dropdownMaxHeight: ie
|
|
81
82
|
}) => {
|
|
82
|
-
const
|
|
83
|
-
multiSelect:
|
|
84
|
-
tags:
|
|
85
|
-
listItemType:
|
|
86
|
-
}), [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
const u = !!(T || m), re = !!(_ || m), le = !!(m && u), se = Ke({
|
|
84
|
+
multiSelect: T,
|
|
85
|
+
tags: m,
|
|
86
|
+
listItemType: ne
|
|
87
|
+
}), [g, V] = j(!1), [b, D] = j(""), E = G(null), $ = G(null), F = s ? `${s}-listbox` : void 0, [v, ce] = j(!1);
|
|
88
|
+
xe(() => {
|
|
89
|
+
var e;
|
|
90
|
+
ce(!!((e = E.current) != null && e.closest("#modal")));
|
|
91
|
+
}, []);
|
|
92
|
+
const l = Be({
|
|
93
|
+
open: g,
|
|
94
|
+
anchorRef: E,
|
|
95
|
+
dropdownRef: $,
|
|
96
|
+
dir: P,
|
|
97
|
+
fixed: v
|
|
98
|
+
}), ae = (l == null ? void 0 : l.resolvedDir) ?? P;
|
|
99
|
+
Ie(() => {
|
|
100
|
+
if (!g) return () => {
|
|
101
|
+
};
|
|
102
|
+
const e = (t) => {
|
|
103
|
+
var x, K;
|
|
104
|
+
(x = E.current) != null && x.contains(t.target) || v && ((K = $.current) != null && K.contains(t.target)) || (V(!1), D(""));
|
|
105
|
+
};
|
|
106
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
107
|
+
}, [g, v]);
|
|
90
108
|
const {
|
|
91
|
-
withSections:
|
|
92
|
-
sections:
|
|
93
|
-
options:
|
|
94
|
-
} =
|
|
95
|
-
() =>
|
|
96
|
-
[
|
|
97
|
-
),
|
|
98
|
-
() =>
|
|
99
|
-
[
|
|
100
|
-
),
|
|
101
|
-
() =>
|
|
102
|
-
[
|
|
103
|
-
),
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
|
|
109
|
+
withSections: de,
|
|
110
|
+
sections: fe,
|
|
111
|
+
options: d
|
|
112
|
+
} = h(() => Le(O), [O]), S = h(
|
|
113
|
+
() => Ae(c, r),
|
|
114
|
+
[c, r]
|
|
115
|
+
), U = h(
|
|
116
|
+
() => Ve(S, d),
|
|
117
|
+
[S, d]
|
|
118
|
+
), pe = $e(c, r, d), me = h(
|
|
119
|
+
() => Y(d, b),
|
|
120
|
+
[d, b]
|
|
121
|
+
), M = (e) => {
|
|
122
|
+
const t = u ? e : e[0] ?? "";
|
|
123
|
+
Me(I, t);
|
|
124
|
+
}, q = (e) => {
|
|
125
|
+
const t = X(S), R = t.map((N) => String(N)), x = String(e), he = R.includes(x) ? t.filter((N) => String(N) !== x) : [...t, e];
|
|
126
|
+
M(u ? he : [e]), u || (V(!1), D(""));
|
|
127
|
+
}, ue = (e) => {
|
|
128
|
+
if (i) return;
|
|
129
|
+
const t = X(S).filter((R) => String(R) !== String(e));
|
|
130
|
+
M(t);
|
|
131
|
+
}, ge = le && U.length > 0 ? /* @__PURE__ */ n(
|
|
132
|
+
ke,
|
|
115
133
|
{
|
|
116
|
-
options:
|
|
117
|
-
wrap:
|
|
118
|
-
disabled:
|
|
119
|
-
onRemove:
|
|
134
|
+
options: U,
|
|
135
|
+
wrap: Z,
|
|
136
|
+
disabled: i,
|
|
137
|
+
onRemove: ue
|
|
120
138
|
}
|
|
121
|
-
) : null,
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
if (
|
|
127
|
-
|
|
139
|
+
) : null, C = () => {
|
|
140
|
+
i || (V((e) => !e), D(""));
|
|
141
|
+
}, ve = () => {
|
|
142
|
+
u && M(ze(S, d));
|
|
143
|
+
}, Se = () => {
|
|
144
|
+
if (o) {
|
|
145
|
+
o();
|
|
128
146
|
return;
|
|
129
147
|
}
|
|
130
|
-
|
|
148
|
+
C();
|
|
131
149
|
};
|
|
132
|
-
|
|
150
|
+
let W;
|
|
151
|
+
v && l ? W = {
|
|
152
|
+
position: "fixed",
|
|
153
|
+
zIndex: 9999,
|
|
154
|
+
top: l.top,
|
|
155
|
+
bottom: l.bottom,
|
|
156
|
+
left: l.left,
|
|
157
|
+
minWidth: l.minWidth
|
|
158
|
+
} : v && (W = { position: "fixed", visibility: "hidden" });
|
|
159
|
+
const z = g ? /* @__PURE__ */ H(
|
|
160
|
+
Fe,
|
|
161
|
+
{
|
|
162
|
+
id: F,
|
|
163
|
+
listRef: $,
|
|
164
|
+
dir: ae,
|
|
165
|
+
maxHeight: ie,
|
|
166
|
+
onLoadMore: ee,
|
|
167
|
+
style: W,
|
|
168
|
+
children: [
|
|
169
|
+
re ? /* @__PURE__ */ n("div", { className: Q.search, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ n(
|
|
170
|
+
J,
|
|
171
|
+
{
|
|
172
|
+
id: F ? `${F}-search` : void 0,
|
|
173
|
+
name: f ? `${f}-search` : void 0,
|
|
174
|
+
value: b,
|
|
175
|
+
placeholder: "Search",
|
|
176
|
+
disabled: i,
|
|
177
|
+
ariaLabel: "Search options",
|
|
178
|
+
size: "sm",
|
|
179
|
+
onChange: (e) => {
|
|
180
|
+
D(e.target.value), A == null || A(e.target.value);
|
|
181
|
+
},
|
|
182
|
+
containerFieldClassName: a,
|
|
183
|
+
startIcon: /* @__PURE__ */ n(Ee, {}),
|
|
184
|
+
inputProps: {
|
|
185
|
+
onKeyDown: (e) => {
|
|
186
|
+
if (e.key !== "Enter") return;
|
|
187
|
+
const t = me[0];
|
|
188
|
+
t && q(t.value);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
) }) : null,
|
|
193
|
+
te ? /* @__PURE__ */ n("span", { className: Q.spinning, children: /* @__PURE__ */ n(De, {}) }) : /* @__PURE__ */ n(
|
|
194
|
+
He,
|
|
195
|
+
{
|
|
196
|
+
withSections: de,
|
|
197
|
+
sections: fe,
|
|
198
|
+
flatOptionList: d,
|
|
199
|
+
searchValue: b,
|
|
200
|
+
listItemType: se,
|
|
201
|
+
value: S,
|
|
202
|
+
selectAllLabel: u ? oe : null,
|
|
203
|
+
onSelectOption: q,
|
|
204
|
+
onToggleAll: ve
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
) : null;
|
|
210
|
+
return /* @__PURE__ */ H("div", { className: Q.wrapper, ref: E, children: [
|
|
133
211
|
/* @__PURE__ */ n(
|
|
134
|
-
|
|
212
|
+
J,
|
|
135
213
|
{
|
|
136
|
-
id:
|
|
137
|
-
name:
|
|
138
|
-
value:
|
|
139
|
-
placeholder:
|
|
140
|
-
disabled:
|
|
214
|
+
id: s,
|
|
215
|
+
name: f,
|
|
216
|
+
value: pe,
|
|
217
|
+
placeholder: k,
|
|
218
|
+
disabled: i,
|
|
141
219
|
onChange: () => {
|
|
142
220
|
},
|
|
143
|
-
startIcon:
|
|
144
|
-
endIcon:
|
|
145
|
-
onEndIconClick:
|
|
146
|
-
onFieldClick:
|
|
147
|
-
onEnter:
|
|
148
|
-
size:
|
|
149
|
-
ariaLabel:
|
|
150
|
-
label:
|
|
151
|
-
containerFieldClassName:
|
|
152
|
-
content:
|
|
221
|
+
startIcon: y,
|
|
222
|
+
endIcon: Qe({ isOpen: g }),
|
|
223
|
+
onEndIconClick: Se,
|
|
224
|
+
onFieldClick: C,
|
|
225
|
+
onEnter: C,
|
|
226
|
+
size: L,
|
|
227
|
+
ariaLabel: B ?? (w ? void 0 : "select field"),
|
|
228
|
+
label: w,
|
|
229
|
+
containerFieldClassName: a,
|
|
230
|
+
content: ge,
|
|
153
231
|
inputProps: {
|
|
154
232
|
readOnly: !0,
|
|
155
233
|
role: "combobox",
|
|
156
|
-
"aria-controls":
|
|
157
|
-
"aria-expanded":
|
|
234
|
+
"aria-controls": F,
|
|
235
|
+
"aria-expanded": g,
|
|
158
236
|
"aria-haspopup": "listbox",
|
|
159
|
-
...
|
|
237
|
+
...p,
|
|
160
238
|
onKeyDown: (e) => {
|
|
161
|
-
var
|
|
162
|
-
e.key === " " && !
|
|
239
|
+
var t;
|
|
240
|
+
e.key === " " && !i && (e.preventDefault(), C()), (t = p.onKeyDown) == null || t.call(p, e);
|
|
163
241
|
}
|
|
164
242
|
}
|
|
165
243
|
}
|
|
166
244
|
),
|
|
167
|
-
|
|
168
|
-
he,
|
|
169
|
-
{
|
|
170
|
-
id: w,
|
|
171
|
-
dir: Y,
|
|
172
|
-
maxHeight: Z,
|
|
173
|
-
onLoadMore: G,
|
|
174
|
-
children: [
|
|
175
|
-
_ ? /* @__PURE__ */ n("div", { className: V.search, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ n(
|
|
176
|
-
M,
|
|
177
|
-
{
|
|
178
|
-
id: w ? `${w}-search` : void 0,
|
|
179
|
-
name: p ? `${p}-search` : void 0,
|
|
180
|
-
value: I,
|
|
181
|
-
placeholder: "Search",
|
|
182
|
-
disabled: l,
|
|
183
|
-
ariaLabel: "Search options",
|
|
184
|
-
size: "sm",
|
|
185
|
-
onChange: (e) => {
|
|
186
|
-
O(e.target.value), k == null || k(e.target.value);
|
|
187
|
-
},
|
|
188
|
-
containerFieldClassName: c,
|
|
189
|
-
startIcon: /* @__PURE__ */ n(Se, {}),
|
|
190
|
-
inputProps: {
|
|
191
|
-
onKeyDown: (e) => {
|
|
192
|
-
if (e.key !== "Enter") return;
|
|
193
|
-
const o = le[0];
|
|
194
|
-
o && N(o.value);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
) }) : null,
|
|
199
|
-
J ? /* @__PURE__ */ n("span", { className: V.spinning, children: /* @__PURE__ */ n(ge, {}) }) : /* @__PURE__ */ n(
|
|
200
|
-
Ae,
|
|
201
|
-
{
|
|
202
|
-
withSections: te,
|
|
203
|
-
sections: oe,
|
|
204
|
-
flatOptionList: a,
|
|
205
|
-
searchValue: I,
|
|
206
|
-
listItemType: ee,
|
|
207
|
-
value: u,
|
|
208
|
-
selectAllLabel: d ? W : null,
|
|
209
|
-
onSelectOption: N,
|
|
210
|
-
onToggleAll: se
|
|
211
|
-
}
|
|
212
|
-
)
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
) : null
|
|
245
|
+
z && (v ? we(z, document.body) : z)
|
|
216
246
|
] });
|
|
217
|
-
},
|
|
247
|
+
}, ct = Oe(Pe);
|
|
218
248
|
export {
|
|
219
|
-
|
|
249
|
+
ct as SelectField
|
|
220
250
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useState as d, useLayoutEffect as w } from "react";
|
|
2
|
+
const f = 8, p = 320, g = () => parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--spacing--2xs")) || 4;
|
|
3
|
+
function h(s, l, o, a) {
|
|
4
|
+
var n;
|
|
5
|
+
const c = s.current;
|
|
6
|
+
if (!c) return null;
|
|
7
|
+
const i = g(), e = c.getBoundingClientRect(), r = ((n = l.current) == null ? void 0 : n.getBoundingClientRect().height) ?? p, m = r + i + f;
|
|
8
|
+
let t = o;
|
|
9
|
+
o === "down" && window.innerHeight - e.bottom < m && e.top >= r + i ? t = "up" : o === "up" && e.top < m && (t = "down");
|
|
10
|
+
const u = {
|
|
11
|
+
resolvedDir: t,
|
|
12
|
+
left: e.left,
|
|
13
|
+
minWidth: e.width
|
|
14
|
+
};
|
|
15
|
+
return a && (t === "down" ? u.top = e.bottom + i : u.bottom = window.innerHeight - e.top + i), u;
|
|
16
|
+
}
|
|
17
|
+
function L({
|
|
18
|
+
open: s,
|
|
19
|
+
anchorRef: l,
|
|
20
|
+
dropdownRef: o,
|
|
21
|
+
dir: a = "down",
|
|
22
|
+
fixed: c = !1
|
|
23
|
+
}) {
|
|
24
|
+
const [i, e] = d(null);
|
|
25
|
+
return w(() => {
|
|
26
|
+
if (!s)
|
|
27
|
+
return e(null), () => {
|
|
28
|
+
};
|
|
29
|
+
let r = 0;
|
|
30
|
+
const m = () => e(h(l, o, a, c)), t = () => {
|
|
31
|
+
cancelAnimationFrame(r), r = requestAnimationFrame(m);
|
|
32
|
+
};
|
|
33
|
+
t(), window.addEventListener("resize", t), window.addEventListener("scroll", t, !0);
|
|
34
|
+
const u = o.current, n = u && typeof ResizeObserver < "u" ? new ResizeObserver(t) : null;
|
|
35
|
+
return n == null || n.observe(u), () => {
|
|
36
|
+
cancelAnimationFrame(r), window.removeEventListener("resize", t), window.removeEventListener("scroll", t, !0), n == null || n.disconnect();
|
|
37
|
+
};
|
|
38
|
+
}, [s, l, o, a, c]), i;
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
L as useSelectFieldDropdownPosition
|
|
42
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const e = "
|
|
1
|
+
const e = "_field_1e7vo_1", t = "_input_1e7vo_7", n = "_expandableField_1e7vo_11", o = "_buttonWrapper_1e7vo_19", p = {
|
|
2
2
|
field: e,
|
|
3
3
|
input: t,
|
|
4
|
-
expandableField:
|
|
5
|
-
buttonWrapper:
|
|
4
|
+
expandableField: n,
|
|
5
|
+
buttonWrapper: o
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
o as buttonWrapper,
|
|
9
|
+
p as default,
|
|
10
|
+
n as expandableField,
|
|
11
11
|
e as field,
|
|
12
12
|
t as input
|
|
13
13
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsxs as x, jsx as e, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { EllipsisTooltip as
|
|
1
|
+
import { jsxs as x, jsx as e, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import A from "clsx";
|
|
3
|
+
import { EllipsisTooltip as y } from "../EllipsisTooltip/EllipsisTooltip.js";
|
|
4
4
|
import a from "./ListItem.module.scss.js";
|
|
5
5
|
const F = ({
|
|
6
|
-
item:
|
|
6
|
+
item: v = null,
|
|
7
7
|
controlItem: r = null,
|
|
8
8
|
customItem: n = null,
|
|
9
9
|
title: i = null,
|
|
10
10
|
description: s = null,
|
|
11
11
|
trailing: t = [],
|
|
12
12
|
trailingDisplay: c = "hover",
|
|
13
|
-
active:
|
|
14
|
-
onClick:
|
|
13
|
+
active: T = !1,
|
|
14
|
+
onClick: C,
|
|
15
15
|
verticalSpacing: p = "xs",
|
|
16
16
|
horizontalSpacing: m = "xs",
|
|
17
|
-
variant:
|
|
18
|
-
disabled: d = !1
|
|
17
|
+
variant: D = "fill",
|
|
18
|
+
disabled: d = !1,
|
|
19
|
+
role: w
|
|
19
20
|
}) => {
|
|
20
21
|
const o = (t == null ? void 0 : t.length) > 0, h = !!i, u = !!s, N = [
|
|
21
22
|
r && "auto",
|
|
@@ -26,34 +27,35 @@ const F = ({
|
|
|
26
27
|
return /* @__PURE__ */ x(
|
|
27
28
|
"div",
|
|
28
29
|
{
|
|
29
|
-
|
|
30
|
+
role: w,
|
|
31
|
+
className: A(a.listItem, a[D], d && a.disabled),
|
|
30
32
|
style: {
|
|
31
33
|
"--minHeight": !s && p === "none" ? "var(--scale--lg)" : "auto",
|
|
32
34
|
"--verticalSpacing": p === "none" ? "0px" : `var(--spacing--${p})`,
|
|
33
35
|
"--horizontalSpacing": m === "none" ? "0px" : `var(--spacing--${m})`,
|
|
34
36
|
"--gridTemplateColumns": N
|
|
35
37
|
},
|
|
36
|
-
"data-active":
|
|
38
|
+
"data-active": T || null,
|
|
37
39
|
onClick: d ? () => {
|
|
38
|
-
} :
|
|
40
|
+
} : C,
|
|
39
41
|
children: [
|
|
40
|
-
r && /* @__PURE__ */ e(
|
|
41
|
-
n && /* @__PURE__ */ e(
|
|
42
|
+
r && /* @__PURE__ */ e("div", { onClick: (l) => l.stopPropagation(), children: r }),
|
|
43
|
+
n && /* @__PURE__ */ e(b, { children: n }),
|
|
42
44
|
/* @__PURE__ */ x("div", { className: a.textWrapper, children: [
|
|
43
|
-
h && /* @__PURE__ */ e(
|
|
44
|
-
u && /* @__PURE__ */ e(
|
|
45
|
+
h && /* @__PURE__ */ e(y, { showArrow: !0, content: i, className: a.title, children: i }),
|
|
46
|
+
u && /* @__PURE__ */ e(y, { showArrow: !0, content: s, className: a.description, children: s })
|
|
45
47
|
] }),
|
|
46
48
|
o && /* @__PURE__ */ e("div", { className: a.trailing, children: t.map((l) => {
|
|
47
|
-
const
|
|
49
|
+
const k = (l == null ? void 0 : l.trailingDisplay) || c, j = (l == null ? void 0 : l.trailingDisplayOnSelectedItem) || "always", g = d || (l == null ? void 0 : l.disabled);
|
|
48
50
|
return /* @__PURE__ */ e(
|
|
49
51
|
"span",
|
|
50
52
|
{
|
|
51
|
-
"data-trailing-display":
|
|
52
|
-
"data-trailing-display-on-selected-item":
|
|
53
|
+
"data-trailing-display": k,
|
|
54
|
+
"data-trailing-display-on-selected-item": j,
|
|
53
55
|
"data-trailing-disabled": g || null,
|
|
54
56
|
onClick: ($) => {
|
|
55
57
|
var f;
|
|
56
|
-
$.stopPropagation(), !g && ((f = l == null ? void 0 : l.onClick) == null || f.call(l,
|
|
58
|
+
$.stopPropagation(), !g && ((f = l == null ? void 0 : l.onClick) == null || f.call(l, v));
|
|
57
59
|
},
|
|
58
60
|
children: l.icon
|
|
59
61
|
},
|