@iress-oss/ids-components 6.0.0 → 6.1.0
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/Autocomplete-BRGD9dSh.js +321 -0
- package/dist/Shadow-D2KoVwxD.js +57 -0
- package/dist/components/Autocomplete/Autocomplete.js +1 -1
- package/dist/components/Autocomplete/hooks/useAutocompleteSearch.js +1 -1
- package/dist/components/Autocomplete/index.js +2 -2
- package/dist/components/Expander/Expander.styles.d.ts +4 -0
- package/dist/components/Expander/Expander.styles.js +5 -1
- package/dist/components/Field/Field.js +47 -47
- package/dist/components/Field/Field.styles.d.ts +2 -2
- package/dist/components/Field/Field.styles.js +8 -2
- package/dist/components/Field/components/FieldHint.js +27 -19
- package/dist/components/Field/index.d.ts +0 -2
- package/dist/components/Field/index.js +1 -3
- package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.js +10 -9
- package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.styles.d.ts +8 -1
- package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.styles.js +6 -4
- package/dist/components/FieldGroup/index.d.ts +2 -0
- package/dist/components/FieldGroup/index.js +3 -0
- package/dist/components/Input/Input.styles.d.ts +4 -4
- package/dist/components/Input/Input.styles.js +4 -4
- package/dist/components/Link/Link.styles.d.ts +1 -0
- package/dist/components/Link/Link.styles.js +4 -1
- package/dist/components/Menu/Menu.js +81 -77
- package/dist/components/Menu/Menu.styles.js +7 -0
- package/dist/components/Menu/MenuGroup/MenuGroup.d.ts +18 -3
- package/dist/components/Menu/MenuGroup/MenuGroup.js +38 -34
- package/dist/components/Menu/MenuHeading/MenuHeading.d.ts +20 -0
- package/dist/components/Menu/MenuHeading/MenuHeading.js +14 -0
- package/dist/components/Menu/MenuItem/MenuItem.styles.js +9 -0
- package/dist/components/Menu/MenuText/MenuText.d.ts +1 -5
- package/dist/components/Menu/MenuText/MenuText.js +11 -17
- package/dist/components/Menu/index.d.ts +1 -0
- package/dist/components/Menu/index.js +4 -3
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Select/SelectHeading/SelectHeading.js +5 -5
- package/dist/components/Select/SelectTags/SelectTags.js +15 -15
- package/dist/components/Select/components/SelectOptions.js +108 -95
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Slideout/Slideout.styles.js +1 -0
- package/dist/components/TabSet/TabSet.d.ts +6 -1
- package/dist/components/TabSet/TabSet.js +34 -30
- package/dist/components/TabSet/TabSet.styles.d.ts +1 -1
- package/dist/components/TabSet/TabSet.styles.js +13 -1
- package/dist/components/Tag/Tag.styles.d.ts +14 -14
- package/dist/components/Tag/Tag.styles.js +16 -16
- package/dist/components/Tag/index.d.ts +0 -1
- package/dist/components/Tag/index.js +1 -2
- package/dist/components/{Tag/TagInput → TagInput}/TagInput.d.ts +1 -1
- package/dist/components/{Tag/TagInput → TagInput}/TagInput.js +7 -7
- package/dist/components/TagInput/TagInput.styles.d.ts +1 -0
- package/dist/components/{Tag/TagInput → TagInput}/TagInput.styles.js +2 -2
- package/dist/components/TagInput/index.d.ts +2 -0
- package/dist/components/TagInput/index.js +3 -0
- package/dist/components/Tooltip/Tooltip.d.ts +7 -2
- package/dist/components/Tooltip/Tooltip.js +48 -42
- package/dist/components/Tooltip/TooltipProvider.d.ts +27 -0
- package/dist/components/Tooltip/TooltipProvider.js +14 -0
- package/dist/components/Tooltip/hooks/useTooltipContainer.d.ts +17 -0
- package/dist/components/Tooltip/hooks/useTooltipContainer.js +5 -0
- package/dist/components/Tooltip/index.d.ts +4 -0
- package/dist/components/Tooltip/index.js +4 -2
- package/dist/components/ValidationMessage/ValidationMessage.js +2 -2
- package/dist/main.d.ts +2 -0
- package/dist/main.js +125 -121
- package/dist/patterns/DropdownMenu/DropdownMenu.js +113 -102
- package/dist/patterns/DropdownMenu/hooks/useDropdownMenuFlags.d.ts +1 -0
- package/dist/patterns/DropdownMenu/hooks/useDropdownMenuFlags.js +1 -0
- package/dist/patterns/Form/FormField/FormFieldset.d.ts +1 -1
- package/dist/patterns/Form/FormField/FormFieldset.js +1 -1
- package/dist/patterns/Form/FormValidationSummary/FormValidationSummary.js +1 -0
- package/dist/patterns/Form/components/LongForm.js +3 -1
- package/dist/patterns/Form/components/ShortForm.js +1 -0
- package/dist/patterns/Loading/Loading.styles.d.ts +3 -0
- package/dist/patterns/Loading/Loading.styles.js +4 -1
- package/dist/patterns/Loading/components/PageLoading.js +4 -4
- package/dist/patterns/Shadow/Shadow.js +1 -1
- package/dist/patterns/Shadow/index.js +1 -1
- package/dist/patterns/SideNav/SideNav.d.ts +6 -0
- package/dist/patterns/SideNav/SideNav.js +74 -68
- package/dist/patterns/SideNav/SideNav.styles.js +6 -2
- package/dist/style.css +1 -1
- package/dist/{useAutocompleteSearch-BJ_hhoKp.js → useAutocompleteSearch-DxKxs6HH.js} +29 -24
- package/package.json +1 -1
- package/dist/Autocomplete-CuUjmIAw.js +0 -308
- package/dist/Shadow-BL3YAhE_.js +0 -57
- package/dist/components/Tag/TagInput/TagInput.styles.d.ts +0 -1
- /package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.d.ts +0 -0
|
@@ -79,7 +79,7 @@ function l(e, t, r) {
|
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/components/Autocomplete/hooks/useAutocompleteSearch.tsx
|
|
82
|
-
var u = 500, d = 1, f = (e) => e instanceof Error && e.message ? e.message : typeof e == "string" ? e : !0,
|
|
82
|
+
var u = 500, d = 1, f = 250, p = (e) => e instanceof Error && e.message ? e.message : typeof e == "string" ? e : !0, m = () => {
|
|
83
83
|
let [t, r] = o(!1), [i, a] = o(!1), [s, c] = o([]), [l, u] = o(!1);
|
|
84
84
|
return {
|
|
85
85
|
loading: t,
|
|
@@ -108,58 +108,63 @@ var u = 500, d = 1, f = (e) => e instanceof Error && e.message ? e.message : typ
|
|
|
108
108
|
a(!1);
|
|
109
109
|
}, [])
|
|
110
110
|
};
|
|
111
|
-
},
|
|
112
|
-
let i = a(""), o =
|
|
111
|
+
}, h = (e, r) => {
|
|
112
|
+
let i = a(""), o = a(null), s = n(() => {
|
|
113
|
+
o.current &&= (clearTimeout(o.current), null);
|
|
114
|
+
}, []), c = n((e) => i.current === e, []), l = n((e) => {
|
|
113
115
|
i.current = e;
|
|
114
116
|
}, []);
|
|
115
117
|
return {
|
|
116
118
|
handleAsync: n(async (t, n, i, a = !1) => {
|
|
117
|
-
if (
|
|
118
|
-
let
|
|
119
|
-
if (
|
|
120
|
-
|
|
119
|
+
if (c(n) && !a) return;
|
|
120
|
+
let u = ++r.current;
|
|
121
|
+
if (l(n), n.length >= i || a) {
|
|
122
|
+
s(), e.clearErrorState(), o.current = setTimeout(() => {
|
|
123
|
+
e.setLoadingState(!0);
|
|
124
|
+
}, f);
|
|
121
125
|
try {
|
|
122
126
|
let i = await t(n);
|
|
123
|
-
if (
|
|
124
|
-
e.setSearched(!0), e.updateWithResults(i, n);
|
|
127
|
+
if (u !== r.current) return;
|
|
128
|
+
s(), e.setSearched(!0), e.updateWithResults(i, n);
|
|
125
129
|
} catch (t) {
|
|
126
|
-
if (
|
|
127
|
-
e.setSearched(!0), e.updateWithError(
|
|
130
|
+
if (u !== r.current) return;
|
|
131
|
+
s(), e.setSearched(!0), e.updateWithError(p(t));
|
|
128
132
|
}
|
|
129
|
-
} else e.reset();
|
|
133
|
+
} else s(), e.reset();
|
|
130
134
|
}, [
|
|
131
135
|
e,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
r
|
|
136
|
+
c,
|
|
137
|
+
l,
|
|
138
|
+
r,
|
|
139
|
+
s
|
|
135
140
|
]),
|
|
136
141
|
handleSync: n((n, r, i, a = !1) => {
|
|
137
|
-
if (!(
|
|
142
|
+
if (!(c(r) && !a)) if (l(r), r.length >= i || a) {
|
|
138
143
|
e.setSearched(!0);
|
|
139
144
|
let i = t(r, n);
|
|
140
145
|
e.updateWithResults(i, r);
|
|
141
146
|
} else e.reset();
|
|
142
147
|
}, [
|
|
143
148
|
e,
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
c,
|
|
150
|
+
l
|
|
146
151
|
])
|
|
147
152
|
};
|
|
148
|
-
},
|
|
149
|
-
let f =
|
|
153
|
+
}, g = ({ debounceThreshold: e = u, disabled: t = !1, initialOptions: i = [], minSearchLength: o = d, options: s = [], query: c = "" }) => {
|
|
154
|
+
let f = m(), p = h(f, a(0)), [g] = l(c, e), _ = n((e = !1) => {
|
|
150
155
|
if (!t) {
|
|
151
156
|
if (typeof s == "function") {
|
|
152
|
-
|
|
157
|
+
p.handleAsync(s, g, o, e);
|
|
153
158
|
return;
|
|
154
159
|
}
|
|
155
|
-
|
|
160
|
+
p.handleSync(s, g, o, e);
|
|
156
161
|
}
|
|
157
162
|
}, [
|
|
158
163
|
t,
|
|
159
164
|
g,
|
|
160
165
|
o,
|
|
161
166
|
s,
|
|
162
|
-
|
|
167
|
+
p
|
|
163
168
|
]);
|
|
164
169
|
r(() => {
|
|
165
170
|
t || _();
|
|
@@ -179,4 +184,4 @@ var u = 500, d = 1, f = (e) => e instanceof Error && e.message ? e.message : typ
|
|
|
179
184
|
};
|
|
180
185
|
};
|
|
181
186
|
//#endregion
|
|
182
|
-
export {
|
|
187
|
+
export { g as t };
|
package/package.json
CHANGED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./cx-CZ8IJJTy.js";
|
|
2
|
-
import { GlobalCSSClass as t } from "./enums.js";
|
|
3
|
-
import { idsLogger as n } from "./helpers/utility/idsLogger.js";
|
|
4
|
-
import { IressIcon as r } from "./components/Icon/Icon.js";
|
|
5
|
-
import { propagateTestid as i } from "./helpers/utility/propagateTestid.js";
|
|
6
|
-
import { toArray as a } from "./helpers/formatting/toArray.js";
|
|
7
|
-
import { useControlledState as o } from "./hooks/useControlledState.js";
|
|
8
|
-
import { useResponsiveProps as ee } from "./hooks/useResponsiveProps.js";
|
|
9
|
-
import { IressPopover as te } from "./components/Popover/Popover.js";
|
|
10
|
-
import { IressInputPopover as s } from "./components/Popover/InputPopover/InputPopover.js";
|
|
11
|
-
import { IressAlert as ne } from "./components/Alert/Alert.js";
|
|
12
|
-
import { autoComplete as re } from "./components/Autocomplete/Autocomplete.styles.js";
|
|
13
|
-
import { getFormControlValueAsStringIfDefined as c } from "./helpers/form/getFormControlValueAsStringIfDefined.js";
|
|
14
|
-
import { useNoDefaultValueInForms as ie } from "./patterns/Form/hooks/useNoDefaultValueInForms.js";
|
|
15
|
-
import { IressReadonly as ae } from "./components/Readonly/Readonly.js";
|
|
16
|
-
import { IressInput as oe } from "./components/Input/Input.js";
|
|
17
|
-
import { getValueAsEvent as l } from "./helpers/form/getValueAsEvent.js";
|
|
18
|
-
import { t as se } from "./useAutocompleteSearch-BJ_hhoKp.js";
|
|
19
|
-
import { AutocompleteInstructions as u } from "./components/Autocomplete/components/AutocompleteInstructions.js";
|
|
20
|
-
import { select as d } from "./components/Select/Select.styles.js";
|
|
21
|
-
import { SelectActivator as f } from "./components/Select/components/SelectActivator.js";
|
|
22
|
-
import { IressSelectMenu as p } from "./components/Select/SelectMenu/SelectMenu.js";
|
|
23
|
-
import { SelectOptions as m } from "./components/Select/components/SelectOptions.js";
|
|
24
|
-
import { SelectHiddenInput as ce } from "./components/Select/components/SelectHiddenInput.js";
|
|
25
|
-
import { NativeSelect as le } from "./components/Select/components/NativeSelect.js";
|
|
26
|
-
import { useSelectState as ue } from "./components/Select/hooks/useSelectState.js";
|
|
27
|
-
import { forwardRef as h, useCallback as g, useEffect as _, useImperativeHandle as de, useMemo as v, useRef as y, useState as b } from "react";
|
|
28
|
-
import { Fragment as fe, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
29
|
-
//#region src/components/Select/Select.tsx
|
|
30
|
-
var C = (e) => typeof e == "object" && !!e && "label" in e, w = (e, t) => {
|
|
31
|
-
for (let n of t) if (n.children) {
|
|
32
|
-
let t = w(e, n.children);
|
|
33
|
-
if (t) return t;
|
|
34
|
-
} else if (n.value !== void 0 && n.value === e) return n;
|
|
35
|
-
}, T = (e, t) => {
|
|
36
|
-
if (C(e)) return e;
|
|
37
|
-
if (typeof t != "function") return w(e, t) ?? (typeof e == "number" ? w(String(e), t) : void 0);
|
|
38
|
-
}, E = (e, t) => {
|
|
39
|
-
if (e !== void 0) {
|
|
40
|
-
if (Array.isArray(e)) {
|
|
41
|
-
let r = e, i = r.map((e) => T(e, t)).filter((e) => e !== void 0);
|
|
42
|
-
return i.length < r.length && typeof t != "function" && n(`IressSelect: ${r.length - i.length} value(s) could not be resolved to matching options and were dropped.`, "warn"), i;
|
|
43
|
-
}
|
|
44
|
-
return T(e, t);
|
|
45
|
-
}
|
|
46
|
-
}, D = h(({ align: r = "bottom-start", autoHighlight: i = !0, className: a, defaultValue: o, disabled: s, footer: ne, header: re, id: c, matchActivatorWidth: oe = !0, multiSelect: l, multiSelectLimit: u, name: p, onChange: h, onBlur: w, options: T, native: D, placeholder: O, readOnly: k, renderHiddenInput: A, renderLabel: j, renderOptions: pe, required: M, type: me, value: N, virtualFocus: P, width: F, ...I }, L) => {
|
|
47
|
-
ie({
|
|
48
|
-
component: "IressSelect",
|
|
49
|
-
defaultValue: o
|
|
50
|
-
});
|
|
51
|
-
let [R, z] = b(!1), B = R && !s, [V, he] = b(""), H = v(() => E(N, T), [N, T]), ge = v(() => E(o, T), [o, T]);
|
|
52
|
-
_(() => {
|
|
53
|
-
N !== void 0 && !C(N) && H === void 0 && typeof T == "function" && n("IressSelect: A primitive value was passed but cannot be resolved because options are asynchronous. Pass a LabelValueMeta object instead when using async options, otherwise the component will behave as uncontrolled.", "warn");
|
|
54
|
-
}, [
|
|
55
|
-
N,
|
|
56
|
-
H,
|
|
57
|
-
T
|
|
58
|
-
]);
|
|
59
|
-
let { value: U, setValue: W, getValuesString: G, getLabelsString: _e } = ue({
|
|
60
|
-
component: "IressSelect",
|
|
61
|
-
defaultValue: ge,
|
|
62
|
-
multiple: l,
|
|
63
|
-
value: H
|
|
64
|
-
}), K = y(null), q = y(null), J = y(null), { value: Y } = ee(typeof D == "string" ? {
|
|
65
|
-
xs: !0,
|
|
66
|
-
[D]: !1
|
|
67
|
-
} : { xs: D }, { disabled: !D }), { append: ve, debounceThreshold: X, initialOptions: ye, minSearchLength: be, onActivated: xe, onDeactivated: Se, prepend: Ce, selectedOptionsText: we, ...Z } = I, { debouncedQuery: Te, error: Ee, results: De, stopSearch: Oe, loading: ke, shouldShowInstructions: Ae, shouldShowNoResults: je } = se({
|
|
68
|
-
debounceThreshold: X,
|
|
69
|
-
disabled: !R || !!Y,
|
|
70
|
-
initialOptions: ye,
|
|
71
|
-
minSearchLength: be,
|
|
72
|
-
options: T,
|
|
73
|
-
query: V
|
|
74
|
-
});
|
|
75
|
-
de(L, () => Y ? {
|
|
76
|
-
focus: () => q.current?.focus(),
|
|
77
|
-
blur: () => q.current?.blur(),
|
|
78
|
-
input: q.current ?? null
|
|
79
|
-
} : K.current ? {
|
|
80
|
-
...K.current,
|
|
81
|
-
focus: () => K.current?.getActivator()?.focus(),
|
|
82
|
-
blur: () => K.current?.getActivator()?.blur(),
|
|
83
|
-
hiddenInput: J.current ?? void 0,
|
|
84
|
-
input: J.current ?? null
|
|
85
|
-
} : {
|
|
86
|
-
hiddenInput: J.current ?? void 0,
|
|
87
|
-
input: J.current ?? null,
|
|
88
|
-
focus: () => J.current?.focus(),
|
|
89
|
-
blur: () => J.current?.blur()
|
|
90
|
-
}, [Y]), _(() => {
|
|
91
|
-
R ? xe?.() : Se?.();
|
|
92
|
-
}, [
|
|
93
|
-
xe,
|
|
94
|
-
Se,
|
|
95
|
-
R
|
|
96
|
-
]);
|
|
97
|
-
let Me = g((e) => {
|
|
98
|
-
if (!w) return;
|
|
99
|
-
let t = e.currentTarget, n = e.relatedTarget;
|
|
100
|
-
!R && (!n || !t.contains(n)) && w(e), e.stopPropagation();
|
|
101
|
-
}, [w, R]);
|
|
102
|
-
if (k) return /* @__PURE__ */ x(ae, {
|
|
103
|
-
value: G(),
|
|
104
|
-
ref: J,
|
|
105
|
-
variant: k,
|
|
106
|
-
name: p,
|
|
107
|
-
disabled: s,
|
|
108
|
-
required: M,
|
|
109
|
-
children: _e(", ")
|
|
110
|
-
});
|
|
111
|
-
if (Y) {
|
|
112
|
-
if (T instanceof Function) throw Error("[IressSelect] The native select does not support asynchronous options. Please provide options as an array.");
|
|
113
|
-
if (l) throw Error("[IressSelect] The native select does not support multiple selection. Please remove the multiSelect prop or use the non-native select.");
|
|
114
|
-
return /* @__PURE__ */ x(le, {
|
|
115
|
-
className: e(a, t.Select),
|
|
116
|
-
"data-testid": Z["data-testid"],
|
|
117
|
-
disabled: s,
|
|
118
|
-
id: c,
|
|
119
|
-
name: p,
|
|
120
|
-
onChange: (e, t) => {
|
|
121
|
-
h?.(e, t?.value ?? null, t), W(t);
|
|
122
|
-
},
|
|
123
|
-
options: T,
|
|
124
|
-
placeholder: typeof D == "string" ? O ?? "" : O,
|
|
125
|
-
style: Z.style,
|
|
126
|
-
value: U,
|
|
127
|
-
width: F,
|
|
128
|
-
ref: q
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
let Q = typeof T == "function", Ne = P ?? !Q, Pe = me ?? (Q ? void 0 : "listbox"), $ = d({ width: F }), Fe = () => {
|
|
132
|
-
z(!0);
|
|
133
|
-
}, Ie = () => {
|
|
134
|
-
z(!1), Oe();
|
|
135
|
-
};
|
|
136
|
-
return /* @__PURE__ */ S(fe, { children: [/* @__PURE__ */ x(ce, {
|
|
137
|
-
"data-testid": Z["data-testid"],
|
|
138
|
-
getValuesString: G,
|
|
139
|
-
name: p,
|
|
140
|
-
renderHiddenInput: A,
|
|
141
|
-
required: M,
|
|
142
|
-
value: U,
|
|
143
|
-
disabled: s,
|
|
144
|
-
ref: J
|
|
145
|
-
}), /* @__PURE__ */ x(te, {
|
|
146
|
-
...Z,
|
|
147
|
-
activator: /* @__PURE__ */ x(f, {
|
|
148
|
-
append: ve,
|
|
149
|
-
async: Q,
|
|
150
|
-
disabled: s,
|
|
151
|
-
error: Ee,
|
|
152
|
-
id: c,
|
|
153
|
-
loading: ke,
|
|
154
|
-
multiSelect: l,
|
|
155
|
-
multiSelectLimit: u,
|
|
156
|
-
onChange: h,
|
|
157
|
-
placeholder: O,
|
|
158
|
-
prepend: Ce,
|
|
159
|
-
renderLabel: j,
|
|
160
|
-
selectedOptionsText: we,
|
|
161
|
-
setValue: W,
|
|
162
|
-
setShow: z,
|
|
163
|
-
show: R,
|
|
164
|
-
value: U
|
|
165
|
-
}),
|
|
166
|
-
align: r,
|
|
167
|
-
className: e(a, $.root, t.Select),
|
|
168
|
-
contentClassName: e($.popoverContent),
|
|
169
|
-
contentStyle: {
|
|
170
|
-
...Z.contentStyle,
|
|
171
|
-
p: "none"
|
|
172
|
-
},
|
|
173
|
-
matchActivatorWidth: oe,
|
|
174
|
-
onActivated: Fe,
|
|
175
|
-
onDeactivated: Ie,
|
|
176
|
-
ref: K,
|
|
177
|
-
show: B,
|
|
178
|
-
type: Pe,
|
|
179
|
-
virtualFocus: Ne,
|
|
180
|
-
onBlur: Me,
|
|
181
|
-
children: /* @__PURE__ */ S("div", {
|
|
182
|
-
className: $.wrapper,
|
|
183
|
-
children: [
|
|
184
|
-
re,
|
|
185
|
-
/* @__PURE__ */ x(m, {
|
|
186
|
-
autoHighlight: i,
|
|
187
|
-
debouncedQuery: Te,
|
|
188
|
-
error: Ee,
|
|
189
|
-
initialOptions: ye,
|
|
190
|
-
loading: ke,
|
|
191
|
-
minSearchLength: be,
|
|
192
|
-
multiSelect: l,
|
|
193
|
-
onChange: h,
|
|
194
|
-
options: T,
|
|
195
|
-
query: V,
|
|
196
|
-
renderOptions: pe,
|
|
197
|
-
results: De,
|
|
198
|
-
setQuery: he,
|
|
199
|
-
setShow: z,
|
|
200
|
-
setValue: W,
|
|
201
|
-
shouldShowInstructions: Ae,
|
|
202
|
-
shouldShowNoResults: je,
|
|
203
|
-
show: B,
|
|
204
|
-
value: U
|
|
205
|
-
}),
|
|
206
|
-
ne
|
|
207
|
-
]
|
|
208
|
-
})
|
|
209
|
-
})] });
|
|
210
|
-
});
|
|
211
|
-
D.displayName = "IressSelect";
|
|
212
|
-
//#endregion
|
|
213
|
-
//#region src/components/Autocomplete/Autocomplete.tsx
|
|
214
|
-
var O = h(({ alwaysShowOnFocus: n, append: ee = /* @__PURE__ */ x(r, { name: "search" }), autoComplete: te = "off", autoSelect: ie = !0, className: d, clearable: f = !0, "data-testid": m, debounceThreshold: ce, defaultValue: le, errorText: ue = /* @__PURE__ */ x(ne, {
|
|
215
|
-
status: "danger",
|
|
216
|
-
mb: "none",
|
|
217
|
-
borderRadius: "radius.system.form",
|
|
218
|
-
children: "An unknown error occurred. Please contact support if the error persists."
|
|
219
|
-
}), initialOptions: h, limitDesktop: g = 12, limitMobile: de = 6, minSearchLength: v, noResultsText: y, onChange: C, onClear: w, onFocus: T, options: E, popoverProps: { autoHighlight: D = !1, append: O, prepend: k, ...A } = {}, readOnly: j, value: pe, ...M }, me) => {
|
|
220
|
-
let [N, P] = b(!1), { value: F, setValue: I } = o({
|
|
221
|
-
component: "IressAutocomplete",
|
|
222
|
-
defaultValue: le,
|
|
223
|
-
value: pe
|
|
224
|
-
}), [L, R] = b(!1), { clearError: z, debouncedQuery: B, error: V, loading: he, results: H, startSearch: ge, stopSearch: U, shouldShowInstructions: W, shouldShowNoResults: G } = se({
|
|
225
|
-
debounceThreshold: ce,
|
|
226
|
-
initialOptions: h,
|
|
227
|
-
minSearchLength: v,
|
|
228
|
-
options: E,
|
|
229
|
-
query: c(F)
|
|
230
|
-
});
|
|
231
|
-
if (_(() => {
|
|
232
|
-
L && !N && H.length > 0 && F && P(!0);
|
|
233
|
-
}, [
|
|
234
|
-
H.length,
|
|
235
|
-
N,
|
|
236
|
-
L,
|
|
237
|
-
F
|
|
238
|
-
]), _(() => {
|
|
239
|
-
V && P(!0);
|
|
240
|
-
}, [V]), j) return /* @__PURE__ */ x(ae, {
|
|
241
|
-
value: F,
|
|
242
|
-
variant: j
|
|
243
|
-
});
|
|
244
|
-
let _e = (e, t) => {
|
|
245
|
-
C?.(e, t), I(t), R(!!t);
|
|
246
|
-
}, K = (e) => {
|
|
247
|
-
w?.(e), I("");
|
|
248
|
-
}, q = (e) => {
|
|
249
|
-
T?.(e), h?.length && P(!0);
|
|
250
|
-
}, J = (e) => {
|
|
251
|
-
let t = a(e)?.[0];
|
|
252
|
-
C?.(l(t?.label), t?.label, t), I(t?.label), P(!1), R(!1);
|
|
253
|
-
}, Y = () => {
|
|
254
|
-
(!n || !F) && U(), z(), P(!1), F && R(!1);
|
|
255
|
-
}, ve = (e) => {
|
|
256
|
-
M.onKeyDown?.(e), e.key === "ArrowDown" && (!N || !L) && (H.length || ge(!0), R(!0), P(!0));
|
|
257
|
-
}, X = re({ isEmpty: H.length === 0 && !V && !W && !G });
|
|
258
|
-
return /* @__PURE__ */ S(s, {
|
|
259
|
-
...A,
|
|
260
|
-
activator: /* @__PURE__ */ x(oe, {
|
|
261
|
-
...M,
|
|
262
|
-
append: ee,
|
|
263
|
-
autoComplete: te,
|
|
264
|
-
clearable: f,
|
|
265
|
-
"data-testid": i(m, "input"),
|
|
266
|
-
loading: he,
|
|
267
|
-
onChange: _e,
|
|
268
|
-
onClear: K,
|
|
269
|
-
onFocus: q,
|
|
270
|
-
onKeyDown: ve,
|
|
271
|
-
value: F,
|
|
272
|
-
ref: me
|
|
273
|
-
}),
|
|
274
|
-
autoHighlight: D,
|
|
275
|
-
className: e(d, A.className, X.root, t.Autocomplete),
|
|
276
|
-
contentClassName: e(A.contentClassName, X.popoverContent),
|
|
277
|
-
contentStyle: A.contentStyle,
|
|
278
|
-
"data-testid": m,
|
|
279
|
-
minLength: 0,
|
|
280
|
-
onActivated: () => (L || n) && P(!0),
|
|
281
|
-
onDeactivated: Y,
|
|
282
|
-
show: N,
|
|
283
|
-
type: "listbox",
|
|
284
|
-
focusStartIndex: 0,
|
|
285
|
-
children: [
|
|
286
|
-
H.length > 0 && /* @__PURE__ */ S(fe, { children: [
|
|
287
|
-
k,
|
|
288
|
-
/* @__PURE__ */ x(p, {
|
|
289
|
-
changeOnBlur: ie,
|
|
290
|
-
className: e(X.optionList),
|
|
291
|
-
"data-testid": i(m, "menu"),
|
|
292
|
-
items: H,
|
|
293
|
-
limitDesktop: g,
|
|
294
|
-
limitMobile: de,
|
|
295
|
-
onChange: J,
|
|
296
|
-
selected: { label: B }
|
|
297
|
-
}),
|
|
298
|
-
O
|
|
299
|
-
] }),
|
|
300
|
-
V && ue,
|
|
301
|
-
W && !V && /* @__PURE__ */ x(u, { minSearchLength: v ?? 1 }),
|
|
302
|
-
G && !V && y
|
|
303
|
-
]
|
|
304
|
-
});
|
|
305
|
-
});
|
|
306
|
-
O.displayName = "IressAutocomplete";
|
|
307
|
-
//#endregion
|
|
308
|
-
export { D as n, O as t };
|