@konstructio/ui 0.1.2-alpha.5 → 0.1.2-alpha.51
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-CjC-CIJ8.js +99 -0
- package/dist/assets/icons/index.js +7 -0
- package/dist/chevron-down-DgT-uSF9.js +5 -0
- package/dist/chevron-right-DYvXLeql.js +7 -0
- package/dist/chevron-up-DEfvgPCw.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 +81 -53
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +3 -2
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Badge/Badge.js +41 -44
- package/dist/components/Badge/Badge.variants.js +52 -13
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +3 -3
- package/dist/components/Breadcrumb/components/Item/Item.js +22 -22
- package/dist/components/Breadcrumb/components/Item/Item.variants.js +25 -14
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.variants.js +108 -98
- package/dist/components/Card/Card.variants.js +7 -12
- package/dist/components/Checkbox/Checkbox.js +108 -105
- package/dist/components/Checkbox/Checkbox.variants.js +34 -7
- 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/Counter/Counter.js +210 -0
- package/dist/components/Counter/Counter.variants.js +70 -0
- package/dist/components/Datepicker/DatePicker.js +1587 -1353
- package/dist/components/Divider/Divider.variants.js +1 -1
- package/dist/components/DropdownButton/DropdownButton.js +1 -1
- package/dist/components/Filter/Filter.js +1 -1
- package/dist/components/Filter/Filter.variants.js +8 -7
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +71 -45
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.js +2 -2
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +76 -43
- package/dist/components/Filter/components/ResetButton/ResetButton.js +15 -12
- package/dist/components/Filter/events/index.js +3 -3
- package/dist/components/ImageUpload/ImageUpload.js +221 -0
- package/dist/components/ImageUpload/ImageUpload.variants.js +109 -0
- package/dist/components/Input/Input.js +185 -118
- package/dist/components/Input/Input.variants.js +24 -19
- 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 +30 -0
- package/dist/components/MultiSelectDropdown/components/Item/Item.js +30 -0
- package/dist/components/MultiSelectDropdown/components/Item/Item.variants.js +38 -0
- package/dist/components/MultiSelectDropdown/components/List/List.js +30 -0
- package/dist/components/MultiSelectDropdown/components/List/List.variants.js +25 -0
- package/dist/components/MultiSelectDropdown/components/Wrapper/Wrapper.js +119 -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/PhoneNumberInput/PhoneNumberInput.js +8 -0
- package/dist/components/PhoneNumberInput/PhoneNumberInput.variants.js +46 -0
- package/dist/components/PhoneNumberInput/components/FlagContent/FlagContent.js +36 -0
- package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +690 -0
- package/dist/components/PhoneNumberInput/components/FlagSelectorWrapper/FlagSelectorWrapper.js +60 -0
- package/dist/components/PhoneNumberInput/components/TruncateText/TruncateText.js +45 -0
- package/dist/components/PhoneNumberInput/components/Wrapper.js +651 -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 +463 -482
- package/dist/components/Radio/Radio.js +47 -44
- package/dist/components/Radio/Radio.variants.js +12 -8
- package/dist/components/RadioCard/RadioCard.variants.js +1 -6
- package/dist/components/RadioGroup/RadioGroup.js +10 -10
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Select/Select.js +48 -0
- package/dist/components/{Dropdown/Dropdown.variants.js → Select/Select.variants.js} +17 -11
- package/dist/components/Select/components/List/List.js +172 -0
- package/dist/components/{Dropdown → Select}/components/List/List.variants.js +11 -8
- package/dist/components/Select/components/ListItem/ListItem.js +117 -0
- package/dist/components/{Dropdown → Select}/components/ListItem/ListItem.variants.js +5 -4
- package/dist/components/Select/components/Wrapper.js +226 -0
- package/dist/components/Select/constants/index.js +4 -0
- package/dist/components/Select/constants/pagination.js +4 -0
- package/dist/components/Select/contexts/index.js +6 -0
- package/dist/components/Select/contexts/select.context.js +36 -0
- package/dist/components/Select/contexts/select.hook.js +11 -0
- package/dist/components/Select/contexts/select.provider.js +58 -0
- package/dist/components/Select/hooks/useNavigationList.js +50 -0
- package/dist/components/Select/hooks/useSelect.js +103 -0
- package/dist/components/Sidebar/Sidebar.variants.js +2 -2
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +156 -129
- package/dist/components/Switch/Switch.variants.js +19 -10
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/Tabs.variants.js +4 -3
- 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.js +1 -1
- package/dist/components/TimePicker/TimePicker.variants.js +26 -14
- package/dist/components/TimePicker/components/MeridianList/MeridianList.js +30 -20
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +57 -35
- package/dist/components/TimePicker/components/WrapperList/WrapperList.js +53 -45
- package/dist/components/Toast/Toast.js +283 -256
- 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.js +23 -25
- package/dist/components/Typography/Typography.variants.js +55 -52
- package/dist/components/VirtualizedTable/VirtualizedTable.js +97 -71
- package/dist/components/VirtualizedTable/components/Actions/Actions.js +95 -33
- package/dist/components/VirtualizedTable/components/Body/Body.js +73 -21
- package/dist/components/VirtualizedTable/components/DotPaginate/DotPaginate.js +94 -91
- package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +20 -20
- package/dist/components/VirtualizedTable/components/Filter/Filter.js +61 -44
- package/dist/components/VirtualizedTable/components/FormPaginate/FormPaginate.js +33 -21
- package/dist/components/VirtualizedTable/components/Header/Header.js +61 -41
- package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +43 -22
- package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +106 -0
- package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +22 -1858
- package/dist/components/VirtualizedTable/components/WrapperBody/WrapperBody.js +27 -0
- package/dist/components/VirtualizedTable/components/index.js +8 -6
- package/dist/components/VirtualizedTable/contexts/table.context.js +1 -0
- package/dist/components/VirtualizedTable/contexts/table.provider.js +68 -761
- package/dist/components/index.js +94 -86
- package/dist/contexts/theme.provider.js +0 -1
- package/dist/{createLucideIcon-D2CN7Ma9.js → createLucideIcon-D4r5Phnh.js} +0 -24
- package/dist/ellipsis-vertical-BVPtjl5f.js +9 -0
- package/dist/{index-C1g_chDT.js → index-AV6ZtGhy.js} +2 -2
- package/dist/index-BG8O18ZY.js +93 -0
- package/dist/index-BKjcReYh.js +55 -0
- package/dist/{index-N2OStZoU.js → index-BOE_3f_Z.js} +4 -25
- package/dist/{index-Cd2vhaop.js → index-BlSRBdPy.js} +5 -6
- package/dist/index-BmVmDQGH.js +662 -0
- package/dist/index-BvoZGpli.js +60 -0
- package/dist/index-Byr10W8m.js +1873 -0
- package/dist/{index-Dx2grAuN.js → index-CSWGJT-v.js} +0 -20
- package/dist/index-CeZcoQDw.js +479 -0
- package/dist/index-D6KzX_ef.js +135 -0
- package/dist/{index-B7t8D14s.js → index-D9SSJ6om.js} +4 -4
- package/dist/index-DKfEnhKr.js +200 -0
- package/dist/index-DLcqcWxM.js +29 -0
- package/dist/{index-ti1b9kqV.js → index-DMb4KD0b.js} +4 -4
- package/dist/{index-BAEWsOG1.js → index-DtEcCIrM.js} +1 -1
- package/dist/{index-bwWKd82e.js → index-Dy59FQl5.js} +1 -1
- package/dist/{index-C84F4YyO.js → index-gSPwC-1I.js} +10 -11
- package/dist/{index-Bnb0ezr3.js → index-vcSp8YRZ.js} +11 -12
- package/dist/index.d.ts +2142 -99
- package/dist/index.js +116 -106
- package/dist/libphonenumber-FTwQ9nyV.js +11549 -0
- package/dist/loader-juvMSJ9L.js +5 -0
- package/dist/package.json +43 -33
- package/dist/styles.css +1 -1
- package/dist/ui/civo-theme.css +194 -168
- package/dist/ui/theme.css +27 -0
- package/dist/{useBreadcrumb-B8DnuqkR.js → useBreadcrumb-BAHbGQ_O.js} +0 -10
- package/dist/utils/index.js +534 -501
- package/dist/x-BXShoIAM.js +8 -0
- package/dist/{x-4F_5p77m.js → x-Eoa9FJjA.js} +1 -1
- package/package.json +43 -33
- package/dist/Modal-D-NOEWMX.js +0 -98
- package/dist/chevron-down-MZvQoT2F.js +0 -11
- package/dist/chevron-right-VYBOBhRt.js +0 -19
- package/dist/components/Dropdown/Dropdown.js +0 -42
- package/dist/components/Dropdown/components/List/List.js +0 -79
- package/dist/components/Dropdown/components/ListItem/ListItem.js +0 -67
- package/dist/components/Dropdown/components/Wrapper.js +0 -205
- package/dist/components/Dropdown/contexts/dropdown.context.js +0 -19
- package/dist/components/Dropdown/contexts/dropdown.hook.js +0 -13
- package/dist/components/Dropdown/contexts/dropdown.provider.js +0 -30
- package/dist/components/Dropdown/contexts/index.js +0 -6
- package/dist/components/Dropdown/hooks/useDropdown.js +0 -58
- package/dist/components/Dropdown/hooks/useNavigationList.js +0 -62
- package/dist/components/NumberInput/NumberInput.js +0 -179
- package/dist/components/NumberInput/NumberInput.variants.js +0 -50
- package/dist/components/TimePicker/components/WrapperList/WrapperList.variants.js +0 -16
- package/dist/index-BITvcJAz.js +0 -423
- package/dist/index-BfXxHr_2.js +0 -125
- package/dist/index-Cvx4lqTq.js +0 -47
- package/dist/index-DBbEcSUG.js +0 -31
- package/dist/index-DQH6odE9.js +0 -82
- package/dist/index-DzIBBMjs.js +0 -436
- package/dist/index-os7vysFS.js +0 -131
- /package/dist/components/{Dropdown → Select}/components/EmptyList.js +0 -0
- /package/dist/components/{Dropdown → Select}/components/index.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { c as r } from "../../../../index-D29mdTf5.js";
|
|
2
2
|
const t = r([
|
|
3
3
|
"cursor-pointer",
|
|
4
|
-
"py-
|
|
5
|
-
"px-
|
|
4
|
+
"py-1.5",
|
|
5
|
+
"px-6",
|
|
6
6
|
"h-full",
|
|
7
7
|
"focus-visible:outline-none",
|
|
8
8
|
"m-0",
|
|
@@ -12,10 +12,11 @@ const t = r([
|
|
|
12
12
|
"gap-3",
|
|
13
13
|
"transition-bg",
|
|
14
14
|
"duration-250",
|
|
15
|
+
"min-h-10",
|
|
15
16
|
"hover:bg-gray-50",
|
|
16
17
|
"focus:bg-gray-50",
|
|
17
|
-
"dark:hover:bg-
|
|
18
|
-
"dark:focus:bg-
|
|
18
|
+
"dark:hover:bg-metal-700",
|
|
19
|
+
"dark:focus:bg-metal-700"
|
|
19
20
|
]);
|
|
20
21
|
export {
|
|
21
22
|
t as listItemVariants
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Z, useId as ee, useRef as w, useMemo as te, useImperativeHandle as ae, useEffect as re } from "react";
|
|
3
|
+
import { S as le } from "../../../loader-juvMSJ9L.js";
|
|
4
|
+
import { Typography as ne } from "../../Typography/Typography.js";
|
|
5
|
+
import { cn as n } from "../../../utils/index.js";
|
|
6
|
+
import { labelVariants as oe, inputVariants as se, selectVariants as ce } from "../Select.variants.js";
|
|
7
|
+
import { useSelect as ie } from "../hooks/useSelect.js";
|
|
8
|
+
import { List as me } from "./List/List.js";
|
|
9
|
+
import { c as pe } from "../../../createLucideIcon-D4r5Phnh.js";
|
|
10
|
+
import { C as ue } from "../../../chevron-up-DrQr2Fwd.js";
|
|
11
|
+
import { useSelectContext as fe } from "../contexts/select.hook.js";
|
|
12
|
+
const de = [
|
|
13
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
14
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
15
|
+
], xe = pe("search", de), je = Z(
|
|
16
|
+
({
|
|
17
|
+
additionalOptions: b,
|
|
18
|
+
className: z,
|
|
19
|
+
defaultValue: x,
|
|
20
|
+
disabled: t = !1,
|
|
21
|
+
error: f,
|
|
22
|
+
iconClassName: R,
|
|
23
|
+
inputClassName: S,
|
|
24
|
+
isInfiniteScrollEnabled: F = !1,
|
|
25
|
+
isLoading: g,
|
|
26
|
+
isRequired: h,
|
|
27
|
+
label: v,
|
|
28
|
+
labelClassName: T,
|
|
29
|
+
listClassName: E,
|
|
30
|
+
listItemClassName: M,
|
|
31
|
+
listItemSecondRowClassName: W,
|
|
32
|
+
name: d,
|
|
33
|
+
noOptionsText: _,
|
|
34
|
+
placeholder: N,
|
|
35
|
+
searchable: k = !1,
|
|
36
|
+
showSearchIcon: C,
|
|
37
|
+
theme: $,
|
|
38
|
+
wrapperClassName: H,
|
|
39
|
+
onFetchMoreOptions: P,
|
|
40
|
+
onBlur: U,
|
|
41
|
+
onSearchChange: q,
|
|
42
|
+
...y
|
|
43
|
+
}, A) => {
|
|
44
|
+
const I = ee(), s = w(null), L = w(null), B = w(0), {
|
|
45
|
+
isOpen: c,
|
|
46
|
+
options: l,
|
|
47
|
+
searchTerm: D,
|
|
48
|
+
value: o,
|
|
49
|
+
setCanFilter: G,
|
|
50
|
+
setSearchTerm: J,
|
|
51
|
+
setValue: i,
|
|
52
|
+
toggleOpen: K
|
|
53
|
+
} = fe(), e = te(() => l.find(({ value: a }) => a === o), [l, o]), { wrapperRef: Q, wrapperInputRef: V, handleOpen: j } = ie({
|
|
54
|
+
ulRef: L,
|
|
55
|
+
inputRef: s,
|
|
56
|
+
disabled: t,
|
|
57
|
+
internalValue: e,
|
|
58
|
+
onBlur: U
|
|
59
|
+
}), m = d ? `${I}-${d}` : I;
|
|
60
|
+
ae(A, () => s.current, [s]), re(() => {
|
|
61
|
+
if (x && !o) {
|
|
62
|
+
const a = l && l.find((p) => p.value === x);
|
|
63
|
+
a && i(a.value);
|
|
64
|
+
}
|
|
65
|
+
}, [x, l, i, o]);
|
|
66
|
+
const X = (a) => {
|
|
67
|
+
const p = a.target.value;
|
|
68
|
+
G(!0), i(""), J(p ?? ""), q?.(p);
|
|
69
|
+
const O = l.find(
|
|
70
|
+
(Y) => Y.value.toLocaleLowerCase() === p.toLocaleLowerCase()
|
|
71
|
+
);
|
|
72
|
+
i(O ? O.value : e?.value ?? "");
|
|
73
|
+
};
|
|
74
|
+
return /* @__PURE__ */ u(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
ref: Q,
|
|
78
|
+
className: n("flex flex-col w-full relative", H),
|
|
79
|
+
"data-theme": $,
|
|
80
|
+
children: [
|
|
81
|
+
v ? /* @__PURE__ */ u(
|
|
82
|
+
"label",
|
|
83
|
+
{
|
|
84
|
+
id: m,
|
|
85
|
+
className: n(oe({ className: T })),
|
|
86
|
+
htmlFor: m,
|
|
87
|
+
onClick: () => !t && j(),
|
|
88
|
+
children: [
|
|
89
|
+
v,
|
|
90
|
+
h && /* @__PURE__ */ r("span", { className: "text-red-600 dark:text-red-500 ml-1", children: "*" })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
) : null,
|
|
94
|
+
/* @__PURE__ */ u(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
ref: V,
|
|
98
|
+
id: m,
|
|
99
|
+
className: n(
|
|
100
|
+
ce({ className: z, hasError: !!f, disabled: t })
|
|
101
|
+
),
|
|
102
|
+
role: "combobox",
|
|
103
|
+
onClick: () => !t && K(!c),
|
|
104
|
+
"aria-expanded": c,
|
|
105
|
+
tabIndex: B.current,
|
|
106
|
+
"aria-labelledby": m,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ u("div", { className: "flex gap-2.5 items-center flex-1", children: [
|
|
109
|
+
e?.leftIcon && !C && /* @__PURE__ */ r("span", { className: "w-4 h-4 flex justify-center items-center dark:text-metal-50", children: e.leftIcon }),
|
|
110
|
+
C && /* @__PURE__ */ r(
|
|
111
|
+
xe,
|
|
112
|
+
{
|
|
113
|
+
className: n(
|
|
114
|
+
"w-4",
|
|
115
|
+
"h-4",
|
|
116
|
+
"text-zinc-500",
|
|
117
|
+
"select-none",
|
|
118
|
+
"transition-colors",
|
|
119
|
+
"duration-300",
|
|
120
|
+
"dark:text-metal-300",
|
|
121
|
+
"dark:group-focus-within:text-metal-50"
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
k ? /* @__PURE__ */ r(
|
|
126
|
+
"input",
|
|
127
|
+
{
|
|
128
|
+
type: "text",
|
|
129
|
+
value: c ? D : e?.label ?? o ?? "",
|
|
130
|
+
onChange: X,
|
|
131
|
+
placeholder: N,
|
|
132
|
+
className: n(se({ className: S }), {
|
|
133
|
+
"text-red-700 placeholder:text-red-700": !!f
|
|
134
|
+
}),
|
|
135
|
+
onClick: (a) => {
|
|
136
|
+
a.stopPropagation(), t || j();
|
|
137
|
+
},
|
|
138
|
+
"aria-label": v || N,
|
|
139
|
+
"aria-labelledby": m,
|
|
140
|
+
required: h,
|
|
141
|
+
autoComplete: "off",
|
|
142
|
+
autoCapitalize: "words",
|
|
143
|
+
disabled: t,
|
|
144
|
+
tabIndex: -1,
|
|
145
|
+
...y
|
|
146
|
+
}
|
|
147
|
+
) : /* @__PURE__ */ u(
|
|
148
|
+
ne,
|
|
149
|
+
{
|
|
150
|
+
variant: "body2",
|
|
151
|
+
className: n(
|
|
152
|
+
"flex-1 text-zinc-400 text-sm dark:text-metal-400 flex gap-2 items-center",
|
|
153
|
+
{
|
|
154
|
+
"text-red-700": !!f,
|
|
155
|
+
"select-none": !e,
|
|
156
|
+
"text-metal-800 dark:text-metal-50": e,
|
|
157
|
+
"text-metal-400/50 dark:text-metal-50/50": t
|
|
158
|
+
},
|
|
159
|
+
e?.wrapperClassNameOnSelectedValue
|
|
160
|
+
),
|
|
161
|
+
children: [
|
|
162
|
+
e?.label || N,
|
|
163
|
+
" ",
|
|
164
|
+
e?.showRightComponentOnselectedValue ? e?.rightComponent : null
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] }),
|
|
169
|
+
g ? /* @__PURE__ */ r(le, { className: "w-4 h-4 text-metal-400 animate-spin select-none" }) : !C && /* @__PURE__ */ r(
|
|
170
|
+
ue,
|
|
171
|
+
{
|
|
172
|
+
"data-state": c ? "open" : "closed",
|
|
173
|
+
className: n(
|
|
174
|
+
"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-metal-50",
|
|
175
|
+
R,
|
|
176
|
+
{
|
|
177
|
+
"text-red-700": !!f,
|
|
178
|
+
"text-metal-400/50 dark:group-focus-within:text-zinc-500": t
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ r(
|
|
187
|
+
"input",
|
|
188
|
+
{
|
|
189
|
+
ref: s,
|
|
190
|
+
type: "text",
|
|
191
|
+
name: d,
|
|
192
|
+
className: "hidden",
|
|
193
|
+
"aria-hidden": "true",
|
|
194
|
+
required: h,
|
|
195
|
+
inert: !0,
|
|
196
|
+
defaultValue: e?.value ?? o ?? void 0,
|
|
197
|
+
...y
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
c && /* @__PURE__ */ r(
|
|
201
|
+
me,
|
|
202
|
+
{
|
|
203
|
+
ref: L,
|
|
204
|
+
additionalOptions: b,
|
|
205
|
+
className: E,
|
|
206
|
+
itemClassName: M,
|
|
207
|
+
name: d,
|
|
208
|
+
wrapperInputRef: V,
|
|
209
|
+
inputRef: s,
|
|
210
|
+
options: l,
|
|
211
|
+
isLoading: !!g,
|
|
212
|
+
searchable: k,
|
|
213
|
+
listItemSecondRowClassName: W,
|
|
214
|
+
isInfiniteScrollEnabled: F,
|
|
215
|
+
onFetchMoreOptions: P,
|
|
216
|
+
noOptionsText: _
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
export {
|
|
225
|
+
je as Wrapper
|
|
226
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createContext as e } from "react";
|
|
2
|
+
const r = e({
|
|
3
|
+
highlightSearchEnabled: !1,
|
|
4
|
+
isOpen: !1,
|
|
5
|
+
searchTerm: "",
|
|
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
|
+
},
|
|
24
|
+
setSearchTerm() {
|
|
25
|
+
throw new Error("setSearchTerm function must be overridden");
|
|
26
|
+
},
|
|
27
|
+
setValue() {
|
|
28
|
+
throw new Error("setValue function must be overridden");
|
|
29
|
+
},
|
|
30
|
+
toggleOpen() {
|
|
31
|
+
throw new Error("toggleOpen function must be overridden");
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
r as SelectContext
|
|
36
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext as e } from "react";
|
|
2
|
+
import { SelectContext as o } from "./select.context.js";
|
|
3
|
+
const c = () => {
|
|
4
|
+
const t = e(o);
|
|
5
|
+
if (!t)
|
|
6
|
+
throw new Error("useSelectContext must be used within a SelectProvider");
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
c as useSelectContext
|
|
11
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as L } from "react/jsx-runtime";
|
|
2
|
+
import { useState as e, useRef as f, useCallback as T, useEffect as p } from "react";
|
|
3
|
+
import { SelectContext as N } from "./select.context.js";
|
|
4
|
+
import { useToggle as O } from "../../../hooks/useToggle.js";
|
|
5
|
+
const c = 1, R = 300, V = ({
|
|
6
|
+
children: C,
|
|
7
|
+
value: E,
|
|
8
|
+
name: i,
|
|
9
|
+
highlightSearch: S = !1,
|
|
10
|
+
options: n,
|
|
11
|
+
onChange: a,
|
|
12
|
+
onBlur: u
|
|
13
|
+
}) => {
|
|
14
|
+
const [d, l] = e(n), v = f(S), [F, g] = O(!1), [P, I] = e(""), [b, x] = e(!0), [A, o] = e(!0), [_, s] = e(c), [y, h] = e(!1), t = f(void 0), D = T(
|
|
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
|
+
}, R);
|
|
19
|
+
},
|
|
20
|
+
[a, i, u]
|
|
21
|
+
), G = T(
|
|
22
|
+
(r) => {
|
|
23
|
+
g(r), o(!0), s(c);
|
|
24
|
+
},
|
|
25
|
+
[g]
|
|
26
|
+
);
|
|
27
|
+
return p(() => {
|
|
28
|
+
l(n);
|
|
29
|
+
}, [n.length]), p(() => () => {
|
|
30
|
+
t.current && clearTimeout(t.current);
|
|
31
|
+
}, []), /* @__PURE__ */ L(
|
|
32
|
+
N.Provider,
|
|
33
|
+
{
|
|
34
|
+
value: {
|
|
35
|
+
highlightSearchEnabled: v.current,
|
|
36
|
+
isOpen: F,
|
|
37
|
+
searchTerm: P,
|
|
38
|
+
value: E,
|
|
39
|
+
canFilter: b,
|
|
40
|
+
canContinueFetching: A,
|
|
41
|
+
page: _,
|
|
42
|
+
options: d,
|
|
43
|
+
isTyping: y,
|
|
44
|
+
setOptions: l,
|
|
45
|
+
setPage: s,
|
|
46
|
+
setCanContinueFetching: o,
|
|
47
|
+
setCanFilter: x,
|
|
48
|
+
setSearchTerm: I,
|
|
49
|
+
setValue: D,
|
|
50
|
+
toggleOpen: G
|
|
51
|
+
},
|
|
52
|
+
children: C
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
V as SelectProvider
|
|
58
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useRef as g, useEffect as a } from "react";
|
|
2
|
+
import { useSelectContext as k } from "../contexts/select.hook.js";
|
|
3
|
+
const d = ({
|
|
4
|
+
searchable: o,
|
|
5
|
+
ulRef: n,
|
|
6
|
+
wrapperInputRef: e,
|
|
7
|
+
filteredOptions: f
|
|
8
|
+
}) => {
|
|
9
|
+
const r = g(0), { isOpen: s } = k();
|
|
10
|
+
a(() => {
|
|
11
|
+
const m = n.current?.querySelectorAll("li") ?? [], t = Array.from(m).filter(
|
|
12
|
+
(c) => c.getAttribute("data-action") !== "true"
|
|
13
|
+
), u = new AbortController(), i = () => {
|
|
14
|
+
r.current < t.length - 1 ? (r.current = r.current + 1, t[r.current].focus()) : (r.current = 0, t[0].focus());
|
|
15
|
+
}, l = () => {
|
|
16
|
+
r.current > 0 ? (r.current = r.current - 1, t[r.current].focus()) : (r.current = 0, e?.current && o ? e.current.querySelector("input")?.focus() : e.current?.focus());
|
|
17
|
+
};
|
|
18
|
+
return n.current?.addEventListener(
|
|
19
|
+
"keydown",
|
|
20
|
+
(c) => {
|
|
21
|
+
switch (c.preventDefault(), c.key) {
|
|
22
|
+
case "ArrowDown": {
|
|
23
|
+
i();
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case "Tab": {
|
|
27
|
+
c.shiftKey ? l() : i();
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case "ArrowUp": {
|
|
31
|
+
r.current === 0 ? e.current?.focus() : l();
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "Enter": {
|
|
35
|
+
t[r.current]?.click();
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{ signal: u.signal }
|
|
41
|
+
), () => {
|
|
42
|
+
u.abort();
|
|
43
|
+
};
|
|
44
|
+
}, [n, r, e, o, f.length]), a(() => {
|
|
45
|
+
s || (r.current = 0);
|
|
46
|
+
}, [s]);
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
d as useNavigationUlList
|
|
50
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { useRef as m, useEffect as c, useCallback as w } from "react";
|
|
2
|
+
import { useSelectContext as L } from "../contexts/select.hook.js";
|
|
3
|
+
const y = ({
|
|
4
|
+
ulRef: f,
|
|
5
|
+
inputRef: r,
|
|
6
|
+
disabled: E,
|
|
7
|
+
internalValue: u,
|
|
8
|
+
onBlur: g
|
|
9
|
+
}) => {
|
|
10
|
+
const t = m(null), a = m(null), { value: i, setSearchTerm: v, setCanFilter: d, toggleOpen: n } = L();
|
|
11
|
+
c(() => {
|
|
12
|
+
const e = new AbortController(), s = (l) => {
|
|
13
|
+
l.key === "Escape" && n(!1);
|
|
14
|
+
}, o = (l) => {
|
|
15
|
+
t.current?.contains(l.target) || n(!1);
|
|
16
|
+
};
|
|
17
|
+
return document.addEventListener("keydown", s, {
|
|
18
|
+
signal: e.signal
|
|
19
|
+
}), document.addEventListener("mousedown", o, {
|
|
20
|
+
signal: e.signal
|
|
21
|
+
}), document.addEventListener(
|
|
22
|
+
"visibilitychange",
|
|
23
|
+
() => {
|
|
24
|
+
document.hidden && n(!1);
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
signal: e.signal
|
|
28
|
+
}
|
|
29
|
+
), a.current?.addEventListener(
|
|
30
|
+
"focusin",
|
|
31
|
+
(l) => {
|
|
32
|
+
!E && l.target?.matches(":focus-visible") && n(!0);
|
|
33
|
+
},
|
|
34
|
+
{ signal: e.signal }
|
|
35
|
+
), () => {
|
|
36
|
+
e.abort();
|
|
37
|
+
};
|
|
38
|
+
}, [n, t]), c(() => {
|
|
39
|
+
const e = new AbortController();
|
|
40
|
+
return a.current?.addEventListener(
|
|
41
|
+
"keydown",
|
|
42
|
+
(s) => {
|
|
43
|
+
if (s.key === "ArrowDown") {
|
|
44
|
+
const o = f.current?.querySelector("li");
|
|
45
|
+
o && o.focus();
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{ signal: e.signal }
|
|
49
|
+
), () => {
|
|
50
|
+
e.abort();
|
|
51
|
+
};
|
|
52
|
+
}, [a, f]), c(() => {
|
|
53
|
+
const e = new AbortController();
|
|
54
|
+
return r?.current?.addEventListener(
|
|
55
|
+
"focusin",
|
|
56
|
+
() => {
|
|
57
|
+
v(u?.value ?? ""), d(!1);
|
|
58
|
+
},
|
|
59
|
+
{ signal: e.signal }
|
|
60
|
+
), r?.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
|
+
), t.current?.addEventListener(
|
|
73
|
+
"focusout",
|
|
74
|
+
(s) => {
|
|
75
|
+
t.current?.contains(s.relatedTarget) || n(!1);
|
|
76
|
+
},
|
|
77
|
+
{ signal: e.signal }
|
|
78
|
+
), () => {
|
|
79
|
+
e.abort();
|
|
80
|
+
};
|
|
81
|
+
}, [i]), c(() => {
|
|
82
|
+
r?.current && (r.current.value = i && u?.value || "");
|
|
83
|
+
}, [u, i]), c(() => {
|
|
84
|
+
const e = new AbortController();
|
|
85
|
+
return t.current?.addEventListener("focusout", (s) => {
|
|
86
|
+
const o = s.relatedTarget;
|
|
87
|
+
(!o || !t.current?.contains(o)) && (r?.current?.value || g?.());
|
|
88
|
+
}), () => {
|
|
89
|
+
e.abort();
|
|
90
|
+
};
|
|
91
|
+
}, [n, t, v, g, i]);
|
|
92
|
+
const b = w(() => {
|
|
93
|
+
n(!0), requestAnimationFrame(() => r?.current?.focus());
|
|
94
|
+
}, [r, n]);
|
|
95
|
+
return {
|
|
96
|
+
wrapperRef: t,
|
|
97
|
+
wrapperInputRef: a,
|
|
98
|
+
handleOpen: b
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
y as useSelect
|
|
103
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { R as x, T as N, b as v } from "../../index-
|
|
2
|
+
import { R as x, T as N, b as v } from "../../index-gSPwC-1I.js";
|
|
3
3
|
import { forwardRef as V, useRef as b, useState as R, useImperativeHandle as g, useEffect as j, useCallback as k } from "react";
|
|
4
4
|
import { cn as r } from "../../utils/index.js";
|
|
5
5
|
import { trackVariants as w, thumbVariants as y, sliderVariants as C } from "./Slider.variants.js";
|