@boxcustodia/library 2.0.0-alpha.30 → 2.0.0-alpha.31
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/calendar/calendar.cjs.js +1 -1
- package/dist/components/calendar/calendar.es.js +33 -33
- package/dist/components/combobox/combobox.cjs.js +1 -1
- package/dist/components/combobox/combobox.es.js +302 -282
- package/dist/components/pagination/pagination.cjs.js +1 -1
- package/dist/components/pagination/pagination.es.js +70 -67
- package/dist/components/select/select.cjs.js +1 -1
- package/dist/components/select/select.es.js +168 -154
- package/dist/src/components/combobox/combobox.d.ts +31 -12
- package/dist/src/components/pagination/pagination.d.ts +6 -2
- package/dist/src/components/select/select.d.ts +38 -12
- package/package.json +1 -1
- package/src/components/calendar/calendar.tsx +3 -3
- package/src/components/combobox/combobox.stories.tsx +7 -4
- package/src/components/combobox/combobox.test.tsx +52 -15
- package/src/components/combobox/combobox.tsx +109 -23
- package/src/components/form/form.stories.tsx +3 -2
- package/src/components/pagination/pagination.test.tsx +5 -5
- package/src/components/pagination/pagination.tsx +17 -16
- package/src/components/select/select.stories.tsx +51 -13
- package/src/components/select/select.test.tsx +114 -16
- package/src/components/select/select.tsx +97 -37
|
@@ -1,99 +1,100 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
2
|
+
import { jsx as r, jsxs as p, Fragment as T } from "react/jsx-runtime";
|
|
3
|
+
import * as $ from "react";
|
|
4
|
+
import I from "../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.es.js";
|
|
5
|
+
import { useRender as V } from "../../node_modules/@base-ui/react/use-render/useRender.es.js";
|
|
6
|
+
import R from "../../node_modules/lucide-react/dist/esm/icons/chevron-up.es.js";
|
|
7
|
+
import B from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.es.js";
|
|
8
|
+
import { cn as l } from "../../lib/cn.es.js";
|
|
9
|
+
import { SelectRoot as U } from "../../node_modules/@base-ui/react/select/root/SelectRoot.es.js";
|
|
10
|
+
import { SelectTrigger as A } from "../../node_modules/@base-ui/react/select/trigger/SelectTrigger.es.js";
|
|
11
|
+
import { SelectIcon as E } from "../../node_modules/@base-ui/react/select/icon/SelectIcon.es.js";
|
|
12
|
+
import { mergeProps as K } from "../../node_modules/@base-ui/react/merge-props/mergeProps.es.js";
|
|
13
|
+
import { SelectValue as M } from "../../node_modules/@base-ui/react/select/value/SelectValue.es.js";
|
|
14
|
+
import { SelectPortal as q } from "../../node_modules/@base-ui/react/select/portal/SelectPortal.es.js";
|
|
15
|
+
import { SelectPositioner as F } from "../../node_modules/@base-ui/react/select/positioner/SelectPositioner.es.js";
|
|
16
|
+
import { SelectPopup as O } from "../../node_modules/@base-ui/react/select/popup/SelectPopup.es.js";
|
|
17
|
+
import { SelectScrollUpArrow as W } from "../../node_modules/@base-ui/react/select/scroll-up-arrow/SelectScrollUpArrow.es.js";
|
|
18
|
+
import { SelectList as H } from "../../node_modules/@base-ui/react/select/list/SelectList.es.js";
|
|
19
|
+
import { SelectScrollDownArrow as J } from "../../node_modules/@base-ui/react/select/scroll-down-arrow/SelectScrollDownArrow.es.js";
|
|
20
|
+
import { SelectItem as Q } from "../../node_modules/@base-ui/react/select/item/SelectItem.es.js";
|
|
21
|
+
import { SelectItemText as X } from "../../node_modules/@base-ui/react/select/item-text/SelectItemText.es.js";
|
|
22
|
+
import { SelectItemIndicator as Y } from "../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.es.js";
|
|
23
|
+
import { Separator as Z } from "../../node_modules/@base-ui/react/separator/Separator.es.js";
|
|
24
|
+
import { SelectGroup as ee } from "../../node_modules/@base-ui/react/select/group/SelectGroup.es.js";
|
|
25
|
+
import { SelectGroupLabel as te } from "../../node_modules/@base-ui/react/select/group-label/SelectGroupLabel.es.js";
|
|
26
|
+
import { SelectLabel as re } from "../../node_modules/@base-ui/react/select/label/SelectLabel.es.js";
|
|
27
|
+
import { inputBaseClasses as oe } from "../input/input.es.js";
|
|
28
|
+
const L = l(
|
|
29
|
+
oe,
|
|
29
30
|
"relative inline-flex items-center justify-between gap-2 select-none text-left text-foreground",
|
|
30
31
|
"focus-visible:border-ring",
|
|
31
32
|
"aria-invalid:border-error focus-visible:aria-invalid:ring-error/20",
|
|
32
33
|
"has-aria-invalid:border-error has-focus-visible:has-aria-invalid:ring-error/20",
|
|
33
34
|
"data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
34
35
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
35
|
-
),
|
|
36
|
-
function
|
|
36
|
+
), k = "-me-1 size-4.5 opacity-80 sm:size-4";
|
|
37
|
+
function ae({
|
|
37
38
|
...e
|
|
38
39
|
}) {
|
|
39
|
-
return /* @__PURE__ */ r(
|
|
40
|
+
return /* @__PURE__ */ r(U, { ...e });
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function ne({
|
|
42
43
|
className: e,
|
|
43
44
|
children: t,
|
|
44
|
-
icon:
|
|
45
|
-
...
|
|
45
|
+
icon: n,
|
|
46
|
+
...s
|
|
46
47
|
}) {
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
48
|
+
return /* @__PURE__ */ p(
|
|
49
|
+
A,
|
|
49
50
|
{
|
|
50
|
-
className:
|
|
51
|
+
className: l(L, e),
|
|
51
52
|
"data-slot": "select-trigger",
|
|
52
|
-
...
|
|
53
|
+
...s,
|
|
53
54
|
children: [
|
|
54
55
|
t,
|
|
55
56
|
/* @__PURE__ */ r(
|
|
56
|
-
|
|
57
|
+
E,
|
|
57
58
|
{
|
|
58
59
|
"data-slot": "select-icon",
|
|
59
60
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
60
|
-
children:
|
|
61
|
+
children: n ?? /* @__PURE__ */ r(I, { className: k })
|
|
61
62
|
}
|
|
62
63
|
)
|
|
63
64
|
]
|
|
64
65
|
}
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
+
function Ue({
|
|
68
69
|
className: e,
|
|
69
70
|
render: t,
|
|
70
|
-
children:
|
|
71
|
-
icon:
|
|
72
|
-
...
|
|
71
|
+
children: n,
|
|
72
|
+
icon: s,
|
|
73
|
+
...d
|
|
73
74
|
}) {
|
|
74
|
-
const
|
|
75
|
-
children: /* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */ r("span", { className: "flex-1 truncate in-data-placeholder:text-muted-foreground/72", children:
|
|
77
|
-
|
|
75
|
+
const i = t ? void 0 : "button", u = {
|
|
76
|
+
children: /* @__PURE__ */ p(T, { children: [
|
|
77
|
+
/* @__PURE__ */ r("span", { className: "flex-1 truncate in-data-placeholder:text-muted-foreground/72", children: n }),
|
|
78
|
+
s ?? /* @__PURE__ */ r(I, { className: k })
|
|
78
79
|
] }),
|
|
79
|
-
className:
|
|
80
|
+
className: l(L, "min-w-0", e),
|
|
80
81
|
"data-slot": "select-button",
|
|
81
|
-
type:
|
|
82
|
+
type: i
|
|
82
83
|
};
|
|
83
|
-
return
|
|
84
|
+
return V({
|
|
84
85
|
defaultTagName: "button",
|
|
85
|
-
props:
|
|
86
|
+
props: K(u, d),
|
|
86
87
|
render: t
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function le({
|
|
90
91
|
className: e,
|
|
91
92
|
...t
|
|
92
93
|
}) {
|
|
93
94
|
return /* @__PURE__ */ r(
|
|
94
|
-
|
|
95
|
+
M,
|
|
95
96
|
{
|
|
96
|
-
className:
|
|
97
|
+
className: l(
|
|
97
98
|
"flex-1 truncate data-placeholder:text-muted-foreground",
|
|
98
99
|
e
|
|
99
100
|
),
|
|
@@ -102,48 +103,48 @@ function oe({
|
|
|
102
103
|
}
|
|
103
104
|
);
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function se({
|
|
106
107
|
className: e,
|
|
107
108
|
children: t,
|
|
108
|
-
side:
|
|
109
|
-
sideOffset:
|
|
110
|
-
align:
|
|
111
|
-
alignOffset:
|
|
112
|
-
alignItemWithTrigger:
|
|
113
|
-
anchor:
|
|
114
|
-
portalProps:
|
|
109
|
+
side: n = "bottom",
|
|
110
|
+
sideOffset: s = 4,
|
|
111
|
+
align: d = "start",
|
|
112
|
+
alignOffset: i = 0,
|
|
113
|
+
alignItemWithTrigger: u = !1,
|
|
114
|
+
anchor: f,
|
|
115
|
+
portalProps: c,
|
|
115
116
|
...m
|
|
116
117
|
}) {
|
|
117
|
-
return /* @__PURE__ */ r(
|
|
118
|
-
|
|
118
|
+
return /* @__PURE__ */ r(q, { ...c, children: /* @__PURE__ */ r(
|
|
119
|
+
F,
|
|
119
120
|
{
|
|
120
|
-
align:
|
|
121
|
-
alignItemWithTrigger:
|
|
122
|
-
alignOffset:
|
|
123
|
-
anchor:
|
|
121
|
+
align: d,
|
|
122
|
+
alignItemWithTrigger: u,
|
|
123
|
+
alignOffset: i,
|
|
124
|
+
anchor: f,
|
|
124
125
|
className: "z-50 select-none",
|
|
125
126
|
"data-slot": "select-positioner",
|
|
126
|
-
side:
|
|
127
|
-
sideOffset:
|
|
128
|
-
children: /* @__PURE__ */
|
|
129
|
-
|
|
127
|
+
side: n,
|
|
128
|
+
sideOffset: s,
|
|
129
|
+
children: /* @__PURE__ */ p(
|
|
130
|
+
O,
|
|
130
131
|
{
|
|
131
132
|
className: "origin-(--transform-origin) text-foreground outline-none duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
|
|
132
133
|
"data-slot": "select-popup",
|
|
133
134
|
...m,
|
|
134
135
|
children: [
|
|
135
136
|
/* @__PURE__ */ r(
|
|
136
|
-
|
|
137
|
+
W,
|
|
137
138
|
{
|
|
138
139
|
className: "top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover",
|
|
139
140
|
"data-slot": "select-scroll-up-arrow",
|
|
140
|
-
children: /* @__PURE__ */ r(
|
|
141
|
+
children: /* @__PURE__ */ r(R, { className: "relative size-4.5 sm:size-4" })
|
|
141
142
|
}
|
|
142
143
|
),
|
|
143
144
|
/* @__PURE__ */ r("div", { className: "relative h-full min-w-(--anchor-width) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", children: /* @__PURE__ */ r(
|
|
144
|
-
|
|
145
|
+
H,
|
|
145
146
|
{
|
|
146
|
-
className:
|
|
147
|
+
className: l(
|
|
147
148
|
"max-h-[min(24rem,var(--available-height))] overflow-y-auto p-1",
|
|
148
149
|
e
|
|
149
150
|
),
|
|
@@ -152,11 +153,11 @@ function ae({
|
|
|
152
153
|
}
|
|
153
154
|
) }),
|
|
154
155
|
/* @__PURE__ */ r(
|
|
155
|
-
|
|
156
|
+
J,
|
|
156
157
|
{
|
|
157
158
|
className: "bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover",
|
|
158
159
|
"data-slot": "select-scroll-down-arrow",
|
|
159
|
-
children: /* @__PURE__ */ r(
|
|
160
|
+
children: /* @__PURE__ */ r(B, { className: "relative size-4.5 sm:size-4" })
|
|
160
161
|
}
|
|
161
162
|
)
|
|
162
163
|
]
|
|
@@ -165,23 +166,23 @@ function ae({
|
|
|
165
166
|
}
|
|
166
167
|
) });
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
function ie({
|
|
169
170
|
className: e,
|
|
170
171
|
children: t,
|
|
171
|
-
...
|
|
172
|
+
...n
|
|
172
173
|
}) {
|
|
173
|
-
return /* @__PURE__ */
|
|
174
|
-
|
|
174
|
+
return /* @__PURE__ */ p(
|
|
175
|
+
Q,
|
|
175
176
|
{
|
|
176
|
-
className:
|
|
177
|
+
className: l(
|
|
177
178
|
"grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1fr_1rem] items-center gap-2 rounded-sm py-1 px-2 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
178
179
|
e
|
|
179
180
|
),
|
|
180
181
|
"data-slot": "select-item",
|
|
181
|
-
...
|
|
182
|
+
...n,
|
|
182
183
|
children: [
|
|
183
|
-
/* @__PURE__ */ r(
|
|
184
|
-
/* @__PURE__ */ r(
|
|
184
|
+
/* @__PURE__ */ r(X, { className: "col-start-1 min-w-0", children: t }),
|
|
185
|
+
/* @__PURE__ */ r(Y, { className: "col-start-2", children: /* @__PURE__ */ r(
|
|
185
186
|
"svg",
|
|
186
187
|
{
|
|
187
188
|
"aria-hidden": "true",
|
|
@@ -201,25 +202,25 @@ function le({
|
|
|
201
202
|
}
|
|
202
203
|
);
|
|
203
204
|
}
|
|
204
|
-
function
|
|
205
|
+
function Ae({
|
|
205
206
|
className: e,
|
|
206
207
|
...t
|
|
207
208
|
}) {
|
|
208
209
|
return /* @__PURE__ */ r(
|
|
209
|
-
|
|
210
|
+
Z,
|
|
210
211
|
{
|
|
211
|
-
className:
|
|
212
|
+
className: l("mx-2 my-1 h-px bg-border", e),
|
|
212
213
|
"data-slot": "select-separator",
|
|
213
214
|
...t
|
|
214
215
|
}
|
|
215
216
|
);
|
|
216
217
|
}
|
|
217
|
-
function
|
|
218
|
-
return /* @__PURE__ */ r(
|
|
218
|
+
function Ee(e) {
|
|
219
|
+
return /* @__PURE__ */ r(ee, { "data-slot": "select-group", ...e });
|
|
219
220
|
}
|
|
220
|
-
function
|
|
221
|
+
function Ke(e) {
|
|
221
222
|
return /* @__PURE__ */ r(
|
|
222
|
-
|
|
223
|
+
te,
|
|
223
224
|
{
|
|
224
225
|
className: "px-2 py-1.5 font-medium text-muted-foreground text-xs",
|
|
225
226
|
"data-slot": "select-group-label",
|
|
@@ -227,14 +228,14 @@ function Ue(e) {
|
|
|
227
228
|
}
|
|
228
229
|
);
|
|
229
230
|
}
|
|
230
|
-
function
|
|
231
|
+
function Me({
|
|
231
232
|
className: e,
|
|
232
233
|
...t
|
|
233
234
|
}) {
|
|
234
235
|
return /* @__PURE__ */ r(
|
|
235
|
-
|
|
236
|
+
re,
|
|
236
237
|
{
|
|
237
|
-
className:
|
|
238
|
+
className: l(
|
|
238
239
|
"not-in-data-[slot=field]:mb-2 inline-flex cursor-default items-center gap-2 font-medium text-base/4.5 text-foreground sm:text-sm/4",
|
|
239
240
|
e
|
|
240
241
|
),
|
|
@@ -243,7 +244,7 @@ function Ae({
|
|
|
243
244
|
}
|
|
244
245
|
);
|
|
245
246
|
}
|
|
246
|
-
function
|
|
247
|
+
function ce(e) {
|
|
247
248
|
if (e == null) return "";
|
|
248
249
|
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
249
250
|
if (typeof e == "object") {
|
|
@@ -254,7 +255,7 @@ function ne(e) {
|
|
|
254
255
|
}
|
|
255
256
|
return String(e);
|
|
256
257
|
}
|
|
257
|
-
function
|
|
258
|
+
function de(e) {
|
|
258
259
|
if (e == null) return "";
|
|
259
260
|
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
260
261
|
if (typeof e == "object") {
|
|
@@ -264,88 +265,101 @@ function ie(e) {
|
|
|
264
265
|
}
|
|
265
266
|
return String(e);
|
|
266
267
|
}
|
|
267
|
-
function
|
|
268
|
+
function ue(e) {
|
|
268
269
|
return e != null && typeof e == "object" && "disabled" in e ? !!e.disabled : !1;
|
|
269
270
|
}
|
|
270
|
-
function
|
|
271
|
+
function qe(e) {
|
|
271
272
|
const {
|
|
272
273
|
items: t,
|
|
273
|
-
getLabel:
|
|
274
|
-
getId:
|
|
275
|
-
getDisabled:
|
|
276
|
-
renderItem:
|
|
277
|
-
placeholder:
|
|
278
|
-
onValueChange:
|
|
279
|
-
value:
|
|
274
|
+
getLabel: n,
|
|
275
|
+
getId: s,
|
|
276
|
+
getDisabled: d,
|
|
277
|
+
renderItem: i,
|
|
278
|
+
placeholder: u,
|
|
279
|
+
onValueChange: f,
|
|
280
|
+
value: c,
|
|
280
281
|
defaultValue: m,
|
|
281
|
-
multiple:
|
|
282
|
-
className:
|
|
283
|
-
classNames:
|
|
284
|
-
icon:
|
|
285
|
-
"aria-invalid":
|
|
286
|
-
...
|
|
287
|
-
} = e,
|
|
288
|
-
|
|
289
|
-
|
|
282
|
+
multiple: g,
|
|
283
|
+
className: C,
|
|
284
|
+
classNames: w,
|
|
285
|
+
icon: _,
|
|
286
|
+
"aria-invalid": N,
|
|
287
|
+
...P
|
|
288
|
+
} = e, y = n ?? ce, S = s ?? de, j = d ?? ue, b = (o) => String(S(o)), v = (o) => t.find((a) => b(a) === o) ?? null, z = $.useRef(!1);
|
|
289
|
+
if (process.env.NODE_ENV !== "production" && !z.current) {
|
|
290
|
+
const o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
291
|
+
for (const h of t) {
|
|
292
|
+
const x = b(h);
|
|
293
|
+
o.has(x) && a.add(x), o.add(x);
|
|
294
|
+
}
|
|
295
|
+
a.size > 0 && (z.current = !0, console.warn(
|
|
296
|
+
`[Select] Multiple items resolve to the same id (${[...a].join(", ")}). Provide a \`getId\` that returns a unique value per item.`
|
|
297
|
+
));
|
|
298
|
+
}
|
|
299
|
+
const D = g ? c?.map((o) => String(o)) : c == null ? c : String(c), G = g ? m?.map(
|
|
300
|
+
(o) => String(o)
|
|
301
|
+
) : m == null ? void 0 : String(m);
|
|
302
|
+
return /* @__PURE__ */ p(
|
|
303
|
+
ae,
|
|
290
304
|
{
|
|
291
305
|
itemToStringLabel: (o) => {
|
|
292
|
-
const
|
|
293
|
-
return
|
|
306
|
+
const a = v(o);
|
|
307
|
+
return a ? y(a) : o;
|
|
294
308
|
},
|
|
295
|
-
multiple:
|
|
296
|
-
value:
|
|
297
|
-
defaultValue:
|
|
309
|
+
multiple: g,
|
|
310
|
+
value: D,
|
|
311
|
+
defaultValue: G,
|
|
298
312
|
onValueChange: (o) => {
|
|
299
|
-
if (
|
|
300
|
-
const
|
|
301
|
-
|
|
313
|
+
if (g) {
|
|
314
|
+
const h = (o ?? []).map(v).filter(Boolean);
|
|
315
|
+
f?.(h.map(S), h);
|
|
302
316
|
} else {
|
|
303
317
|
if (o == null) {
|
|
304
|
-
|
|
318
|
+
f?.(null, null);
|
|
305
319
|
return;
|
|
306
320
|
}
|
|
307
|
-
const
|
|
308
|
-
|
|
321
|
+
const a = v(o);
|
|
322
|
+
f?.(a ? S(a) : null, a);
|
|
309
323
|
}
|
|
310
324
|
},
|
|
311
|
-
...
|
|
325
|
+
...P,
|
|
312
326
|
children: [
|
|
313
327
|
/* @__PURE__ */ r(
|
|
314
|
-
|
|
328
|
+
ne,
|
|
315
329
|
{
|
|
316
|
-
className:
|
|
317
|
-
icon:
|
|
318
|
-
...
|
|
319
|
-
children: /* @__PURE__ */ r(
|
|
330
|
+
className: C,
|
|
331
|
+
icon: _,
|
|
332
|
+
...N === void 0 ? {} : { "aria-invalid": N },
|
|
333
|
+
children: /* @__PURE__ */ r(le, { placeholder: u })
|
|
320
334
|
}
|
|
321
335
|
),
|
|
322
|
-
/* @__PURE__ */ r(
|
|
323
|
-
|
|
336
|
+
/* @__PURE__ */ r(se, { className: w?.popup, children: t.map((o) => /* @__PURE__ */ r(
|
|
337
|
+
ie,
|
|
324
338
|
{
|
|
325
|
-
value:
|
|
326
|
-
disabled:
|
|
327
|
-
className:
|
|
328
|
-
children:
|
|
339
|
+
value: b(o),
|
|
340
|
+
disabled: j(o),
|
|
341
|
+
className: w?.item,
|
|
342
|
+
children: i ? i(o) : y(o)
|
|
329
343
|
},
|
|
330
|
-
|
|
344
|
+
b(o)
|
|
331
345
|
)) })
|
|
332
346
|
]
|
|
333
347
|
}
|
|
334
348
|
);
|
|
335
349
|
}
|
|
336
350
|
export {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
qe as Select,
|
|
352
|
+
Ue as SelectButton,
|
|
353
|
+
se as SelectContent,
|
|
354
|
+
Ee as SelectGroup,
|
|
355
|
+
Ke as SelectGroupLabel,
|
|
356
|
+
ie as SelectItem,
|
|
357
|
+
Me as SelectLabel,
|
|
358
|
+
se as SelectPopup,
|
|
359
|
+
ae as SelectRoot,
|
|
360
|
+
Ae as SelectSeparator,
|
|
361
|
+
ne as SelectTrigger,
|
|
362
|
+
le as SelectValue,
|
|
363
|
+
L as selectTriggerClasses,
|
|
364
|
+
k as selectTriggerIconClassName
|
|
351
365
|
};
|
|
@@ -51,12 +51,25 @@ export declare function ComboboxChip({ children, removeProps, ...props }: Combob
|
|
|
51
51
|
removeProps?: ComboboxPrimitive.ChipRemove.Props;
|
|
52
52
|
}): React.ReactElement;
|
|
53
53
|
export declare function ComboboxChipRemove(props: ComboboxPrimitive.ChipRemove.Props): React.ReactElement;
|
|
54
|
-
type
|
|
54
|
+
type ComboboxId = string | number;
|
|
55
|
+
/**
|
|
56
|
+
* Infers the id type from the shape of an item, mirroring `defaultGetId`'s
|
|
57
|
+
* lookup order (`id` before `value`, then the primitive itself). Lets the
|
|
58
|
+
* common case — `{ id, name }`, `{ label, value }`, or plain primitives — drive
|
|
59
|
+
* `value` / `onValueChange` typing with no explicit `getId`. Falls back to
|
|
60
|
+
* `string` for shapes `defaultGetId` can't address.
|
|
61
|
+
*/
|
|
62
|
+
type InferId<TItem> = TItem extends {
|
|
63
|
+
id: infer I extends ComboboxId;
|
|
64
|
+
} ? I : TItem extends {
|
|
65
|
+
value: infer V extends ComboboxId;
|
|
66
|
+
} ? V : TItem extends ComboboxId ? TItem : string;
|
|
67
|
+
type ComboboxBaseProps<TItem = unknown, TId extends ComboboxId = InferId<TItem>> = Omit<ComboboxPrimitive.Root.Props<TItem, boolean>, "items" | "itemToStringLabel" | "itemToStringValue" | "children" | "multiple" | "onValueChange" | "value" | "defaultValue" | "isItemEqualToValue"> & {
|
|
55
68
|
items: readonly TItem[];
|
|
56
69
|
/** Returns the display text for an item. Used for filter matching, ARIA, and the trigger input. Defaults to `item.label`, `item.name`, `item.title`, or the stringified primitive. */
|
|
57
70
|
getLabel?: (item: TItem) => string;
|
|
58
|
-
/** Returns a stable
|
|
59
|
-
getId?: (item: TItem) =>
|
|
71
|
+
/** Returns a stable id for an item. Used as the controlled `value`, React key, and hidden form value. Defaults to `item.id`, `item.value`, or the stringified primitive. */
|
|
72
|
+
getId?: (item: TItem) => TId;
|
|
60
73
|
renderItem?: (item: TItem) => React.ReactNode;
|
|
61
74
|
placeholder?: string;
|
|
62
75
|
emptyText?: string;
|
|
@@ -83,16 +96,22 @@ type ComboboxBaseProps<TItem = unknown> = Omit<ComboboxPrimitive.Root.Props<TIte
|
|
|
83
96
|
empty?: string;
|
|
84
97
|
};
|
|
85
98
|
};
|
|
86
|
-
export type ComboboxProps<TItem = unknown
|
|
99
|
+
export type ComboboxProps<TItem = unknown, TId extends ComboboxId = InferId<TItem>> = (ComboboxBaseProps<TItem, TId> & {
|
|
87
100
|
multiple?: false;
|
|
88
|
-
value
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
101
|
+
/** Controlled selection id. Pass the value returned by `getId` (string or number), not the item object. */
|
|
102
|
+
value?: TId | null;
|
|
103
|
+
/** Initial selection id for uncontrolled usage. */
|
|
104
|
+
defaultValue?: TId | null;
|
|
105
|
+
/** Called with the selected id and the full item when selection changes. Both are `null` when cleared. */
|
|
106
|
+
onValueChange?: (id: TId | null, item: TItem | null) => void;
|
|
107
|
+
}) | (ComboboxBaseProps<TItem, TId> & {
|
|
92
108
|
multiple: true;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
109
|
+
/** Controlled selection ids for multiple mode. Pass the array of values returned by `getId`. */
|
|
110
|
+
value?: ReadonlyArray<TId>;
|
|
111
|
+
/** Initial selection ids for uncontrolled multiple mode. */
|
|
112
|
+
defaultValue?: ReadonlyArray<TId>;
|
|
113
|
+
/** Called with the array of selected ids and the array of full items when selection changes. */
|
|
114
|
+
onValueChange?: (ids: TId[], items: TItem[]) => void;
|
|
96
115
|
});
|
|
97
116
|
/**
|
|
98
117
|
* Composite combobox for single and multiple selection.
|
|
@@ -109,6 +128,6 @@ export type ComboboxProps<TItem = unknown> = (ComboboxBaseProps<TItem> & {
|
|
|
109
128
|
* Use `ComboboxRoot` + primitives directly when you need full structural
|
|
110
129
|
* control beyond what escape-hatch props offer.
|
|
111
130
|
*/
|
|
112
|
-
export declare function Combobox<TItem = unknown
|
|
131
|
+
export declare function Combobox<TItem = unknown, TId extends ComboboxId = InferId<TItem>>(allProps: ComboboxProps<TItem, TId>): React.ReactElement;
|
|
113
132
|
export declare const useComboboxFilter: typeof ComboboxPrimitive.useFilter;
|
|
114
133
|
export { ComboboxPrimitive };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, ComponentType, ElementType, ReactNode } from 'react';
|
|
2
2
|
import { Button } from '../button';
|
|
3
|
+
import { SelectProps } from '../select';
|
|
3
4
|
import { PageSize } from './pagination.model';
|
|
4
5
|
type GetPageHref = (state: {
|
|
5
6
|
page: number;
|
|
@@ -116,9 +117,12 @@ interface PaginationRangeProps {
|
|
|
116
117
|
}) => ReactNode);
|
|
117
118
|
}
|
|
118
119
|
export declare function PaginationRange({ children, className, ...props }: PaginationRangeProps): import("react/jsx-runtime").JSX.Element;
|
|
119
|
-
|
|
120
|
+
type PaginationSizeSelectProps = Omit<SelectProps<{
|
|
121
|
+
label: string;
|
|
122
|
+
value: PageSize;
|
|
123
|
+
}, PageSize>, "items" | "value" | "defaultValue" | "onValueChange" | "multiple"> & {
|
|
120
124
|
sizes?: readonly PageSize[] | PageSize[];
|
|
121
|
-
}
|
|
125
|
+
};
|
|
122
126
|
export declare function PaginationSizeSelect({ sizes, className, ...props }: PaginationSizeSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
123
127
|
interface PaginationProps extends Omit<PaginationRootProps, "children"> {
|
|
124
128
|
sizes?: readonly PageSize[] | PageSize[] | false;
|