@instructure/ui-select 8.13.1-snapshot.9 → 8.14.1-snapshot.6

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 (37) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/Select/Group/index.js +2 -3
  3. package/es/Select/Group/props.js +0 -7
  4. package/es/Select/Option/index.js +2 -2
  5. package/es/Select/Option/props.js +0 -27
  6. package/es/Select/SelectLocator.js +5 -2
  7. package/es/Select/index.js +92 -85
  8. package/es/Select/props.js +2 -142
  9. package/lib/Select/Group/index.js +2 -3
  10. package/lib/Select/Group/props.js +0 -7
  11. package/lib/Select/Option/index.js +2 -2
  12. package/lib/Select/Option/props.js +0 -27
  13. package/lib/Select/SelectLocator.js +3 -0
  14. package/lib/Select/index.js +96 -86
  15. package/lib/Select/props.js +2 -142
  16. package/package.json +23 -23
  17. package/src/Select/Group/index.tsx +2 -3
  18. package/src/Select/Group/props.ts +8 -8
  19. package/src/Select/Option/index.tsx +2 -2
  20. package/src/Select/Option/props.ts +33 -25
  21. package/src/Select/index.tsx +160 -168
  22. package/src/Select/props.ts +176 -117
  23. package/tsconfig.build.json +27 -2
  24. package/tsconfig.build.tsbuildinfo +1 -0
  25. package/types/Select/Group/index.d.ts +4 -5
  26. package/types/Select/Group/index.d.ts.map +1 -1
  27. package/types/Select/Group/props.d.ts +7 -1
  28. package/types/Select/Group/props.d.ts.map +1 -1
  29. package/types/Select/Option/index.d.ts +3 -7
  30. package/types/Select/Option/index.d.ts.map +1 -1
  31. package/types/Select/Option/props.d.ts +28 -4
  32. package/types/Select/Option/props.d.ts.map +1 -1
  33. package/types/Select/SelectLocator.d.ts +117 -117
  34. package/types/Select/index.d.ts +68 -99
  35. package/types/Select/index.d.ts.map +1 -1
  36. package/types/Select/props.d.ts +146 -21
  37. package/types/Select/props.d.ts.map +1 -1
@@ -32,6 +32,7 @@ parent: Select
32
32
  id: Select.Group
33
33
  ---
34
34
  @module Group
35
+ @tsProps
35
36
  **/
36
37
  class Group extends Component<SelectGroupProps> {
37
38
  static readonly componentId = 'Select.Group'
@@ -39,9 +40,7 @@ class Group extends Component<SelectGroupProps> {
39
40
  static allowedProps = allowedProps
40
41
  static propTypes = propTypes
41
42
 
42
- static defaultProps = {
43
- children: null
44
- }
43
+ static defaultProps = {}
45
44
 
46
45
  /* istanbul ignore next */
47
46
  render() {
@@ -33,8 +33,14 @@ import type {
33
33
  } from '@instructure/shared-types'
34
34
 
35
35
  type SelectGroupOwnProps = {
36
- renderLabel: React.ReactNode | ((...args: any[]) => any)
37
- children?: React.ReactNode
36
+ /**
37
+ * The label associated with the group options.
38
+ */
39
+ renderLabel: React.ReactNode | (() => React.ReactNode)
40
+ /**
41
+ * Children of type `<SimpleSelect.Option />` that will be considered part of the group.
42
+ */
43
+ children?: React.ReactNode // TODO: ChildrenPropTypes.oneOf([Option])
38
44
  }
39
45
 
40
46
  type PropKeys = keyof SelectGroupOwnProps
@@ -45,13 +51,7 @@ type SelectGroupProps = SelectGroupOwnProps &
45
51
  OtherHTMLAttributes<SelectGroupOwnProps>
46
52
 
47
53
  const propTypes: PropValidators<PropKeys> = {
48
- /**
49
- * The label associated with the group options.
50
- */
51
54
  renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
52
- /**
53
- * Children of type `<SimpleSelect.Option />` that will be considered part of the group.
54
- */
55
55
  children: ChildrenPropTypes.oneOf([Option])
56
56
  }
57
57
 
@@ -32,6 +32,7 @@ parent: Select
32
32
  id: Select.Option
33
33
  ---
34
34
  @module Option
35
+ @tsProps
35
36
  **/
36
37
  class Option extends Component<SelectOptionProps> {
37
38
  static readonly componentId = 'Select.Option'
@@ -42,8 +43,7 @@ class Option extends Component<SelectOptionProps> {
42
43
  static defaultProps = {
43
44
  isHighlighted: false,
44
45
  isSelected: false,
45
- isDisabled: false,
46
- children: null
46
+ isDisabled: false
47
47
  }
48
48
 
49
49
  /* istanbul ignore next */
@@ -21,6 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import React from 'react'
25
26
  import PropTypes from 'prop-types'
26
27
 
@@ -29,16 +30,44 @@ import type {
29
30
  PropValidators
30
31
  } from '@instructure/shared-types'
31
32
 
32
- type SelectOptionOwnProps = {
33
+ type OptionProps = {
34
+ /**
35
+ * The id for the option.
36
+ */
33
37
  id: string
38
+ /**
39
+ * Whether or not this option is highlighted.
40
+ */
34
41
  isHighlighted?: boolean
42
+ /**
43
+ * Whether or not this option is selected.
44
+ */
35
45
  isSelected?: boolean
46
+ /**
47
+ * Whether or not this option is disabled.
48
+ */
36
49
  isDisabled?: boolean
37
- renderBeforeLabel?: React.ReactNode | ((...args: any[]) => any)
38
- renderAfterLabel?: React.ReactNode | ((...args: any[]) => any)
50
+ /**
51
+ * Content to display as the option label.
52
+ */
39
53
  children?: React.ReactNode
40
54
  }
41
55
 
56
+ type RenderSelectOptionLabel =
57
+ | React.ReactNode
58
+ | ((args: OptionProps) => React.ReactNode)
59
+
60
+ type SelectOptionOwnProps = OptionProps & {
61
+ /**
62
+ * Content to display before the option label, such as an icon.
63
+ */
64
+ renderBeforeLabel?: RenderSelectOptionLabel
65
+ /**
66
+ * Content to display after the option label, such as an icon.
67
+ */
68
+ renderAfterLabel?: RenderSelectOptionLabel
69
+ }
70
+
42
71
  type PropKeys = keyof SelectOptionOwnProps
43
72
 
44
73
  type AllowedPropKeys = Readonly<Array<PropKeys>>
@@ -47,33 +76,12 @@ type SelectOptionProps = SelectOptionOwnProps &
47
76
  OtherHTMLAttributes<SelectOptionOwnProps>
48
77
 
49
78
  const propTypes: PropValidators<PropKeys> = {
50
- /**
51
- * The id for the option.
52
- */
53
79
  id: PropTypes.string.isRequired,
54
- /**
55
- * Whether or not this option is highlighted.
56
- */
57
80
  isHighlighted: PropTypes.bool,
58
- /**
59
- * Whether or not this option is selected.
60
- */
61
81
  isSelected: PropTypes.bool,
62
- /**
63
- * Whether or not this option is disabled.
64
- */
65
82
  isDisabled: PropTypes.bool,
66
- /**
67
- * Content to display before the option label, such as an icon.
68
- */
69
83
  renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
70
- /**
71
- * Content to display after the option label, such as an icon.
72
- */
73
84
  renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
74
- /**
75
- * Content to display as the option label.
76
- */
77
85
  children: PropTypes.node
78
86
  }
79
87
 
@@ -87,5 +95,5 @@ const allowedProps: AllowedPropKeys = [
87
95
  'children'
88
96
  ]
89
97
 
90
- export type { SelectOptionProps }
98
+ export type { SelectOptionProps, RenderSelectOptionLabel }
91
99
  export { propTypes, allowedProps }