@fluentui/react-select 9.0.0-beta.8 → 9.0.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.
Files changed (69) hide show
  1. package/CHANGELOG.json +536 -2
  2. package/CHANGELOG.md +192 -3
  3. package/README.md +1 -5
  4. package/dist/index.d.ts +17 -0
  5. package/lib/Select.js.map +1 -1
  6. package/lib/SelectField.js +2 -0
  7. package/lib/SelectField.js.map +1 -0
  8. package/lib/components/Select/Select.js +0 -1
  9. package/lib/components/Select/Select.js.map +1 -1
  10. package/lib/components/Select/Select.types.js.map +1 -1
  11. package/lib/components/Select/index.js.map +1 -1
  12. package/lib/components/Select/renderSelect.js +6 -4
  13. package/lib/components/Select/renderSelect.js.map +1 -1
  14. package/lib/components/Select/useSelect.js +4 -2
  15. package/lib/components/Select/useSelect.js.map +1 -1
  16. package/lib/components/Select/useSelectStyles.js +223 -194
  17. package/lib/components/Select/useSelectStyles.js.map +1 -1
  18. package/lib/components/SelectField/SelectField.js +8 -0
  19. package/lib/components/SelectField/SelectField.js.map +1 -0
  20. package/lib/components/SelectField/index.js +2 -0
  21. package/lib/components/SelectField/index.js.map +1 -0
  22. package/lib/index.js +2 -0
  23. package/lib/index.js.map +1 -1
  24. package/lib-amd/Select.js +6 -0
  25. package/lib-amd/Select.js.map +1 -0
  26. package/lib-amd/SelectField.js +6 -0
  27. package/lib-amd/SelectField.js.map +1 -0
  28. package/lib-amd/components/Select/Select.js +15 -0
  29. package/lib-amd/components/Select/Select.js.map +1 -0
  30. package/lib-amd/components/Select/Select.types.js +5 -0
  31. package/lib-amd/components/Select/Select.types.js.map +1 -0
  32. package/lib-amd/components/Select/index.js +10 -0
  33. package/lib-amd/components/Select/index.js.map +1 -0
  34. package/lib-amd/components/Select/renderSelect.js +16 -0
  35. package/lib-amd/components/Select/renderSelect.js.map +1 -0
  36. package/lib-amd/components/Select/useSelect.js +51 -0
  37. package/lib-amd/components/Select/useSelect.js.map +1 -0
  38. package/lib-amd/components/Select/useSelectStyles.js +154 -0
  39. package/lib-amd/components/Select/useSelectStyles.js.map +1 -0
  40. package/lib-amd/components/SelectField/SelectField.js +10 -0
  41. package/lib-amd/components/SelectField/SelectField.js.map +1 -0
  42. package/lib-amd/components/SelectField/index.js +6 -0
  43. package/lib-amd/components/SelectField/index.js.map +1 -0
  44. package/lib-amd/index.js +13 -0
  45. package/lib-amd/index.js.map +1 -0
  46. package/lib-commonjs/Select.js +0 -2
  47. package/lib-commonjs/Select.js.map +1 -1
  48. package/lib-commonjs/SelectField.js +8 -0
  49. package/lib-commonjs/SelectField.js.map +1 -0
  50. package/lib-commonjs/components/Select/Select.js +0 -6
  51. package/lib-commonjs/components/Select/Select.js.map +1 -1
  52. package/lib-commonjs/components/Select/Select.types.js.map +1 -1
  53. package/lib-commonjs/components/Select/index.js +0 -6
  54. package/lib-commonjs/components/Select/index.js.map +1 -1
  55. package/lib-commonjs/components/Select/renderSelect.js +6 -8
  56. package/lib-commonjs/components/Select/renderSelect.js.map +1 -1
  57. package/lib-commonjs/components/Select/useSelect.js +4 -7
  58. package/lib-commonjs/components/Select/useSelect.js.map +1 -1
  59. package/lib-commonjs/components/Select/useSelectStyles.js +223 -198
  60. package/lib-commonjs/components/Select/useSelectStyles.js.map +1 -1
  61. package/lib-commonjs/components/SelectField/SelectField.js +14 -0
  62. package/lib-commonjs/components/SelectField/SelectField.js.map +1 -0
  63. package/lib-commonjs/components/SelectField/index.js +8 -0
  64. package/lib-commonjs/components/SelectField/index.js.map +1 -0
  65. package/lib-commonjs/index.js +15 -3
  66. package/lib-commonjs/index.js.map +1 -1
  67. package/package.json +21 -18
  68. package/Spec.md +0 -238
  69. package/dist/tsdoc-metadata.json +0 -11
@@ -3,10 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useSelect_unstable = exports.useSelectStyles_unstable = exports.renderSelect_unstable = exports.selectClassNames = exports.Select = void 0;
7
-
6
+ exports.selectFieldClassNames = exports.SelectField_unstable = exports.useSelect_unstable = exports.useSelectStyles_unstable = exports.renderSelect_unstable = exports.selectClassNames = exports.Select = void 0;
8
7
  var Select_1 = /*#__PURE__*/require("./Select");
9
-
10
8
  Object.defineProperty(exports, "Select", {
11
9
  enumerable: true,
12
10
  get: function () {
@@ -37,4 +35,18 @@ Object.defineProperty(exports, "useSelect_unstable", {
37
35
  return Select_1.useSelect_unstable;
38
36
  }
39
37
  });
38
+ // eslint-disable-next-line deprecation/deprecation
39
+ var SelectField_1 = /*#__PURE__*/require("./SelectField");
40
+ Object.defineProperty(exports, "SelectField_unstable", {
41
+ enumerable: true,
42
+ get: function () {
43
+ return SelectField_1.SelectField;
44
+ }
45
+ });
46
+ Object.defineProperty(exports, "selectFieldClassNames", {
47
+ enumerable: true,
48
+ get: function () {
49
+ return SelectField_1.selectFieldClassNames;
50
+ }
51
+ });
40
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,QAAA,gBAAA,OAAA,CAAA,UAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,QAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,MAAA;EAAM;AAAN,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,uBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,qBAAA;EAAqB;AAArB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,0BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,wBAAA;EAAwB;AAAxB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,oBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,QAAA,CAAA,kBAAA;EAAkB;AAAlB,CAAA","sourcesContent":["export {\n Select,\n selectClassNames,\n renderSelect_unstable,\n useSelectStyles_unstable,\n useSelect_unstable,\n} from './Select';\nexport type { SelectOnChangeData, SelectProps, SelectSlots, SelectState } from './Select';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACEA;EAAAC;EAAAC;IAAA,sBAAM;EAAA;AAAA;AACNF;EAAAC;EAAAC;IAAA,gCAAgB;EAAA;AAAA;AAChBF;EAAAC;EAAAC;IAAA,qCAAqB;EAAA;AAAA;AACrBF;EAAAC;EAAAC;IAAA,wCAAwB;EAAA;AAAA;AACxBF;EAAAC;EAAAC;IAAA,kCAAkB;EAAA;AAAA;AAIpB;AACA;AAASF;EAAAC;EAAAC;IAAA,gCAAW;EAAA;AAAA;AAA0BF;EAAAC;EAAAC;IAAA,0CAAqB;EAAA;AAAA","names":["Object","enumerable","get"],"sourceRoot":"../src/","sources":["packages/react-components/react-select/src/index.ts"],"sourcesContent":["export {\n Select,\n selectClassNames,\n renderSelect_unstable,\n useSelectStyles_unstable,\n useSelect_unstable,\n} from './Select';\nexport type { SelectOnChangeData, SelectProps, SelectSlots, SelectState } from './Select';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { SelectField as SelectField_unstable, selectFieldClassNames } from './SelectField';\n// eslint-disable-next-line deprecation/deprecation\nexport type { SelectFieldProps as SelectFieldProps_unstable } from './SelectField';\n"]}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@fluentui/react-select",
3
- "version": "9.0.0-beta.8",
3
+ "version": "9.0.0",
4
4
  "description": "Fluent UI React Select component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
7
- "typings": "dist/index.d.ts",
7
+ "typings": "./dist/index.d.ts",
8
8
  "sideEffects": false,
9
9
  "repository": {
10
10
  "type": "git",
@@ -20,42 +20,45 @@
20
20
  "lint": "just-scripts lint",
21
21
  "start": "yarn storybook",
22
22
  "test": "jest --passWithNoTests",
23
- "docs": "api-extractor run --config=config/api-extractor.local.json --local",
24
- "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/packages/react-components/react-select/src && yarn docs",
25
- "storybook": "node ../../../scripts/storybook/runner",
26
- "type-check": "tsc -b tsconfig.json"
23
+ "storybook": "start-storybook",
24
+ "type-check": "tsc -b tsconfig.json",
25
+ "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
27
26
  },
28
27
  "devDependencies": {
29
28
  "@fluentui/eslint-plugin": "*",
30
29
  "@fluentui/react-conformance": "*",
31
- "@fluentui/react-conformance-griffel": "9.0.0-beta.12"
30
+ "@fluentui/react-conformance-griffel": "9.0.0-beta.19",
31
+ "@fluentui/scripts-api-extractor": "*",
32
+ "@fluentui/scripts-tasks": "*"
32
33
  },
33
34
  "dependencies": {
35
+ "@fluentui/react-field": "9.0.0-alpha.18",
34
36
  "@fluentui/react-icons": "^2.0.175",
35
- "@fluentui/react-theme": "^9.0.0",
36
- "@fluentui/react-utilities": "^9.0.2",
37
- "@griffel/react": "^1.2.3",
37
+ "@fluentui/react-shared-contexts": "^9.2.0",
38
+ "@fluentui/react-theme": "^9.1.5",
39
+ "@fluentui/react-utilities": "^9.5.1",
40
+ "@griffel/react": "^1.5.2",
38
41
  "tslib": "^2.1.0"
39
42
  },
40
43
  "peerDependencies": {
41
- "@types/react": ">=16.8.0 <18.0.0",
42
- "@types/react-dom": ">=16.8.0 <18.0.0",
43
- "react": ">=16.8.0 <18.0.0",
44
- "react-dom": ">=16.8.0 <18.0.0"
44
+ "@types/react": ">=16.8.0 <19.0.0",
45
+ "@types/react-dom": ">=16.8.0 <19.0.0",
46
+ "react": ">=16.8.0 <19.0.0",
47
+ "react-dom": ">=16.8.0 <19.0.0"
45
48
  },
46
49
  "beachball": {
47
50
  "tag": "beta",
48
51
  "disallowedChangeTypes": [
49
52
  "major",
50
- "minor",
51
- "patch"
53
+ "prerelease"
52
54
  ]
53
55
  },
54
56
  "exports": {
55
57
  ".": {
56
- "types": "./lib/index.d.ts",
58
+ "types": "./dist/index.d.ts",
57
59
  "import": "./lib/index.js",
58
60
  "require": "./lib-commonjs/index.js"
59
- }
61
+ },
62
+ "./package.json": "./package.json"
60
63
  }
61
64
  }
package/Spec.md DELETED
@@ -1,238 +0,0 @@
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
- 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">
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
- ### Size
109
-
110
- - Small
111
- - Medium (default)
112
- - Large
113
-
114
- ### Appearance
115
-
116
- - Filled darker
117
- - Filled lighter
118
- - Outline (default)
119
- - Transparent
120
-
121
- ### Unsupported Select variants
122
-
123
- #### Multiple Selection
124
-
125
- 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.
126
-
127
- #### Size attribute
128
-
129
- 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>`.
130
-
131
- ## API
132
-
133
- From [Select.types.tsx](https://github.com/microsoft/fluentui/blob/master/packages/react-select/src/components/Select/Select.types.ts)
134
-
135
- ### Slots
136
-
137
- In this component, `select` is the primary slot. Since `select` is primary, `root` is a separate explicit slot to customize the wrapper.
138
-
139
- ```ts
140
- export type SelectSlots = {
141
- /** Root of the component, renders as a `<span>`. */
142
- root: IntrinsicSlotProps<'span'>;
143
- /** The actual `<select>` element */
144
- select: IntrinsicSlotProps<'select'>;
145
- /** the icon, typically a down arrow */
146
- icon: IntrinsicSlotProps<'span'>;
147
- };
148
- ```
149
-
150
- ### Children
151
-
152
- 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.
153
-
154
- ## Structure
155
-
156
- - _**Public**_
157
-
158
- ```tsx
159
- <label htmlFor="selectID">Choose a color</label>
160
- <Select id="selectID" className="my-select-class">
161
- <option>Red</option>
162
- <option>Green</option>
163
- <option>Blue</option>
164
- </Select>
165
- ```
166
-
167
- - _**DOM**_
168
-
169
- ```html
170
- <label for="selectID">Choose a color</label>
171
- <span class="my-select-class">
172
- <select id="selectID">
173
- <option>Red</option>
174
- <option>Green</option>
175
- <option>Blue</option>
176
- </select>
177
- <svg><!-- icon --></svg>
178
- </span>
179
- ```
180
-
181
- ## Migration
182
-
183
- 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`.
184
-
185
- ### Props
186
-
187
- | v8 Dropdown | v0 Dropdown | Proposal |
188
- | -------------------- | ------------------------- | --------------------------------- |
189
- | options | items | children |
190
- | defaultSelectedKey | defaultValue | child with `selected` |
191
- | selectedKey | value | imperative ref.value |
192
- | id | n/a | id |
193
- | disabled | disabled | disabled |
194
- | required | n/a | required |
195
- | multiSelect | multiple | use Combobox |
196
- | placeholder | placeholder | child with `value=""` |
197
- | ariaLabel | n/a | aria-label |
198
- | n/a | aria-\* | aria-\* |
199
- | errorMessage | error | invalid, message handled in Field |
200
- | label, onRenderLabel | n/a | Handled in Field |
201
- | componentRef | n/a | ref |
202
- | n/a | popperRef, popper props | n/a |
203
- | calloutProps | list | n/a |
204
- | panelProps | n/a | n/a |
205
- | openOnKeyboardFocus | n/a | n/a |
206
- | n/a | a11ySelectedItemsMessage | n/a |
207
- | n/a | align | n/a |
208
- | n/a | autosize | n/a |
209
- | n/a | checkable | n/a |
210
- | n/a | clearable | n/a |
211
- | n/a | defaultHighlightedIndex | n/a |
212
- | n/a | defaultOpen | n/a |
213
- | n/a | fluid | default style |
214
- | n/a | headerMessage | optgroup child with `name` |
215
- | n/a | highlightFirstItemOnOpen | n/a |
216
- | n/a | highlightedIndex | n/a |
217
- | n/a | inline | use custom styles |
218
- | n/a | inverted | n/a |
219
- | n/a | loading | n/a |
220
- | n/a | noResultsMessage | use children |
221
- | n/a | offset | n/a |
222
- | n/a | open | n/a |
223
- | n/a | position | n/a |
224
- | n/a | positionFixed | n/a |
225
- | n/a | search | use Combobox |
226
- | styles | styles | style |
227
- | onRenderCaretDown | toggleIndicator | use icon slot |
228
- | n/a | triggerButton | n/a |
229
- | onRenderContainer | n/a | n/a |
230
- | onRenderItem | renderItem | use children |
231
- | onRenderList | list slot | n/a |
232
- | onRenderOption | renderItem, headerMessage | use children |
233
- | onRenderPlaceholder | n/a | n/a |
234
- | onRenderTitle | n/a | n/a |
235
-
236
- ## Behaviors and Accessibility
237
-
238
- This component makes use of the native `<select>` element, and inherits the native semantics and keyboard interactivity.
@@ -1,11 +0,0 @@
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
- }