@gridui/select 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -7
- package/dist/autocomplete/autocomplete.d.ts +20 -0
- package/dist/combobox/combobox.d.ts +2 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +692 -473
- package/dist/index.js.map +4 -4
- package/dist/multi-select/multi-select.d.ts +2 -8
- package/dist/select/select-options.d.ts +2 -6
- package/dist/select/style.d.ts +0 -2
- package/dist/shared/{selection-actions.d.ts → popup/selection-actions.d.ts} +2 -2
- package/dist/shared/{selection-popup.d.ts → popup/selection-popup.d.ts} +1 -1
- package/dist/shared/{use-selection-popup.d.ts → popup/use-selection-popup.d.ts} +2 -2
- package/dist/shared/{combobox-options.d.ts → search/combobox-options.d.ts} +3 -5
- package/dist/shared/{scroll-option.d.ts → search/scroll-option.d.ts} +1 -1
- package/dist/shared/{use-search-options.d.ts → search/use-search-options.d.ts} +2 -2
- package/dist/shared/style.d.ts +0 -1
- package/dist/shared/types.d.ts +16 -4
- package/dist/styles.css +55 -81
- package/docs/catalog.json +21 -5
- package/docs/reference/README.md +7 -0
- package/docs/reference/autocomplete.md +127 -0
- package/docs/reference/combobox.md +149 -0
- package/docs/reference/multi-select.md +139 -0
- package/docs/reference/select.md +121 -0
- package/package.json +6 -7
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @author WMXPY
|
|
3
3
|
* @package Select
|
|
4
|
-
* @namespace
|
|
4
|
+
* @namespace Shared_Search
|
|
5
5
|
* @description Use Search Options
|
|
6
6
|
*/
|
|
7
|
-
import type { SelectGroup, SelectionSearchProps, SelectOption } from "
|
|
7
|
+
import type { SelectGroup, SelectionSearchProps, SelectOption } from "../types";
|
|
8
8
|
export declare const useSearchOptions: (options: readonly (SelectOption | SelectGroup)[], selected: readonly string[], listId: string, open: boolean, searchProps?: SelectionSearchProps) => {
|
|
9
9
|
all: SelectOption[];
|
|
10
10
|
filtered: readonly (SelectOption | SelectGroup)[];
|
package/dist/shared/style.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* @namespace Shared
|
|
5
5
|
* @description Style
|
|
6
6
|
*/
|
|
7
|
-
export declare const selectItemStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
8
7
|
export declare const selectIconStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
8
|
export declare const selectOptionContentStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
10
9
|
export declare const selectOptionDescriptionStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -36,15 +36,23 @@ export interface SelectionValueProps {
|
|
|
36
36
|
readonly defaultValue?: string;
|
|
37
37
|
readonly onValueChange?: (value: string) => void;
|
|
38
38
|
}
|
|
39
|
-
export interface
|
|
39
|
+
export interface SelectionOptionSource {
|
|
40
40
|
readonly options: readonly (SelectOption | SelectGroup)[];
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
}
|
|
42
|
+
export interface SelectionControlOptions extends SelectionOptionSource {
|
|
43
43
|
readonly clearLabel?: string;
|
|
44
44
|
readonly portalContainer?: HTMLElement | null;
|
|
45
|
+
readonly required?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface SelectionSearchLabels {
|
|
48
|
+
readonly searchLabel: string;
|
|
49
|
+
readonly emptyLabel: string;
|
|
50
|
+
}
|
|
51
|
+
export interface SelectionProps extends SelectionValueProps, SelectionControlOptions {
|
|
52
|
+
readonly actions?: readonly SelectAction[];
|
|
53
|
+
readonly controlSize?: "standard" | "small";
|
|
45
54
|
readonly name?: string;
|
|
46
55
|
readonly form?: string;
|
|
47
|
-
readonly required?: boolean;
|
|
48
56
|
readonly disabled?: boolean;
|
|
49
57
|
}
|
|
50
58
|
export type SelectionSearchProps = {
|
|
@@ -56,3 +64,7 @@ export type SelectionSearchProps = {
|
|
|
56
64
|
readonly errorLabel?: string | undefined;
|
|
57
65
|
readonly resultCountLabel?: ((count: number) => string) | undefined;
|
|
58
66
|
};
|
|
67
|
+
export type SelectionListOptions = SelectionOptionSource & {
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly label?: string | undefined;
|
|
70
|
+
};
|
package/dist/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer theme {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
@layer utilities {
|
|
10
|
-
.gridui-u-sr-only {
|
|
10
|
+
.gridui-u-select--sr-only {
|
|
11
11
|
position: absolute;
|
|
12
12
|
width: 1px;
|
|
13
13
|
height: 1px;
|
|
@@ -18,188 +18,162 @@
|
|
|
18
18
|
white-space: nowrap;
|
|
19
19
|
border-width: 0;
|
|
20
20
|
}
|
|
21
|
-
.gridui-u-absolute {
|
|
21
|
+
.gridui-u-select--absolute {
|
|
22
22
|
position: absolute;
|
|
23
23
|
}
|
|
24
|
-
.gridui-u-relative {
|
|
24
|
+
.gridui-u-select--relative {
|
|
25
25
|
position: relative;
|
|
26
26
|
}
|
|
27
|
-
.gridui-u-inset-x-0 {
|
|
27
|
+
.gridui-u-select--inset-x-0 {
|
|
28
28
|
inset-inline: 0px;
|
|
29
29
|
}
|
|
30
|
-
.gridui-u-inset-y-0 {
|
|
30
|
+
.gridui-u-select--inset-y-0 {
|
|
31
31
|
inset-block: 0px;
|
|
32
32
|
}
|
|
33
|
-
.gridui-u-top-0 {
|
|
33
|
+
.gridui-u-select--top-0 {
|
|
34
34
|
top: 0px;
|
|
35
35
|
}
|
|
36
|
-
.gridui-u-right-0 {
|
|
36
|
+
.gridui-u-select--right-0 {
|
|
37
37
|
right: 0px;
|
|
38
38
|
}
|
|
39
|
-
.gridui-u-
|
|
40
|
-
right: var(--gridui-space-4);
|
|
41
|
-
}
|
|
42
|
-
.gridui-u-bottom-0 {
|
|
39
|
+
.gridui-u-select--bottom-0 {
|
|
43
40
|
bottom: 0px;
|
|
44
41
|
}
|
|
45
|
-
.gridui-u-z-\(--gridui-z-content\) {
|
|
42
|
+
.gridui-u-select--z-\(--gridui-z-content\) {
|
|
46
43
|
z-index: var(--gridui-z-content);
|
|
47
44
|
}
|
|
48
|
-
.gridui-u-
|
|
49
|
-
|
|
45
|
+
.gridui-u-select--m-gridui-8 {
|
|
46
|
+
margin: var(--gridui-space-8);
|
|
50
47
|
}
|
|
51
|
-
.gridui-u-mt-gridui-4 {
|
|
48
|
+
.gridui-u-select--mt-gridui-4 {
|
|
52
49
|
margin-top: var(--gridui-space-4);
|
|
53
50
|
}
|
|
54
|
-
.gridui-u-
|
|
55
|
-
margin-bottom: var(--gridui-space-4);
|
|
56
|
-
}
|
|
57
|
-
.gridui-u-box-border {
|
|
51
|
+
.gridui-u-select--box-border {
|
|
58
52
|
box-sizing: border-box;
|
|
59
53
|
}
|
|
60
|
-
.gridui-u-block {
|
|
54
|
+
.gridui-u-select--block {
|
|
61
55
|
display: block;
|
|
62
56
|
}
|
|
63
|
-
.gridui-u-flex {
|
|
57
|
+
.gridui-u-select--flex {
|
|
64
58
|
display: flex;
|
|
65
59
|
}
|
|
66
|
-
.gridui-u-inline-flex {
|
|
60
|
+
.gridui-u-select--inline-flex {
|
|
67
61
|
display: inline-flex;
|
|
68
62
|
}
|
|
69
|
-
.gridui-u-h-gridui-24 {
|
|
63
|
+
.gridui-u-select--h-gridui-24 {
|
|
70
64
|
height: var(--gridui-space-24);
|
|
71
65
|
}
|
|
72
|
-
.gridui-u-max-h-\(--available-height\) {
|
|
66
|
+
.gridui-u-select--max-h-\(--available-height\) {
|
|
73
67
|
max-height: var(--available-height);
|
|
74
68
|
}
|
|
75
|
-
.gridui-u-min-h-0 {
|
|
69
|
+
.gridui-u-select--min-h-0 {
|
|
76
70
|
min-height: 0px;
|
|
77
71
|
}
|
|
78
|
-
.gridui-u-w-\(--anchor-width\) {
|
|
72
|
+
.gridui-u-select--w-\(--anchor-width\) {
|
|
79
73
|
width: var(--anchor-width);
|
|
80
74
|
}
|
|
81
|
-
.gridui-u-w-9 {
|
|
75
|
+
.gridui-u-select--w-9 {
|
|
82
76
|
width: calc(var(--spacing) * 9);
|
|
83
77
|
}
|
|
84
|
-
.gridui-u-w-auto {
|
|
78
|
+
.gridui-u-select--w-auto {
|
|
85
79
|
width: auto;
|
|
86
80
|
}
|
|
87
|
-
.gridui-u-w-full {
|
|
81
|
+
.gridui-u-select--w-full {
|
|
88
82
|
width: 100%;
|
|
89
83
|
}
|
|
90
|
-
.gridui-u-w-
|
|
91
|
-
width: var(--gridui-space-16);
|
|
92
|
-
}
|
|
93
|
-
.gridui-u-max-w-\(--available-width\) {
|
|
84
|
+
.gridui-u-select--max-w-\(--available-width\) {
|
|
94
85
|
max-width: var(--available-width);
|
|
95
86
|
}
|
|
96
|
-
.gridui-u-min-w-0 {
|
|
87
|
+
.gridui-u-select--min-w-0 {
|
|
97
88
|
min-width: 0px;
|
|
98
89
|
}
|
|
99
|
-
.gridui-u-min-w-11 {
|
|
90
|
+
.gridui-u-select--min-w-11 {
|
|
100
91
|
min-width: calc(var(--spacing) * 11);
|
|
101
92
|
}
|
|
102
|
-
.gridui-u-flex-1 {
|
|
93
|
+
.gridui-u-select--flex-1 {
|
|
103
94
|
flex: 1;
|
|
104
95
|
}
|
|
105
|
-
.gridui-u-shrink-0 {
|
|
96
|
+
.gridui-u-select--shrink-0 {
|
|
106
97
|
flex-shrink: 0;
|
|
107
98
|
}
|
|
108
|
-
.gridui-u-cursor-pointer {
|
|
99
|
+
.gridui-u-select--cursor-pointer {
|
|
109
100
|
cursor: pointer;
|
|
110
101
|
}
|
|
111
|
-
.gridui-u-flex-col {
|
|
102
|
+
.gridui-u-select--flex-col {
|
|
112
103
|
flex-direction: column;
|
|
113
104
|
}
|
|
114
|
-
.gridui-u-items-center {
|
|
105
|
+
.gridui-u-select--items-center {
|
|
115
106
|
align-items: center;
|
|
116
107
|
}
|
|
117
|
-
.gridui-u-items-stretch {
|
|
108
|
+
.gridui-u-select--items-stretch {
|
|
118
109
|
align-items: stretch;
|
|
119
110
|
}
|
|
120
|
-
.gridui-u-justify-center {
|
|
111
|
+
.gridui-u-select--justify-center {
|
|
121
112
|
justify-content: center;
|
|
122
113
|
}
|
|
123
|
-
.gridui-u-gap-gridui-4 {
|
|
114
|
+
.gridui-u-select--gap-gridui-4 {
|
|
124
115
|
gap: var(--gridui-space-4);
|
|
125
116
|
}
|
|
126
|
-
.gridui-u-gap-gridui-8 {
|
|
117
|
+
.gridui-u-select--gap-gridui-8 {
|
|
127
118
|
gap: var(--gridui-space-8);
|
|
128
119
|
}
|
|
129
|
-
.gridui-u-overflow-hidden {
|
|
120
|
+
.gridui-u-select--overflow-hidden {
|
|
130
121
|
overflow: hidden;
|
|
131
122
|
}
|
|
132
|
-
.gridui-u-overflow-y-auto {
|
|
123
|
+
.gridui-u-select--overflow-y-auto {
|
|
133
124
|
overflow-y: auto;
|
|
134
125
|
}
|
|
135
|
-
.gridui-u-rounded-control {
|
|
126
|
+
.gridui-u-select--rounded-control {
|
|
136
127
|
border-radius: var(--gridui-control-radius);
|
|
137
128
|
}
|
|
138
|
-
.gridui-u-border-t {
|
|
129
|
+
.gridui-u-select--border-t {
|
|
139
130
|
border-top-style: var(--tw-border-style);
|
|
140
131
|
border-top-width: 1px;
|
|
141
132
|
}
|
|
142
|
-
.gridui-u-border-border {
|
|
133
|
+
.gridui-u-select--border-border {
|
|
143
134
|
border-color: var(--gridui-border);
|
|
144
135
|
}
|
|
145
|
-
.gridui-u-bg-background {
|
|
136
|
+
.gridui-u-select--bg-background {
|
|
146
137
|
background-color: var(--gridui-background);
|
|
147
138
|
}
|
|
148
|
-
.gridui-u-p-gridui-
|
|
149
|
-
padding: var(--gridui-space-4);
|
|
150
|
-
}
|
|
151
|
-
.gridui-u-p-gridui-8 {
|
|
139
|
+
.gridui-u-select--p-gridui-8 {
|
|
152
140
|
padding: var(--gridui-space-8);
|
|
153
141
|
}
|
|
154
|
-
.gridui-u-
|
|
155
|
-
padding-inline: var(--gridui-space-4);
|
|
156
|
-
}
|
|
157
|
-
.gridui-u-pt-gridui-4 {
|
|
158
|
-
padding-top: var(--gridui-space-4);
|
|
159
|
-
}
|
|
160
|
-
.gridui-u-pr-9 {
|
|
161
|
-
padding-right: calc(var(--spacing) * 9);
|
|
162
|
-
}
|
|
163
|
-
.gridui-u-pr-11 {
|
|
142
|
+
.gridui-u-select--pr-11 {
|
|
164
143
|
padding-right: calc(var(--spacing) * 11);
|
|
165
144
|
}
|
|
166
|
-
.gridui-u-text-start {
|
|
145
|
+
.gridui-u-select--text-start {
|
|
167
146
|
text-align: start;
|
|
168
147
|
}
|
|
169
|
-
.gridui-u-type-
|
|
170
|
-
font: var(--gridui-type-data);
|
|
171
|
-
letter-spacing: normal;
|
|
172
|
-
font-variant-numeric: tabular-nums;
|
|
173
|
-
}
|
|
174
|
-
.gridui-u-type-caption {
|
|
148
|
+
.gridui-u-select--type-caption {
|
|
175
149
|
font: var(--gridui-type-caption);
|
|
176
150
|
letter-spacing: normal;
|
|
177
151
|
}
|
|
178
|
-
.gridui-u-wrap-anywhere {
|
|
152
|
+
.gridui-u-select--wrap-anywhere {
|
|
179
153
|
overflow-wrap: anywhere;
|
|
180
154
|
}
|
|
181
|
-
.gridui-u-text-ellipsis {
|
|
155
|
+
.gridui-u-select--text-ellipsis {
|
|
182
156
|
text-overflow: ellipsis;
|
|
183
157
|
}
|
|
184
|
-
.gridui-u-whitespace-normal {
|
|
158
|
+
.gridui-u-select--whitespace-normal {
|
|
185
159
|
white-space: normal;
|
|
186
160
|
}
|
|
187
|
-
.gridui-u-text-foreground {
|
|
161
|
+
.gridui-u-select--text-foreground {
|
|
188
162
|
color: var(--gridui-foreground);
|
|
189
163
|
}
|
|
190
|
-
.gridui-u-text-muted {
|
|
164
|
+
.gridui-u-select--text-muted {
|
|
191
165
|
color: var(--gridui-muted);
|
|
192
166
|
}
|
|
193
|
-
.gridui-u-empty\:hidden:empty {
|
|
167
|
+
.gridui-u-select--empty\:hidden:empty {
|
|
194
168
|
display: none;
|
|
195
169
|
}
|
|
196
|
-
.gridui-u-disabled\:cursor-not-allowed:disabled {
|
|
170
|
+
.gridui-u-select--disabled\:cursor-not-allowed:disabled {
|
|
197
171
|
cursor: not-allowed;
|
|
198
172
|
}
|
|
199
|
-
.gridui-u-disabled\:opacity-50:disabled {
|
|
173
|
+
.gridui-u-select--disabled\:opacity-50:disabled {
|
|
200
174
|
opacity: 50%;
|
|
201
175
|
}
|
|
202
|
-
.gridui-u
|
|
176
|
+
.gridui-u-select--\[\&_svg\]\:size-gridui-16 svg {
|
|
203
177
|
width: var(--gridui-space-16);
|
|
204
178
|
height: var(--gridui-space-16);
|
|
205
179
|
}
|
package/docs/catalog.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/select",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"category": "core",
|
|
6
6
|
"description": "GridUI React select",
|
|
7
|
-
"usage": "Input supplies control styles
|
|
7
|
+
"usage": "Input supplies control styles. Overlay supplies popup surfaces, motion, option rows, group labels, and trailing check slots. Form hides MultiSelect’s native multiple-value bridge. Applications own routes, labels, state persistence, and branding.",
|
|
8
8
|
"documentation": [
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs/reference/README.md",
|
|
11
|
+
"docs/reference/autocomplete.md",
|
|
12
|
+
"docs/reference/combobox.md",
|
|
13
|
+
"docs/reference/multi-select.md",
|
|
14
|
+
"docs/reference/select.md"
|
|
10
15
|
],
|
|
11
16
|
"exports": [
|
|
12
17
|
{
|
|
@@ -19,6 +24,16 @@
|
|
|
19
24
|
"kind": "type",
|
|
20
25
|
"importPath": "@gridui/select"
|
|
21
26
|
},
|
|
27
|
+
{
|
|
28
|
+
"name": "Autocomplete",
|
|
29
|
+
"kind": "component",
|
|
30
|
+
"importPath": "@gridui/select"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "AutocompleteProps",
|
|
34
|
+
"kind": "type",
|
|
35
|
+
"importPath": "@gridui/select"
|
|
36
|
+
},
|
|
22
37
|
{
|
|
23
38
|
"name": "Combobox",
|
|
24
39
|
"kind": "component",
|
|
@@ -83,12 +98,13 @@
|
|
|
83
98
|
"styles": [
|
|
84
99
|
"@gridui/theme/styles.css",
|
|
85
100
|
"@gridui/overlay/styles.css",
|
|
86
|
-
"@gridui/input/styles.css",
|
|
87
101
|
"@gridui/form/styles.css",
|
|
88
|
-
"@gridui/
|
|
102
|
+
"@gridui/button/styles.css",
|
|
103
|
+
"@gridui/input/styles.css",
|
|
89
104
|
"@gridui/select/styles.css"
|
|
90
105
|
],
|
|
91
106
|
"examples": [
|
|
107
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/autocomplete.stories.tsx",
|
|
92
108
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/combobox.stories.tsx",
|
|
93
109
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/multi-select.stories.tsx",
|
|
94
110
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/select.stories.tsx"
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# Autocomplete
|
|
3
|
+
|
|
4
|
+
Suggests values while accepting arbitrary text. Arrow keys choose a suggestion; typing and dismissal preserve the native text value.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/select`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Autocomplete } from "@gridui/select";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/select/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/autocomplete.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### children
|
|
23
|
+
|
|
24
|
+
``ReactNode`` · Optional
|
|
25
|
+
|
|
26
|
+
Content rendered inside the component.
|
|
27
|
+
|
|
28
|
+
### onFocus
|
|
29
|
+
|
|
30
|
+
``(event: FocusEvent<HTMLInputElement, Element>): void`` · Optional
|
|
31
|
+
|
|
32
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
33
|
+
|
|
34
|
+
### onBlur
|
|
35
|
+
|
|
36
|
+
``(event: FocusEvent<HTMLInputElement, Element>): void`` · Optional
|
|
37
|
+
|
|
38
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
39
|
+
|
|
40
|
+
### onChange
|
|
41
|
+
|
|
42
|
+
``(event: ChangeEvent<HTMLInputElement, HTMLInputElement>): void`` · Optional
|
|
43
|
+
|
|
44
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
45
|
+
|
|
46
|
+
### onSubmit
|
|
47
|
+
|
|
48
|
+
``(event: SubmitEvent<HTMLInputElement>): void`` · Optional
|
|
49
|
+
|
|
50
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
51
|
+
|
|
52
|
+
### onClick
|
|
53
|
+
|
|
54
|
+
``(event: MouseEvent<HTMLInputElement, MouseEvent>): void`` · Optional
|
|
55
|
+
|
|
56
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
57
|
+
|
|
58
|
+
### onValueChange
|
|
59
|
+
|
|
60
|
+
``(value: string): void`` · Optional
|
|
61
|
+
|
|
62
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
63
|
+
|
|
64
|
+
### controlSize
|
|
65
|
+
|
|
66
|
+
``"small" | "standard" | undefined`` · Optional
|
|
67
|
+
|
|
68
|
+
### loading
|
|
69
|
+
|
|
70
|
+
``boolean | undefined`` · Optional
|
|
71
|
+
|
|
72
|
+
### filterOptions
|
|
73
|
+
|
|
74
|
+
``boolean | undefined`` · Optional
|
|
75
|
+
|
|
76
|
+
### loadingLabel
|
|
77
|
+
|
|
78
|
+
``string | undefined`` · Optional
|
|
79
|
+
|
|
80
|
+
### errorLabel
|
|
81
|
+
|
|
82
|
+
``string | undefined`` · Optional
|
|
83
|
+
|
|
84
|
+
### resultCountLabel
|
|
85
|
+
|
|
86
|
+
``((count: number) => string) | undefined`` · Optional
|
|
87
|
+
|
|
88
|
+
### value
|
|
89
|
+
|
|
90
|
+
``string | undefined`` · Optional
|
|
91
|
+
|
|
92
|
+
Controlled value. Pair with the corresponding change callback.
|
|
93
|
+
|
|
94
|
+
### defaultValue
|
|
95
|
+
|
|
96
|
+
``string | undefined`` · Optional
|
|
97
|
+
|
|
98
|
+
Default: ``""``
|
|
99
|
+
|
|
100
|
+
Initial uncontrolled value. Reset the story after changing it.
|
|
101
|
+
|
|
102
|
+
### options
|
|
103
|
+
|
|
104
|
+
``readonly (SelectOption | SelectGroup)[]`` · Required
|
|
105
|
+
|
|
106
|
+
### searchLabel
|
|
107
|
+
|
|
108
|
+
``string`` · Required
|
|
109
|
+
|
|
110
|
+
### emptyLabel
|
|
111
|
+
|
|
112
|
+
``string`` · Required
|
|
113
|
+
|
|
114
|
+
### portalContainer
|
|
115
|
+
|
|
116
|
+
``HTMLElement | undefined`` · Optional
|
|
117
|
+
|
|
118
|
+
### rootClassName
|
|
119
|
+
|
|
120
|
+
``string | undefined`` · Optional
|
|
121
|
+
|
|
122
|
+
### onOptionSelect
|
|
123
|
+
|
|
124
|
+
``(option: SelectOption): void`` · Optional
|
|
125
|
+
|
|
126
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
127
|
+
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# Combobox
|
|
3
|
+
|
|
4
|
+
Combines text input with a list of selectable suggestions. Use it when users need to search a larger set of options.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/select`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Combobox } from "@gridui/select";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/select/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/select/stories/combobox.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### form
|
|
23
|
+
|
|
24
|
+
``string | undefined`` · Optional
|
|
25
|
+
|
|
26
|
+
### onFocus
|
|
27
|
+
|
|
28
|
+
``(event: FocusEvent<HTMLInputElement, Element>): void`` · Optional
|
|
29
|
+
|
|
30
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
31
|
+
|
|
32
|
+
### onBlur
|
|
33
|
+
|
|
34
|
+
``(event: FocusEvent<HTMLInputElement, Element>): void`` · Optional
|
|
35
|
+
|
|
36
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
37
|
+
|
|
38
|
+
### onSubmit
|
|
39
|
+
|
|
40
|
+
``(event: SubmitEvent<HTMLInputElement>): void`` · Optional
|
|
41
|
+
|
|
42
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
43
|
+
|
|
44
|
+
### onClick
|
|
45
|
+
|
|
46
|
+
``(event: MouseEvent<HTMLInputElement, MouseEvent>): void`` · Optional
|
|
47
|
+
|
|
48
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
49
|
+
|
|
50
|
+
### disabled
|
|
51
|
+
|
|
52
|
+
``boolean | undefined`` · Optional
|
|
53
|
+
|
|
54
|
+
Prevents interaction when enabled.
|
|
55
|
+
|
|
56
|
+
### name
|
|
57
|
+
|
|
58
|
+
``string | undefined`` · Optional
|
|
59
|
+
|
|
60
|
+
Native form field name.
|
|
61
|
+
|
|
62
|
+
### required
|
|
63
|
+
|
|
64
|
+
``boolean | undefined`` · Optional
|
|
65
|
+
|
|
66
|
+
Participates in required form validation.
|
|
67
|
+
|
|
68
|
+
### actions
|
|
69
|
+
|
|
70
|
+
``readonly SelectAction[] | undefined`` · Optional
|
|
71
|
+
|
|
72
|
+
Default: ``[]``
|
|
73
|
+
|
|
74
|
+
### controlSize
|
|
75
|
+
|
|
76
|
+
``"small" | "standard" | undefined`` · Optional
|
|
77
|
+
|
|
78
|
+
Default: ``"standard"``
|
|
79
|
+
|
|
80
|
+
### value
|
|
81
|
+
|
|
82
|
+
``string | undefined`` · Optional
|
|
83
|
+
|
|
84
|
+
Controlled value. Pair with the corresponding change callback.
|
|
85
|
+
|
|
86
|
+
### defaultValue
|
|
87
|
+
|
|
88
|
+
``string | undefined`` · Optional
|
|
89
|
+
|
|
90
|
+
Default: ``""``
|
|
91
|
+
|
|
92
|
+
Initial uncontrolled value. Reset the story after changing it.
|
|
93
|
+
|
|
94
|
+
### onValueChange
|
|
95
|
+
|
|
96
|
+
``(value: string): void`` · Optional
|
|
97
|
+
|
|
98
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
99
|
+
|
|
100
|
+
### clearLabel
|
|
101
|
+
|
|
102
|
+
``string | undefined`` · Optional
|
|
103
|
+
|
|
104
|
+
### portalContainer
|
|
105
|
+
|
|
106
|
+
``HTMLElement | null | undefined`` · Optional
|
|
107
|
+
|
|
108
|
+
### options
|
|
109
|
+
|
|
110
|
+
``readonly (SelectOption | SelectGroup)[]`` · Required
|
|
111
|
+
|
|
112
|
+
### query
|
|
113
|
+
|
|
114
|
+
``string | undefined`` · Optional
|
|
115
|
+
|
|
116
|
+
### onQueryChange
|
|
117
|
+
|
|
118
|
+
``(query: string): void`` · Optional
|
|
119
|
+
|
|
120
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
121
|
+
|
|
122
|
+
### filterOptions
|
|
123
|
+
|
|
124
|
+
``boolean | undefined`` · Optional
|
|
125
|
+
|
|
126
|
+
### loading
|
|
127
|
+
|
|
128
|
+
``boolean | undefined`` · Optional
|
|
129
|
+
|
|
130
|
+
### loadingLabel
|
|
131
|
+
|
|
132
|
+
``string | undefined`` · Optional
|
|
133
|
+
|
|
134
|
+
### errorLabel
|
|
135
|
+
|
|
136
|
+
``string | undefined`` · Optional
|
|
137
|
+
|
|
138
|
+
### resultCountLabel
|
|
139
|
+
|
|
140
|
+
``((count: number) => string) | undefined`` · Optional
|
|
141
|
+
|
|
142
|
+
### searchLabel
|
|
143
|
+
|
|
144
|
+
``string`` · Required
|
|
145
|
+
|
|
146
|
+
### emptyLabel
|
|
147
|
+
|
|
148
|
+
``string`` · Required
|
|
149
|
+
|