@iress-oss/ids-components 6.0.0-alpha.12 → 6.0.0-alpha.13
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.
|
@@ -1,133 +1,137 @@
|
|
|
1
|
-
import { jsx as e, jsxs as n, Fragment as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { filter as
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as re } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as oe, useRef as se, useMemo as R, useState as I, useImperativeHandle as ie } from "react";
|
|
3
|
+
import { c as ae } from "../../cx-DN21T1EH.js";
|
|
4
|
+
import { filter as ne } from "./Filter.styles.js";
|
|
5
|
+
import { s as le } from "../../factory-CsinCTPr.js";
|
|
6
|
+
import { s as me } from "../../is-valid-prop-DweT-eOL.js";
|
|
5
7
|
import { propagateTestid as o } from "../../helpers/utility/propagateTestid.js";
|
|
6
|
-
import { IressPopover as
|
|
8
|
+
import { IressPopover as pe } from "../Popover/Popover.js";
|
|
7
9
|
import "../Popover/Popover.styles.js";
|
|
8
10
|
import "../Popover/InputPopover/InputPopover.js";
|
|
9
11
|
import "../Popover/hooks/useFloatingPopover.js";
|
|
10
|
-
import { I as
|
|
12
|
+
import { I as ce } from "../../Button-ZGbOkyOo.js";
|
|
11
13
|
import "../Button/CloseButton/CloseButton.js";
|
|
12
|
-
import { useRichSelectState as
|
|
14
|
+
import { useRichSelectState as de } from "../RichSelect/hooks/useRichSelectState.js";
|
|
13
15
|
import "../../Autocomplete-DUsna_OY.js";
|
|
14
16
|
import "../RichSelect/SelectBody/SelectBody.js";
|
|
15
17
|
import "../RichSelect/SelectCreate/SelectCreate.js";
|
|
16
18
|
import "../RichSelect/SelectHeading/SelectHeading.js";
|
|
17
19
|
import "../RichSelect/SelectLabel/SelectLabel.js";
|
|
18
|
-
import { IressSelectMenu as
|
|
20
|
+
import { IressSelectMenu as ue } from "../RichSelect/SelectMenu/SelectMenu.js";
|
|
19
21
|
import "../RichSelect/SelectSearch/SelectSearch.js";
|
|
20
22
|
import "../RichSelect/SelectSearchInput/SelectSearchInput.js";
|
|
21
23
|
import "../RichSelect/SelectTags/SelectTags.js";
|
|
22
24
|
import "../Autocomplete/Autocomplete.styles.js";
|
|
23
|
-
import { useAutocompleteSearch as
|
|
24
|
-
import { IressPanel as
|
|
25
|
+
import { useAutocompleteSearch as fe } from "../Autocomplete/hooks/useAutocompleteSearch.js";
|
|
26
|
+
import { IressPanel as he } from "../Panel/Panel.js";
|
|
25
27
|
import "../Panel/Panel.styles.js";
|
|
26
|
-
import { useFilterFlags as
|
|
27
|
-
import { useIdIfNeeded as
|
|
28
|
-
import { FilterSearch as
|
|
29
|
-
import { IressDivider as
|
|
28
|
+
import { useFilterFlags as ve } from "./hooks/useFilterFlags.js";
|
|
29
|
+
import { useIdIfNeeded as ge } from "../../hooks/useIdIfNeeded.js";
|
|
30
|
+
import { FilterSearch as ye } from "./components/FilterSearch.js";
|
|
31
|
+
import { IressDivider as Fe } from "../Divider/Divider.js";
|
|
30
32
|
import "../Divider/Divider.styles.js";
|
|
31
|
-
import { FilterResetButton as
|
|
32
|
-
import { FilterLabel as
|
|
33
|
-
import { IressIcon as
|
|
33
|
+
import { FilterResetButton as be } from "./components/FilterResetButton.js";
|
|
34
|
+
import { FilterLabel as Se } from "./components/FilterLabel.js";
|
|
35
|
+
import { IressIcon as w } from "../Icon/Icon.js";
|
|
34
36
|
import "../Icon/Icon.styles.js";
|
|
35
|
-
import { GlobalCSSClass as
|
|
36
|
-
import { FilterResultsDescriptor as
|
|
37
|
-
|
|
38
|
-
const w = {
|
|
37
|
+
import { GlobalCSSClass as Ce } from "../../enums.js";
|
|
38
|
+
import { FilterResultsDescriptor as Pe } from "./components/FilterResultsDescriptor.js";
|
|
39
|
+
const N = {
|
|
39
40
|
align: "bottom-start"
|
|
40
41
|
}, Re = ({
|
|
41
|
-
children:
|
|
42
|
-
className:
|
|
42
|
+
children: x,
|
|
43
|
+
className: D,
|
|
43
44
|
"data-testid": t,
|
|
44
|
-
debounceThreshold:
|
|
45
|
+
debounceThreshold: A,
|
|
45
46
|
defaultValue: h,
|
|
46
|
-
id:
|
|
47
|
-
initialOptions:
|
|
48
|
-
inputProps:
|
|
47
|
+
id: O,
|
|
48
|
+
initialOptions: Q,
|
|
49
|
+
inputProps: _ = {
|
|
49
50
|
clearable: !0,
|
|
50
|
-
prepend: /* @__PURE__ */ e(
|
|
51
|
+
prepend: /* @__PURE__ */ e(w, { name: "search" })
|
|
51
52
|
},
|
|
52
|
-
limitDesktop:
|
|
53
|
-
limitMobile:
|
|
54
|
-
label:
|
|
53
|
+
limitDesktop: L = 12,
|
|
54
|
+
limitMobile: M = 6,
|
|
55
|
+
label: j,
|
|
55
56
|
multiSelect: s,
|
|
56
|
-
onChange:
|
|
57
|
-
onReset:
|
|
57
|
+
onChange: k,
|
|
58
|
+
onReset: E,
|
|
58
59
|
options: i,
|
|
59
60
|
popoverProps: {
|
|
60
|
-
footer:
|
|
61
|
-
header:
|
|
62
|
-
...
|
|
63
|
-
} =
|
|
61
|
+
footer: H,
|
|
62
|
+
header: W,
|
|
63
|
+
...q
|
|
64
|
+
} = N,
|
|
64
65
|
searchable: v,
|
|
65
66
|
searchNoResultsText: g,
|
|
66
|
-
selectedOptionsText:
|
|
67
|
-
value:
|
|
67
|
+
selectedOptionsText: G,
|
|
68
|
+
value: U,
|
|
68
69
|
visibleResetButton: l,
|
|
69
|
-
...
|
|
70
|
-
},
|
|
71
|
-
const F =
|
|
70
|
+
...y
|
|
71
|
+
}, V) => {
|
|
72
|
+
const F = ge({ id: O }), b = `${F}-sr-text`, S = se(null), C = R(
|
|
72
73
|
() => v ?? typeof i == "function",
|
|
73
74
|
[i, v]
|
|
74
|
-
),
|
|
75
|
+
), $ = {
|
|
75
76
|
clearable: !0,
|
|
76
|
-
prepend: /* @__PURE__ */ e(
|
|
77
|
-
...
|
|
78
|
-
},
|
|
77
|
+
prepend: /* @__PURE__ */ e(w, { name: "search" }),
|
|
78
|
+
..._
|
|
79
|
+
}, z = { ...N, ...q }, { value: P, setValue: c } = de({
|
|
79
80
|
component: "IressFilter",
|
|
80
81
|
defaultValue: h,
|
|
81
82
|
multiple: s,
|
|
82
|
-
value:
|
|
83
|
-
}), [
|
|
83
|
+
value: U
|
|
84
|
+
}), [J, d] = I(""), [K, a] = I(!1), [X, Y] = R(
|
|
85
|
+
() => me(y),
|
|
86
|
+
[y]
|
|
87
|
+
), Z = (p) => {
|
|
84
88
|
d(p.target.value);
|
|
85
|
-
},
|
|
89
|
+
}, B = () => {
|
|
86
90
|
d("");
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
c(void 0),
|
|
91
|
+
}, T = (p) => {
|
|
92
|
+
k?.(p), c(p), s || a(!1);
|
|
93
|
+
}, ee = () => {
|
|
94
|
+
c(void 0), E?.(), s || a(!1);
|
|
91
95
|
};
|
|
92
|
-
|
|
93
|
-
element:
|
|
96
|
+
ie(V, () => ({
|
|
97
|
+
element: S.current ?? void 0,
|
|
94
98
|
clearSearch: () => d(""),
|
|
95
99
|
reset: () => c(h)
|
|
96
100
|
}));
|
|
97
101
|
const {
|
|
98
|
-
debouncedQuery:
|
|
102
|
+
debouncedQuery: te,
|
|
99
103
|
loading: u,
|
|
100
104
|
results: f,
|
|
101
|
-
shouldShowInstructions:
|
|
102
|
-
shouldShowDebounceWaiting:
|
|
103
|
-
shouldShowNoResults:
|
|
104
|
-
} =
|
|
105
|
-
debounceThreshold:
|
|
106
|
-
initialOptions:
|
|
105
|
+
shouldShowInstructions: we,
|
|
106
|
+
shouldShowDebounceWaiting: Ne,
|
|
107
|
+
shouldShowNoResults: xe
|
|
108
|
+
} = fe({
|
|
109
|
+
debounceThreshold: A,
|
|
110
|
+
initialOptions: Q ?? (typeof i == "function" ? void 0 : i),
|
|
107
111
|
options: i,
|
|
108
|
-
query:
|
|
109
|
-
}), m =
|
|
110
|
-
debouncedQuery:
|
|
112
|
+
query: J
|
|
113
|
+
}), m = ve({
|
|
114
|
+
debouncedQuery: te,
|
|
111
115
|
loading: u,
|
|
112
116
|
results: f,
|
|
113
|
-
searchable:
|
|
117
|
+
searchable: C,
|
|
114
118
|
visibleResetButton: l
|
|
115
|
-
}), r =
|
|
119
|
+
}), r = ne();
|
|
116
120
|
return /* @__PURE__ */ n(
|
|
117
|
-
|
|
121
|
+
le.div,
|
|
118
122
|
{
|
|
119
|
-
...
|
|
120
|
-
className:
|
|
123
|
+
...Y,
|
|
124
|
+
className: ae(D, r.root, Ce.Filter),
|
|
121
125
|
"data-testid": t,
|
|
122
126
|
id: F,
|
|
123
|
-
ref:
|
|
127
|
+
ref: S,
|
|
124
128
|
children: [
|
|
125
129
|
/* @__PURE__ */ n(
|
|
126
|
-
|
|
130
|
+
pe,
|
|
127
131
|
{
|
|
128
|
-
|
|
132
|
+
...z,
|
|
129
133
|
activator: /* @__PURE__ */ n(
|
|
130
|
-
|
|
134
|
+
ce,
|
|
131
135
|
{
|
|
132
136
|
"aria-describedby": b,
|
|
133
137
|
"data-testid": o(
|
|
@@ -135,13 +139,14 @@ const w = {
|
|
|
135
139
|
"activator-button__button"
|
|
136
140
|
),
|
|
137
141
|
onClick: () => a(!0),
|
|
142
|
+
...X,
|
|
138
143
|
children: [
|
|
139
144
|
/* @__PURE__ */ e(
|
|
140
|
-
|
|
145
|
+
Se,
|
|
141
146
|
{
|
|
142
|
-
label:
|
|
143
|
-
selectedOptionsText:
|
|
144
|
-
value:
|
|
147
|
+
label: j,
|
|
148
|
+
selectedOptionsText: G,
|
|
149
|
+
value: P
|
|
145
150
|
}
|
|
146
151
|
),
|
|
147
152
|
/* @__PURE__ */ e("span", { className: r.chevron })
|
|
@@ -150,59 +155,59 @@ const w = {
|
|
|
150
155
|
),
|
|
151
156
|
contentStyle: { className: r.popoverContent },
|
|
152
157
|
"data-testid": o(t, "popover"),
|
|
153
|
-
show:
|
|
158
|
+
show: K,
|
|
154
159
|
matchActivatorWidth: !0,
|
|
155
160
|
onActivated: () => a(!0),
|
|
156
161
|
onDeactivated: () => a(!1),
|
|
157
162
|
type: "listbox",
|
|
158
163
|
children: [
|
|
159
|
-
|
|
160
|
-
m.showHeader && /* @__PURE__ */ n(
|
|
161
|
-
/* @__PURE__ */ n(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
W,
|
|
165
|
+
m.showHeader && /* @__PURE__ */ n(re, { children: [
|
|
166
|
+
/* @__PURE__ */ n(he, { bg: "transparent", p: "spacing.2", children: [
|
|
167
|
+
C && /* @__PURE__ */ e(
|
|
168
|
+
ye,
|
|
164
169
|
{
|
|
165
|
-
|
|
170
|
+
...$,
|
|
166
171
|
className: r.searchInput,
|
|
167
172
|
"data-testid": o(t, "input"),
|
|
168
173
|
loading: u,
|
|
169
|
-
onChange:
|
|
170
|
-
onClear:
|
|
174
|
+
onChange: Z,
|
|
175
|
+
onClear: B
|
|
171
176
|
}
|
|
172
177
|
),
|
|
173
178
|
l && /* @__PURE__ */ e(
|
|
174
|
-
|
|
179
|
+
be,
|
|
175
180
|
{
|
|
176
181
|
"data-testid": o(t, "reset-button"),
|
|
177
|
-
onClick:
|
|
182
|
+
onClick: ee,
|
|
178
183
|
children: typeof l == "string" ? l : "Reset filter"
|
|
179
184
|
}
|
|
180
185
|
)
|
|
181
186
|
] }),
|
|
182
|
-
m.showResults && /* @__PURE__ */ e(
|
|
187
|
+
m.showResults && /* @__PURE__ */ e(Fe, {})
|
|
183
188
|
] }),
|
|
184
189
|
m.showResults && /* @__PURE__ */ e(
|
|
185
|
-
|
|
190
|
+
ue,
|
|
186
191
|
{
|
|
187
192
|
className: r.optionList,
|
|
188
193
|
"data-testid": o(t, "menu"),
|
|
189
194
|
items: f,
|
|
190
|
-
limitDesktop:
|
|
191
|
-
limitMobile:
|
|
195
|
+
limitDesktop: L,
|
|
196
|
+
limitMobile: M,
|
|
192
197
|
multiSelect: s,
|
|
193
|
-
onChange:
|
|
194
|
-
selected:
|
|
198
|
+
onChange: T,
|
|
199
|
+
selected: P,
|
|
195
200
|
selectedFirst: s
|
|
196
201
|
}
|
|
197
202
|
),
|
|
198
203
|
m.showNoResults && /* @__PURE__ */ e("div", { className: r.noResults, children: g }),
|
|
199
|
-
|
|
204
|
+
H
|
|
200
205
|
]
|
|
201
206
|
}
|
|
202
207
|
),
|
|
203
|
-
|
|
208
|
+
x,
|
|
204
209
|
/* @__PURE__ */ e(
|
|
205
|
-
|
|
210
|
+
Pe,
|
|
206
211
|
{
|
|
207
212
|
"data-testid": o(t, "results-sr-text"),
|
|
208
213
|
id: b,
|
|
@@ -214,8 +219,8 @@ const w = {
|
|
|
214
219
|
]
|
|
215
220
|
}
|
|
216
221
|
);
|
|
217
|
-
},
|
|
218
|
-
|
|
222
|
+
}, Ie = oe(Re);
|
|
223
|
+
Ie.displayName = "IressFilter";
|
|
219
224
|
export {
|
|
220
|
-
|
|
225
|
+
Ie as IressFilter
|
|
221
226
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
const
|
|
3
|
-
const [
|
|
4
|
-
return
|
|
5
|
-
if (
|
|
1
|
+
import { useState as s, useEffect as v } from "react";
|
|
2
|
+
const i = (t, r = !1, n, o = 0) => {
|
|
3
|
+
const [u, l] = s(n ?? 0);
|
|
4
|
+
return v(() => {
|
|
5
|
+
if (r || n !== void 0)
|
|
6
6
|
return;
|
|
7
|
-
const m = performance.now();
|
|
8
|
-
let a;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
7
|
+
const m = performance.now(), p = 50;
|
|
8
|
+
let f = 0, a;
|
|
9
|
+
const c = () => {
|
|
10
|
+
const e = Math.max(performance.now() - m, 0);
|
|
11
|
+
e - f >= p && (l(e), f = e), A(e, t, o) && (a = requestAnimationFrame(c));
|
|
12
12
|
};
|
|
13
|
-
return a = requestAnimationFrame(
|
|
13
|
+
return a = requestAnimationFrame(c), () => {
|
|
14
14
|
a && cancelAnimationFrame(a);
|
|
15
15
|
};
|
|
16
|
-
}, [
|
|
17
|
-
},
|
|
16
|
+
}, [t, r, o, n]), n !== void 0 ? r ? t : n : r || u >= t ? t : u;
|
|
17
|
+
}, A = (t, r, n) => t < r || t < n;
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
i as useEstimatedProgressValue
|
|
20
20
|
};
|