@instructure/ui-simple-select 8.8.1-snapshot.3 → 8.8.1-snapshot.63
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/SimpleSelect/Group/index.js +4 -15
- package/{src/SimpleSelect/Group/types.ts → es/SimpleSelect/Group/props.js} +15 -3
- package/es/SimpleSelect/Option/index.js +4 -35
- package/es/SimpleSelect/Option/props.js +57 -0
- package/es/SimpleSelect/index.js +3 -175
- package/es/SimpleSelect/props.js +192 -0
- package/lib/SimpleSelect/Group/index.js +3 -18
- package/{src/SimpleSelect/Option/types.ts → lib/SimpleSelect/Group/props.js} +28 -7
- package/lib/SimpleSelect/Option/index.js +3 -36
- package/lib/SimpleSelect/Option/props.js +68 -0
- package/lib/SimpleSelect/index.js +3 -178
- package/lib/SimpleSelect/props.js +208 -0
- package/package.json +15 -15
- package/src/SimpleSelect/Group/index.tsx +4 -16
- package/src/SimpleSelect/{types.ts → Group/props.ts} +31 -35
- package/src/SimpleSelect/Option/index.tsx +4 -31
- package/src/SimpleSelect/Option/props.ts +80 -0
- package/src/SimpleSelect/index.tsx +5 -149
- package/src/SimpleSelect/props.ts +247 -0
- package/src/index.ts +3 -3
- package/types/SimpleSelect/Group/index.d.ts +9 -15
- package/types/SimpleSelect/Group/index.d.ts.map +1 -1
- package/types/SimpleSelect/Group/props.d.ts +14 -0
- package/types/SimpleSelect/Group/props.d.ts.map +1 -0
- package/types/SimpleSelect/Option/index.d.ts +17 -30
- package/types/SimpleSelect/Option/index.d.ts.map +1 -1
- package/types/SimpleSelect/Option/props.d.ts +18 -0
- package/types/SimpleSelect/Option/props.d.ts.map +1 -0
- package/types/SimpleSelect/index.d.ts +61 -150
- package/types/SimpleSelect/index.d.ts.map +1 -1
- package/types/SimpleSelect/{types.d.ts → props.d.ts} +11 -2
- package/types/SimpleSelect/props.d.ts.map +1 -0
- package/types/index.d.ts +3 -3
- package/es/SimpleSelect/Group/types.js +0 -1
- package/es/SimpleSelect/Option/types.js +0 -1
- package/es/SimpleSelect/types.js +0 -1
- package/lib/SimpleSelect/Group/types.js +0 -1
- package/lib/SimpleSelect/Option/types.js +0 -1
- package/lib/SimpleSelect/types.js +0 -1
- package/types/SimpleSelect/Group/types.d.ts +0 -5
- package/types/SimpleSelect/Group/types.d.ts.map +0 -1
- package/types/SimpleSelect/Option/types.d.ts +0 -9
- package/types/SimpleSelect/Option/types.d.ts.map +0 -1
- package/types/SimpleSelect/types.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-simple-select",
|
|
3
|
-
"version": "8.8.1-snapshot.
|
|
3
|
+
"version": "8.8.1-snapshot.63+ec21bbc1d",
|
|
4
4
|
"description": "A component for standard select element behavior.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,22 +25,22 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.8.1-snapshot.
|
|
29
|
-
"@instructure/ui-form-field": "8.8.1-snapshot.
|
|
30
|
-
"@instructure/ui-position": "8.8.1-snapshot.
|
|
31
|
-
"@instructure/ui-prop-types": "8.8.1-snapshot.
|
|
32
|
-
"@instructure/ui-react-utils": "8.8.1-snapshot.
|
|
33
|
-
"@instructure/ui-select": "8.8.1-snapshot.
|
|
34
|
-
"@instructure/ui-testable": "8.8.1-snapshot.
|
|
35
|
-
"@instructure/uid": "8.8.1-snapshot.
|
|
28
|
+
"@instructure/console": "8.8.1-snapshot.63+ec21bbc1d",
|
|
29
|
+
"@instructure/ui-form-field": "8.8.1-snapshot.63+ec21bbc1d",
|
|
30
|
+
"@instructure/ui-position": "8.8.1-snapshot.63+ec21bbc1d",
|
|
31
|
+
"@instructure/ui-prop-types": "8.8.1-snapshot.63+ec21bbc1d",
|
|
32
|
+
"@instructure/ui-react-utils": "8.8.1-snapshot.63+ec21bbc1d",
|
|
33
|
+
"@instructure/ui-select": "8.8.1-snapshot.63+ec21bbc1d",
|
|
34
|
+
"@instructure/ui-testable": "8.8.1-snapshot.63+ec21bbc1d",
|
|
35
|
+
"@instructure/uid": "8.8.1-snapshot.63+ec21bbc1d",
|
|
36
36
|
"prop-types": "^15"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@instructure/ui-babel-preset": "8.8.1-snapshot.
|
|
40
|
-
"@instructure/ui-color-utils": "8.8.1-snapshot.
|
|
41
|
-
"@instructure/ui-icons": "8.8.1-snapshot.
|
|
42
|
-
"@instructure/ui-test-locator": "8.8.1-snapshot.
|
|
43
|
-
"@instructure/ui-test-utils": "8.8.1-snapshot.
|
|
39
|
+
"@instructure/ui-babel-preset": "8.8.1-snapshot.63+ec21bbc1d",
|
|
40
|
+
"@instructure/ui-color-utils": "8.8.1-snapshot.63+ec21bbc1d",
|
|
41
|
+
"@instructure/ui-icons": "8.8.1-snapshot.63+ec21bbc1d",
|
|
42
|
+
"@instructure/ui-test-locator": "8.8.1-snapshot.63+ec21bbc1d",
|
|
43
|
+
"@instructure/ui-test-utils": "8.8.1-snapshot.63+ec21bbc1d"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": ">=16.8 <=17"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"sideEffects": false,
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "ec21bbc1dcdd8567b11f2c15f5fadd16709d7e3d"
|
|
53
53
|
}
|
|
@@ -23,11 +23,9 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { SimpleSelectGroupProps } from './types'
|
|
27
|
+
import type { SimpleSelectGroupProps } from './props'
|
|
28
|
+
import { allowedProps, propTypes } from './props'
|
|
31
29
|
|
|
32
30
|
/**
|
|
33
31
|
---
|
|
@@ -37,18 +35,8 @@ id: SimpleSelect.Group
|
|
|
37
35
|
**/
|
|
38
36
|
class Group extends Component<SimpleSelectGroupProps> {
|
|
39
37
|
static readonly componentId = 'SimpleSelect.Group'
|
|
40
|
-
|
|
41
|
-
static propTypes =
|
|
42
|
-
/**
|
|
43
|
-
* The label associated with the group options.
|
|
44
|
-
*/
|
|
45
|
-
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
46
|
-
.isRequired,
|
|
47
|
-
/**
|
|
48
|
-
* Children of type `<SimpleSelect.Option />` that will be considered part of the group.
|
|
49
|
-
*/
|
|
50
|
-
children: ChildrenPropTypes.oneOf([Option])
|
|
51
|
-
}
|
|
38
|
+
static allowedProps = allowedProps
|
|
39
|
+
static propTypes = propTypes
|
|
52
40
|
|
|
53
41
|
static defaultProps = {
|
|
54
42
|
children: null
|
|
@@ -21,41 +21,37 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
24
|
import React from 'react'
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
26
|
+
|
|
27
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
28
|
+
|
|
29
|
+
import { Option } from '../Option'
|
|
30
|
+
|
|
31
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
32
|
+
|
|
33
|
+
type SimpleSelectGroupOwnProps = {
|
|
34
34
|
renderLabel: React.ReactNode | ((...args: any[]) => any)
|
|
35
|
-
|
|
36
|
-
defaultValue?: string
|
|
37
|
-
id?: string
|
|
38
|
-
size?: 'small' | 'medium' | 'large'
|
|
39
|
-
assistiveText?: string
|
|
40
|
-
placeholder?: string
|
|
41
|
-
interaction?: 'enabled' | 'disabled' | 'readonly'
|
|
42
|
-
isRequired?: boolean
|
|
43
|
-
isInline?: boolean
|
|
44
|
-
width?: string
|
|
45
|
-
optionsMaxWidth?: string
|
|
46
|
-
visibleOptionsCount?: number
|
|
47
|
-
messages?: FormMessage[]
|
|
48
|
-
placement?: PlacementPropValues
|
|
49
|
-
constrain?: PositionConstraint
|
|
50
|
-
mountNode?: PositionMountNode
|
|
51
|
-
onChange?: (...args: any[]) => any
|
|
52
|
-
onFocus?: (...args: any[]) => any
|
|
53
|
-
onBlur?: (...args: any[]) => any
|
|
54
|
-
onShowOptions?: (...args: any[]) => any
|
|
55
|
-
onHideOptions?: (...args: any[]) => any
|
|
56
|
-
inputRef?: (...args: any[]) => any
|
|
57
|
-
listRef?: (...args: any[]) => any
|
|
58
|
-
renderEmptyOption?: React.ReactNode | ((...args: any[]) => any)
|
|
59
|
-
renderBeforeInput?: React.ReactNode | ((...args: any[]) => any)
|
|
60
|
-
renderAfterInput?: React.ReactNode | ((...args: any[]) => any)
|
|
35
|
+
children?: React.ReactNode
|
|
61
36
|
}
|
|
37
|
+
type PropKeys = keyof SimpleSelectGroupOwnProps
|
|
38
|
+
|
|
39
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
40
|
+
|
|
41
|
+
type SimpleSelectGroupProps = SimpleSelectGroupOwnProps
|
|
42
|
+
|
|
43
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
44
|
+
/**
|
|
45
|
+
* The label associated with the group options.
|
|
46
|
+
*/
|
|
47
|
+
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
48
|
+
/**
|
|
49
|
+
* Children of type `<SimpleSelect.Option />` that will be considered part of the group.
|
|
50
|
+
*/
|
|
51
|
+
children: ChildrenPropTypes.oneOf([Option])
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const allowedProps: AllowedPropKeys = ['renderLabel', 'children']
|
|
55
|
+
|
|
56
|
+
export type { SimpleSelectGroupProps }
|
|
57
|
+
export { propTypes, allowedProps }
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
26
|
+
import type { SimpleSelectOptionProps } from './props'
|
|
27
|
+
import { allowedProps, propTypes } from './props'
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
---
|
|
@@ -35,37 +35,10 @@ id: SimpleSelect.Option
|
|
|
35
35
|
class Option extends Component<SimpleSelectOptionProps> {
|
|
36
36
|
static readonly componentId = 'SimpleSelect.Option'
|
|
37
37
|
|
|
38
|
-
static
|
|
39
|
-
|
|
40
|
-
* The id for the option.
|
|
41
|
-
*/
|
|
42
|
-
id: PropTypes.string.isRequired,
|
|
43
|
-
/**
|
|
44
|
-
* The value for the option.
|
|
45
|
-
*/
|
|
46
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
47
|
-
/**
|
|
48
|
-
* Whether or not this option is disabled.
|
|
49
|
-
*/
|
|
50
|
-
isDisabled: PropTypes.bool,
|
|
51
|
-
/**
|
|
52
|
-
* Content to display before the option label, such as an icon.
|
|
53
|
-
*/
|
|
54
|
-
renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
55
|
-
/**
|
|
56
|
-
* Content to display after the option label, such as an icon.
|
|
57
|
-
*/
|
|
58
|
-
renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
59
|
-
/**
|
|
60
|
-
* Content to display as the option label.
|
|
61
|
-
*/
|
|
62
|
-
children: PropTypes.string
|
|
63
|
-
}
|
|
64
|
-
|
|
38
|
+
static allowedProps = allowedProps
|
|
39
|
+
static propTypes = propTypes
|
|
65
40
|
static defaultProps = {
|
|
66
41
|
isDisabled: false,
|
|
67
|
-
renderBeforeLabel: undefined,
|
|
68
|
-
renderAfterLabel: undefined,
|
|
69
42
|
children: null
|
|
70
43
|
}
|
|
71
44
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import React from 'react'
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
26
|
+
|
|
27
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
28
|
+
|
|
29
|
+
type SimpleSelectOptionOwnProps = {
|
|
30
|
+
id: string
|
|
31
|
+
value: string | number
|
|
32
|
+
isDisabled?: boolean
|
|
33
|
+
renderBeforeLabel?: React.ReactNode | ((...args: any[]) => any)
|
|
34
|
+
renderAfterLabel?: React.ReactNode | ((...args: any[]) => any)
|
|
35
|
+
children?: React.ReactNode
|
|
36
|
+
}
|
|
37
|
+
type PropKeys = keyof SimpleSelectOptionOwnProps
|
|
38
|
+
|
|
39
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
40
|
+
|
|
41
|
+
type SimpleSelectOptionProps = SimpleSelectOptionOwnProps
|
|
42
|
+
|
|
43
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
44
|
+
/**
|
|
45
|
+
* The id for the option.
|
|
46
|
+
*/
|
|
47
|
+
id: PropTypes.string.isRequired,
|
|
48
|
+
/**
|
|
49
|
+
* The value for the option.
|
|
50
|
+
*/
|
|
51
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
52
|
+
/**
|
|
53
|
+
* Whether or not this option is disabled.
|
|
54
|
+
*/
|
|
55
|
+
isDisabled: PropTypes.bool,
|
|
56
|
+
/**
|
|
57
|
+
* Content to display before the option label, such as an icon.
|
|
58
|
+
*/
|
|
59
|
+
renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
60
|
+
/**
|
|
61
|
+
* Content to display after the option label, such as an icon.
|
|
62
|
+
*/
|
|
63
|
+
renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
64
|
+
/**
|
|
65
|
+
* Content to display as the option label.
|
|
66
|
+
*/
|
|
67
|
+
children: PropTypes.string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const allowedProps: AllowedPropKeys = [
|
|
71
|
+
'id',
|
|
72
|
+
'value',
|
|
73
|
+
'isDisabled',
|
|
74
|
+
'renderBeforeLabel',
|
|
75
|
+
'renderAfterLabel',
|
|
76
|
+
'children'
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
export type { SimpleSelectOptionProps }
|
|
80
|
+
export { propTypes, allowedProps }
|
|
@@ -23,11 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React, { Component, Children } from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
|
|
28
|
-
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
29
|
-
import { FormPropTypes } from '@instructure/ui-form-field'
|
|
30
|
-
import { PositionPropTypes } from '@instructure/ui-position'
|
|
31
27
|
import { testable } from '@instructure/ui-testable'
|
|
32
28
|
import {
|
|
33
29
|
matchComponentTypes,
|
|
@@ -40,7 +36,8 @@ import { Select } from '@instructure/ui-select'
|
|
|
40
36
|
|
|
41
37
|
import { Option } from './Option'
|
|
42
38
|
import { Group } from './Group'
|
|
43
|
-
import { SimpleSelectProps } from './
|
|
39
|
+
import type { SimpleSelectProps } from './props'
|
|
40
|
+
import { allowedProps, propTypes } from './props'
|
|
44
41
|
|
|
45
42
|
/**
|
|
46
43
|
---
|
|
@@ -54,158 +51,17 @@ class SimpleSelect extends Component<SimpleSelectProps> {
|
|
|
54
51
|
|
|
55
52
|
static Option = Option
|
|
56
53
|
static Group = Group
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*/
|
|
61
|
-
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
62
|
-
.isRequired,
|
|
63
|
-
/**
|
|
64
|
-
* The value corresponding to the value of the selected option. If defined,
|
|
65
|
-
* the component will act controlled and will not manage its own state.
|
|
66
|
-
*/
|
|
67
|
-
// TODO: it was using the "controllable" util, in the TS migration mimic that behaviour
|
|
68
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
69
|
-
/**
|
|
70
|
-
* The value of the option to select by default, when uncontrolled.
|
|
71
|
-
*/
|
|
72
|
-
defaultValue: PropTypes.string,
|
|
73
|
-
/**
|
|
74
|
-
* The id of the text input. One is generated if not supplied.
|
|
75
|
-
*/
|
|
76
|
-
id: PropTypes.string,
|
|
77
|
-
/**
|
|
78
|
-
* The size of the text input.
|
|
79
|
-
*/
|
|
80
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
81
|
-
/**
|
|
82
|
-
* Additional helpful text to provide to screen readers about the operation
|
|
83
|
-
* of the component. Provided via aria-describedby.
|
|
84
|
-
*/
|
|
85
|
-
assistiveText: PropTypes.string,
|
|
86
|
-
/**
|
|
87
|
-
* Html placeholder text to display when the input has no value. This should
|
|
88
|
-
* be hint text, not a label replacement.
|
|
89
|
-
*/
|
|
90
|
-
placeholder: PropTypes.string,
|
|
91
|
-
/**
|
|
92
|
-
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
93
|
-
* When "disabled", the input changes visibly to indicate that it cannot
|
|
94
|
-
* receive user interactions. When "readonly" the input still cannot receive
|
|
95
|
-
* user interactions but it keeps the same styles as if it were enabled.
|
|
96
|
-
*/
|
|
97
|
-
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
98
|
-
/**
|
|
99
|
-
* Whether or not the text input is required.
|
|
100
|
-
*/
|
|
101
|
-
isRequired: PropTypes.bool,
|
|
102
|
-
/**
|
|
103
|
-
* Whether the input is rendered inline with other elements or if it
|
|
104
|
-
* is rendered as a block level element.
|
|
105
|
-
*/
|
|
106
|
-
isInline: PropTypes.bool,
|
|
107
|
-
/**
|
|
108
|
-
* The width of the text input.
|
|
109
|
-
*/
|
|
110
|
-
width: PropTypes.string,
|
|
111
|
-
/**
|
|
112
|
-
* The max width the options list can be before option text wraps. If not
|
|
113
|
-
* set, the list will only display as wide as the text input.
|
|
114
|
-
*/
|
|
115
|
-
optionsMaxWidth: PropTypes.string,
|
|
116
|
-
/**
|
|
117
|
-
* The number of options that should be visible before having to scroll.
|
|
118
|
-
*/
|
|
119
|
-
visibleOptionsCount: PropTypes.number,
|
|
120
|
-
/**
|
|
121
|
-
* Displays messages and validation for the input. It should be an object
|
|
122
|
-
* with the following shape:
|
|
123
|
-
* `{
|
|
124
|
-
* text: PropTypes.string,
|
|
125
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
126
|
-
* }`
|
|
127
|
-
*/
|
|
128
|
-
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
129
|
-
/**
|
|
130
|
-
* The placement of the options list.
|
|
131
|
-
*/
|
|
132
|
-
placement: PositionPropTypes.placement,
|
|
133
|
-
/**
|
|
134
|
-
* The parent in which to constrain the placement.
|
|
135
|
-
*/
|
|
136
|
-
constrain: PositionPropTypes.constrain,
|
|
137
|
-
/**
|
|
138
|
-
* An element or a function returning an element to use mount the options
|
|
139
|
-
* list to in the DOM (defaults to `document.body`)
|
|
140
|
-
*/
|
|
141
|
-
mountNode: PositionPropTypes.mountNode,
|
|
142
|
-
/**
|
|
143
|
-
* Callback fired when a new option is selected.
|
|
144
|
-
* @param {Object} event - the event object
|
|
145
|
-
* @param {Object} data - additional data
|
|
146
|
-
* @param data.value - the value of selected option
|
|
147
|
-
* @param data.id - the id of the selected option
|
|
148
|
-
*/
|
|
149
|
-
onChange: PropTypes.func,
|
|
150
|
-
/**
|
|
151
|
-
* Callback fired when text input receives focus.
|
|
152
|
-
*/
|
|
153
|
-
onFocus: PropTypes.func,
|
|
154
|
-
/**
|
|
155
|
-
* Callback fired when text input loses focus.
|
|
156
|
-
*/
|
|
157
|
-
onBlur: PropTypes.func,
|
|
158
|
-
/**
|
|
159
|
-
* Callback fired when the options list is shown.
|
|
160
|
-
*/
|
|
161
|
-
onShowOptions: PropTypes.func,
|
|
162
|
-
/**
|
|
163
|
-
* Callback fired when the options list is hidden.
|
|
164
|
-
*/
|
|
165
|
-
onHideOptions: PropTypes.func,
|
|
166
|
-
/**
|
|
167
|
-
* A ref to the html `input` element.
|
|
168
|
-
*/
|
|
169
|
-
inputRef: PropTypes.func,
|
|
170
|
-
/**
|
|
171
|
-
* A ref to the html `ul` element.
|
|
172
|
-
*/
|
|
173
|
-
listRef: PropTypes.func,
|
|
174
|
-
/**
|
|
175
|
-
* Content to display in the list when no options are available.
|
|
176
|
-
*/
|
|
177
|
-
renderEmptyOption: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
178
|
-
/**
|
|
179
|
-
* Content to display before the text input. This will commonly be an icon.
|
|
180
|
-
*/
|
|
181
|
-
renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
182
|
-
/**
|
|
183
|
-
* Content to display after the text input. This content will replace the
|
|
184
|
-
* default arrow icons.
|
|
185
|
-
*/
|
|
186
|
-
renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
187
|
-
/**
|
|
188
|
-
* Children of type `<SimpleSelect.Option />` or `<SimpleSelect.Group />`.
|
|
189
|
-
*/
|
|
190
|
-
children: ChildrenPropTypes.oneOf([Group, Option])
|
|
191
|
-
}
|
|
54
|
+
|
|
55
|
+
static allowedProps = allowedProps
|
|
56
|
+
static propTypes = propTypes
|
|
192
57
|
|
|
193
58
|
static defaultProps = {
|
|
194
|
-
value: undefined,
|
|
195
|
-
defaultValue: undefined,
|
|
196
|
-
id: undefined,
|
|
197
59
|
size: 'medium',
|
|
198
|
-
assistiveText: undefined,
|
|
199
60
|
placeholder: null,
|
|
200
|
-
interaction: undefined,
|
|
201
61
|
isRequired: false,
|
|
202
62
|
isInline: false,
|
|
203
|
-
width: undefined,
|
|
204
|
-
optionsMaxWidth: undefined,
|
|
205
63
|
visibleOptionsCount: 8,
|
|
206
|
-
messages: undefined,
|
|
207
64
|
placement: 'bottom stretch',
|
|
208
|
-
mountNode: undefined,
|
|
209
65
|
constrain: 'window',
|
|
210
66
|
// @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
|
|
211
67
|
onChange: (event, data) => {},
|