@gridui/select 1.0.6 → 1.1.1
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 +23 -2
- package/dist/combobox/combobox.d.ts +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +182 -35
- package/dist/index.js.map +4 -4
- package/dist/multi-select/multi-select.d.ts +2 -2
- package/dist/shared/types.d.ts +9 -0
- package/dist/shared/use-search-options.d.ts +2 -2
- package/dist/styles.css +3 -0
- package/dist/use-async-options/request.d.ts +17 -0
- package/dist/use-async-options/use-async-options.d.ts +14 -0
- package/docs/catalog.json +96 -0
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@ Combobox, and MultiSelect:
|
|
|
7
7
|
|
|
8
8
|
```css
|
|
9
9
|
@import "@gridui/theme/styles.css";
|
|
10
|
+
@import "@gridui/overlay/styles.css";
|
|
10
11
|
@import "@gridui/input/styles.css";
|
|
11
12
|
@import "@gridui/form/styles.css";
|
|
12
|
-
@import "@gridui/overlay/styles.css";
|
|
13
13
|
@import "@gridui/dropdown-menu/styles.css";
|
|
14
14
|
@import "@gridui/select/styles.css";
|
|
15
15
|
```
|
|
@@ -119,7 +119,7 @@ execute actions. The client hydrates before popup interaction;
|
|
|
119
119
|
keep server and client initial values/options identical. Browser verification
|
|
120
120
|
hydrates real Node-rendered HTML and exercises selection, reset, filtering,
|
|
121
121
|
independent actions, focus handoff, and empty results across the viewport matrix.
|
|
122
|
-
Remote search
|
|
122
|
+
Remote search uses the controlled search contract below. Implicit option creation is not included. Use MultiSelect for multiple selection.
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
## Implementation and lifecycle
|
|
@@ -149,3 +149,24 @@ callers choose initial focus and dismissal policy. MultiSelect uses Form's
|
|
|
149
149
|
ListFieldControl with useListField for the native multiple-value bridge. Internal parts
|
|
150
150
|
are not package exports. See the selection contract
|
|
151
151
|
for keyboard, form, server-rendering, and focus guarantees protected by browser tests.
|
|
152
|
+
|
|
153
|
+
## Controlled and asynchronous search
|
|
154
|
+
|
|
155
|
+
Combobox and MultiSelect accept `query` / `onQueryChange`. Closing their popup
|
|
156
|
+
requests an empty query and preserves the selected value. Omit `query` to retain
|
|
157
|
+
local search. `filterOptions={false}` renders caller-filtered results without a
|
|
158
|
+
second local filter. `loading` and `errorLabel` temporarily remove selectable
|
|
159
|
+
results, so a stale response cannot be selected while a request is pending.
|
|
160
|
+
Supply localized `loadingLabel`, `errorLabel`, and optionally `resultCountLabel`
|
|
161
|
+
for the polite status region. Native form values remain available during search.
|
|
162
|
+
|
|
163
|
+
`useAsyncOptions({ query, loadOptions, debounceMs, enabled })` is an optional
|
|
164
|
+
request helper. It returns `options`, `loading`, `error`, and the corresponding
|
|
165
|
+
`query`. `loadOptions(query, signal)` owns fetching and caching. Keep its identity
|
|
166
|
+
stable, forward the AbortSignal to fetch, and map errors to application copy.
|
|
167
|
+
A newer query or a changed loader identity clears the preceding results
|
|
168
|
+
immediately, including when the same query moves to another data source.
|
|
169
|
+
Cancellation and request ownership also reject late answers from loaders that
|
|
170
|
+
ignore the signal.
|
|
171
|
+
`debounceMs` defaults to 150; `enabled={false}` cancels and clears the request.
|
|
172
|
+
This helper is also useful when supplying remote items to CommandPalette.
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @namespace Combobox
|
|
5
5
|
* @description Combobox
|
|
6
6
|
*/
|
|
7
|
-
import type { SelectionProps } from "../shared/types";
|
|
7
|
+
import type { SelectionProps, SelectionSearchProps } from "../shared/types";
|
|
8
8
|
import { type ComponentPropsWithRef, type FC } from "react";
|
|
9
|
-
export type ComboboxProps = Omit<ComponentPropsWithRef<"input">, "children" | "value" | "defaultValue" | "onChange" | "type" | "size"> & SelectionProps & {
|
|
9
|
+
export type ComboboxProps = Omit<ComponentPropsWithRef<"input">, "children" | "value" | "defaultValue" | "onChange" | "type" | "size"> & SelectionProps & SelectionSearchProps & {
|
|
10
10
|
readonly searchLabel: string;
|
|
11
11
|
readonly emptyLabel: string;
|
|
12
12
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -13,3 +13,7 @@ export { Select } from "./select/select";
|
|
|
13
13
|
export type { SelectAction } from "./shared/types";
|
|
14
14
|
export type { SelectGroup } from "./shared/types";
|
|
15
15
|
export type { SelectOption } from "./shared/types";
|
|
16
|
+
export type { SelectionSearchProps } from "./shared/types";
|
|
17
|
+
export type { AsyncOptionsLoader, AsyncOptionsState } from "./use-async-options/request";
|
|
18
|
+
export type { UseAsyncOptionsOptions } from "./use-async-options/use-async-options";
|
|
19
|
+
export { useAsyncOptions } from "./use-async-options/use-async-options";
|
package/dist/index.js
CHANGED
|
@@ -295,6 +295,7 @@ var SelectionForm = (props) => {
|
|
|
295
295
|
};
|
|
296
296
|
|
|
297
297
|
// src/shared/selection-popup.tsx
|
|
298
|
+
import { isComposingKeyEvent } from "@gridui/interaction";
|
|
298
299
|
import { interactionLayerProps } from "@gridui/overlay";
|
|
299
300
|
import * as Primitive from "@radix-ui/react-popover";
|
|
300
301
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -334,7 +335,7 @@ var SelectionPopup = (props) => {
|
|
|
334
335
|
onEscapeKeyDown: (event) => {
|
|
335
336
|
event.preventDefault();
|
|
336
337
|
event.stopPropagation();
|
|
337
|
-
if (!event
|
|
338
|
+
if (!isComposingKeyEvent(event)) {
|
|
338
339
|
onEscape();
|
|
339
340
|
}
|
|
340
341
|
},
|
|
@@ -394,19 +395,22 @@ var scrollOption = (id) => {
|
|
|
394
395
|
};
|
|
395
396
|
|
|
396
397
|
// src/shared/use-search-options.ts
|
|
397
|
-
import { useEffect, useState } from "react";
|
|
398
|
+
import { useEffect, useRef as useRef2, useState } from "react";
|
|
398
399
|
var INITIAL_SEARCH = {
|
|
399
400
|
query: null,
|
|
400
401
|
highlighted: null
|
|
401
402
|
};
|
|
402
|
-
var useSearchOptions = (options, selected, listId, open) => {
|
|
403
|
+
var useSearchOptions = (options, selected, listId, open, searchProps = {}) => {
|
|
403
404
|
const [
|
|
404
405
|
search,
|
|
405
406
|
setSearch
|
|
406
407
|
] = useState(INITIAL_SEARCH);
|
|
407
|
-
const query =
|
|
408
|
+
const { query: controlledQuery, onQueryChange, filterOptions: shouldFilter = true, loading, errorLabel } = searchProps;
|
|
409
|
+
const wasOpen = useRef2(open);
|
|
410
|
+
const query = open ? controlledQuery ?? search.query : null;
|
|
408
411
|
const all = flattenOptions(options);
|
|
409
|
-
const
|
|
412
|
+
const availableOptions = shouldFilter ? filterOptions(options, query ?? "") : options;
|
|
413
|
+
const filtered = loading || errorLabel ? [] : availableOptions;
|
|
410
414
|
const visible = flattenOptions(filtered);
|
|
411
415
|
const highlighted = visible.find((option) => {
|
|
412
416
|
return option.value === search.highlighted;
|
|
@@ -416,17 +420,26 @@ var useSearchOptions = (options, selected, listId, open) => {
|
|
|
416
420
|
}) : void 0;
|
|
417
421
|
const active = highlighted ?? selectedOption ?? visible[0];
|
|
418
422
|
const activeValue = active?.value ?? null;
|
|
423
|
+
const optionIndices = new Map(all.map((option, index) => {
|
|
424
|
+
return [
|
|
425
|
+
option.value,
|
|
426
|
+
index
|
|
427
|
+
];
|
|
428
|
+
}));
|
|
419
429
|
const optionId = (value) => {
|
|
420
|
-
return `${listId}-${
|
|
421
|
-
return option.value === value;
|
|
422
|
-
})}`;
|
|
430
|
+
return `${listId}-${optionIndices.get(value) ?? -1}`;
|
|
423
431
|
};
|
|
424
432
|
const activeOptionId = active ? optionId(active.value) : void 0;
|
|
425
433
|
useEffect(() => {
|
|
426
|
-
if (!open) {
|
|
434
|
+
if (!open && wasOpen.current) {
|
|
427
435
|
setSearch(INITIAL_SEARCH);
|
|
436
|
+
onQueryChange?.("");
|
|
428
437
|
}
|
|
429
|
-
|
|
438
|
+
wasOpen.current = open;
|
|
439
|
+
}, [
|
|
440
|
+
open,
|
|
441
|
+
onQueryChange
|
|
442
|
+
]);
|
|
430
443
|
useEffect(() => {
|
|
431
444
|
if (open && activeOptionId !== void 0) {
|
|
432
445
|
scrollOption(activeOptionId);
|
|
@@ -454,6 +467,7 @@ var useSearchOptions = (options, selected, listId, open) => {
|
|
|
454
467
|
optionId,
|
|
455
468
|
highlight,
|
|
456
469
|
changeQuery: (text) => {
|
|
470
|
+
onQueryChange?.(text);
|
|
457
471
|
setSearch({
|
|
458
472
|
query: text,
|
|
459
473
|
highlighted: null
|
|
@@ -472,15 +486,15 @@ var useSearchOptions = (options, selected, listId, open) => {
|
|
|
472
486
|
};
|
|
473
487
|
|
|
474
488
|
// src/shared/use-selection-popup.ts
|
|
475
|
-
import { useEffect as useEffect2, useRef as
|
|
489
|
+
import { useEffect as useEffect2, useRef as useRef3, useState as useState2 } from "react";
|
|
476
490
|
import { flushSync as flushSync2 } from "react-dom";
|
|
477
491
|
var useSelectionPopup = ({ disabled, readOnly, controlRef }) => {
|
|
478
492
|
const [
|
|
479
493
|
localOpen,
|
|
480
494
|
setLocalOpen
|
|
481
495
|
] = useState2(false);
|
|
482
|
-
const popupRef =
|
|
483
|
-
const restoreFocus =
|
|
496
|
+
const popupRef = useRef3(null);
|
|
497
|
+
const restoreFocus = useRef3(true);
|
|
484
498
|
const unavailable = Boolean(disabled || readOnly);
|
|
485
499
|
useEffect2(() => {
|
|
486
500
|
if (unavailable) {
|
|
@@ -541,7 +555,7 @@ var useSelectionPopup = ({ disabled, readOnly, controlRef }) => {
|
|
|
541
555
|
};
|
|
542
556
|
|
|
543
557
|
// src/shared/use-selection-value.ts
|
|
544
|
-
import { useRef as
|
|
558
|
+
import { useRef as useRef4, useState as useState3 } from "react";
|
|
545
559
|
var useSelectionValue = (props, available) => {
|
|
546
560
|
const { value, defaultValue = "", onValueChange } = props;
|
|
547
561
|
const [
|
|
@@ -549,7 +563,7 @@ var useSelectionValue = (props, available) => {
|
|
|
549
563
|
setLocalValue
|
|
550
564
|
] = useState3(defaultValue);
|
|
551
565
|
const selectedValue = value ?? localValue;
|
|
552
|
-
const initialValue =
|
|
566
|
+
const initialValue = useRef4(selectedValue);
|
|
553
567
|
const update = (next) => {
|
|
554
568
|
if (next === selectedValue) {
|
|
555
569
|
return;
|
|
@@ -579,10 +593,11 @@ var comboboxTriggerStyles = cva2("gridui-u-absolute gridui-u-inset-y-0 gridui-u-
|
|
|
579
593
|
|
|
580
594
|
// src/combobox/combobox.tsx
|
|
581
595
|
import { controlVariants } from "@gridui/input";
|
|
596
|
+
import { isComposingKeyEvent as isComposingKeyEvent2 } from "@gridui/interaction";
|
|
582
597
|
import { cn as cn2 } from "@gridui/style-utils";
|
|
583
598
|
import * as Primitive2 from "@radix-ui/react-popover";
|
|
584
599
|
import { ChevronDown, X } from "lucide-react";
|
|
585
|
-
import { useId, useRef as
|
|
600
|
+
import { useId, useRef as useRef5 } from "react";
|
|
586
601
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
587
602
|
var Combobox = (props) => {
|
|
588
603
|
const {
|
|
@@ -607,10 +622,17 @@ var Combobox = (props) => {
|
|
|
607
622
|
placeholder,
|
|
608
623
|
onKeyDown,
|
|
609
624
|
onClick,
|
|
625
|
+
query: controlledQuery,
|
|
626
|
+
onQueryChange,
|
|
627
|
+
filterOptions: filterOptions2,
|
|
628
|
+
loading,
|
|
629
|
+
loadingLabel,
|
|
630
|
+
errorLabel,
|
|
631
|
+
resultCountLabel,
|
|
610
632
|
...restProps
|
|
611
633
|
} = props;
|
|
612
|
-
const controlRef =
|
|
613
|
-
const anchorRef =
|
|
634
|
+
const controlRef = useRef5(null);
|
|
635
|
+
const anchorRef = useRef5(null);
|
|
614
636
|
const { open, popupRef, available, changeOpen, close, focus, runAction, finalFocus } = useSelectionPopup({
|
|
615
637
|
disabled,
|
|
616
638
|
readOnly,
|
|
@@ -623,7 +645,13 @@ var Combobox = (props) => {
|
|
|
623
645
|
}, available);
|
|
624
646
|
const inputId = useId();
|
|
625
647
|
const listId = `${inputId}-list`;
|
|
626
|
-
const search = useSearchOptions(options, [selectedValue], listId, open
|
|
648
|
+
const search = useSearchOptions(options, [selectedValue], listId, open, {
|
|
649
|
+
query: controlledQuery,
|
|
650
|
+
onQueryChange,
|
|
651
|
+
filterOptions: filterOptions2,
|
|
652
|
+
loading,
|
|
653
|
+
errorLabel
|
|
654
|
+
});
|
|
627
655
|
const { all: allOptions, filtered, visible, query, active, optionId, activeOptionId } = search;
|
|
628
656
|
const selected = allOptions.find((option) => {
|
|
629
657
|
return option.value === selectedValue;
|
|
@@ -633,7 +661,7 @@ var Combobox = (props) => {
|
|
|
633
661
|
changeOpen(true);
|
|
634
662
|
};
|
|
635
663
|
const choose = (option) => {
|
|
636
|
-
if (option.disabled || !available()) {
|
|
664
|
+
if (option.disabled || loading || errorLabel || !available()) {
|
|
637
665
|
return;
|
|
638
666
|
}
|
|
639
667
|
change(option.value);
|
|
@@ -681,6 +709,7 @@ var Combobox = (props) => {
|
|
|
681
709
|
"aria-label": restProps["aria-label"] ?? (restProps.id ? void 0 : searchLabel),
|
|
682
710
|
"aria-required": required,
|
|
683
711
|
"aria-autocomplete": "list",
|
|
712
|
+
"aria-busy": loading || void 0,
|
|
684
713
|
"aria-expanded": open,
|
|
685
714
|
"aria-controls": open ? listId : void 0,
|
|
686
715
|
"aria-activedescendant": open ? activeOptionId : void 0,
|
|
@@ -709,7 +738,7 @@ var Combobox = (props) => {
|
|
|
709
738
|
if (event.defaultPrevented || readOnly) {
|
|
710
739
|
return;
|
|
711
740
|
}
|
|
712
|
-
if (event.nativeEvent
|
|
741
|
+
if (isComposingKeyEvent2(event.nativeEvent)) {
|
|
713
742
|
if (event.key === "Enter" || event.key === "Escape") {
|
|
714
743
|
event.stopPropagation();
|
|
715
744
|
}
|
|
@@ -832,12 +861,13 @@ var Combobox = (props) => {
|
|
|
832
861
|
focus();
|
|
833
862
|
},
|
|
834
863
|
children: [
|
|
835
|
-
|
|
864
|
+
/* @__PURE__ */ jsx5(
|
|
836
865
|
"div",
|
|
837
866
|
{
|
|
838
867
|
role: "status",
|
|
839
|
-
|
|
840
|
-
|
|
868
|
+
"aria-atomic": "true",
|
|
869
|
+
className: cn2(selectEmptyStyles(), "gridui-u-empty:hidden"),
|
|
870
|
+
children: loading ? loadingLabel : errorLabel ?? (visible.length ? resultCountLabel?.(visible.length) : emptyLabel)
|
|
841
871
|
}
|
|
842
872
|
),
|
|
843
873
|
/* @__PURE__ */ jsx5(
|
|
@@ -871,10 +901,11 @@ var Combobox = (props) => {
|
|
|
871
901
|
// src/multi-select/multi-select.tsx
|
|
872
902
|
import { ListFieldControl, useListField } from "@gridui/form";
|
|
873
903
|
import { controlVariants as controlVariants2 } from "@gridui/input";
|
|
904
|
+
import { isComposingKeyEvent as isComposingKeyEvent3 } from "@gridui/interaction";
|
|
874
905
|
import { cn as cn3 } from "@gridui/style-utils";
|
|
875
906
|
import * as Primitive3 from "@radix-ui/react-popover";
|
|
876
907
|
import { ChevronDown as ChevronDown2, X as X2 } from "lucide-react";
|
|
877
|
-
import { useId as useId2, useRef as
|
|
908
|
+
import { useId as useId2, useRef as useRef6 } from "react";
|
|
878
909
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
879
910
|
var MultiSelect = (props) => {
|
|
880
911
|
const {
|
|
@@ -895,9 +926,16 @@ var MultiSelect = (props) => {
|
|
|
895
926
|
className,
|
|
896
927
|
ref,
|
|
897
928
|
onKeyDown,
|
|
929
|
+
query: controlledQuery,
|
|
930
|
+
onQueryChange,
|
|
931
|
+
filterOptions: filterOptions2,
|
|
932
|
+
loading,
|
|
933
|
+
loadingLabel,
|
|
934
|
+
errorLabel,
|
|
935
|
+
resultCountLabel,
|
|
898
936
|
...restProps
|
|
899
937
|
} = props;
|
|
900
|
-
const search =
|
|
938
|
+
const search = useRef6(null);
|
|
901
939
|
const id = useId2();
|
|
902
940
|
const { selected, native, control, change } = useListField({
|
|
903
941
|
value,
|
|
@@ -914,10 +952,16 @@ var MultiSelect = (props) => {
|
|
|
914
952
|
readOnly,
|
|
915
953
|
controlRef: control
|
|
916
954
|
});
|
|
917
|
-
const searchOptions = useSearchOptions(options, selected, `${id}-list`, open
|
|
955
|
+
const searchOptions = useSearchOptions(options, selected, `${id}-list`, open, {
|
|
956
|
+
query: controlledQuery,
|
|
957
|
+
onQueryChange,
|
|
958
|
+
filterOptions: filterOptions2,
|
|
959
|
+
loading,
|
|
960
|
+
errorLabel
|
|
961
|
+
});
|
|
918
962
|
const { all, filtered, visible, query, active, optionId, activeOptionId } = searchOptions;
|
|
919
963
|
const choose = (option) => {
|
|
920
|
-
if (option.disabled || !available()) {
|
|
964
|
+
if (option.disabled || loading || errorLabel || !available()) {
|
|
921
965
|
return;
|
|
922
966
|
}
|
|
923
967
|
change(selected.includes(option.value) ? selected.filter((entry) => {
|
|
@@ -1084,6 +1128,7 @@ var MultiSelect = (props) => {
|
|
|
1084
1128
|
"aria-label": searchLabel,
|
|
1085
1129
|
"aria-expanded": "true",
|
|
1086
1130
|
"aria-autocomplete": "list",
|
|
1131
|
+
"aria-busy": loading || void 0,
|
|
1087
1132
|
"aria-controls": `${id}-list`,
|
|
1088
1133
|
"aria-activedescendant": activeOptionId,
|
|
1089
1134
|
value: query ?? "",
|
|
@@ -1092,7 +1137,7 @@ var MultiSelect = (props) => {
|
|
|
1092
1137
|
searchOptions.changeQuery(event.target.value);
|
|
1093
1138
|
},
|
|
1094
1139
|
onKeyDown: (event) => {
|
|
1095
|
-
if (event.nativeEvent
|
|
1140
|
+
if (isComposingKeyEvent3(event.nativeEvent)) {
|
|
1096
1141
|
event.stopPropagation();
|
|
1097
1142
|
return;
|
|
1098
1143
|
}
|
|
@@ -1124,12 +1169,13 @@ var MultiSelect = (props) => {
|
|
|
1124
1169
|
onHighlight: searchOptions.highlight
|
|
1125
1170
|
}
|
|
1126
1171
|
),
|
|
1127
|
-
|
|
1172
|
+
/* @__PURE__ */ jsx6(
|
|
1128
1173
|
"div",
|
|
1129
1174
|
{
|
|
1130
1175
|
role: "status",
|
|
1131
|
-
|
|
1132
|
-
|
|
1176
|
+
"aria-atomic": "true",
|
|
1177
|
+
className: cn3(selectEmptyStyles(), "gridui-u-empty:hidden"),
|
|
1178
|
+
children: loading ? loadingLabel : errorLabel ?? (visible.length ? resultCountLabel?.(visible.length) : emptyLabel)
|
|
1133
1179
|
}
|
|
1134
1180
|
)
|
|
1135
1181
|
]
|
|
@@ -1289,7 +1335,7 @@ import { interactionLayerProps as interactionLayerProps2 } from "@gridui/overlay
|
|
|
1289
1335
|
import { cn as cn5 } from "@gridui/style-utils";
|
|
1290
1336
|
import * as Primitive5 from "@radix-ui/react-select";
|
|
1291
1337
|
import { ChevronDown as ChevronDown3, ChevronUp, X as X3 } from "lucide-react";
|
|
1292
|
-
import { useId as useId4, useRef as
|
|
1338
|
+
import { useId as useId4, useRef as useRef7, useState as useState4 } from "react";
|
|
1293
1339
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1294
1340
|
var Select = (props) => {
|
|
1295
1341
|
const {
|
|
@@ -1312,7 +1358,7 @@ var Select = (props) => {
|
|
|
1312
1358
|
ref,
|
|
1313
1359
|
...restProps
|
|
1314
1360
|
} = props;
|
|
1315
|
-
const controlRef =
|
|
1361
|
+
const controlRef = useRef7(null);
|
|
1316
1362
|
const {
|
|
1317
1363
|
open,
|
|
1318
1364
|
popupRef,
|
|
@@ -1569,9 +1615,110 @@ var Select = (props) => {
|
|
|
1569
1615
|
}
|
|
1570
1616
|
);
|
|
1571
1617
|
};
|
|
1618
|
+
|
|
1619
|
+
// src/use-async-options/request.ts
|
|
1620
|
+
var createOptionsRequest = (loadOptions, onState) => {
|
|
1621
|
+
let controller;
|
|
1622
|
+
const cancel = () => {
|
|
1623
|
+
controller?.abort();
|
|
1624
|
+
controller = void 0;
|
|
1625
|
+
};
|
|
1626
|
+
const run = async (query) => {
|
|
1627
|
+
cancel();
|
|
1628
|
+
const current = new AbortController();
|
|
1629
|
+
controller = current;
|
|
1630
|
+
onState({
|
|
1631
|
+
query,
|
|
1632
|
+
options: [],
|
|
1633
|
+
loading: true,
|
|
1634
|
+
error: null
|
|
1635
|
+
});
|
|
1636
|
+
try {
|
|
1637
|
+
const options = await loadOptions(query, current.signal);
|
|
1638
|
+
if (controller === current && !current.signal.aborted) {
|
|
1639
|
+
onState({
|
|
1640
|
+
query,
|
|
1641
|
+
options,
|
|
1642
|
+
loading: false,
|
|
1643
|
+
error: null
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
} catch (error) {
|
|
1647
|
+
if (controller === current && !current.signal.aborted) {
|
|
1648
|
+
onState({
|
|
1649
|
+
query,
|
|
1650
|
+
options: [],
|
|
1651
|
+
loading: false,
|
|
1652
|
+
error
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
return {
|
|
1658
|
+
run,
|
|
1659
|
+
cancel
|
|
1660
|
+
};
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1663
|
+
// src/use-async-options/use-async-options.ts
|
|
1664
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
1665
|
+
var useAsyncOptions = ({ query, loadOptions, debounceMs = 150, enabled = true }) => {
|
|
1666
|
+
if (!Number.isFinite(debounceMs) || debounceMs < 0) {
|
|
1667
|
+
throw new RangeError("Option search debounce must be finite and nonnegative.");
|
|
1668
|
+
}
|
|
1669
|
+
const [
|
|
1670
|
+
state,
|
|
1671
|
+
setState
|
|
1672
|
+
] = useState5({
|
|
1673
|
+
loader: loadOptions,
|
|
1674
|
+
result: {
|
|
1675
|
+
query,
|
|
1676
|
+
options: [],
|
|
1677
|
+
loading: enabled,
|
|
1678
|
+
error: null
|
|
1679
|
+
}
|
|
1680
|
+
});
|
|
1681
|
+
useEffect3(() => {
|
|
1682
|
+
const publish = (result) => {
|
|
1683
|
+
setState({
|
|
1684
|
+
loader: loadOptions,
|
|
1685
|
+
result
|
|
1686
|
+
});
|
|
1687
|
+
};
|
|
1688
|
+
const request = createOptionsRequest(loadOptions, publish);
|
|
1689
|
+
publish({
|
|
1690
|
+
query,
|
|
1691
|
+
options: [],
|
|
1692
|
+
loading: enabled,
|
|
1693
|
+
error: null
|
|
1694
|
+
});
|
|
1695
|
+
if (!enabled) {
|
|
1696
|
+
return request.cancel;
|
|
1697
|
+
}
|
|
1698
|
+
const timer = setTimeout(() => {
|
|
1699
|
+
void request.run(query);
|
|
1700
|
+
}, debounceMs);
|
|
1701
|
+
return () => {
|
|
1702
|
+
clearTimeout(timer);
|
|
1703
|
+
request.cancel();
|
|
1704
|
+
};
|
|
1705
|
+
}, [
|
|
1706
|
+
query,
|
|
1707
|
+
loadOptions,
|
|
1708
|
+
debounceMs,
|
|
1709
|
+
enabled
|
|
1710
|
+
]);
|
|
1711
|
+
return state.loader === loadOptions && state.result.query === query && enabled ? state.result : {
|
|
1712
|
+
query,
|
|
1713
|
+
options: [],
|
|
1714
|
+
loading: enabled,
|
|
1715
|
+
error: null
|
|
1716
|
+
};
|
|
1717
|
+
};
|
|
1572
1718
|
export {
|
|
1573
1719
|
Combobox,
|
|
1574
1720
|
MultiSelect,
|
|
1575
|
-
Select
|
|
1721
|
+
Select,
|
|
1722
|
+
useAsyncOptions
|
|
1576
1723
|
};
|
|
1577
1724
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/shared/style.ts", "../src/shared/combobox-options.tsx", "../src/shared/selection-actions.tsx", "../src/shared/selection-form.tsx", "../src/shared/selection-popup.tsx", "../src/shared/options.ts", "../src/shared/scroll-option.ts", "../src/shared/use-search-options.ts", "../src/shared/use-selection-popup.ts", "../src/shared/use-selection-value.ts", "../src/combobox/style.ts", "../src/combobox/combobox.tsx", "../src/multi-select/multi-select.tsx", "../src/select/style.ts", "../src/select/select-options.tsx", "../src/select/select.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Style\n */\n\nimport { dropdownItemStyles } from \"@gridui/dropdown-menu\";\nimport { overlaySurfaceStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const selectItemStyles = cva(cn(dropdownItemStyles(), \"gridui-u-min-w-0\"));\n\nexport const selectIconStyles = cva(\"gridui-u-inline-flex gridui-u-shrink-0 gridui-u-items-center gridui-u-[&_svg]:size-gridui-16\");\n\nexport const selectOptionContentStyles = cva(\"gridui-u-min-w-0 gridui-u-flex-1 gridui-u-whitespace-normal gridui-u-wrap-anywhere\");\n\nexport const selectOptionDescriptionStyles = cva(\"gridui-u-block gridui-u-text-muted gridui-u-type-caption gridui-u-mt-gridui-4\");\n\nexport const selectListStyles = cva(\"gridui-u-min-h-0 gridui-u-overflow-y-auto\");\n\nexport const selectEmptyStyles = cva(\"gridui-u-p-gridui-8 gridui-u-text-muted gridui-u-type-caption\");\n\nexport const selectActionsStyles = cva(\"gridui-u-shrink-0 gridui-u-border-t gridui-u-border-border gridui-u-pt-gridui-4\");\n\nexport const selectActionStyles = cva(cn(\n selectItemStyles(),\n \"gridui-u-w-full gridui-u-text-start gridui-u-whitespace-normal gridui-u-wrap-anywhere\",\n));\n\nexport const comboboxContentStyles = cva(cn(\n overlaySurfaceStyles(),\n \"gridui-u-z-(--gridui-z-popover) gridui-u-p-gridui-4 gridui-u-type-data\",\n \"gridui-combobox-content gridui-u-box-border gridui-u-flex gridui-u-flex-col gridui-u-overflow-hidden gridui-u-min-w-0 gridui-u-w-(--anchor-width) gridui-u-max-h-(--available-height) gridui-u-max-w-(--available-width)\",\n));\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Combobox Options\n */\n\nimport { selectIconStyles, selectItemStyles, selectListStyles, selectOptionContentStyles, selectOptionDescriptionStyles } from \"./style\";\nimport type { SelectGroup, SelectOption } from \"./types\";\nimport { dropdownIndicatorStyles, dropdownLabelStyles } from \"@gridui/dropdown-menu\";\nimport { useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { Check } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type ComboboxOptionsProps = {\n readonly id: string;\n readonly label: string;\n readonly options: readonly (SelectOption | SelectGroup)[];\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={selectItemStyles()}\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 <span\n className={dropdownIndicatorStyles()}\n aria-hidden=\"true\"\n >\n {checked && (<Check\n size={16}\n />)}\n </span>\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 </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={dropdownLabelStyles()}\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 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-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 Selection Popup\n */\n\nimport { comboboxContentStyles } from \"./style\";\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 (!event.isComposing) {\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\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\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\n * @description Use Search Options\n */\n\nimport { filterOptions, flattenOptions } from \"./options\";\nimport { scrollOption } from \"./scroll-option\";\nimport type { SelectGroup, SelectOption } from \"./types\";\nimport { useEffect, 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) => {\n const [\n search,\n setSearch,\n ] = useState(INITIAL_SEARCH);\n const query = open ? search.query : null;\n const all = flattenOptions(options);\n const filtered = filterOptions(options, query ?? \"\");\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 optionId = (value: string): string => {\n return `${listId}-${all.findIndex(option => {\n return option.value === value;\n })}`;\n };\n const activeOptionId = active ? optionId(active.value) : undefined;\n useEffect(() => {\n if (!open) {\n setSearch(INITIAL_SEARCH);\n }\n }, [open]);\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 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 Shared\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 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-pr-11 gridui-u-text-ellipsis\");\n\nexport const comboboxTriggerStyles = cva(\"gridui-u-absolute gridui-u-inset-y-0 gridui-u-right-0 gridui-u-flex gridui-u-w-9 gridui-u-items-center gridui-u-justify-center gridui-u-rounded-control gridui-u-text-foreground gridui-u-cursor-pointer gridui-u-disabled:cursor-not-allowed gridui-u-disabled:opacity-50\");\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Combobox\n * @description Combobox\n */\n\nimport { ComboboxOptions } from \"../shared/combobox-options\";\nimport { SelectionActions } from \"../shared/selection-actions\";\nimport { SelectionForm } from \"../shared/selection-form\";\nimport { SelectionPopup } from \"../shared/selection-popup\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectionProps, SelectOption } from \"../shared/types\";\nimport { useSearchOptions } from \"../shared/use-search-options\";\nimport { useSelectionPopup } from \"../shared/use-selection-popup\";\nimport { useSelectionValue } from \"../shared/use-selection-value\";\nimport { comboboxInputStyles, comboboxTriggerStyles } from \"./style\";\nimport { controlVariants } from \"@gridui/input\";\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 & {\n readonly searchLabel: string;\n readonly emptyLabel: string;\n };\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, ...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 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 || !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-relative gridui-u-flex gridui-u-min-w-0 gridui-u-w-full gridui-u-items-stretch gridui-u-gap-gridui-4\"\n dir={dir}\n >\n <Primitive.Anchor\n asChild\n >\n <div\n ref={anchorRef}\n className=\"gridui-u-relative gridui-u-flex gridui-u-min-w-0 gridui-u-flex-1 gridui-u-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-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 (event.nativeEvent.isComposing) {\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-flex gridui-u-w-auto gridui-u-shrink-0 gridui-u-items-center gridui-u-justify-center gridui-u-min-w-11 gridui-u-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 {visible.length === 0 && (<div\n role=\"status\"\n className={selectEmptyStyles()}\n >\n {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 { ComboboxOptions } from \"../shared/combobox-options\";\nimport { SelectionPopup } from \"../shared/selection-popup\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectGroup, SelectOption } from \"../shared/types\";\nimport { useSearchOptions } from \"../shared/use-search-options\";\nimport { useSelectionPopup } from \"../shared/use-selection-popup\";\nimport { ListFieldControl, type ListFieldProps, useListField } from \"@gridui/form\";\nimport { controlVariants } from \"@gridui/input\";\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 & {\n readonly options: readonly (SelectOption | SelectGroup)[];\n readonly placeholder: string;\n readonly searchLabel: string;\n readonly emptyLabel: string;\n readonly clearLabel?: string;\n readonly required?: boolean;\n readonly portalContainer?: HTMLElement | null;\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, ...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 const { all, filtered, visible, query, active, optionId, activeOptionId } = searchOptions;\n const choose = (option: SelectOption) => {\n if (option.disabled || !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-flex gridui-u-min-w-0 gridui-u-items-stretch gridui-u-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-flex gridui-u-flex-1 gridui-u-items-center gridui-u-gap-gridui-8 gridui-u-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-min-w-0 gridui-u-flex-1 gridui-u-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-flex gridui-u-w-auto gridui-u-shrink-0 gridui-u-items-center gridui-u-justify-center gridui-u-min-w-11 gridui-u-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-controls={`${id}-list`}\n aria-activedescendant={activeOptionId}\n value={query ?? \"\"}\n className={cn(controlVariants({ size: \"small\" }), \"gridui-u-mb-gridui-4 gridui-u-shrink-0\")}\n onChange={(event) => {\n searchOptions.changeQuery(event.target.value);\n }}\n onKeyDown={(event) => {\n if (event.nativeEvent.isComposing) {\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 {!visible.length && (<div\n role=\"status\"\n className={selectEmptyStyles()}\n >\n {emptyLabel}\n </div>)}\n </SelectionPopup>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Select\n * @description Style\n */\n\nimport { selectItemStyles } from \"../shared/style\";\nimport { overlaySurfaceStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const selectContentStyles = cva(cn(\n overlaySurfaceStyles(),\n \"gridui-u-z-(--gridui-z-popover) gridui-u-p-gridui-4 gridui-u-type-data\",\n \"gridui-select-content gridui-u-box-border gridui-u-relative gridui-u-flex gridui-u-flex-col gridui-u-overflow-hidden gridui-u-min-w-0 gridui-u-w-(--anchor-width) gridui-u-max-w-(--available-width) gridui-u-max-h-(--available-height)\",\n));\n\nexport const selectMenuItemStyles = cva(cn(selectItemStyles(), \"gridui-u-relative gridui-u-px-gridui-4 gridui-u-pr-9\"));\n\nexport const selectIndicatorStyles = cva(\"gridui-u-absolute gridui-u-inset-y-0 gridui-u-right-gridui-4 gridui-u-flex gridui-u-w-gridui-16 gridui-u-items-center gridui-u-justify-center gridui-u-text-foreground\");\n\nexport const selectScrollArrowStyles = cva(\"gridui-u-absolute gridui-u-inset-x-0 gridui-u-z-(--gridui-z-content) gridui-u-flex gridui-u-h-gridui-24 gridui-u-items-center gridui-u-justify-center gridui-u-bg-background gridui-u-text-foreground\", {\n variants: {\n direction: {\n up: \"gridui-u-top-0\",\n down: \"gridui-u-bottom-0\",\n },\n },\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 { SelectGroup, SelectOption } from \"../shared/types\";\nimport { selectIndicatorStyles, selectMenuItemStyles } from \"./style\";\nimport { dropdownLabelStyles } from \"@gridui/dropdown-menu\";\nimport { 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 = {\n readonly options: readonly (SelectOption | SelectGroup)[];\n readonly id: string;\n readonly label?: string | undefined;\n};\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={dropdownLabelStyles()}\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={selectMenuItemStyles()}\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 <Primitive.ItemIndicator\n className={selectIndicatorStyles()}\n aria-hidden=\"true\"\n >\n <Check\n size={16}\n />\n </Primitive.ItemIndicator>\n </Primitive.Item>);\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/selection-actions\";\nimport { SelectionForm } from \"../shared/selection-form\";\nimport { selectIconStyles } from \"../shared/style\";\nimport type { SelectionProps } from \"../shared/types\";\nimport { useSelectionPopup } from \"../shared/use-selection-popup\";\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-relative gridui-u-flex gridui-u-min-w-0 gridui-u-w-full gridui-u-items-stretch gridui-u-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-flex gridui-u-flex-1 gridui-u-items-center gridui-u-gap-gridui-8 gridui-u-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-min-w-0 gridui-u-flex-1 gridui-u-whitespace-normal gridui-u-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-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-flex gridui-u-w-auto gridui-u-shrink-0 gridui-u-items-center gridui-u-justify-center gridui-u-min-w-11 gridui-u-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-relative gridui-u-flex gridui-u-min-h-0 gridui-u-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"],
|
|
5
|
-
"mappings": ";AAOA,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,mBAAmB,IAAI,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAEzE,IAAM,mBAAmB,IAAI,8FAA8F;AAE3H,IAAM,4BAA4B,IAAI,oFAAoF;AAE1H,IAAM,gCAAgC,IAAI,+EAA+E;AAEzH,IAAM,mBA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sx", "jsxs", "jsx", "jsxs", "jsx", "useEffect", "useRef", "useState", "flushSync", "useRef", "useState", "cva", "cn", "Primitive", "useRef", "jsx", "jsxs", "controlVariants", "cn", "Primitive", "ChevronDown", "X", "useId", "useRef", "jsx", "jsxs", "overlaySurfaceStyles", "cn", "cva", "dropdownLabelStyles", "useInteractionOutline", "useScrollbars", "Primitive", "Check", "useId", "jsx", "jsxs", "controlVariants", "interactionLayerProps", "cn", "Primitive", "ChevronDown", "X", "useId", "useRef", "useState", "jsx", "jsxs"]
|
|
3
|
+
"sources": ["../src/shared/style.ts", "../src/shared/combobox-options.tsx", "../src/shared/selection-actions.tsx", "../src/shared/selection-form.tsx", "../src/shared/selection-popup.tsx", "../src/shared/options.ts", "../src/shared/scroll-option.ts", "../src/shared/use-search-options.ts", "../src/shared/use-selection-popup.ts", "../src/shared/use-selection-value.ts", "../src/combobox/style.ts", "../src/combobox/combobox.tsx", "../src/multi-select/multi-select.tsx", "../src/select/style.ts", "../src/select/select-options.tsx", "../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 { dropdownItemStyles } from \"@gridui/dropdown-menu\";\nimport { overlaySurfaceStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const selectItemStyles = cva(cn(dropdownItemStyles(), \"gridui-u-min-w-0\"));\n\nexport const selectIconStyles = cva(\"gridui-u-inline-flex gridui-u-shrink-0 gridui-u-items-center gridui-u-[&_svg]:size-gridui-16\");\n\nexport const selectOptionContentStyles = cva(\"gridui-u-min-w-0 gridui-u-flex-1 gridui-u-whitespace-normal gridui-u-wrap-anywhere\");\n\nexport const selectOptionDescriptionStyles = cva(\"gridui-u-block gridui-u-text-muted gridui-u-type-caption gridui-u-mt-gridui-4\");\n\nexport const selectListStyles = cva(\"gridui-u-min-h-0 gridui-u-overflow-y-auto\");\n\nexport const selectEmptyStyles = cva(\"gridui-u-p-gridui-8 gridui-u-text-muted gridui-u-type-caption\");\n\nexport const selectActionsStyles = cva(\"gridui-u-shrink-0 gridui-u-border-t gridui-u-border-border gridui-u-pt-gridui-4\");\n\nexport const selectActionStyles = cva(cn(\n selectItemStyles(),\n \"gridui-u-w-full gridui-u-text-start gridui-u-whitespace-normal gridui-u-wrap-anywhere\",\n));\n\nexport const comboboxContentStyles = cva(cn(\n overlaySurfaceStyles(),\n \"gridui-u-z-(--gridui-z-popover) gridui-u-p-gridui-4 gridui-u-type-data\",\n \"gridui-combobox-content gridui-u-box-border gridui-u-flex gridui-u-flex-col gridui-u-overflow-hidden gridui-u-min-w-0 gridui-u-w-(--anchor-width) gridui-u-max-h-(--available-height) gridui-u-max-w-(--available-width)\",\n));\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Shared\n * @description Combobox Options\n */\n\nimport { selectIconStyles, selectItemStyles, selectListStyles, selectOptionContentStyles, selectOptionDescriptionStyles } from \"./style\";\nimport type { SelectGroup, SelectOption } from \"./types\";\nimport { dropdownIndicatorStyles, dropdownLabelStyles } from \"@gridui/dropdown-menu\";\nimport { useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { Check } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type ComboboxOptionsProps = {\n readonly id: string;\n readonly label: string;\n readonly options: readonly (SelectOption | SelectGroup)[];\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={selectItemStyles()}\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 <span\n className={dropdownIndicatorStyles()}\n aria-hidden=\"true\"\n >\n {checked && (<Check\n size={16}\n />)}\n </span>\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 </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={dropdownLabelStyles()}\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 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-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 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\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\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\n * @description Use Search Options\n */\n\nimport { filterOptions, flattenOptions } from \"./options\";\nimport { scrollOption } from \"./scroll-option\";\nimport type { SelectGroup, SelectionSearchProps, SelectOption } from \"./types\";\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 Shared\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 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-pr-11 gridui-u-text-ellipsis\");\n\nexport const comboboxTriggerStyles = cva(\"gridui-u-absolute gridui-u-inset-y-0 gridui-u-right-0 gridui-u-flex gridui-u-w-9 gridui-u-items-center gridui-u-justify-center gridui-u-rounded-control gridui-u-text-foreground gridui-u-cursor-pointer gridui-u-disabled:cursor-not-allowed gridui-u-disabled:opacity-50\");\n", "/**\n * @author WMXPY\n * @package Select\n * @namespace Combobox\n * @description Combobox\n */\n\nimport { ComboboxOptions } from \"../shared/combobox-options\";\nimport { SelectionActions } from \"../shared/selection-actions\";\nimport { SelectionForm } from \"../shared/selection-form\";\nimport { SelectionPopup } from \"../shared/selection-popup\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectionProps, SelectionSearchProps, SelectOption } from \"../shared/types\";\nimport { useSearchOptions } from \"../shared/use-search-options\";\nimport { useSelectionPopup } from \"../shared/use-selection-popup\";\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 & {\n readonly searchLabel: string;\n readonly emptyLabel: string;\n };\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-relative gridui-u-flex gridui-u-min-w-0 gridui-u-w-full gridui-u-items-stretch gridui-u-gap-gridui-4\"\n dir={dir}\n >\n <Primitive.Anchor\n asChild\n >\n <div\n ref={anchorRef}\n className=\"gridui-u-relative gridui-u-flex gridui-u-min-w-0 gridui-u-flex-1 gridui-u-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-flex gridui-u-w-auto gridui-u-shrink-0 gridui-u-items-center gridui-u-justify-center gridui-u-min-w-11 gridui-u-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-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 { ComboboxOptions } from \"../shared/combobox-options\";\nimport { SelectionPopup } from \"../shared/selection-popup\";\nimport { selectEmptyStyles } from \"../shared/style\";\nimport type { SelectGroup, SelectionSearchProps, SelectOption } from \"../shared/types\";\nimport { useSearchOptions } from \"../shared/use-search-options\";\nimport { useSelectionPopup } from \"../shared/use-selection-popup\";\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 & SelectionSearchProps & {\n readonly options: readonly (SelectOption | SelectGroup)[];\n readonly placeholder: string;\n readonly searchLabel: string;\n readonly emptyLabel: string;\n readonly clearLabel?: string;\n readonly required?: boolean;\n readonly portalContainer?: HTMLElement | null;\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-flex gridui-u-min-w-0 gridui-u-items-stretch gridui-u-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-flex gridui-u-flex-1 gridui-u-items-center gridui-u-gap-gridui-8 gridui-u-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-min-w-0 gridui-u-flex-1 gridui-u-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-flex gridui-u-w-auto gridui-u-shrink-0 gridui-u-items-center gridui-u-justify-center gridui-u-min-w-11 gridui-u-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-mb-gridui-4 gridui-u-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-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 Style\n */\n\nimport { selectItemStyles } from \"../shared/style\";\nimport { overlaySurfaceStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const selectContentStyles = cva(cn(\n overlaySurfaceStyles(),\n \"gridui-u-z-(--gridui-z-popover) gridui-u-p-gridui-4 gridui-u-type-data\",\n \"gridui-select-content gridui-u-box-border gridui-u-relative gridui-u-flex gridui-u-flex-col gridui-u-overflow-hidden gridui-u-min-w-0 gridui-u-w-(--anchor-width) gridui-u-max-w-(--available-width) gridui-u-max-h-(--available-height)\",\n));\n\nexport const selectMenuItemStyles = cva(cn(selectItemStyles(), \"gridui-u-relative gridui-u-px-gridui-4 gridui-u-pr-9\"));\n\nexport const selectIndicatorStyles = cva(\"gridui-u-absolute gridui-u-inset-y-0 gridui-u-right-gridui-4 gridui-u-flex gridui-u-w-gridui-16 gridui-u-items-center gridui-u-justify-center gridui-u-text-foreground\");\n\nexport const selectScrollArrowStyles = cva(\"gridui-u-absolute gridui-u-inset-x-0 gridui-u-z-(--gridui-z-content) gridui-u-flex gridui-u-h-gridui-24 gridui-u-items-center gridui-u-justify-center gridui-u-bg-background gridui-u-text-foreground\", {\n variants: {\n direction: {\n up: \"gridui-u-top-0\",\n down: \"gridui-u-bottom-0\",\n },\n },\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 { SelectGroup, SelectOption } from \"../shared/types\";\nimport { selectIndicatorStyles, selectMenuItemStyles } from \"./style\";\nimport { dropdownLabelStyles } from \"@gridui/dropdown-menu\";\nimport { 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 = {\n readonly options: readonly (SelectOption | SelectGroup)[];\n readonly id: string;\n readonly label?: string | undefined;\n};\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={dropdownLabelStyles()}\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={selectMenuItemStyles()}\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 <Primitive.ItemIndicator\n className={selectIndicatorStyles()}\n aria-hidden=\"true\"\n >\n <Check\n size={16}\n />\n </Primitive.ItemIndicator>\n </Primitive.Item>);\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/selection-actions\";\nimport { SelectionForm } from \"../shared/selection-form\";\nimport { selectIconStyles } from \"../shared/style\";\nimport type { SelectionProps } from \"../shared/types\";\nimport { useSelectionPopup } from \"../shared/use-selection-popup\";\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-relative gridui-u-flex gridui-u-min-w-0 gridui-u-w-full gridui-u-items-stretch gridui-u-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-flex gridui-u-flex-1 gridui-u-items-center gridui-u-gap-gridui-8 gridui-u-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-min-w-0 gridui-u-flex-1 gridui-u-whitespace-normal gridui-u-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-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-flex gridui-u-w-auto gridui-u-shrink-0 gridui-u-items-center gridui-u-justify-center gridui-u-min-w-11 gridui-u-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-relative gridui-u-flex gridui-u-min-h-0 gridui-u-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,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,mBAAmB,IAAI,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAEzE,IAAM,mBAAmB,IAAI,8FAA8F;AAE3H,IAAM,4BAA4B,IAAI,oFAAoF;AAE1H,IAAM,gCAAgC,IAAI,+EAA+E;AAEzH,IAAM,mBAAmB,IAAI,2CAA2C;AAExE,IAAM,oBAAoB,IAAI,+DAA+D;AAE7F,IAAM,sBAAsB,IAAI,iFAAiF;AAEjH,IAAM,qBAAqB,IAAI;AAAA,EAClC,iBAAiB;AAAA,EACjB;AACJ,CAAC;AAEM,IAAM,wBAAwB,IAAI;AAAA,EACrC,qBAAqB;AAAA,EACrB;AAAA,EACA;AACJ,CAAC;;;AC1BD,SAAS,yBAAyB,2BAA2B;AAC7D,SAAS,uBAAuB,qBAAqB;AACrD,SAAS,aAAa;AAoDO,cAUjB,YAViB;AArCtB,IAAM,kBAA4C,CAAC,UAAgC;AACtF,QAAM,EAAE,IAAI,OAAO,SAAS,UAAU,UAA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,MAAM,SAAS;AAAA,IAC5F;AAAA,IACA,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACX;AACJ;",
|
|
6
|
+
"names": ["jsx", "jsxs", "jsx", "jsxs", "jsx", "useRef", "useEffect", "useRef", "useState", "flushSync", "useRef", "useState", "cva", "isComposingKeyEvent", "cn", "Primitive", "useRef", "jsx", "jsxs", "filterOptions", "controlVariants", "isComposingKeyEvent", "cn", "Primitive", "ChevronDown", "X", "useId", "useRef", "jsx", "jsxs", "filterOptions", "overlaySurfaceStyles", "cn", "cva", "dropdownLabelStyles", "useInteractionOutline", "useScrollbars", "Primitive", "Check", "useId", "jsx", "jsxs", "controlVariants", "interactionLayerProps", "cn", "Primitive", "ChevronDown", "X", "useId", "useRef", "useState", "jsx", "jsxs", "useEffect", "useState"]
|
|
7
7
|
}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* @namespace MultiSelect
|
|
5
5
|
* @description Multi Select
|
|
6
6
|
*/
|
|
7
|
-
import type { SelectGroup, SelectOption } from "../shared/types";
|
|
7
|
+
import type { SelectGroup, SelectionSearchProps, SelectOption } from "../shared/types";
|
|
8
8
|
import { type ListFieldProps } from "@gridui/form";
|
|
9
9
|
import { type ComponentPropsWithRef, type FC } from "react";
|
|
10
|
-
export type MultiSelectProps = Omit<ComponentPropsWithRef<"button">, "children" | "value" | "defaultValue" | "onChange" | "type"> & ListFieldProps & {
|
|
10
|
+
export type MultiSelectProps = Omit<ComponentPropsWithRef<"button">, "children" | "value" | "defaultValue" | "onChange" | "type"> & ListFieldProps & SelectionSearchProps & {
|
|
11
11
|
readonly options: readonly (SelectOption | SelectGroup)[];
|
|
12
12
|
readonly placeholder: string;
|
|
13
13
|
readonly searchLabel: string;
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -47,3 +47,12 @@ export interface SelectionProps extends SelectionValueProps {
|
|
|
47
47
|
readonly required?: boolean;
|
|
48
48
|
readonly disabled?: boolean;
|
|
49
49
|
}
|
|
50
|
+
export type SelectionSearchProps = {
|
|
51
|
+
readonly query?: string | undefined;
|
|
52
|
+
readonly onQueryChange?: ((query: string) => void) | undefined;
|
|
53
|
+
readonly filterOptions?: boolean | undefined;
|
|
54
|
+
readonly loading?: boolean | undefined;
|
|
55
|
+
readonly loadingLabel?: string | undefined;
|
|
56
|
+
readonly errorLabel?: string | undefined;
|
|
57
|
+
readonly resultCountLabel?: ((count: number) => string) | undefined;
|
|
58
|
+
};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @namespace Shared
|
|
5
5
|
* @description Use Search Options
|
|
6
6
|
*/
|
|
7
|
-
import type { SelectGroup, SelectOption } from "./types";
|
|
8
|
-
export declare const useSearchOptions: (options: readonly (SelectOption | SelectGroup)[], selected: readonly string[], listId: string, open: boolean) => {
|
|
7
|
+
import type { SelectGroup, SelectionSearchProps, SelectOption } from "./types";
|
|
8
|
+
export declare const useSearchOptions: (options: readonly (SelectOption | SelectGroup)[], selected: readonly string[], listId: string, open: boolean, searchProps?: SelectionSearchProps) => {
|
|
9
9
|
all: SelectOption[];
|
|
10
10
|
filtered: readonly (SelectOption | SelectGroup)[];
|
|
11
11
|
visible: SelectOption[];
|
package/dist/styles.css
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Select
|
|
4
|
+
* @namespace UseAsyncOptions
|
|
5
|
+
* @description Request
|
|
6
|
+
*/
|
|
7
|
+
export type AsyncOptionsLoader<T> = (query: string, signal: AbortSignal) => Promise<readonly T[]>;
|
|
8
|
+
export type AsyncOptionsState<T> = {
|
|
9
|
+
readonly query: string;
|
|
10
|
+
readonly options: readonly T[];
|
|
11
|
+
readonly loading: boolean;
|
|
12
|
+
readonly error: unknown;
|
|
13
|
+
};
|
|
14
|
+
export declare const createOptionsRequest: <T>(loadOptions: AsyncOptionsLoader<T>, onState: (state: AsyncOptionsState<T>) => void) => {
|
|
15
|
+
run: (query: string) => Promise<void>;
|
|
16
|
+
cancel: () => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Select
|
|
4
|
+
* @namespace UseAsyncOptions
|
|
5
|
+
* @description Use Async Options
|
|
6
|
+
*/
|
|
7
|
+
import { type AsyncOptionsLoader, type AsyncOptionsState } from "./request";
|
|
8
|
+
export type UseAsyncOptionsOptions<T> = {
|
|
9
|
+
readonly query: string;
|
|
10
|
+
readonly loadOptions: AsyncOptionsLoader<T>;
|
|
11
|
+
readonly debounceMs?: number;
|
|
12
|
+
readonly enabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const useAsyncOptions: <T>({ query, loadOptions, debounceMs, enabled }: UseAsyncOptionsOptions<T>) => AsyncOptionsState<T>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"name": "@gridui/select",
|
|
4
|
+
"version": "1.1.1",
|
|
5
|
+
"category": "core",
|
|
6
|
+
"description": "GridUI React select",
|
|
7
|
+
"usage": "Input supplies control styles, Overlay supplies the popup surface and motion, DropdownMenu supplies option-row styles, and Form hides MultiSelect’s native multiple-value bridge. Applications own routes, labels, state persistence, and branding.",
|
|
8
|
+
"documentation": [
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"exports": [
|
|
12
|
+
{
|
|
13
|
+
"name": "AsyncOptionsLoader",
|
|
14
|
+
"kind": "type",
|
|
15
|
+
"importPath": "@gridui/select"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "AsyncOptionsState",
|
|
19
|
+
"kind": "type",
|
|
20
|
+
"importPath": "@gridui/select"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Combobox",
|
|
24
|
+
"kind": "component",
|
|
25
|
+
"importPath": "@gridui/select"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "ComboboxProps",
|
|
29
|
+
"kind": "type",
|
|
30
|
+
"importPath": "@gridui/select"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "MultiSelect",
|
|
34
|
+
"kind": "component",
|
|
35
|
+
"importPath": "@gridui/select"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "MultiSelectProps",
|
|
39
|
+
"kind": "type",
|
|
40
|
+
"importPath": "@gridui/select"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "Select",
|
|
44
|
+
"kind": "component",
|
|
45
|
+
"importPath": "@gridui/select"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "SelectAction",
|
|
49
|
+
"kind": "type",
|
|
50
|
+
"importPath": "@gridui/select"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "SelectGroup",
|
|
54
|
+
"kind": "type",
|
|
55
|
+
"importPath": "@gridui/select"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "SelectionSearchProps",
|
|
59
|
+
"kind": "type",
|
|
60
|
+
"importPath": "@gridui/select"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "SelectOption",
|
|
64
|
+
"kind": "type",
|
|
65
|
+
"importPath": "@gridui/select"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "SelectProps",
|
|
69
|
+
"kind": "type",
|
|
70
|
+
"importPath": "@gridui/select"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "useAsyncOptions",
|
|
74
|
+
"kind": "function",
|
|
75
|
+
"importPath": "@gridui/select"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "UseAsyncOptionsOptions",
|
|
79
|
+
"kind": "type",
|
|
80
|
+
"importPath": "@gridui/select"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"styles": [
|
|
84
|
+
"@gridui/theme/styles.css",
|
|
85
|
+
"@gridui/overlay/styles.css",
|
|
86
|
+
"@gridui/input/styles.css",
|
|
87
|
+
"@gridui/form/styles.css",
|
|
88
|
+
"@gridui/dropdown-menu/styles.css",
|
|
89
|
+
"@gridui/select/styles.css"
|
|
90
|
+
],
|
|
91
|
+
"examples": [
|
|
92
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/combobox.stories.tsx",
|
|
93
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/multi-select.stories.tsx",
|
|
94
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/select.stories.tsx"
|
|
95
|
+
]
|
|
96
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/select",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "GridUI React select",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs"
|
|
10
11
|
],
|
|
11
12
|
"sideEffects": [
|
|
12
13
|
"**/*.css"
|
|
@@ -26,21 +27,22 @@
|
|
|
26
27
|
"react-dom": "^19.2.0"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@gridui/dropdown-menu": "^1.1.
|
|
30
|
-
"@gridui/form": "^3.0.
|
|
31
|
-
"@gridui/input": "^1.1.
|
|
32
|
-
"@gridui/
|
|
33
|
-
"@gridui/
|
|
34
|
-
"@gridui/
|
|
30
|
+
"@gridui/dropdown-menu": "^1.1.7",
|
|
31
|
+
"@gridui/form": "^3.0.2",
|
|
32
|
+
"@gridui/input": "^1.1.6",
|
|
33
|
+
"@gridui/interaction": "^1.2.1",
|
|
34
|
+
"@gridui/overlay": "^1.2.2",
|
|
35
|
+
"@gridui/style-utils": "^2.2.2",
|
|
36
|
+
"@gridui/theme": "^2.5.3",
|
|
35
37
|
"@radix-ui/react-popover": "1.3.1",
|
|
36
38
|
"@radix-ui/react-select": "2.4.1",
|
|
37
39
|
"class-variance-authority": "0.7.1",
|
|
38
|
-
"lucide-react": "1.
|
|
40
|
+
"lucide-react": "1.69.0"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
43
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
42
44
|
"@jest/globals": "30.5.2",
|
|
43
|
-
"@storybook/react-vite": "10.6.
|
|
45
|
+
"@storybook/react-vite": "10.6.6",
|
|
44
46
|
"@types/jest": "30.0.0",
|
|
45
47
|
"@types/node": "26.6.6",
|
|
46
48
|
"@types/react": "19.3.0",
|