@instructure/ui-select 8.13.1-snapshot.2 → 8.13.1-snapshot.27
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/es/Select/Group/index.js +2 -3
- package/es/Select/Group/props.js +0 -7
- package/es/Select/Option/index.js +2 -2
- package/es/Select/Option/props.js +0 -27
- package/es/Select/SelectLocator.js +5 -2
- package/es/Select/index.js +92 -85
- package/es/Select/props.js +2 -142
- package/lib/Select/Group/index.js +2 -3
- package/lib/Select/Group/props.js +0 -7
- package/lib/Select/Option/index.js +2 -2
- package/lib/Select/Option/props.js +0 -27
- package/lib/Select/SelectLocator.js +3 -0
- package/lib/Select/index.js +96 -86
- package/lib/Select/props.js +2 -142
- package/package.json +23 -23
- package/src/Select/Group/index.tsx +2 -3
- package/src/Select/Group/props.ts +8 -8
- package/src/Select/Option/index.tsx +2 -2
- package/src/Select/Option/props.ts +33 -25
- package/src/Select/index.tsx +160 -168
- package/src/Select/props.ts +176 -117
- package/tsconfig.build.json +27 -2
- package/tsconfig.build.tsbuildinfo +1 -0
- package/types/Select/Group/index.d.ts +4 -5
- package/types/Select/Group/index.d.ts.map +1 -1
- package/types/Select/Group/props.d.ts +7 -1
- package/types/Select/Group/props.d.ts.map +1 -1
- package/types/Select/Option/index.d.ts +3 -7
- package/types/Select/Option/index.d.ts.map +1 -1
- package/types/Select/Option/props.d.ts +28 -4
- package/types/Select/Option/props.d.ts.map +1 -1
- package/types/Select/SelectLocator.d.ts +117 -117
- package/types/Select/index.d.ts +68 -99
- package/types/Select/index.d.ts.map +1 -1
- package/types/Select/props.d.ts +146 -21
- package/types/Select/props.d.ts.map +1 -1
package/src/Select/props.ts
CHANGED
|
@@ -46,190 +46,249 @@ import type {
|
|
|
46
46
|
} from '@instructure/ui-position'
|
|
47
47
|
|
|
48
48
|
type SelectOwnProps = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The id of the text input. One is generated if not supplied.
|
|
51
|
+
*/
|
|
52
52
|
id?: string
|
|
53
|
-
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Additional helpful text to provide to screen readers about the operation
|
|
56
|
+
* of the component.
|
|
57
|
+
*/
|
|
54
58
|
assistiveText?: string
|
|
55
|
-
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
62
|
+
* When "disabled", the input changes visibly to indicate that it cannot
|
|
63
|
+
* receive user interactions. When "readonly" the input still cannot receive
|
|
64
|
+
* user interactions but it keeps the same styles as if it were enabled.
|
|
65
|
+
*/
|
|
56
66
|
interaction?: 'enabled' | 'disabled' | 'readonly'
|
|
57
|
-
isRequired?: boolean
|
|
58
|
-
isInline?: boolean
|
|
59
|
-
width?: string
|
|
60
|
-
htmlSize?: string | number
|
|
61
|
-
optionsMaxWidth?: string
|
|
62
|
-
visibleOptionsCount?: number
|
|
63
|
-
messages?: FormMessage[]
|
|
64
|
-
placement?: PlacementPropValues
|
|
65
|
-
constrain?: PositionConstraint
|
|
66
|
-
mountNode?: PositionMountNode
|
|
67
|
-
onFocus?: (...args: any[]) => any
|
|
68
|
-
onBlur?: (...args: any[]) => any
|
|
69
|
-
onInputChange?: (...args: any[]) => any
|
|
70
|
-
onRequestShowOptions?: (...args: any[]) => any
|
|
71
|
-
onRequestHideOptions?: (...args: any[]) => any
|
|
72
|
-
onRequestHighlightOption?: (...args: any[]) => any
|
|
73
|
-
onRequestSelectOption?: (...args: any[]) => any
|
|
74
|
-
inputRef?: (...args: any[]) => any
|
|
75
|
-
listRef?: (...args: any[]) => any
|
|
76
|
-
renderBeforeInput?: React.ReactNode | ((...args: any[]) => any)
|
|
77
|
-
renderAfterInput?: React.ReactNode | ((...args: any[]) => any)
|
|
78
|
-
shouldNotWrap?: boolean
|
|
79
|
-
children?: React.ReactNode
|
|
80
|
-
}
|
|
81
67
|
|
|
82
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Whether the input is rendered inline with other elements or if it
|
|
70
|
+
* is rendered as a block level element.
|
|
71
|
+
*/
|
|
72
|
+
isInline?: boolean
|
|
83
73
|
|
|
84
|
-
|
|
74
|
+
/**
|
|
75
|
+
* The max width the options list can be before option text wraps. If not
|
|
76
|
+
* set, the list will only display as wide as the text input.
|
|
77
|
+
*/
|
|
78
|
+
optionsMaxWidth?: string
|
|
85
79
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
/**
|
|
81
|
+
* The number of options that should be visible before having to scroll.
|
|
82
|
+
*/
|
|
83
|
+
visibleOptionsCount?: number
|
|
89
84
|
|
|
90
|
-
|
|
85
|
+
// Passed directly to TextInput as `value`
|
|
86
|
+
/**
|
|
87
|
+
* The value to display in the text input.
|
|
88
|
+
*/
|
|
89
|
+
inputValue?: string
|
|
91
90
|
|
|
92
|
-
|
|
91
|
+
// Passed directly to TextInput as `onChange`
|
|
93
92
|
/**
|
|
94
|
-
*
|
|
93
|
+
* Callback fired when text input value changes.
|
|
95
94
|
*/
|
|
96
|
-
|
|
95
|
+
onInputChange?: (
|
|
96
|
+
event: React.ChangeEvent<HTMLInputElement>,
|
|
97
|
+
value: string
|
|
98
|
+
) => void
|
|
99
|
+
|
|
97
100
|
/**
|
|
98
|
-
*
|
|
101
|
+
* A ref to the html `ul` element.
|
|
99
102
|
*/
|
|
100
|
-
|
|
103
|
+
listRef?: (listElement: HTMLUListElement | null) => void
|
|
104
|
+
|
|
101
105
|
/**
|
|
102
|
-
*
|
|
106
|
+
* Children of type `<Select.Option />` or `<Select.Group />`.
|
|
103
107
|
*/
|
|
104
|
-
|
|
108
|
+
children?: React.ReactNode // TODO: ChildrenPropTypes.oneOf([Group, Option])
|
|
109
|
+
} & PropsFromSelectable &
|
|
110
|
+
PropsFromTextInput &
|
|
111
|
+
PropsFromPopover
|
|
112
|
+
|
|
113
|
+
// These props are directly passed to Selectable
|
|
114
|
+
// TODO: import these from Selectable once TS types can be imported
|
|
115
|
+
type PropsFromSelectable = {
|
|
105
116
|
/**
|
|
106
|
-
*
|
|
117
|
+
* Whether or not to show the options list.
|
|
107
118
|
*/
|
|
108
|
-
|
|
119
|
+
isShowingOptions?: boolean
|
|
120
|
+
|
|
109
121
|
/**
|
|
110
|
-
*
|
|
122
|
+
* Callback fired requesting that the options list be shown.
|
|
111
123
|
*/
|
|
112
|
-
|
|
124
|
+
onRequestShowOptions?: (event: React.SyntheticEvent) => void
|
|
125
|
+
|
|
113
126
|
/**
|
|
114
|
-
*
|
|
115
|
-
* of the component.
|
|
127
|
+
* Callback fired requesting that the options list be hidden.
|
|
116
128
|
*/
|
|
117
|
-
|
|
129
|
+
onRequestHideOptions?: (event: React.SyntheticEvent) => void
|
|
130
|
+
|
|
118
131
|
/**
|
|
119
|
-
*
|
|
120
|
-
* be hint text, not a label replacement.
|
|
132
|
+
* Callback fired requesting a particular option be highlighted.
|
|
121
133
|
*/
|
|
122
|
-
|
|
134
|
+
onRequestHighlightOption?: (
|
|
135
|
+
event: React.SyntheticEvent,
|
|
136
|
+
data: { id?: string; direction?: 1 | -1 }
|
|
137
|
+
) => void
|
|
138
|
+
|
|
123
139
|
/**
|
|
124
|
-
*
|
|
125
|
-
* When "disabled", the input changes visibly to indicate that it cannot
|
|
126
|
-
* receive user interactions. When "readonly" the input still cannot receive
|
|
127
|
-
* user interactions but it keeps the same styles as if it were enabled.
|
|
140
|
+
* Callback fired requesting a particular option be selected.
|
|
128
141
|
*/
|
|
129
|
-
|
|
142
|
+
onRequestSelectOption?: (
|
|
143
|
+
event: React.SyntheticEvent,
|
|
144
|
+
data: { id?: string }
|
|
145
|
+
) => void
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// These props are directly passed to TextInput
|
|
149
|
+
// TODO: import these from TextInput once TS types can be imported
|
|
150
|
+
type PropsFromTextInput = {
|
|
130
151
|
/**
|
|
131
|
-
*
|
|
152
|
+
* The form field label.
|
|
132
153
|
*/
|
|
133
|
-
|
|
154
|
+
renderLabel: React.ReactNode | (() => React.ReactNode)
|
|
155
|
+
|
|
134
156
|
/**
|
|
135
|
-
*
|
|
136
|
-
* is rendered as a block level element.
|
|
157
|
+
* The size of the text input.
|
|
137
158
|
*/
|
|
138
|
-
|
|
159
|
+
size?: 'small' | 'medium' | 'large'
|
|
160
|
+
|
|
139
161
|
/**
|
|
140
|
-
*
|
|
162
|
+
* Html placeholder text to display when the input has no value. This should
|
|
163
|
+
* be hint text, not a label replacement.
|
|
141
164
|
*/
|
|
142
|
-
|
|
165
|
+
placeholder?: string
|
|
166
|
+
|
|
143
167
|
/**
|
|
144
|
-
*
|
|
145
|
-
* provided via the `width` prop. Only applicable if `isInline={true}`.
|
|
168
|
+
* Whether or not the text input is required.
|
|
146
169
|
*/
|
|
147
|
-
|
|
170
|
+
isRequired?: boolean
|
|
171
|
+
|
|
148
172
|
/**
|
|
149
|
-
* The
|
|
150
|
-
* set, the list will only display as wide as the text input.
|
|
173
|
+
* The width of the text input.
|
|
151
174
|
*/
|
|
152
|
-
|
|
175
|
+
width?: string
|
|
176
|
+
|
|
153
177
|
/**
|
|
154
|
-
* The
|
|
178
|
+
* The width of the input (integer value 0 or higher), if a width is not explicitly
|
|
179
|
+
* provided via the `width` prop.
|
|
180
|
+
*
|
|
181
|
+
* Only applicable if `isInline={true}`.
|
|
182
|
+
*
|
|
183
|
+
* For more see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/size
|
|
155
184
|
*/
|
|
156
|
-
|
|
185
|
+
htmlSize?: number
|
|
186
|
+
|
|
157
187
|
/**
|
|
158
188
|
* Displays messages and validation for the input. It should be an object
|
|
159
189
|
* with the following shape:
|
|
160
190
|
* `{
|
|
161
|
-
* text:
|
|
162
|
-
* type:
|
|
191
|
+
* text: React.ReactNode,
|
|
192
|
+
* type: One of: ['error', 'hint', 'success', 'screenreader-only']
|
|
163
193
|
* }`
|
|
164
194
|
*/
|
|
165
|
-
messages
|
|
195
|
+
messages?: FormMessage[]
|
|
196
|
+
|
|
166
197
|
/**
|
|
167
|
-
*
|
|
198
|
+
* Callback fired when text input receives focus.
|
|
168
199
|
*/
|
|
169
|
-
|
|
200
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void
|
|
201
|
+
|
|
170
202
|
/**
|
|
171
|
-
*
|
|
203
|
+
* Callback fired when text input loses focus.
|
|
172
204
|
*/
|
|
173
|
-
|
|
205
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void
|
|
206
|
+
|
|
174
207
|
/**
|
|
175
|
-
*
|
|
176
|
-
* list to in the DOM (defaults to `document.body`)
|
|
208
|
+
* A ref to the html `input` element.
|
|
177
209
|
*/
|
|
178
|
-
|
|
210
|
+
inputRef?: (inputElement: HTMLInputElement | null) => void
|
|
211
|
+
|
|
179
212
|
/**
|
|
180
|
-
*
|
|
213
|
+
* Content to display before the text input. This will commonly be an icon or
|
|
214
|
+
* tags to show multiple selections.
|
|
181
215
|
*/
|
|
182
|
-
|
|
216
|
+
renderBeforeInput?: React.ReactNode | (() => React.ReactNode)
|
|
217
|
+
|
|
183
218
|
/**
|
|
184
|
-
*
|
|
219
|
+
* Content to display after the text input. This content will replace the
|
|
220
|
+
* default arrow icons.
|
|
185
221
|
*/
|
|
186
|
-
|
|
222
|
+
renderAfterInput?: React.ReactNode | (() => React.ReactNode)
|
|
223
|
+
|
|
187
224
|
/**
|
|
188
|
-
*
|
|
225
|
+
* Prevents the default behavior of wrapping the input and rendered content
|
|
226
|
+
* when available space is exceeded.
|
|
189
227
|
*/
|
|
190
|
-
|
|
228
|
+
shouldNotWrap?: boolean
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// These props are directly passed to Popover
|
|
232
|
+
// TODO: import these from Popover once TS types can be imported
|
|
233
|
+
type PropsFromPopover = {
|
|
191
234
|
/**
|
|
192
|
-
*
|
|
235
|
+
* The placement of the options list.
|
|
193
236
|
*/
|
|
194
|
-
|
|
237
|
+
placement?: PlacementPropValues
|
|
238
|
+
|
|
195
239
|
/**
|
|
196
|
-
*
|
|
240
|
+
* The parent in which to constrain the placement.
|
|
197
241
|
*/
|
|
198
|
-
|
|
242
|
+
constrain?: PositionConstraint
|
|
243
|
+
|
|
199
244
|
/**
|
|
200
|
-
*
|
|
245
|
+
* An element or a function returning an element to use mount the options
|
|
246
|
+
* list to in the DOM (defaults to `document.body`)
|
|
201
247
|
*/
|
|
248
|
+
mountNode?: PositionMountNode
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
type PropKeys = keyof SelectOwnProps
|
|
252
|
+
|
|
253
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
254
|
+
|
|
255
|
+
type SelectProps = SelectOwnProps &
|
|
256
|
+
WithStyleProps<SelectTheme, SelectStyle> &
|
|
257
|
+
OtherHTMLAttributes<SelectOwnProps, InputHTMLAttributes<SelectOwnProps>>
|
|
258
|
+
|
|
259
|
+
type SelectStyle = ComponentStyle<'select' | 'icon' | 'assistiveText'>
|
|
260
|
+
|
|
261
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
262
|
+
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
263
|
+
inputValue: PropTypes.string,
|
|
264
|
+
id: PropTypes.string,
|
|
265
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
266
|
+
assistiveText: PropTypes.string,
|
|
267
|
+
placeholder: PropTypes.string,
|
|
268
|
+
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
269
|
+
isRequired: PropTypes.bool,
|
|
270
|
+
isInline: PropTypes.bool,
|
|
271
|
+
width: PropTypes.string,
|
|
272
|
+
htmlSize: PropTypes.number,
|
|
273
|
+
optionsMaxWidth: PropTypes.string,
|
|
274
|
+
visibleOptionsCount: PropTypes.number,
|
|
275
|
+
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
276
|
+
placement: PositionPropTypes.placement,
|
|
277
|
+
constrain: PositionPropTypes.constrain,
|
|
278
|
+
mountNode: PositionPropTypes.mountNode,
|
|
279
|
+
onFocus: PropTypes.func,
|
|
280
|
+
onBlur: PropTypes.func,
|
|
281
|
+
onInputChange: PropTypes.func,
|
|
282
|
+
isShowingOptions: PropTypes.bool,
|
|
283
|
+
onRequestShowOptions: PropTypes.func,
|
|
284
|
+
onRequestHideOptions: PropTypes.func,
|
|
202
285
|
onRequestHighlightOption: PropTypes.func,
|
|
203
|
-
/**
|
|
204
|
-
* Callback fired requesting a particular option be selected.
|
|
205
|
-
*/
|
|
206
286
|
onRequestSelectOption: PropTypes.func,
|
|
207
|
-
/**
|
|
208
|
-
* A ref to the html `input` element.
|
|
209
|
-
*/
|
|
210
287
|
inputRef: PropTypes.func,
|
|
211
|
-
/**
|
|
212
|
-
* A ref to the html `ul` element.
|
|
213
|
-
*/
|
|
214
288
|
listRef: PropTypes.func,
|
|
215
|
-
/**
|
|
216
|
-
* Content to display before the text input. This will commonly be an icon or
|
|
217
|
-
* tags to show multiple selections.
|
|
218
|
-
*/
|
|
219
289
|
renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
220
|
-
/**
|
|
221
|
-
* Content to display after the text input. This content will replace the
|
|
222
|
-
* default arrow icons.
|
|
223
|
-
*/
|
|
224
290
|
renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
225
|
-
/**
|
|
226
|
-
* Children of type `<Select.Option />` or `<Select.Group />`.
|
|
227
|
-
*/
|
|
228
291
|
children: ChildrenPropTypes.oneOf([Group, Option]),
|
|
229
|
-
/**
|
|
230
|
-
* Prevents the default behavior of wrapping the input and rendered content
|
|
231
|
-
* when available space is exceeded.
|
|
232
|
-
*/
|
|
233
292
|
shouldNotWrap: PropTypes.bool
|
|
234
293
|
}
|
|
235
294
|
|
package/tsconfig.build.json
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../tsconfig.build.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"outDir": "./types"
|
|
4
|
+
"outDir": "./types",
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"composite": true
|
|
5
7
|
},
|
|
6
|
-
"include": ["src
|
|
8
|
+
"include": ["src"],
|
|
9
|
+
"references": [
|
|
10
|
+
{ "path": "../ui-babel-preset/tsconfig.build.json" },
|
|
11
|
+
{ "path": "../ui-color-utils/tsconfig.build.json" },
|
|
12
|
+
{ "path": "../ui-test-locator/tsconfig.build.json" },
|
|
13
|
+
{ "path": "../ui-test-utils/tsconfig.build.json" },
|
|
14
|
+
{ "path": "../ui-themes/tsconfig.build.json" },
|
|
15
|
+
{ "path": "../emotion/tsconfig.build.json" },
|
|
16
|
+
{ "path": "../shared-types/tsconfig.build.json" },
|
|
17
|
+
{ "path": "../ui-dom-utils/tsconfig.build.json" },
|
|
18
|
+
{ "path": "../ui-form-field/tsconfig.build.json" },
|
|
19
|
+
{ "path": "../ui-icons/tsconfig.build.json" },
|
|
20
|
+
{ "path": "../ui-options/tsconfig.build.json" },
|
|
21
|
+
{ "path": "../ui-popover/tsconfig.build.json" },
|
|
22
|
+
{ "path": "../ui-position/tsconfig.build.json" },
|
|
23
|
+
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
24
|
+
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
25
|
+
{ "path": "../ui-selectable/tsconfig.build.json" },
|
|
26
|
+
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
27
|
+
{ "path": "../ui-text-input/tsconfig.build.json" },
|
|
28
|
+
{ "path": "../ui-utils/tsconfig.build.json" },
|
|
29
|
+
{ "path": "../ui-view/tsconfig.build.json" },
|
|
30
|
+
{ "path": "../uid/tsconfig.build.json" }
|
|
31
|
+
]
|
|
7
32
|
}
|