@konstructio/ui 0.1.2-alpha.44 → 0.1.2-alpha.47
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/components/AlertDialog/AlertDialog.js +39 -37
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Badge/Badge.js +23 -26
- package/dist/components/Badge/Badge.variants.js +1 -1
- package/dist/components/Button/Button.variants.js +108 -98
- package/dist/components/Checkbox/Checkbox.js +104 -100
- package/dist/components/Checkbox/Checkbox.variants.js +30 -7
- package/dist/components/Counter/Counter.js +210 -0
- package/dist/components/Counter/Counter.variants.js +70 -0
- package/dist/components/Filter/Filter.js +1 -1
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +9 -10
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +76 -43
- package/dist/components/Filter/components/ResetButton/ResetButton.js +21 -32
- 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.variants.js +10 -2
- package/dist/components/PhoneNumberInput/PhoneNumberInput.variants.js +4 -4
- package/dist/components/PhoneNumberInput/components/FlagContent/FlagContent.js +16 -7
- package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +92 -74
- package/dist/components/PhoneNumberInput/components/FlagSelectorWrapper/FlagSelectorWrapper.js +53 -29
- package/dist/components/PhoneNumberInput/components/Wrapper.js +139 -120
- package/dist/components/Radio/Radio.js +47 -44
- package/dist/components/Radio/Radio.variants.js +12 -8
- package/dist/components/Select/Select.js +48 -0
- package/dist/components/{Dropdown/Dropdown.variants.js → Select/Select.variants.js} +3 -3
- package/dist/components/{Dropdown → Select}/components/List/List.js +48 -43
- package/dist/components/{Dropdown → Select}/components/List/List.variants.js +8 -5
- package/dist/components/{Dropdown → Select}/components/ListItem/ListItem.js +20 -20
- package/dist/components/{Dropdown → Select}/components/ListItem/ListItem.variants.js +3 -2
- package/dist/components/{Dropdown → Select}/components/Wrapper.js +70 -70
- package/dist/components/Select/contexts/index.js +6 -0
- package/dist/components/{Dropdown/contexts/dropdown.context.js → Select/contexts/select.context.js} +2 -2
- package/dist/components/Select/contexts/select.hook.js +11 -0
- package/dist/components/Select/contexts/select.provider.js +58 -0
- package/dist/components/{Dropdown → Select}/hooks/useNavigationList.js +3 -3
- package/dist/components/{Dropdown/hooks/useDropdown.js → Select/hooks/useSelect.js} +33 -33
- package/dist/components/Switch/Switch.js +153 -125
- package/dist/components/Switch/Switch.variants.js +15 -6
- package/dist/components/TimePicker/TimePicker.variants.js +11 -6
- package/dist/components/TimePicker/components/MeridianList/MeridianList.js +30 -20
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +50 -35
- package/dist/components/Typography/Typography.js +24 -28
- package/dist/components/Typography/Typography.variants.js +49 -46
- package/dist/components/VirtualizedTable/components/Actions/Actions.js +14 -14
- package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +10 -10
- package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/index.js +84 -80
- package/dist/{index-CPU02rhe.js → index-D6KzX_ef.js} +13 -12
- package/dist/index.d.ts +134 -81
- package/dist/index.js +114 -110
- package/dist/package.json +4 -4
- package/dist/styles.css +1 -1
- package/dist/ui/civo-theme.css +6 -5
- package/dist/ui/theme.css +27 -0
- package/dist/x-BXShoIAM.js +8 -0
- package/package.json +4 -4
- package/dist/components/Dropdown/Dropdown.js +0 -48
- package/dist/components/Dropdown/contexts/dropdown.hook.js +0 -13
- package/dist/components/Dropdown/contexts/dropdown.provider.js +0 -58
- package/dist/components/Dropdown/contexts/index.js +0 -6
- package/dist/components/NumberInput/NumberInput.js +0 -179
- package/dist/components/NumberInput/NumberInput.variants.js +0 -50
- /package/dist/components/{Dropdown → Select}/components/EmptyList.js +0 -0
- /package/dist/components/{Dropdown → Select}/components/index.js +0 -0
- /package/dist/components/{Dropdown → Select}/constants/index.js +0 -0
- /package/dist/components/{Dropdown → Select}/constants/pagination.js +0 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { c as t } from "../../index-D29mdTf5.js";
|
|
2
|
+
const a = t(
|
|
3
|
+
["flex", "flex-col", "gap-2", "w-full"],
|
|
4
|
+
{
|
|
5
|
+
variants: {
|
|
6
|
+
status: {
|
|
7
|
+
default: "",
|
|
8
|
+
uploading: "",
|
|
9
|
+
complete: "",
|
|
10
|
+
error: ""
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
status: "default"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
), r = t(
|
|
18
|
+
["flex", "gap-2", "h-15", "items-center", "w-full"],
|
|
19
|
+
{
|
|
20
|
+
variants: {
|
|
21
|
+
status: {
|
|
22
|
+
default: "",
|
|
23
|
+
uploading: "",
|
|
24
|
+
complete: "",
|
|
25
|
+
error: ""
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
status: "default"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
), s = t(
|
|
33
|
+
[
|
|
34
|
+
"flex",
|
|
35
|
+
"gap-4",
|
|
36
|
+
"grow",
|
|
37
|
+
"h-full",
|
|
38
|
+
"items-center",
|
|
39
|
+
"px-4",
|
|
40
|
+
"py-2",
|
|
41
|
+
"rounded",
|
|
42
|
+
"border",
|
|
43
|
+
"bg-white",
|
|
44
|
+
"border-gray-300",
|
|
45
|
+
"dark:bg-metal-800",
|
|
46
|
+
"dark:border-metal-700",
|
|
47
|
+
"kubefirst-dark:bg-slate-800",
|
|
48
|
+
"kubefirst-dark:border-slate-600"
|
|
49
|
+
],
|
|
50
|
+
{
|
|
51
|
+
variants: {
|
|
52
|
+
status: {
|
|
53
|
+
default: "",
|
|
54
|
+
uploading: "",
|
|
55
|
+
complete: "",
|
|
56
|
+
error: [
|
|
57
|
+
"border-red-600",
|
|
58
|
+
"dark:border-red-500",
|
|
59
|
+
"kubefirst-dark:border-red-500"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: {
|
|
64
|
+
status: "default"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
), l = t([
|
|
68
|
+
"flex",
|
|
69
|
+
"gap-1",
|
|
70
|
+
"items-center",
|
|
71
|
+
"text-sm",
|
|
72
|
+
"font-medium",
|
|
73
|
+
"leading-5",
|
|
74
|
+
"text-slate-500",
|
|
75
|
+
"dark:text-slate-50",
|
|
76
|
+
"kubefirst-dark:text-slate-50"
|
|
77
|
+
]), d = t(
|
|
78
|
+
[
|
|
79
|
+
"text-xs",
|
|
80
|
+
"leading-5",
|
|
81
|
+
"text-slate-600",
|
|
82
|
+
"dark:text-slate-200",
|
|
83
|
+
"kubefirst-dark:text-slate-200"
|
|
84
|
+
],
|
|
85
|
+
{
|
|
86
|
+
variants: {
|
|
87
|
+
status: {
|
|
88
|
+
default: "",
|
|
89
|
+
uploading: "",
|
|
90
|
+
complete: "",
|
|
91
|
+
error: [
|
|
92
|
+
"text-red-700",
|
|
93
|
+
"dark:text-red-400",
|
|
94
|
+
"kubefirst-dark:text-red-500"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
defaultVariants: {
|
|
99
|
+
status: "default"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
export {
|
|
104
|
+
d as helperTextVariants,
|
|
105
|
+
a as imageUploadVariants,
|
|
106
|
+
r as inputContainerVariants,
|
|
107
|
+
s as inputFieldVariants,
|
|
108
|
+
l as labelVariants
|
|
109
|
+
};
|
|
@@ -11,7 +11,8 @@ const a = r(
|
|
|
11
11
|
"focus-visible:outline-none",
|
|
12
12
|
"focus-visible:ring-1",
|
|
13
13
|
"h-10",
|
|
14
|
-
"placeholder:text-
|
|
14
|
+
"placeholder:text-zinc-400",
|
|
15
|
+
"dark:placeholder:text-metal-300",
|
|
15
16
|
"px-2.5",
|
|
16
17
|
"py-2",
|
|
17
18
|
"rounded",
|
|
@@ -40,7 +41,14 @@ const a = r(
|
|
|
40
41
|
variants: {
|
|
41
42
|
variant: {
|
|
42
43
|
default: "",
|
|
43
|
-
error:
|
|
44
|
+
error: [
|
|
45
|
+
"pr-8",
|
|
46
|
+
"border-red-600",
|
|
47
|
+
"focus-visible:border-red-600",
|
|
48
|
+
"focus-visible:ring-transparent",
|
|
49
|
+
"dark:border-red-500",
|
|
50
|
+
"kubefirst-dark:border-red-500"
|
|
51
|
+
]
|
|
44
52
|
}
|
|
45
53
|
},
|
|
46
54
|
defaultVariants: {
|
|
@@ -10,10 +10,10 @@ const t = r(
|
|
|
10
10
|
"focus-within:border-aurora-500",
|
|
11
11
|
"transition-colors",
|
|
12
12
|
"duration-150",
|
|
13
|
-
"dark:border-
|
|
14
|
-
"dark:bg-
|
|
15
|
-
"dark:data-[state=open]:border-
|
|
16
|
-
"dark:focus-within:border-
|
|
13
|
+
"dark:border-metal-700",
|
|
14
|
+
"dark:bg-metal-800",
|
|
15
|
+
"dark:data-[state=open]:border-metal-700",
|
|
16
|
+
"dark:focus-within:border-metal-700"
|
|
17
17
|
],
|
|
18
18
|
{
|
|
19
19
|
variants: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { cn as s } from "../../../../utils/index.js";
|
|
3
|
+
import { C as l } from "../../../../chevron-up-DrQr2Fwd.js";
|
|
4
|
+
import { usePhoneNumberContext as c } from "../../contexts/phone-number.hook.js";
|
|
5
|
+
const u = () => {
|
|
6
|
+
const { selectedCountry: o, isOpenSelector: t, handleOpenSelector: a } = c(), { flag: n } = o;
|
|
6
7
|
return /* @__PURE__ */ r(
|
|
7
8
|
"button",
|
|
8
9
|
{
|
|
@@ -12,9 +13,17 @@ const m = () => {
|
|
|
12
13
|
children: [
|
|
13
14
|
/* @__PURE__ */ e(n, {}),
|
|
14
15
|
/* @__PURE__ */ e(
|
|
15
|
-
|
|
16
|
+
l,
|
|
16
17
|
{
|
|
17
|
-
className:
|
|
18
|
+
className: s(
|
|
19
|
+
"transition-all",
|
|
20
|
+
"duration-100",
|
|
21
|
+
"data-[state=open]:rotate-0",
|
|
22
|
+
"data-[state=closed]:rotate-180",
|
|
23
|
+
"w-5",
|
|
24
|
+
"h-5",
|
|
25
|
+
"text-slate-400"
|
|
26
|
+
),
|
|
18
27
|
"data-state": t ? "open" : "closed"
|
|
19
28
|
}
|
|
20
29
|
)
|
|
@@ -23,5 +32,5 @@ const m = () => {
|
|
|
23
32
|
);
|
|
24
33
|
};
|
|
25
34
|
export {
|
|
26
|
-
|
|
35
|
+
u as FlagContent
|
|
27
36
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as g, jsxs as
|
|
1
|
+
import { jsx as g, jsxs as R } from "react/jsx-runtime";
|
|
2
2
|
import * as S from "react";
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { flushSync as
|
|
3
|
+
import { useRef as T, useMemo as k, useEffect as D } from "react";
|
|
4
|
+
import { flushSync as W } from "react-dom";
|
|
5
5
|
import { Typography as O } from "../../../Typography/Typography.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { cn as z } from "../../../../utils/index.js";
|
|
7
|
+
import { TruncateText as L } from "../TruncateText/TruncateText.js";
|
|
8
|
+
import { usePhoneNumberContext as V } from "../../contexts/phone-number.hook.js";
|
|
9
|
+
function x(r, l, e) {
|
|
9
10
|
let s = e.initialDeps ?? [], t, o = !0;
|
|
10
11
|
function n() {
|
|
11
12
|
var i, a, u;
|
|
@@ -17,7 +18,7 @@ function y(r, l, e) {
|
|
|
17
18
|
s = d;
|
|
18
19
|
let m;
|
|
19
20
|
if (e.key && ((a = e.debug) != null && a.call(e)) && (m = Date.now()), t = l(...d), e.key && ((u = e.debug) != null && u.call(e))) {
|
|
20
|
-
const v = Math.round((Date.now() - c) * 100) / 100, f = Math.round((Date.now() - m) * 100) / 100,
|
|
21
|
+
const v = Math.round((Date.now() - c) * 100) / 100, f = Math.round((Date.now() - m) * 100) / 100, y = f / 16, E = (p, w) => {
|
|
21
22
|
for (p = String(p); p.length < w; )
|
|
22
23
|
p = " " + p;
|
|
23
24
|
return p;
|
|
@@ -29,7 +30,7 @@ function y(r, l, e) {
|
|
|
29
30
|
font-weight: bold;
|
|
30
31
|
color: hsl(${Math.max(
|
|
31
32
|
0,
|
|
32
|
-
Math.min(120 - 120 *
|
|
33
|
+
Math.min(120 - 120 * y, 120)
|
|
33
34
|
)}deg 100% 31%);`,
|
|
34
35
|
e?.key
|
|
35
36
|
);
|
|
@@ -40,25 +41,25 @@ function y(r, l, e) {
|
|
|
40
41
|
s = i;
|
|
41
42
|
}, n;
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function C(r, l) {
|
|
44
45
|
if (r === void 0)
|
|
45
46
|
throw new Error("Unexpected undefined");
|
|
46
47
|
return r;
|
|
47
48
|
}
|
|
48
|
-
const
|
|
49
|
+
const j = (r, l) => Math.abs(r - l) < 1.01, P = (r, l, e) => {
|
|
49
50
|
let s;
|
|
50
51
|
return function(...t) {
|
|
51
52
|
r.clearTimeout(s), s = r.setTimeout(() => l.apply(this, t), e);
|
|
52
53
|
};
|
|
53
|
-
},
|
|
54
|
+
}, I = (r) => {
|
|
54
55
|
const { offsetWidth: l, offsetHeight: e } = r;
|
|
55
56
|
return { width: l, height: e };
|
|
56
|
-
},
|
|
57
|
+
}, B = (r) => r, H = (r) => {
|
|
57
58
|
const l = Math.max(r.startIndex - r.overscan, 0), e = Math.min(r.endIndex + r.overscan, r.count - 1), s = [];
|
|
58
59
|
for (let t = l; t <= e; t++)
|
|
59
60
|
s.push(t);
|
|
60
61
|
return s;
|
|
61
|
-
},
|
|
62
|
+
}, $ = (r, l) => {
|
|
62
63
|
const e = r.scrollElement;
|
|
63
64
|
if (!e)
|
|
64
65
|
return;
|
|
@@ -69,7 +70,7 @@ const V = (r, l) => Math.abs(r - l) < 1.01, j = (r, l, e) => {
|
|
|
69
70
|
const { width: i, height: a } = n;
|
|
70
71
|
l({ width: Math.round(i), height: Math.round(a) });
|
|
71
72
|
};
|
|
72
|
-
if (t(
|
|
73
|
+
if (t(I(e)), !s.ResizeObserver)
|
|
73
74
|
return () => {
|
|
74
75
|
};
|
|
75
76
|
const o = new s.ResizeObserver((n) => {
|
|
@@ -82,16 +83,16 @@ const V = (r, l) => Math.abs(r - l) < 1.01, j = (r, l, e) => {
|
|
|
82
83
|
return;
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
t(
|
|
86
|
+
t(I(e));
|
|
86
87
|
};
|
|
87
88
|
r.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(i) : i();
|
|
88
89
|
});
|
|
89
90
|
return o.observe(e, { box: "border-box" }), () => {
|
|
90
91
|
o.unobserve(e);
|
|
91
92
|
};
|
|
92
|
-
},
|
|
93
|
+
}, A = {
|
|
93
94
|
passive: !0
|
|
94
|
-
},
|
|
95
|
+
}, F = typeof window > "u" ? !0 : "onscrollend" in window, q = (r, l) => {
|
|
95
96
|
const e = r.scrollElement;
|
|
96
97
|
if (!e)
|
|
97
98
|
return;
|
|
@@ -99,8 +100,8 @@ const V = (r, l) => Math.abs(r - l) < 1.01, j = (r, l, e) => {
|
|
|
99
100
|
if (!s)
|
|
100
101
|
return;
|
|
101
102
|
let t = 0;
|
|
102
|
-
const o = r.options.useScrollendEvent &&
|
|
103
|
-
} :
|
|
103
|
+
const o = r.options.useScrollendEvent && F ? () => {
|
|
104
|
+
} : P(
|
|
104
105
|
s,
|
|
105
106
|
() => {
|
|
106
107
|
l(t, !1);
|
|
@@ -110,12 +111,12 @@ const V = (r, l) => Math.abs(r - l) < 1.01, j = (r, l, e) => {
|
|
|
110
111
|
const { horizontal: d, isRtl: h } = r.options;
|
|
111
112
|
t = d ? e.scrollLeft * (h && -1 || 1) : e.scrollTop, o(), l(t, c);
|
|
112
113
|
}, i = n(!0), a = n(!1);
|
|
113
|
-
e.addEventListener("scroll", i,
|
|
114
|
-
const u = r.options.useScrollendEvent &&
|
|
115
|
-
return u && e.addEventListener("scrollend", a,
|
|
114
|
+
e.addEventListener("scroll", i, A);
|
|
115
|
+
const u = r.options.useScrollendEvent && F;
|
|
116
|
+
return u && e.addEventListener("scrollend", a, A), () => {
|
|
116
117
|
e.removeEventListener("scroll", i), u && e.removeEventListener("scrollend", a);
|
|
117
118
|
};
|
|
118
|
-
},
|
|
119
|
+
}, U = (r, l, e) => {
|
|
119
120
|
if (l?.borderBoxSize) {
|
|
120
121
|
const s = l.borderBoxSize[0];
|
|
121
122
|
if (s)
|
|
@@ -124,7 +125,7 @@ const V = (r, l) => Math.abs(r - l) < 1.01, j = (r, l, e) => {
|
|
|
124
125
|
);
|
|
125
126
|
}
|
|
126
127
|
return r[e.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
127
|
-
},
|
|
128
|
+
}, K = (r, {
|
|
128
129
|
adjustments: l = 0,
|
|
129
130
|
behavior: e
|
|
130
131
|
}, s) => {
|
|
@@ -135,7 +136,7 @@ const V = (r, l) => Math.abs(r - l) < 1.01, j = (r, l, e) => {
|
|
|
135
136
|
behavior: e
|
|
136
137
|
});
|
|
137
138
|
};
|
|
138
|
-
class
|
|
139
|
+
class G {
|
|
139
140
|
constructor(l) {
|
|
140
141
|
this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.currentScrollToIndex = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
|
|
141
142
|
let e = null;
|
|
@@ -173,11 +174,11 @@ class K {
|
|
|
173
174
|
scrollPaddingStart: 0,
|
|
174
175
|
scrollPaddingEnd: 0,
|
|
175
176
|
horizontal: !1,
|
|
176
|
-
getItemKey:
|
|
177
|
-
rangeExtractor:
|
|
177
|
+
getItemKey: B,
|
|
178
|
+
rangeExtractor: H,
|
|
178
179
|
onChange: () => {
|
|
179
180
|
},
|
|
180
|
-
measureElement:
|
|
181
|
+
measureElement: U,
|
|
181
182
|
initialRect: { width: 0, height: 0 },
|
|
182
183
|
scrollMargin: 0,
|
|
183
184
|
gap: 0,
|
|
@@ -194,7 +195,7 @@ class K {
|
|
|
194
195
|
}, this.notify = (e) => {
|
|
195
196
|
var s, t;
|
|
196
197
|
(t = (s = this.options).onChange) == null || t.call(s, this, e);
|
|
197
|
-
}, this.maybeNotify =
|
|
198
|
+
}, this.maybeNotify = x(
|
|
198
199
|
() => (this.calculateRange(), [
|
|
199
200
|
this.isScrolling,
|
|
200
201
|
this.range ? this.range.startIndex : null,
|
|
@@ -252,7 +253,7 @@ class K {
|
|
|
252
253
|
break;
|
|
253
254
|
}
|
|
254
255
|
return o.size === this.options.lanes ? Array.from(o.values()).sort((n, i) => n.end === i.end ? n.index - i.index : n.end - i.end)[0] : void 0;
|
|
255
|
-
}, this.getMeasurementOptions =
|
|
256
|
+
}, this.getMeasurementOptions = x(
|
|
256
257
|
() => [
|
|
257
258
|
this.options.count,
|
|
258
259
|
this.options.paddingStart,
|
|
@@ -270,13 +271,9 @@ class K {
|
|
|
270
271
|
lanes: i
|
|
271
272
|
}),
|
|
272
273
|
{
|
|
273
|
-
key: !1
|
|
274
|
-
skipInitialOnChange: !0,
|
|
275
|
-
onChange: () => {
|
|
276
|
-
this.notify(this.isScrolling);
|
|
277
|
-
}
|
|
274
|
+
key: !1
|
|
278
275
|
}
|
|
279
|
-
), this.getMeasurements =
|
|
276
|
+
), this.getMeasurements = x(
|
|
280
277
|
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
281
278
|
({ count: e, paddingStart: s, scrollMargin: t, getItemKey: o, enabled: n, lanes: i }, a) => {
|
|
282
279
|
if (!n)
|
|
@@ -298,19 +295,19 @@ class K {
|
|
|
298
295
|
}
|
|
299
296
|
for (let h = u; h < e; h++) {
|
|
300
297
|
const m = o(h), v = this.laneAssignments.get(h);
|
|
301
|
-
let f,
|
|
298
|
+
let f, y;
|
|
302
299
|
if (v !== void 0 && this.options.lanes > 1) {
|
|
303
300
|
f = v;
|
|
304
301
|
const b = d[f], M = b !== void 0 ? c[b] : void 0;
|
|
305
|
-
|
|
302
|
+
y = M ? M.end + this.options.gap : s + t;
|
|
306
303
|
} else {
|
|
307
304
|
const b = this.options.lanes === 1 ? c[h - 1] : this.getFurthestMeasurement(c, h);
|
|
308
|
-
|
|
305
|
+
y = b ? b.end + this.options.gap : s + t, f = b ? b.lane : h % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(h, f);
|
|
309
306
|
}
|
|
310
|
-
const E = a.get(m), p = typeof E == "number" ? E : this.options.estimateSize(h), w =
|
|
307
|
+
const E = a.get(m), p = typeof E == "number" ? E : this.options.estimateSize(h), w = y + p;
|
|
311
308
|
c[h] = {
|
|
312
309
|
index: h,
|
|
313
|
-
start:
|
|
310
|
+
start: y,
|
|
314
311
|
size: p,
|
|
315
312
|
end: w,
|
|
316
313
|
key: m,
|
|
@@ -323,14 +320,14 @@ class K {
|
|
|
323
320
|
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
324
321
|
debug: () => this.options.debug
|
|
325
322
|
}
|
|
326
|
-
), this.calculateRange =
|
|
323
|
+
), this.calculateRange = x(
|
|
327
324
|
() => [
|
|
328
325
|
this.getMeasurements(),
|
|
329
326
|
this.getSize(),
|
|
330
327
|
this.getScrollOffset(),
|
|
331
328
|
this.options.lanes
|
|
332
329
|
],
|
|
333
|
-
(e, s, t, o) => this.range = e.length > 0 && s > 0 ?
|
|
330
|
+
(e, s, t, o) => this.range = e.length > 0 && s > 0 ? J({
|
|
334
331
|
measurements: e,
|
|
335
332
|
outerSize: s,
|
|
336
333
|
scrollOffset: t,
|
|
@@ -340,7 +337,7 @@ class K {
|
|
|
340
337
|
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
341
338
|
debug: () => this.options.debug
|
|
342
339
|
}
|
|
343
|
-
), this.getVirtualIndexes =
|
|
340
|
+
), this.getVirtualIndexes = x(
|
|
344
341
|
() => {
|
|
345
342
|
let e = null, s = null;
|
|
346
343
|
const t = this.calculateRange();
|
|
@@ -390,7 +387,7 @@ class K {
|
|
|
390
387
|
return;
|
|
391
388
|
}
|
|
392
389
|
this._measureElement(e, void 0);
|
|
393
|
-
}, this.getVirtualItems =
|
|
390
|
+
}, this.getVirtualItems = x(
|
|
394
391
|
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
395
392
|
(e, s) => {
|
|
396
393
|
const t = [];
|
|
@@ -407,11 +404,11 @@ class K {
|
|
|
407
404
|
), this.getVirtualItemForOffset = (e) => {
|
|
408
405
|
const s = this.getMeasurements();
|
|
409
406
|
if (s.length !== 0)
|
|
410
|
-
return
|
|
411
|
-
s[
|
|
407
|
+
return C(
|
|
408
|
+
s[_(
|
|
412
409
|
0,
|
|
413
410
|
s.length - 1,
|
|
414
|
-
(t) =>
|
|
411
|
+
(t) => C(s[t]).start,
|
|
415
412
|
e
|
|
416
413
|
)]
|
|
417
414
|
);
|
|
@@ -477,7 +474,7 @@ class K {
|
|
|
477
474
|
console.warn("Failed to get offset for index:", e);
|
|
478
475
|
return;
|
|
479
476
|
}
|
|
480
|
-
|
|
477
|
+
j(f[0], v) || a(h);
|
|
481
478
|
};
|
|
482
479
|
this.isDynamicMode() ? this.targetWindow.requestAnimationFrame(m) : m();
|
|
483
480
|
});
|
|
@@ -525,7 +522,7 @@ class K {
|
|
|
525
522
|
}, this.setOptions(l);
|
|
526
523
|
}
|
|
527
524
|
}
|
|
528
|
-
const
|
|
525
|
+
const _ = (r, l, e, s) => {
|
|
529
526
|
for (; r <= l; ) {
|
|
530
527
|
const t = (r + l) / 2 | 0, o = e(t);
|
|
531
528
|
if (o < s)
|
|
@@ -537,7 +534,7 @@ const N = (r, l, e, s) => {
|
|
|
537
534
|
}
|
|
538
535
|
return r > 0 ? r - 1 : 0;
|
|
539
536
|
};
|
|
540
|
-
function
|
|
537
|
+
function J({
|
|
541
538
|
measurements: r,
|
|
542
539
|
outerSize: l,
|
|
543
540
|
scrollOffset: e,
|
|
@@ -549,7 +546,7 @@ function G({
|
|
|
549
546
|
startIndex: 0,
|
|
550
547
|
endIndex: t
|
|
551
548
|
};
|
|
552
|
-
let n =
|
|
549
|
+
let n = _(
|
|
553
550
|
0,
|
|
554
551
|
t,
|
|
555
552
|
o,
|
|
@@ -573,8 +570,8 @@ function G({
|
|
|
573
570
|
}
|
|
574
571
|
return { startIndex: n, endIndex: i };
|
|
575
572
|
}
|
|
576
|
-
const
|
|
577
|
-
function
|
|
573
|
+
const N = typeof document < "u" ? S.useLayoutEffect : S.useEffect;
|
|
574
|
+
function Q({
|
|
578
575
|
useFlushSync: r = !0,
|
|
579
576
|
...l
|
|
580
577
|
}) {
|
|
@@ -582,48 +579,48 @@ function J({
|
|
|
582
579
|
...l,
|
|
583
580
|
onChange: (o, n) => {
|
|
584
581
|
var i;
|
|
585
|
-
r && n ?
|
|
582
|
+
r && n ? W(e) : e(), (i = l.onChange) == null || i.call(l, o, n);
|
|
586
583
|
}
|
|
587
584
|
}, [t] = S.useState(
|
|
588
|
-
() => new
|
|
585
|
+
() => new G(s)
|
|
589
586
|
);
|
|
590
|
-
return t.setOptions(s),
|
|
587
|
+
return t.setOptions(s), N(() => t._didMount(), []), N(() => t._willUpdate()), t;
|
|
591
588
|
}
|
|
592
|
-
function
|
|
593
|
-
return
|
|
594
|
-
observeElementRect:
|
|
595
|
-
observeElementOffset:
|
|
596
|
-
scrollToFn:
|
|
589
|
+
function X(r) {
|
|
590
|
+
return Q({
|
|
591
|
+
observeElementRect: $,
|
|
592
|
+
observeElementOffset: q,
|
|
593
|
+
scrollToFn: K,
|
|
597
594
|
...r
|
|
598
595
|
});
|
|
599
596
|
}
|
|
600
|
-
const
|
|
597
|
+
const oe = ({
|
|
601
598
|
showFlagOnSearch: r,
|
|
602
599
|
showNameOnSearch: l
|
|
603
600
|
}) => {
|
|
604
|
-
const e =
|
|
601
|
+
const e = T(null), { termOfSearch: s, countries: t, handleSelectCountry: o } = V(), n = k(() => t.filter(
|
|
605
602
|
(a) => a.name.toLocaleLowerCase().includes(s.toLowerCase())
|
|
606
|
-
), [s]), i =
|
|
603
|
+
), [s]), i = X({
|
|
607
604
|
count: n.length,
|
|
608
605
|
overscan: 5,
|
|
609
606
|
getScrollElement: () => e.current,
|
|
610
607
|
estimateSize: () => 40
|
|
611
608
|
});
|
|
612
|
-
return
|
|
609
|
+
return D(() => {
|
|
613
610
|
n.length > 0 && i.scrollToIndex(0);
|
|
614
611
|
}, [s, i]), n.length === 0 ? /* @__PURE__ */ g("div", { className: "overflow-y-auto max-h-60 snap-y snap-mandatory", children: /* @__PURE__ */ g("ul", { className: "relative", children: /* @__PURE__ */ g("li", { className: "w-full flex items-center h-10 select-none px-6", children: /* @__PURE__ */ g(
|
|
615
612
|
O,
|
|
616
613
|
{
|
|
617
614
|
variant: "body2",
|
|
618
615
|
component: "span",
|
|
619
|
-
className: "flex gap-2 items-center text-left
|
|
616
|
+
className: "flex gap-2 items-center text-left",
|
|
620
617
|
children: "No options"
|
|
621
618
|
}
|
|
622
619
|
) }) }) }) : /* @__PURE__ */ g(
|
|
623
620
|
"div",
|
|
624
621
|
{
|
|
625
622
|
ref: e,
|
|
626
|
-
className: "overflow-y-auto max-h-60 snap-y snap-mandatory",
|
|
623
|
+
className: "overflow-y-auto max-h-60 snap-y snap-mandatory scrollbar",
|
|
627
624
|
children: /* @__PURE__ */ g(
|
|
628
625
|
"ul",
|
|
629
626
|
{
|
|
@@ -634,7 +631,16 @@ const ne = ({
|
|
|
634
631
|
return /* @__PURE__ */ g(
|
|
635
632
|
"li",
|
|
636
633
|
{
|
|
637
|
-
className:
|
|
634
|
+
className: z(
|
|
635
|
+
"absolute",
|
|
636
|
+
"w-full",
|
|
637
|
+
"snap-start",
|
|
638
|
+
"snap-always",
|
|
639
|
+
"scroll-m-0",
|
|
640
|
+
"flex",
|
|
641
|
+
"items-center",
|
|
642
|
+
"h-10"
|
|
643
|
+
),
|
|
638
644
|
style: {
|
|
639
645
|
top: a.start,
|
|
640
646
|
height: a.size
|
|
@@ -642,17 +648,29 @@ const ne = ({
|
|
|
642
648
|
children: /* @__PURE__ */ g(
|
|
643
649
|
"button",
|
|
644
650
|
{
|
|
645
|
-
className:
|
|
651
|
+
className: z(
|
|
652
|
+
"w-full",
|
|
653
|
+
"h-full",
|
|
654
|
+
"cursor-pointer",
|
|
655
|
+
"px-6",
|
|
656
|
+
"hover:bg-gray-50",
|
|
657
|
+
"transition-colors",
|
|
658
|
+
"duration-150",
|
|
659
|
+
"focus-visible:outline-0",
|
|
660
|
+
"hover:outline-gray-100",
|
|
661
|
+
"focus:bg-gray-50",
|
|
662
|
+
"dark:hover:bg-metal-700"
|
|
663
|
+
),
|
|
646
664
|
onClick: () => o(u),
|
|
647
|
-
children: /* @__PURE__ */
|
|
665
|
+
children: /* @__PURE__ */ R(
|
|
648
666
|
O,
|
|
649
667
|
{
|
|
650
668
|
variant: "body2",
|
|
651
669
|
component: "span",
|
|
652
|
-
className: "flex gap-2 items-center text-left
|
|
670
|
+
className: "flex gap-2 items-center text-left",
|
|
653
671
|
children: [
|
|
654
672
|
r && /* @__PURE__ */ g(c, {}),
|
|
655
|
-
l && /* @__PURE__ */ g(
|
|
673
|
+
l && /* @__PURE__ */ g(L, { text: d, prefix: h })
|
|
656
674
|
]
|
|
657
675
|
}
|
|
658
676
|
)
|
|
@@ -668,5 +686,5 @@ const ne = ({
|
|
|
668
686
|
);
|
|
669
687
|
};
|
|
670
688
|
export {
|
|
671
|
-
|
|
689
|
+
oe as FlagSelectorList
|
|
672
690
|
};
|