@gridui/select 1.2.1 → 1.3.0
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/README.md +16 -2
- package/dist/index.js +150 -77
- package/dist/index.js.map +3 -3
- package/dist/select/select-options.d.ts +1 -1
- package/dist/shared/popup/selection-popup.d.ts +1 -0
- package/dist/shared/search/calculate-search-options.d.ts +28 -0
- package/dist/shared/search/use-search-options.d.ts +5 -4
- package/dist/shared/types.d.ts +8 -2
- package/docs/catalog.json +2 -1
- package/docs/reference/combobox.md +8 -0
- package/docs/reference/multi-select.md +8 -0
- package/docs/reference/select.md +8 -0
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -70,6 +70,16 @@ disabled, or already-empty controls.
|
|
|
70
70
|
Combobox also disables clearing while `readOnly`; external controlled updates and
|
|
71
71
|
native form reset retain their normal behavior.
|
|
72
72
|
|
|
73
|
+
### Selection appearance
|
|
74
|
+
|
|
75
|
+
Select, Combobox, and MultiSelect accept `selectionAppearance="filled" | "indicator"`,
|
|
76
|
+
using the same Overlay CVA variant as DropdownMenu and Preferences. `"filled"`
|
|
77
|
+
(default) shows the selected background and trailing check; `"indicator"` keeps
|
|
78
|
+
the check without the selected background. Unselected options retain their check
|
|
79
|
+
slot so labels do not shift. This affects both flat and grouped options, including
|
|
80
|
+
multiple selected rows. Keyboard/pointer highlights, search, form values, actions,
|
|
81
|
+
and disabled behavior remain independent of this presentation choice.
|
|
82
|
+
|
|
73
83
|
### Actions
|
|
74
84
|
|
|
75
85
|
Both components accept `actions: readonly SelectAction[]`. Each action has a
|
|
@@ -143,8 +153,7 @@ reset observation. `selection-actions.tsx` renders independent links and buttons
|
|
|
143
153
|
|
|
144
154
|
`types.ts` owns shared option, action, and selection contracts; `options.ts` owns
|
|
145
155
|
pure filtering and flattening; `style.ts` owns selection-specific presentation and composes Overlay surface
|
|
146
|
-
styles without translating variables into DropdownMenu names. DropdownMenu
|
|
147
|
-
owns the public option-row style. `selection-popup.tsx` shares Combobox/MultiSelect
|
|
156
|
+
styles without translating variables into DropdownMenu names. Overlay owns the public option-row style shared with DropdownMenu. `selection-popup.tsx` shares Combobox/MultiSelect
|
|
148
157
|
portal geometry, explicit anchor containment, and focus/escape event plumbing;
|
|
149
158
|
callers choose initial focus and dismissal policy. MultiSelect uses Form's
|
|
150
159
|
ListFieldControl with useListField for the native multiple-value bridge. Internal parts
|
|
@@ -195,3 +204,8 @@ stale options. Supply useAsyncOptions with the controlled text value for remote
|
|
|
195
204
|
suggestions. Applications own request and caching policy. className/style/ref
|
|
196
205
|
address the input; rootClassName addresses its anchor. portalContainer and dir
|
|
197
206
|
follow the same overlay contract as Combobox.
|
|
207
|
+
|
|
208
|
+
Search result calculation is independent of popup visibility. Closing updates the
|
|
209
|
+
control and query callbacks immediately while retaining the last open popup
|
|
210
|
+
content through exit. A rapid reopen renders current results; reduced motion
|
|
211
|
+
unmounts without waiting for an animation event.
|
package/dist/index.js
CHANGED
|
@@ -19,11 +19,11 @@ var comboboxContentStyles = cva(cn(
|
|
|
19
19
|
|
|
20
20
|
// src/shared/popup/selection-popup.tsx
|
|
21
21
|
import { isComposingKeyEvent } from "@gridui/interaction";
|
|
22
|
-
import { interactionLayerProps } from "@gridui/overlay";
|
|
22
|
+
import { ExitSnapshot, interactionLayerProps } from "@gridui/overlay";
|
|
23
23
|
import * as Primitive from "@radix-ui/react-popover";
|
|
24
24
|
import { jsx } from "react/jsx-runtime";
|
|
25
25
|
var SelectionPopup = (props) => {
|
|
26
|
-
const { container, anchorRef, initialFocus, finalFocus, onEscape, onDismiss, ...restProps } = props;
|
|
26
|
+
const { open, children, container, anchorRef, initialFocus, finalFocus, onEscape, onDismiss, ...restProps } = props;
|
|
27
27
|
return /* @__PURE__ */ jsx(
|
|
28
28
|
Primitive.Portal,
|
|
29
29
|
{
|
|
@@ -66,7 +66,14 @@ var SelectionPopup = (props) => {
|
|
|
66
66
|
if (event.key === "Escape") {
|
|
67
67
|
event.stopPropagation();
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
},
|
|
70
|
+
children: /* @__PURE__ */ jsx(
|
|
71
|
+
ExitSnapshot,
|
|
72
|
+
{
|
|
73
|
+
open,
|
|
74
|
+
children
|
|
75
|
+
}
|
|
76
|
+
)
|
|
70
77
|
}
|
|
71
78
|
)
|
|
72
79
|
}
|
|
@@ -142,12 +149,95 @@ var useSelectionPopup = ({ disabled, readOnly, controlRef }) => {
|
|
|
142
149
|
};
|
|
143
150
|
};
|
|
144
151
|
|
|
152
|
+
// src/shared/options.ts
|
|
153
|
+
var flattenOptions = (options) => {
|
|
154
|
+
return options.flatMap((entry) => {
|
|
155
|
+
return "options" in entry ? entry.options : [entry];
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
var filterOptions = (options, query) => {
|
|
159
|
+
const term = query.trim().normalize("NFKC").toLowerCase();
|
|
160
|
+
if (!term) {
|
|
161
|
+
return options;
|
|
162
|
+
}
|
|
163
|
+
const matches = (option) => {
|
|
164
|
+
return `${option.label} ${option.description ?? ""}`.normalize("NFKC").toLowerCase().includes(term);
|
|
165
|
+
};
|
|
166
|
+
return options.flatMap((entry) => {
|
|
167
|
+
if ("options" in entry) {
|
|
168
|
+
const items = entry.options.filter(matches);
|
|
169
|
+
return items.length ? [
|
|
170
|
+
{
|
|
171
|
+
...entry,
|
|
172
|
+
options: items
|
|
173
|
+
}
|
|
174
|
+
] : [];
|
|
175
|
+
}
|
|
176
|
+
return matches(entry) ? [entry] : [];
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// src/shared/search/calculate-search-options.ts
|
|
181
|
+
var calculateSearchOptions = (input) => {
|
|
182
|
+
const { options, selected, listId, query, highlighted, filterOptions: shouldFilter = true, loading, errorLabel } = input;
|
|
183
|
+
const all = flattenOptions(options);
|
|
184
|
+
let filtered = options;
|
|
185
|
+
if (loading || errorLabel) {
|
|
186
|
+
filtered = [];
|
|
187
|
+
} else if (shouldFilter) {
|
|
188
|
+
filtered = filterOptions(options, query ?? "");
|
|
189
|
+
}
|
|
190
|
+
const visible = flattenOptions(filtered);
|
|
191
|
+
const highlightedOption = visible.find((option) => {
|
|
192
|
+
return option.value === highlighted;
|
|
193
|
+
});
|
|
194
|
+
const selectedOption = query === null ? visible.find((option) => {
|
|
195
|
+
return selected.includes(option.value);
|
|
196
|
+
}) : void 0;
|
|
197
|
+
const activeOption = highlightedOption ?? selectedOption ?? visible[0];
|
|
198
|
+
const optionLookup = /* @__PURE__ */ new Map();
|
|
199
|
+
all.forEach((option, index) => {
|
|
200
|
+
optionLookup.set(option.value, {
|
|
201
|
+
option: optionLookup.get(option.value)?.option ?? option,
|
|
202
|
+
index
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
const optionId = (value) => {
|
|
206
|
+
return `${listId}-${optionLookup.get(value)?.index ?? -1}`;
|
|
207
|
+
};
|
|
208
|
+
const getOption = (value) => {
|
|
209
|
+
return optionLookup.get(value)?.option;
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
all,
|
|
213
|
+
filtered,
|
|
214
|
+
visible,
|
|
215
|
+
active: activeOption?.value ?? null,
|
|
216
|
+
activeOption,
|
|
217
|
+
activeOptionId: activeOption ? optionId(activeOption.value) : void 0,
|
|
218
|
+
optionId,
|
|
219
|
+
getOption
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
var getSearchStatus = (count, props) => {
|
|
223
|
+
if (props.loading) {
|
|
224
|
+
return props.loadingLabel;
|
|
225
|
+
}
|
|
226
|
+
if (props.errorLabel !== void 0) {
|
|
227
|
+
return props.errorLabel;
|
|
228
|
+
}
|
|
229
|
+
if (count === 0) {
|
|
230
|
+
return props.emptyLabel;
|
|
231
|
+
}
|
|
232
|
+
return props.resultCountLabel?.(count);
|
|
233
|
+
};
|
|
234
|
+
|
|
145
235
|
// src/shared/search/combobox-options.tsx
|
|
146
236
|
import { overlayListIndicatorStyles, overlayListItemStyles as overlayListItemStyles2, overlayListLabelStyles, useInteractionOutline, useScrollbars } from "@gridui/overlay";
|
|
147
237
|
import { Check } from "lucide-react";
|
|
148
238
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
149
239
|
var ComboboxOptions = (props) => {
|
|
150
|
-
const { id, label, options, selected, multiple, active, optionId, onSelect, onHighlight } = props;
|
|
240
|
+
const { id, label, options, selected, multiple, active, optionId, onSelect, onHighlight, selectionAppearance } = props;
|
|
151
241
|
const scrollbarRef = useScrollbars();
|
|
152
242
|
const ref = useInteractionOutline({
|
|
153
243
|
ref: scrollbarRef,
|
|
@@ -167,7 +257,7 @@ var ComboboxOptions = (props) => {
|
|
|
167
257
|
"aria-describedby": option.description ? `${itemId}-description` : void 0,
|
|
168
258
|
"data-disabled": option.disabled ? "" : void 0,
|
|
169
259
|
"data-highlighted": active === option.value ? "" : void 0,
|
|
170
|
-
className: overlayListItemStyles2(),
|
|
260
|
+
className: overlayListItemStyles2({ selectionAppearance }),
|
|
171
261
|
onPointerMove: () => {
|
|
172
262
|
onHighlight(option.value);
|
|
173
263
|
},
|
|
@@ -263,34 +353,6 @@ var ComboboxOptions = (props) => {
|
|
|
263
353
|
);
|
|
264
354
|
};
|
|
265
355
|
|
|
266
|
-
// src/shared/options.ts
|
|
267
|
-
var flattenOptions = (options) => {
|
|
268
|
-
return options.flatMap((entry) => {
|
|
269
|
-
return "options" in entry ? entry.options : [entry];
|
|
270
|
-
});
|
|
271
|
-
};
|
|
272
|
-
var filterOptions = (options, query) => {
|
|
273
|
-
const term = query.trim().normalize("NFKC").toLowerCase();
|
|
274
|
-
if (!term) {
|
|
275
|
-
return options;
|
|
276
|
-
}
|
|
277
|
-
const matches = (option) => {
|
|
278
|
-
return `${option.label} ${option.description ?? ""}`.normalize("NFKC").toLowerCase().includes(term);
|
|
279
|
-
};
|
|
280
|
-
return options.flatMap((entry) => {
|
|
281
|
-
if ("options" in entry) {
|
|
282
|
-
const items = entry.options.filter(matches);
|
|
283
|
-
return items.length ? [
|
|
284
|
-
{
|
|
285
|
-
...entry,
|
|
286
|
-
options: items
|
|
287
|
-
}
|
|
288
|
-
] : [];
|
|
289
|
-
}
|
|
290
|
-
return matches(entry) ? [entry] : [];
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
|
|
294
356
|
// src/shared/search/scroll-option.ts
|
|
295
357
|
var scrollOption = (id) => {
|
|
296
358
|
const option = document.getElementById(id);
|
|
@@ -320,29 +382,21 @@ var useSearchOptions = (options, selected, listId, open, searchProps = {}) => {
|
|
|
320
382
|
] = useState2(INITIAL_SEARCH);
|
|
321
383
|
const { query: controlledQuery, onQueryChange, filterOptions: shouldFilter = true, loading, errorLabel } = searchProps;
|
|
322
384
|
const wasOpen = useRef2(open);
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
385
|
+
let query = null;
|
|
386
|
+
if (open) {
|
|
387
|
+
query = controlledQuery ?? search.query;
|
|
388
|
+
}
|
|
389
|
+
const result = calculateSearchOptions({
|
|
390
|
+
options,
|
|
391
|
+
selected,
|
|
392
|
+
listId,
|
|
393
|
+
query,
|
|
394
|
+
highlighted: search.highlighted,
|
|
395
|
+
filterOptions: shouldFilter,
|
|
396
|
+
loading,
|
|
397
|
+
errorLabel
|
|
330
398
|
});
|
|
331
|
-
const
|
|
332
|
-
return selected.includes(option.value);
|
|
333
|
-
}) : void 0;
|
|
334
|
-
const active = highlighted ?? selectedOption ?? visible[0];
|
|
335
|
-
const activeValue = active?.value ?? null;
|
|
336
|
-
const optionIndices = new Map(all.map((option, index) => {
|
|
337
|
-
return [
|
|
338
|
-
option.value,
|
|
339
|
-
index
|
|
340
|
-
];
|
|
341
|
-
}));
|
|
342
|
-
const optionId = (value) => {
|
|
343
|
-
return `${listId}-${optionIndices.get(value) ?? -1}`;
|
|
344
|
-
};
|
|
345
|
-
const activeOptionId = active ? optionId(active.value) : void 0;
|
|
399
|
+
const { visible, active: activeValue, activeOptionId } = result;
|
|
346
400
|
useEffect2(() => {
|
|
347
401
|
if (!open && wasOpen.current) {
|
|
348
402
|
setSearch(INITIAL_SEARCH);
|
|
@@ -370,14 +424,8 @@ var useSearchOptions = (options, selected, listId, open, searchProps = {}) => {
|
|
|
370
424
|
});
|
|
371
425
|
};
|
|
372
426
|
return {
|
|
373
|
-
|
|
374
|
-
filtered,
|
|
375
|
-
visible,
|
|
427
|
+
...result,
|
|
376
428
|
query,
|
|
377
|
-
active: activeValue,
|
|
378
|
-
activeOption: active,
|
|
379
|
-
activeOptionId,
|
|
380
|
-
optionId,
|
|
381
429
|
highlight,
|
|
382
430
|
changeQuery: (text) => {
|
|
383
431
|
onQueryChange?.(text);
|
|
@@ -579,6 +627,7 @@ var Autocomplete = (props) => {
|
|
|
579
627
|
/* @__PURE__ */ jsxs2(
|
|
580
628
|
SelectionPopup,
|
|
581
629
|
{
|
|
630
|
+
open: popup.open,
|
|
582
631
|
ref: popup.popupRef,
|
|
583
632
|
container: portalContainer,
|
|
584
633
|
anchorRef: anchor,
|
|
@@ -597,7 +646,13 @@ var Autocomplete = (props) => {
|
|
|
597
646
|
role: "status",
|
|
598
647
|
"aria-atomic": "true",
|
|
599
648
|
className: cn2(selectEmptyStyles(), "gridui-u-select--empty:hidden"),
|
|
600
|
-
children:
|
|
649
|
+
children: getSearchStatus(search.visible.length, {
|
|
650
|
+
loading,
|
|
651
|
+
loadingLabel,
|
|
652
|
+
errorLabel,
|
|
653
|
+
resultCountLabel,
|
|
654
|
+
emptyLabel
|
|
655
|
+
})
|
|
601
656
|
}
|
|
602
657
|
),
|
|
603
658
|
/* @__PURE__ */ jsx3(
|
|
@@ -851,6 +906,7 @@ var Combobox = (props) => {
|
|
|
851
906
|
loadingLabel,
|
|
852
907
|
errorLabel,
|
|
853
908
|
resultCountLabel,
|
|
909
|
+
selectionAppearance = "filled",
|
|
854
910
|
...restProps
|
|
855
911
|
} = props;
|
|
856
912
|
const controlRef = useRef6(null);
|
|
@@ -1071,6 +1127,7 @@ var Combobox = (props) => {
|
|
|
1071
1127
|
/* @__PURE__ */ jsxs5(
|
|
1072
1128
|
SelectionPopup,
|
|
1073
1129
|
{
|
|
1130
|
+
open,
|
|
1074
1131
|
container: portalContainer,
|
|
1075
1132
|
ref: popupRef,
|
|
1076
1133
|
role: "presentation",
|
|
@@ -1089,12 +1146,19 @@ var Combobox = (props) => {
|
|
|
1089
1146
|
role: "status",
|
|
1090
1147
|
"aria-atomic": "true",
|
|
1091
1148
|
className: cn3(selectEmptyStyles(), "gridui-u-select--empty:hidden"),
|
|
1092
|
-
children:
|
|
1149
|
+
children: getSearchStatus(visible.length, {
|
|
1150
|
+
loading,
|
|
1151
|
+
loadingLabel,
|
|
1152
|
+
errorLabel,
|
|
1153
|
+
resultCountLabel,
|
|
1154
|
+
emptyLabel
|
|
1155
|
+
})
|
|
1093
1156
|
}
|
|
1094
1157
|
),
|
|
1095
1158
|
/* @__PURE__ */ jsx6(
|
|
1096
1159
|
ComboboxOptions,
|
|
1097
1160
|
{
|
|
1161
|
+
selectionAppearance,
|
|
1098
1162
|
id: listId,
|
|
1099
1163
|
label: searchLabel,
|
|
1100
1164
|
options: filtered,
|
|
@@ -1155,6 +1219,7 @@ var MultiSelect = (props) => {
|
|
|
1155
1219
|
loadingLabel,
|
|
1156
1220
|
errorLabel,
|
|
1157
1221
|
resultCountLabel,
|
|
1222
|
+
selectionAppearance = "filled",
|
|
1158
1223
|
...restProps
|
|
1159
1224
|
} = props;
|
|
1160
1225
|
const search = useRef7(null);
|
|
@@ -1181,7 +1246,7 @@ var MultiSelect = (props) => {
|
|
|
1181
1246
|
loading,
|
|
1182
1247
|
errorLabel
|
|
1183
1248
|
});
|
|
1184
|
-
const { all, filtered, visible, query, active, optionId, activeOptionId } = searchOptions;
|
|
1249
|
+
const { all, filtered, visible, query, active, optionId, activeOptionId, getOption } = searchOptions;
|
|
1185
1250
|
const choose = (option) => {
|
|
1186
1251
|
if (option.disabled || loading || errorLabel || !available()) {
|
|
1187
1252
|
return;
|
|
@@ -1242,9 +1307,7 @@ var MultiSelect = (props) => {
|
|
|
1242
1307
|
{
|
|
1243
1308
|
className: "gridui-u-select--min-w-0 gridui-u-select--flex-1 gridui-u-select--wrap-anywhere",
|
|
1244
1309
|
children: selected.length ? selected.map((entry) => {
|
|
1245
|
-
return
|
|
1246
|
-
return option.value === entry;
|
|
1247
|
-
})?.label ?? entry;
|
|
1310
|
+
return getOption(entry)?.label ?? entry;
|
|
1248
1311
|
}).join(", ") : placeholder
|
|
1249
1312
|
}
|
|
1250
1313
|
),
|
|
@@ -1306,9 +1369,7 @@ var MultiSelect = (props) => {
|
|
|
1306
1369
|
);
|
|
1307
1370
|
}),
|
|
1308
1371
|
selected.filter((entry) => {
|
|
1309
|
-
return
|
|
1310
|
-
return option.value === entry;
|
|
1311
|
-
});
|
|
1372
|
+
return getOption(entry) === void 0;
|
|
1312
1373
|
}).map((entry) => {
|
|
1313
1374
|
return /* @__PURE__ */ jsx7(
|
|
1314
1375
|
"option",
|
|
@@ -1328,6 +1389,7 @@ var MultiSelect = (props) => {
|
|
|
1328
1389
|
/* @__PURE__ */ jsxs6(
|
|
1329
1390
|
SelectionPopup,
|
|
1330
1391
|
{
|
|
1392
|
+
open,
|
|
1331
1393
|
container: portalContainer,
|
|
1332
1394
|
ref: popup,
|
|
1333
1395
|
"aria-label": searchLabel,
|
|
@@ -1380,6 +1442,7 @@ var MultiSelect = (props) => {
|
|
|
1380
1442
|
/* @__PURE__ */ jsx7(
|
|
1381
1443
|
ComboboxOptions,
|
|
1382
1444
|
{
|
|
1445
|
+
selectionAppearance,
|
|
1383
1446
|
id: `${id}-list`,
|
|
1384
1447
|
label: searchLabel,
|
|
1385
1448
|
options: filtered,
|
|
@@ -1397,7 +1460,13 @@ var MultiSelect = (props) => {
|
|
|
1397
1460
|
role: "status",
|
|
1398
1461
|
"aria-atomic": "true",
|
|
1399
1462
|
className: cn4(selectEmptyStyles(), "gridui-u-select--empty:hidden"),
|
|
1400
|
-
children:
|
|
1463
|
+
children: getSearchStatus(visible.length, {
|
|
1464
|
+
loading,
|
|
1465
|
+
loadingLabel,
|
|
1466
|
+
errorLabel,
|
|
1467
|
+
resultCountLabel,
|
|
1468
|
+
emptyLabel
|
|
1469
|
+
})
|
|
1401
1470
|
}
|
|
1402
1471
|
)
|
|
1403
1472
|
]
|
|
@@ -1415,7 +1484,7 @@ import { Check as Check2 } from "lucide-react";
|
|
|
1415
1484
|
import { useId as useId4 } from "react";
|
|
1416
1485
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1417
1486
|
var SelectOptions = (props) => {
|
|
1418
|
-
const { options, id, label } = props;
|
|
1487
|
+
const { options, id, label, selectionAppearance } = props;
|
|
1419
1488
|
const scrollbarRef = useScrollbars2();
|
|
1420
1489
|
const ref = useInteractionOutline2({
|
|
1421
1490
|
ref: scrollbarRef,
|
|
@@ -1434,7 +1503,8 @@ var SelectOptions = (props) => {
|
|
|
1434
1503
|
return /* @__PURE__ */ jsx8(
|
|
1435
1504
|
SelectOptionItem,
|
|
1436
1505
|
{
|
|
1437
|
-
option: entry
|
|
1506
|
+
option: entry,
|
|
1507
|
+
selectionAppearance
|
|
1438
1508
|
},
|
|
1439
1509
|
entry.value
|
|
1440
1510
|
);
|
|
@@ -1454,7 +1524,8 @@ var SelectOptions = (props) => {
|
|
|
1454
1524
|
return /* @__PURE__ */ jsx8(
|
|
1455
1525
|
SelectOptionItem,
|
|
1456
1526
|
{
|
|
1457
|
-
option
|
|
1527
|
+
option,
|
|
1528
|
+
selectionAppearance
|
|
1458
1529
|
},
|
|
1459
1530
|
option.value
|
|
1460
1531
|
);
|
|
@@ -1468,7 +1539,7 @@ var SelectOptions = (props) => {
|
|
|
1468
1539
|
);
|
|
1469
1540
|
};
|
|
1470
1541
|
var SelectOptionItem = (props) => {
|
|
1471
|
-
const { option } = props;
|
|
1542
|
+
const { option, selectionAppearance } = props;
|
|
1472
1543
|
const labelId = useId4();
|
|
1473
1544
|
const descriptionId = `${labelId}-description`;
|
|
1474
1545
|
return /* @__PURE__ */ jsxs7(
|
|
@@ -1479,7 +1550,7 @@ var SelectOptionItem = (props) => {
|
|
|
1479
1550
|
"aria-describedby": option.description ? descriptionId : void 0,
|
|
1480
1551
|
textValue: option.label,
|
|
1481
1552
|
disabled: option.disabled,
|
|
1482
|
-
className: overlayListItemStyles3(),
|
|
1553
|
+
className: overlayListItemStyles3({ selectionAppearance }),
|
|
1483
1554
|
children: [
|
|
1484
1555
|
option.icon && /* @__PURE__ */ jsx8(
|
|
1485
1556
|
"span",
|
|
@@ -1572,6 +1643,7 @@ var Select = (props) => {
|
|
|
1572
1643
|
form,
|
|
1573
1644
|
dir,
|
|
1574
1645
|
portalContainer,
|
|
1646
|
+
selectionAppearance = "filled",
|
|
1575
1647
|
className,
|
|
1576
1648
|
ref,
|
|
1577
1649
|
...restProps
|
|
@@ -1796,6 +1868,7 @@ var Select = (props) => {
|
|
|
1796
1868
|
/* @__PURE__ */ jsx9(
|
|
1797
1869
|
SelectOptions,
|
|
1798
1870
|
{
|
|
1871
|
+
selectionAppearance,
|
|
1799
1872
|
options,
|
|
1800
1873
|
id: listId,
|
|
1801
1874
|
label: restProps["aria-label"]
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/shared/style.ts", "../src/shared/popup/selection-popup.tsx", "../src/shared/popup/use-selection-popup.ts", "../src/shared/search/
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Style\n */\n\nimport { overlayListItemStyles, overlayListStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const selectIconStyles = cva(\"gridui-u-select--inline-flex gridui-u-select--shrink-0 gridui-u-select--items-center gridui-u-select--[&_svg]:size-gridui-16\");\n\nexport const selectOptionContentStyles = cva(\"gridui-u-select--min-w-0 gridui-u-select--flex-1 gridui-u-select--whitespace-normal gridui-u-select--wrap-anywhere\");\n\nexport const selectOptionDescriptionStyles = cva(\"gridui-u-select--block gridui-u-select--text-muted gridui-u-select--type-caption gridui-u-select--mt-gridui-4\");\n\nexport const selectListStyles = cva(\"gridui-u-select--min-h-0 gridui-u-select--overflow-y-auto\");\n\nexport const selectEmptyStyles = cva(\"gridui-u-select--p-gridui-8 gridui-u-select--text-muted gridui-u-select--type-caption\");\n\nexport const selectActionsStyles = cva(\"gridui-u-select--shrink-0 gridui-u-select--border-t gridui-u-select--border-border\");\n\nexport const selectActionStyles = cva(cn(\n overlayListItemStyles(),\n \"gridui-u-select--w-full gridui-u-select--text-start\",\n));\n\nexport const comboboxContentStyles = cva(cn(\n overlayListStyles(),\n \"gridui-combobox-content gridui-u-select--box-border gridui-u-select--flex gridui-u-select--flex-col gridui-u-select--overflow-hidden gridui-u-select--min-w-0 gridui-u-select--w-(--anchor-width) gridui-u-select--max-h-(--available-height) gridui-u-select--max-w-(--available-width)\",\n));\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Popup\n * @description Selection Popup\n */\n\nimport { comboboxContentStyles } from \"../style\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport { interactionLayerProps } from \"@gridui/overlay\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithRef, FC, RefObject } from \"react\";\n\nexport type SelectionPopupProps = Pick<ComponentPropsWithRef<typeof Primitive.Content>, \"ref\" | \"children\" | \"dir\" | \"role\" | \"aria-label\"> & {\n readonly container?: ComponentPropsWithRef<typeof Primitive.Portal>[\"container\"];\n readonly anchorRef?: RefObject<HTMLElement | null>;\n readonly initialFocus?: () => void;\n readonly finalFocus: () => HTMLElement | false;\n readonly onEscape: () => void;\n readonly onDismiss?: () => void;\n};\n\nexport const SelectionPopup: FC<SelectionPopupProps> = (props: SelectionPopupProps) => {\n const { container, anchorRef, initialFocus, finalFocus, onEscape, onDismiss, ...restProps } = props;\n return (<Primitive.Portal\n container={container}\n >\n <Primitive.Content\n {...interactionLayerProps}\n {...restProps}\n sideOffset={8}\n align=\"start\"\n collisionPadding={16}\n className={comboboxContentStyles()}\n onOpenAutoFocus={event => {\n event.preventDefault();\n initialFocus?.();\n }}\n onCloseAutoFocus={event => {\n event.preventDefault();\n const target = finalFocus();\n if (target) {\n target.focus();\n }\n }}\n onInteractOutside={event => {\n if (anchorRef?.current?.contains(event.target as Node)) {\n event.preventDefault();\n } else {\n onDismiss?.();\n }\n }}\n onEscapeKeyDown={event => {\n event.preventDefault();\n event.stopPropagation();\n if (!isComposingKeyEvent(event)) {\n onEscape();\n }\n }}\n onKeyDown={event => {\n if (event.key === \"Escape\") {\n event.stopPropagation();\n }\n }}\n />\n </Primitive.Portal>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Popup\n * @description Use Selection Popup\n */\n\nimport type { SelectAction } from \"../types\";\nimport { type RefObject, useEffect, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\n\ntype SelectionPopupOptions = {\n readonly disabled?: boolean | undefined;\n readonly readOnly?: boolean | undefined;\n readonly controlRef: RefObject<HTMLElement | null>;\n};\n\nexport const useSelectionPopup = ({ disabled, readOnly, controlRef }: SelectionPopupOptions) => {\n const [\n localOpen,\n setLocalOpen,\n ] = useState(false);\n const popupRef = useRef<HTMLDivElement>(null);\n const restoreFocus = useRef(true);\n const unavailable = Boolean(disabled || readOnly);\n useEffect(() => {\n if (unavailable) {\n setLocalOpen(false);\n }\n }, [unavailable]);\n const available = (): boolean => {\n return !unavailable && !controlRef.current?.matches(\":disabled\");\n };\n const changeOpen = (next: boolean): void => {\n if (next && !available()) {\n return;\n }\n if (next) {\n restoreFocus.current = true;\n }\n setLocalOpen(next);\n };\n const close = (): void => {\n restoreFocus.current = false;\n setLocalOpen(false);\n };\n const focus = (): void => {\n controlRef.current?.focus();\n };\n const finalFocus = (): HTMLElement | false => {\n const control = controlRef.current;\n if (!restoreFocus.current || !control) {\n return false;\n }\n // Closing animations may finish after focus moves to another control.\n const active = control.ownerDocument.activeElement;\n if (active && active !== control.ownerDocument.body && active !== control\n && !popupRef.current?.contains(active)) {\n return false;\n }\n return control;\n };\n const runAction = (action: SelectAction): boolean => {\n if (action.disabled || !available()) {\n return false;\n }\n if (action.closeOnAction !== false) {\n flushSync(close);\n focus();\n }\n action.onAction?.();\n return true;\n };\n return {\n open: localOpen && !unavailable,\n popupRef,\n available,\n changeOpen,\n close,\n focus,\n finalFocus,\n runAction,\n };\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Search\n * @description Combobox Options\n */\n\nimport { selectIconStyles, selectListStyles, selectOptionContentStyles, selectOptionDescriptionStyles } from \"../style\";\nimport type { SelectionListOptions, SelectOption } from \"../types\";\nimport { overlayListIndicatorStyles, overlayListItemStyles, overlayListLabelStyles, useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { Check } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type ComboboxOptionsProps = SelectionListOptions & {\n readonly label: string;\n readonly selected: string | readonly string[];\n readonly multiple?: boolean;\n readonly active: string | null;\n readonly optionId: (value: string) => string;\n readonly onSelect: (option: SelectOption) => void;\n readonly onHighlight: (value: string) => void;\n};\n\nexport const ComboboxOptions: FC<ComboboxOptionsProps> = (props: ComboboxOptionsProps) => {\n const { id, label, options, selected, multiple, active, optionId, onSelect, onHighlight } = props;\n const scrollbarRef = useScrollbars<HTMLDivElement>();\n const ref = useInteractionOutline<HTMLDivElement>({\n ref: scrollbarRef,\n selector: '[role=\"option\"]',\n });\n const renderOption = (option: SelectOption) => {\n const itemId = optionId(option.value);\n const checked = typeof selected === \"string\" ? selected === option.value : selected.includes(option.value);\n return (<div\n key={option.value}\n id={itemId}\n role=\"option\"\n aria-selected={checked}\n aria-disabled={option.disabled}\n aria-labelledby={`${itemId}-label`}\n aria-describedby={option.description ? `${itemId}-description` : undefined}\n data-disabled={option.disabled ? \"\" : undefined}\n data-highlighted={active === option.value ? \"\" : undefined}\n className={overlayListItemStyles()}\n onPointerMove={() => {\n onHighlight(option.value);\n }}\n onPointerDown={(event) => {\n event.preventDefault();\n }}\n onClick={() => {\n if (!option.disabled) {\n onSelect(option);\n }\n }}\n >\n {option.icon && (<span\n className={selectIconStyles()}\n aria-hidden=\"true\"\n >\n {option.icon}\n </span>)}\n <span\n className={selectOptionContentStyles()}\n >\n <span\n id={`${itemId}-label`}\n >\n {option.label}\n </span>\n {option.description && (<span\n id={`${itemId}-description`}\n className={selectOptionDescriptionStyles()}\n >\n {option.description}\n </span>)}\n </span>\n <span\n className={overlayListIndicatorStyles()}\n aria-hidden=\"true\"\n >\n {checked && (<Check\n size={16}\n />)}\n </span>\n </div>);\n };\n return (<div\n ref={ref}\n id={id}\n role=\"listbox\"\n aria-multiselectable={multiple || undefined}\n aria-label={label}\n className={selectListStyles()}\n >\n {options.map((entry, index) => {\n return \"options\" in entry\n ? (<div\n key={entry.label}\n role=\"group\"\n aria-labelledby={`${id}-group-${index}`}\n >\n <div\n id={`${id}-group-${index}`}\n className={overlayListLabelStyles()}\n >\n {entry.label}\n </div>\n {entry.options.map(renderOption)}\n </div>)\n : renderOption(entry);\n })}\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Options\n */\n\nimport type { SelectGroup, SelectOption } from \"./types\";\n\nexport const flattenOptions = (options: readonly (SelectOption | SelectGroup)[]): SelectOption[] => {\n return options.flatMap((entry) => {\n return \"options\" in entry ? entry.options : [entry];\n });\n};\n\nexport const filterOptions = (\n options: readonly (SelectOption | SelectGroup)[],\n query: string,\n): readonly (SelectOption | SelectGroup)[] => {\n const term = query.trim().normalize(\"NFKC\")\n .toLowerCase();\n if (!term) {\n return options;\n }\n const matches = (option: SelectOption): boolean => {\n return `${option.label} ${option.description ?? \"\"}`.normalize(\"NFKC\")\n .toLowerCase()\n .includes(term);\n };\n return options.flatMap((entry): (SelectOption | SelectGroup)[] => {\n if (\"options\" in entry) {\n const items = entry.options.filter(matches);\n return items.length ? [\n {\n ...entry,\n options: items,\n },\n ] : [];\n }\n return matches(entry) ? [entry] : [];\n });\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Search\n * @description Scroll Option\n */\n\n/** Keep active options visible without moving the page beneath a portal. */\nexport const scrollOption = (id: string): void => {\n const option = document.getElementById(id);\n const list = option?.closest<HTMLElement>('[role=\"listbox\"]');\n if (!option || !list) {\n return;\n }\n const itemBounds = option.getBoundingClientRect();\n const listBounds = list.getBoundingClientRect();\n if (itemBounds.top < listBounds.top) {\n list.scrollTop += itemBounds.top - listBounds.top;\n }\n else if (itemBounds.bottom > listBounds.bottom) {\n list.scrollTop += itemBounds.bottom - listBounds.bottom;\n }\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Search\n * @description Use Search Options\n */\n\nimport { filterOptions, flattenOptions } from \"../options\";\nimport type { SelectGroup, SelectionSearchProps, SelectOption } from \"../types\";\nimport { scrollOption } from \"./scroll-option\";\nimport { useEffect, useRef, useState } from \"react\";\n\ntype SearchState = {\n readonly query: string | null;\n readonly highlighted: string | null;\n};\n\nconst INITIAL_SEARCH: SearchState = {\n query: null,\n highlighted: null,\n};\n\nexport const useSearchOptions = (\n options: readonly (SelectOption | SelectGroup)[],\n selected: readonly string[],\n listId: string,\n open: boolean,\n searchProps: SelectionSearchProps = {},\n) => {\n const [\n search,\n setSearch,\n ] = useState(INITIAL_SEARCH);\n const { query: controlledQuery, onQueryChange, filterOptions: shouldFilter = true, loading, errorLabel } = searchProps;\n const wasOpen = useRef(open);\n const query = open ? controlledQuery ?? search.query : null;\n const all = flattenOptions(options);\n const availableOptions = shouldFilter ? filterOptions(options, query ?? \"\") : options;\n const filtered = loading || errorLabel ? [] : availableOptions;\n const visible = flattenOptions(filtered);\n const highlighted = visible.find(option => {\n return option.value === search.highlighted;\n });\n const selectedOption = query === null ? visible.find(option => {\n return selected.includes(option.value);\n }) : undefined;\n const active = highlighted ?? selectedOption ?? visible[0];\n const activeValue = active?.value ?? null;\n const optionIndices = new Map(all.map((option, index) => {\n return [\n option.value,\n index,\n ] as const;\n }));\n const optionId = (value: string): string => {\n return `${listId}-${optionIndices.get(value) ?? -1}`;\n };\n const activeOptionId = active ? optionId(active.value) : undefined;\n useEffect(() => {\n if (!open && wasOpen.current) {\n setSearch(INITIAL_SEARCH);\n onQueryChange?.(\"\");\n }\n wasOpen.current = open;\n }, [\n open,\n onQueryChange,\n ]);\n useEffect(() => {\n if (open && activeOptionId !== undefined) {\n scrollOption(activeOptionId);\n }\n }, [\n open,\n activeOptionId,\n ]);\n const highlight = (value: string): void => {\n setSearch(current => {\n return {\n ...current,\n highlighted: value,\n };\n });\n };\n return {\n all,\n filtered,\n visible,\n query,\n active: activeValue,\n activeOption: active,\n activeOptionId,\n optionId,\n highlight,\n changeQuery: (text: string): void => {\n onQueryChange?.(text);\n setSearch({\n query: text,\n highlighted: null,\n });\n },\n moveActive: (direction: number): void => {\n const index = visible.findIndex(option => {\n return option.value === activeValue;\n });\n const next = visible[Math.max(0, Math.min(visible.length - 1, index + direction))];\n if (next) {\n highlight(next.value);\n }\n },\n };\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Autocomplete\n * @description Autocomplete\n */\n\nimport { SelectionPopup } from \"../shared/popup/selection-popup\";\nimport { useSelectionPopup } from \"../shared/popup/use-selection-popup\";\nimport { ComboboxOptions } from \"../shared/search/combobox-options\";\nimport { useSearchOptions } from \"../shared/search/use-search-options\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectGroup, SelectionSearchProps, SelectOption } from \"../shared/types\";\nimport { useFormReset } from \"@gridui/form\";\nimport { Input, type InputProps } from \"@gridui/input\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { type FC, useEffect, useId, useImperativeHandle, useRef, useState } from \"react\";\n\nexport type AutocompleteProps = Omit<InputProps, \"value\" | \"defaultValue\" | \"type\"> &\n Omit<SelectionSearchProps, \"query\" | \"onQueryChange\"> & {\n readonly value?: string | undefined;\n readonly defaultValue?: string | undefined;\n readonly options: readonly (SelectOption | SelectGroup)[];\n readonly searchLabel: string;\n readonly emptyLabel: string;\n readonly portalContainer?: HTMLElement | undefined;\n readonly rootClassName?: string;\n readonly onOptionSelect?: (option: SelectOption) => void;\n };\nexport const Autocomplete: FC<AutocompleteProps> = (props: AutocompleteProps) => {\n const { value, defaultValue = \"\", onValueChange, options, searchLabel, emptyLabel,\n filterOptions, loading, loadingLabel, errorLabel, resultCountLabel, portalContainer,\n rootClassName, onOptionSelect, ref, onChange, onKeyDown, onFocus, onClick, ...restProps } = props;\n const [\n local,\n setLocal,\n ] = useState(defaultValue);\n const [\n navigating,\n setNavigating,\n ] = useState(false);\n const text = value ?? local;\n const input = useRef<HTMLInputElement>(null);\n const anchor = useRef<HTMLDivElement>(null);\n const initial = useRef(defaultValue);\n useImperativeHandle(ref, () => {\n return input.current!;\n });\n const popup = useSelectionPopup({\n disabled: restProps.disabled,\n readOnly: restProps.readOnly,\n controlRef: input,\n });\n useEffect(() => {\n if (!popup.open) {\n setNavigating(false);\n }\n }, [popup.open]);\n const generatedId = useId();\n const listId = `${generatedId}-list`;\n const search = useSearchOptions(options, [], listId, popup.open, {\n query: text,\n filterOptions,\n loading,\n errorLabel,\n });\n const close = () => {\n popup.close(); setNavigating(false);\n };\n const change = (next: string) => {\n if (!popup.available()) {\n return;\n }\n if (value === undefined) {\n setLocal(next);\n }\n onValueChange?.(next);\n };\n useFormReset(input, () => {\n if (value === undefined) {\n setLocal(initial.current);\n }\n close();\n }, restProps.form);\n const choose = (option: SelectOption) => {\n if (!popup.available() || option.disabled || loading || errorLabel) {\n return;\n }\n change(option.label);\n close();\n popup.focus();\n onOptionSelect?.(option);\n };\n return (<Primitive.Root\n open={popup.open}\n onOpenChange={popup.changeOpen}\n >\n <Primitive.Anchor\n asChild\n >\n <div\n ref={anchor}\n dir={restProps.dir}\n className={cn(\"gridui-autocomplete gridui-u-select--min-w-0 gridui-u-select--w-full\", rootClassName)}\n >\n <Input\n {...restProps}\n id={restProps.id ?? generatedId}\n ref={input}\n type=\"text\"\n role=\"combobox\"\n aria-label={restProps[\"aria-label\"] ?? (restProps.id || restProps[\"aria-labelledby\"] ? undefined : searchLabel)}\n autoComplete={restProps.autoComplete ?? \"off\"}\n value={text}\n aria-autocomplete=\"list\"\n aria-expanded={popup.open}\n aria-busy={loading || undefined}\n aria-controls={popup.open ? listId : undefined}\n aria-activedescendant={popup.open && navigating ? search.activeOptionId : undefined}\n onChange={(event) => {\n onChange?.(event);\n change(event.currentTarget.value);\n search.changeQuery(event.currentTarget.value);\n setNavigating(false);\n popup.changeOpen(true);\n }}\n onFocus={(event) => {\n onFocus?.(event); if (!event.defaultPrevented) {\n popup.changeOpen(true);\n }\n }}\n onClick={(event) => {\n onClick?.(event); if (!event.defaultPrevented) {\n popup.changeOpen(true);\n }\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !popup.available()) {\n return;\n }\n if (isComposingKeyEvent(event.nativeEvent)) {\n if (event.key === \"Enter\" || event.key === \"Escape\") {\n event.stopPropagation();\n }\n return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n popup.changeOpen(true);\n if (navigating && popup.open) {\n search.moveActive(event.key === \"ArrowDown\" ? 1 : -1);\n }\n setNavigating(true);\n } else if (event.key === \"Enter\" && popup.open && navigating && search.activeOption) {\n event.preventDefault(); choose(search.activeOption);\n } else if (event.key === \"Escape\" && popup.open) {\n event.preventDefault(); event.stopPropagation(); close();\n } else if (event.key === \"Tab\") {\n close();\n }\n }}\n />\n </div>\n </Primitive.Anchor>\n <SelectionPopup\n ref={popup.popupRef}\n container={portalContainer}\n anchorRef={anchor}\n dir={restProps.dir}\n role=\"presentation\"\n finalFocus={popup.finalFocus}\n onDismiss={close}\n onEscape={() => {\n close(); popup.focus();\n }}\n >\n <div\n role=\"status\"\n aria-atomic=\"true\"\n className={cn(selectEmptyStyles(), \"gridui-u-select--empty:hidden\")}\n >\n {loading ? loadingLabel : errorLabel ?? (search.visible.length ? resultCountLabel?.(search.visible.length) : emptyLabel)}\n </div>\n <ComboboxOptions\n id={listId}\n label={searchLabel}\n options={search.filtered}\n selected={[]}\n active={navigating ? search.active : null}\n optionId={search.optionId}\n onSelect={choose}\n onHighlight={(next) => {\n setNavigating(true); search.highlight(next);\n }}\n />\n </SelectionPopup>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Popup\n * @description Selection Actions\n */\n\nimport { selectActionsStyles, selectActionStyles, selectIconStyles } from \"../style\";\nimport type { SelectAction } from \"../types\";\nimport type { FC } from \"react\";\n\nexport type SelectionActionsProps = {\n readonly actions: readonly SelectAction[];\n readonly onAction: (action: SelectAction) => boolean;\n};\n\nexport const SelectionActions: FC<SelectionActionsProps> = (props: SelectionActionsProps) => {\n const { actions, onAction } = props;\n return (<>\n {actions.length > 0 && (<div\n className={selectActionsStyles()}\n >\n {actions.map((action) => {\n const content = (<>\n {action.icon && (<span\n className={selectIconStyles()}\n aria-hidden=\"true\"\n >\n {action.icon}\n </span>)}\n {action.label}\n </>);\n const actionClass = selectActionStyles();\n if (action.href !== undefined) {\n return (<a\n key={action.id}\n href={action.disabled ? undefined : action.href}\n target={action.target}\n rel={action.rel}\n aria-disabled={action.disabled || undefined}\n data-disabled={action.disabled ? \"\" : undefined}\n tabIndex={action.disabled ? -1 : undefined}\n className={actionClass}\n onClick={(event) => {\n if (action.disabled) {\n event.preventDefault();\n return;\n }\n if (!onAction(action)) {\n event.preventDefault();\n }\n }}\n >\n {content}\n </a>);\n }\n return (<button\n key={action.id}\n type=\"button\"\n disabled={action.disabled}\n data-disabled={action.disabled ? \"\" : undefined}\n className={actionClass}\n onClick={() => {\n onAction(action);\n }}\n >\n {content}\n </button>);\n })}\n </div>)}\n </>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Selection Form\n */\n\nimport type { SelectionProps, SelectOption } from \"./types\";\nimport { focusInvalidControl, useFormReset } from \"@gridui/form\";\nimport { type FC, useLayoutEffect, useRef } from \"react\";\nimport { flushSync } from \"react-dom\";\n\nexport type SelectionFormProps = {\n readonly [Key in \"name\" | \"form\" | \"required\" | \"disabled\"]: SelectionProps[Key];\n} & {\n readonly selectedValue: string;\n readonly allOptions: readonly SelectOption[];\n readonly onValueChange: (value: string) => void;\n readonly onReset: () => void;\n readonly onInvalid: () => void;\n};\n\nexport const SelectionForm: FC<SelectionFormProps> = (props: SelectionFormProps) => {\n\n const {\n name, form, required, disabled, selectedValue, allOptions,\n onValueChange, onReset, onInvalid,\n } = props;\n const nativeRef = useRef<HTMLSelectElement | null>(null);\n const resetSelection = useRef(onReset);\n const currentValue = useRef(selectedValue);\n useLayoutEffect(() => {\n resetSelection.current = onReset;\n currentValue.current = selectedValue;\n }, [\n onReset,\n selectedValue,\n ]);\n useFormReset(nativeRef, () => {\n flushSync(() => {\n resetSelection.current();\n });\n if (nativeRef.current) {\n nativeRef.current.value = currentValue.current;\n }\n }, form);\n\n return (<select\n ref={nativeRef}\n aria-hidden=\"true\"\n tabIndex={-1}\n className=\"gridui-u-select--sr-only\"\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n value={selectedValue}\n onChange={(event) => {\n\n onValueChange(event.currentTarget.value);\n }}\n onInvalid={(event) => {\n\n focusInvalidControl(event, onInvalid);\n }}\n >\n {!allOptions.some((option) => {\n\n return option.value === \"\";\n }) && (<option\n value=\"\"\n />)}\n {selectedValue !== \"\" && !allOptions.some(option => {\n return option.value === selectedValue;\n }) && (<option\n value={selectedValue}\n >\n {selectedValue}\n </option>)}\n {allOptions.map((option) => {\n\n return (<option\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n >\n {option.label}\n </option>);\n })}\n </select>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Use Selection Value\n */\n\nimport type { SelectionValueProps } from \"./types\";\nimport { useRef, useState } from \"react\";\n\ntype SelectionValueOptions = {\n readonly [Key in \"value\" | \"defaultValue\" | \"onValueChange\"]: SelectionValueProps[Key];\n};\n\nexport const useSelectionValue = (props: SelectionValueOptions, available: () => boolean) => {\n const { value, defaultValue = \"\", onValueChange } = props;\n const [\n localValue,\n setLocalValue,\n ] = useState(defaultValue);\n const selectedValue = value ?? localValue;\n const initialValue = useRef(selectedValue);\n const update = (next: string): void => {\n if (next === selectedValue) {\n return;\n }\n if (value === undefined) {\n setLocalValue(next);\n }\n onValueChange?.(next);\n };\n return {\n selectedValue,\n change: (next: string | null): void => {\n if (next !== null && available()) {\n update(next);\n }\n },\n reset: (): void => {\n update(initialValue.current);\n },\n };\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Combobox\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const comboboxInputStyles = cva(\"gridui-u-select--pr-11 gridui-u-select--text-ellipsis\");\n\nexport const comboboxTriggerStyles = cva(\"gridui-u-select--absolute gridui-u-select--inset-y-0 gridui-u-select--right-0 gridui-u-select--flex gridui-u-select--w-9 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--rounded-control gridui-u-select--text-foreground gridui-u-select--cursor-pointer gridui-u-select--disabled:cursor-not-allowed gridui-u-select--disabled:opacity-50\");\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Combobox\n * @description Combobox\n */\n\nimport { SelectionActions } from \"../shared/popup/selection-actions\";\nimport { SelectionPopup } from \"../shared/popup/selection-popup\";\nimport { useSelectionPopup } from \"../shared/popup/use-selection-popup\";\nimport { ComboboxOptions } from \"../shared/search/combobox-options\";\nimport { useSearchOptions } from \"../shared/search/use-search-options\";\nimport { SelectionForm } from \"../shared/selection-form\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectionProps, SelectionSearchLabels, SelectionSearchProps, SelectOption } from \"../shared/types\";\nimport { useSelectionValue } from \"../shared/use-selection-value\";\nimport { comboboxInputStyles, comboboxTriggerStyles } from \"./style\";\nimport { controlVariants } from \"@gridui/input\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { type ComponentPropsWithRef, type FC, useId, useRef } from \"react\";\n\nexport type ComboboxProps = Omit<ComponentPropsWithRef<\"input\">,\n \"children\" | \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"size\"> & SelectionProps & SelectionSearchProps & SelectionSearchLabels;\n\nexport const Combobox: FC<ComboboxProps> = (props: ComboboxProps) => {\n const { options, actions = [], value, defaultValue = \"\", onValueChange, controlSize = \"standard\", clearLabel,\n required, disabled, readOnly, name, form, dir, portalContainer, className, ref, searchLabel, emptyLabel,\n placeholder, onKeyDown, onClick, query: controlledQuery, onQueryChange, filterOptions,\n loading, loadingLabel, errorLabel, resultCountLabel, ...restProps } = props;\n const controlRef = useRef<HTMLElement>(null);\n const anchorRef = useRef<HTMLDivElement>(null);\n const { open, popupRef, available, changeOpen, close, focus, runAction, finalFocus } = useSelectionPopup({\n disabled,\n readOnly,\n controlRef,\n });\n const { selectedValue, change, reset } = useSelectionValue({\n value,\n defaultValue,\n onValueChange,\n }, available);\n const inputId = useId();\n const listId = `${inputId}-list`;\n const search = useSearchOptions(options, [selectedValue], listId, open, {\n query: controlledQuery,\n onQueryChange,\n filterOptions,\n loading,\n errorLabel,\n });\n const { all: allOptions, filtered, visible, query, active, optionId, activeOptionId } = search;\n const selected = allOptions.find(option => {\n return option.value === selectedValue;\n });\n const text = query ?? selected?.label ?? selectedValue;\n const show = () => {\n changeOpen(true);\n };\n const choose = (option: SelectOption) => {\n if (option.disabled || loading || errorLabel || !available()) {\n return;\n }\n change(option.value);\n close();\n focus();\n };\n return (<Primitive.Root\n open={open}\n onOpenChange={changeOpen}\n >\n <div\n className=\"gridui-u-select--relative gridui-u-select--flex gridui-u-select--min-w-0 gridui-u-select--w-full gridui-u-select--items-stretch gridui-u-select--gap-gridui-4\"\n dir={dir}\n >\n <Primitive.Anchor\n asChild\n >\n <div\n ref={anchorRef}\n className=\"gridui-u-select--relative gridui-u-select--flex gridui-u-select--min-w-0 gridui-u-select--flex-1 gridui-u-select--items-stretch\"\n >\n <input\n {...restProps}\n id={restProps.id ?? inputId}\n type=\"text\"\n role=\"combobox\"\n ref={(element) => {\n controlRef.current = element;\n if (typeof ref === \"function\") {\n return ref(element);\n }\n if (ref) {\n ref.current = element;\n }\n }}\n aria-label={restProps[\"aria-label\"] ?? (restProps.id ? undefined : searchLabel)}\n aria-required={required}\n aria-autocomplete=\"list\"\n aria-busy={loading || undefined}\n aria-expanded={open}\n aria-controls={open ? listId : undefined}\n aria-activedescendant={open ? activeOptionId : undefined}\n placeholder={placeholder ?? searchLabel}\n autoComplete=\"off\"\n form={form}\n disabled={disabled}\n readOnly={readOnly}\n className={cn(controlVariants({ size: controlSize }), comboboxInputStyles(), className)}\n value={text}\n onClick={(event) => {\n onClick?.(event); if (!event.defaultPrevented && !open) {\n show();\n }\n }}\n onChange={(event) => {\n if (readOnly) {\n return;\n }\n search.changeQuery(event.target.value);\n changeOpen(true);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || readOnly) {\n return;\n }\n if (isComposingKeyEvent(event.nativeEvent)) {\n if (event.key === \"Enter\" || event.key === \"Escape\") {\n event.stopPropagation();\n }\n return;\n }\n if (event.key === \"Escape\" && open) {\n event.preventDefault(); event.stopPropagation(); close();\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n if (!open) {\n show(); return;\n }\n search.moveActive(event.key === \"ArrowDown\" ? 1 : -1);\n }\n if (event.key === \"Enter\" && open) {\n event.preventDefault();\n const option = search.activeOption;\n if (option) {\n choose(option);\n }\n }\n if (event.key === \"Tab\" && open) {\n const action = !event.shiftKey && popupRef.current?.querySelector<HTMLElement>(\"button:not(:disabled), a[href]\");\n if (action) {\n event.preventDefault(); action.focus();\n } else {\n close();\n }\n }\n }}\n />\n <button\n type=\"button\"\n aria-label={searchLabel}\n disabled={disabled || readOnly}\n className={comboboxTriggerStyles()}\n onClick={() => {\n if (open) {\n close();\n } else {\n show();\n } focus();\n }}\n >\n <ChevronDown\n size={16}\n aria-hidden=\"true\"\n />\n </button>\n </div>\n </Primitive.Anchor>\n {clearLabel && (<button\n type=\"button\"\n disabled={disabled || readOnly || required || selectedValue === \"\"}\n aria-label={clearLabel}\n onClick={() => {\n change(\"\"); close(); focus();\n }}\n className={cn(controlVariants({ size: controlSize }), \"gridui-u-select--flex gridui-u-select--w-auto gridui-u-select--shrink-0 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--min-w-11 gridui-u-select--cursor-pointer\")}\n >\n <X\n size={16}\n aria-hidden=\"true\"\n />\n </button>)}\n <SelectionForm\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n selectedValue={selectedValue}\n allOptions={allOptions}\n onValueChange={change}\n onReset={() => {\n reset();\n close();\n }}\n onInvalid={focus}\n />\n </div>\n <SelectionPopup\n container={portalContainer}\n ref={popupRef}\n role=\"presentation\"\n dir={dir}\n finalFocus={finalFocus}\n anchorRef={anchorRef}\n onDismiss={close}\n onEscape={() => {\n close();\n focus();\n }}\n >\n <div\n role=\"status\"\n aria-atomic=\"true\"\n className={cn(selectEmptyStyles(), \"gridui-u-select--empty:hidden\")}\n >\n {loading ? loadingLabel : errorLabel ?? (visible.length ? resultCountLabel?.(visible.length) : emptyLabel)}\n </div>\n <ComboboxOptions\n id={listId}\n label={searchLabel}\n options={filtered}\n selected={selectedValue}\n active={active}\n optionId={optionId}\n onSelect={choose}\n onHighlight={search.highlight}\n />\n <SelectionActions\n actions={actions}\n onAction={runAction}\n />\n </SelectionPopup>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace MultiSelect\n * @description Multi Select\n */\n\nimport { SelectionPopup } from \"../shared/popup/selection-popup\";\nimport { useSelectionPopup } from \"../shared/popup/use-selection-popup\";\nimport { ComboboxOptions } from \"../shared/search/combobox-options\";\nimport { useSearchOptions } from \"../shared/search/use-search-options\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectionControlOptions, SelectionSearchLabels, SelectionSearchProps, SelectOption } from \"../shared/types\";\nimport { ListFieldControl, type ListFieldProps, useListField } from \"@gridui/form\";\nimport { controlVariants } from \"@gridui/input\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { type ComponentPropsWithRef, type FC, useId, useRef } from \"react\";\n\nexport type MultiSelectProps = Omit<ComponentPropsWithRef<\"button\">, \"children\" | \"value\" | \"defaultValue\" | \"onChange\" | \"type\"> & ListFieldProps & SelectionControlOptions & SelectionSearchProps & SelectionSearchLabels & {\n readonly placeholder: string;\n};\n\nexport const MultiSelect: FC<MultiSelectProps> = (props: MultiSelectProps) => {\n const { value, defaultValue, onValueChange, options, placeholder, searchLabel, emptyLabel, clearLabel, required, disabled, readOnly,\n name, form, portalContainer, className, ref, onKeyDown, query: controlledQuery, onQueryChange, filterOptions,\n loading, loadingLabel, errorLabel, resultCountLabel, ...restProps } = props;\n const search = useRef<HTMLInputElement>(null);\n const id = useId();\n const { selected, native, control, change } = useListField({\n value,\n defaultValue,\n onValueChange,\n disabled,\n readOnly,\n form,\n }, () => {\n close();\n });\n const { open, popupRef: popup, available, changeOpen, close, focus, finalFocus } = useSelectionPopup({\n disabled,\n readOnly,\n controlRef: control,\n });\n const searchOptions = useSearchOptions(options, selected, `${id}-list`, open, {\n query: controlledQuery,\n onQueryChange,\n filterOptions,\n loading,\n errorLabel,\n });\n const { all, filtered, visible, query, active, optionId, activeOptionId } = searchOptions;\n const choose = (option: SelectOption) => {\n if (option.disabled || loading || errorLabel || !available()) {\n return;\n }\n change(selected.includes(option.value) ? selected.filter(entry => {\n return entry !== option.value;\n }) : [\n ...selected,\n option.value,\n ]);\n search.current?.focus({ preventScroll: true });\n };\n return (<Primitive.Root\n open={open}\n onOpenChange={changeOpen}\n >\n <div\n className=\"gridui-u-select--flex gridui-u-select--min-w-0 gridui-u-select--items-stretch gridui-u-select--gap-gridui-4\"\n dir={restProps.dir}\n >\n <Primitive.Trigger\n asChild\n >\n <button\n {...restProps}\n type=\"button\"\n form={form}\n disabled={disabled}\n aria-readonly={readOnly}\n aria-required={required}\n ref={(element) => {\n control.current = element; if (typeof ref === \"function\") {\n return ref(element);\n } if (ref) {\n ref.current = element;\n }\n }}\n className={cn(controlVariants(), \"gridui-u-select--flex gridui-u-select--flex-1 gridui-u-select--items-center gridui-u-select--gap-gridui-8 gridui-u-select--text-start\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n event.preventDefault(); changeOpen(true);\n }\n }}\n >\n <span\n className=\"gridui-u-select--min-w-0 gridui-u-select--flex-1 gridui-u-select--wrap-anywhere\"\n >\n {selected.length\n ? selected.map(entry => {\n return all.find(option => {\n return option.value === entry;\n })?.label ?? entry;\n }).join(\", \")\n : placeholder}\n </span>\n <ChevronDown\n size={16}\n aria-hidden=\"true\"\n />\n </button>\n </Primitive.Trigger>\n {clearLabel && (<button\n type=\"button\"\n aria-label={clearLabel}\n disabled={disabled || readOnly || required || !selected.length}\n className={cn(controlVariants(), \"gridui-u-select--flex gridui-u-select--w-auto gridui-u-select--shrink-0 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--min-w-11 gridui-u-select--cursor-pointer\")}\n onClick={() => {\n change([]); control.current?.focus();\n }}\n >\n <X\n size={16}\n aria-hidden=\"true\"\n />\n </button>)}\n <ListFieldControl\n ref={native}\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n value={selected}\n onValueChange={change}\n onInvalidFocus={() => {\n control.current?.focus();\n }}\n >\n {all.map(option => {\n return (<option\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n >\n {option.label}\n </option>);\n })}\n {selected.filter(entry => {\n return !all.some(option => {\n return option.value === entry;\n });\n }).map(entry => {\n return (<option\n key={entry}\n value={entry}\n >\n {entry}\n </option>);\n })}\n </ListFieldControl>\n </div>\n <SelectionPopup\n container={portalContainer}\n ref={popup}\n aria-label={searchLabel}\n dir={restProps.dir}\n finalFocus={finalFocus}\n initialFocus={() => {\n search.current?.focus({ preventScroll: true });\n }}\n onEscape={() => {\n close();\n focus();\n }}\n >\n <input\n ref={search}\n type=\"text\"\n role=\"combobox\"\n aria-label={searchLabel}\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-busy={loading || undefined}\n aria-controls={`${id}-list`}\n aria-activedescendant={activeOptionId}\n value={query ?? \"\"}\n className={cn(controlVariants({ size: \"small\" }), \"gridui-u-select--m-gridui-8 gridui-u-select--w-auto gridui-u-select--shrink-0\")}\n onChange={(event) => {\n searchOptions.changeQuery(event.target.value);\n }}\n onKeyDown={(event) => {\n if (isComposingKeyEvent(event.nativeEvent)) {\n event.stopPropagation(); return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n searchOptions.moveActive(event.key === \"ArrowDown\" ? 1 : -1);\n }\n if (event.key === \"Enter\") {\n event.preventDefault();\n const option = searchOptions.activeOption;\n if (option) {\n choose(option);\n }\n }\n }}\n />\n <ComboboxOptions\n id={`${id}-list`}\n label={searchLabel}\n options={filtered}\n selected={selected}\n multiple\n active={active}\n optionId={optionId}\n onSelect={choose}\n onHighlight={searchOptions.highlight}\n />\n <div\n role=\"status\"\n aria-atomic=\"true\"\n className={cn(selectEmptyStyles(), \"gridui-u-select--empty:hidden\")}\n >\n {loading ? loadingLabel : errorLabel ?? (visible.length ? resultCountLabel?.(visible.length) : emptyLabel)}\n </div>\n </SelectionPopup>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Select\n * @description Select Options\n */\n\nimport { selectIconStyles, selectListStyles, selectOptionContentStyles, selectOptionDescriptionStyles } from \"../shared/style\";\nimport type { SelectionListOptions, SelectOption } from \"../shared/types\";\nimport { overlayListIndicatorStyles, overlayListItemStyles, overlayListLabelStyles, useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport * as Primitive from \"@radix-ui/react-select\";\nimport { Check } from \"lucide-react\";\nimport { type FC, useId } from \"react\";\n\nexport type SelectOptionsProps = SelectionListOptions;\n\nexport const SelectOptions: FC<SelectOptionsProps> = (props: SelectOptionsProps) => {\n\n const { options, id, label } = props;\n const scrollbarRef = useScrollbars<HTMLDivElement>();\n const ref = useInteractionOutline<HTMLDivElement>({\n ref: scrollbarRef,\n selector: '[role=\"option\"]',\n });\n\n return (<Primitive.Viewport\n ref={ref}\n className={selectListStyles()}\n role=\"listbox\"\n id={id}\n aria-label={label}\n >\n {options.map((entry) => {\n\n if (!(\"options\" in entry)) {\n return (<SelectOptionItem\n key={entry.value}\n option={entry}\n />);\n }\n\n return (<Primitive.Group\n key={entry.label}\n >\n <Primitive.Label\n className={overlayListLabelStyles()}\n >\n {entry.label}\n </Primitive.Label>\n {entry.options.map(option => {\n return (<SelectOptionItem\n key={option.value}\n option={option}\n />);\n })}\n </Primitive.Group>);\n })}\n </Primitive.Viewport>);\n};\n\nexport type SelectOptionItemProps = {\n readonly option: SelectOption;\n};\n\nexport const SelectOptionItem: FC<SelectOptionItemProps> = (props: SelectOptionItemProps) => {\n const { option } = props;\n const labelId = useId();\n const descriptionId = `${labelId}-description`;\n return (<Primitive.Item\n value={`gridui:${option.value}`}\n aria-labelledby={labelId}\n aria-describedby={option.description ? descriptionId : undefined}\n textValue={option.label}\n disabled={option.disabled}\n className={overlayListItemStyles()}\n >\n {option.icon && (<span\n className={selectIconStyles()}\n aria-hidden=\"true\"\n >\n {option.icon}\n </span>)}\n <span\n className={selectOptionContentStyles()}\n >\n <Primitive.ItemText\n id={labelId}\n >\n {option.label}\n </Primitive.ItemText>\n {option.description && (<span\n id={descriptionId}\n className={selectOptionDescriptionStyles()}\n >\n {option.description}\n </span>)}\n </span>\n <span\n className={overlayListIndicatorStyles()}\n aria-hidden=\"true\"\n >\n <Primitive.ItemIndicator>\n <Check\n size={16}\n />\n </Primitive.ItemIndicator>\n </span>\n </Primitive.Item>);\n\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Select\n * @description Style\n */\n\nimport { overlayListStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const selectContentStyles = cva(cn(\n overlayListStyles(),\n \"gridui-select-content gridui-u-select--box-border gridui-u-select--relative gridui-u-select--flex gridui-u-select--flex-col gridui-u-select--overflow-hidden gridui-u-select--min-w-0 gridui-u-select--w-(--anchor-width) gridui-u-select--max-w-(--available-width) gridui-u-select--max-h-(--available-height)\",\n));\n\nexport const selectScrollArrowStyles = cva(\"gridui-u-select--absolute gridui-u-select--inset-x-0 gridui-u-select--z-(--gridui-z-content) gridui-u-select--flex gridui-u-select--h-gridui-24 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--bg-background gridui-u-select--text-foreground\", {\n variants: {\n direction: {\n up: \"gridui-u-select--top-0\",\n down: \"gridui-u-select--bottom-0\",\n },\n },\n});\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Select\n * @description Select\n */\n\nimport { flattenOptions } from \"../shared/options\";\nimport { SelectionActions } from \"../shared/popup/selection-actions\";\nimport { useSelectionPopup } from \"../shared/popup/use-selection-popup\";\nimport { SelectionForm } from \"../shared/selection-form\";\nimport { selectIconStyles } from \"../shared/style\";\nimport type { SelectionProps } from \"../shared/types\";\nimport { useSelectionValue } from \"../shared/use-selection-value\";\nimport { SelectOptions } from \"./select-options\";\nimport { selectContentStyles, selectScrollArrowStyles } from \"./style\";\nimport { controlVariants } from \"@gridui/input\";\nimport { interactionLayerProps } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-select\";\nimport { ChevronDown, ChevronUp, X } from \"lucide-react\";\nimport { type ComponentPropsWithRef, type FC, useId, useRef, useState } from \"react\";\n\nexport type SelectProps = Omit<ComponentPropsWithRef<\"button\">,\n \"children\" | \"value\" | \"defaultValue\" | \"onChange\" | \"type\"> & SelectionProps & {\n readonly placeholder?: string;\n readonly position?: \"item-aligned\" | \"popper\";\n };\n\nexport const Select: FC<SelectProps> = (props: SelectProps) => {\n\n const {\n options, actions = [], value, defaultValue = \"\", onValueChange, placeholder,\n controlSize = \"standard\", position = \"popper\", clearLabel, required, disabled,\n name, form, dir, portalContainer,\n className, ref, ...restProps\n } = props;\n const controlRef = useRef<HTMLElement>(null);\n const {\n open,\n popupRef,\n available,\n changeOpen,\n close,\n focus,\n runAction,\n finalFocus,\n } = useSelectionPopup({\n disabled,\n controlRef,\n });\n const { selectedValue, change, reset } = useSelectionValue({\n value,\n defaultValue,\n onValueChange,\n }, available);\n const listId = useId();\n const [\n triggerWidth,\n setTriggerWidth,\n ] = useState<number>();\n const allOptions = flattenOptions(options);\n const selected = allOptions.find(option => {\n\n return option.value === selectedValue;\n });\n const fallback = selectedValue === \"\" ? placeholder ?? \"\" : selectedValue;\n const display = selected?.label ?? fallback;\n\n // SelectionForm owns form reset and submission, including canceled resets.\n return (<Primitive.Root\n form={`${listId}-detached`}\n value={selected ? `gridui:${selectedValue}` : \"\"}\n disabled={disabled}\n open={open}\n onOpenChange={(next) => {\n if (next) {\n setTriggerWidth(controlRef.current?.getBoundingClientRect().width);\n }\n changeOpen(next);\n }}\n onValueChange={(next) => {\n change(next.slice(7));\n }}\n dir={dir === \"rtl\" ? \"rtl\" : \"ltr\"}\n >\n <div\n className=\"gridui-u-select--relative gridui-u-select--flex gridui-u-select--min-w-0 gridui-u-select--w-full gridui-u-select--items-stretch gridui-u-select--gap-gridui-4\"\n dir={dir}\n >\n <Primitive.Trigger\n {...restProps}\n form={form}\n aria-controls={open ? listId : undefined}\n aria-required={required}\n ref={(element) => {\n\n controlRef.current = element;\n if (typeof ref === \"function\") {\n return ref(element);\n }\n if (ref) {\n ref.current = element;\n }\n }}\n className={cn(controlVariants({ size: controlSize }), \"gridui-u-select--flex gridui-u-select--flex-1 gridui-u-select--items-center gridui-u-select--gap-gridui-8 gridui-u-select--text-start\", className)}\n >\n {selected?.icon && (<span\n className={selectIconStyles()}\n aria-hidden=\"true\"\n >\n {selected.icon}\n </span>)}\n <span\n className=\"gridui-u-select--min-w-0 gridui-u-select--flex-1 gridui-u-select--whitespace-normal gridui-u-select--wrap-anywhere\"\n >\n <Primitive.Value\n placeholder={display}\n >\n {display}\n </Primitive.Value>\n </span>\n <Primitive.Icon>\n <ChevronDown\n size={16}\n className=\"gridui-u-select--shrink-0\"\n aria-hidden=\"true\"\n />\n </Primitive.Icon>\n </Primitive.Trigger>\n {clearLabel && (<button\n type=\"button\"\n disabled={disabled || required || selectedValue === \"\"}\n aria-label={clearLabel}\n onClick={() => {\n\n change(\"\");\n controlRef.current?.focus();\n }}\n className={cn(controlVariants({ size: controlSize }), \"gridui-u-select--flex gridui-u-select--w-auto gridui-u-select--shrink-0 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--min-w-11 gridui-u-select--cursor-pointer\")}\n >\n <X\n size={16}\n aria-hidden=\"true\"\n />\n </button>)}\n <SelectionForm\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n selectedValue={selectedValue}\n allOptions={allOptions}\n onValueChange={change}\n onReset={() => {\n reset();\n close();\n }}\n onInvalid={focus}\n />\n </div>\n <Primitive.Portal\n container={portalContainer}\n >\n <Primitive.Content\n {...interactionLayerProps}\n position={position}\n align=\"start\"\n sideOffset={8}\n collisionPadding={16}\n ref={popupRef}\n role=\"presentation\"\n {...(position === \"item-aligned\" ? {\n \"data-side\": \"none\",\n style: { width: triggerWidth },\n } : {})}\n className={selectContentStyles()}\n dir={dir}\n onCloseAutoFocus={(event) => {\n event.preventDefault();\n const target = finalFocus();\n if (target) {\n target.focus();\n }\n }}\n onPointerDownOutside={() => {\n close();\n }}\n onEscapeKeyDown={(event) => {\n event.preventDefault();\n event.stopPropagation(); changeOpen(false);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") {\n event.stopPropagation();\n }\n if (event.key === \"Tab\") {\n event.preventDefault();\n const controls = Array.from(event.currentTarget.querySelectorAll<HTMLElement>(\"button:not(:disabled), a[href]\"));\n const active = controls.indexOf(event.target as HTMLElement);\n const next = controls[active + (event.shiftKey ? -1 : 1)];\n if (next) {\n next.focus();\n }\n else {\n popupRef.current?.querySelector<HTMLElement>('[role=\"option\"][data-state=\"checked\"]')?.focus();\n }\n }\n if ((event.target as HTMLElement).closest(\"button, a\") && event.key !== \"Tab\") {\n event.stopPropagation();\n }\n }}\n >\n <div\n className=\"gridui-u-select--relative gridui-u-select--flex gridui-u-select--min-h-0 gridui-u-select--flex-col\"\n >\n <Primitive.ScrollUpButton\n className={selectScrollArrowStyles({ direction: \"up\" })}\n >\n <ChevronUp\n size={16}\n aria-hidden=\"true\"\n />\n </Primitive.ScrollUpButton>\n <SelectOptions\n options={options}\n id={listId}\n label={restProps[\"aria-label\"]}\n />\n <Primitive.ScrollDownButton\n className={selectScrollArrowStyles({ direction: \"down\" })}\n >\n <ChevronDown\n size={16}\n aria-hidden=\"true\"\n />\n </Primitive.ScrollDownButton>\n </div>\n <SelectionActions\n actions={actions}\n onAction={runAction}\n />\n\n </Primitive.Content>\n </Primitive.Portal>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace UseAsyncOptions\n * @description Request\n */\n\nexport type AsyncOptionsLoader<T> = (query: string, signal: AbortSignal) => Promise<readonly T[]>;\n\nexport type AsyncOptionsState<T> = {\n readonly query: string;\n readonly options: readonly T[];\n readonly loading: boolean;\n readonly error: unknown;\n};\n\nexport const createOptionsRequest = <T>(\n loadOptions: AsyncOptionsLoader<T>,\n onState: (state: AsyncOptionsState<T>) => void,\n) => {\n let controller: AbortController | undefined;\n const cancel = () => {\n controller?.abort();\n controller = undefined;\n };\n const run = async (query: string) => {\n cancel();\n const current = new AbortController();\n controller = current;\n onState({\n query,\n options: [],\n loading: true,\n error: null,\n });\n try {\n const options = await loadOptions(query, current.signal);\n if (controller === current && !current.signal.aborted) {\n onState({\n query,\n options,\n loading: false,\n error: null,\n });\n }\n } catch (error: unknown) {\n if (controller === current && !current.signal.aborted) {\n onState({\n query,\n options: [],\n loading: false,\n error,\n });\n }\n }\n };\n return {\n run,\n cancel,\n };\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace UseAsyncOptions\n * @description Use Async Options\n */\n\nimport { type AsyncOptionsLoader, type AsyncOptionsState, createOptionsRequest } from \"./request\";\nimport { useEffect, useState } from \"react\";\n\nexport type UseAsyncOptionsOptions<T> = {\n readonly query: string;\n readonly loadOptions: AsyncOptionsLoader<T>;\n readonly debounceMs?: number;\n readonly enabled?: boolean;\n};\n\ntype OwnedOptionsState<T> = {\n readonly loader: AsyncOptionsLoader<T>;\n readonly result: AsyncOptionsState<T>;\n};\n\nexport const useAsyncOptions = <T>({ query, loadOptions, debounceMs = 150, enabled = true }: UseAsyncOptionsOptions<T>): AsyncOptionsState<T> => {\n if (!Number.isFinite(debounceMs) || debounceMs < 0) {\n throw new RangeError(\"Option search debounce must be finite and nonnegative.\");\n }\n const [\n state,\n setState,\n ] = useState<OwnedOptionsState<T>>({\n loader: loadOptions,\n result: {\n query,\n options: [],\n loading: enabled,\n error: null,\n },\n });\n useEffect(() => {\n const publish = (result: AsyncOptionsState<T>) => {\n setState({\n loader: loadOptions,\n result,\n });\n };\n const request = createOptionsRequest(loadOptions, publish);\n publish({\n query,\n options: [],\n loading: enabled,\n error: null,\n });\n if (!enabled) {\n return request.cancel;\n }\n const timer = setTimeout(() => {\n void request.run(query);\n }, debounceMs);\n return () => {\n clearTimeout(timer);\n request.cancel();\n };\n }, [\n query,\n loadOptions,\n debounceMs,\n enabled,\n ]);\n return state.loader === loadOptions && state.result.query === query && enabled ? state.result : {\n query,\n options: [],\n loading: enabled,\n error: null,\n };\n};\n"],
|
|
5
|
-
"mappings": ";AAOA,SAAS,uBAAuB,yBAAyB;AACzD,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,mBAAmB,IAAI,8HAA8H;AAE3J,IAAM,4BAA4B,IAAI,oHAAoH;AAE1J,IAAM,gCAAgC,IAAI,+GAA+G;AAEzJ,IAAM,mBAAmB,IAAI,2DAA2D;AAExF,IAAM,oBAAoB,IAAI,uFAAuF;AAErH,IAAM,sBAAsB,IAAI,oFAAoF;AAEpH,IAAM,qBAAqB,IAAI;AAAA,EAClC,sBAAsB;AAAA,EACtB;AACJ,CAAC;AAEM,IAAM,wBAAwB,IAAI;AAAA,EACrC,kBAAkB;AAAA,EAClB;AACJ,CAAC;;;ACvBD,SAAS,2BAA2B;AACpC,SAAS,6BAA6B;AACtC,YAAY,eAAe;AAiBnB;AALD,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM,EAAE,WAAW,WAAW,cAAc,YAAY,UAAU,WAAW,GAAG,UAAU,IAAI;AAC9F,SAAQ;AAAA,IAAW;AAAA,IAAV;AAAA,MACL;AAAA,MAEA;AAAA,QAAW;AAAA,QAAV;AAAA,UACI,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,YAAY;AAAA,UACZ,OAAM;AAAA,UACN,kBAAkB;AAAA,UAClB,WAAW,sBAAsB;AAAA,UACjC,iBAAiB,WAAS;AACtB,kBAAM,eAAe;AACrB,2BAAe;AAAA,UACnB;AAAA,UACA,kBAAkB,WAAS;AACvB,kBAAM,eAAe;AACrB,kBAAM,SAAS,WAAW;AAC1B,gBAAI,QAAQ;AACR,qBAAO,MAAM;AAAA,YACjB;AAAA,UACJ;AAAA,UACA,mBAAmB,WAAS;AACxB,gBAAI,WAAW,SAAS,SAAS,MAAM,MAAc,GAAG;AACpD,oBAAM,eAAe;AAAA,YACzB,OAAO;AACH,0BAAY;AAAA,YAChB;AAAA,U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AAC;AAAA,IACL;AACA,UAAM,UAAU,qBAAqB,aAAa,OAAO;AACzD,YAAQ;AAAA,MACJ;AAAA,MACA,SAAS,CAAC;AAAA,MACV,SAAS;AAAA,MACT,OAAO;AAAA,IACX,CAAC;AACD,QAAI,CAAC,SAAS;AACV,aAAO,QAAQ;AAAA,IACnB;AACA,UAAM,QAAQ,WAAW,MAAM;AAC3B,WAAK,QAAQ,IAAI,KAAK;AAAA,IAC1B,GAAG,UAAU;AACb,WAAO,MAAM;AACT,mBAAa,KAAK;AAClB,cAAQ,OAAO;AAAA,IACnB;AAAA,EACJ,GAAG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AACD,SAAO,MAAM,WAAW,eAAe,MAAM,OAAO,UAAU,SAAS,UAAU,MAAM,SAAS;AAAA,IAC5F;AAAA,IACA,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACX;AACJ;",
|
|
3
|
+
"sources": ["../src/shared/style.ts", "../src/shared/popup/selection-popup.tsx", "../src/shared/popup/use-selection-popup.ts", "../src/shared/options.ts", "../src/shared/search/calculate-search-options.ts", "../src/shared/search/combobox-options.tsx", "../src/shared/search/scroll-option.ts", "../src/shared/search/use-search-options.ts", "../src/autocomplete/autocomplete.tsx", "../src/shared/popup/selection-actions.tsx", "../src/shared/selection-form.tsx", "../src/shared/use-selection-value.ts", "../src/combobox/style.ts", "../src/combobox/combobox.tsx", "../src/multi-select/multi-select.tsx", "../src/select/select-options.tsx", "../src/select/style.ts", "../src/select/select.tsx", "../src/use-async-options/request.ts", "../src/use-async-options/use-async-options.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Style\n */\n\nimport { overlayListItemStyles, overlayListStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const selectIconStyles = cva(\"gridui-u-select--inline-flex gridui-u-select--shrink-0 gridui-u-select--items-center gridui-u-select--[&_svg]:size-gridui-16\");\n\nexport const selectOptionContentStyles = cva(\"gridui-u-select--min-w-0 gridui-u-select--flex-1 gridui-u-select--whitespace-normal gridui-u-select--wrap-anywhere\");\n\nexport const selectOptionDescriptionStyles = cva(\"gridui-u-select--block gridui-u-select--text-muted gridui-u-select--type-caption gridui-u-select--mt-gridui-4\");\n\nexport const selectListStyles = cva(\"gridui-u-select--min-h-0 gridui-u-select--overflow-y-auto\");\n\nexport const selectEmptyStyles = cva(\"gridui-u-select--p-gridui-8 gridui-u-select--text-muted gridui-u-select--type-caption\");\n\nexport const selectActionsStyles = cva(\"gridui-u-select--shrink-0 gridui-u-select--border-t gridui-u-select--border-border\");\n\nexport const selectActionStyles = cva(cn(\n overlayListItemStyles(),\n \"gridui-u-select--w-full gridui-u-select--text-start\",\n));\n\nexport const comboboxContentStyles = cva(cn(\n overlayListStyles(),\n \"gridui-combobox-content gridui-u-select--box-border gridui-u-select--flex gridui-u-select--flex-col gridui-u-select--overflow-hidden gridui-u-select--min-w-0 gridui-u-select--w-(--anchor-width) gridui-u-select--max-h-(--available-height) gridui-u-select--max-w-(--available-width)\",\n));\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Popup\n * @description Selection Popup\n */\n\nimport { comboboxContentStyles } from \"../style\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport { ExitSnapshot, interactionLayerProps } from \"@gridui/overlay\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithRef, FC, RefObject } from \"react\";\n\nexport type SelectionPopupProps = Pick<ComponentPropsWithRef<typeof Primitive.Content>, \"ref\" | \"children\" | \"dir\" | \"role\" | \"aria-label\"> & {\n readonly open: boolean;\n readonly container?: ComponentPropsWithRef<typeof Primitive.Portal>[\"container\"];\n readonly anchorRef?: RefObject<HTMLElement | null>;\n readonly initialFocus?: () => void;\n readonly finalFocus: () => HTMLElement | false;\n readonly onEscape: () => void;\n readonly onDismiss?: () => void;\n};\n\nexport const SelectionPopup: FC<SelectionPopupProps> = (props: SelectionPopupProps) => {\n const { open, children, container, anchorRef, initialFocus, finalFocus, onEscape, onDismiss, ...restProps } = props;\n return (<Primitive.Portal\n container={container}\n >\n <Primitive.Content\n {...interactionLayerProps}\n {...restProps}\n sideOffset={8}\n align=\"start\"\n collisionPadding={16}\n className={comboboxContentStyles()}\n onOpenAutoFocus={event => {\n event.preventDefault();\n initialFocus?.();\n }}\n onCloseAutoFocus={event => {\n event.preventDefault();\n const target = finalFocus();\n if (target) {\n target.focus();\n }\n }}\n onInteractOutside={event => {\n if (anchorRef?.current?.contains(event.target as Node)) {\n event.preventDefault();\n } else {\n onDismiss?.();\n }\n }}\n onEscapeKeyDown={event => {\n event.preventDefault();\n event.stopPropagation();\n if (!isComposingKeyEvent(event)) {\n onEscape();\n }\n }}\n onKeyDown={event => {\n if (event.key === \"Escape\") {\n event.stopPropagation();\n }\n }}\n >\n <ExitSnapshot\n open={open}\n >\n {children}\n </ExitSnapshot>\n </Primitive.Content>\n </Primitive.Portal>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Popup\n * @description Use Selection Popup\n */\n\nimport type { SelectAction } from \"../types\";\nimport { type RefObject, useEffect, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\n\ntype SelectionPopupOptions = {\n readonly disabled?: boolean | undefined;\n readonly readOnly?: boolean | undefined;\n readonly controlRef: RefObject<HTMLElement | null>;\n};\n\nexport const useSelectionPopup = ({ disabled, readOnly, controlRef }: SelectionPopupOptions) => {\n const [\n localOpen,\n setLocalOpen,\n ] = useState(false);\n const popupRef = useRef<HTMLDivElement>(null);\n const restoreFocus = useRef(true);\n const unavailable = Boolean(disabled || readOnly);\n useEffect(() => {\n if (unavailable) {\n setLocalOpen(false);\n }\n }, [unavailable]);\n const available = (): boolean => {\n return !unavailable && !controlRef.current?.matches(\":disabled\");\n };\n const changeOpen = (next: boolean): void => {\n if (next && !available()) {\n return;\n }\n if (next) {\n restoreFocus.current = true;\n }\n setLocalOpen(next);\n };\n const close = (): void => {\n restoreFocus.current = false;\n setLocalOpen(false);\n };\n const focus = (): void => {\n controlRef.current?.focus();\n };\n const finalFocus = (): HTMLElement | false => {\n const control = controlRef.current;\n if (!restoreFocus.current || !control) {\n return false;\n }\n // Closing animations may finish after focus moves to another control.\n const active = control.ownerDocument.activeElement;\n if (active && active !== control.ownerDocument.body && active !== control\n && !popupRef.current?.contains(active)) {\n return false;\n }\n return control;\n };\n const runAction = (action: SelectAction): boolean => {\n if (action.disabled || !available()) {\n return false;\n }\n if (action.closeOnAction !== false) {\n flushSync(close);\n focus();\n }\n action.onAction?.();\n return true;\n };\n return {\n open: localOpen && !unavailable,\n popupRef,\n available,\n changeOpen,\n close,\n focus,\n finalFocus,\n runAction,\n };\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Options\n */\n\nimport type { SelectGroup, SelectOption } from \"./types\";\n\nexport const flattenOptions = (options: readonly (SelectOption | SelectGroup)[]): SelectOption[] => {\n return options.flatMap((entry) => {\n return \"options\" in entry ? entry.options : [entry];\n });\n};\n\nexport const filterOptions = (\n options: readonly (SelectOption | SelectGroup)[],\n query: string,\n): readonly (SelectOption | SelectGroup)[] => {\n const term = query.trim().normalize(\"NFKC\")\n .toLowerCase();\n if (!term) {\n return options;\n }\n const matches = (option: SelectOption): boolean => {\n return `${option.label} ${option.description ?? \"\"}`.normalize(\"NFKC\")\n .toLowerCase()\n .includes(term);\n };\n return options.flatMap((entry): (SelectOption | SelectGroup)[] => {\n if (\"options\" in entry) {\n const items = entry.options.filter(matches);\n return items.length ? [\n {\n ...entry,\n options: items,\n },\n ] : [];\n }\n return matches(entry) ? [entry] : [];\n });\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Search\n * @description Calculate Search Options\n */\n\nimport { filterOptions, flattenOptions } from \"../options\";\nimport type { SelectGroup, SelectionSearchProps, SelectOption } from \"../types\";\n\ntype SearchOptionsInput = Pick<SelectionSearchProps, \"filterOptions\" | \"loading\" | \"errorLabel\"> & {\n readonly options: readonly (SelectOption | SelectGroup)[];\n readonly selected: readonly string[];\n readonly listId: string;\n readonly query: string | null;\n readonly highlighted: string | null;\n};\n\nexport const calculateSearchOptions = (input: SearchOptionsInput) => {\n const { options, selected, listId, query, highlighted, filterOptions: shouldFilter = true, loading, errorLabel } = input;\n const all = flattenOptions(options);\n let filtered = options;\n if (loading || errorLabel) {\n filtered = [];\n } else if (shouldFilter) {\n filtered = filterOptions(options, query ?? \"\");\n }\n const visible = flattenOptions(filtered);\n const highlightedOption = visible.find(option => {\n return option.value === highlighted;\n });\n const selectedOption = query === null ? visible.find(option => {\n return selected.includes(option.value);\n }) : undefined;\n const activeOption = highlightedOption ?? selectedOption ?? visible[0];\n const optionLookup = new Map<string, {\n option: SelectOption;\n index: number;\n }>();\n all.forEach((option, index) => {\n optionLookup.set(option.value, {\n option: optionLookup.get(option.value)?.option ?? option,\n index,\n });\n });\n const optionId = (value: string): string => {\n return `${listId}-${optionLookup.get(value)?.index ?? -1}`;\n };\n const getOption = (value: string): SelectOption | undefined => {\n return optionLookup.get(value)?.option;\n };\n return {\n all,\n filtered,\n visible,\n active: activeOption?.value ?? null,\n activeOption,\n activeOptionId: activeOption ? optionId(activeOption.value) : undefined,\n optionId,\n getOption,\n };\n};\n\nexport const getSearchStatus = (count: number, props: Pick<SelectionSearchProps, \"loading\" | \"loadingLabel\" | \"errorLabel\" | \"resultCountLabel\"> & {\n readonly emptyLabel: string;\n}): string | undefined => {\n if (props.loading) {\n return props.loadingLabel;\n }\n if (props.errorLabel !== undefined) {\n return props.errorLabel;\n }\n if (count === 0) {\n return props.emptyLabel;\n }\n return props.resultCountLabel?.(count);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Search\n * @description Combobox Options\n */\n\nimport { selectIconStyles, selectListStyles, selectOptionContentStyles, selectOptionDescriptionStyles } from \"../style\";\nimport type { SelectionListOptions, SelectOption } from \"../types\";\nimport { overlayListIndicatorStyles, overlayListItemStyles, overlayListLabelStyles, useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { Check } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type ComboboxOptionsProps = SelectionListOptions & {\n readonly label: string;\n readonly selected: string | readonly string[];\n readonly multiple?: boolean;\n readonly active: string | null;\n readonly optionId: (value: string) => string;\n readonly onSelect: (option: SelectOption) => void;\n readonly onHighlight: (value: string) => void;\n};\n\nexport const ComboboxOptions: FC<ComboboxOptionsProps> = (props: ComboboxOptionsProps) => {\n const { id, label, options, selected, multiple, active, optionId, onSelect, onHighlight, selectionAppearance } = props;\n const scrollbarRef = useScrollbars<HTMLDivElement>();\n const ref = useInteractionOutline<HTMLDivElement>({\n ref: scrollbarRef,\n selector: '[role=\"option\"]',\n });\n const renderOption = (option: SelectOption) => {\n const itemId = optionId(option.value);\n const checked = typeof selected === \"string\" ? selected === option.value : selected.includes(option.value);\n return (<div\n key={option.value}\n id={itemId}\n role=\"option\"\n aria-selected={checked}\n aria-disabled={option.disabled}\n aria-labelledby={`${itemId}-label`}\n aria-describedby={option.description ? `${itemId}-description` : undefined}\n data-disabled={option.disabled ? \"\" : undefined}\n data-highlighted={active === option.value ? \"\" : undefined}\n className={overlayListItemStyles({ selectionAppearance })}\n onPointerMove={() => {\n onHighlight(option.value);\n }}\n onPointerDown={(event) => {\n event.preventDefault();\n }}\n onClick={() => {\n if (!option.disabled) {\n onSelect(option);\n }\n }}\n >\n {option.icon && (<span\n className={selectIconStyles()}\n aria-hidden=\"true\"\n >\n {option.icon}\n </span>)}\n <span\n className={selectOptionContentStyles()}\n >\n <span\n id={`${itemId}-label`}\n >\n {option.label}\n </span>\n {option.description && (<span\n id={`${itemId}-description`}\n className={selectOptionDescriptionStyles()}\n >\n {option.description}\n </span>)}\n </span>\n <span\n className={overlayListIndicatorStyles()}\n aria-hidden=\"true\"\n >\n {checked && (<Check\n size={16}\n />)}\n </span>\n </div>);\n };\n return (<div\n ref={ref}\n id={id}\n role=\"listbox\"\n aria-multiselectable={multiple || undefined}\n aria-label={label}\n className={selectListStyles()}\n >\n {options.map((entry, index) => {\n return \"options\" in entry\n ? (<div\n key={entry.label}\n role=\"group\"\n aria-labelledby={`${id}-group-${index}`}\n >\n <div\n id={`${id}-group-${index}`}\n className={overlayListLabelStyles()}\n >\n {entry.label}\n </div>\n {entry.options.map(renderOption)}\n </div>)\n : renderOption(entry);\n })}\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Search\n * @description Scroll Option\n */\n\n/** Keep active options visible without moving the page beneath a portal. */\nexport const scrollOption = (id: string): void => {\n const option = document.getElementById(id);\n const list = option?.closest<HTMLElement>('[role=\"listbox\"]');\n if (!option || !list) {\n return;\n }\n const itemBounds = option.getBoundingClientRect();\n const listBounds = list.getBoundingClientRect();\n if (itemBounds.top < listBounds.top) {\n list.scrollTop += itemBounds.top - listBounds.top;\n }\n else if (itemBounds.bottom > listBounds.bottom) {\n list.scrollTop += itemBounds.bottom - listBounds.bottom;\n }\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Search\n * @description Use Search Options\n */\n\nimport type { SelectGroup, SelectionSearchProps, SelectOption } from \"../types\";\nimport { calculateSearchOptions } from \"./calculate-search-options\";\nimport { scrollOption } from \"./scroll-option\";\nimport { useEffect, useRef, useState } from \"react\";\n\ntype SearchState = {\n readonly query: string | null;\n readonly highlighted: string | null;\n};\n\nconst INITIAL_SEARCH: SearchState = {\n query: null,\n highlighted: null,\n};\n\nexport const useSearchOptions = (\n options: readonly (SelectOption | SelectGroup)[],\n selected: readonly string[],\n listId: string,\n open: boolean,\n searchProps: SelectionSearchProps = {},\n) => {\n const [\n search,\n setSearch,\n ] = useState(INITIAL_SEARCH);\n const { query: controlledQuery, onQueryChange, filterOptions: shouldFilter = true, loading, errorLabel } = searchProps;\n const wasOpen = useRef(open);\n let query: string | null = null;\n if (open) {\n query = controlledQuery ?? search.query;\n }\n const result = calculateSearchOptions({\n options,\n selected,\n listId,\n query,\n highlighted: search.highlighted,\n filterOptions: shouldFilter,\n loading,\n errorLabel,\n });\n const { visible, active: activeValue, activeOptionId } = result;\n useEffect(() => {\n if (!open && wasOpen.current) {\n setSearch(INITIAL_SEARCH);\n onQueryChange?.(\"\");\n }\n wasOpen.current = open;\n }, [\n open,\n onQueryChange,\n ]);\n useEffect(() => {\n if (open && activeOptionId !== undefined) {\n scrollOption(activeOptionId);\n }\n }, [\n open,\n activeOptionId,\n ]);\n const highlight = (value: string): void => {\n setSearch(current => {\n return {\n ...current,\n highlighted: value,\n };\n });\n };\n return {\n ...result,\n query,\n highlight,\n changeQuery: (text: string): void => {\n onQueryChange?.(text);\n setSearch({\n query: text,\n highlighted: null,\n });\n },\n moveActive: (direction: number): void => {\n const index = visible.findIndex(option => {\n return option.value === activeValue;\n });\n const next = visible[Math.max(0, Math.min(visible.length - 1, index + direction))];\n if (next) {\n highlight(next.value);\n }\n },\n };\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Autocomplete\n * @description Autocomplete\n */\n\nimport { SelectionPopup } from \"../shared/popup/selection-popup\";\nimport { useSelectionPopup } from \"../shared/popup/use-selection-popup\";\nimport { getSearchStatus } from \"../shared/search/calculate-search-options\";\nimport { ComboboxOptions } from \"../shared/search/combobox-options\";\nimport { useSearchOptions } from \"../shared/search/use-search-options\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectGroup, SelectionSearchProps, SelectOption } from \"../shared/types\";\nimport { useFormReset } from \"@gridui/form\";\nimport { Input, type InputProps } from \"@gridui/input\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { type FC, useEffect, useId, useImperativeHandle, useRef, useState } from \"react\";\n\nexport type AutocompleteProps = Omit<InputProps, \"value\" | \"defaultValue\" | \"type\"> &\n Omit<SelectionSearchProps, \"query\" | \"onQueryChange\"> & {\n readonly value?: string | undefined;\n readonly defaultValue?: string | undefined;\n readonly options: readonly (SelectOption | SelectGroup)[];\n readonly searchLabel: string;\n readonly emptyLabel: string;\n readonly portalContainer?: HTMLElement | undefined;\n readonly rootClassName?: string;\n readonly onOptionSelect?: (option: SelectOption) => void;\n };\nexport const Autocomplete: FC<AutocompleteProps> = (props: AutocompleteProps) => {\n const { value, defaultValue = \"\", onValueChange, options, searchLabel, emptyLabel,\n filterOptions, loading, loadingLabel, errorLabel, resultCountLabel, portalContainer,\n rootClassName, onOptionSelect, ref, onChange, onKeyDown, onFocus, onClick, ...restProps } = props;\n const [\n local,\n setLocal,\n ] = useState(defaultValue);\n const [\n navigating,\n setNavigating,\n ] = useState(false);\n const text = value ?? local;\n const input = useRef<HTMLInputElement>(null);\n const anchor = useRef<HTMLDivElement>(null);\n const initial = useRef(defaultValue);\n useImperativeHandle(ref, () => {\n return input.current!;\n });\n const popup = useSelectionPopup({\n disabled: restProps.disabled,\n readOnly: restProps.readOnly,\n controlRef: input,\n });\n useEffect(() => {\n if (!popup.open) {\n setNavigating(false);\n }\n }, [popup.open]);\n const generatedId = useId();\n const listId = `${generatedId}-list`;\n const search = useSearchOptions(options, [], listId, popup.open, {\n query: text,\n filterOptions,\n loading,\n errorLabel,\n });\n const close = () => {\n popup.close(); setNavigating(false);\n };\n const change = (next: string) => {\n if (!popup.available()) {\n return;\n }\n if (value === undefined) {\n setLocal(next);\n }\n onValueChange?.(next);\n };\n useFormReset(input, () => {\n if (value === undefined) {\n setLocal(initial.current);\n }\n close();\n }, restProps.form);\n const choose = (option: SelectOption) => {\n if (!popup.available() || option.disabled || loading || errorLabel) {\n return;\n }\n change(option.label);\n close();\n popup.focus();\n onOptionSelect?.(option);\n };\n return (<Primitive.Root\n open={popup.open}\n onOpenChange={popup.changeOpen}\n >\n <Primitive.Anchor\n asChild\n >\n <div\n ref={anchor}\n dir={restProps.dir}\n className={cn(\"gridui-autocomplete gridui-u-select--min-w-0 gridui-u-select--w-full\", rootClassName)}\n >\n <Input\n {...restProps}\n id={restProps.id ?? generatedId}\n ref={input}\n type=\"text\"\n role=\"combobox\"\n aria-label={restProps[\"aria-label\"] ?? (restProps.id || restProps[\"aria-labelledby\"] ? undefined : searchLabel)}\n autoComplete={restProps.autoComplete ?? \"off\"}\n value={text}\n aria-autocomplete=\"list\"\n aria-expanded={popup.open}\n aria-busy={loading || undefined}\n aria-controls={popup.open ? listId : undefined}\n aria-activedescendant={popup.open && navigating ? search.activeOptionId : undefined}\n onChange={(event) => {\n onChange?.(event);\n change(event.currentTarget.value);\n search.changeQuery(event.currentTarget.value);\n setNavigating(false);\n popup.changeOpen(true);\n }}\n onFocus={(event) => {\n onFocus?.(event); if (!event.defaultPrevented) {\n popup.changeOpen(true);\n }\n }}\n onClick={(event) => {\n onClick?.(event); if (!event.defaultPrevented) {\n popup.changeOpen(true);\n }\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !popup.available()) {\n return;\n }\n if (isComposingKeyEvent(event.nativeEvent)) {\n if (event.key === \"Enter\" || event.key === \"Escape\") {\n event.stopPropagation();\n }\n return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n popup.changeOpen(true);\n if (navigating && popup.open) {\n search.moveActive(event.key === \"ArrowDown\" ? 1 : -1);\n }\n setNavigating(true);\n } else if (event.key === \"Enter\" && popup.open && navigating && search.activeOption) {\n event.preventDefault(); choose(search.activeOption);\n } else if (event.key === \"Escape\" && popup.open) {\n event.preventDefault(); event.stopPropagation(); close();\n } else if (event.key === \"Tab\") {\n close();\n }\n }}\n />\n </div>\n </Primitive.Anchor>\n <SelectionPopup\n open={popup.open}\n ref={popup.popupRef}\n container={portalContainer}\n anchorRef={anchor}\n dir={restProps.dir}\n role=\"presentation\"\n finalFocus={popup.finalFocus}\n onDismiss={close}\n onEscape={() => {\n close(); popup.focus();\n }}\n >\n <div\n role=\"status\"\n aria-atomic=\"true\"\n className={cn(selectEmptyStyles(), \"gridui-u-select--empty:hidden\")}\n >\n {getSearchStatus(search.visible.length, {\n loading,\n loadingLabel,\n errorLabel,\n resultCountLabel,\n emptyLabel,\n })}\n </div>\n <ComboboxOptions\n id={listId}\n label={searchLabel}\n options={search.filtered}\n selected={[]}\n active={navigating ? search.active : null}\n optionId={search.optionId}\n onSelect={choose}\n onHighlight={(next) => {\n setNavigating(true); search.highlight(next);\n }}\n />\n </SelectionPopup>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared_Popup\n * @description Selection Actions\n */\n\nimport { selectActionsStyles, selectActionStyles, selectIconStyles } from \"../style\";\nimport type { SelectAction } from \"../types\";\nimport type { FC } from \"react\";\n\nexport type SelectionActionsProps = {\n readonly actions: readonly SelectAction[];\n readonly onAction: (action: SelectAction) => boolean;\n};\n\nexport const SelectionActions: FC<SelectionActionsProps> = (props: SelectionActionsProps) => {\n const { actions, onAction } = props;\n return (<>\n {actions.length > 0 && (<div\n className={selectActionsStyles()}\n >\n {actions.map((action) => {\n const content = (<>\n {action.icon && (<span\n className={selectIconStyles()}\n aria-hidden=\"true\"\n >\n {action.icon}\n </span>)}\n {action.label}\n </>);\n const actionClass = selectActionStyles();\n if (action.href !== undefined) {\n return (<a\n key={action.id}\n href={action.disabled ? undefined : action.href}\n target={action.target}\n rel={action.rel}\n aria-disabled={action.disabled || undefined}\n data-disabled={action.disabled ? \"\" : undefined}\n tabIndex={action.disabled ? -1 : undefined}\n className={actionClass}\n onClick={(event) => {\n if (action.disabled) {\n event.preventDefault();\n return;\n }\n if (!onAction(action)) {\n event.preventDefault();\n }\n }}\n >\n {content}\n </a>);\n }\n return (<button\n key={action.id}\n type=\"button\"\n disabled={action.disabled}\n data-disabled={action.disabled ? \"\" : undefined}\n className={actionClass}\n onClick={() => {\n onAction(action);\n }}\n >\n {content}\n </button>);\n })}\n </div>)}\n </>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Selection Form\n */\n\nimport type { SelectionProps, SelectOption } from \"./types\";\nimport { focusInvalidControl, useFormReset } from \"@gridui/form\";\nimport { type FC, useLayoutEffect, useRef } from \"react\";\nimport { flushSync } from \"react-dom\";\n\nexport type SelectionFormProps = {\n readonly [Key in \"name\" | \"form\" | \"required\" | \"disabled\"]: SelectionProps[Key];\n} & {\n readonly selectedValue: string;\n readonly allOptions: readonly SelectOption[];\n readonly onValueChange: (value: string) => void;\n readonly onReset: () => void;\n readonly onInvalid: () => void;\n};\n\nexport const SelectionForm: FC<SelectionFormProps> = (props: SelectionFormProps) => {\n\n const {\n name, form, required, disabled, selectedValue, allOptions,\n onValueChange, onReset, onInvalid,\n } = props;\n const nativeRef = useRef<HTMLSelectElement | null>(null);\n const resetSelection = useRef(onReset);\n const currentValue = useRef(selectedValue);\n useLayoutEffect(() => {\n resetSelection.current = onReset;\n currentValue.current = selectedValue;\n }, [\n onReset,\n selectedValue,\n ]);\n useFormReset(nativeRef, () => {\n flushSync(() => {\n resetSelection.current();\n });\n if (nativeRef.current) {\n nativeRef.current.value = currentValue.current;\n }\n }, form);\n\n return (<select\n ref={nativeRef}\n aria-hidden=\"true\"\n tabIndex={-1}\n className=\"gridui-u-select--sr-only\"\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n value={selectedValue}\n onChange={(event) => {\n\n onValueChange(event.currentTarget.value);\n }}\n onInvalid={(event) => {\n\n focusInvalidControl(event, onInvalid);\n }}\n >\n {!allOptions.some((option) => {\n\n return option.value === \"\";\n }) && (<option\n value=\"\"\n />)}\n {selectedValue !== \"\" && !allOptions.some(option => {\n return option.value === selectedValue;\n }) && (<option\n value={selectedValue}\n >\n {selectedValue}\n </option>)}\n {allOptions.map((option) => {\n\n return (<option\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n >\n {option.label}\n </option>);\n })}\n </select>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Use Selection Value\n */\n\nimport type { SelectionValueProps } from \"./types\";\nimport { useRef, useState } from \"react\";\n\ntype SelectionValueOptions = {\n readonly [Key in \"value\" | \"defaultValue\" | \"onValueChange\"]: SelectionValueProps[Key];\n};\n\nexport const useSelectionValue = (props: SelectionValueOptions, available: () => boolean) => {\n const { value, defaultValue = \"\", onValueChange } = props;\n const [\n localValue,\n setLocalValue,\n ] = useState(defaultValue);\n const selectedValue = value ?? localValue;\n const initialValue = useRef(selectedValue);\n const update = (next: string): void => {\n if (next === selectedValue) {\n return;\n }\n if (value === undefined) {\n setLocalValue(next);\n }\n onValueChange?.(next);\n };\n return {\n selectedValue,\n change: (next: string | null): void => {\n if (next !== null && available()) {\n update(next);\n }\n },\n reset: (): void => {\n update(initialValue.current);\n },\n };\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Combobox\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const comboboxInputStyles = cva(\"gridui-u-select--pr-11 gridui-u-select--text-ellipsis\");\n\nexport const comboboxTriggerStyles = cva(\"gridui-u-select--absolute gridui-u-select--inset-y-0 gridui-u-select--right-0 gridui-u-select--flex gridui-u-select--w-9 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--rounded-control gridui-u-select--text-foreground gridui-u-select--cursor-pointer gridui-u-select--disabled:cursor-not-allowed gridui-u-select--disabled:opacity-50\");\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Combobox\n * @description Combobox\n */\n\nimport { SelectionActions } from \"../shared/popup/selection-actions\";\nimport { SelectionPopup } from \"../shared/popup/selection-popup\";\nimport { useSelectionPopup } from \"../shared/popup/use-selection-popup\";\nimport { getSearchStatus } from \"../shared/search/calculate-search-options\";\nimport { ComboboxOptions } from \"../shared/search/combobox-options\";\nimport { useSearchOptions } from \"../shared/search/use-search-options\";\nimport { SelectionForm } from \"../shared/selection-form\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectionProps, SelectionSearchLabels, SelectionSearchProps, SelectOption } from \"../shared/types\";\nimport { useSelectionValue } from \"../shared/use-selection-value\";\nimport { comboboxInputStyles, comboboxTriggerStyles } from \"./style\";\nimport { controlVariants } from \"@gridui/input\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { type ComponentPropsWithRef, type FC, useId, useRef } from \"react\";\n\nexport type ComboboxProps = Omit<ComponentPropsWithRef<\"input\">,\n \"children\" | \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"size\"> & SelectionProps & SelectionSearchProps & SelectionSearchLabels;\n\nexport const Combobox: FC<ComboboxProps> = (props: ComboboxProps) => {\n const { options, actions = [], value, defaultValue = \"\", onValueChange, controlSize = \"standard\", clearLabel,\n required, disabled, readOnly, name, form, dir, portalContainer, className, ref, searchLabel, emptyLabel,\n placeholder, onKeyDown, onClick, query: controlledQuery, onQueryChange, filterOptions,\n loading, loadingLabel, errorLabel, resultCountLabel, selectionAppearance = \"filled\", ...restProps } = props;\n const controlRef = useRef<HTMLElement>(null);\n const anchorRef = useRef<HTMLDivElement>(null);\n const { open, popupRef, available, changeOpen, close, focus, runAction, finalFocus } = useSelectionPopup({\n disabled,\n readOnly,\n controlRef,\n });\n const { selectedValue, change, reset } = useSelectionValue({\n value,\n defaultValue,\n onValueChange,\n }, available);\n const inputId = useId();\n const listId = `${inputId}-list`;\n const search = useSearchOptions(options, [selectedValue], listId, open, {\n query: controlledQuery,\n onQueryChange,\n filterOptions,\n loading,\n errorLabel,\n });\n const { all: allOptions, filtered, visible, query, active, optionId, activeOptionId } = search;\n const selected = allOptions.find(option => {\n return option.value === selectedValue;\n });\n const text = query ?? selected?.label ?? selectedValue;\n const show = () => {\n changeOpen(true);\n };\n const choose = (option: SelectOption) => {\n if (option.disabled || loading || errorLabel || !available()) {\n return;\n }\n change(option.value);\n close();\n focus();\n };\n return (<Primitive.Root\n open={open}\n onOpenChange={changeOpen}\n >\n <div\n className=\"gridui-u-select--relative gridui-u-select--flex gridui-u-select--min-w-0 gridui-u-select--w-full gridui-u-select--items-stretch gridui-u-select--gap-gridui-4\"\n dir={dir}\n >\n <Primitive.Anchor\n asChild\n >\n <div\n ref={anchorRef}\n className=\"gridui-u-select--relative gridui-u-select--flex gridui-u-select--min-w-0 gridui-u-select--flex-1 gridui-u-select--items-stretch\"\n >\n <input\n {...restProps}\n id={restProps.id ?? inputId}\n type=\"text\"\n role=\"combobox\"\n ref={(element) => {\n controlRef.current = element;\n if (typeof ref === \"function\") {\n return ref(element);\n }\n if (ref) {\n ref.current = element;\n }\n }}\n aria-label={restProps[\"aria-label\"] ?? (restProps.id ? undefined : searchLabel)}\n aria-required={required}\n aria-autocomplete=\"list\"\n aria-busy={loading || undefined}\n aria-expanded={open}\n aria-controls={open ? listId : undefined}\n aria-activedescendant={open ? activeOptionId : undefined}\n placeholder={placeholder ?? searchLabel}\n autoComplete=\"off\"\n form={form}\n disabled={disabled}\n readOnly={readOnly}\n className={cn(controlVariants({ size: controlSize }), comboboxInputStyles(), className)}\n value={text}\n onClick={(event) => {\n onClick?.(event); if (!event.defaultPrevented && !open) {\n show();\n }\n }}\n onChange={(event) => {\n if (readOnly) {\n return;\n }\n search.changeQuery(event.target.value);\n changeOpen(true);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || readOnly) {\n return;\n }\n if (isComposingKeyEvent(event.nativeEvent)) {\n if (event.key === \"Enter\" || event.key === \"Escape\") {\n event.stopPropagation();\n }\n return;\n }\n if (event.key === \"Escape\" && open) {\n event.preventDefault(); event.stopPropagation(); close();\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n if (!open) {\n show(); return;\n }\n search.moveActive(event.key === \"ArrowDown\" ? 1 : -1);\n }\n if (event.key === \"Enter\" && open) {\n event.preventDefault();\n const option = search.activeOption;\n if (option) {\n choose(option);\n }\n }\n if (event.key === \"Tab\" && open) {\n const action = !event.shiftKey && popupRef.current?.querySelector<HTMLElement>(\"button:not(:disabled), a[href]\");\n if (action) {\n event.preventDefault(); action.focus();\n } else {\n close();\n }\n }\n }}\n />\n <button\n type=\"button\"\n aria-label={searchLabel}\n disabled={disabled || readOnly}\n className={comboboxTriggerStyles()}\n onClick={() => {\n if (open) {\n close();\n } else {\n show();\n } focus();\n }}\n >\n <ChevronDown\n size={16}\n aria-hidden=\"true\"\n />\n </button>\n </div>\n </Primitive.Anchor>\n {clearLabel && (<button\n type=\"button\"\n disabled={disabled || readOnly || required || selectedValue === \"\"}\n aria-label={clearLabel}\n onClick={() => {\n change(\"\"); close(); focus();\n }}\n className={cn(controlVariants({ size: controlSize }), \"gridui-u-select--flex gridui-u-select--w-auto gridui-u-select--shrink-0 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--min-w-11 gridui-u-select--cursor-pointer\")}\n >\n <X\n size={16}\n aria-hidden=\"true\"\n />\n </button>)}\n <SelectionForm\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n selectedValue={selectedValue}\n allOptions={allOptions}\n onValueChange={change}\n onReset={() => {\n reset();\n close();\n }}\n onInvalid={focus}\n />\n </div>\n <SelectionPopup\n open={open}\n container={portalContainer}\n ref={popupRef}\n role=\"presentation\"\n dir={dir}\n finalFocus={finalFocus}\n anchorRef={anchorRef}\n onDismiss={close}\n onEscape={() => {\n close();\n focus();\n }}\n >\n <div\n role=\"status\"\n aria-atomic=\"true\"\n className={cn(selectEmptyStyles(), \"gridui-u-select--empty:hidden\")}\n >\n {getSearchStatus(visible.length, {\n loading,\n loadingLabel,\n errorLabel,\n resultCountLabel,\n emptyLabel,\n })}\n </div>\n <ComboboxOptions\n selectionAppearance={selectionAppearance}\n id={listId}\n label={searchLabel}\n options={filtered}\n selected={selectedValue}\n active={active}\n optionId={optionId}\n onSelect={choose}\n onHighlight={search.highlight}\n />\n <SelectionActions\n actions={actions}\n onAction={runAction}\n />\n </SelectionPopup>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace MultiSelect\n * @description Multi Select\n */\n\nimport { SelectionPopup } from \"../shared/popup/selection-popup\";\nimport { useSelectionPopup } from \"../shared/popup/use-selection-popup\";\nimport { getSearchStatus } from \"../shared/search/calculate-search-options\";\nimport { ComboboxOptions } from \"../shared/search/combobox-options\";\nimport { useSearchOptions } from \"../shared/search/use-search-options\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectionControlOptions, SelectionSearchLabels, SelectionSearchProps, SelectOption } from \"../shared/types\";\nimport { ListFieldControl, type ListFieldProps, useListField } from \"@gridui/form\";\nimport { controlVariants } from \"@gridui/input\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { type ComponentPropsWithRef, type FC, useId, useRef } from \"react\";\n\nexport type MultiSelectProps = Omit<ComponentPropsWithRef<\"button\">, \"children\" | \"value\" | \"defaultValue\" | \"onChange\" | \"type\"> & ListFieldProps & SelectionControlOptions & SelectionSearchProps & SelectionSearchLabels & {\n readonly placeholder: string;\n};\n\nexport const MultiSelect: FC<MultiSelectProps> = (props: MultiSelectProps) => {\n const { value, defaultValue, onValueChange, options, placeholder, searchLabel, emptyLabel, clearLabel, required, disabled, readOnly,\n name, form, portalContainer, className, ref, onKeyDown, query: controlledQuery, onQueryChange, filterOptions,\n loading, loadingLabel, errorLabel, resultCountLabel, selectionAppearance = \"filled\", ...restProps } = props;\n const search = useRef<HTMLInputElement>(null);\n const id = useId();\n const { selected, native, control, change } = useListField({\n value,\n defaultValue,\n onValueChange,\n disabled,\n readOnly,\n form,\n }, () => {\n close();\n });\n const { open, popupRef: popup, available, changeOpen, close, focus, finalFocus } = useSelectionPopup({\n disabled,\n readOnly,\n controlRef: control,\n });\n const searchOptions = useSearchOptions(options, selected, `${id}-list`, open, {\n query: controlledQuery,\n onQueryChange,\n filterOptions,\n loading,\n errorLabel,\n });\n const { all, filtered, visible, query, active, optionId, activeOptionId, getOption } = searchOptions;\n const choose = (option: SelectOption) => {\n if (option.disabled || loading || errorLabel || !available()) {\n return;\n }\n change(selected.includes(option.value) ? selected.filter(entry => {\n return entry !== option.value;\n }) : [\n ...selected,\n option.value,\n ]);\n search.current?.focus({ preventScroll: true });\n };\n return (<Primitive.Root\n open={open}\n onOpenChange={changeOpen}\n >\n <div\n className=\"gridui-u-select--flex gridui-u-select--min-w-0 gridui-u-select--items-stretch gridui-u-select--gap-gridui-4\"\n dir={restProps.dir}\n >\n <Primitive.Trigger\n asChild\n >\n <button\n {...restProps}\n type=\"button\"\n form={form}\n disabled={disabled}\n aria-readonly={readOnly}\n aria-required={required}\n ref={(element) => {\n control.current = element; if (typeof ref === \"function\") {\n return ref(element);\n } if (ref) {\n ref.current = element;\n }\n }}\n className={cn(controlVariants(), \"gridui-u-select--flex gridui-u-select--flex-1 gridui-u-select--items-center gridui-u-select--gap-gridui-8 gridui-u-select--text-start\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n event.preventDefault(); changeOpen(true);\n }\n }}\n >\n <span\n className=\"gridui-u-select--min-w-0 gridui-u-select--flex-1 gridui-u-select--wrap-anywhere\"\n >\n {selected.length\n ? selected.map(entry => {\n return getOption(entry)?.label ?? entry;\n }).join(\", \")\n : placeholder}\n </span>\n <ChevronDown\n size={16}\n aria-hidden=\"true\"\n />\n </button>\n </Primitive.Trigger>\n {clearLabel && (<button\n type=\"button\"\n aria-label={clearLabel}\n disabled={disabled || readOnly || required || !selected.length}\n className={cn(controlVariants(), \"gridui-u-select--flex gridui-u-select--w-auto gridui-u-select--shrink-0 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--min-w-11 gridui-u-select--cursor-pointer\")}\n onClick={() => {\n change([]); control.current?.focus();\n }}\n >\n <X\n size={16}\n aria-hidden=\"true\"\n />\n </button>)}\n <ListFieldControl\n ref={native}\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n value={selected}\n onValueChange={change}\n onInvalidFocus={() => {\n control.current?.focus();\n }}\n >\n {all.map(option => {\n return (<option\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n >\n {option.label}\n </option>);\n })}\n {selected.filter(entry => {\n return getOption(entry) === undefined;\n }).map(entry => {\n return (<option\n key={entry}\n value={entry}\n >\n {entry}\n </option>);\n })}\n </ListFieldControl>\n </div>\n <SelectionPopup\n open={open}\n container={portalContainer}\n ref={popup}\n aria-label={searchLabel}\n dir={restProps.dir}\n finalFocus={finalFocus}\n initialFocus={() => {\n search.current?.focus({ preventScroll: true });\n }}\n onEscape={() => {\n close();\n focus();\n }}\n >\n <input\n ref={search}\n type=\"text\"\n role=\"combobox\"\n aria-label={searchLabel}\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-busy={loading || undefined}\n aria-controls={`${id}-list`}\n aria-activedescendant={activeOptionId}\n value={query ?? \"\"}\n className={cn(controlVariants({ size: \"small\" }), \"gridui-u-select--m-gridui-8 gridui-u-select--w-auto gridui-u-select--shrink-0\")}\n onChange={(event) => {\n searchOptions.changeQuery(event.target.value);\n }}\n onKeyDown={(event) => {\n if (isComposingKeyEvent(event.nativeEvent)) {\n event.stopPropagation(); return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n searchOptions.moveActive(event.key === \"ArrowDown\" ? 1 : -1);\n }\n if (event.key === \"Enter\") {\n event.preventDefault();\n const option = searchOptions.activeOption;\n if (option) {\n choose(option);\n }\n }\n }}\n />\n <ComboboxOptions\n selectionAppearance={selectionAppearance}\n id={`${id}-list`}\n label={searchLabel}\n options={filtered}\n selected={selected}\n multiple\n active={active}\n optionId={optionId}\n onSelect={choose}\n onHighlight={searchOptions.highlight}\n />\n <div\n role=\"status\"\n aria-atomic=\"true\"\n className={cn(selectEmptyStyles(), \"gridui-u-select--empty:hidden\")}\n >\n {getSearchStatus(visible.length, {\n loading,\n loadingLabel,\n errorLabel,\n resultCountLabel,\n emptyLabel,\n })}\n </div>\n </SelectionPopup>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Select\n * @description Select Options\n */\n\nimport { selectIconStyles, selectListStyles, selectOptionContentStyles, selectOptionDescriptionStyles } from \"../shared/style\";\nimport type { SelectionListOptions, SelectOption } from \"../shared/types\";\nimport { overlayListIndicatorStyles, overlayListItemStyles, overlayListLabelStyles, useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport * as Primitive from \"@radix-ui/react-select\";\nimport { Check } from \"lucide-react\";\nimport { type FC, useId } from \"react\";\n\nexport type SelectOptionsProps = SelectionListOptions;\n\nexport const SelectOptions: FC<SelectOptionsProps> = (props: SelectOptionsProps) => {\n\n const { options, id, label, selectionAppearance } = props;\n const scrollbarRef = useScrollbars<HTMLDivElement>();\n const ref = useInteractionOutline<HTMLDivElement>({\n ref: scrollbarRef,\n selector: '[role=\"option\"]',\n });\n\n return (<Primitive.Viewport\n ref={ref}\n className={selectListStyles()}\n role=\"listbox\"\n id={id}\n aria-label={label}\n >\n {options.map((entry) => {\n\n if (!(\"options\" in entry)) {\n return (<SelectOptionItem\n key={entry.value}\n option={entry}\n selectionAppearance={selectionAppearance}\n />);\n }\n\n return (<Primitive.Group\n key={entry.label}\n >\n <Primitive.Label\n className={overlayListLabelStyles()}\n >\n {entry.label}\n </Primitive.Label>\n {entry.options.map(option => {\n return (<SelectOptionItem\n key={option.value}\n option={option}\n selectionAppearance={selectionAppearance}\n />);\n })}\n </Primitive.Group>);\n })}\n </Primitive.Viewport>);\n};\n\nexport type SelectOptionItemProps = Pick<SelectionListOptions, \"selectionAppearance\"> & {\n readonly option: SelectOption;\n};\n\nexport const SelectOptionItem: FC<SelectOptionItemProps> = (props: SelectOptionItemProps) => {\n const { option, selectionAppearance } = props;\n const labelId = useId();\n const descriptionId = `${labelId}-description`;\n return (<Primitive.Item\n value={`gridui:${option.value}`}\n aria-labelledby={labelId}\n aria-describedby={option.description ? descriptionId : undefined}\n textValue={option.label}\n disabled={option.disabled}\n className={overlayListItemStyles({ selectionAppearance })}\n >\n {option.icon && (<span\n className={selectIconStyles()}\n aria-hidden=\"true\"\n >\n {option.icon}\n </span>)}\n <span\n className={selectOptionContentStyles()}\n >\n <Primitive.ItemText\n id={labelId}\n >\n {option.label}\n </Primitive.ItemText>\n {option.description && (<span\n id={descriptionId}\n className={selectOptionDescriptionStyles()}\n >\n {option.description}\n </span>)}\n </span>\n <span\n className={overlayListIndicatorStyles()}\n aria-hidden=\"true\"\n >\n <Primitive.ItemIndicator>\n <Check\n size={16}\n />\n </Primitive.ItemIndicator>\n </span>\n </Primitive.Item>);\n\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Select\n * @description Style\n */\n\nimport { overlayListStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const selectContentStyles = cva(cn(\n overlayListStyles(),\n \"gridui-select-content gridui-u-select--box-border gridui-u-select--relative gridui-u-select--flex gridui-u-select--flex-col gridui-u-select--overflow-hidden gridui-u-select--min-w-0 gridui-u-select--w-(--anchor-width) gridui-u-select--max-w-(--available-width) gridui-u-select--max-h-(--available-height)\",\n));\n\nexport const selectScrollArrowStyles = cva(\"gridui-u-select--absolute gridui-u-select--inset-x-0 gridui-u-select--z-(--gridui-z-content) gridui-u-select--flex gridui-u-select--h-gridui-24 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--bg-background gridui-u-select--text-foreground\", {\n variants: {\n direction: {\n up: \"gridui-u-select--top-0\",\n down: \"gridui-u-select--bottom-0\",\n },\n },\n});\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Select\n * @description Select\n */\n\nimport { flattenOptions } from \"../shared/options\";\nimport { SelectionActions } from \"../shared/popup/selection-actions\";\nimport { useSelectionPopup } from \"../shared/popup/use-selection-popup\";\nimport { SelectionForm } from \"../shared/selection-form\";\nimport { selectIconStyles } from \"../shared/style\";\nimport type { SelectionProps } from \"../shared/types\";\nimport { useSelectionValue } from \"../shared/use-selection-value\";\nimport { SelectOptions } from \"./select-options\";\nimport { selectContentStyles, selectScrollArrowStyles } from \"./style\";\nimport { controlVariants } from \"@gridui/input\";\nimport { interactionLayerProps } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-select\";\nimport { ChevronDown, ChevronUp, X } from \"lucide-react\";\nimport { type ComponentPropsWithRef, type FC, useId, useRef, useState } from \"react\";\n\nexport type SelectProps = Omit<ComponentPropsWithRef<\"button\">,\n \"children\" | \"value\" | \"defaultValue\" | \"onChange\" | \"type\"> & SelectionProps & {\n readonly placeholder?: string;\n readonly position?: \"item-aligned\" | \"popper\";\n };\n\nexport const Select: FC<SelectProps> = (props: SelectProps) => {\n\n const {\n options, actions = [], value, defaultValue = \"\", onValueChange, placeholder,\n controlSize = \"standard\", position = \"popper\", clearLabel, required, disabled,\n name, form, dir, portalContainer, selectionAppearance = \"filled\",\n className, ref, ...restProps\n } = props;\n const controlRef = useRef<HTMLElement>(null);\n const {\n open,\n popupRef,\n available,\n changeOpen,\n close,\n focus,\n runAction,\n finalFocus,\n } = useSelectionPopup({\n disabled,\n controlRef,\n });\n const { selectedValue, change, reset } = useSelectionValue({\n value,\n defaultValue,\n onValueChange,\n }, available);\n const listId = useId();\n const [\n triggerWidth,\n setTriggerWidth,\n ] = useState<number>();\n const allOptions = flattenOptions(options);\n const selected = allOptions.find(option => {\n\n return option.value === selectedValue;\n });\n const fallback = selectedValue === \"\" ? placeholder ?? \"\" : selectedValue;\n const display = selected?.label ?? fallback;\n\n // SelectionForm owns form reset and submission, including canceled resets.\n return (<Primitive.Root\n form={`${listId}-detached`}\n value={selected ? `gridui:${selectedValue}` : \"\"}\n disabled={disabled}\n open={open}\n onOpenChange={(next) => {\n if (next) {\n setTriggerWidth(controlRef.current?.getBoundingClientRect().width);\n }\n changeOpen(next);\n }}\n onValueChange={(next) => {\n change(next.slice(7));\n }}\n dir={dir === \"rtl\" ? \"rtl\" : \"ltr\"}\n >\n <div\n className=\"gridui-u-select--relative gridui-u-select--flex gridui-u-select--min-w-0 gridui-u-select--w-full gridui-u-select--items-stretch gridui-u-select--gap-gridui-4\"\n dir={dir}\n >\n <Primitive.Trigger\n {...restProps}\n form={form}\n aria-controls={open ? listId : undefined}\n aria-required={required}\n ref={(element) => {\n\n controlRef.current = element;\n if (typeof ref === \"function\") {\n return ref(element);\n }\n if (ref) {\n ref.current = element;\n }\n }}\n className={cn(controlVariants({ size: controlSize }), \"gridui-u-select--flex gridui-u-select--flex-1 gridui-u-select--items-center gridui-u-select--gap-gridui-8 gridui-u-select--text-start\", className)}\n >\n {selected?.icon && (<span\n className={selectIconStyles()}\n aria-hidden=\"true\"\n >\n {selected.icon}\n </span>)}\n <span\n className=\"gridui-u-select--min-w-0 gridui-u-select--flex-1 gridui-u-select--whitespace-normal gridui-u-select--wrap-anywhere\"\n >\n <Primitive.Value\n placeholder={display}\n >\n {display}\n </Primitive.Value>\n </span>\n <Primitive.Icon>\n <ChevronDown\n size={16}\n className=\"gridui-u-select--shrink-0\"\n aria-hidden=\"true\"\n />\n </Primitive.Icon>\n </Primitive.Trigger>\n {clearLabel && (<button\n type=\"button\"\n disabled={disabled || required || selectedValue === \"\"}\n aria-label={clearLabel}\n onClick={() => {\n\n change(\"\");\n controlRef.current?.focus();\n }}\n className={cn(controlVariants({ size: controlSize }), \"gridui-u-select--flex gridui-u-select--w-auto gridui-u-select--shrink-0 gridui-u-select--items-center gridui-u-select--justify-center gridui-u-select--min-w-11 gridui-u-select--cursor-pointer\")}\n >\n <X\n size={16}\n aria-hidden=\"true\"\n />\n </button>)}\n <SelectionForm\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n selectedValue={selectedValue}\n allOptions={allOptions}\n onValueChange={change}\n onReset={() => {\n reset();\n close();\n }}\n onInvalid={focus}\n />\n </div>\n <Primitive.Portal\n container={portalContainer}\n >\n <Primitive.Content\n {...interactionLayerProps}\n position={position}\n align=\"start\"\n sideOffset={8}\n collisionPadding={16}\n ref={popupRef}\n role=\"presentation\"\n {...(position === \"item-aligned\" ? {\n \"data-side\": \"none\",\n style: { width: triggerWidth },\n } : {})}\n className={selectContentStyles()}\n dir={dir}\n onCloseAutoFocus={(event) => {\n event.preventDefault();\n const target = finalFocus();\n if (target) {\n target.focus();\n }\n }}\n onPointerDownOutside={() => {\n close();\n }}\n onEscapeKeyDown={(event) => {\n event.preventDefault();\n event.stopPropagation(); changeOpen(false);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") {\n event.stopPropagation();\n }\n if (event.key === \"Tab\") {\n event.preventDefault();\n const controls = Array.from(event.currentTarget.querySelectorAll<HTMLElement>(\"button:not(:disabled), a[href]\"));\n const active = controls.indexOf(event.target as HTMLElement);\n const next = controls[active + (event.shiftKey ? -1 : 1)];\n if (next) {\n next.focus();\n }\n else {\n popupRef.current?.querySelector<HTMLElement>('[role=\"option\"][data-state=\"checked\"]')?.focus();\n }\n }\n if ((event.target as HTMLElement).closest(\"button, a\") && event.key !== \"Tab\") {\n event.stopPropagation();\n }\n }}\n >\n <div\n className=\"gridui-u-select--relative gridui-u-select--flex gridui-u-select--min-h-0 gridui-u-select--flex-col\"\n >\n <Primitive.ScrollUpButton\n className={selectScrollArrowStyles({ direction: \"up\" })}\n >\n <ChevronUp\n size={16}\n aria-hidden=\"true\"\n />\n </Primitive.ScrollUpButton>\n <SelectOptions\n selectionAppearance={selectionAppearance}\n options={options}\n id={listId}\n label={restProps[\"aria-label\"]}\n />\n <Primitive.ScrollDownButton\n className={selectScrollArrowStyles({ direction: \"down\" })}\n >\n <ChevronDown\n size={16}\n aria-hidden=\"true\"\n />\n </Primitive.ScrollDownButton>\n </div>\n <SelectionActions\n actions={actions}\n onAction={runAction}\n />\n\n </Primitive.Content>\n </Primitive.Portal>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace UseAsyncOptions\n * @description Request\n */\n\nexport type AsyncOptionsLoader<T> = (query: string, signal: AbortSignal) => Promise<readonly T[]>;\n\nexport type AsyncOptionsState<T> = {\n readonly query: string;\n readonly options: readonly T[];\n readonly loading: boolean;\n readonly error: unknown;\n};\n\nexport const createOptionsRequest = <T>(\n loadOptions: AsyncOptionsLoader<T>,\n onState: (state: AsyncOptionsState<T>) => void,\n) => {\n let controller: AbortController | undefined;\n const cancel = () => {\n controller?.abort();\n controller = undefined;\n };\n const run = async (query: string) => {\n cancel();\n const current = new AbortController();\n controller = current;\n onState({\n query,\n options: [],\n loading: true,\n error: null,\n });\n try {\n const options = await loadOptions(query, current.signal);\n if (controller === current && !current.signal.aborted) {\n onState({\n query,\n options,\n loading: false,\n error: null,\n });\n }\n } catch (error: unknown) {\n if (controller === current && !current.signal.aborted) {\n onState({\n query,\n options: [],\n loading: false,\n error,\n });\n }\n }\n };\n return {\n run,\n cancel,\n };\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace UseAsyncOptions\n * @description Use Async Options\n */\n\nimport { type AsyncOptionsLoader, type AsyncOptionsState, createOptionsRequest } from \"./request\";\nimport { useEffect, useState } from \"react\";\n\nexport type UseAsyncOptionsOptions<T> = {\n readonly query: string;\n readonly loadOptions: AsyncOptionsLoader<T>;\n readonly debounceMs?: number;\n readonly enabled?: boolean;\n};\n\ntype OwnedOptionsState<T> = {\n readonly loader: AsyncOptionsLoader<T>;\n readonly result: AsyncOptionsState<T>;\n};\n\nexport const useAsyncOptions = <T>({ query, loadOptions, debounceMs = 150, enabled = true }: UseAsyncOptionsOptions<T>): AsyncOptionsState<T> => {\n if (!Number.isFinite(debounceMs) || debounceMs < 0) {\n throw new RangeError(\"Option search debounce must be finite and nonnegative.\");\n }\n const [\n state,\n setState,\n ] = useState<OwnedOptionsState<T>>({\n loader: loadOptions,\n result: {\n query,\n options: [],\n loading: enabled,\n error: null,\n },\n });\n useEffect(() => {\n const publish = (result: AsyncOptionsState<T>) => {\n setState({\n loader: loadOptions,\n result,\n });\n };\n const request = createOptionsRequest(loadOptions, publish);\n publish({\n query,\n options: [],\n loading: enabled,\n error: null,\n });\n if (!enabled) {\n return request.cancel;\n }\n const timer = setTimeout(() => {\n void request.run(query);\n }, debounceMs);\n return () => {\n clearTimeout(timer);\n request.cancel();\n };\n }, [\n query,\n loadOptions,\n debounceMs,\n enabled,\n ]);\n return state.loader === loadOptions && state.result.query === query && enabled ? state.result : {\n query,\n options: [],\n loading: enabled,\n error: null,\n };\n};\n"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,uBAAuB,yBAAyB;AACzD,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,mBAAmB,IAAI,8HAA8H;AAE3J,IAAM,4BAA4B,IAAI,oHAAoH;AAE1J,IAAM,gCAAgC,IAAI,+GAA+G;AAEzJ,IAAM,mBAAmB,IAAI,2DAA2D;AAExF,IAAM,oBAAoB,IAAI,uFAAuF;AAErH,IAAM,sBAAsB,IAAI,oFAAoF;AAEpH,IAAM,qBAAqB,IAAI;AAAA,EAClC,sBAAsB;AAAA,EACtB;AACJ,CAAC;AAEM,IAAM,wBAAwB,IAAI;AAAA,EACrC,kBAAkB;AAAA,EAClB;AACJ,CAAC;;;ACvBD,SAAS,2BAA2B;AACpC,SAAS,cAAc,6BAA6B;AACpD,YAAY,eAAe;AAwDf;AA3CL,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM,EAAE,MAAM,UAAU,WAAW,WAAW,cAAc,YAAY,UAAU,WAAW,GAAG,UAAU,IAAI;AAC9G,SAAQ;AAAA,IAAW;AAAA,IAAV;AAAA,MACL;AAAA,MAEA;AAAA,QAAW;AAAA,QAAV;AAAA,UACI,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,YAAY;AAAA,UACZ,OAAM;AAAA,UACN,kBAAkB;AAAA,UAClB,WAAW,sBAAsB;AAAA,UACjC,iBAAiB,WAAS;AACtB,kBAAM,eAAe;AACrB,2BAAe;AAAA,UACnB;AAAA,UAC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,MACV,SAAS;AAAA,MACT,OAAO;AAAA,IACX;AAAA,EACJ,CAAC;AACD,EAAAD,WAAU,MAAM;AACZ,UAAM,UAAU,CAAC,WAAiC;AAC9C,eAAS;AAAA,QACL,QAAQ;AAAA,QACR;AAAA,MACJ,CAAC;AAAA,IACL;AACA,UAAM,UAAU,qBAAqB,aAAa,OAAO;AACzD,YAAQ;AAAA,MACJ;AAAA,MACA,SAAS,CAAC;AAAA,MACV,SAAS;AAAA,MACT,OAAO;AAAA,IACX,CAAC;AACD,QAAI,CAAC,SAAS;AACV,aAAO,QAAQ;AAAA,IACnB;AACA,UAAM,QAAQ,WAAW,MAAM;AAC3B,WAAK,QAAQ,IAAI,KAAK;AAAA,IAC1B,GAAG,UAAU;AACb,WAAO,MAAM;AACT,mBAAa,KAAK;AAClB,cAAQ,OAAO;AAAA,IACnB;AAAA,EACJ,GAAG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AACD,SAAO,MAAM,WAAW,eAAe,MAAM,OAAO,UAAU,SAAS,UAAU,MAAM,SAAS;AAAA,IAC5F;AAAA,IACA,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACX;AACJ;",
|
|
6
6
|
"names": ["overlayListItemStyles", "jsx", "useEffect", "useRef", "useState", "isComposingKeyEvent", "cn", "Primitive", "useEffect", "useRef", "useState", "jsx", "jsxs", "filterOptions", "jsx", "jsxs", "useFormReset", "useRef", "flushSync", "jsx", "jsxs", "useRef", "useState", "cva", "isComposingKeyEvent", "cn", "Primitive", "useId", "useRef", "jsx", "jsxs", "filterOptions", "controlVariants", "isComposingKeyEvent", "cn", "Primitive", "ChevronDown", "X", "useId", "useRef", "jsx", "jsxs", "filterOptions", "overlayListIndicatorStyles", "overlayListItemStyles", "overlayListLabelStyles", "useInteractionOutline", "useScrollbars", "Primitive", "Check", "useId", "jsx", "jsxs", "overlayListStyles", "cn", "cva", "controlVariants", "interactionLayerProps", "cn", "Primitive", "ChevronDown", "X", "useId", "useRef", "useState", "jsx", "jsxs", "useEffect", "useState"]
|
|
7
7
|
}
|
|
@@ -8,7 +8,7 @@ import type { SelectionListOptions, SelectOption } from "../shared/types";
|
|
|
8
8
|
import { type FC } from "react";
|
|
9
9
|
export type SelectOptionsProps = SelectionListOptions;
|
|
10
10
|
export declare const SelectOptions: FC<SelectOptionsProps>;
|
|
11
|
-
export type SelectOptionItemProps = {
|
|
11
|
+
export type SelectOptionItemProps = Pick<SelectionListOptions, "selectionAppearance"> & {
|
|
12
12
|
readonly option: SelectOption;
|
|
13
13
|
};
|
|
14
14
|
export declare const SelectOptionItem: FC<SelectOptionItemProps>;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import * as Primitive from "@radix-ui/react-popover";
|
|
8
8
|
import type { ComponentPropsWithRef, FC, RefObject } from "react";
|
|
9
9
|
export type SelectionPopupProps = Pick<ComponentPropsWithRef<typeof Primitive.Content>, "ref" | "children" | "dir" | "role" | "aria-label"> & {
|
|
10
|
+
readonly open: boolean;
|
|
10
11
|
readonly container?: ComponentPropsWithRef<typeof Primitive.Portal>["container"];
|
|
11
12
|
readonly anchorRef?: RefObject<HTMLElement | null>;
|
|
12
13
|
readonly initialFocus?: () => void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Select
|
|
4
|
+
* @namespace Shared_Search
|
|
5
|
+
* @description Calculate Search Options
|
|
6
|
+
*/
|
|
7
|
+
import type { SelectGroup, SelectionSearchProps, SelectOption } from "../types";
|
|
8
|
+
type SearchOptionsInput = Pick<SelectionSearchProps, "filterOptions" | "loading" | "errorLabel"> & {
|
|
9
|
+
readonly options: readonly (SelectOption | SelectGroup)[];
|
|
10
|
+
readonly selected: readonly string[];
|
|
11
|
+
readonly listId: string;
|
|
12
|
+
readonly query: string | null;
|
|
13
|
+
readonly highlighted: string | null;
|
|
14
|
+
};
|
|
15
|
+
export declare const calculateSearchOptions: (input: SearchOptionsInput) => {
|
|
16
|
+
all: SelectOption[];
|
|
17
|
+
filtered: readonly (SelectOption | SelectGroup)[];
|
|
18
|
+
visible: SelectOption[];
|
|
19
|
+
active: string | null;
|
|
20
|
+
activeOption: SelectOption | undefined;
|
|
21
|
+
activeOptionId: string | undefined;
|
|
22
|
+
optionId: (value: string) => string;
|
|
23
|
+
getOption: (value: string) => SelectOption | undefined;
|
|
24
|
+
};
|
|
25
|
+
export declare const getSearchStatus: (count: number, props: Pick<SelectionSearchProps, "loading" | "loadingLabel" | "errorLabel" | "resultCountLabel"> & {
|
|
26
|
+
readonly emptyLabel: string;
|
|
27
|
+
}) => string | undefined;
|
|
28
|
+
export {};
|
|
@@ -6,15 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { SelectGroup, SelectionSearchProps, SelectOption } from "../types";
|
|
8
8
|
export declare const useSearchOptions: (options: readonly (SelectOption | SelectGroup)[], selected: readonly string[], listId: string, open: boolean, searchProps?: SelectionSearchProps) => {
|
|
9
|
+
query: string | null;
|
|
10
|
+
highlight: (value: string) => void;
|
|
11
|
+
changeQuery: (text: string) => void;
|
|
12
|
+
moveActive: (direction: number) => void;
|
|
9
13
|
all: SelectOption[];
|
|
10
14
|
filtered: readonly (SelectOption | SelectGroup)[];
|
|
11
15
|
visible: SelectOption[];
|
|
12
|
-
query: string | null;
|
|
13
16
|
active: string | null;
|
|
14
17
|
activeOption: SelectOption | undefined;
|
|
15
18
|
activeOptionId: string | undefined;
|
|
16
19
|
optionId: (value: string) => string;
|
|
17
|
-
|
|
18
|
-
changeQuery: (text: string) => void;
|
|
19
|
-
moveActive: (direction: number) => void;
|
|
20
|
+
getOption: (value: string) => SelectOption | undefined;
|
|
20
21
|
};
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* @namespace Shared
|
|
5
5
|
* @description Types
|
|
6
6
|
*/
|
|
7
|
+
import type { overlayListItemStyles } from "@gridui/overlay";
|
|
8
|
+
import type { VariantProps } from "class-variance-authority";
|
|
7
9
|
import type { ReactNode } from "react";
|
|
8
10
|
export type SelectOption = {
|
|
9
11
|
readonly value: string;
|
|
@@ -39,7 +41,11 @@ export interface SelectionValueProps {
|
|
|
39
41
|
export interface SelectionOptionSource {
|
|
40
42
|
readonly options: readonly (SelectOption | SelectGroup)[];
|
|
41
43
|
}
|
|
42
|
-
export
|
|
44
|
+
export type SelectionAppearanceOptions = {
|
|
45
|
+
/** Selected option presentation; keyboard and pointer highlights remain independent. */
|
|
46
|
+
readonly selectionAppearance?: NonNullable<VariantProps<typeof overlayListItemStyles>["selectionAppearance"]> | undefined;
|
|
47
|
+
};
|
|
48
|
+
export interface SelectionControlOptions extends SelectionOptionSource, SelectionAppearanceOptions {
|
|
43
49
|
readonly clearLabel?: string;
|
|
44
50
|
readonly portalContainer?: HTMLElement | null;
|
|
45
51
|
readonly required?: boolean;
|
|
@@ -64,7 +70,7 @@ export type SelectionSearchProps = {
|
|
|
64
70
|
readonly errorLabel?: string | undefined;
|
|
65
71
|
readonly resultCountLabel?: ((count: number) => string) | undefined;
|
|
66
72
|
};
|
|
67
|
-
export type SelectionListOptions = SelectionOptionSource & {
|
|
73
|
+
export type SelectionListOptions = SelectionOptionSource & SelectionAppearanceOptions & {
|
|
68
74
|
readonly id: string;
|
|
69
75
|
readonly label?: string | undefined;
|
|
70
76
|
};
|
package/docs/catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/select",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"category": "core",
|
|
6
6
|
"description": "GridUI React select",
|
|
7
7
|
"usage": "Input supplies control styles. Overlay supplies popup surfaces, motion, option rows, group labels, and trailing check slots. Form hides MultiSelect’s native multiple-value bridge. Applications own routes, labels, state persistence, and branding.",
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
],
|
|
106
106
|
"examples": [
|
|
107
107
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/free-text.mdx",
|
|
108
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/getting-started.mdx",
|
|
108
109
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/multiple-options.mdx",
|
|
109
110
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/remote-options.mdx",
|
|
110
111
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/search-options.mdx",
|
|
@@ -109,6 +109,14 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
|
|
|
109
109
|
|
|
110
110
|
``readonly (SelectOption | SelectGroup)[]`` · Required
|
|
111
111
|
|
|
112
|
+
### selectionAppearance
|
|
113
|
+
|
|
114
|
+
``NonNullable<"filled" | "indicator" | null | undefined> | undefined`` · Optional
|
|
115
|
+
|
|
116
|
+
Default: ``"filled"``
|
|
117
|
+
|
|
118
|
+
Selected option presentation; keyboard and pointer highlights remain independent.
|
|
119
|
+
|
|
112
120
|
### query
|
|
113
121
|
|
|
114
122
|
``string | undefined`` · Optional
|
|
@@ -95,6 +95,14 @@ Participates in required form validation.
|
|
|
95
95
|
|
|
96
96
|
``readonly (SelectOption | SelectGroup)[]`` · Required
|
|
97
97
|
|
|
98
|
+
### selectionAppearance
|
|
99
|
+
|
|
100
|
+
``NonNullable<"filled" | "indicator" | null | undefined> | undefined`` · Optional
|
|
101
|
+
|
|
102
|
+
Default: ``"filled"``
|
|
103
|
+
|
|
104
|
+
Selected option presentation; keyboard and pointer highlights remain independent.
|
|
105
|
+
|
|
98
106
|
### query
|
|
99
107
|
|
|
100
108
|
``string | undefined`` · Optional
|
package/docs/reference/select.md
CHANGED
|
@@ -109,6 +109,14 @@ Participates in required form validation.
|
|
|
109
109
|
|
|
110
110
|
``readonly (SelectOption | SelectGroup)[]`` · Required
|
|
111
111
|
|
|
112
|
+
### selectionAppearance
|
|
113
|
+
|
|
114
|
+
``NonNullable<"filled" | "indicator" | null | undefined> | undefined`` · Optional
|
|
115
|
+
|
|
116
|
+
Default: ``"filled"``
|
|
117
|
+
|
|
118
|
+
Selected option presentation; keyboard and pointer highlights remain independent.
|
|
119
|
+
|
|
112
120
|
### placeholder
|
|
113
121
|
|
|
114
122
|
``string | undefined`` · Optional
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/select",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "GridUI React select",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@gridui/form": "^4.1.1",
|
|
31
|
-
"@gridui/input": "^
|
|
31
|
+
"@gridui/input": "^4.0.1",
|
|
32
32
|
"@gridui/interaction": "^1.2.1",
|
|
33
|
-
"@gridui/overlay": "^2.
|
|
33
|
+
"@gridui/overlay": "^2.2.0",
|
|
34
34
|
"@gridui/style-utils": "^4.0.0",
|
|
35
|
-
"@gridui/theme": "^2.
|
|
35
|
+
"@gridui/theme": "^2.6.0",
|
|
36
36
|
"@radix-ui/react-popover": "1.3.1",
|
|
37
37
|
"@radix-ui/react-select": "2.4.1",
|
|
38
38
|
"class-variance-authority": "0.7.1",
|
|
39
|
-
"lucide-react": "1.
|
|
39
|
+
"lucide-react": "1.72.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
43
43
|
"@jest/globals": "30.5.2",
|
|
44
|
-
"@storybook/react-vite": "10.6.
|
|
44
|
+
"@storybook/react-vite": "10.6.7",
|
|
45
45
|
"@types/jest": "30.0.0",
|
|
46
46
|
"@types/node": "26.6.6",
|
|
47
47
|
"@types/react": "19.3.0",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "node ../../scripts/compilation/package.ts",
|
|
56
56
|
"compile": "tsc --project tsconfig.json",
|
|
57
|
-
"test": "jest"
|
|
58
|
-
"coverage": "jest --coverage"
|
|
57
|
+
"test": "jest"
|
|
59
58
|
}
|
|
60
59
|
}
|