@instructure/ui-list 8.8.0 → 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/LICENSE.md +27 -0
- package/es/InlineList/InlineListItem/index.js +5 -38
- package/es/InlineList/InlineListItem/props.js +56 -0
- package/es/InlineList/index.js +2 -25
- package/{src/InlineList/InlineListItem/types.ts → es/InlineList/props.js} +26 -20
- package/es/List/ListItem/index.js +4 -37
- package/es/List/ListItem/props.js +56 -0
- package/es/List/index.js +4 -41
- package/es/List/props.js +60 -0
- package/lib/InlineList/InlineListItem/index.js +5 -38
- package/lib/InlineList/InlineListItem/props.js +68 -0
- package/lib/InlineList/index.js +3 -28
- package/lib/InlineList/props.js +65 -0
- package/lib/List/ListItem/index.js +4 -37
- package/lib/List/ListItem/props.js +68 -0
- package/lib/List/index.js +4 -42
- package/lib/List/props.js +74 -0
- package/package.json +15 -14
- package/src/InlineList/InlineListItem/index.tsx +8 -46
- package/src/InlineList/InlineListItem/props.ts +105 -0
- package/src/InlineList/InlineListItem/styles.ts +1 -1
- package/src/InlineList/InlineListItem/theme.ts +1 -1
- package/src/InlineList/index.tsx +5 -35
- package/src/InlineList/props.ts +102 -0
- package/src/List/ListItem/index.tsx +7 -45
- package/src/List/ListItem/props.ts +105 -0
- package/src/List/ListItem/styles.ts +1 -1
- package/src/List/ListItem/theme.ts +1 -1
- package/src/List/index.tsx +7 -48
- package/src/List/props.ts +111 -0
- package/src/List/styles.ts +1 -1
- package/src/List/theme.ts +1 -1
- package/src/index.ts +4 -4
- package/types/InlineList/InlineListItem/index.d.ts +19 -30
- package/types/InlineList/InlineListItem/index.d.ts.map +1 -1
- package/types/InlineList/InlineListItem/props.d.ts +20 -0
- package/types/InlineList/InlineListItem/props.d.ts.map +1 -0
- package/types/InlineList/InlineListItem/styles.d.ts +1 -1
- package/types/InlineList/InlineListItem/theme.d.ts +1 -1
- package/types/InlineList/InlineListItem/theme.d.ts.map +1 -1
- package/types/InlineList/index.d.ts +27 -23
- package/types/InlineList/index.d.ts.map +1 -1
- package/types/InlineList/props.d.ts +20 -0
- package/types/InlineList/props.d.ts.map +1 -0
- package/types/List/ListItem/index.d.ts +19 -30
- package/types/List/ListItem/index.d.ts.map +1 -1
- package/types/List/ListItem/props.d.ts +20 -0
- package/types/List/ListItem/props.d.ts.map +1 -0
- package/types/List/ListItem/styles.d.ts +1 -1
- package/types/List/ListItem/theme.d.ts +1 -1
- package/types/List/ListItem/theme.d.ts.map +1 -1
- package/types/List/index.d.ts +21 -35
- package/types/List/index.d.ts.map +1 -1
- package/types/List/props.d.ts +21 -0
- package/types/List/props.d.ts.map +1 -0
- package/types/List/styles.d.ts +1 -1
- package/types/List/theme.d.ts +1 -1
- package/types/List/theme.d.ts.map +1 -1
- package/types/index.d.ts +4 -4
- package/es/InlineList/InlineListItem/types.js +0 -1
- package/es/InlineList/types.js +0 -1
- package/es/List/ListItem/types.js +0 -1
- package/es/List/types.js +0 -1
- package/lib/InlineList/InlineListItem/types.js +0 -1
- package/lib/InlineList/types.js +0 -1
- package/lib/List/ListItem/types.js +0 -1
- package/lib/List/types.js +0 -1
- package/src/InlineList/types.ts +0 -43
- package/src/List/ListItem/types.ts +0 -45
- package/src/List/types.ts +0 -46
- package/types/InlineList/InlineListItem/types.d.ts +0 -12
- package/types/InlineList/InlineListItem/types.d.ts.map +0 -1
- package/types/InlineList/types.d.ts +0 -10
- package/types/InlineList/types.d.ts.map +0 -1
- package/types/List/ListItem/types.d.ts +0 -12
- package/types/List/ListItem/types.d.ts.map +0 -1
- package/types/List/types.d.ts +0 -13
- package/types/List/types.d.ts.map +0 -1
package/lib/List/index.js
CHANGED
|
@@ -17,16 +17,12 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
17
17
|
|
|
18
18
|
var _react = require("react");
|
|
19
19
|
|
|
20
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
|
-
|
|
22
20
|
var _View = require("@instructure/ui-view/lib/View");
|
|
23
21
|
|
|
24
22
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
25
23
|
|
|
26
24
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
27
25
|
|
|
28
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
29
|
-
|
|
30
26
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
31
27
|
|
|
32
28
|
var _ListItem = require("./ListItem");
|
|
@@ -37,6 +33,8 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
37
33
|
|
|
38
34
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
39
35
|
|
|
36
|
+
var _props = require("./props");
|
|
37
|
+
|
|
40
38
|
const _excluded = ["as", "margin", "isUnstyled", "elementRef", "styles"];
|
|
41
39
|
|
|
42
40
|
var _dec, _dec2, _class, _class2, _temp;
|
|
@@ -77,7 +75,7 @@ let List = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
77
75
|
styles = _this$props.styles,
|
|
78
76
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
79
77
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(rest), {
|
|
80
|
-
css: styles.list,
|
|
78
|
+
css: styles === null || styles === void 0 ? void 0 : styles.list,
|
|
81
79
|
as: as,
|
|
82
80
|
margin: margin,
|
|
83
81
|
elementRef: elementRef,
|
|
@@ -85,47 +83,11 @@ let List = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
85
83
|
}), this.renderChildren());
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
}, _class2.displayName = "List", _class2.componentId = 'List', _class2.propTypes = {
|
|
89
|
-
// eslint-disable-next-line react/require-default-props
|
|
90
|
-
makeStyles: _propTypes.default.func,
|
|
91
|
-
// eslint-disable-next-line react/require-default-props
|
|
92
|
-
styles: _propTypes.default.object,
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Only accepts `<List.Item>` as a child
|
|
96
|
-
*/
|
|
97
|
-
children: _Children.Children.oneOf([_ListItem.ListItem]),
|
|
98
|
-
as: _propTypes.default.oneOf(['ul', 'ol']),
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* One of: none, dashed, solid
|
|
102
|
-
*/
|
|
103
|
-
delimiter: _propTypes.default.oneOf(['none', 'dashed', 'solid']),
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* When set, renders the List Items without a list style type.
|
|
107
|
-
*/
|
|
108
|
-
isUnstyled: _propTypes.default.bool,
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
112
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
113
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
114
|
-
*/
|
|
115
|
-
margin: _emotion.ThemeablePropTypes.spacing,
|
|
116
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Sets the margin separating each ListItem.
|
|
120
|
-
*/
|
|
121
|
-
itemSpacing: _propTypes.default.oneOf(['none', 'xxx-small', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
|
|
122
|
-
elementRef: _propTypes.default.func
|
|
123
|
-
}, _class2.defaultProps = {
|
|
86
|
+
}, _class2.displayName = "List", _class2.componentId = 'List', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
124
87
|
children: null,
|
|
125
88
|
as: 'ul',
|
|
126
89
|
delimiter: 'none',
|
|
127
90
|
isUnstyled: false,
|
|
128
|
-
margin: void 0,
|
|
129
91
|
size: 'medium',
|
|
130
92
|
itemSpacing: 'none',
|
|
131
93
|
elementRef: el => {}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
13
|
+
|
|
14
|
+
var _emotion = require("@instructure/emotion");
|
|
15
|
+
|
|
16
|
+
var _ListItem = require("./ListItem");
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* The MIT License (MIT)
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
22
|
+
*
|
|
23
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
24
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
25
|
+
* in the Software without restriction, including without limitation the rights
|
|
26
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
27
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
28
|
+
* furnished to do so, subject to the following conditions:
|
|
29
|
+
*
|
|
30
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
31
|
+
* copies or substantial portions of the Software.
|
|
32
|
+
*
|
|
33
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
34
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
35
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
36
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
37
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
38
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
|
+
* SOFTWARE.
|
|
40
|
+
*/
|
|
41
|
+
const propTypes = {
|
|
42
|
+
/**
|
|
43
|
+
* Only accepts `<List.Item>` as a child
|
|
44
|
+
*/
|
|
45
|
+
children: _Children.Children.oneOf([_ListItem.ListItem]),
|
|
46
|
+
as: _propTypes.default.oneOf(['ul', 'ol']),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* One of: none, dashed, solid
|
|
50
|
+
*/
|
|
51
|
+
delimiter: _propTypes.default.oneOf(['none', 'dashed', 'solid']),
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* When set, renders the List Items without a list style type.
|
|
55
|
+
*/
|
|
56
|
+
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
|
+
margin: _emotion.ThemeablePropTypes.spacing,
|
|
64
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Sets the margin separating each ListItem.
|
|
68
|
+
*/
|
|
69
|
+
itemSpacing: _propTypes.default.oneOf(['none', 'xxx-small', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
|
|
70
|
+
elementRef: _propTypes.default.func
|
|
71
|
+
};
|
|
72
|
+
exports.propTypes = propTypes;
|
|
73
|
+
const allowedProps = ['children', 'as', 'delimiter', 'isUnstyled', 'margin', 'size', 'itemSpacing', 'elementRef'];
|
|
74
|
+
exports.allowedProps = allowedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-list",
|
|
3
|
-
"version": "8.8.
|
|
3
|
+
"version": "8.8.1-snapshot.63+ec21bbc1d",
|
|
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.8.
|
|
29
|
-
"@instructure/emotion": "8.8.
|
|
30
|
-
"@instructure/
|
|
31
|
-
"@instructure/ui-
|
|
32
|
-
"@instructure/ui-
|
|
33
|
-
"@instructure/ui-
|
|
28
|
+
"@instructure/console": "8.8.1-snapshot.63+ec21bbc1d",
|
|
29
|
+
"@instructure/emotion": "8.8.1-snapshot.63+ec21bbc1d",
|
|
30
|
+
"@instructure/shared-types": "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-testable": "8.8.1-snapshot.63+ec21bbc1d",
|
|
34
|
+
"@instructure/ui-view": "8.8.1-snapshot.63+ec21bbc1d",
|
|
34
35
|
"prop-types": "^15"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"@instructure/
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-
|
|
40
|
-
"@instructure/ui-test-
|
|
41
|
-
"@instructure/ui-
|
|
42
|
-
"@instructure/ui-themes": "8.8.0"
|
|
38
|
+
"@instructure/ui-babel-preset": "8.8.1-snapshot.63+ec21bbc1d",
|
|
39
|
+
"@instructure/ui-color-utils": "8.8.1-snapshot.63+ec21bbc1d",
|
|
40
|
+
"@instructure/ui-test-locator": "8.8.1-snapshot.63+ec21bbc1d",
|
|
41
|
+
"@instructure/ui-test-utils": "8.8.1-snapshot.63+ec21bbc1d",
|
|
42
|
+
"@instructure/ui-themes": "8.8.1-snapshot.63+ec21bbc1d"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": ">=16.8 <=17"
|
|
@@ -47,5 +47,6 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"sideEffects": false
|
|
50
|
+
"sideEffects": false,
|
|
51
|
+
"gitHead": "ec21bbc1dcdd8567b11f2c15f5fadd16709d7e3d"
|
|
51
52
|
}
|
|
@@ -23,17 +23,18 @@
|
|
|
23
23
|
*/
|
|
24
24
|
/** @jsx jsx */
|
|
25
25
|
import { Component } from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
|
|
28
27
|
import { View } from '@instructure/ui-view'
|
|
29
28
|
import { testable } from '@instructure/ui-testable'
|
|
30
29
|
import { passthroughProps } from '@instructure/ui-react-utils'
|
|
31
30
|
|
|
32
|
-
import { withStyle, jsx
|
|
31
|
+
import { withStyle, jsx } from '@instructure/emotion'
|
|
33
32
|
|
|
34
33
|
import generateStyle from './styles'
|
|
35
34
|
import generateComponentTheme from './theme'
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
import { propTypes, allowedProps } from './props'
|
|
37
|
+
import type { InlineListItemProps } from './props'
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
---
|
|
@@ -46,49 +47,10 @@ id: InlineList.Item
|
|
|
46
47
|
class InlineListItem extends Component<InlineListItemProps> {
|
|
47
48
|
static readonly componentId = 'InlineList.Item'
|
|
48
49
|
|
|
49
|
-
static propTypes =
|
|
50
|
-
|
|
51
|
-
makeStyles: PropTypes.func,
|
|
52
|
-
// eslint-disable-next-line react/require-default-props
|
|
53
|
-
styles: PropTypes.object,
|
|
54
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
55
|
-
/**
|
|
56
|
-
* Inherits delimiter from the parent InlineList component
|
|
57
|
-
*/
|
|
58
|
-
delimiter: PropTypes.oneOf(['none', 'pipe', 'slash', 'arrow']),
|
|
59
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
60
|
-
/**
|
|
61
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
62
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
63
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
64
|
-
*/
|
|
65
|
-
margin: ThemeablePropTypes.spacing,
|
|
66
|
-
/**
|
|
67
|
-
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
68
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
69
|
-
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
70
|
-
*/
|
|
71
|
-
padding: ThemeablePropTypes.spacing,
|
|
72
|
-
/**
|
|
73
|
-
* Inherits itemSpacing from the parent InlineList component
|
|
74
|
-
*/
|
|
75
|
-
spacing: PropTypes.oneOf([
|
|
76
|
-
'none',
|
|
77
|
-
'xxx-small',
|
|
78
|
-
'xx-small',
|
|
79
|
-
'x-small',
|
|
80
|
-
'small',
|
|
81
|
-
'medium',
|
|
82
|
-
'large',
|
|
83
|
-
'x-large',
|
|
84
|
-
'xx-large'
|
|
85
|
-
]),
|
|
86
|
-
elementRef: PropTypes.func
|
|
87
|
-
}
|
|
88
|
-
|
|
50
|
+
static propTypes = propTypes
|
|
51
|
+
static allowedProps = allowedProps
|
|
89
52
|
static defaultProps = {
|
|
90
53
|
padding: 'none',
|
|
91
|
-
margin: undefined,
|
|
92
54
|
spacing: 'none',
|
|
93
55
|
delimiter: 'none',
|
|
94
56
|
size: 'medium',
|
|
@@ -123,7 +85,7 @@ class InlineListItem extends Component<InlineListItemProps> {
|
|
|
123
85
|
return (
|
|
124
86
|
<View
|
|
125
87
|
{...passthroughProps(rest)}
|
|
126
|
-
css={styles
|
|
88
|
+
css={styles?.inlineListItem}
|
|
127
89
|
as="li"
|
|
128
90
|
margin={margin}
|
|
129
91
|
padding={padding}
|
|
@@ -132,7 +94,7 @@ class InlineListItem extends Component<InlineListItemProps> {
|
|
|
132
94
|
elementRef={elementRef}
|
|
133
95
|
>
|
|
134
96
|
{children}
|
|
135
|
-
<span css={styles
|
|
97
|
+
<span css={styles?.delimiter} aria-hidden="true" />
|
|
136
98
|
</View>
|
|
137
99
|
)
|
|
138
100
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
|
|
25
|
+
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import { ThemeablePropTypes } from '@instructure/emotion'
|
|
29
|
+
|
|
30
|
+
import type { Spacing, WithStyleProps } from '@instructure/emotion'
|
|
31
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
32
|
+
|
|
33
|
+
type InlineListItemOwnProps = {
|
|
34
|
+
children: React.ReactNode | ((...args: any[]) => React.ReactNode)
|
|
35
|
+
delimiter?: 'none' | 'pipe' | 'slash' | 'arrow'
|
|
36
|
+
size?: 'small' | 'medium' | 'large'
|
|
37
|
+
margin?: Spacing
|
|
38
|
+
padding?: Spacing
|
|
39
|
+
spacing?:
|
|
40
|
+
| 'none'
|
|
41
|
+
| 'xxx-small'
|
|
42
|
+
| 'xx-small'
|
|
43
|
+
| 'x-small'
|
|
44
|
+
| 'small'
|
|
45
|
+
| 'medium'
|
|
46
|
+
| 'large'
|
|
47
|
+
| 'x-large'
|
|
48
|
+
| 'xx-large'
|
|
49
|
+
elementRef?: (...args: any[]) => any
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type PropKeys = keyof InlineListItemOwnProps
|
|
53
|
+
|
|
54
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
55
|
+
|
|
56
|
+
type InlineListItemProps = InlineListItemOwnProps & WithStyleProps
|
|
57
|
+
|
|
58
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
59
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
60
|
+
/**
|
|
61
|
+
* Inherits delimiter from the parent InlineList component
|
|
62
|
+
*/
|
|
63
|
+
delimiter: PropTypes.oneOf(['none', 'pipe', 'slash', 'arrow']),
|
|
64
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
65
|
+
/**
|
|
66
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
67
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
68
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
69
|
+
*/
|
|
70
|
+
margin: ThemeablePropTypes.spacing,
|
|
71
|
+
/**
|
|
72
|
+
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
73
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
74
|
+
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
75
|
+
*/
|
|
76
|
+
padding: ThemeablePropTypes.spacing,
|
|
77
|
+
/**
|
|
78
|
+
* Inherits itemSpacing from the parent InlineList component
|
|
79
|
+
*/
|
|
80
|
+
spacing: PropTypes.oneOf([
|
|
81
|
+
'none',
|
|
82
|
+
'xxx-small',
|
|
83
|
+
'xx-small',
|
|
84
|
+
'x-small',
|
|
85
|
+
'small',
|
|
86
|
+
'medium',
|
|
87
|
+
'large',
|
|
88
|
+
'x-large',
|
|
89
|
+
'xx-large'
|
|
90
|
+
]),
|
|
91
|
+
elementRef: PropTypes.func
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const allowedProps: AllowedPropKeys = [
|
|
95
|
+
'children',
|
|
96
|
+
'delimiter',
|
|
97
|
+
'size',
|
|
98
|
+
'margin',
|
|
99
|
+
'padding',
|
|
100
|
+
'spacing',
|
|
101
|
+
'elementRef'
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
export type { InlineListItemProps }
|
|
105
|
+
export { propTypes, allowedProps }
|
package/src/InlineList/index.tsx
CHANGED
|
@@ -22,16 +22,15 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import React, { Children, Component, ReactElement } from 'react'
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
25
|
|
|
27
26
|
import { View } from '@instructure/ui-view'
|
|
28
|
-
import { ThemeablePropTypes } from '@instructure/emotion'
|
|
29
27
|
import { passthroughProps, safeCloneElement } from '@instructure/ui-react-utils'
|
|
30
|
-
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
31
28
|
import { testable } from '@instructure/ui-testable'
|
|
32
29
|
|
|
33
30
|
import { InlineListItem } from './InlineListItem'
|
|
34
|
-
|
|
31
|
+
|
|
32
|
+
import { propTypes, allowedProps } from './props'
|
|
33
|
+
import type { InlineListProps } from './props'
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
---
|
|
@@ -40,37 +39,8 @@ category: components
|
|
|
40
39
|
**/
|
|
41
40
|
@testable()
|
|
42
41
|
class InlineList extends Component<InlineListProps> {
|
|
43
|
-
static propTypes =
|
|
44
|
-
|
|
45
|
-
* Only accepts `<InlineList.Item>` as a child
|
|
46
|
-
*/
|
|
47
|
-
children: ChildrenPropTypes.oneOf([InlineListItem]),
|
|
48
|
-
as: PropTypes.oneOf(['ul', 'ol']),
|
|
49
|
-
/**
|
|
50
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
51
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
52
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
53
|
-
*/
|
|
54
|
-
margin: ThemeablePropTypes.spacing,
|
|
55
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
56
|
-
delimiter: PropTypes.oneOf(['none', 'pipe', 'slash', 'arrow']),
|
|
57
|
-
/**
|
|
58
|
-
* Sets the margin separating each ListItem.
|
|
59
|
-
*/
|
|
60
|
-
itemSpacing: PropTypes.oneOf([
|
|
61
|
-
'none',
|
|
62
|
-
'xxx-small',
|
|
63
|
-
'xx-small',
|
|
64
|
-
'x-small',
|
|
65
|
-
'small',
|
|
66
|
-
'medium',
|
|
67
|
-
'large',
|
|
68
|
-
'x-large',
|
|
69
|
-
'xx-large'
|
|
70
|
-
]),
|
|
71
|
-
elementRef: PropTypes.func
|
|
72
|
-
}
|
|
73
|
-
|
|
42
|
+
static propTypes = propTypes
|
|
43
|
+
static allowedProps = allowedProps
|
|
74
44
|
static defaultProps = {
|
|
75
45
|
children: null,
|
|
76
46
|
itemSpacing: 'none',
|