@instructure/ui-flex 8.12.1-snapshot.7 → 8.13.1-snapshot.9
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/CHANGELOG.md +4 -0
- package/es/Flex/Item/index.js +21 -17
- package/es/Flex/Item/props.js +0 -59
- package/es/Flex/Item/styles.js +1 -1
- package/es/Flex/index.js +24 -20
- package/es/Flex/props.js +0 -62
- package/lib/Flex/Item/index.js +22 -18
- package/lib/Flex/Item/props.js +1 -60
- package/lib/Flex/Item/styles.js +1 -1
- package/lib/Flex/index.js +28 -21
- package/lib/Flex/props.js +1 -63
- package/package.json +10 -10
- package/src/Flex/Item/index.tsx +3 -6
- package/src/Flex/Item/props.ts +54 -41
- package/src/Flex/Item/styles.ts +1 -2
- package/src/Flex/index.tsx +14 -15
- package/src/Flex/props.ts +66 -50
- package/types/Flex/Item/index.d.ts +1 -1
- package/types/Flex/Item/index.d.ts.map +1 -1
- package/types/Flex/Item/props.d.ts +46 -0
- package/types/Flex/Item/props.d.ts.map +1 -1
- package/types/Flex/Item/styles.d.ts +1 -1
- package/types/Flex/Item/styles.d.ts.map +1 -1
- package/types/Flex/index.d.ts +8 -19
- package/types/Flex/index.d.ts.map +1 -1
- package/types/Flex/props.d.ts +53 -2
- package/types/Flex/props.d.ts.map +1 -1
package/lib/Flex/props.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -35,81 +35,19 @@ var _emotion = require("@instructure/emotion");
|
|
|
35
35
|
* SOFTWARE.
|
|
36
36
|
*/
|
|
37
37
|
const propTypes = {
|
|
38
|
-
/**
|
|
39
|
-
* It's recommended that you use `Flex.Item` for children, but you can also pass any markup or a function
|
|
40
|
-
* returning markup. Note that if you do not use `Flex.Item`, the `withVisualDebug` and `direction` props
|
|
41
|
-
* will not automatically be set on the children.
|
|
42
|
-
*/
|
|
43
38
|
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* the element type to render as
|
|
47
|
-
*/
|
|
48
39
|
as: _propTypes.default.elementType,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* provides a reference to the underlying html root element
|
|
52
|
-
*/
|
|
53
40
|
elementRef: _propTypes.default.func,
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Sets the height of the component's container (optional)
|
|
57
|
-
*/
|
|
58
41
|
height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Sets the width of the component's container (optional)
|
|
62
|
-
*/
|
|
63
42
|
width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
64
|
-
|
|
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
43
|
margin: _emotion.ThemeablePropTypes.spacing,
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
74
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
75
|
-
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
76
|
-
*/
|
|
77
44
|
padding: _emotion.ThemeablePropTypes.spacing,
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Sets the CSS display rule for the component's container
|
|
81
|
-
*/
|
|
82
45
|
display: _propTypes.default.oneOf(['flex', 'inline-flex']),
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Designates the text alignment
|
|
86
|
-
*/
|
|
87
46
|
textAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Sets the flex-direction to row (horizontal) or column (vertical)
|
|
91
|
-
*/
|
|
92
47
|
direction: _propTypes.default.oneOf(['row', 'column', 'row-reverse', 'column-reverse']),
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Aligns Flex.Items on the vertical axis (horizontal if direction is column)
|
|
96
|
-
*/
|
|
97
48
|
alignItems: _propTypes.default.oneOf(['center', 'start', 'end', 'stretch']),
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Aligns Flex.Items on the horizontal axis (vertical if direction is column)
|
|
101
|
-
*/
|
|
102
49
|
justifyItems: _propTypes.default.oneOf(['center', 'start', 'end', 'space-around', 'space-between']),
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Determines if the Flex.Items should wrap when they exceed their container's width
|
|
106
|
-
*/
|
|
107
50
|
wrap: _propTypes.default.oneOf(['wrap', 'no-wrap', 'wrap-reverse']),
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Activate a dotted outline around the component to make building your
|
|
111
|
-
* layout easier
|
|
112
|
-
*/
|
|
113
51
|
withVisualDebug: _propTypes.default.bool
|
|
114
52
|
};
|
|
115
53
|
exports.propTypes = propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-flex",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.13.1-snapshot.9+f32ba918e",
|
|
4
4
|
"description": "A component that makes it easy to align content using flexbox CSS",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.
|
|
29
|
-
"@instructure/emotion": "8.
|
|
30
|
-
"@instructure/shared-types": "8.
|
|
31
|
-
"@instructure/ui-react-utils": "8.
|
|
32
|
-
"@instructure/ui-view": "8.
|
|
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-react-utils": "8.13.1-snapshot.9+f32ba918e",
|
|
32
|
+
"@instructure/ui-view": "8.13.1-snapshot.9+f32ba918e",
|
|
33
33
|
"prop-types": "^15"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@instructure/ui-babel-preset": "8.
|
|
37
|
-
"@instructure/ui-test-utils": "8.
|
|
38
|
-
"@instructure/ui-themes": "8.
|
|
36
|
+
"@instructure/ui-babel-preset": "8.13.1-snapshot.9+f32ba918e",
|
|
37
|
+
"@instructure/ui-test-utils": "8.13.1-snapshot.9+f32ba918e",
|
|
38
|
+
"@instructure/ui-themes": "8.13.1-snapshot.9+f32ba918e"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=16.8 <=17"
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": false,
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "f32ba918e4d3ce76c6ee95c856584d00a9d80958"
|
|
48
48
|
}
|
package/src/Flex/Item/index.tsx
CHANGED
|
@@ -39,27 +39,24 @@ import type { FlexItemProps } from './props'
|
|
|
39
39
|
parent: Flex
|
|
40
40
|
id: Flex.Item
|
|
41
41
|
---
|
|
42
|
+
@tsProps
|
|
42
43
|
**/
|
|
43
44
|
@withStyle(generateStyle, null)
|
|
44
45
|
class Item extends Component<FlexItemProps> {
|
|
45
46
|
static readonly componentId = 'Flex.Item'
|
|
46
47
|
|
|
47
48
|
componentDidMount() {
|
|
48
|
-
|
|
49
|
-
this.props.makeStyles()
|
|
49
|
+
this.props.makeStyles?.()
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
componentDidUpdate() {
|
|
53
|
-
|
|
54
|
-
this.props.makeStyles()
|
|
53
|
+
this.props.makeStyles?.()
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
static propTypes = propTypes
|
|
58
57
|
static allowedProps = allowedProps
|
|
59
58
|
static defaultProps = {
|
|
60
59
|
as: 'span',
|
|
61
|
-
// @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
|
|
62
|
-
elementRef: (el: any) => {},
|
|
63
60
|
shouldGrow: false,
|
|
64
61
|
shouldShrink: false
|
|
65
62
|
}
|
package/src/Flex/Item/props.ts
CHANGED
|
@@ -39,92 +39,105 @@ import type {
|
|
|
39
39
|
} from '@instructure/emotion'
|
|
40
40
|
|
|
41
41
|
type FlexItemOwnProps = {
|
|
42
|
-
children?: React.ReactNode
|
|
43
|
-
as?: AsElementType
|
|
44
|
-
elementRef?: (element: Element | null) => void
|
|
45
|
-
margin?: Spacing
|
|
46
|
-
padding?: Spacing
|
|
47
|
-
align?: 'center' | 'start' | 'end' | 'stretch'
|
|
48
|
-
direction?: 'row' | 'column'
|
|
49
|
-
textAlign?: 'start' | 'center' | 'end'
|
|
50
|
-
overflowX?: 'auto' | 'hidden' | 'visible'
|
|
51
|
-
overflowY?: 'auto' | 'hidden' | 'visible'
|
|
52
|
-
shouldGrow?: boolean
|
|
53
|
-
shouldShrink?: boolean
|
|
54
|
-
size?: string
|
|
55
|
-
withVisualDebug?: boolean
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
type PropKeys = keyof FlexItemOwnProps
|
|
59
|
-
|
|
60
|
-
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
61
|
-
|
|
62
|
-
type FlexItemProps = FlexItemOwnProps &
|
|
63
|
-
WithStyleProps<null, FlexItemStyle> &
|
|
64
|
-
OtherHTMLAttributes<FlexItemOwnProps>
|
|
65
|
-
|
|
66
|
-
type FlexItemStyle = ComponentStyle<'flexItem'>
|
|
67
|
-
|
|
68
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
69
42
|
/**
|
|
70
|
-
* The children to render inside the Item
|
|
43
|
+
* The children to render inside the Item
|
|
71
44
|
*/
|
|
72
|
-
children
|
|
45
|
+
children?: React.ReactNode
|
|
46
|
+
|
|
73
47
|
/**
|
|
74
48
|
* the element type to render as
|
|
75
49
|
*/
|
|
76
|
-
as
|
|
50
|
+
as?: AsElementType
|
|
51
|
+
|
|
77
52
|
/**
|
|
78
53
|
* provides a reference to the underlying html root element
|
|
79
54
|
*/
|
|
80
|
-
elementRef:
|
|
55
|
+
elementRef?: (element: Element | null) => void
|
|
56
|
+
|
|
81
57
|
/**
|
|
82
58
|
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
83
59
|
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
84
60
|
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
85
61
|
*/
|
|
86
|
-
margin
|
|
62
|
+
margin?: Spacing
|
|
63
|
+
|
|
87
64
|
/**
|
|
88
65
|
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
89
66
|
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
90
67
|
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
91
68
|
*/
|
|
92
|
-
padding
|
|
69
|
+
padding?: Spacing
|
|
70
|
+
|
|
93
71
|
/**
|
|
94
72
|
* overrides the parent Flex's alignItems prop, if needed
|
|
95
73
|
*/
|
|
96
|
-
align
|
|
74
|
+
align?: 'center' | 'start' | 'end' | 'stretch'
|
|
75
|
+
|
|
97
76
|
/**
|
|
98
77
|
* Inherits from the parent Flex component
|
|
99
78
|
*/
|
|
100
|
-
direction
|
|
79
|
+
direction?: 'row' | 'column'
|
|
80
|
+
|
|
101
81
|
/**
|
|
102
82
|
* Designates the text alignment inside the Item
|
|
103
83
|
*/
|
|
104
|
-
textAlign
|
|
84
|
+
textAlign?: 'start' | 'center' | 'end'
|
|
85
|
+
|
|
105
86
|
/**
|
|
106
87
|
* Handles horizontal overflow
|
|
107
88
|
*/
|
|
108
|
-
overflowX
|
|
89
|
+
overflowX?: 'auto' | 'hidden' | 'visible'
|
|
90
|
+
|
|
109
91
|
/**
|
|
110
92
|
* Handles vertical overflow
|
|
111
93
|
*/
|
|
112
|
-
overflowY
|
|
94
|
+
overflowY?: 'auto' | 'hidden' | 'visible'
|
|
95
|
+
|
|
113
96
|
/**
|
|
114
97
|
* Should the FlexItem grow to fill any available space?
|
|
115
98
|
*/
|
|
116
|
-
shouldGrow
|
|
99
|
+
shouldGrow?: boolean
|
|
100
|
+
|
|
117
101
|
/**
|
|
118
102
|
* Should the FlexItem shrink (stopping at its `size`)?
|
|
119
103
|
*/
|
|
120
|
-
shouldShrink
|
|
104
|
+
shouldShrink?: boolean
|
|
105
|
+
|
|
121
106
|
/**
|
|
122
107
|
* Sets the base size of the FlexItem (width if direction is `row`; height if direction is `column`)
|
|
123
108
|
*/
|
|
124
|
-
size
|
|
109
|
+
size?: string
|
|
110
|
+
|
|
125
111
|
/**
|
|
126
112
|
* Places dashed lines around the component's borders to help debug your layout
|
|
127
113
|
*/
|
|
114
|
+
withVisualDebug?: boolean
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type PropKeys = keyof FlexItemOwnProps
|
|
118
|
+
|
|
119
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
120
|
+
|
|
121
|
+
type FlexItemProps = FlexItemOwnProps &
|
|
122
|
+
WithStyleProps<null, FlexItemStyle> &
|
|
123
|
+
OtherHTMLAttributes<FlexItemOwnProps>
|
|
124
|
+
|
|
125
|
+
type FlexItemStyle = ComponentStyle<'flexItem'>
|
|
126
|
+
|
|
127
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
128
|
+
children: PropTypes.node,
|
|
129
|
+
as: PropTypes.elementType,
|
|
130
|
+
elementRef: PropTypes.func,
|
|
131
|
+
margin: ThemeablePropTypes.spacing,
|
|
132
|
+
padding: ThemeablePropTypes.spacing,
|
|
133
|
+
align: PropTypes.oneOf(['center', 'start', 'end', 'stretch']),
|
|
134
|
+
direction: PropTypes.oneOf(['row', 'column']),
|
|
135
|
+
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
136
|
+
overflowX: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
137
|
+
overflowY: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
138
|
+
shouldGrow: PropTypes.bool,
|
|
139
|
+
shouldShrink: PropTypes.bool,
|
|
140
|
+
size: PropTypes.string,
|
|
128
141
|
withVisualDebug: PropTypes.bool
|
|
129
142
|
}
|
|
130
143
|
|
package/src/Flex/Item/styles.ts
CHANGED
|
@@ -35,8 +35,7 @@ import type { FlexItemProps, FlexItemStyle } from './props'
|
|
|
35
35
|
* @return {Object} The final style object, which will be used in the component
|
|
36
36
|
*/
|
|
37
37
|
const generateStyle = (
|
|
38
|
-
|
|
39
|
-
componentTheme,
|
|
38
|
+
_componentTheme: null,
|
|
40
39
|
props: FlexItemProps
|
|
41
40
|
): FlexItemStyle => {
|
|
42
41
|
const { shouldGrow, shouldShrink, align, size } = props
|
package/src/Flex/index.tsx
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
/** @jsx jsx */
|
|
26
|
-
import { Children, Component } from 'react'
|
|
26
|
+
import React, { Children, Component } from 'react'
|
|
27
27
|
|
|
28
28
|
import {
|
|
29
29
|
safeCloneElement,
|
|
@@ -35,6 +35,7 @@ import { View } from '@instructure/ui-view'
|
|
|
35
35
|
import { withStyle, jsx } from '@instructure/emotion'
|
|
36
36
|
|
|
37
37
|
import { Item } from './Item'
|
|
38
|
+
import type { FlexItemProps } from './Item/props'
|
|
38
39
|
|
|
39
40
|
import generateStyle from './styles'
|
|
40
41
|
import generateComponentTheme from './theme'
|
|
@@ -47,20 +48,18 @@ import type { FlexProps } from './props'
|
|
|
47
48
|
category: components
|
|
48
49
|
---
|
|
49
50
|
@module Flex
|
|
51
|
+
@tsProps
|
|
50
52
|
**/
|
|
51
53
|
@withStyle(generateStyle, generateComponentTheme)
|
|
52
54
|
class Flex extends Component<FlexProps> {
|
|
53
55
|
static readonly componentId = 'Flex'
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
|
|
58
|
-
props.makeStyles()
|
|
57
|
+
componentDidMount() {
|
|
58
|
+
this.props.makeStyles?.()
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
componentDidUpdate() {
|
|
62
|
-
|
|
63
|
-
this.props.makeStyles()
|
|
62
|
+
this.props.makeStyles?.()
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
static Item = Item
|
|
@@ -68,10 +67,7 @@ class Flex extends Component<FlexProps> {
|
|
|
68
67
|
static propTypes = propTypes
|
|
69
68
|
static allowedProps = allowedProps
|
|
70
69
|
static defaultProps = {
|
|
71
|
-
children: null,
|
|
72
70
|
as: 'span',
|
|
73
|
-
// @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
|
|
74
|
-
elementRef: (el: any) => {},
|
|
75
71
|
direction: 'row',
|
|
76
72
|
justifyItems: 'start',
|
|
77
73
|
display: 'flex',
|
|
@@ -91,18 +87,21 @@ class Flex extends Component<FlexProps> {
|
|
|
91
87
|
}
|
|
92
88
|
}
|
|
93
89
|
|
|
94
|
-
renderChildren(children:
|
|
90
|
+
renderChildren(children: FlexProps['children']) {
|
|
95
91
|
return Children.map(children, (child) => {
|
|
96
92
|
if (!child) {
|
|
97
93
|
return null
|
|
98
94
|
}
|
|
99
95
|
|
|
100
96
|
return matchComponentTypes(child, ['Item'])
|
|
101
|
-
? safeCloneElement(child
|
|
97
|
+
? safeCloneElement(child as React.ReactElement<FlexItemProps>, {
|
|
98
|
+
// child withVisualDebug prop should override parent
|
|
102
99
|
withVisualDebug: this.props.withVisualDebug,
|
|
103
|
-
...child.props
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
...(child as React.ReactElement<FlexItemProps>).props,
|
|
101
|
+
direction: this.props.direction!.replace(
|
|
102
|
+
/-reverse/,
|
|
103
|
+
''
|
|
104
|
+
) as FlexItemProps['direction']
|
|
106
105
|
})
|
|
107
106
|
: child
|
|
108
107
|
})
|
package/src/Flex/props.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import React from 'react'
|
|
25
26
|
import PropTypes from 'prop-types'
|
|
26
27
|
|
|
27
28
|
import { ThemeablePropTypes } from '@instructure/emotion'
|
|
@@ -39,19 +40,83 @@ import type {
|
|
|
39
40
|
} from '@instructure/emotion'
|
|
40
41
|
|
|
41
42
|
type FlexOwnProps = {
|
|
42
|
-
|
|
43
|
+
/**
|
|
44
|
+
* It's recommended that you use `Flex.Item` for children, but you can also
|
|
45
|
+
* pass any markup or a function returning markup.
|
|
46
|
+
*
|
|
47
|
+
* Note that if you do not use `Flex.Item`, the `withVisualDebug` and
|
|
48
|
+
* `direction` props will not automatically be set on the children.
|
|
49
|
+
*/
|
|
50
|
+
children?: React.ReactNode | (() => React.ReactNode)
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* the element type to render as
|
|
54
|
+
*/
|
|
43
55
|
as?: AsElementType
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* provides a reference to the underlying html root element
|
|
59
|
+
*/
|
|
44
60
|
elementRef?: (element: Element | null) => void
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Sets the height of the component's container (optional)
|
|
64
|
+
*/
|
|
45
65
|
height?: string | number
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Sets the width of the component's container (optional)
|
|
69
|
+
*/
|
|
46
70
|
width?: string | number
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
74
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
75
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
76
|
+
*/
|
|
47
77
|
margin?: Spacing
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
81
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
82
|
+
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
83
|
+
*/
|
|
48
84
|
padding?: Spacing
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Sets the CSS display rule for the component's container
|
|
88
|
+
*/
|
|
49
89
|
display?: 'flex' | 'inline-flex'
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Designates the text alignment
|
|
93
|
+
*/
|
|
50
94
|
textAlign?: 'start' | 'center' | 'end'
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Sets the flex-direction to row (horizontal) or column (vertical)
|
|
98
|
+
*/
|
|
51
99
|
direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse'
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Aligns Flex.Items on the vertical axis (horizontal if direction is column)
|
|
103
|
+
*/
|
|
52
104
|
alignItems?: 'center' | 'start' | 'end' | 'stretch'
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Aligns Flex.Items on the horizontal axis (vertical if direction is column)
|
|
108
|
+
*/
|
|
53
109
|
justifyItems?: 'center' | 'start' | 'end' | 'space-around' | 'space-between'
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Determines if the Flex.Items should wrap when they exceed their container's width
|
|
113
|
+
*/
|
|
54
114
|
wrap?: 'wrap' | 'no-wrap' | 'wrap-reverse'
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Activate a dotted outline around the component to make building your
|
|
118
|
+
* layout easier
|
|
119
|
+
*/
|
|
55
120
|
withVisualDebug?: boolean
|
|
56
121
|
}
|
|
57
122
|
|
|
@@ -66,64 +131,22 @@ type FlexProps = FlexOwnProps &
|
|
|
66
131
|
type FlexStyle = ComponentStyle<'flex'>
|
|
67
132
|
|
|
68
133
|
const propTypes: PropValidators<PropKeys> = {
|
|
69
|
-
/**
|
|
70
|
-
* It's recommended that you use `Flex.Item` for children, but you can also pass any markup or a function
|
|
71
|
-
* returning markup. Note that if you do not use `Flex.Item`, the `withVisualDebug` and `direction` props
|
|
72
|
-
* will not automatically be set on the children.
|
|
73
|
-
*/
|
|
74
134
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
75
|
-
/**
|
|
76
|
-
* the element type to render as
|
|
77
|
-
*/
|
|
78
135
|
as: PropTypes.elementType,
|
|
79
|
-
/**
|
|
80
|
-
* provides a reference to the underlying html root element
|
|
81
|
-
*/
|
|
82
136
|
elementRef: PropTypes.func,
|
|
83
|
-
/**
|
|
84
|
-
* Sets the height of the component's container (optional)
|
|
85
|
-
*/
|
|
86
137
|
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
87
|
-
/**
|
|
88
|
-
* Sets the width of the component's container (optional)
|
|
89
|
-
*/
|
|
90
138
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
91
|
-
/**
|
|
92
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
93
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
94
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
95
|
-
*/
|
|
96
139
|
margin: ThemeablePropTypes.spacing,
|
|
97
|
-
/**
|
|
98
|
-
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
99
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
100
|
-
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
101
|
-
*/
|
|
102
140
|
padding: ThemeablePropTypes.spacing,
|
|
103
|
-
/**
|
|
104
|
-
* Sets the CSS display rule for the component's container
|
|
105
|
-
*/
|
|
106
141
|
display: PropTypes.oneOf(['flex', 'inline-flex']),
|
|
107
|
-
/**
|
|
108
|
-
* Designates the text alignment
|
|
109
|
-
*/
|
|
110
142
|
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
111
|
-
/**
|
|
112
|
-
* Sets the flex-direction to row (horizontal) or column (vertical)
|
|
113
|
-
*/
|
|
114
143
|
direction: PropTypes.oneOf([
|
|
115
144
|
'row',
|
|
116
145
|
'column',
|
|
117
146
|
'row-reverse',
|
|
118
147
|
'column-reverse'
|
|
119
148
|
]),
|
|
120
|
-
/**
|
|
121
|
-
* Aligns Flex.Items on the vertical axis (horizontal if direction is column)
|
|
122
|
-
*/
|
|
123
149
|
alignItems: PropTypes.oneOf(['center', 'start', 'end', 'stretch']),
|
|
124
|
-
/**
|
|
125
|
-
* Aligns Flex.Items on the horizontal axis (vertical if direction is column)
|
|
126
|
-
*/
|
|
127
150
|
justifyItems: PropTypes.oneOf([
|
|
128
151
|
'center',
|
|
129
152
|
'start',
|
|
@@ -131,14 +154,7 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
131
154
|
'space-around',
|
|
132
155
|
'space-between'
|
|
133
156
|
]),
|
|
134
|
-
/**
|
|
135
|
-
* Determines if the Flex.Items should wrap when they exceed their container's width
|
|
136
|
-
*/
|
|
137
157
|
wrap: PropTypes.oneOf(['wrap', 'no-wrap', 'wrap-reverse']),
|
|
138
|
-
/**
|
|
139
|
-
* Activate a dotted outline around the component to make building your
|
|
140
|
-
* layout easier
|
|
141
|
-
*/
|
|
142
158
|
withVisualDebug: PropTypes.bool
|
|
143
159
|
}
|
|
144
160
|
|
|
@@ -7,6 +7,7 @@ import type { FlexItemProps } from './props';
|
|
|
7
7
|
parent: Flex
|
|
8
8
|
id: Flex.Item
|
|
9
9
|
---
|
|
10
|
+
@tsProps
|
|
10
11
|
**/
|
|
11
12
|
declare class Item extends Component<FlexItemProps> {
|
|
12
13
|
static readonly componentId = "Flex.Item";
|
|
@@ -46,7 +47,6 @@ declare class Item extends Component<FlexItemProps> {
|
|
|
46
47
|
})[];
|
|
47
48
|
static defaultProps: {
|
|
48
49
|
as: string;
|
|
49
|
-
elementRef: (el: any) => void;
|
|
50
50
|
shouldGrow: boolean;
|
|
51
51
|
shouldShrink: boolean;
|
|
52
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Flex/Item/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Flex/Item/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C;;;;;;GAMG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,aAAa,CAAC;IACzC,MAAM,CAAC,QAAQ,CAAC,WAAW,eAAc;IAEzC,iBAAiB;IAIjB,kBAAkB;IAIlB,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;MAIlB;IAED,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;IAED,MAAM;CAuCP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -2,19 +2,65 @@ import React from 'react';
|
|
|
2
2
|
import type { AsElementType, OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
|
|
3
3
|
import type { Spacing, WithStyleProps, ComponentStyle } from '@instructure/emotion';
|
|
4
4
|
declare type FlexItemOwnProps = {
|
|
5
|
+
/**
|
|
6
|
+
* The children to render inside the Item
|
|
7
|
+
*/
|
|
5
8
|
children?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* the element type to render as
|
|
11
|
+
*/
|
|
6
12
|
as?: AsElementType;
|
|
13
|
+
/**
|
|
14
|
+
* provides a reference to the underlying html root element
|
|
15
|
+
*/
|
|
7
16
|
elementRef?: (element: Element | null) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
19
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
20
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
21
|
+
*/
|
|
8
22
|
margin?: Spacing;
|
|
23
|
+
/**
|
|
24
|
+
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
25
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
26
|
+
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
27
|
+
*/
|
|
9
28
|
padding?: Spacing;
|
|
29
|
+
/**
|
|
30
|
+
* overrides the parent Flex's alignItems prop, if needed
|
|
31
|
+
*/
|
|
10
32
|
align?: 'center' | 'start' | 'end' | 'stretch';
|
|
33
|
+
/**
|
|
34
|
+
* Inherits from the parent Flex component
|
|
35
|
+
*/
|
|
11
36
|
direction?: 'row' | 'column';
|
|
37
|
+
/**
|
|
38
|
+
* Designates the text alignment inside the Item
|
|
39
|
+
*/
|
|
12
40
|
textAlign?: 'start' | 'center' | 'end';
|
|
41
|
+
/**
|
|
42
|
+
* Handles horizontal overflow
|
|
43
|
+
*/
|
|
13
44
|
overflowX?: 'auto' | 'hidden' | 'visible';
|
|
45
|
+
/**
|
|
46
|
+
* Handles vertical overflow
|
|
47
|
+
*/
|
|
14
48
|
overflowY?: 'auto' | 'hidden' | 'visible';
|
|
49
|
+
/**
|
|
50
|
+
* Should the FlexItem grow to fill any available space?
|
|
51
|
+
*/
|
|
15
52
|
shouldGrow?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Should the FlexItem shrink (stopping at its `size`)?
|
|
55
|
+
*/
|
|
16
56
|
shouldShrink?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the base size of the FlexItem (width if direction is `row`; height if direction is `column`)
|
|
59
|
+
*/
|
|
17
60
|
size?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Places dashed lines around the component's borders to help debug your layout
|
|
63
|
+
*/
|
|
18
64
|
withVisualDebug?: boolean;
|
|
19
65
|
};
|
|
20
66
|
declare type PropKeys = keyof FlexItemOwnProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Flex/Item/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,aAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Flex/Item/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,aAAK,gBAAgB,GAAG;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,EAAE,CAAC,EAAE,aAAa,CAAA;IAElB;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAA;IAE9C;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAA;IAE9C;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAA;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAEtC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;IAEzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;IAEzC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,gBAAgB,CAAA;AAEtC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,aAAa,GAAG,gBAAgB,GACnC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,GACnC,mBAAmB,CAAC,gBAAgB,CAAC,CAAA;AAEvC,aAAK,aAAa,GAAG,cAAc,CAAC,UAAU,CAAC,CAAA;AAE/C,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAevC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAenB,CAAA;AAED,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|