@konstructio/ui 0.1.2-alpha.66 → 0.1.2-alpha.68
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/AdditionalOptions-C2FDVZhu.js +45 -0
- package/dist/{DayPicker-PUEUVAST.js → DayPicker-CaeUXRCF.js} +475 -470
- package/dist/{Modal--z642-Wv.js → Modal-mwLmWbnA.js} +23 -20
- package/dist/assets/icons/components/CloudLockOutline.d.ts +3 -0
- package/dist/assets/icons/components/CloudLockOutline.js +28 -0
- package/dist/assets/icons/components/index.d.ts +1 -0
- package/dist/assets/icons/components/index.js +106 -104
- package/dist/assets/icons/index.js +106 -104
- package/dist/components/ButtonGroup/ButtonGroup.js +65 -61
- package/dist/components/ButtonGroup/ButtonGroup.types.d.ts +6 -0
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.js +32 -30
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.types.d.ts +3 -1
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.d.ts +4 -1
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.js +37 -17
- package/dist/components/DateRangePicker/components/CalendarPanel/components/CalendarMonth/CalendarMonth.js +1 -1
- package/dist/components/Datepicker/DatePicker.js +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -2
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +2 -2
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/Select/Select.d.ts +1 -0
- package/dist/components/Select/Select.js +54 -40
- package/dist/components/Select/Select.types.d.ts +18 -2
- package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.d.ts +3 -0
- package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.js +11 -0
- package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.types.d.ts +4 -0
- package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.variants.d.ts +1 -0
- package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.variants.js +26 -0
- package/dist/components/Select/components/List/List.js +131 -132
- package/dist/components/Select/components/List/List.types.d.ts +1 -0
- package/dist/components/Select/components/List/List.variants.d.ts +1 -0
- package/dist/components/Select/components/List/List.variants.js +17 -2
- package/dist/components/Select/components/Wrapper.d.ts +3 -1
- package/dist/components/Select/components/Wrapper.js +65 -63
- package/dist/components/Select/components/index.d.ts +1 -0
- package/dist/components/Select/components/index.js +8 -6
- package/dist/components/VirtualizedTable/VirtualizedTable.d.ts +5 -0
- package/dist/components/VirtualizedTable/VirtualizedTable.js +86 -80
- package/dist/components/VirtualizedTable/components/Body/Body.js +51 -49
- package/dist/components/VirtualizedTable/contexts/table.context.d.ts +2 -0
- package/dist/components/VirtualizedTable/contexts/table.provider.js +69 -67
- package/dist/components/VirtualizedTable/events/index.d.ts +3 -3
- package/dist/components/VirtualizedTable/events/index.js +22 -16
- package/dist/components/index.js +1 -1
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +106 -104
- package/dist/index.js +1 -1
- package/dist/package.json +21 -21
- package/dist/styles.css +1 -1
- package/package.json +21 -21
|
@@ -33,6 +33,22 @@ export type Option = {
|
|
|
33
33
|
/** Unique value for the option */
|
|
34
34
|
value: string;
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* A group of options with a non-interactive header label.
|
|
38
|
+
*/
|
|
39
|
+
export type OptionGroup = {
|
|
40
|
+
groupLabel: string;
|
|
41
|
+
options: Option[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A group of additional options with a non-interactive header label.
|
|
45
|
+
*/
|
|
46
|
+
export type AdditionalOptionGroup = {
|
|
47
|
+
groupLabel: string;
|
|
48
|
+
options: ReactNode[];
|
|
49
|
+
};
|
|
50
|
+
export declare const isOptionGroup: (item: Option | OptionGroup) => item is OptionGroup;
|
|
51
|
+
export declare const isAdditionalOptionGroup: (item: unknown) => item is AdditionalOptionGroup;
|
|
36
52
|
type OnChangeFn = (params: {
|
|
37
53
|
target: {
|
|
38
54
|
value: string;
|
|
@@ -74,7 +90,7 @@ type OnChangeFn = (params: {
|
|
|
74
90
|
* @see {@link https://konstructio.github.io/konstruct-ui/?path=/docs/components-select--docs Storybook}
|
|
75
91
|
*/
|
|
76
92
|
export type SelectProps = VariantProps<typeof selectVariants> & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> & {
|
|
77
|
-
additionalOptions?: ReactNode[] | string[];
|
|
93
|
+
additionalOptions?: ReactNode[] | string[] | AdditionalOptionGroup[];
|
|
78
94
|
className?: string;
|
|
79
95
|
disabled?: boolean;
|
|
80
96
|
error?: string;
|
|
@@ -95,7 +111,7 @@ export type SelectProps = VariantProps<typeof selectVariants> & Omit<InputHTMLAt
|
|
|
95
111
|
listItemSecondRowClassName?: string;
|
|
96
112
|
mainWrapperClassName?: string;
|
|
97
113
|
noOptionsText?: string;
|
|
98
|
-
options: Option[];
|
|
114
|
+
options: Option[] | OptionGroup[];
|
|
99
115
|
searchable?: boolean;
|
|
100
116
|
showSearchIcon?: boolean;
|
|
101
117
|
theme?: Theme;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "../../../../index-BvoZGpli.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "../../../../utils/index.js";
|
|
5
|
+
import { A as s } from "../../../../AdditionalOptions-C2FDVZhu.js";
|
|
6
|
+
import "../List/List.variants.js";
|
|
7
|
+
import "./AdditionalOptions.variants.js";
|
|
8
|
+
import "../../contexts/select.hook.js";
|
|
9
|
+
export {
|
|
10
|
+
s as AdditionalOptions
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const additionalOptionSlotClassName: string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn as e } from "../../../../utils/index.js";
|
|
2
|
+
const o = e(
|
|
3
|
+
"flex",
|
|
4
|
+
"min-h-10",
|
|
5
|
+
"py-2",
|
|
6
|
+
"px-6",
|
|
7
|
+
"w-full",
|
|
8
|
+
"h-full",
|
|
9
|
+
"gap-1",
|
|
10
|
+
"items-center",
|
|
11
|
+
"text-sm",
|
|
12
|
+
"[&>svg]:-ml-1",
|
|
13
|
+
"[&>svg]:w-3.5",
|
|
14
|
+
"[&>svg]:h-3.5",
|
|
15
|
+
"[&>svg]:shrink-0",
|
|
16
|
+
"cursor-pointer",
|
|
17
|
+
"select-none",
|
|
18
|
+
"hover:bg-gray-50",
|
|
19
|
+
"hover:dark:bg-metal-700",
|
|
20
|
+
"focus:outline-0",
|
|
21
|
+
"text-blue-600",
|
|
22
|
+
"dark:text-aurora-500"
|
|
23
|
+
);
|
|
24
|
+
export {
|
|
25
|
+
o as additionalOptionSlotClassName
|
|
26
|
+
};
|
|
@@ -1,182 +1,181 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { ListItem as
|
|
9
|
-
import { listVariants as
|
|
10
|
-
import { DEFAULT_LIST_SIZE as
|
|
11
|
-
import { useSelectContext as
|
|
12
|
-
const
|
|
1
|
+
import { jsxs as N, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { d as K } from "../../../../debounce-DJveWHr_.js";
|
|
3
|
+
import { forwardRef as Q, useRef as O, useState as W, useImperativeHandle as X, useMemo as j, useEffect as Y, Fragment as $ } from "react";
|
|
4
|
+
import { Loading as R } from "../../../Loading/Loading.js";
|
|
5
|
+
import { cn as s } from "../../../../utils/index.js";
|
|
6
|
+
import { useNavigationUlList as ee } from "../../hooks/useNavigationList.js";
|
|
7
|
+
import { A as te, i as re } from "../../../../AdditionalOptions-C2FDVZhu.js";
|
|
8
|
+
import { ListItem as g } from "../ListItem/ListItem.js";
|
|
9
|
+
import { listGroupLabelVariants as oe, listVariants as ne } from "./List.variants.js";
|
|
10
|
+
import { DEFAULT_LIST_SIZE as se } from "../../constants/pagination.js";
|
|
11
|
+
import { useSelectContext as ae } from "../../contexts/select.hook.js";
|
|
12
|
+
const Le = Q(
|
|
13
13
|
({
|
|
14
|
-
additionalOptions:
|
|
15
|
-
className:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
noOptionsText:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} =
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
const t =
|
|
14
|
+
additionalOptions: A,
|
|
15
|
+
className: I,
|
|
16
|
+
groupedOptions: l,
|
|
17
|
+
inputRef: c,
|
|
18
|
+
isLoading: P,
|
|
19
|
+
itemClassName: u,
|
|
20
|
+
name: T,
|
|
21
|
+
searchable: f = !1,
|
|
22
|
+
listItemSecondRowClassName: p,
|
|
23
|
+
wrapperInputRef: U,
|
|
24
|
+
isInfiniteScrollEnabled: h,
|
|
25
|
+
noOptionsText: F,
|
|
26
|
+
onFetchMoreOptions: b
|
|
27
|
+
}, V) => {
|
|
28
|
+
const m = O(null), L = O(null), [v, k] = W(!1), {
|
|
29
|
+
canContinueFetching: d,
|
|
30
|
+
canFilter: y,
|
|
31
|
+
isOpen: _,
|
|
32
|
+
isTyping: E,
|
|
33
|
+
options: G,
|
|
34
|
+
page: w,
|
|
35
|
+
searchTerm: n,
|
|
36
|
+
setCanContinueFetching: q,
|
|
37
|
+
setOptions: z,
|
|
38
|
+
setPage: D
|
|
39
|
+
} = ae();
|
|
40
|
+
X(V, () => m.current, [m]);
|
|
41
|
+
const a = l.length > 0 && re(l[0]), x = f && y ? G.filter((e) => {
|
|
42
|
+
const t = n.toLowerCase();
|
|
43
43
|
return (typeof e.label == "string" ? e.label.toLowerCase() : "").includes(t);
|
|
44
|
-
}) :
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
}) : G, C = j(() => {
|
|
45
|
+
if (!a)
|
|
46
|
+
return [];
|
|
47
|
+
const e = l;
|
|
48
|
+
if (!f || !y || !n)
|
|
49
|
+
return e;
|
|
50
|
+
const t = n.toLowerCase();
|
|
51
|
+
return e.map((r) => ({
|
|
52
|
+
...r,
|
|
53
|
+
options: r.options.filter(
|
|
54
|
+
(i) => i.label.toLowerCase().includes(t)
|
|
55
|
+
)
|
|
56
|
+
})).filter((r) => r.options.length > 0);
|
|
57
|
+
}, [a, l, f, y, n]), H = a ? C.flatMap((e) => e.options) : x;
|
|
58
|
+
ee({
|
|
59
|
+
ulRef: m,
|
|
60
|
+
wrapperInputRef: U,
|
|
61
|
+
searchable: f,
|
|
62
|
+
filteredOptions: H
|
|
50
63
|
});
|
|
51
|
-
const
|
|
52
|
-
(e, t,
|
|
53
|
-
),
|
|
54
|
-
() =>
|
|
64
|
+
const M = x.filter(
|
|
65
|
+
(e, t, r) => t === r.findIndex((i) => i.value === e.value)
|
|
66
|
+
), S = a ? C.length === 0 : x.length === 0, Z = j(
|
|
67
|
+
() => K(async (e) => {
|
|
55
68
|
const [t] = e;
|
|
56
|
-
if (t.isIntersecting && !
|
|
69
|
+
if (t.isIntersecting && !v && b && d)
|
|
57
70
|
try {
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
page:
|
|
61
|
-
pageSize:
|
|
62
|
-
termOfSearch:
|
|
71
|
+
k(!0);
|
|
72
|
+
const r = w + 1, { data: i, hasMore: B } = await b({
|
|
73
|
+
page: r,
|
|
74
|
+
pageSize: se,
|
|
75
|
+
termOfSearch: n
|
|
63
76
|
});
|
|
64
|
-
|
|
77
|
+
D(r), q(B), z((J) => [...J, ...i]);
|
|
65
78
|
} catch {
|
|
66
79
|
console.error("Error fetching more options");
|
|
67
80
|
} finally {
|
|
68
|
-
|
|
81
|
+
k(!1);
|
|
69
82
|
}
|
|
70
83
|
}, 100),
|
|
71
|
-
[
|
|
84
|
+
[v, b, n, w]
|
|
72
85
|
);
|
|
73
|
-
return
|
|
74
|
-
if (
|
|
75
|
-
const e = new IntersectionObserver(
|
|
86
|
+
return Y(() => {
|
|
87
|
+
if (h && d && L.current && !E) {
|
|
88
|
+
const e = new IntersectionObserver(Z, {
|
|
76
89
|
threshold: 0.1
|
|
77
90
|
});
|
|
78
|
-
return e.observe(
|
|
91
|
+
return e.observe(L.current), () => e.disconnect();
|
|
79
92
|
}
|
|
80
93
|
}, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
]), /* @__PURE__ */
|
|
94
|
+
h,
|
|
95
|
+
d,
|
|
96
|
+
v,
|
|
97
|
+
E,
|
|
98
|
+
w
|
|
99
|
+
]), /* @__PURE__ */ N(
|
|
87
100
|
"ul",
|
|
88
101
|
{
|
|
89
|
-
ref:
|
|
90
|
-
title:
|
|
102
|
+
ref: m,
|
|
103
|
+
title: T,
|
|
91
104
|
role: "listbox",
|
|
92
|
-
className:
|
|
93
|
-
"data-state":
|
|
105
|
+
className: s(ne({ className: I })),
|
|
106
|
+
"data-state": _ ? "open" : "closed",
|
|
94
107
|
children: [
|
|
95
|
-
|
|
96
|
-
|
|
108
|
+
P ? /* @__PURE__ */ o(
|
|
109
|
+
g,
|
|
97
110
|
{
|
|
98
|
-
className:
|
|
111
|
+
className: s("select-none", u),
|
|
99
112
|
isClickable: !1,
|
|
100
|
-
inputRef:
|
|
113
|
+
inputRef: c,
|
|
101
114
|
value: "Loading...",
|
|
102
115
|
label: "Loading...",
|
|
103
|
-
listItemSecondRowClassName:
|
|
116
|
+
listItemSecondRowClassName: p
|
|
104
117
|
}
|
|
105
|
-
) :
|
|
106
|
-
|
|
118
|
+
) : S ? /* @__PURE__ */ o(
|
|
119
|
+
g,
|
|
107
120
|
{
|
|
108
121
|
isEmpty: !0,
|
|
109
|
-
className:
|
|
122
|
+
className: s("select-none", u),
|
|
110
123
|
isClickable: !1,
|
|
111
|
-
inputRef:
|
|
112
|
-
value:
|
|
113
|
-
label:
|
|
114
|
-
listItemSecondRowClassName:
|
|
124
|
+
inputRef: c,
|
|
125
|
+
value: F ?? "",
|
|
126
|
+
label: F ?? "No options",
|
|
127
|
+
listItemSecondRowClassName: p
|
|
115
128
|
}
|
|
116
|
-
) :
|
|
117
|
-
|
|
129
|
+
) : a ? C.map((e) => /* @__PURE__ */ N($, { children: [
|
|
130
|
+
/* @__PURE__ */ o(
|
|
131
|
+
"li",
|
|
132
|
+
{
|
|
133
|
+
role: "presentation",
|
|
134
|
+
"aria-hidden": "true",
|
|
135
|
+
"data-action": "true",
|
|
136
|
+
className: s(oe()),
|
|
137
|
+
children: e.groupLabel
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
e.options.map((t) => /* @__PURE__ */ o(
|
|
141
|
+
g,
|
|
142
|
+
{
|
|
143
|
+
className: s("select-none", u),
|
|
144
|
+
isClickable: !0,
|
|
145
|
+
inputRef: c,
|
|
146
|
+
listItemSecondRowClassName: p,
|
|
147
|
+
...t
|
|
148
|
+
},
|
|
149
|
+
t.value
|
|
150
|
+
))
|
|
151
|
+
] }, e.groupLabel)) : M.map((e) => /* @__PURE__ */ o(
|
|
152
|
+
g,
|
|
118
153
|
{
|
|
119
|
-
className:
|
|
154
|
+
className: s("select-none", u),
|
|
120
155
|
isClickable: !0,
|
|
121
|
-
inputRef:
|
|
122
|
-
listItemSecondRowClassName:
|
|
156
|
+
inputRef: c,
|
|
157
|
+
listItemSecondRowClassName: p,
|
|
123
158
|
...e
|
|
124
159
|
},
|
|
125
160
|
e.value
|
|
126
161
|
)),
|
|
127
|
-
|
|
162
|
+
h && d && /* @__PURE__ */ o(
|
|
128
163
|
"li",
|
|
129
164
|
{
|
|
130
|
-
ref:
|
|
165
|
+
ref: L,
|
|
131
166
|
role: "option",
|
|
132
167
|
"data-action": "true",
|
|
133
168
|
className: "flex items-center justify-center py-3",
|
|
134
169
|
onClick: (e) => e.stopPropagation(),
|
|
135
|
-
children: /* @__PURE__ */
|
|
170
|
+
children: /* @__PURE__ */ o(R, { className: "w-4 h-4 text-aurora-500 select-none" })
|
|
136
171
|
}
|
|
137
172
|
),
|
|
138
|
-
|
|
139
|
-
"li",
|
|
140
|
-
{
|
|
141
|
-
role: "option",
|
|
142
|
-
"data-action": "true",
|
|
143
|
-
onClick: () => q(!1),
|
|
144
|
-
children: /* @__PURE__ */ r(
|
|
145
|
-
B,
|
|
146
|
-
{
|
|
147
|
-
className: o(
|
|
148
|
-
"flex",
|
|
149
|
-
"min-h-10",
|
|
150
|
-
"py-2",
|
|
151
|
-
"px-6",
|
|
152
|
-
"w-full",
|
|
153
|
-
"h-full",
|
|
154
|
-
"gap-1",
|
|
155
|
-
"items-center",
|
|
156
|
-
"text-sm",
|
|
157
|
-
"[&>svg]:-ml-1",
|
|
158
|
-
"[&>svg]:w-3.5",
|
|
159
|
-
"[&>svg]:h-3.5",
|
|
160
|
-
"[&>svg]:shrink-0",
|
|
161
|
-
"cursor-pointer",
|
|
162
|
-
"select-none",
|
|
163
|
-
"hover:bg-gray-50",
|
|
164
|
-
"hover:dark:bg-metal-700",
|
|
165
|
-
"focus:outline-0",
|
|
166
|
-
"text-blue-600",
|
|
167
|
-
"dark:text-aurora-500"
|
|
168
|
-
),
|
|
169
|
-
children: e
|
|
170
|
-
}
|
|
171
|
-
)
|
|
172
|
-
},
|
|
173
|
-
t
|
|
174
|
-
))
|
|
173
|
+
/* @__PURE__ */ o(te, { additionalOptions: A })
|
|
175
174
|
]
|
|
176
175
|
}
|
|
177
176
|
);
|
|
178
177
|
}
|
|
179
178
|
);
|
|
180
179
|
export {
|
|
181
|
-
|
|
180
|
+
Le as List
|
|
182
181
|
};
|
|
@@ -2,6 +2,7 @@ import { ComponentRef, RefObject } from 'react';
|
|
|
2
2
|
import { SelectProps } from '../../Select.types';
|
|
3
3
|
export type ListProps = Pick<SelectProps, 'name' | 'options' | 'theme' | 'additionalOptions'> & {
|
|
4
4
|
className?: string;
|
|
5
|
+
groupedOptions: SelectProps['options'];
|
|
5
6
|
inputRef?: RefObject<ComponentRef<'input'> | null>;
|
|
6
7
|
isLoading: boolean;
|
|
7
8
|
itemClassName?: string;
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { c as t } from "../../../../index-D29mdTf5.js";
|
|
2
|
-
const
|
|
2
|
+
const r = t([
|
|
3
|
+
"flex",
|
|
4
|
+
"items-center",
|
|
5
|
+
"h-8",
|
|
6
|
+
"px-6",
|
|
7
|
+
"py-1.5",
|
|
8
|
+
"text-[11px]",
|
|
9
|
+
"font-medium",
|
|
10
|
+
"uppercase",
|
|
11
|
+
"tracking-[0.25px]",
|
|
12
|
+
"text-metal-50",
|
|
13
|
+
"pointer-events-none",
|
|
14
|
+
"select-none",
|
|
15
|
+
"cursor-default"
|
|
16
|
+
]), a = t([
|
|
3
17
|
"scrollbar",
|
|
4
18
|
"absolute",
|
|
5
19
|
"bg-white",
|
|
@@ -27,5 +41,6 @@ const o = t([
|
|
|
27
41
|
"[&>li:last-child]:mb-2"
|
|
28
42
|
]);
|
|
29
43
|
export {
|
|
30
|
-
|
|
44
|
+
r as listGroupLabelVariants,
|
|
45
|
+
a as listVariants
|
|
31
46
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { ComponentRef, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
2
|
import { SelectProps } from '../Select.types';
|
|
3
|
-
export declare const Wrapper: ForwardRefExoticComponent<Omit<SelectProps, 'options'> &
|
|
3
|
+
export declare const Wrapper: ForwardRefExoticComponent<Omit<SelectProps, 'options'> & {
|
|
4
|
+
groupedOptions: SelectProps['options'];
|
|
5
|
+
} & RefAttributes<ComponentRef<'input'>>>;
|