@konstructio/ui 0.1.2-alpha.4 → 0.1.2-alpha.41
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/{Combination-VYaRRJBZ.js → Combination-BtmnusWq.js} +141 -138
- package/dist/DatePicker.css +1 -1
- package/dist/Modal-CtAG97Ts.js +99 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/chevron-down-DgT-uSF9.js +5 -0
- package/dist/chevron-left-C4LEg1fH.js +7 -0
- package/dist/chevron-up-CRyLc5Ml.js +54 -0
- package/dist/chevron-up-DrQr2Fwd.js +5 -0
- package/dist/components/Alert/Alert.js +2 -2
- package/dist/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Badge/Badge.js +42 -44
- package/dist/components/Badge/Badge.variants.js +8 -6
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Breadcrumb/components/Item/Item.js +24 -23
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.variants.js +1 -1
- package/dist/components/Card/Card.variants.js +5 -9
- package/dist/components/Checkbox/Checkbox.js +6 -6
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/Command/components/Command.js +1 -1
- package/dist/components/Command/components/CommandEmpty.js +1 -1
- package/dist/components/Command/components/CommandGroup.js +1 -1
- package/dist/components/Command/components/CommandInput.js +2 -2
- package/dist/components/Command/components/CommandItem.js +1 -1
- package/dist/components/Command/components/CommandList.js +1 -1
- package/dist/components/Command/components/CommandSeparator.js +1 -1
- package/dist/components/Command/components/DialogContent.js +2 -2
- package/dist/components/Command/components/DialogOverlay.js +1 -1
- package/dist/components/Datepicker/DatePicker.js +1243 -1191
- package/dist/components/Divider/Divider.variants.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +37 -31
- package/dist/components/Dropdown/Dropdown.variants.js +9 -4
- package/dist/components/Dropdown/components/List/List.js +128 -59
- package/dist/components/Dropdown/components/ListItem/ListItem.js +90 -39
- package/dist/components/Dropdown/components/Wrapper.js +141 -134
- package/dist/components/Dropdown/constants/index.js +4 -0
- package/dist/components/Dropdown/constants/pagination.js +4 -0
- package/dist/components/Dropdown/contexts/dropdown.context.js +17 -0
- package/dist/components/Dropdown/contexts/dropdown.provider.js +48 -20
- package/dist/components/Dropdown/hooks/useDropdown.js +74 -29
- package/dist/components/Dropdown/hooks/useNavigationList.js +27 -39
- package/dist/components/DropdownButton/DropdownButton.js +1 -1
- package/dist/components/Filter/Filter.variants.js +2 -2
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +1 -1
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +1 -1
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input.variants.js +2 -1
- package/dist/components/Loading/Loading.js +1 -7
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/components/Body/Body.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -4
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.js +34 -0
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.variants.js +34 -0
- package/dist/components/MultiSelectDropdown/components/Item/Item.js +38 -0
- package/dist/components/MultiSelectDropdown/components/Item/Item.variants.js +38 -0
- package/dist/components/MultiSelectDropdown/components/List/List.js +37 -0
- package/dist/components/MultiSelectDropdown/components/List/List.variants.js +23 -0
- package/dist/components/MultiSelectDropdown/components/Wrapper/Wrapper.js +105 -0
- package/dist/components/MultiSelectDropdown/components/index.js +8 -0
- package/dist/components/MultiSelectDropdown/contexts/MultiSelectDropdown.context.js +21 -0
- package/dist/components/MultiSelectDropdown/contexts/MultiSelectDropdown.hook.js +13 -0
- package/dist/components/MultiSelectDropdown/contexts/MultiSelectDropdown.provider.js +138 -0
- package/dist/components/MultiSelectDropdown/contexts/index.js +6 -0
- package/dist/components/MultiSelectDropdown/hooks/useMultiSelectDropdown.js +32 -0
- package/dist/components/NumberInput/NumberInput.js +2 -2
- package/dist/components/PhoneNumberInput/PhoneNumberInput.js +8 -0
- package/dist/components/PhoneNumberInput/PhoneNumberInput.variants.js +46 -0
- package/dist/components/PhoneNumberInput/components/FlagContent/FlagContent.js +27 -0
- package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +629 -0
- package/dist/components/PhoneNumberInput/components/FlagSelectorWrapper/FlagSelectorWrapper.js +36 -0
- package/dist/components/PhoneNumberInput/components/TruncateText/TruncateText.js +45 -0
- package/dist/components/PhoneNumberInput/components/Wrapper.js +625 -0
- package/dist/components/PhoneNumberInput/components/index.js +6 -0
- package/dist/components/PhoneNumberInput/contexts/index.js +8 -0
- package/dist/components/PhoneNumberInput/contexts/phone-number.context.js +28 -0
- package/dist/components/PhoneNumberInput/contexts/phone-number.hook.js +13 -0
- package/dist/components/PhoneNumberInput/contexts/phone-number.provider.js +6144 -0
- package/dist/components/PhoneNumberInput/utils/index.js +11 -0
- package/dist/components/PieChart/PieChart.js +647 -664
- package/dist/components/RadioCard/RadioCard.variants.js +1 -6
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Sidebar/Sidebar.variants.js +2 -2
- package/dist/components/Sidebar/components/Wrapper/Wrapper.js +29 -28
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +8 -8
- package/dist/components/Switch/Switch.variants.js +4 -4
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/Tabs.variants.js +1 -1
- package/dist/components/Tabs/components/Content.js +1 -1
- package/dist/components/Tabs/components/List.js +1 -1
- package/dist/components/Tabs/components/Trigger.js +1 -1
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/Tag/Tag.variants.js +1 -0
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +49 -98
- package/dist/components/TimePicker/TimePicker.variants.js +2 -2
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +2 -2
- package/dist/components/Toast/Toast.js +283 -255
- package/dist/components/Toast/Toast.variants.js +37 -24
- package/dist/components/Tooltip/Tooltip.js +15 -14
- package/dist/components/Tooltip/Tooltip.variants.js +5 -4
- package/dist/components/Typography/Typography.variants.js +18 -23
- package/dist/components/VirtualizedTable/VirtualizedTable.js +121 -0
- package/dist/components/VirtualizedTable/VirtualizedTable.variants.js +5 -0
- package/dist/components/VirtualizedTable/assets/chevron-down.js +25 -0
- package/dist/components/VirtualizedTable/assets/chevron-up.js +25 -0
- package/dist/components/VirtualizedTable/assets/index.js +6 -0
- package/dist/components/VirtualizedTable/components/Actions/Actions.js +72 -0
- package/dist/components/VirtualizedTable/components/Body/Body.js +51 -0
- package/dist/components/VirtualizedTable/components/DotPaginate/DotPaginate.js +165 -0
- package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +34 -0
- package/dist/components/VirtualizedTable/components/Filter/Filter.js +93 -0
- package/dist/components/VirtualizedTable/components/FormPaginate/FormPaginate.js +48 -0
- package/dist/components/VirtualizedTable/components/Header/Header.js +84 -0
- package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +53 -0
- package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +67 -0
- package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +34 -0
- package/dist/components/VirtualizedTable/components/WrapperBody/WrapperBody.js +27 -0
- package/dist/components/VirtualizedTable/components/index.js +16 -0
- package/dist/components/VirtualizedTable/constants/index.js +5 -0
- package/dist/components/VirtualizedTable/constants/pagination.js +5 -0
- package/dist/components/VirtualizedTable/contexts/index.js +8 -0
- package/dist/components/VirtualizedTable/contexts/table.context.js +32 -0
- package/dist/components/VirtualizedTable/contexts/table.hook.js +11 -0
- package/dist/components/VirtualizedTable/contexts/table.provider.js +85 -0
- package/dist/components/index.js +88 -80
- package/dist/contexts/theme.provider.js +0 -1
- package/dist/{createLucideIcon-DbC6TvM5.js → createLucideIcon-D4r5Phnh.js} +0 -24
- package/dist/debounce-BFejQm9P.js +200 -0
- package/dist/ellipsis-vertical-BVPtjl5f.js +9 -0
- package/dist/{index-h-Ul0anl.js → index--V_ZsiQe.js} +1 -22
- package/dist/index-2hB40Iuc.js +1873 -0
- package/dist/index-BZPx6jYI.js +8 -0
- package/dist/{index-bwWKd82e.js → index-BbQkJE5L.js} +1 -1
- package/dist/index-BtQfgaSF.js +60 -0
- package/dist/index-C3tHPg8y.js +662 -0
- package/dist/index-C65LtGuU.js +137 -0
- package/dist/index-CIAmiWcw.js +200 -0
- package/dist/index-CSFe9uC5.js +14 -0
- package/dist/index-CSWGJT-v.js +1722 -0
- package/dist/{index-D3xzCzcO.js → index-CdwPV0FE.js} +4 -4
- package/dist/index-CigKKiZS.js +91 -0
- package/dist/{index-BAraV3ai.js → index-DH2Fnov1.js} +11 -12
- package/dist/index-DLcqcWxM.js +29 -0
- package/dist/index-Dbt2vBmS.js +136 -0
- package/dist/{index-DB2XhXHn.js → index-DpW9ExsS.js} +7 -7
- package/dist/index-DrWQH0QF.js +55 -0
- package/dist/index-Ds6U2x4Z.js +479 -0
- package/dist/{index-C1g_chDT.js → index-mPY_8Y5v.js} +2 -2
- package/dist/index-ohdbKsws.js +27 -0
- package/dist/index.d.ts +232 -23
- package/dist/index.js +112 -102
- package/dist/libphonenumber-_7ZyKWA7.js +11549 -0
- package/dist/loader-juvMSJ9L.js +5 -0
- package/dist/package.json +48 -34
- package/dist/styles.css +1 -1
- package/dist/ui/civo-theme.css +191 -167
- package/dist/{useBreadcrumb-B8DnuqkR.js → useBreadcrumb-BAHbGQ_O.js} +0 -10
- package/dist/utils/index.js +534 -501
- package/dist/{x-BPcqkRZd.js → x-DPU9OdYH.js} +1 -1
- package/package.json +48 -34
- package/dist/Modal-V67Uz78z.js +0 -98
- package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/chevron-down-BLZPftpV.js +0 -11
- package/dist/index-BXuxPoz7.js +0 -435
- package/dist/index-BfXxHr_2.js +0 -125
- package/dist/index-C9T9HQaa.js +0 -423
- package/dist/index-CZnD2QxM.js +0 -32
- package/dist/index-CrBonFvu.js +0 -144
- package/dist/index-Cvx4lqTq.js +0 -47
- package/dist/index-DQH6odE9.js +0 -82
- package/dist/index-Oq5GlCHP.js +0 -131
- package/dist/index-iXyXtdgP.js +0 -31
|
@@ -1,165 +1,167 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import { Typography as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { labelVariants as
|
|
7
|
-
import { useDropdown as
|
|
8
|
-
import { List as
|
|
9
|
-
import { c as
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/
|
|
17
|
-
const le = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], oe = T("chevron-up", le);
|
|
18
|
-
/**
|
|
19
|
-
* @license lucide-react v0.544.0 - ISC
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the ISC license.
|
|
22
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
23
|
-
*/
|
|
24
|
-
const se = [
|
|
1
|
+
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Z, useId as ee, useRef as C, useMemo as te, useImperativeHandle as ae, useEffect as re } from "react";
|
|
3
|
+
import { S as ne } from "../../../loader-juvMSJ9L.js";
|
|
4
|
+
import { Typography as se } from "../../Typography/Typography.js";
|
|
5
|
+
import { cn as o } from "../../../utils/index.js";
|
|
6
|
+
import { labelVariants as oe, inputVariants as le, dropdownVariants as ie } from "../Dropdown.variants.js";
|
|
7
|
+
import { useDropdown as ce } from "../hooks/useDropdown.js";
|
|
8
|
+
import { List as pe } from "./List/List.js";
|
|
9
|
+
import { c as ue } from "../../../createLucideIcon-D4r5Phnh.js";
|
|
10
|
+
import { C as me } from "../../../chevron-up-DrQr2Fwd.js";
|
|
11
|
+
import { useDropdownContext as fe } from "../contexts/dropdown.hook.js";
|
|
12
|
+
const de = [
|
|
25
13
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
26
14
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
27
|
-
],
|
|
15
|
+
], xe = ue("search", de), je = Z(
|
|
28
16
|
({
|
|
29
|
-
additionalOptions:
|
|
30
|
-
className:
|
|
17
|
+
additionalOptions: b,
|
|
18
|
+
className: z,
|
|
31
19
|
defaultValue: x,
|
|
20
|
+
disabled: t = !1,
|
|
32
21
|
error: f,
|
|
33
|
-
iconClassName:
|
|
34
|
-
inputClassName:
|
|
35
|
-
isLoading:
|
|
22
|
+
iconClassName: R,
|
|
23
|
+
inputClassName: F,
|
|
24
|
+
isLoading: g,
|
|
36
25
|
isRequired: h,
|
|
37
26
|
label: v,
|
|
38
|
-
labelClassName:
|
|
39
|
-
listClassName:
|
|
40
|
-
listItemClassName:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
placeholder:
|
|
44
|
-
searchable:
|
|
45
|
-
showSearchIcon:
|
|
46
|
-
theme:
|
|
47
|
-
wrapperClassName:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
27
|
+
labelClassName: S,
|
|
28
|
+
listClassName: T,
|
|
29
|
+
listItemClassName: D,
|
|
30
|
+
listItemSecondRowClassName: E,
|
|
31
|
+
name: d,
|
|
32
|
+
placeholder: w,
|
|
33
|
+
searchable: k = !1,
|
|
34
|
+
showSearchIcon: N,
|
|
35
|
+
theme: M,
|
|
36
|
+
wrapperClassName: W,
|
|
37
|
+
isInfiniteScrollEnabled: _ = !1,
|
|
38
|
+
onFetchMoreOptions: $,
|
|
39
|
+
onBlur: H,
|
|
40
|
+
onSearchChange: P,
|
|
41
|
+
noOptionsText: U,
|
|
42
|
+
...y
|
|
43
|
+
}, q) => {
|
|
44
|
+
const I = ee(), l = C(null), L = C(null), A = C(0), {
|
|
45
|
+
isOpen: i,
|
|
46
|
+
searchTerm: B,
|
|
47
|
+
value: s,
|
|
48
|
+
options: n,
|
|
49
|
+
setValue: c,
|
|
50
|
+
setSearchTerm: G,
|
|
51
|
+
setCanFilter: J,
|
|
52
|
+
toggleOpen: K
|
|
53
|
+
} = fe(), e = te(() => n.find(({ value: a }) => a === s), [n, s]), { wrapperRef: Q, wrapperInputRef: V, handleOpen: j } = ce({
|
|
54
|
+
ulRef: L,
|
|
55
|
+
inputRef: l,
|
|
56
|
+
disabled: t,
|
|
57
|
+
internalValue: e,
|
|
58
|
+
onBlur: H
|
|
59
|
+
}), p = d ? `${I}-${d}` : I;
|
|
60
|
+
ae(q, () => l.current, [l]), re(() => {
|
|
61
|
+
if (x && !s) {
|
|
62
|
+
const a = n && n.find((u) => u.value === x);
|
|
63
|
+
a && c(a.value);
|
|
63
64
|
}
|
|
64
|
-
}, [x, n,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
e.abort();
|
|
71
|
-
};
|
|
72
|
-
}, [q, i, b, j, l]);
|
|
73
|
-
const G = (e) => {
|
|
74
|
-
const o = e.target.value;
|
|
75
|
-
b(o);
|
|
76
|
-
const u = n.find(
|
|
77
|
-
(J) => J.value.toLocaleLowerCase() === o.toLocaleLowerCase()
|
|
65
|
+
}, [x, n, c, s]);
|
|
66
|
+
const X = (a) => {
|
|
67
|
+
const u = a.target.value;
|
|
68
|
+
J(!0), c(""), G(u ?? ""), P?.(u);
|
|
69
|
+
const O = n.find(
|
|
70
|
+
(Y) => Y.value.toLocaleLowerCase() === u.toLocaleLowerCase()
|
|
78
71
|
);
|
|
79
|
-
|
|
72
|
+
c(O ? O.value : e?.value ?? "");
|
|
80
73
|
};
|
|
81
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ m(
|
|
82
75
|
"div",
|
|
83
76
|
{
|
|
84
|
-
ref:
|
|
85
|
-
className:
|
|
86
|
-
"data-theme":
|
|
77
|
+
ref: Q,
|
|
78
|
+
className: o("flex flex-col w-full relative", W),
|
|
79
|
+
"data-theme": M,
|
|
87
80
|
children: [
|
|
88
|
-
v ? /* @__PURE__ */
|
|
81
|
+
v ? /* @__PURE__ */ m(
|
|
89
82
|
"label",
|
|
90
83
|
{
|
|
91
|
-
id:
|
|
92
|
-
className:
|
|
93
|
-
htmlFor:
|
|
94
|
-
onClick:
|
|
84
|
+
id: p,
|
|
85
|
+
className: o(oe({ className: S })),
|
|
86
|
+
htmlFor: p,
|
|
87
|
+
onClick: () => !t && j(),
|
|
95
88
|
children: [
|
|
96
89
|
v,
|
|
97
|
-
h && /* @__PURE__ */
|
|
90
|
+
h && /* @__PURE__ */ r("span", { className: "text-red-600 ml-1", children: "*" })
|
|
98
91
|
]
|
|
99
92
|
}
|
|
100
93
|
) : null,
|
|
101
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ m(
|
|
102
95
|
"div",
|
|
103
96
|
{
|
|
104
|
-
ref:
|
|
105
|
-
id:
|
|
106
|
-
className:
|
|
97
|
+
ref: V,
|
|
98
|
+
id: p,
|
|
99
|
+
className: o(
|
|
100
|
+
ie({ className: z, hasError: !!f, disabled: t })
|
|
101
|
+
),
|
|
107
102
|
role: "combobox",
|
|
108
|
-
onClick:
|
|
109
|
-
"aria-expanded":
|
|
110
|
-
tabIndex:
|
|
111
|
-
"aria-labelledby":
|
|
103
|
+
onClick: () => !t && K(!i),
|
|
104
|
+
"aria-expanded": i,
|
|
105
|
+
tabIndex: A.current,
|
|
106
|
+
"aria-labelledby": p,
|
|
112
107
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
/* @__PURE__ */ m("div", { className: "flex gap-2.5 items-center flex-1", children: [
|
|
109
|
+
e?.leftIcon && !N && /* @__PURE__ */ r("span", { className: "w-4 h-4 flex justify-center items-center dark:text-slate-50", children: e.leftIcon }),
|
|
110
|
+
N && /* @__PURE__ */ r(xe, { className: "w-4 h-4 text-zinc-500 select-none dark:text-slate-300 dark:group-focus-within:text-slate-50 transition-colors duration-300" }),
|
|
111
|
+
k ? /* @__PURE__ */ r(
|
|
117
112
|
"input",
|
|
118
113
|
{
|
|
119
|
-
ref: t,
|
|
120
114
|
type: "text",
|
|
121
|
-
value:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
className: s(ee({ className: D }), {
|
|
115
|
+
value: i ? B : e?.label ?? s ?? "",
|
|
116
|
+
onChange: X,
|
|
117
|
+
placeholder: w,
|
|
118
|
+
className: o(le({ className: F }), {
|
|
126
119
|
"text-red-700 placeholder:text-red-700": !!f
|
|
127
120
|
}),
|
|
128
|
-
onClick: (
|
|
129
|
-
|
|
121
|
+
onClick: (a) => {
|
|
122
|
+
a.stopPropagation(), t || j();
|
|
130
123
|
},
|
|
131
|
-
"aria-label": v ||
|
|
132
|
-
"aria-labelledby":
|
|
124
|
+
"aria-label": v || w,
|
|
125
|
+
"aria-labelledby": p,
|
|
133
126
|
required: h,
|
|
134
127
|
autoComplete: "off",
|
|
135
128
|
autoCapitalize: "words",
|
|
136
|
-
|
|
129
|
+
disabled: t,
|
|
130
|
+
tabIndex: -1,
|
|
131
|
+
...y
|
|
137
132
|
}
|
|
138
|
-
) : /* @__PURE__ */
|
|
139
|
-
|
|
133
|
+
) : /* @__PURE__ */ m(
|
|
134
|
+
se,
|
|
140
135
|
{
|
|
141
136
|
variant: "body2",
|
|
142
|
-
className:
|
|
143
|
-
"flex-1 text-zinc-400 text-sm dark:text-slate-400",
|
|
137
|
+
className: o(
|
|
138
|
+
"flex-1 text-zinc-400 text-sm dark:text-slate-400 flex gap-2 items-center",
|
|
144
139
|
{
|
|
145
140
|
"text-red-700": !!f,
|
|
146
|
-
"select-none": !
|
|
147
|
-
"text-slate-800 dark:text-slate-50":
|
|
148
|
-
|
|
141
|
+
"select-none": !e,
|
|
142
|
+
"text-slate-800 dark:text-slate-50": e,
|
|
143
|
+
"text-slate-400/50 dark:text-slate-50/50": t
|
|
144
|
+
},
|
|
145
|
+
e?.wrapperClassNameOnSelectedValue
|
|
149
146
|
),
|
|
150
|
-
children:
|
|
147
|
+
children: [
|
|
148
|
+
e?.label || w,
|
|
149
|
+
" ",
|
|
150
|
+
e?.showRightComponentOnselectedValue ? e?.rightComponent : null
|
|
151
|
+
]
|
|
151
152
|
}
|
|
152
153
|
)
|
|
153
154
|
] }),
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
g ? /* @__PURE__ */ r(ne, { className: "w-4 h-4 text-slate-400 animate-spin select-none" }) : !N && /* @__PURE__ */ r(
|
|
156
|
+
me,
|
|
156
157
|
{
|
|
157
|
-
"data-state":
|
|
158
|
-
className:
|
|
158
|
+
"data-state": i ? "open" : "closed",
|
|
159
|
+
className: o(
|
|
159
160
|
"w-4 h-4 text-zinc-500 transition-all duration-100 data-[state=open]:rotate-0 data-[state=closed]:rotate-180 select-none dark:group-focus-within:text-slate-50",
|
|
160
|
-
|
|
161
|
+
R,
|
|
161
162
|
{
|
|
162
|
-
"text-red-700": !!f
|
|
163
|
+
"text-red-700": !!f,
|
|
164
|
+
"text-slate-400/50 dark:group-focus-within:text-zinc-500": t
|
|
163
165
|
}
|
|
164
166
|
)
|
|
165
167
|
}
|
|
@@ -167,32 +169,37 @@ const se = [
|
|
|
167
169
|
]
|
|
168
170
|
}
|
|
169
171
|
),
|
|
170
|
-
|
|
172
|
+
/* @__PURE__ */ r(
|
|
171
173
|
"input",
|
|
172
174
|
{
|
|
173
|
-
ref:
|
|
175
|
+
ref: l,
|
|
174
176
|
type: "text",
|
|
175
|
-
name:
|
|
177
|
+
name: d,
|
|
176
178
|
className: "hidden",
|
|
177
179
|
"aria-hidden": "true",
|
|
178
180
|
required: h,
|
|
179
|
-
|
|
181
|
+
inert: !0,
|
|
182
|
+
defaultValue: e?.value ?? s ?? void 0,
|
|
183
|
+
...y
|
|
180
184
|
}
|
|
181
185
|
),
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
i && /* @__PURE__ */ r(
|
|
187
|
+
pe,
|
|
184
188
|
{
|
|
185
|
-
ref:
|
|
186
|
-
additionalOptions:
|
|
187
|
-
className:
|
|
188
|
-
itemClassName:
|
|
189
|
-
name:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
inputRef: t,
|
|
189
|
+
ref: L,
|
|
190
|
+
additionalOptions: b,
|
|
191
|
+
className: T,
|
|
192
|
+
itemClassName: D,
|
|
193
|
+
name: d,
|
|
194
|
+
wrapperInputRef: V,
|
|
195
|
+
inputRef: l,
|
|
193
196
|
options: n,
|
|
194
|
-
isLoading: !!
|
|
195
|
-
searchable:
|
|
197
|
+
isLoading: !!g,
|
|
198
|
+
searchable: k,
|
|
199
|
+
listItemSecondRowClassName: E,
|
|
200
|
+
isInfiniteScrollEnabled: _,
|
|
201
|
+
onFetchMoreOptions: $,
|
|
202
|
+
noOptionsText: U
|
|
196
203
|
}
|
|
197
204
|
)
|
|
198
205
|
]
|
|
@@ -201,5 +208,5 @@ const se = [
|
|
|
201
208
|
}
|
|
202
209
|
);
|
|
203
210
|
export {
|
|
204
|
-
|
|
211
|
+
je as Wrapper
|
|
205
212
|
};
|
|
@@ -4,6 +4,23 @@ const t = e({
|
|
|
4
4
|
isOpen: !1,
|
|
5
5
|
searchTerm: "",
|
|
6
6
|
value: void 0,
|
|
7
|
+
canFilter: !0,
|
|
8
|
+
canContinueFetching: !0,
|
|
9
|
+
page: 1,
|
|
10
|
+
options: [],
|
|
11
|
+
isTyping: !1,
|
|
12
|
+
setOptions() {
|
|
13
|
+
throw new Error("setOptions function must be overridden");
|
|
14
|
+
},
|
|
15
|
+
setPage() {
|
|
16
|
+
throw new Error("setPage function must be overridden");
|
|
17
|
+
},
|
|
18
|
+
setCanContinueFetching() {
|
|
19
|
+
throw new Error("setCanContinueFetching function must be overridden");
|
|
20
|
+
},
|
|
21
|
+
setCanFilter() {
|
|
22
|
+
throw new Error("setCanFilter function must be overridden");
|
|
23
|
+
},
|
|
7
24
|
setSearchTerm() {
|
|
8
25
|
throw new Error("setSearchTerm function must be overridden");
|
|
9
26
|
},
|
|
@@ -1,30 +1,58 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import { DropdownContext as
|
|
4
|
-
import { useToggle as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as G } from "react/jsx-runtime";
|
|
2
|
+
import { useState as e, useRef as f, useCallback as p, useEffect as T } from "react";
|
|
3
|
+
import { DropdownContext as L } from "./dropdown.context.js";
|
|
4
|
+
import { useToggle as N } from "../../../hooks/useToggle.js";
|
|
5
|
+
const c = 1, O = 300, U = ({
|
|
6
|
+
children: d,
|
|
7
|
+
value: C,
|
|
8
|
+
name: i,
|
|
9
|
+
highlightSearch: E = !1,
|
|
10
|
+
options: n,
|
|
11
|
+
onChange: a,
|
|
12
|
+
onBlur: u
|
|
13
|
+
}) => {
|
|
14
|
+
const [v, l] = e(n), F = f(E), [P, g] = N(!1), [D, I] = e(""), [S, b] = e(!0), [x, o] = e(!0), [A, s] = e(c), [_, h] = e(!1), t = f(void 0), w = p(
|
|
15
|
+
(r, m) => {
|
|
16
|
+
m?.current && (m.current.value = r), t.current && clearTimeout(t.current), h(!0), o(!0), s(c), a?.({ target: { value: r, name: i ?? "" } }), u?.(), t.current = setTimeout(() => {
|
|
17
|
+
h(!1);
|
|
18
|
+
}, O);
|
|
9
19
|
},
|
|
10
|
-
[
|
|
20
|
+
[a, i, u]
|
|
21
|
+
), y = p(
|
|
22
|
+
(r) => {
|
|
23
|
+
g(r), o(!0), s(c);
|
|
24
|
+
},
|
|
25
|
+
[g]
|
|
11
26
|
);
|
|
12
|
-
return
|
|
13
|
-
|
|
27
|
+
return T(() => {
|
|
28
|
+
l(n);
|
|
29
|
+
}, [n.length]), T(() => () => {
|
|
30
|
+
t.current && clearTimeout(t.current);
|
|
31
|
+
}, []), /* @__PURE__ */ G(
|
|
32
|
+
L.Provider,
|
|
14
33
|
{
|
|
15
34
|
value: {
|
|
16
|
-
highlightSearchEnabled:
|
|
17
|
-
isOpen:
|
|
18
|
-
searchTerm:
|
|
19
|
-
value:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
35
|
+
highlightSearchEnabled: F.current,
|
|
36
|
+
isOpen: P,
|
|
37
|
+
searchTerm: D,
|
|
38
|
+
value: C,
|
|
39
|
+
canFilter: S,
|
|
40
|
+
canContinueFetching: x,
|
|
41
|
+
page: A,
|
|
42
|
+
options: v,
|
|
43
|
+
isTyping: _,
|
|
44
|
+
setOptions: l,
|
|
45
|
+
setPage: s,
|
|
46
|
+
setCanContinueFetching: o,
|
|
47
|
+
setCanFilter: b,
|
|
48
|
+
setSearchTerm: I,
|
|
49
|
+
setValue: w,
|
|
50
|
+
toggleOpen: y
|
|
23
51
|
},
|
|
24
|
-
children:
|
|
52
|
+
children: d
|
|
25
53
|
}
|
|
26
54
|
);
|
|
27
55
|
};
|
|
28
56
|
export {
|
|
29
|
-
|
|
57
|
+
U as DropdownProvider
|
|
30
58
|
};
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useDropdownContext as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { useRef as m, useEffect as c, useCallback as b } from "react";
|
|
2
|
+
import { useDropdownContext as L } from "../contexts/dropdown.hook.js";
|
|
3
|
+
const p = ({
|
|
4
|
+
ulRef: f,
|
|
5
|
+
inputRef: t,
|
|
6
|
+
disabled: w,
|
|
7
|
+
internalValue: u,
|
|
8
|
+
onBlur: g
|
|
9
|
+
}) => {
|
|
10
|
+
const r = m(null), a = m(null), { value: i, setSearchTerm: v, setCanFilter: d, toggleOpen: n } = L();
|
|
11
|
+
c(() => {
|
|
12
|
+
const e = new AbortController(), o = (l) => {
|
|
13
|
+
l.key === "Escape" && n(!1);
|
|
14
|
+
}, s = (l) => {
|
|
15
|
+
r.current?.contains(l.target) || n(!1);
|
|
10
16
|
};
|
|
11
|
-
return document.addEventListener("keydown",
|
|
17
|
+
return document.addEventListener("keydown", o, {
|
|
12
18
|
signal: e.signal
|
|
13
|
-
}), document.addEventListener("mousedown",
|
|
19
|
+
}), document.addEventListener("mousedown", s, {
|
|
14
20
|
signal: e.signal
|
|
15
21
|
}), document.addEventListener(
|
|
16
22
|
"visibilitychange",
|
|
@@ -20,39 +26,78 @@ const w = ({ ulRef: l, inputRef: i }) => {
|
|
|
20
26
|
{
|
|
21
27
|
signal: e.signal
|
|
22
28
|
}
|
|
23
|
-
),
|
|
24
|
-
"
|
|
25
|
-
() => {
|
|
26
|
-
n(!0);
|
|
29
|
+
), a.current?.addEventListener(
|
|
30
|
+
"focusin",
|
|
31
|
+
(l) => {
|
|
32
|
+
!w && l.target?.matches(":focus-visible") && n(!0);
|
|
27
33
|
},
|
|
28
34
|
{ signal: e.signal }
|
|
29
35
|
), () => {
|
|
30
36
|
e.abort();
|
|
31
37
|
};
|
|
32
|
-
}, [n,
|
|
38
|
+
}, [n, r]), c(() => {
|
|
33
39
|
const e = new AbortController();
|
|
34
|
-
return
|
|
40
|
+
return a.current?.addEventListener(
|
|
35
41
|
"keydown",
|
|
36
|
-
(
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
|
|
42
|
+
(o) => {
|
|
43
|
+
if (o.key === "ArrowDown") {
|
|
44
|
+
const s = f.current?.querySelector("li");
|
|
45
|
+
s && s.focus();
|
|
40
46
|
}
|
|
41
47
|
},
|
|
42
48
|
{ signal: e.signal }
|
|
43
49
|
), () => {
|
|
44
50
|
e.abort();
|
|
45
51
|
};
|
|
46
|
-
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
}, [a, f]), c(() => {
|
|
53
|
+
const e = new AbortController();
|
|
54
|
+
return t?.current?.addEventListener(
|
|
55
|
+
"focusin",
|
|
56
|
+
() => {
|
|
57
|
+
v(u?.value ?? ""), d(!1);
|
|
58
|
+
},
|
|
59
|
+
{ signal: e.signal }
|
|
60
|
+
), t?.current?.addEventListener(
|
|
61
|
+
"focusout",
|
|
62
|
+
() => {
|
|
63
|
+
d(!0);
|
|
64
|
+
},
|
|
65
|
+
{ signal: e.signal }
|
|
66
|
+
), a.current?.addEventListener(
|
|
67
|
+
"focus",
|
|
68
|
+
() => {
|
|
69
|
+
d(!1);
|
|
70
|
+
},
|
|
71
|
+
{ signal: e.signal }
|
|
72
|
+
), r.current?.addEventListener(
|
|
73
|
+
"focusout",
|
|
74
|
+
(o) => {
|
|
75
|
+
r.current?.contains(o.relatedTarget) || n(!1);
|
|
76
|
+
},
|
|
77
|
+
{ signal: e.signal }
|
|
78
|
+
), () => {
|
|
79
|
+
e.abort();
|
|
80
|
+
};
|
|
81
|
+
}, [i]), c(() => {
|
|
82
|
+
t?.current && (t.current.value = i && u?.value || "");
|
|
83
|
+
}, [u, i]), c(() => {
|
|
84
|
+
const e = new AbortController();
|
|
85
|
+
return r.current?.addEventListener("focusout", (o) => {
|
|
86
|
+
const s = o.relatedTarget;
|
|
87
|
+
(!s || !r.current?.contains(s)) && (t?.current?.value || g?.());
|
|
88
|
+
}), () => {
|
|
89
|
+
e.abort();
|
|
90
|
+
};
|
|
91
|
+
}, [n, r, v, g, i]);
|
|
92
|
+
const E = b(() => {
|
|
93
|
+
n(!0), requestAnimationFrame(() => t?.current?.focus());
|
|
94
|
+
}, [t, n]);
|
|
50
95
|
return {
|
|
51
|
-
wrapperRef:
|
|
52
|
-
wrapperInputRef:
|
|
53
|
-
handleOpen:
|
|
96
|
+
wrapperRef: r,
|
|
97
|
+
wrapperInputRef: a,
|
|
98
|
+
handleOpen: E
|
|
54
99
|
};
|
|
55
100
|
};
|
|
56
101
|
export {
|
|
57
|
-
|
|
102
|
+
p as useDropdown
|
|
58
103
|
};
|