@atlaskit/react-select 0.0.2

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 (197) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE.md +11 -0
  3. package/README.md +10 -0
  4. package/async/package.json +15 -0
  5. package/base/package.json +15 -0
  6. package/creatable/package.json +15 -0
  7. package/dist/cjs/accessibility/helpers.js +34 -0
  8. package/dist/cjs/accessibility/index.js +74 -0
  9. package/dist/cjs/async-creatable.js +27 -0
  10. package/dist/cjs/async.js +30 -0
  11. package/dist/cjs/builtins.js +18 -0
  12. package/dist/cjs/components/containers.js +100 -0
  13. package/dist/cjs/components/control.js +67 -0
  14. package/dist/cjs/components/group.js +79 -0
  15. package/dist/cjs/components/index.js +53 -0
  16. package/dist/cjs/components/indicators.js +214 -0
  17. package/dist/cjs/components/input.js +93 -0
  18. package/dist/cjs/components/internal/a11y-text.js +34 -0
  19. package/dist/cjs/components/internal/dummy-input.js +43 -0
  20. package/dist/cjs/components/internal/index.js +34 -0
  21. package/dist/cjs/components/internal/required-input.js +43 -0
  22. package/dist/cjs/components/internal/scroll-manager.js +57 -0
  23. package/dist/cjs/components/internal/use-scroll-capture.js +132 -0
  24. package/dist/cjs/components/internal/use-scroll-lock.js +149 -0
  25. package/dist/cjs/components/live-region.js +153 -0
  26. package/dist/cjs/components/menu.js +464 -0
  27. package/dist/cjs/components/multi-value.js +129 -0
  28. package/dist/cjs/components/option.js +62 -0
  29. package/dist/cjs/components/placeholder.js +39 -0
  30. package/dist/cjs/components/single-value.js +46 -0
  31. package/dist/cjs/creatable.js +30 -0
  32. package/dist/cjs/diacritics.js +274 -0
  33. package/dist/cjs/filters.js +50 -0
  34. package/dist/cjs/index.js +55 -0
  35. package/dist/cjs/nonce-provider.js +30 -0
  36. package/dist/cjs/select.js +1803 -0
  37. package/dist/cjs/state-manager.js +31 -0
  38. package/dist/cjs/styles.js +66 -0
  39. package/dist/cjs/theme.js +42 -0
  40. package/dist/cjs/types.js +5 -0
  41. package/dist/cjs/use-async.js +156 -0
  42. package/dist/cjs/use-creatable.js +114 -0
  43. package/dist/cjs/use-state-manager.js +83 -0
  44. package/dist/cjs/utils.js +357 -0
  45. package/dist/es2019/accessibility/helpers.js +24 -0
  46. package/dist/es2019/accessibility/index.js +72 -0
  47. package/dist/es2019/async-creatable.js +17 -0
  48. package/dist/es2019/async.js +16 -0
  49. package/dist/es2019/builtins.js +4 -0
  50. package/dist/es2019/components/containers.js +100 -0
  51. package/dist/es2019/components/control.js +62 -0
  52. package/dist/es2019/components/group.js +74 -0
  53. package/dist/es2019/components/index.js +41 -0
  54. package/dist/es2019/components/indicators.js +211 -0
  55. package/dist/es2019/components/input.js +88 -0
  56. package/dist/es2019/components/internal/a11y-text.js +25 -0
  57. package/dist/es2019/components/internal/dummy-input.js +36 -0
  58. package/dist/es2019/components/internal/index.js +4 -0
  59. package/dist/es2019/components/internal/required-input.js +35 -0
  60. package/dist/es2019/components/internal/scroll-manager.js +49 -0
  61. package/dist/es2019/components/internal/use-scroll-capture.js +128 -0
  62. package/dist/es2019/components/internal/use-scroll-lock.js +143 -0
  63. package/dist/es2019/components/live-region.js +151 -0
  64. package/dist/es2019/components/menu.js +466 -0
  65. package/dist/es2019/components/multi-value.js +134 -0
  66. package/dist/es2019/components/option.js +57 -0
  67. package/dist/es2019/components/placeholder.js +34 -0
  68. package/dist/es2019/components/single-value.js +41 -0
  69. package/dist/es2019/creatable.js +15 -0
  70. package/dist/es2019/diacritics.js +264 -0
  71. package/dist/es2019/filters.js +36 -0
  72. package/dist/es2019/index.js +8 -0
  73. package/dist/es2019/nonce-provider.js +19 -0
  74. package/dist/es2019/select.js +1766 -0
  75. package/dist/es2019/state-manager.js +22 -0
  76. package/dist/es2019/styles.js +56 -0
  77. package/dist/es2019/theme.js +36 -0
  78. package/dist/es2019/types.js +1 -0
  79. package/dist/es2019/use-async.js +117 -0
  80. package/dist/es2019/use-creatable.js +81 -0
  81. package/dist/es2019/use-state-manager.js +60 -0
  82. package/dist/es2019/utils.js +309 -0
  83. package/dist/esm/accessibility/helpers.js +24 -0
  84. package/dist/esm/accessibility/index.js +68 -0
  85. package/dist/esm/async-creatable.js +17 -0
  86. package/dist/esm/async.js +16 -0
  87. package/dist/esm/builtins.js +12 -0
  88. package/dist/esm/components/containers.js +96 -0
  89. package/dist/esm/components/control.js +62 -0
  90. package/dist/esm/components/group.js +74 -0
  91. package/dist/esm/components/index.js +43 -0
  92. package/dist/esm/components/indicators.js +209 -0
  93. package/dist/esm/components/input.js +88 -0
  94. package/dist/esm/components/internal/a11y-text.js +27 -0
  95. package/dist/esm/components/internal/dummy-input.js +37 -0
  96. package/dist/esm/components/internal/index.js +4 -0
  97. package/dist/esm/components/internal/required-input.js +36 -0
  98. package/dist/esm/components/internal/scroll-manager.js +49 -0
  99. package/dist/esm/components/internal/use-scroll-capture.js +126 -0
  100. package/dist/esm/components/internal/use-scroll-lock.js +143 -0
  101. package/dist/esm/components/live-region.js +148 -0
  102. package/dist/esm/components/menu.js +460 -0
  103. package/dist/esm/components/multi-value.js +122 -0
  104. package/dist/esm/components/option.js +57 -0
  105. package/dist/esm/components/placeholder.js +34 -0
  106. package/dist/esm/components/single-value.js +41 -0
  107. package/dist/esm/creatable.js +15 -0
  108. package/dist/esm/diacritics.js +268 -0
  109. package/dist/esm/filters.js +43 -0
  110. package/dist/esm/index.js +8 -0
  111. package/dist/esm/nonce-provider.js +20 -0
  112. package/dist/esm/select.js +1794 -0
  113. package/dist/esm/state-manager.js +22 -0
  114. package/dist/esm/styles.js +58 -0
  115. package/dist/esm/theme.js +36 -0
  116. package/dist/esm/types.js +1 -0
  117. package/dist/esm/use-async.js +149 -0
  118. package/dist/esm/use-creatable.js +107 -0
  119. package/dist/esm/use-state-manager.js +76 -0
  120. package/dist/esm/utils.js +328 -0
  121. package/dist/types/accessibility/helpers.d.ts +5 -0
  122. package/dist/types/accessibility/index.d.ts +125 -0
  123. package/dist/types/async-creatable.d.ts +10 -0
  124. package/dist/types/async.d.ts +9 -0
  125. package/dist/types/builtins.d.ts +5 -0
  126. package/dist/types/components/containers.d.ts +50 -0
  127. package/dist/types/components/control.d.ts +33 -0
  128. package/dist/types/components/group.d.ts +53 -0
  129. package/dist/types/components/index.d.ts +73 -0
  130. package/dist/types/components/indicators.d.ts +72 -0
  131. package/dist/types/components/input.d.ts +33 -0
  132. package/dist/types/components/internal/a11y-text.d.ts +8 -0
  133. package/dist/types/components/internal/dummy-input.d.ts +9 -0
  134. package/dist/types/components/internal/index.d.ts +4 -0
  135. package/dist/types/components/internal/required-input.d.ts +10 -0
  136. package/dist/types/components/internal/scroll-manager.d.ts +17 -0
  137. package/dist/types/components/internal/use-scroll-capture.d.ts +12 -0
  138. package/dist/types/components/internal/use-scroll-lock.d.ts +9 -0
  139. package/dist/types/components/live-region.d.ts +24 -0
  140. package/dist/types/components/menu.d.ts +130 -0
  141. package/dist/types/components/multi-value.d.ts +47 -0
  142. package/dist/types/components/option.d.ts +49 -0
  143. package/dist/types/components/placeholder.d.ts +22 -0
  144. package/dist/types/components/single-value.d.ts +28 -0
  145. package/dist/types/creatable.d.ts +10 -0
  146. package/dist/types/diacritics.d.ts +1 -0
  147. package/dist/types/filters.d.ts +15 -0
  148. package/dist/types/index.d.ts +28 -0
  149. package/dist/types/nonce-provider.d.ts +8 -0
  150. package/dist/types/select.d.ts +616 -0
  151. package/dist/types/state-manager.d.ts +17 -0
  152. package/dist/types/styles.d.ts +68 -0
  153. package/dist/types/theme.d.ts +27 -0
  154. package/dist/types/types.d.ts +134 -0
  155. package/dist/types/use-async.d.ts +31 -0
  156. package/dist/types/use-creatable.d.ts +46 -0
  157. package/dist/types/use-state-manager.d.ts +15 -0
  158. package/dist/types/utils.d.ts +44 -0
  159. package/dist/types-ts4.5/accessibility/helpers.d.ts +5 -0
  160. package/dist/types-ts4.5/accessibility/index.d.ts +125 -0
  161. package/dist/types-ts4.5/async-creatable.d.ts +10 -0
  162. package/dist/types-ts4.5/async.d.ts +9 -0
  163. package/dist/types-ts4.5/builtins.d.ts +5 -0
  164. package/dist/types-ts4.5/components/containers.d.ts +50 -0
  165. package/dist/types-ts4.5/components/control.d.ts +33 -0
  166. package/dist/types-ts4.5/components/group.d.ts +53 -0
  167. package/dist/types-ts4.5/components/index.d.ts +73 -0
  168. package/dist/types-ts4.5/components/indicators.d.ts +72 -0
  169. package/dist/types-ts4.5/components/input.d.ts +33 -0
  170. package/dist/types-ts4.5/components/internal/a11y-text.d.ts +8 -0
  171. package/dist/types-ts4.5/components/internal/dummy-input.d.ts +9 -0
  172. package/dist/types-ts4.5/components/internal/index.d.ts +4 -0
  173. package/dist/types-ts4.5/components/internal/required-input.d.ts +10 -0
  174. package/dist/types-ts4.5/components/internal/scroll-manager.d.ts +17 -0
  175. package/dist/types-ts4.5/components/internal/use-scroll-capture.d.ts +12 -0
  176. package/dist/types-ts4.5/components/internal/use-scroll-lock.d.ts +9 -0
  177. package/dist/types-ts4.5/components/live-region.d.ts +24 -0
  178. package/dist/types-ts4.5/components/menu.d.ts +130 -0
  179. package/dist/types-ts4.5/components/multi-value.d.ts +47 -0
  180. package/dist/types-ts4.5/components/option.d.ts +49 -0
  181. package/dist/types-ts4.5/components/placeholder.d.ts +22 -0
  182. package/dist/types-ts4.5/components/single-value.d.ts +28 -0
  183. package/dist/types-ts4.5/creatable.d.ts +10 -0
  184. package/dist/types-ts4.5/diacritics.d.ts +1 -0
  185. package/dist/types-ts4.5/filters.d.ts +15 -0
  186. package/dist/types-ts4.5/index.d.ts +28 -0
  187. package/dist/types-ts4.5/nonce-provider.d.ts +8 -0
  188. package/dist/types-ts4.5/select.d.ts +616 -0
  189. package/dist/types-ts4.5/state-manager.d.ts +17 -0
  190. package/dist/types-ts4.5/styles.d.ts +68 -0
  191. package/dist/types-ts4.5/theme.d.ts +27 -0
  192. package/dist/types-ts4.5/types.d.ts +134 -0
  193. package/dist/types-ts4.5/use-async.d.ts +31 -0
  194. package/dist/types-ts4.5/use-creatable.d.ts +46 -0
  195. package/dist/types-ts4.5/use-state-manager.d.ts +15 -0
  196. package/dist/types-ts4.5/utils.d.ts +44 -0
  197. package/package.json +83 -0
@@ -0,0 +1,8 @@
1
+ import { type ReactNode } from 'react';
2
+ interface NonceProviderProps {
3
+ nonce: string;
4
+ children: ReactNode;
5
+ cacheKey: string;
6
+ }
7
+ declare const NonceProvider: ({ nonce, children, cacheKey }: NonceProviderProps) => JSX.Element;
8
+ export default NonceProvider;
@@ -0,0 +1,616 @@
1
+ import React, { type AriaAttributes, Component, type FocusEventHandler, type FormEventHandler, type KeyboardEventHandler, type MouseEventHandler, type ReactNode, type RefCallback, type TouchEventHandler } from 'react';
2
+ import { type AriaLiveMessages, type AriaSelection } from './accessibility';
3
+ import { type SelectComponentsConfig } from './components';
4
+ import { type FilterOptionOption } from './filters';
5
+ import { type ClassNamesConfig, type StylesConfig, type StylesProps } from './styles';
6
+ import { type ThemeConfig } from './theme';
7
+ import { type ActionMeta, type FocusDirection, type GetOptionLabel, type GetOptionValue, type GroupBase, type InputActionMeta, type MenuPlacement, type MenuPosition, type OnChangeValue, type Options, type OptionsOrGroups, type PropsValue, type SetValueAction } from './types';
8
+ export type FormatOptionLabelContext = 'menu' | 'value';
9
+ export interface FormatOptionLabelMeta<Option> {
10
+ context: FormatOptionLabelContext;
11
+ inputValue: string;
12
+ selectValue: Options<Option>;
13
+ }
14
+ export interface SelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
15
+ /**
16
+ * HTML ID of an element containing an error message related to the input
17
+ */
18
+ 'aria-errormessage'?: AriaAttributes['aria-errormessage'];
19
+ /**
20
+ * Indicate if the value entered in the field is invalid
21
+ */
22
+ 'aria-invalid'?: AriaAttributes['aria-invalid'];
23
+ /**
24
+ * Aria label (for assistive tech)
25
+ */
26
+ 'aria-label'?: AriaAttributes['aria-label'];
27
+ /**
28
+ * HTML ID of an element that should be used as the label (for assistive tech)
29
+ */
30
+ 'aria-labelledby'?: AriaAttributes['aria-labelledby'];
31
+ 'aria-describedby'?: AriaAttributes['aria-describedby'];
32
+ /**
33
+ * Used to set the priority with which screen reader should treat updates to live regions. The possible settings are: off, polite (default) or assertive
34
+ */
35
+ 'aria-live'?: AriaAttributes['aria-live'];
36
+ /**
37
+ * Customise the messages used by the aria-live component
38
+ */
39
+ ariaLiveMessages?: AriaLiveMessages<Option, IsMulti, Group>;
40
+ /**
41
+ * Focus the control when it is mounted
42
+ */
43
+ autoFocus?: boolean;
44
+ /**
45
+ * Remove the currently focused option when the user presses backspace when Select isClearable or isMulti
46
+ */
47
+ backspaceRemovesValue: boolean;
48
+ /**
49
+ * Remove focus from the input when the user selects an option (handy for dismissing the keyboard on touch devices)
50
+ */
51
+ blurInputOnSelect: boolean;
52
+ /**
53
+ * When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent
54
+ */
55
+ captureMenuScroll: boolean;
56
+ /**
57
+ * Sets a className attribute on the outer component
58
+ */
59
+ className?: string;
60
+ /**
61
+ * If provided, all inner components will be given a prefixed className attribute.
62
+ *
63
+ * This is useful when styling via CSS classes instead of the Styles API approach.
64
+ */
65
+ classNamePrefix?: string | null;
66
+ /**
67
+ * Provide classNames based on state for each inner component
68
+ */
69
+ classNames: ClassNamesConfig<Option, IsMulti, Group>;
70
+ /**
71
+ * Close the select menu when the user selects an option
72
+ */
73
+ closeMenuOnSelect: boolean;
74
+ /**
75
+ * If `true`, close the select menu when the user scrolls the document/body.
76
+ *
77
+ * If a function, takes a standard javascript `ScrollEvent` you return a boolean:
78
+ *
79
+ * `true` => The menu closes
80
+ *
81
+ * `false` => The menu stays open
82
+ *
83
+ * This is useful when you have a scrollable modal and want to portal the menu out,
84
+ * but want to avoid graphical issues.
85
+ */
86
+ closeMenuOnScroll: boolean | ((event: Event) => boolean);
87
+ /**
88
+ * This complex object includes all the compositional components that are used
89
+ * in `react-select`. If you wish to overwrite a component, pass in an object
90
+ * with the appropriate namespace.
91
+ *
92
+ * If you only wish to restyle a component, we recommend using the `styles` prop
93
+ * instead. For a list of the components that can be passed in, and the shape
94
+ * that will be passed to them, see [the components docs](/components)
95
+ */
96
+ components: SelectComponentsConfig<Option, IsMulti, Group>;
97
+ /**
98
+ * Whether the value of the select, e.g. SingleValue, should be displayed in the control.
99
+ */
100
+ controlShouldRenderValue: boolean;
101
+ /**
102
+ * Delimiter used to join multiple values into a single HTML Input value
103
+ */
104
+ delimiter?: string;
105
+ /**
106
+ * Clear all values when the user presses escape AND the menu is closed
107
+ */
108
+ escapeClearsValue: boolean;
109
+ /**
110
+ * Custom method to filter whether an option should be displayed in the menu
111
+ */
112
+ filterOption: ((option: FilterOptionOption<Option>, inputValue: string) => boolean) | null;
113
+ /**
114
+ * Formats group labels in the menu as React components
115
+ *
116
+ * An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
117
+ */
118
+ formatGroupLabel: (group: Group) => ReactNode;
119
+ /**
120
+ * Formats option labels in the menu and control as React components
121
+ */
122
+ formatOptionLabel?: (data: Option, formatOptionLabelMeta: FormatOptionLabelMeta<Option>) => ReactNode;
123
+ /**
124
+ * Resolves option data to a string to be displayed as the label by components
125
+ *
126
+ * Note: Failure to resolve to a string type can interfere with filtering and
127
+ * screen reader support.
128
+ */
129
+ getOptionLabel: GetOptionLabel<Option>;
130
+ /**
131
+ * Resolves option data to a string to compare options and specify value attributes
132
+ */
133
+ getOptionValue: GetOptionValue<Option>;
134
+ /**
135
+ * Hide the selected option from the menu
136
+ */
137
+ hideSelectedOptions?: boolean;
138
+ /**
139
+ * The id to set on the SelectContainer component.
140
+ */
141
+ id?: string;
142
+ /**
143
+ * The value of the search input
144
+ */
145
+ inputValue: string;
146
+ /**
147
+ * The id of the search input
148
+ */
149
+ inputId?: string;
150
+ /**
151
+ * Define an id prefix for the select components e.g. {your-id}-value
152
+ */
153
+ instanceId?: number | string;
154
+ /**
155
+ * Is the select value clearable
156
+ */
157
+ isClearable?: boolean;
158
+ /**
159
+ * Is the select disabled
160
+ */
161
+ isDisabled: boolean;
162
+ /**
163
+ * Is the select in a state of loading (async)
164
+ */
165
+ isLoading: boolean;
166
+ /**
167
+ * Override the built-in logic to detect whether an option is disabled
168
+ *
169
+ * An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
170
+ */
171
+ isOptionDisabled: (option: Option, selectValue: Options<Option>) => boolean;
172
+ /**
173
+ * Override the built-in logic to detect whether an option is selected
174
+ */
175
+ isOptionSelected?: (option: Option, selectValue: Options<Option>) => boolean;
176
+ /**
177
+ * Support multiple selected options
178
+ */
179
+ isMulti: IsMulti;
180
+ /**
181
+ * Is the select direction right-to-left
182
+ */
183
+ isRtl: boolean;
184
+ /**
185
+ * Whether to enable search functionality
186
+ */
187
+ isSearchable: boolean;
188
+ /**
189
+ * Async: Text to display when loading options
190
+ */
191
+ loadingMessage: (obj: {
192
+ inputValue: string;
193
+ }) => ReactNode;
194
+ /**
195
+ * Minimum height of the menu before flipping
196
+ */
197
+ minMenuHeight: number;
198
+ /**
199
+ * Maximum height of the menu before scrolling
200
+ */
201
+ maxMenuHeight: number;
202
+ /**
203
+ * Whether the menu is open
204
+ */
205
+ menuIsOpen: boolean;
206
+ /**
207
+ * Default placement of the menu in relation to the control. 'auto' will flip
208
+ * when there isn't enough space below the control.
209
+ */
210
+ menuPlacement: MenuPlacement;
211
+ /**
212
+ * The CSS position value of the menu, when "fixed" extra layout management is required
213
+ */
214
+ menuPosition: MenuPosition;
215
+ /**
216
+ * Whether the menu should use a portal, and where it should attach
217
+ *
218
+ * An example can be found in the [Portaling](/advanced#portaling) documentation
219
+ */
220
+ menuPortalTarget?: HTMLElement | null;
221
+ /**
222
+ * Whether to block scroll events when the menu is open
223
+ */
224
+ menuShouldBlockScroll: boolean;
225
+ /**
226
+ * Whether the menu should be scrolled into view when it opens
227
+ */
228
+ menuShouldScrollIntoView: boolean;
229
+ /**
230
+ * Name of the HTML Input (optional - without this, no input will be rendered)
231
+ */
232
+ name?: string;
233
+ /**
234
+ * Text to display when there are no options
235
+ */
236
+ noOptionsMessage: (obj: {
237
+ inputValue: string;
238
+ }) => ReactNode;
239
+ /**
240
+ * Handle blur events on the control
241
+ */
242
+ onBlur?: FocusEventHandler<HTMLInputElement>;
243
+ /**
244
+ * Handle change events on the select
245
+ */
246
+ onChange: (newValue: OnChangeValue<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void;
247
+ /**
248
+ * Handle focus events on the control
249
+ */
250
+ onFocus?: FocusEventHandler<HTMLInputElement>;
251
+ /**
252
+ * Handle change events on the input
253
+ */
254
+ onInputChange: (newValue: string, actionMeta: InputActionMeta) => void;
255
+ /**
256
+ * Handle key down events on the select
257
+ */
258
+ onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
259
+ /**
260
+ * Handle the menu opening
261
+ */
262
+ onMenuOpen: () => void;
263
+ /**
264
+ * Handle the menu closing
265
+ */
266
+ onMenuClose: () => void;
267
+ /**
268
+ * Fired when the user scrolls to the top of the menu
269
+ */
270
+ onMenuScrollToTop?: (event: WheelEvent | TouchEvent) => void;
271
+ /**
272
+ * Fired when the user scrolls to the bottom of the menu
273
+ */
274
+ onMenuScrollToBottom?: (event: WheelEvent | TouchEvent) => void;
275
+ /**
276
+ * Allows control of whether the menu is opened when the Select is focused
277
+ */
278
+ openMenuOnFocus: boolean;
279
+ /**
280
+ * Allows control of whether the menu is opened when the Select is clicked
281
+ */
282
+ openMenuOnClick: boolean;
283
+ /**
284
+ * Array of options that populate the select menu
285
+ */
286
+ options: OptionsOrGroups<Option, Group>;
287
+ /**
288
+ * Number of options to jump in menu when page{up|down} keys are used
289
+ */
290
+ pageSize: number;
291
+ /**
292
+ * Placeholder for the select value
293
+ */
294
+ placeholder: ReactNode;
295
+ /**
296
+ * Status to relay to screen readers
297
+ */
298
+ screenReaderStatus: (obj: {
299
+ count: number;
300
+ }) => string;
301
+ /**
302
+ * Style modifier methods
303
+ *
304
+ * A basic example can be found at the bottom of the [Replacing builtins](/advanced#replacing-builtins) documentation.
305
+ */
306
+ styles: StylesConfig<Option, IsMulti, Group>;
307
+ /**
308
+ * Theme modifier method
309
+ */
310
+ theme?: ThemeConfig;
311
+ /**
312
+ * Sets the tabIndex attribute on the input
313
+ */
314
+ tabIndex: number;
315
+ /**
316
+ * Select the currently focused option when the user presses tab
317
+ */
318
+ tabSelectsValue: boolean;
319
+ /**
320
+ * Remove all non-essential styles
321
+ */
322
+ unstyled: boolean;
323
+ /**
324
+ * The value of the select; reflected by the selected option
325
+ */
326
+ value: PropsValue<Option>;
327
+ /**
328
+ * Sets the form attribute on the input
329
+ */
330
+ form?: string;
331
+ /**
332
+ * Marks the value-holding input as required for form validation
333
+ */
334
+ required?: boolean;
335
+ }
336
+ export declare const defaultProps: {
337
+ 'aria-live': string;
338
+ backspaceRemovesValue: boolean;
339
+ blurInputOnSelect: boolean;
340
+ captureMenuScroll: boolean;
341
+ classNames: {};
342
+ closeMenuOnSelect: boolean;
343
+ closeMenuOnScroll: boolean;
344
+ components: {};
345
+ controlShouldRenderValue: boolean;
346
+ escapeClearsValue: boolean;
347
+ filterOption: (option: FilterOptionOption<import("./types").Option>, rawInput: string) => boolean;
348
+ formatGroupLabel: <Option, Group extends GroupBase<Option>>(group: Group) => string;
349
+ getOptionLabel: (option: import("./types").Option) => string;
350
+ getOptionValue: (option: import("./types").Option) => string;
351
+ isDisabled: boolean;
352
+ isLoading: boolean;
353
+ isMulti: boolean;
354
+ isRtl: boolean;
355
+ isSearchable: boolean;
356
+ isOptionDisabled: (option: import("./types").Option) => boolean;
357
+ loadingMessage: () => string;
358
+ maxMenuHeight: number;
359
+ minMenuHeight: number;
360
+ menuIsOpen: boolean;
361
+ menuPlacement: string;
362
+ menuPosition: string;
363
+ menuShouldBlockScroll: boolean;
364
+ menuShouldScrollIntoView: boolean;
365
+ noOptionsMessage: () => string;
366
+ openMenuOnFocus: boolean;
367
+ openMenuOnClick: boolean;
368
+ options: never[];
369
+ pageSize: number;
370
+ placeholder: string;
371
+ screenReaderStatus: ({ count }: {
372
+ count: number;
373
+ }) => string;
374
+ styles: {};
375
+ tabIndex: number;
376
+ tabSelectsValue: boolean;
377
+ unstyled: boolean;
378
+ };
379
+ interface State<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
380
+ ariaSelection: AriaSelection<Option, IsMulti> | null;
381
+ inputIsHidden: boolean;
382
+ isFocused: boolean;
383
+ focusedOption: Option | null;
384
+ focusedOptionId: string | null;
385
+ focusableOptionsWithIds: FocusableOptionWithId<Option>[];
386
+ focusedValue: Option | null;
387
+ selectValue: Options<Option>;
388
+ clearFocusValueOnUpdate: boolean;
389
+ prevWasFocused: boolean;
390
+ inputIsHiddenAfterUpdate: boolean | null | undefined;
391
+ prevProps: SelectProps<Option, IsMulti, Group> | void;
392
+ instancePrefix: string;
393
+ }
394
+ interface CategorizedOption<Option> {
395
+ type: 'option';
396
+ data: Option;
397
+ isDisabled: boolean;
398
+ isSelected: boolean;
399
+ label: string;
400
+ value: string;
401
+ index: number;
402
+ }
403
+ interface FocusableOptionWithId<Option> {
404
+ data: Option;
405
+ id: string;
406
+ }
407
+ interface CategorizedGroup<Option, Group extends GroupBase<Option>> {
408
+ type: 'group';
409
+ data: Group;
410
+ options: readonly CategorizedOption<Option>[];
411
+ index: number;
412
+ }
413
+ type CategorizedGroupOrOption<Option, Group extends GroupBase<Option>> = CategorizedGroup<Option, Group> | CategorizedOption<Option>;
414
+ export default class Select<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> extends Component<SelectProps<Option, IsMulti, Group>, State<Option, IsMulti, Group>> {
415
+ static defaultProps: {
416
+ 'aria-live': string;
417
+ backspaceRemovesValue: boolean;
418
+ blurInputOnSelect: boolean;
419
+ captureMenuScroll: boolean;
420
+ classNames: {};
421
+ closeMenuOnSelect: boolean;
422
+ closeMenuOnScroll: boolean;
423
+ components: {};
424
+ controlShouldRenderValue: boolean;
425
+ escapeClearsValue: boolean;
426
+ filterOption: (option: FilterOptionOption<import("./types").Option>, rawInput: string) => boolean;
427
+ formatGroupLabel: <Option_1, Group_1 extends GroupBase<Option_1>>(group: Group_1) => string;
428
+ getOptionLabel: (option: import("./types").Option) => string;
429
+ getOptionValue: (option: import("./types").Option) => string;
430
+ isDisabled: boolean;
431
+ isLoading: boolean;
432
+ isMulti: boolean;
433
+ isRtl: boolean;
434
+ isSearchable: boolean;
435
+ isOptionDisabled: (option: import("./types").Option) => boolean;
436
+ loadingMessage: () => string;
437
+ maxMenuHeight: number;
438
+ minMenuHeight: number;
439
+ menuIsOpen: boolean;
440
+ menuPlacement: string;
441
+ menuPosition: string;
442
+ menuShouldBlockScroll: boolean;
443
+ menuShouldScrollIntoView: boolean;
444
+ noOptionsMessage: () => string;
445
+ openMenuOnFocus: boolean;
446
+ openMenuOnClick: boolean;
447
+ options: never[];
448
+ pageSize: number;
449
+ placeholder: string;
450
+ screenReaderStatus: ({ count }: {
451
+ count: number;
452
+ }) => string;
453
+ styles: {};
454
+ tabIndex: number;
455
+ tabSelectsValue: boolean;
456
+ unstyled: boolean;
457
+ };
458
+ state: State<Option, IsMulti, Group>;
459
+ blockOptionHover: boolean;
460
+ isComposing: boolean;
461
+ commonProps: any;
462
+ initialTouchX: number;
463
+ initialTouchY: number;
464
+ openAfterFocus: boolean;
465
+ scrollToFocusedOptionOnUpdate: boolean;
466
+ userIsDragging?: boolean;
467
+ isAppleDevice: boolean;
468
+ controlRef: HTMLDivElement | null;
469
+ getControlRef: RefCallback<HTMLDivElement>;
470
+ focusedOptionRef: HTMLDivElement | null;
471
+ getFocusedOptionRef: RefCallback<HTMLDivElement>;
472
+ menuListRef: HTMLUListElement | null;
473
+ getMenuListRef: RefCallback<HTMLUListElement>;
474
+ inputRef: HTMLInputElement | null;
475
+ getInputRef: RefCallback<HTMLInputElement>;
476
+ constructor(props: SelectProps<Option, IsMulti, Group>);
477
+ static getDerivedStateFromProps(props: SelectProps<unknown, boolean, GroupBase<unknown>>, state: State<unknown, boolean, GroupBase<unknown>>): {
478
+ prevProps: SelectProps<unknown, boolean, GroupBase<unknown>>;
479
+ ariaSelection: AriaSelection<unknown, boolean> | null;
480
+ prevWasFocused: boolean;
481
+ inputIsHidden: boolean;
482
+ inputIsHiddenAfterUpdate: undefined;
483
+ } | {
484
+ prevProps: SelectProps<unknown, boolean, GroupBase<unknown>>;
485
+ ariaSelection: AriaSelection<unknown, boolean> | null;
486
+ prevWasFocused: boolean;
487
+ inputIsHidden?: undefined;
488
+ inputIsHiddenAfterUpdate?: undefined;
489
+ };
490
+ componentDidMount(): void;
491
+ componentDidUpdate(prevProps: SelectProps<Option, IsMulti, Group>): void;
492
+ componentWillUnmount(): void;
493
+ onMenuOpen(): void;
494
+ onMenuClose(): void;
495
+ onInputChange(newValue: string, actionMeta: InputActionMeta): void;
496
+ focusInput(): void;
497
+ blurInput(): void;
498
+ focus: () => void;
499
+ blur: () => void;
500
+ openMenu(focusOption: 'first' | 'last'): void;
501
+ focusValue(direction: 'previous' | 'next'): void;
502
+ focusOption(direction?: FocusDirection): void;
503
+ onChange: (newValue: OnChangeValue<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void;
504
+ setValue: (newValue: OnChangeValue<Option, IsMulti>, action: SetValueAction, option?: Option) => void;
505
+ selectOption: (newValue: Option) => void;
506
+ removeValue: (removedValue: Option) => void;
507
+ clearValue: () => void;
508
+ popValue: () => void;
509
+ getTheme(): import("./types").Theme;
510
+ getFocusedOptionId: (focusedOption: Option) => string | null;
511
+ getFocusableOptionsWithIds: () => FocusableOptionWithId<Option>[];
512
+ getValue: () => Options<Option>;
513
+ cx: (...args: any) => string;
514
+ getCommonProps(): {
515
+ clearValue: () => void;
516
+ cx: (...args: any) => string;
517
+ getStyles: <Key extends keyof StylesProps<Option, IsMulti, Group>>(key: Key, props: StylesProps<Option, IsMulti, Group>[Key]) => import("./types").CSSObjectWithLabel;
518
+ getClassNames: <Key_1 extends keyof StylesProps<Option, IsMulti, Group>>(key: Key_1, props: StylesProps<Option, IsMulti, Group>[Key_1]) => string | undefined;
519
+ getValue: () => Options<Option>;
520
+ hasValue: boolean;
521
+ isMulti: IsMulti;
522
+ isRtl: boolean;
523
+ options: OptionsOrGroups<Option, Group>;
524
+ selectOption: (newValue: Option) => void;
525
+ selectProps: Readonly<SelectProps<Option, IsMulti, Group>> & Readonly<{
526
+ children?: React.ReactNode;
527
+ }>;
528
+ setValue: (newValue: OnChangeValue<Option, IsMulti>, action: SetValueAction, option?: Option | undefined) => void;
529
+ theme: import("./types").Theme;
530
+ };
531
+ getOptionLabel: (data: Option) => string;
532
+ getOptionValue: (data: Option) => string;
533
+ getStyles: <Key extends keyof StylesProps<Option, IsMulti, Group>>(key: Key, props: StylesProps<Option, IsMulti, Group>[Key]) => import("./types").CSSObjectWithLabel;
534
+ getClassNames: <Key extends keyof StylesProps<Option, IsMulti, Group>>(key: Key, props: StylesProps<Option, IsMulti, Group>[Key]) => string | undefined;
535
+ getElementId: (element: 'group' | 'input' | 'listbox' | 'option' | 'placeholder' | 'live-region') => string;
536
+ getComponents: () => {
537
+ ClearIndicator: <Option_1, IsMulti_1 extends boolean, Group_1 extends GroupBase<Option_1>>(props: import(".").ClearIndicatorProps<Option_1, IsMulti_1, Group_1>) => import("@emotion/react").jsx.JSX.Element;
538
+ Control: <Option_2, IsMulti_2 extends boolean, Group_2 extends GroupBase<Option_2>>(props: import(".").ControlProps<Option_2, IsMulti_2, Group_2>) => import("@emotion/react").jsx.JSX.Element;
539
+ DropdownIndicator: <Option_3, IsMulti_3 extends boolean, Group_3 extends GroupBase<Option_3>>(props: import(".").DropdownIndicatorProps<Option_3, IsMulti_3, Group_3>) => import("@emotion/react").jsx.JSX.Element;
540
+ DownChevron: (props: import("./components/indicators").DownChevronProps) => import("@emotion/react").jsx.JSX.Element;
541
+ CrossIcon: (props: import("./components/indicators").CrossIconProps) => import("@emotion/react").jsx.JSX.Element;
542
+ Group: <Option_4, IsMulti_4 extends boolean, Group_4 extends GroupBase<Option_4>>(props: import(".").GroupProps<Option_4, IsMulti_4, Group_4>) => import("@emotion/react").jsx.JSX.Element;
543
+ GroupHeading: <Option_5, IsMulti_5 extends boolean, Group_5 extends GroupBase<Option_5>>(props: import(".").GroupHeadingProps<Option_5, IsMulti_5, Group_5>) => import("@emotion/react").jsx.JSX.Element;
544
+ IndicatorsContainer: <Option_6, IsMulti_6 extends boolean, Group_6 extends GroupBase<Option_6>>(props: import(".").IndicatorsContainerProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
545
+ IndicatorSeparator: <Option_7, IsMulti_7 extends boolean, Group_7 extends GroupBase<Option_7>>(props: import(".").IndicatorSeparatorProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
546
+ Input: <Option_8, IsMulti_8 extends boolean, Group_8 extends GroupBase<Option_8>>(props: import(".").InputProps<Option_8, IsMulti_8, Group_8>) => import("@emotion/react").jsx.JSX.Element;
547
+ /**
548
+ * Sets a className attribute on the outer component
549
+ */
550
+ LoadingIndicator: <Option_9, IsMulti_9 extends boolean, Group_9 extends GroupBase<Option_9>>({ innerProps, isRtl, size, ...restProps }: import(".").LoadingIndicatorProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
551
+ Menu: <Option_10, IsMulti_10 extends boolean, Group_10 extends GroupBase<Option_10>>(props: import("./components/menu").MenuProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
552
+ MenuList: <Option_11, IsMulti_11 extends boolean, Group_11 extends GroupBase<Option_11>>(props: import("./components/menu").MenuListProps<Option_11, IsMulti_11, Group_11>) => import("@emotion/react").jsx.JSX.Element;
553
+ MenuPortal: <Option_12, IsMulti_12 extends boolean, Group_12 extends GroupBase<Option_12>>(props: import("./components/menu").MenuPortalProps<Option_12, IsMulti_12, Group_12>) => import("@emotion/react").jsx.JSX.Element | null;
554
+ LoadingMessage: <Option_13, IsMulti_13 extends boolean, Group_13 extends GroupBase<Option_13>>({ children, innerProps, ...restProps }: import("./components/menu").NoticeProps<Option_13, IsMulti_13, Group_13>) => import("@emotion/react").jsx.JSX.Element;
555
+ NoOptionsMessage: <Option_14, IsMulti_14 extends boolean, Group_14 extends GroupBase<Option_14>>({ children, innerProps, ...restProps }: import("./components/menu").NoticeProps<Option_14, IsMulti_14, Group_14>) => import("@emotion/react").jsx.JSX.Element;
556
+ MultiValue: <Option_15, IsMulti_15 extends boolean, Group_15 extends GroupBase<Option_15>>(props: import(".").MultiValueProps<Option_15, IsMulti_15, Group_15>) => import("@emotion/react").jsx.JSX.Element;
557
+ MultiValueContainer: <Option_16, IsMulti_16 extends boolean, Group_16 extends GroupBase<Option_16>>({ children, innerProps, }: import(".").MultiValueGenericProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
558
+ MultiValueLabel: <Option_16, IsMulti_16 extends boolean, Group_16 extends GroupBase<Option_16>>({ children, innerProps, }: import(".").MultiValueGenericProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
559
+ MultiValueRemove: typeof import("./components/multi-value").MultiValueRemove;
560
+ Option: <Option_17, IsMulti_17 extends boolean, Group_17 extends GroupBase<Option_17>>(props: import(".").OptionProps<Option_17, IsMulti_17, Group_17>) => import("@emotion/react").jsx.JSX.Element;
561
+ Placeholder: <Option_18, IsMulti_18 extends boolean, Group_18 extends GroupBase<Option_18>>(props: import(".").PlaceholderProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element;
562
+ SelectContainer: <Option_19, IsMulti_19 extends boolean, Group_19 extends GroupBase<Option_19>>(props: import(".").ContainerProps<Option_19, IsMulti_19, Group_19>) => import("@emotion/react").jsx.JSX.Element;
563
+ SingleValue: <Option_20, IsMulti_20 extends boolean, Group_20 extends GroupBase<Option_20>>(props: import(".").SingleValueProps<Option_20, IsMulti_20, Group_20>) => import("@emotion/react").jsx.JSX.Element;
564
+ ValueContainer: <Option_21, IsMulti_21 extends boolean, Group_21 extends GroupBase<Option_21>>(props: import(".").ValueContainerProps<Option_21, IsMulti_21, Group_21>) => import("@emotion/react").jsx.JSX.Element;
565
+ };
566
+ buildCategorizedOptions: () => CategorizedGroupOrOption<Option, Group>[];
567
+ getCategorizedOptions: () => CategorizedGroupOrOption<Option, Group>[];
568
+ buildFocusableOptions: () => Option[];
569
+ getFocusableOptions: () => Option[];
570
+ ariaOnChange: (value: OnChangeValue<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void;
571
+ hasValue(): boolean;
572
+ hasOptions(): boolean;
573
+ isClearable(): boolean;
574
+ isOptionDisabled(option: Option, selectValue: Options<Option>): boolean;
575
+ isOptionSelected(option: Option, selectValue: Options<Option>): boolean;
576
+ filterOption(option: FilterOptionOption<Option>, inputValue: string): boolean;
577
+ formatOptionLabel(data: Option, context: FormatOptionLabelContext): ReactNode;
578
+ formatGroupLabel(data: Group): React.ReactNode;
579
+ onMenuMouseDown: MouseEventHandler<HTMLDivElement>;
580
+ onMenuMouseMove: MouseEventHandler<HTMLDivElement>;
581
+ onControlMouseDown: (event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => void;
582
+ onDropdownIndicatorMouseDown: (event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => void;
583
+ onClearIndicatorMouseDown: (event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => void;
584
+ onScroll: (event: Event) => void;
585
+ startListeningComposition(): void;
586
+ stopListeningComposition(): void;
587
+ onCompositionStart: () => void;
588
+ onCompositionEnd: () => void;
589
+ startListeningToTouch(): void;
590
+ stopListeningToTouch(): void;
591
+ onTouchStart: ({ touches }: TouchEvent) => void;
592
+ onTouchMove: ({ touches }: TouchEvent) => void;
593
+ onTouchEnd: (event: TouchEvent) => void;
594
+ onControlTouchEnd: TouchEventHandler<HTMLDivElement>;
595
+ onClearIndicatorTouchEnd: TouchEventHandler<HTMLDivElement>;
596
+ onDropdownIndicatorTouchEnd: TouchEventHandler<HTMLDivElement>;
597
+ handleInputChange: FormEventHandler<HTMLInputElement>;
598
+ onInputFocus: FocusEventHandler<HTMLInputElement>;
599
+ onInputBlur: FocusEventHandler<HTMLInputElement>;
600
+ onOptionHover: (focusedOption: Option) => void;
601
+ shouldHideSelectedOptions: () => boolean;
602
+ onValueInputFocus: FocusEventHandler;
603
+ onKeyDown: KeyboardEventHandler<HTMLDivElement>;
604
+ renderInput(): JSX.Element;
605
+ renderPlaceholderOrValue(): JSX.Element | JSX.Element[] | null;
606
+ renderClearIndicator(): JSX.Element | null;
607
+ renderLoadingIndicator(): JSX.Element | null;
608
+ renderIndicatorSeparator(): JSX.Element | null;
609
+ renderDropdownIndicator(): JSX.Element | null;
610
+ renderMenu(): JSX.Element | null;
611
+ renderFormField(): JSX.Element | undefined;
612
+ renderLiveRegion(): JSX.Element;
613
+ render(): JSX.Element;
614
+ }
615
+ export type PublicBaseSelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = JSX.LibraryManagedAttributes<typeof Select, SelectProps<Option, IsMulti, Group>>;
616
+ export {};
@@ -0,0 +1,17 @@
1
+ import { type ReactElement, type RefAttributes } from 'react';
2
+ import Select from './select';
3
+ import { type GroupBase } from './types';
4
+ import { type StateManagerProps } from './use-state-manager';
5
+ export type { StateManagerProps };
6
+ /**
7
+ * __StateManagedSelect__
8
+ *
9
+ * A state managed select {description}.
10
+ *
11
+ * - [Examples](https://atlassian.design/components/{packageName}/examples)
12
+ * - [Code](https://atlassian.design/components/{packageName}/code)
13
+ * - [Usage](https://atlassian.design/components/{packageName}/usage)
14
+ */
15
+ type StateManagedSelect = <Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: StateManagerProps<Option, IsMulti, Group> & RefAttributes<Select<Option, IsMulti, Group>>) => ReactElement;
16
+ declare const StateManagedSelect: StateManagedSelect;
17
+ export default StateManagedSelect;