@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,42 +1,48 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { jsx as s, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as h } from "react";
|
|
3
|
+
import { cn as o } from "../../utils/index.js";
|
|
4
|
+
import { DropdownProvider as v } from "./contexts/dropdown.provider.js";
|
|
5
|
+
import { Wrapper as N } from "./components/Wrapper.js";
|
|
6
|
+
const W = h(
|
|
6
7
|
({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
c,
|
|
8
|
+
error: t,
|
|
9
|
+
errorClassName: i,
|
|
10
|
+
helperText: r,
|
|
11
|
+
helperTextClassName: m,
|
|
12
|
+
highlightSearch: a,
|
|
13
|
+
mainWrapperClassName: p,
|
|
14
|
+
name: l,
|
|
15
|
+
value: d,
|
|
16
|
+
options: n,
|
|
17
|
+
onChange: c,
|
|
18
|
+
onBlur: e,
|
|
19
|
+
...f
|
|
20
|
+
}, x) => /* @__PURE__ */ s(
|
|
21
|
+
v,
|
|
17
22
|
{
|
|
18
|
-
highlightSearch:
|
|
19
|
-
name:
|
|
20
|
-
value:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
highlightSearch: a,
|
|
24
|
+
name: l,
|
|
25
|
+
value: d,
|
|
26
|
+
options: n,
|
|
27
|
+
onBlur: e,
|
|
28
|
+
onChange: c,
|
|
29
|
+
children: /* @__PURE__ */ w("div", { className: o("relative w-full", p), children: [
|
|
30
|
+
/* @__PURE__ */ s(
|
|
31
|
+
N,
|
|
26
32
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
ref:
|
|
30
|
-
onBlur:
|
|
31
|
-
...
|
|
33
|
+
error: t,
|
|
34
|
+
name: l,
|
|
35
|
+
ref: x,
|
|
36
|
+
onBlur: e,
|
|
37
|
+
...f
|
|
32
38
|
}
|
|
33
39
|
),
|
|
34
|
-
|
|
35
|
-
!
|
|
40
|
+
t ? /* @__PURE__ */ s("span", { className: o("text-xs text-red-700", i), children: t }) : null,
|
|
41
|
+
!t && r ? /* @__PURE__ */ s("span", { className: o("text-xs text-slate-600", m), children: r }) : null
|
|
36
42
|
] })
|
|
37
43
|
}
|
|
38
44
|
)
|
|
39
45
|
);
|
|
40
46
|
export {
|
|
41
|
-
|
|
47
|
+
W as Dropdown
|
|
42
48
|
};
|
|
@@ -35,10 +35,15 @@ const a = e(
|
|
|
35
35
|
"kubefirst:text-red-600"
|
|
36
36
|
],
|
|
37
37
|
false: ""
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
true: ["cursor-default", "bg-gray-100", "dark:bg-slate-700/80"],
|
|
41
|
+
false: []
|
|
38
42
|
}
|
|
39
43
|
},
|
|
40
44
|
defaultVariants: {
|
|
41
|
-
hasError: !1
|
|
45
|
+
hasError: !1,
|
|
46
|
+
disabled: !1
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
), t = e([
|
|
@@ -54,16 +59,16 @@ const a = e(
|
|
|
54
59
|
"placeholder:select-none",
|
|
55
60
|
"dark:placeholder:text-slate-400",
|
|
56
61
|
"dark:text-slate-50"
|
|
57
|
-
]),
|
|
62
|
+
]), d = e([
|
|
58
63
|
"mb-1",
|
|
59
64
|
"cursor-pointer",
|
|
60
65
|
"text-sm",
|
|
61
|
-
"leading-
|
|
66
|
+
"leading-5",
|
|
62
67
|
"tracking-[0.1px]",
|
|
63
68
|
"dark:text-slate-50"
|
|
64
69
|
]);
|
|
65
70
|
export {
|
|
66
71
|
a as dropdownVariants,
|
|
67
72
|
t as inputVariants,
|
|
68
|
-
|
|
73
|
+
d as labelVariants
|
|
69
74
|
};
|
|
@@ -1,76 +1,145 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
1
|
+
import { jsxs as V, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { S as Z } from "../../../../index-BtQfgaSF.js";
|
|
3
|
+
import { d as B } from "../../../../debounce-BFejQm9P.js";
|
|
4
|
+
import { forwardRef as G, useRef as C, useState as J, useImperativeHandle as K, useMemo as M, useEffect as Q } from "react";
|
|
5
|
+
import { Loading as R } from "../../../Loading/Loading.js";
|
|
6
|
+
import { cn as a } from "../../../../utils/index.js";
|
|
7
|
+
import { useNavigationUlList as W } from "../../hooks/useNavigationList.js";
|
|
8
|
+
import { ListItem as b } from "../ListItem/ListItem.js";
|
|
9
|
+
import { listVariants as X } from "./List.variants.js";
|
|
10
|
+
import { DEFAULT_LIST_SIZE as Y } from "../../constants/pagination.js";
|
|
11
|
+
import { useDropdownContext as $ } from "../../contexts/dropdown.hook.js";
|
|
12
|
+
const fe = G(
|
|
10
13
|
({
|
|
11
|
-
additionalOptions:
|
|
12
|
-
className:
|
|
13
|
-
inputRef:
|
|
14
|
-
isLoading:
|
|
15
|
-
itemClassName:
|
|
16
|
-
name:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
wrapperInputRef:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
additionalOptions: F,
|
|
15
|
+
className: N,
|
|
16
|
+
inputRef: i,
|
|
17
|
+
isLoading: E,
|
|
18
|
+
itemClassName: l,
|
|
19
|
+
name: I,
|
|
20
|
+
searchable: y = !1,
|
|
21
|
+
listItemSecondRowClassName: c,
|
|
22
|
+
wrapperInputRef: j,
|
|
23
|
+
isInfiniteScrollEnabled: u,
|
|
24
|
+
onFetchMoreOptions: f,
|
|
25
|
+
noOptionsText: L
|
|
26
|
+
}, O) => {
|
|
27
|
+
const o = C(null), m = C(null), [p, w] = J(!1), {
|
|
28
|
+
isOpen: P,
|
|
29
|
+
searchTerm: g,
|
|
30
|
+
canFilter: S,
|
|
31
|
+
canContinueFetching: n,
|
|
32
|
+
page: d,
|
|
33
|
+
options: x,
|
|
34
|
+
isTyping: k,
|
|
35
|
+
setOptions: T,
|
|
36
|
+
setPage: D,
|
|
37
|
+
setCanContinueFetching: U
|
|
38
|
+
} = $();
|
|
39
|
+
K(O, () => o.current, [o]);
|
|
40
|
+
const h = y && S ? x.filter((e) => {
|
|
41
|
+
const t = g.toLowerCase();
|
|
42
|
+
return (typeof e.label == "string" ? e.label.toLowerCase() : "").includes(t);
|
|
43
|
+
}) : x;
|
|
44
|
+
W({
|
|
45
|
+
ulRef: o,
|
|
46
|
+
wrapperInputRef: j,
|
|
47
|
+
searchable: y,
|
|
48
|
+
filteredOptions: h
|
|
29
49
|
});
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
const _ = h.filter(
|
|
51
|
+
(e, t, s) => t === s.findIndex((v) => v.value === e.value)
|
|
52
|
+
), q = h.length === 0, z = M(
|
|
53
|
+
() => B(async (e) => {
|
|
54
|
+
const [t] = e;
|
|
55
|
+
if (t.isIntersecting && !p && f && n)
|
|
56
|
+
try {
|
|
57
|
+
w(!0);
|
|
58
|
+
const s = d + 1, { data: v, hasMore: A } = await f({
|
|
59
|
+
page: s,
|
|
60
|
+
pageSize: Y,
|
|
61
|
+
termOfSearch: g
|
|
62
|
+
});
|
|
63
|
+
D(s), U(A), T((H) => [...H, ...v]);
|
|
64
|
+
} catch {
|
|
65
|
+
console.error("Error fetching more options");
|
|
66
|
+
} finally {
|
|
67
|
+
w(!1);
|
|
68
|
+
}
|
|
69
|
+
}, 100),
|
|
70
|
+
[p, f, g, d]
|
|
71
|
+
);
|
|
72
|
+
return Q(() => {
|
|
73
|
+
if (u && n && m.current && !k) {
|
|
74
|
+
const e = new IntersectionObserver(z, {
|
|
75
|
+
threshold: 0.1
|
|
76
|
+
});
|
|
77
|
+
return e.observe(m.current), () => e.disconnect();
|
|
78
|
+
}
|
|
79
|
+
}, [
|
|
80
|
+
u,
|
|
81
|
+
n,
|
|
82
|
+
p,
|
|
83
|
+
k,
|
|
84
|
+
d
|
|
85
|
+
]), /* @__PURE__ */ V(
|
|
35
86
|
"ul",
|
|
36
87
|
{
|
|
37
|
-
ref:
|
|
38
|
-
title:
|
|
88
|
+
ref: o,
|
|
89
|
+
title: I,
|
|
39
90
|
role: "listbox",
|
|
40
|
-
className:
|
|
41
|
-
"data-state":
|
|
42
|
-
children:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
value: "No options",
|
|
56
|
-
label: "No options"
|
|
57
|
-
}
|
|
58
|
-
) : /* @__PURE__ */ x(N, { children: [
|
|
59
|
-
c.map((e) => /* @__PURE__ */ l(
|
|
60
|
-
a,
|
|
91
|
+
className: a(X({ className: N })),
|
|
92
|
+
"data-state": P ? "open" : "closed",
|
|
93
|
+
children: [
|
|
94
|
+
E ? /* @__PURE__ */ r(
|
|
95
|
+
b,
|
|
96
|
+
{
|
|
97
|
+
className: a("select-none", l),
|
|
98
|
+
isClickable: !1,
|
|
99
|
+
inputRef: i,
|
|
100
|
+
value: "Loading...",
|
|
101
|
+
label: "Loading...",
|
|
102
|
+
listItemSecondRowClassName: c
|
|
103
|
+
}
|
|
104
|
+
) : q ? /* @__PURE__ */ r(
|
|
105
|
+
b,
|
|
61
106
|
{
|
|
62
|
-
|
|
107
|
+
isEmpty: !0,
|
|
108
|
+
className: a("select-none", l),
|
|
109
|
+
isClickable: !1,
|
|
110
|
+
inputRef: i,
|
|
111
|
+
value: L ?? "",
|
|
112
|
+
label: L ?? "No options",
|
|
113
|
+
listItemSecondRowClassName: c
|
|
114
|
+
}
|
|
115
|
+
) : _.map((e) => /* @__PURE__ */ r(
|
|
116
|
+
b,
|
|
117
|
+
{
|
|
118
|
+
className: a("select-none", l),
|
|
63
119
|
isClickable: !0,
|
|
120
|
+
inputRef: i,
|
|
121
|
+
listItemSecondRowClassName: c,
|
|
64
122
|
...e
|
|
65
123
|
},
|
|
66
124
|
e.value
|
|
67
125
|
)),
|
|
68
|
-
|
|
69
|
-
|
|
126
|
+
u && n && /* @__PURE__ */ r(
|
|
127
|
+
"li",
|
|
128
|
+
{
|
|
129
|
+
ref: m,
|
|
130
|
+
role: "option",
|
|
131
|
+
"data-action": "true",
|
|
132
|
+
className: "flex items-center justify-center py-3",
|
|
133
|
+
onClick: (e) => e.stopPropagation(),
|
|
134
|
+
children: /* @__PURE__ */ r(R, { className: "w-4 h-4 text-aurora-500 select-none" })
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
F?.map((e, t) => /* @__PURE__ */ r("li", { role: "option", "data-action": "true", children: /* @__PURE__ */ r(Z, { className: "flex p-2 w-full h-full gap-1 items-center text-sm [&>svg]:w-3.5 [&>svg]:h-3.5 [&>svg]:shrink-0 cursor-pointer select-none hover:bg-gray-50 hover:dark:bg-slate-700 focus:outline-0", children: e }) }, t))
|
|
138
|
+
]
|
|
70
139
|
}
|
|
71
140
|
);
|
|
72
141
|
}
|
|
73
142
|
);
|
|
74
143
|
export {
|
|
75
|
-
|
|
144
|
+
fe as List
|
|
76
145
|
};
|
|
@@ -1,66 +1,117 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { listItemVariants as
|
|
6
|
-
import { useDropdownContext as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as s, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as I, useCallback as u } from "react";
|
|
3
|
+
import { cn as l } from "../../../../utils/index.js";
|
|
4
|
+
import { Typography as y } from "../../../Typography/Typography.js";
|
|
5
|
+
import { listItemVariants as L } from "./ListItem.variants.js";
|
|
6
|
+
import { useDropdownContext as V } from "../../contexts/dropdown.hook.js";
|
|
7
|
+
function j(c, n) {
|
|
8
|
+
const i = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp(`(${i})`, "gi");
|
|
9
|
+
return c.split(o).map((a, t) => a.toLowerCase() === n.toLowerCase() ? /* @__PURE__ */ s(
|
|
10
|
+
"mark",
|
|
11
|
+
{
|
|
12
|
+
className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
|
|
13
|
+
children: a
|
|
14
|
+
},
|
|
15
|
+
t
|
|
16
|
+
) : /* @__PURE__ */ s("span", { children: a }, t));
|
|
17
|
+
}
|
|
18
|
+
const K = ({
|
|
19
|
+
isEmpty: c,
|
|
20
|
+
isClickable: n,
|
|
21
|
+
className: i,
|
|
22
|
+
inputRef: o,
|
|
23
|
+
listItemSecondRowClassName: a,
|
|
10
24
|
...t
|
|
11
25
|
}) => {
|
|
12
|
-
const { searchTerm:
|
|
26
|
+
const { searchTerm: m, highlightSearchEnabled: h, setValue: p, toggleOpen: x } = V(), b = I(null), f = u(
|
|
13
27
|
(e) => {
|
|
14
|
-
|
|
28
|
+
p(e.value, o), x(!1);
|
|
15
29
|
},
|
|
16
|
-
[
|
|
17
|
-
),
|
|
18
|
-
(e,
|
|
19
|
-
e.key === "Enter" && (e.stopPropagation(),
|
|
30
|
+
[p, x]
|
|
31
|
+
), w = u(
|
|
32
|
+
(e, r) => {
|
|
33
|
+
e.key === "Enter" && (e.stopPropagation(), f(r));
|
|
20
34
|
},
|
|
21
|
-
[
|
|
22
|
-
),
|
|
23
|
-
(e) => {
|
|
35
|
+
[f]
|
|
36
|
+
), N = u(
|
|
37
|
+
({ label: e, rightComponent: r, subLabel: g, rightComponentClassName: C }) => {
|
|
38
|
+
if (c)
|
|
39
|
+
return /* @__PURE__ */ s(
|
|
40
|
+
y,
|
|
41
|
+
{
|
|
42
|
+
variant: "body2",
|
|
43
|
+
className: "text-zinc-800 dark:text-slate-50 italic",
|
|
44
|
+
children: e
|
|
45
|
+
}
|
|
46
|
+
);
|
|
24
47
|
if (typeof e != "string")
|
|
25
48
|
return e;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
|
|
30
|
-
children: n
|
|
31
|
-
},
|
|
32
|
-
n
|
|
33
|
-
) : n) : [e];
|
|
34
|
-
return /* @__PURE__ */ o(
|
|
35
|
-
b,
|
|
49
|
+
const k = h && m.length > 0 ? j(e, m) : [e];
|
|
50
|
+
return /* @__PURE__ */ d(
|
|
51
|
+
y,
|
|
36
52
|
{
|
|
37
53
|
variant: "body2",
|
|
38
|
-
className: "text-zinc-700 dark:text-slate-50",
|
|
39
|
-
children:
|
|
54
|
+
className: "text-zinc-700 dark:text-slate-50 font-medium",
|
|
55
|
+
children: [
|
|
56
|
+
r ? /* @__PURE__ */ d(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
className: l("flex gap-2 items-center", C),
|
|
60
|
+
children: [
|
|
61
|
+
k,
|
|
62
|
+
" ",
|
|
63
|
+
r
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
) : k,
|
|
67
|
+
g ? /* @__PURE__ */ s(
|
|
68
|
+
"span",
|
|
69
|
+
{
|
|
70
|
+
className: l(
|
|
71
|
+
"block font-normal text-sm text-slate-800 dark:text-slate-50",
|
|
72
|
+
a
|
|
73
|
+
),
|
|
74
|
+
children: g
|
|
75
|
+
}
|
|
76
|
+
) : null
|
|
77
|
+
]
|
|
40
78
|
}
|
|
41
79
|
);
|
|
42
80
|
},
|
|
43
|
-
[
|
|
81
|
+
[h, m]
|
|
44
82
|
);
|
|
45
|
-
return /* @__PURE__ */
|
|
83
|
+
return /* @__PURE__ */ d(
|
|
46
84
|
"li",
|
|
47
85
|
{
|
|
48
|
-
ref:
|
|
86
|
+
ref: b,
|
|
49
87
|
role: "option",
|
|
50
88
|
"data-action": "false",
|
|
51
|
-
className:
|
|
89
|
+
className: l(L({ className: i })),
|
|
52
90
|
tabIndex: 0,
|
|
53
91
|
onClick: (e) => {
|
|
54
|
-
|
|
92
|
+
n && (f(t), e.stopPropagation());
|
|
55
93
|
},
|
|
56
|
-
onKeyDown: (e) =>
|
|
94
|
+
onKeyDown: (e) => w(e, t),
|
|
57
95
|
children: [
|
|
58
|
-
t.leftIcon ? /* @__PURE__ */
|
|
59
|
-
|
|
96
|
+
t.leftIcon ? /* @__PURE__ */ s(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
className: l(
|
|
100
|
+
"w-4 h-4 flex justify-center",
|
|
101
|
+
{
|
|
102
|
+
"items-center": !t.subLabel,
|
|
103
|
+
"items-baseline -translate-y-2": !!t.subLabel
|
|
104
|
+
},
|
|
105
|
+
t.leftIconClassName
|
|
106
|
+
),
|
|
107
|
+
children: t.leftIcon
|
|
108
|
+
}
|
|
109
|
+
) : null,
|
|
110
|
+
N(t)
|
|
60
111
|
]
|
|
61
112
|
}
|
|
62
113
|
);
|
|
63
114
|
};
|
|
64
115
|
export {
|
|
65
|
-
|
|
116
|
+
K as ListItem
|
|
66
117
|
};
|