@fluentui/react-select 0.0.0-nightly-20220525-0423.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.
Files changed (40) hide show
  1. package/CHANGELOG.json +194 -0
  2. package/CHANGELOG.md +96 -0
  3. package/LICENSE +15 -0
  4. package/README.md +9 -0
  5. package/Spec.md +243 -0
  6. package/dist/index.d.ts +68 -0
  7. package/dist/tsdoc-metadata.json +11 -0
  8. package/lib/Select.js +2 -0
  9. package/lib/Select.js.map +1 -0
  10. package/lib/components/Select/Select.js +15 -0
  11. package/lib/components/Select/Select.js.map +1 -0
  12. package/lib/components/Select/Select.types.js +2 -0
  13. package/lib/components/Select/Select.types.js.map +1 -0
  14. package/lib/components/Select/index.js +6 -0
  15. package/lib/components/Select/index.js.map +1 -0
  16. package/lib/components/Select/renderSelect.js +17 -0
  17. package/lib/components/Select/renderSelect.js.map +1 -0
  18. package/lib/components/Select/useSelect.js +56 -0
  19. package/lib/components/Select/useSelect.js.map +1 -0
  20. package/lib/components/Select/useSelectStyles.js +219 -0
  21. package/lib/components/Select/useSelectStyles.js.map +1 -0
  22. package/lib/index.js +2 -0
  23. package/lib/index.js.map +1 -0
  24. package/lib-commonjs/Select.js +10 -0
  25. package/lib-commonjs/Select.js.map +1 -0
  26. package/lib-commonjs/components/Select/Select.js +26 -0
  27. package/lib-commonjs/components/Select/Select.js.map +1 -0
  28. package/lib-commonjs/components/Select/Select.types.js +6 -0
  29. package/lib-commonjs/components/Select/Select.types.js.map +1 -0
  30. package/lib-commonjs/components/Select/index.js +18 -0
  31. package/lib-commonjs/components/Select/index.js.map +1 -0
  32. package/lib-commonjs/components/Select/renderSelect.js +28 -0
  33. package/lib-commonjs/components/Select/renderSelect.js.map +1 -0
  34. package/lib-commonjs/components/Select/useSelect.js +68 -0
  35. package/lib-commonjs/components/Select/useSelect.js.map +1 -0
  36. package/lib-commonjs/components/Select/useSelectStyles.js +230 -0
  37. package/lib-commonjs/components/Select/useSelectStyles.js.map +1 -0
  38. package/lib-commonjs/index.js +40 -0
  39. package/lib-commonjs/index.js.map +1 -0
  40. package/package.json +61 -0
package/CHANGELOG.json ADDED
@@ -0,0 +1,194 @@
1
+ {
2
+ "name": "@fluentui/react-select",
3
+ "entries": [
4
+ {
5
+ "date": "Wed, 25 May 2022 04:35:48 GMT",
6
+ "tag": "@fluentui/react-select_v0.0.0-nightly-20220525-0423.1",
7
+ "version": "0.0.0-nightly-20220525-0423.1",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "sarah.higley@microsoft.com",
12
+ "package": "@fluentui/react-select",
13
+ "commit": "02b40c905e997347f8c910bc51cfbdbdc67de7ee",
14
+ "comment": "add Select to Preview Components"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Mon, 23 May 2022 18:56:51 GMT",
21
+ "tag": "@fluentui/react-select_v9.0.0-beta.0",
22
+ "version": "9.0.0-beta.0",
23
+ "comments": {
24
+ "prerelease": [
25
+ {
26
+ "author": "beachball",
27
+ "package": "@fluentui/react-select",
28
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.9",
29
+ "commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
30
+ },
31
+ {
32
+ "author": "beachball",
33
+ "package": "@fluentui/react-select",
34
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.7",
35
+ "commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
36
+ }
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "date": "Mon, 23 May 2022 12:14:24 GMT",
42
+ "tag": "@fluentui/react-select_v9.0.0-beta.0",
43
+ "version": "9.0.0-beta.0",
44
+ "comments": {
45
+ "prerelease": [
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-select",
49
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.8",
50
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-select",
55
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.9",
56
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
57
+ },
58
+ {
59
+ "author": "beachball",
60
+ "package": "@fluentui/react-select",
61
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.6",
62
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
63
+ }
64
+ ]
65
+ }
66
+ },
67
+ {
68
+ "date": "Thu, 05 May 2022 18:26:30 GMT",
69
+ "tag": "@fluentui/react-select_v9.0.0-beta.0",
70
+ "version": "9.0.0-beta.0",
71
+ "comments": {
72
+ "prerelease": [
73
+ {
74
+ "author": "beachball",
75
+ "package": "@fluentui/react-select",
76
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.7",
77
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
78
+ },
79
+ {
80
+ "author": "beachball",
81
+ "package": "@fluentui/react-select",
82
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.8",
83
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
84
+ },
85
+ {
86
+ "author": "beachball",
87
+ "package": "@fluentui/react-select",
88
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.5",
89
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
90
+ }
91
+ ]
92
+ }
93
+ },
94
+ {
95
+ "date": "Wed, 04 May 2022 13:26:54 GMT",
96
+ "tag": "@fluentui/react-select_v9.0.0-beta.0",
97
+ "version": "9.0.0-beta.0",
98
+ "comments": {
99
+ "prerelease": [
100
+ {
101
+ "author": "beachball",
102
+ "package": "@fluentui/react-select",
103
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.6",
104
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
105
+ },
106
+ {
107
+ "author": "beachball",
108
+ "package": "@fluentui/react-select",
109
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.7",
110
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
111
+ }
112
+ ]
113
+ }
114
+ },
115
+ {
116
+ "date": "Tue, 19 Apr 2022 19:17:29 GMT",
117
+ "tag": "@fluentui/react-select_v9.0.0-beta.0",
118
+ "version": "9.0.0-beta.0",
119
+ "comments": {
120
+ "prerelease": [
121
+ {
122
+ "author": "beachball",
123
+ "package": "@fluentui/react-select",
124
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.5",
125
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
126
+ },
127
+ {
128
+ "author": "beachball",
129
+ "package": "@fluentui/react-select",
130
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.6",
131
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
132
+ },
133
+ {
134
+ "author": "beachball",
135
+ "package": "@fluentui/react-select",
136
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.4",
137
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
138
+ }
139
+ ]
140
+ }
141
+ },
142
+ {
143
+ "date": "Fri, 04 Mar 2022 05:17:40 GMT",
144
+ "tag": "@fluentui/react-select_v9.0.0-beta.0",
145
+ "version": "9.0.0-beta.0",
146
+ "comments": {
147
+ "prerelease": [
148
+ {
149
+ "author": "beachball",
150
+ "package": "@fluentui/react-select",
151
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.5",
152
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
153
+ }
154
+ ]
155
+ }
156
+ },
157
+ {
158
+ "date": "Tue, 01 Mar 2022 02:17:40 GMT",
159
+ "tag": "@fluentui/react-select_v9.0.0-beta.0",
160
+ "version": "9.0.0-beta.0",
161
+ "comments": {
162
+ "prerelease": [
163
+ {
164
+ "author": "beachball",
165
+ "package": "@fluentui/react-select",
166
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.4",
167
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
168
+ }
169
+ ]
170
+ }
171
+ },
172
+ {
173
+ "date": "Fri, 18 Feb 2022 13:35:38 GMT",
174
+ "tag": "@fluentui/react-select_v9.0.0-beta.0",
175
+ "version": "9.0.0-beta.0",
176
+ "comments": {
177
+ "prerelease": [
178
+ {
179
+ "author": "beachball",
180
+ "package": "@fluentui/react-select",
181
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.3",
182
+ "commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
183
+ },
184
+ {
185
+ "author": "beachball",
186
+ "package": "@fluentui/react-select",
187
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.3",
188
+ "commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
189
+ }
190
+ ]
191
+ }
192
+ }
193
+ ]
194
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,96 @@
1
+ # Change Log - @fluentui/react-select
2
+
3
+ This log was last generated on Wed, 25 May 2022 04:35:48 GMT and should not be manually modified.
4
+
5
+ <!-- Start content -->
6
+
7
+ ## [0.0.0-nightly-20220525-0423.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-select_v0.0.0-nightly-20220525-0423.1)
8
+
9
+ Wed, 25 May 2022 04:35:48 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-select_v9.0.0-beta.0..@fluentui/react-select_v0.0.0-nightly-20220525-0423.1)
11
+
12
+ ### Changes
13
+
14
+ - add Select to Preview Components ([PR #23208](https://github.com/microsoft/fluentui/pull/23208) by sarah.higley@microsoft.com)
15
+
16
+ ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-select_v9.0.0-beta.0)
17
+
18
+ Mon, 23 May 2022 18:56:51 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-select_v9.0.0-beta.0..@fluentui/react-select_v9.0.0-beta.0)
20
+
21
+ ### Changes
22
+
23
+ - Bump @fluentui/react-theme to v9.0.0-rc.9 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
24
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.7 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
25
+
26
+ ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-select_v9.0.0-beta.0)
27
+
28
+ Mon, 23 May 2022 12:14:24 GMT
29
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-select_v9.0.0-beta.0..@fluentui/react-select_v9.0.0-beta.0)
30
+
31
+ ### Changes
32
+
33
+ - Bump @fluentui/react-theme to v9.0.0-rc.8 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
34
+ - Bump @fluentui/react-utilities to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
35
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.6 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
36
+
37
+ ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-select_v9.0.0-beta.0)
38
+
39
+ Thu, 05 May 2022 18:26:30 GMT
40
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-select_v9.0.0-beta.0..@fluentui/react-select_v9.0.0-beta.0)
41
+
42
+ ### Changes
43
+
44
+ - Bump @fluentui/react-theme to v9.0.0-rc.7 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
45
+ - Bump @fluentui/react-utilities to v9.0.0-rc.8 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
46
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.5 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
47
+
48
+ ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-select_v9.0.0-beta.0)
49
+
50
+ Wed, 04 May 2022 13:26:54 GMT
51
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-select_v9.0.0-beta.0..@fluentui/react-select_v9.0.0-beta.0)
52
+
53
+ ### Changes
54
+
55
+ - Bump @fluentui/react-theme to v9.0.0-rc.6 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
56
+ - Bump @fluentui/react-utilities to v9.0.0-rc.7 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
57
+
58
+ ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-select_v9.0.0-beta.0)
59
+
60
+ Tue, 19 Apr 2022 19:17:29 GMT
61
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-select_v9.0.0-beta.0..@fluentui/react-select_v9.0.0-beta.0)
62
+
63
+ ### Changes
64
+
65
+ - Bump @fluentui/react-theme to v9.0.0-rc.5 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
66
+ - Bump @fluentui/react-utilities to v9.0.0-rc.6 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
67
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.4 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
68
+
69
+ ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-select_v9.0.0-beta.0)
70
+
71
+ Fri, 04 Mar 2022 05:17:40 GMT
72
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-select_v9.0.0-beta.0..@fluentui/react-select_v9.0.0-beta.0)
73
+
74
+ ### Changes
75
+
76
+ - Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
77
+
78
+ ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-select_v9.0.0-beta.0)
79
+
80
+ Tue, 01 Mar 2022 02:17:40 GMT
81
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-select_v9.0.0-beta.0..@fluentui/react-select_v9.0.0-beta.0)
82
+
83
+ ### Changes
84
+
85
+ - Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
86
+
87
+ ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-select_v9.0.0-beta.0)
88
+
89
+ Fri, 18 Feb 2022 13:35:38 GMT
90
+
91
+ ### Changes
92
+
93
+ - Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
94
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
95
+
96
+ # Change Log - @fluentui/react-select
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ @fluentui/react-select
2
+
3
+ Copyright (c) Microsoft Corporation
4
+
5
+ All rights reserved.
6
+
7
+ MIT License
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+
15
+ Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @fluentui/react-select
2
+
3
+ **React Select components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
4
+
5
+ The Select component provides a styled wrapper around the native `<select>` element. It is recommended over Combobox when features like filtering and virtualization are not required. It provides better cross-platform functionality particularly on mobile, and better accessibility.
6
+
7
+ ## STATUS: WIP 🚧
8
+
9
+ These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
package/Spec.md ADDED
@@ -0,0 +1,243 @@
1
+ # @fluentui/react-select Spec
2
+
3
+ ## Background
4
+
5
+ The Select component allows users to select one value from a predefined set of values. It does so by providing a styled wrapper around the HTML `<select>` element. This means it inherits the dropdown UI and keyboard functionality from the platform.
6
+
7
+ Select is a more lightweight, accessible, and less feature-rich alternative to Combobox. It has better mobile support, and better cross-platform screen reader support. Unlike Combobox, it does not provide filtering, multiple selection, or virtualization. Select is recommended over Combobox when the following are true:
8
+
9
+ - The control is a basic single-select that matches the functionality of a `<select>`
10
+ - Native-feeling cross platform UX (particularly on mobile) is a primary concern
11
+ - Performance, accessibility, and bundle size are primary concerns
12
+
13
+ Combobox is recommended if any of the following are needed:
14
+
15
+ - Filtering or freeform text input
16
+ - Virtualization
17
+ - Control over styling the dropdown and options
18
+ - Multiple selection
19
+
20
+ ## Prior Art
21
+
22
+ The [Open UI research on Select](https://open-ui.org/components/select.research) combines both the ideas of the proposed Fluent Combobox and Select. There is also an [Open UI draft describing the select element](https://open-ui.org/components/select).
23
+
24
+ ### Comparison of v8 and v0
25
+
26
+ `@fluentui/react` has three different controls that are different flavors of select/combobox:
27
+
28
+ - [Combobox](https://developer.microsoft.com/en-us/fluentui#/controls/web/combobox): an editable combobox with a textfield and dropdown listbox
29
+ - [Dropdown](https://developer.microsoft.com/en-us/fluentui#/controls/web/dropdown): a non-editable combobox with dropdown listbox
30
+ - [Pickers](https://developer.microsoft.com/en-us/fluentui#/controls/web/pickers): an editable combobox with greater customization, particularly in displaying selected items
31
+
32
+ `@fluentui/react-northstar` has one combobox control:
33
+
34
+ - [Dropdown](https://fluentsite.z22.web.core.windows.net/0.51.2/components/dropdown/definition): either an editable or non-editable combobox with a tag-like approach to selected items
35
+
36
+ ### Functional variations across v8 and v0 components
37
+
38
+ The main functional variants in existing components are as follows:
39
+
40
+ - Editable vs. non-editable: editable comboboxes have a textbox and allow the user to type, which optionally filters the listbox
41
+ - Within editable comboboxes: freeform text input and filtering on input are optional
42
+ - Within editable comboboxes: When a typed value does not match an option, it can be cleared or preserved on blur
43
+ - Single vs. multiselect
44
+ - Within multiselect: selected options may be presented as text within the combobox value, pills, or a custom render.
45
+
46
+ ### Dropdown options variations across v8 and v0 Components
47
+
48
+ - Options may have an icon, image, text + description, or entirely custom render
49
+ - Options may be grouped with a group header and divider
50
+ - There may be a "load more results" action
51
+ - Within multiselect: There may be a "Select all" option
52
+
53
+ ## Sample Code
54
+
55
+ Default/standard Select:
56
+
57
+ ```tsx
58
+ <label htmlFor="selectID">Choose a color</label>
59
+ <Select id="selectID">
60
+ <option>Red</option>
61
+ <option>Green</option>
62
+ <option>Blue</option>
63
+ </Select>
64
+ ```
65
+
66
+ Select with grouped options:
67
+
68
+ ```tsx
69
+ <label htmlFor="selectID">Choose an animal</label>
70
+ <Select id="selectID">
71
+ <optgroup label="Land">
72
+ <option>Cat</option>
73
+ <option>Dog</option>
74
+ <option>Horse</option>
75
+ </optgroup>
76
+ <optgroup label="Water">
77
+ <option>Dolphin</option>
78
+ <option>Seal</option>
79
+ <option>Shark</option>
80
+ </optgroup>
81
+ </Select>
82
+ ```
83
+
84
+ Inline Select with appearance and size set:
85
+
86
+ ```tsx
87
+ <label htmlFor="selectID">Choose a color</label>
88
+ <Select id="selectID" appearance="filledDarker" size="small" inline>
89
+ <option>Red</option>
90
+ <option>Green</option>
91
+ <option>Blue</option>
92
+ </Select>
93
+ ```
94
+
95
+ Disabled Select with second option selected:
96
+
97
+ ```tsx
98
+ <label htmlFor="selectID">Choose a color</label>
99
+ <Select id="selectID" disabled>
100
+ <option>Red</option>
101
+ <option selected>Green</option>
102
+ <option>Blue</option>
103
+ </Select>
104
+ ```
105
+
106
+ ## Variants
107
+
108
+ ### Layout
109
+
110
+ - Block (default)
111
+ - Inline
112
+
113
+ ### Size
114
+
115
+ - Small
116
+ - Medium (default)
117
+ - Large
118
+
119
+ ### Appearance
120
+
121
+ - Filled darker
122
+ - Filled lighter
123
+ - Outline (default)
124
+ - Transparent
125
+
126
+ ### Unsupported Select variants
127
+
128
+ #### Multiple Selection
129
+
130
+ The Select component does not support multi-select, and does not support the native `multiselect` attribute. Multiple selection is instead provided through the Combobox component. This is because the native `<select multiple>` has poor accessibility and general UX, and we do not recommend using it. Additionally, because the options are not styleable, there is little benefit to using a wrapped `<Select multiple>` over using the native element directly.
131
+
132
+ #### Size attribute
133
+
134
+ For similar reasons to `multiple`, the native `size` attribute is not supported out of the box. It also has very limited styling support, and therefore also has little benefit over the native `<select size="N">`. The Listbox (TODO: confirm name) component is an alternative to using the `size` attribute on a `<select>`.
135
+
136
+ ## API
137
+
138
+ From [Select.types.tsx](https://github.com/microsoft/fluentui/blob/master/packages/react-select/src/components/Select/Select.types.ts)
139
+
140
+ ### Slots
141
+
142
+ In this component, `select` is the primary slot. Since `select` is primary, `root` is a separate explicit slot to customize the wrapper.
143
+
144
+ ```ts
145
+ export type SelectSlots = {
146
+ /** Root of the component, renders as a `<span>`. */
147
+ root: IntrinsicSlotProps<'span'>;
148
+ /** The actual `<select>` element */
149
+ select: IntrinsicSlotProps<'select'>;
150
+ /** the icon, typically a down arrow */
151
+ icon: IntrinsicSlotProps<'span'>;
152
+ };
153
+ ```
154
+
155
+ ### Children
156
+
157
+ Children of the `Select` component are rendered as children of the internal `<select>` element. The only children that are supported in practice are the `<optgroup>` and `<option>` elements.
158
+
159
+ ## Structure
160
+
161
+ - _**Public**_
162
+
163
+ ```tsx
164
+ <label htmlFor="selectID">Choose a color</label>
165
+ <Select id="selectID" className="my-select-class">
166
+ <option>Red</option>
167
+ <option>Green</option>
168
+ <option>Blue</option>
169
+ </Select>
170
+ ```
171
+
172
+ - _**DOM**_
173
+
174
+ ```html
175
+ <label for="selectID">Choose a color</label>
176
+ <span class="my-select-class">
177
+ <select id="selectID">
178
+ <option>Red</option>
179
+ <option>Green</option>
180
+ <option>Blue</option>
181
+ </select>
182
+ <svg><!-- icon --></svg>
183
+ </span>
184
+ ```
185
+
186
+ ## Migration
187
+
188
+ The Select component is a new approach that was not present in `@fluentui/react` v8, or `@fluentui/react-northstar`. It can be considered if the currently used control is the `@fluentui/react` Dropdown component, or the `@fluentui/react-northstar` Dropdown without `search`.
189
+
190
+ ### Props
191
+
192
+ | v8 Dropdown | v0 Dropdown | Proposal |
193
+ | -------------------- | ------------------------- | --------------------------------- |
194
+ | options | items | children |
195
+ | defaultSelectedKey | defaultValue | child with `selected` |
196
+ | selectedKey | value | imperative ref.value |
197
+ | id | n/a | id |
198
+ | disabled | disabled | disabled |
199
+ | required | n/a | required |
200
+ | multiSelect | multiple | use Combobox |
201
+ | placeholder | placeholder | child with `value=""` |
202
+ | ariaLabel | n/a | aria-label |
203
+ | n/a | aria-\* | aria-\* |
204
+ | errorMessage | error | invalid, message handled in Field |
205
+ | label, onRenderLabel | n/a | Handled in Field |
206
+ | componentRef | n/a | ref |
207
+ | n/a | popperRef, popper props | n/a |
208
+ | calloutProps | list | n/a |
209
+ | panelProps | n/a | n/a |
210
+ | openOnKeyboardFocus | n/a | n/a |
211
+ | n/a | a11ySelectedItemsMessage | n/a |
212
+ | n/a | align | n/a |
213
+ | n/a | autosize | n/a |
214
+ | n/a | checkable | n/a |
215
+ | n/a | clearable | n/a |
216
+ | n/a | defaultHighlightedIndex | n/a |
217
+ | n/a | defaultOpen | n/a |
218
+ | n/a | fluid | default style |
219
+ | n/a | headerMessage | optgroup child with `name` |
220
+ | n/a | highlightFirstItemOnOpen | n/a |
221
+ | n/a | highlightedIndex | n/a |
222
+ | n/a | inline | inline |
223
+ | n/a | inverted | n/a |
224
+ | n/a | loading | n/a |
225
+ | n/a | noResultsMessage | use children |
226
+ | n/a | offset | n/a |
227
+ | n/a | open | n/a |
228
+ | n/a | position | n/a |
229
+ | n/a | positionFixed | n/a |
230
+ | n/a | search | use Combobox |
231
+ | styles | styles | style |
232
+ | onRenderCaretDown | toggleIndicator | use icon slot |
233
+ | n/a | triggerButton | n/a |
234
+ | onRenderContainer | n/a | n/a |
235
+ | onRenderItem | renderItem | use children |
236
+ | onRenderList | list slot | n/a |
237
+ | onRenderOption | renderItem, headerMessage | use children |
238
+ | onRenderPlaceholder | n/a | n/a |
239
+ | onRenderTitle | n/a | n/a |
240
+
241
+ ## Behaviors and Accessibility
242
+
243
+ This component makes use of the native `<select>` element, and inherits the native semantics and keyboard interactivity.
@@ -0,0 +1,68 @@
1
+ import type { ComponentProps } from '@fluentui/react-utilities';
2
+ import type { ComponentState } from '@fluentui/react-utilities';
3
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
+ import * as React_2 from 'react';
5
+ import type { Slot } from '@fluentui/react-utilities';
6
+ import { SlotClassNames } from '@fluentui/react-utilities';
7
+
8
+ /**
9
+ * Render the final JSX of Select
10
+ */
11
+ export declare const renderSelect_unstable: (state: SelectState) => JSX.Element;
12
+
13
+ /**
14
+ * Select component
15
+ */
16
+ export declare const Select: ForwardRefComponent<SelectProps>;
17
+
18
+ export declare const selectClassNames: SlotClassNames<SelectSlots>;
19
+
20
+ export declare type SelectProps = Omit<ComponentProps<Partial<SelectSlots>, 'select'>, 'size'> & {
21
+ /**
22
+ * Controls the colors and borders of the Select.
23
+ *
24
+ * @default 'outline'
25
+ */
26
+ appearance?: 'outline' | 'underline' | 'filled-darker' | 'filled-lighter';
27
+ /**
28
+ * If true, the Select will have an inline `display`, allowing it to be inline with other content.
29
+ * By default, Select has block layout.
30
+ *
31
+ * @default false
32
+ */
33
+ inline?: boolean;
34
+ /**
35
+ * Matches the Input sizes
36
+ *
37
+ * @default 'medium'
38
+ */
39
+ size?: 'small' | 'medium' | 'large';
40
+ };
41
+
42
+ export declare type SelectSlots = {
43
+ root: NonNullable<Slot<'span'>>;
44
+ /** Primary slot: the actual `<select>` element */
45
+ select: NonNullable<Slot<'select'>>;
46
+ /** the icon, typically a down arrow */
47
+ icon: Slot<'span'>;
48
+ };
49
+
50
+ export declare type SelectState = ComponentState<SelectSlots> & Required<Pick<SelectProps, 'appearance' | 'inline' | 'size'>>;
51
+
52
+ /**
53
+ * Create the state required to render Select.
54
+ *
55
+ * The returned state can be modified with hooks such as useSelectStyles,
56
+ * before being passed to renderSelect.
57
+ *
58
+ * @param props - props from this instance of Select
59
+ * @param ref - reference to the `<select>` element in Select
60
+ */
61
+ export declare const useSelect_unstable: (props: SelectProps, ref: React_2.Ref<HTMLSelectElement>) => SelectState;
62
+
63
+ /**
64
+ * Apply styling to the Select slots based on the state
65
+ */
66
+ export declare const useSelectStyles_unstable: (state: SelectState) => SelectState;
67
+
68
+ export { }
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.18.1"
9
+ }
10
+ ]
11
+ }
package/lib/Select.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Select/index';
2
+ //# sourceMappingURL=Select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.js","sourceRoot":"../src/","sources":["Select.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './components/Select/index';\n"]}
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { useSelect_unstable } from './useSelect';
3
+ import { renderSelect_unstable } from './renderSelect';
4
+ import { useSelectStyles_unstable } from './useSelectStyles';
5
+ /**
6
+ * Select component
7
+ */
8
+
9
+ export const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = useSelect_unstable(props, ref);
11
+ useSelectStyles_unstable(state);
12
+ return renderSelect_unstable(state);
13
+ });
14
+ Select.displayName = 'Select';
15
+ //# sourceMappingURL=Select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AAIA;;AAEG;;AACH,OAAO,MAAM,MAAM,gBAAqC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtF,QAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAhC;AAEA,EAAA,wBAAwB,CAAC,KAAD,CAAxB;AACA,SAAO,qBAAqB,CAAC,KAAD,CAA5B;AACD,CALuD,CAAjD;AAOP,MAAM,CAAC,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\nimport { useSelect_unstable } from './useSelect';\nimport { renderSelect_unstable } from './renderSelect';\nimport { useSelectStyles_unstable } from './useSelectStyles';\nimport type { SelectProps } from './Select.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Select component\n */\nexport const Select: ForwardRefComponent<SelectProps> = React.forwardRef((props, ref) => {\n const state = useSelect_unstable(props, ref);\n\n useSelectStyles_unstable(state);\n return renderSelect_unstable(state);\n});\n\nSelect.displayName = 'Select';\n"],"sourceRoot":"../src/"}