@instructure/ui-list 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 (63) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/InlineList/InlineListItem/InlineListItemLocator.js +2 -1
  3. package/es/InlineList/InlineListItem/index.js +19 -15
  4. package/es/InlineList/InlineListItem/props.js +0 -24
  5. package/es/InlineList/InlineListLocator.js +2 -1
  6. package/es/InlineList/__examples__/InlineList.examples.js +1 -1
  7. package/es/InlineList/index.js +1 -2
  8. package/es/InlineList/props.js +0 -17
  9. package/es/List/ListItem/index.js +19 -15
  10. package/es/List/ListItem/props.js +0 -24
  11. package/es/List/ListLocator.js +4 -2
  12. package/es/List/__examples__/List.examples.js +1 -1
  13. package/es/List/index.js +16 -13
  14. package/es/List/props.js +0 -25
  15. package/lib/InlineList/InlineListItem/InlineListItemLocator.js +1 -0
  16. package/lib/InlineList/InlineListItem/index.js +19 -15
  17. package/lib/InlineList/InlineListItem/props.js +0 -24
  18. package/lib/InlineList/InlineListLocator.js +1 -0
  19. package/lib/InlineList/__examples__/InlineList.examples.js +1 -1
  20. package/lib/InlineList/index.js +1 -2
  21. package/lib/InlineList/props.js +0 -17
  22. package/lib/List/ListItem/index.js +19 -15
  23. package/lib/List/ListItem/props.js +0 -24
  24. package/lib/List/ListLocator.js +3 -1
  25. package/lib/List/__examples__/List.examples.js +1 -1
  26. package/lib/List/index.js +16 -13
  27. package/lib/List/props.js +0 -25
  28. package/package.json +14 -14
  29. package/src/InlineList/InlineListItem/index.tsx +5 -9
  30. package/src/InlineList/InlineListItem/props.ts +20 -20
  31. package/src/InlineList/__examples__/InlineList.examples.tsx +7 -4
  32. package/src/InlineList/index.tsx +1 -3
  33. package/src/InlineList/props.ts +16 -15
  34. package/src/List/ListItem/index.tsx +5 -9
  35. package/src/List/ListItem/props.ts +20 -20
  36. package/src/List/__examples__/List.examples.tsx +8 -5
  37. package/src/List/index.tsx +5 -10
  38. package/src/List/props.ts +20 -20
  39. package/tsconfig.build.json +18 -2
  40. package/tsconfig.build.tsbuildinfo +1 -0
  41. package/types/InlineList/InlineListItem/InlineListItemLocator.d.ts +52 -52
  42. package/types/InlineList/InlineListItem/index.d.ts +4 -4
  43. package/types/InlineList/InlineListItem/index.d.ts.map +1 -1
  44. package/types/InlineList/InlineListItem/props.d.ts +20 -1
  45. package/types/InlineList/InlineListItem/props.d.ts.map +1 -1
  46. package/types/InlineList/InlineListLocator.d.ts +182 -182
  47. package/types/InlineList/__examples__/InlineList.examples.d.ts +3 -8
  48. package/types/InlineList/__examples__/InlineList.examples.d.ts.map +1 -1
  49. package/types/InlineList/index.d.ts +1 -2
  50. package/types/InlineList/index.d.ts.map +1 -1
  51. package/types/InlineList/props.d.ts +14 -0
  52. package/types/InlineList/props.d.ts.map +1 -1
  53. package/types/List/ListItem/index.d.ts +4 -4
  54. package/types/List/ListItem/index.d.ts.map +1 -1
  55. package/types/List/ListItem/props.d.ts +20 -1
  56. package/types/List/ListItem/props.d.ts.map +1 -1
  57. package/types/List/ListLocator.d.ts +182 -182
  58. package/types/List/__examples__/List.examples.d.ts +3 -8
  59. package/types/List/__examples__/List.examples.d.ts.map +1 -1
  60. package/types/List/index.d.ts +2 -3
  61. package/types/List/index.d.ts.map +1 -1
  62. package/types/List/props.d.ts +20 -0
  63. package/types/List/props.d.ts.map +1 -1
@@ -36,35 +36,11 @@ var _emotion = require("@instructure/emotion");
36
36
  */
37
37
  const propTypes = {
38
38
  children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
39
-
40
- /**
41
- * Inherits delimiter from the parent List component.
42
- */
43
39
  delimiter: _propTypes.default.oneOf(['none', 'dashed', 'solid']),
44
40
  size: _propTypes.default.oneOf(['small', 'medium', 'large']),
45
-
46
- /**
47
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
48
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
49
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
50
- */
51
41
  margin: _emotion.ThemeablePropTypes.spacing,
52
-
53
- /**
54
- * Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
55
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
56
- * familiar CSS-like shorthand. For example: `padding="small x-large large"`.
57
- */
58
42
  padding: _emotion.ThemeablePropTypes.spacing,
59
-
60
- /**
61
- * Inherits itemSpacing from the parent List component
62
- */
63
43
  spacing: _propTypes.default.oneOf(['none', 'xxx-small', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
64
-
65
- /**
66
- * provides a reference to the underlying html root element
67
- */
68
44
  elementRef: _propTypes.default.func
69
45
  };
70
46
  exports.propTypes = propTypes;
@@ -32,7 +32,9 @@ var _index = require("./index");
32
32
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
33
  * SOFTWARE.
34
34
  */
35
- const ListItemLocator = (0, _locator.locator)(_index.List.Item.selector);
35
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
36
+ const ListItemLocator = (0, _locator.locator)(_index.List.Item.selector); // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
37
+
36
38
  const ListLocator = (0, _locator.locator)(_index.List.selector, {
37
39
  findAllItems: function () {
38
40
  return ListItemLocator.findAll(...arguments);
@@ -15,7 +15,7 @@ var _List$Item, _List$Item2, _List$Item3;
15
15
 
16
16
  var _default = {
17
17
  sectionProp: 'size',
18
- getComponentProps: props => {
18
+ getComponentProps: () => {
19
19
  return {
20
20
  children: [_List$Item || (_List$Item = /*#__PURE__*/_react.default.createElement(_index.List.Item, {
21
21
  key: "1"
package/lib/List/index.js CHANGED
@@ -44,6 +44,7 @@ var _dec, _dec2, _class, _class2, _temp;
44
44
  ---
45
45
  category: components
46
46
  ---
47
+ @tsProps
47
48
  **/
48
49
  let List = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class List extends _react.Component {
49
50
  constructor() {
@@ -61,11 +62,15 @@ let List = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
61
62
  }
62
63
 
63
64
  componentDidMount() {
64
- this.props.makeStyles();
65
+ var _this$props$makeStyle, _this$props;
66
+
67
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
65
68
  }
66
69
 
67
- componentDidUpdate(prevProps, prevState, snapshot) {
68
- this.props.makeStyles();
70
+ componentDidUpdate() {
71
+ var _this$props$makeStyle2, _this$props2;
72
+
73
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
69
74
  }
70
75
 
71
76
  renderChildren() {
@@ -82,13 +87,13 @@ let List = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
82
87
  }
83
88
 
84
89
  render() {
85
- const _this$props = this.props,
86
- as = _this$props.as,
87
- margin = _this$props.margin,
88
- isUnstyled = _this$props.isUnstyled,
89
- elementRef = _this$props.elementRef,
90
- styles = _this$props.styles,
91
- rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
90
+ const _this$props3 = this.props,
91
+ as = _this$props3.as,
92
+ margin = _this$props3.margin,
93
+ isUnstyled = _this$props3.isUnstyled,
94
+ elementRef = _this$props3.elementRef,
95
+ styles = _this$props3.styles,
96
+ rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
92
97
  return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(rest), {
93
98
  css: styles === null || styles === void 0 ? void 0 : styles.list,
94
99
  as: as,
@@ -99,13 +104,11 @@ let List = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
99
104
  }
100
105
 
101
106
  }, _class2.displayName = "List", _class2.componentId = 'List', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
102
- children: null,
103
107
  as: 'ul',
104
108
  delimiter: 'none',
105
109
  isUnstyled: false,
106
110
  size: 'medium',
107
- itemSpacing: 'none',
108
- elementRef: el => {}
111
+ itemSpacing: 'none'
109
112
  }, _class2.Item = _ListItem.ListItem, _temp)) || _class) || _class);
110
113
  exports.List = List;
111
114
  var _default = List;
package/lib/List/props.js CHANGED
@@ -39,38 +39,13 @@ var _ListItem = require("./ListItem");
39
39
  * SOFTWARE.
40
40
  */
41
41
  const propTypes = {
42
- /**
43
- * Only accepts `<List.Item>` as a child
44
- */
45
42
  children: _Children.Children.oneOf([_ListItem.ListItem]),
46
43
  as: _propTypes.default.oneOf(['ul', 'ol']),
47
-
48
- /**
49
- * One of: none, dashed, solid
50
- */
51
44
  delimiter: _propTypes.default.oneOf(['none', 'dashed', 'solid']),
52
-
53
- /**
54
- * When set, renders the List Items without a list style type.
55
- */
56
45
  isUnstyled: _propTypes.default.bool,
57
-
58
- /**
59
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
60
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
61
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
62
- */
63
46
  margin: _emotion.ThemeablePropTypes.spacing,
64
47
  size: _propTypes.default.oneOf(['small', 'medium', 'large']),
65
-
66
- /**
67
- * Sets the margin separating each ListItem.
68
- */
69
48
  itemSpacing: _propTypes.default.oneOf(['none', 'xxx-small', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
70
-
71
- /**
72
- * provides a reference to the underlying html root element
73
- */
74
49
  elementRef: _propTypes.default.func
75
50
  };
76
51
  exports.propTypes = propTypes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-list",
3
- "version": "8.13.1-snapshot.9+f32ba918e",
3
+ "version": "8.14.1-snapshot.6+44559fbd7",
4
4
  "description": "Components for displaying vertical or horizontal lists.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -25,21 +25,21 @@
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.13.10",
28
- "@instructure/console": "8.13.1-snapshot.9+f32ba918e",
29
- "@instructure/emotion": "8.13.1-snapshot.9+f32ba918e",
30
- "@instructure/shared-types": "8.13.1-snapshot.9+f32ba918e",
31
- "@instructure/ui-prop-types": "8.13.1-snapshot.9+f32ba918e",
32
- "@instructure/ui-react-utils": "8.13.1-snapshot.9+f32ba918e",
33
- "@instructure/ui-testable": "8.13.1-snapshot.9+f32ba918e",
34
- "@instructure/ui-view": "8.13.1-snapshot.9+f32ba918e",
28
+ "@instructure/console": "8.14.1-snapshot.6+44559fbd7",
29
+ "@instructure/emotion": "8.14.1-snapshot.6+44559fbd7",
30
+ "@instructure/shared-types": "8.14.1-snapshot.6+44559fbd7",
31
+ "@instructure/ui-prop-types": "8.14.1-snapshot.6+44559fbd7",
32
+ "@instructure/ui-react-utils": "8.14.1-snapshot.6+44559fbd7",
33
+ "@instructure/ui-testable": "8.14.1-snapshot.6+44559fbd7",
34
+ "@instructure/ui-view": "8.14.1-snapshot.6+44559fbd7",
35
35
  "prop-types": "^15"
36
36
  },
37
37
  "devDependencies": {
38
- "@instructure/ui-babel-preset": "8.13.1-snapshot.9+f32ba918e",
39
- "@instructure/ui-color-utils": "8.13.1-snapshot.9+f32ba918e",
40
- "@instructure/ui-test-locator": "8.13.1-snapshot.9+f32ba918e",
41
- "@instructure/ui-test-utils": "8.13.1-snapshot.9+f32ba918e",
42
- "@instructure/ui-themes": "8.13.1-snapshot.9+f32ba918e"
38
+ "@instructure/ui-babel-preset": "8.14.1-snapshot.6+44559fbd7",
39
+ "@instructure/ui-color-utils": "8.14.1-snapshot.6+44559fbd7",
40
+ "@instructure/ui-test-locator": "8.14.1-snapshot.6+44559fbd7",
41
+ "@instructure/ui-test-utils": "8.14.1-snapshot.6+44559fbd7",
42
+ "@instructure/ui-themes": "8.14.1-snapshot.6+44559fbd7"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8 <=17"
@@ -48,5 +48,5 @@
48
48
  "access": "public"
49
49
  },
50
50
  "sideEffects": false,
51
- "gitHead": "f32ba918e4d3ce76c6ee95c856584d00a9d80958"
51
+ "gitHead": "44559fbd71344c571d339f20cf74491c6fd1dd2f"
52
52
  }
@@ -41,6 +41,7 @@ import type { InlineListItemProps } from './props'
41
41
  parent: InlineList
42
42
  id: InlineList.Item
43
43
  ---
44
+ @tsProps
44
45
  **/
45
46
  @withStyle(generateStyle, generateComponentTheme)
46
47
  @testable()
@@ -53,9 +54,7 @@ class InlineListItem extends Component<InlineListItemProps> {
53
54
  padding: 'none',
54
55
  spacing: 'none',
55
56
  delimiter: 'none',
56
- size: 'medium',
57
- // @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
58
- elementRef: (el) => {}
57
+ size: 'medium'
59
58
  }
60
59
 
61
60
  ref: Element | null = null
@@ -71,14 +70,11 @@ class InlineListItem extends Component<InlineListItemProps> {
71
70
  }
72
71
 
73
72
  componentDidMount() {
74
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
75
- this.props.makeStyles()
73
+ this.props.makeStyles?.()
76
74
  }
77
75
 
78
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
79
- componentDidUpdate(prevProps, prevState, snapshot) {
80
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
81
- this.props.makeStyles()
76
+ componentDidUpdate() {
77
+ this.props.makeStyles?.()
82
78
  }
83
79
 
84
80
  render() {
@@ -39,11 +39,27 @@ import type {
39
39
  } from '@instructure/shared-types'
40
40
 
41
41
  type InlineListItemOwnProps = {
42
- children: React.ReactNode | ((...args: any[]) => React.ReactNode)
42
+ children: React.ReactNode | (() => React.ReactNode)
43
+ /**
44
+ * Inherits delimiter from the parent InlineList component
45
+ */
43
46
  delimiter?: 'none' | 'pipe' | 'slash' | 'arrow'
44
47
  size?: 'small' | 'medium' | 'large'
48
+ /**
49
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
50
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
51
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
52
+ */
45
53
  margin?: Spacing
54
+ /**
55
+ * Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
56
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
57
+ * familiar CSS-like shorthand. For example: `padding="small x-large large"`.
58
+ */
46
59
  padding?: Spacing
60
+ /**
61
+ * Inherits itemSpacing from the parent InlineList component
62
+ */
47
63
  spacing?:
48
64
  | 'none'
49
65
  | 'xxx-small'
@@ -54,6 +70,9 @@ type InlineListItemOwnProps = {
54
70
  | 'large'
55
71
  | 'x-large'
56
72
  | 'xx-large'
73
+ /**
74
+ * provides a reference to the underlying html root element
75
+ */
57
76
  elementRef?: (element: Element | null) => void
58
77
  }
59
78
 
@@ -69,26 +88,10 @@ type InlineListItemStyle = ComponentStyle<'inlineListItem' | 'delimiter'>
69
88
 
70
89
  const propTypes: PropValidators<PropKeys> = {
71
90
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
72
- /**
73
- * Inherits delimiter from the parent InlineList component
74
- */
75
91
  delimiter: PropTypes.oneOf(['none', 'pipe', 'slash', 'arrow']),
76
92
  size: PropTypes.oneOf(['small', 'medium', 'large']),
77
- /**
78
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
79
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
80
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
81
- */
82
93
  margin: ThemeablePropTypes.spacing,
83
- /**
84
- * Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
85
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
86
- * familiar CSS-like shorthand. For example: `padding="small x-large large"`.
87
- */
88
94
  padding: ThemeablePropTypes.spacing,
89
- /**
90
- * Inherits itemSpacing from the parent InlineList component
91
- */
92
95
  spacing: PropTypes.oneOf([
93
96
  'none',
94
97
  'xxx-small',
@@ -100,9 +103,6 @@ const propTypes: PropValidators<PropKeys> = {
100
103
  'x-large',
101
104
  'xx-large'
102
105
  ]),
103
- /**
104
- * provides a reference to the underlying html root element
105
- */
106
106
  elementRef: PropTypes.func
107
107
  }
108
108
 
@@ -21,13 +21,17 @@
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'
26
+
25
27
  import { InlineList } from '../index'
26
28
 
29
+ import type { StoryConfig } from '@instructure/ui-test-utils'
30
+ import type { InlineListProps } from '../props'
31
+
27
32
  export default {
28
33
  sectionProp: 'size',
29
- // @ts-expect-error ts-migrate(6133) FIXME: 'props' is declared but its value is never read.
30
- getComponentProps: (props) => {
34
+ getComponentProps: () => {
31
35
  return {
32
36
  children: [
33
37
  <InlineList.Item key="1">Oranges</InlineList.Item>,
@@ -36,7 +40,6 @@ export default {
36
40
  ]
37
41
  }
38
42
  },
39
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
40
43
  filter: (props) => {
41
44
  return (
42
45
  // itemSpacing has no affect on the list if the delimiter prop is set
@@ -44,4 +47,4 @@ export default {
44
47
  props.delimiter !== 'none' && props.itemSpacing !== 'none'
45
48
  )
46
49
  }
47
- }
50
+ } as StoryConfig<InlineListProps>
@@ -36,16 +36,14 @@ import type { InlineListProps } from './props'
36
36
  ---
37
37
  category: components
38
38
  ---
39
+ @tsProps
39
40
  **/
40
41
  @testable()
41
42
  class InlineList extends Component<InlineListProps> {
42
43
  static propTypes = propTypes
43
44
  static allowedProps = allowedProps
44
45
  static defaultProps = {
45
- children: null,
46
46
  itemSpacing: 'none',
47
- // @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
48
- elementRef: (el) => {},
49
47
  as: 'ul',
50
48
  margin: 'none',
51
49
  delimiter: 'none',
@@ -36,11 +36,23 @@ import type {
36
36
  } from '@instructure/shared-types'
37
37
 
38
38
  type InlineListOwnProps = {
39
- children?: React.ReactNode // TODO: oneOf([InlineListItem])
39
+ /**
40
+ * Only accepts `<InlineList.Item>` as a child
41
+ */
42
+ //TODO type children better e.g.:ChildrenPropTypes.oneOf([InlineListItem])
43
+ children?: React.ReactNode
40
44
  as?: 'ul' | 'ol'
45
+ /**
46
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
47
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
48
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
49
+ */
41
50
  margin?: Spacing
42
51
  size?: 'small' | 'medium' | 'large'
43
52
  delimiter?: 'none' | 'pipe' | 'slash' | 'arrow'
53
+ /**
54
+ * Sets the margin separating each ListItem.
55
+ */
44
56
  itemSpacing?:
45
57
  | 'none'
46
58
  | 'xxx-small'
@@ -51,6 +63,9 @@ type InlineListOwnProps = {
51
63
  | 'large'
52
64
  | 'x-large'
53
65
  | 'xx-large'
66
+ /**
67
+ * provides a reference to the underlying html root element
68
+ */
54
69
  elementRef?: (element: Element | null) => void
55
70
  }
56
71
 
@@ -62,22 +77,11 @@ type InlineListProps = InlineListOwnProps &
62
77
  OtherHTMLAttributes<InlineListOwnProps>
63
78
 
64
79
  const propTypes: PropValidators<PropKeys> = {
65
- /**
66
- * Only accepts `<InlineList.Item>` as a child
67
- */
68
80
  children: ChildrenPropTypes.oneOf([InlineListItem]),
69
81
  as: PropTypes.oneOf(['ul', 'ol']),
70
- /**
71
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
72
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
73
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
74
- */
75
82
  margin: ThemeablePropTypes.spacing,
76
83
  size: PropTypes.oneOf(['small', 'medium', 'large']),
77
84
  delimiter: PropTypes.oneOf(['none', 'pipe', 'slash', 'arrow']),
78
- /**
79
- * Sets the margin separating each ListItem.
80
- */
81
85
  itemSpacing: PropTypes.oneOf([
82
86
  'none',
83
87
  'xxx-small',
@@ -89,9 +93,6 @@ const propTypes: PropValidators<PropKeys> = {
89
93
  'x-large',
90
94
  'xx-large'
91
95
  ]),
92
- /**
93
- * provides a reference to the underlying html root element
94
- */
95
96
  elementRef: PropTypes.func
96
97
  }
97
98
 
@@ -42,6 +42,7 @@ import type { ListItemProps } from './props'
42
42
  parent: List
43
43
  id: List.Item
44
44
  ---
45
+ @tsProps
45
46
  **/
46
47
  @withStyle(generateStyle, generateComponentTheme)
47
48
  @testable()
@@ -54,9 +55,7 @@ class ListItem extends Component<ListItemProps> {
54
55
  padding: 'none',
55
56
  spacing: 'none',
56
57
  delimiter: 'none',
57
- size: 'medium',
58
- // @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
59
- elementRef: (el) => {}
58
+ size: 'medium'
60
59
  }
61
60
 
62
61
  ref: Element | null = null
@@ -72,14 +71,11 @@ class ListItem extends Component<ListItemProps> {
72
71
  }
73
72
 
74
73
  componentDidMount() {
75
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
76
- this.props.makeStyles()
74
+ this.props.makeStyles?.()
77
75
  }
78
76
 
79
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
80
- componentDidUpdate(prevProps, prevState, snapshot) {
81
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
82
- this.props.makeStyles()
77
+ componentDidUpdate() {
78
+ this.props.makeStyles?.()
83
79
  }
84
80
 
85
81
  render() {
@@ -39,11 +39,27 @@ import type {
39
39
  } from '@instructure/shared-types'
40
40
 
41
41
  type ListItemOwnProps = {
42
- children: React.ReactNode | ((...args: any[]) => React.ReactNode)
42
+ children: React.ReactNode | (() => React.ReactNode)
43
+ /**
44
+ * Inherits delimiter from the parent List component.
45
+ */
43
46
  delimiter?: 'none' | 'dashed' | 'solid'
44
47
  size?: 'small' | 'medium' | 'large'
48
+ /**
49
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
50
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
51
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
52
+ */
45
53
  margin?: Spacing
54
+ /**
55
+ * Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
56
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
57
+ * familiar CSS-like shorthand. For example: `padding="small x-large large"`.
58
+ */
46
59
  padding?: Spacing
60
+ /**
61
+ * Inherits itemSpacing from the parent List component
62
+ */
47
63
  spacing?:
48
64
  | 'none'
49
65
  | 'xxx-small'
@@ -54,6 +70,9 @@ type ListItemOwnProps = {
54
70
  | 'large'
55
71
  | 'x-large'
56
72
  | 'xx-large'
73
+ /**
74
+ * provides a reference to the underlying html root element
75
+ */
57
76
  elementRef?: (element: Element | null) => void
58
77
  }
59
78
 
@@ -69,26 +88,10 @@ type ListItemStyle = ComponentStyle<'listItem'>
69
88
 
70
89
  const propTypes: PropValidators<PropKeys> = {
71
90
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
72
- /**
73
- * Inherits delimiter from the parent List component.
74
- */
75
91
  delimiter: PropTypes.oneOf(['none', 'dashed', 'solid']),
76
92
  size: PropTypes.oneOf(['small', 'medium', 'large']),
77
- /**
78
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
79
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
80
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
81
- */
82
93
  margin: ThemeablePropTypes.spacing,
83
- /**
84
- * Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
85
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
86
- * familiar CSS-like shorthand. For example: `padding="small x-large large"`.
87
- */
88
94
  padding: ThemeablePropTypes.spacing,
89
- /**
90
- * Inherits itemSpacing from the parent List component
91
- */
92
95
  spacing: PropTypes.oneOf([
93
96
  'none',
94
97
  'xxx-small',
@@ -100,9 +103,6 @@ const propTypes: PropValidators<PropKeys> = {
100
103
  'x-large',
101
104
  'xx-large'
102
105
  ]),
103
- /**
104
- * provides a reference to the underlying html root element
105
- */
106
106
  elementRef: PropTypes.func
107
107
  }
108
108
 
@@ -21,13 +21,17 @@
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'
26
+
25
27
  import { List } from '../index'
26
28
 
29
+ import type { StoryConfig } from '@instructure/ui-test-utils'
30
+ import type { ListProps } from '../props'
31
+
27
32
  export default {
28
33
  sectionProp: 'size',
29
- // @ts-expect-error ts-migrate(6133) FIXME: 'props' is declared but its value is never read.
30
- getComponentProps: (props) => {
34
+ getComponentProps: () => {
31
35
  return {
32
36
  children: [
33
37
  <List.Item key="1">Oranges</List.Item>,
@@ -36,11 +40,10 @@ export default {
36
40
  ]
37
41
  }
38
42
  },
39
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
40
43
  filter: (props) => {
41
44
  return (
42
- (['dashed', 'solid'].includes(props.delimiter) && props.as === 'ol') ||
45
+ (['dashed', 'solid'].includes(props.delimiter!) && props.as === 'ol') ||
43
46
  (props.delimiter !== 'none' && props.itemSpacing !== 'none')
44
47
  )
45
48
  }
46
- }
49
+ } as StoryConfig<ListProps>
@@ -43,6 +43,7 @@ import type { ListProps } from './props'
43
43
  ---
44
44
  category: components
45
45
  ---
46
+ @tsProps
46
47
  **/
47
48
  @withStyle(generateStyle, generateComponentTheme)
48
49
  @testable()
@@ -52,14 +53,11 @@ class List extends Component<ListProps> {
52
53
  static propTypes = propTypes
53
54
  static allowedProps = allowedProps
54
55
  static defaultProps = {
55
- children: null,
56
56
  as: 'ul',
57
57
  delimiter: 'none',
58
58
  isUnstyled: false,
59
59
  size: 'medium',
60
- itemSpacing: 'none',
61
- // @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
62
- elementRef: (el) => {}
60
+ itemSpacing: 'none'
63
61
  }
64
62
 
65
63
  static Item = ListItem
@@ -77,14 +75,11 @@ class List extends Component<ListProps> {
77
75
  }
78
76
 
79
77
  componentDidMount() {
80
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
81
- this.props.makeStyles()
78
+ this.props.makeStyles?.()
82
79
  }
83
80
 
84
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
85
- componentDidUpdate(prevProps, prevState, snapshot) {
86
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
87
- this.props.makeStyles()
81
+ componentDidUpdate() {
82
+ this.props.makeStyles?.()
88
83
  }
89
84
 
90
85
  renderChildren() {