@instructure/ui-view 10.26.1-snapshot-2 → 10.26.2
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 +5 -18
- package/es/ContextView/index.js +2 -2
- package/es/ContextView/props.js +67 -1
- package/es/View/index.js +6 -6
- package/es/View/props.js +44 -1
- package/lib/ContextView/index.js +1 -1
- package/lib/ContextView/props.js +68 -1
- package/lib/View/index.js +5 -5
- package/lib/View/props.js +45 -1
- package/package.json +16 -15
- package/src/ContextView/index.tsx +2 -1
- package/src/ContextView/props.ts +83 -1
- package/src/View/index.tsx +5 -4
- package/src/View/props.ts +72 -2
- package/tsconfig.build.json +6 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ContextView/index.d.ts +20 -0
- package/types/ContextView/index.d.ts.map +1 -1
- package/types/ContextView/props.d.ts +3 -2
- package/types/ContextView/props.d.ts.map +1 -1
- package/types/View/index.d.ts +1 -0
- package/types/View/index.d.ts.map +1 -1
- package/types/View/props.d.ts +4 -3
- package/types/View/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,30 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [10.26.
|
|
6
|
+
## [10.26.2](https://github.com/instructure/instructure-ui/compare/v10.26.1...v10.26.2) (2025-10-13)
|
|
7
7
|
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-view
|
|
8
9
|
|
|
9
|
-
### Features
|
|
10
10
|
|
|
11
|
-
* **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
### BREAKING CHANGES
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- remove `CodeEditor` component
|
|
20
|
-
- remove `@instui/theme-registry` package
|
|
21
|
-
- remove `@testable`, `@experimental`, `@hack` decorators
|
|
22
|
-
- InstUISettingsProvider's `as` prop is removed
|
|
23
|
-
- `canvas.use()`, `canvasHighContrast.use()` functions are removed
|
|
24
|
-
- `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
|
|
25
|
-
- `variables` field on theme objects are removed
|
|
26
|
-
- remove deprecated props from Table: Row's `isStacked`, Body's
|
|
27
|
-
`isStacked`, `hover`, and `headers`
|
|
28
|
-
- `Table`'s `caption` prop is now required
|
|
29
|
-
- `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
|
|
14
|
+
## [10.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @instructure/ui-view
|
|
30
17
|
|
|
31
18
|
|
|
32
19
|
|
package/es/ContextView/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import { omitProps } from '@instructure/ui-react-utils';
|
|
|
29
29
|
import { View } from '../View';
|
|
30
30
|
import generateStyle from './styles';
|
|
31
31
|
import generateComponentTheme from './theme';
|
|
32
|
-
import { allowedProps } from './props';
|
|
32
|
+
import { propTypes, allowedProps } from './props';
|
|
33
33
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
34
34
|
/**
|
|
35
35
|
---
|
|
@@ -110,7 +110,7 @@ let ContextView = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
110
110
|
})
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
}, _ContextView.displayName = "ContextView", _ContextView.componentId = 'ContextView', _ContextView.allowedProps = allowedProps, _ContextView.defaultProps = {
|
|
113
|
+
}, _ContextView.displayName = "ContextView", _ContextView.componentId = 'ContextView', _ContextView.allowedProps = allowedProps, _ContextView.propTypes = propTypes, _ContextView.defaultProps = {
|
|
114
114
|
as: 'span',
|
|
115
115
|
elementRef: () => {},
|
|
116
116
|
debug: false,
|
package/es/ContextView/props.js
CHANGED
|
@@ -22,5 +22,71 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
27
|
+
import { PositionPropTypes } from '@instructure/ui-position';
|
|
28
|
+
const propTypes = {
|
|
29
|
+
/**
|
|
30
|
+
* The element to render as the component root
|
|
31
|
+
*/
|
|
32
|
+
as: PropTypes.elementType,
|
|
33
|
+
/**
|
|
34
|
+
* provides a reference to the underlying html root element
|
|
35
|
+
*/
|
|
36
|
+
elementRef: PropTypes.func,
|
|
37
|
+
/**
|
|
38
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
39
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
40
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
41
|
+
*/
|
|
42
|
+
margin: PropTypes.string,
|
|
43
|
+
/**
|
|
44
|
+
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
45
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
46
|
+
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
47
|
+
*/
|
|
48
|
+
padding: PropTypes.string,
|
|
49
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
50
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
51
|
+
maxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
52
|
+
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
53
|
+
minHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
54
|
+
minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
55
|
+
/**
|
|
56
|
+
* The children to render inside the `<ContextView />`
|
|
57
|
+
*/
|
|
58
|
+
children: PropTypes.node,
|
|
59
|
+
/**
|
|
60
|
+
* Designates the text alignment within the `<ContextView />`
|
|
61
|
+
*/
|
|
62
|
+
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
63
|
+
/**
|
|
64
|
+
* Controls the shadow depth for the `<ContextView />`
|
|
65
|
+
*/
|
|
66
|
+
shadow: ThemeablePropTypes.shadow,
|
|
67
|
+
/**
|
|
68
|
+
* Controls the z-index depth for the `<ContextView />`
|
|
69
|
+
*/
|
|
70
|
+
stacking: ThemeablePropTypes.stacking,
|
|
71
|
+
/**
|
|
72
|
+
* Designates the background style of the `<ContextView />`
|
|
73
|
+
*/
|
|
74
|
+
background: PropTypes.oneOf(['default', 'inverse']),
|
|
75
|
+
/**
|
|
76
|
+
* Specifies how the arrow for `<ContextView />` will be rendered.
|
|
77
|
+
* Ex. `placement="top"` will render with an arrow pointing down.
|
|
78
|
+
*/
|
|
79
|
+
placement: PositionPropTypes.placement,
|
|
80
|
+
/**
|
|
81
|
+
* Activate an outline around the component to make building your
|
|
82
|
+
* layout easier
|
|
83
|
+
*/
|
|
84
|
+
debug: PropTypes.bool,
|
|
85
|
+
/**
|
|
86
|
+
* Sets the color of the ContextView border.
|
|
87
|
+
* Accepts a color string value (e.g., "#FFFFFF", "red")
|
|
88
|
+
*/
|
|
89
|
+
borderColor: PropTypes.string
|
|
90
|
+
};
|
|
25
91
|
const allowedProps = ['as', 'elementRef', 'margin', 'padding', 'height', 'width', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'children', 'textAlign', 'shadow', 'stacking', 'background', 'placement', 'debug', 'borderColor'];
|
|
26
|
-
export { allowedProps };
|
|
92
|
+
export { propTypes, allowedProps };
|
package/es/View/index.js
CHANGED
|
@@ -26,14 +26,14 @@ var _dec, _dec2, _class, _View;
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import { Component } from 'react';
|
|
29
|
-
import {
|
|
29
|
+
import { getComputedStyle } from '@instructure/ui-dom-utils';
|
|
30
30
|
import { textDirectionContextConsumer } from '@instructure/ui-i18n';
|
|
31
31
|
import { logError as error } from '@instructure/console';
|
|
32
32
|
import { getElementType, omitProps, pickProps, passthroughProps } from '@instructure/ui-react-utils';
|
|
33
33
|
import { withStyle } from '@instructure/emotion';
|
|
34
34
|
import generateStyle from './styles';
|
|
35
35
|
import generateComponentTheme from './theme';
|
|
36
|
-
import { allowedProps } from './props';
|
|
36
|
+
import { propTypes, allowedProps } from './props';
|
|
37
37
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
38
38
|
/**
|
|
39
39
|
---
|
|
@@ -65,17 +65,17 @@ let View = (_dec = textDirectionContextConsumer(), _dec2 = withStyle(generateSty
|
|
|
65
65
|
var _this$props$makeStyle2, _this$props2;
|
|
66
66
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
67
67
|
|
|
68
|
-
// Not calling
|
|
68
|
+
// Not calling getComputedStyle can save hundreds of ms in tests and production
|
|
69
69
|
if (process.env.NODE_ENV === 'development' && !this.spanMarginVerified) {
|
|
70
70
|
// We have to verify margins in the first 'componentDidUpdate',
|
|
71
71
|
// because that is when all styles are calculated,
|
|
72
72
|
// but we only want to check once, using a flag
|
|
73
73
|
this.spanMarginVerified = true;
|
|
74
|
-
error(!function verifySpanMargin(element, margin
|
|
74
|
+
error(!function verifySpanMargin(element, margin) {
|
|
75
75
|
if (!element) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
const display = (
|
|
78
|
+
const display = getComputedStyle(element).display;
|
|
79
79
|
if (display !== 'inline') {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
@@ -131,7 +131,7 @@ let View = (_dec = textDirectionContextConsumer(), _dec2 = withStyle(generateSty
|
|
|
131
131
|
children: children
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
}, _View.displayName = "View", _View.componentId = 'View', _View.allowedProps = allowedProps, _View.defaultProps = {
|
|
134
|
+
}, _View.displayName = "View", _View.componentId = 'View', _View.allowedProps = allowedProps, _View.propTypes = propTypes, _View.defaultProps = {
|
|
135
135
|
display: 'auto',
|
|
136
136
|
overflowX: 'visible',
|
|
137
137
|
overflowY: 'visible',
|
package/es/View/props.js
CHANGED
|
@@ -22,8 +22,51 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { cursor as cursorPropTypes } from '@instructure/ui-prop-types';
|
|
27
|
+
import { textDirectionContextConsumer } from '@instructure/ui-i18n';
|
|
28
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
29
|
+
const propTypes = {
|
|
30
|
+
as: PropTypes.elementType,
|
|
31
|
+
elementRef: PropTypes.func,
|
|
32
|
+
display: PropTypes.oneOf(['auto', 'inline', 'block', 'inline-block', 'flex', 'inline-flex']),
|
|
33
|
+
overflowX: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
34
|
+
overflowY: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
35
|
+
margin: PropTypes.string,
|
|
36
|
+
padding: PropTypes.string,
|
|
37
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
38
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
39
|
+
maxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
40
|
+
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
41
|
+
minHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
42
|
+
minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
43
|
+
children: PropTypes.node,
|
|
44
|
+
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
45
|
+
borderWidth: ThemeablePropTypes.borderWidth,
|
|
46
|
+
borderRadius: PropTypes.string,
|
|
47
|
+
borderColor: PropTypes.string,
|
|
48
|
+
background: PropTypes.oneOf(['transparent', 'primary', 'secondary', 'primary-inverse', 'brand', 'info', 'alert', 'success', 'danger', 'warning']),
|
|
49
|
+
shadow: ThemeablePropTypes.shadow,
|
|
50
|
+
stacking: ThemeablePropTypes.stacking,
|
|
51
|
+
cursor: cursorPropTypes,
|
|
52
|
+
position: PropTypes.oneOf(['static', 'absolute', 'relative', 'sticky', 'fixed']),
|
|
53
|
+
insetInlineStart: PropTypes.string,
|
|
54
|
+
insetInlineEnd: PropTypes.string,
|
|
55
|
+
insetBlockStart: PropTypes.string,
|
|
56
|
+
insetBlockEnd: PropTypes.string,
|
|
57
|
+
withFocusOutline: PropTypes.bool,
|
|
58
|
+
focusPosition: PropTypes.oneOf(['offset', 'inset']),
|
|
59
|
+
focusColor: PropTypes.oneOf(['info', 'inverse', 'success', 'danger']),
|
|
60
|
+
shouldAnimateFocus: PropTypes.bool,
|
|
61
|
+
withVisualDebug: PropTypes.bool,
|
|
62
|
+
dir: PropTypes.oneOf(Object.values(textDirectionContextConsumer.DIRECTION)),
|
|
63
|
+
overscrollBehavior: PropTypes.oneOf(['auto', 'contain', 'none']),
|
|
64
|
+
focusRingBorderRadius: PropTypes.string,
|
|
65
|
+
focusWithin: PropTypes.bool
|
|
66
|
+
};
|
|
67
|
+
|
|
25
68
|
// This variable will be attached as static property on the `View` component
|
|
26
69
|
// so we don't rely on the `PropTypes` validators for our internal logic.
|
|
27
70
|
// This means on prod builds the consuming applications can safely delete propTypes.
|
|
28
71
|
const allowedProps = ['as', 'background', 'borderColor', 'borderRadius', 'borderWidth', 'children', 'cursor', 'dir', 'display', 'elementRef', 'focusColor', 'focusPosition', 'height', 'insetBlockEnd', 'insetBlockStart', 'insetInlineEnd', 'insetInlineStart', 'margin', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'overflowX', 'overflowY', 'overscrollBehavior', 'padding', 'position', 'shadow', 'shouldAnimateFocus', 'stacking', 'textAlign', 'width', 'withFocusOutline', 'withVisualDebug', 'focusRingBorderRadius', 'focusWithin'];
|
|
29
|
-
export { allowedProps };
|
|
72
|
+
export { propTypes, allowedProps };
|
package/lib/ContextView/index.js
CHANGED
|
@@ -116,7 +116,7 @@ let ContextView = exports.ContextView = (_dec = (0, _emotion.withStyle)(_styles.
|
|
|
116
116
|
})
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
}, _ContextView.displayName = "ContextView", _ContextView.componentId = 'ContextView', _ContextView.allowedProps = _props.allowedProps, _ContextView.defaultProps = {
|
|
119
|
+
}, _ContextView.displayName = "ContextView", _ContextView.componentId = 'ContextView', _ContextView.allowedProps = _props.allowedProps, _ContextView.propTypes = _props.propTypes, _ContextView.defaultProps = {
|
|
120
120
|
as: 'span',
|
|
121
121
|
elementRef: () => {},
|
|
122
122
|
debug: false,
|
package/lib/ContextView/props.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _emotion = require("@instructure/emotion");
|
|
10
|
+
var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
|
|
7
11
|
/*
|
|
8
12
|
* The MIT License (MIT)
|
|
9
13
|
*
|
|
@@ -28,4 +32,67 @@ exports.allowedProps = void 0;
|
|
|
28
32
|
* SOFTWARE.
|
|
29
33
|
*/
|
|
30
34
|
|
|
35
|
+
const propTypes = exports.propTypes = {
|
|
36
|
+
/**
|
|
37
|
+
* The element to render as the component root
|
|
38
|
+
*/
|
|
39
|
+
as: _propTypes.default.elementType,
|
|
40
|
+
/**
|
|
41
|
+
* provides a reference to the underlying html root element
|
|
42
|
+
*/
|
|
43
|
+
elementRef: _propTypes.default.func,
|
|
44
|
+
/**
|
|
45
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
46
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
47
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
48
|
+
*/
|
|
49
|
+
margin: _propTypes.default.string,
|
|
50
|
+
/**
|
|
51
|
+
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
52
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
53
|
+
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
54
|
+
*/
|
|
55
|
+
padding: _propTypes.default.string,
|
|
56
|
+
height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
57
|
+
width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
58
|
+
maxHeight: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
59
|
+
maxWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
60
|
+
minHeight: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
61
|
+
minWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
62
|
+
/**
|
|
63
|
+
* The children to render inside the `<ContextView />`
|
|
64
|
+
*/
|
|
65
|
+
children: _propTypes.default.node,
|
|
66
|
+
/**
|
|
67
|
+
* Designates the text alignment within the `<ContextView />`
|
|
68
|
+
*/
|
|
69
|
+
textAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
|
|
70
|
+
/**
|
|
71
|
+
* Controls the shadow depth for the `<ContextView />`
|
|
72
|
+
*/
|
|
73
|
+
shadow: _emotion.ThemeablePropTypes.shadow,
|
|
74
|
+
/**
|
|
75
|
+
* Controls the z-index depth for the `<ContextView />`
|
|
76
|
+
*/
|
|
77
|
+
stacking: _emotion.ThemeablePropTypes.stacking,
|
|
78
|
+
/**
|
|
79
|
+
* Designates the background style of the `<ContextView />`
|
|
80
|
+
*/
|
|
81
|
+
background: _propTypes.default.oneOf(['default', 'inverse']),
|
|
82
|
+
/**
|
|
83
|
+
* Specifies how the arrow for `<ContextView />` will be rendered.
|
|
84
|
+
* Ex. `placement="top"` will render with an arrow pointing down.
|
|
85
|
+
*/
|
|
86
|
+
placement: _PositionPropTypes.PositionPropTypes.placement,
|
|
87
|
+
/**
|
|
88
|
+
* Activate an outline around the component to make building your
|
|
89
|
+
* layout easier
|
|
90
|
+
*/
|
|
91
|
+
debug: _propTypes.default.bool,
|
|
92
|
+
/**
|
|
93
|
+
* Sets the color of the ContextView border.
|
|
94
|
+
* Accepts a color string value (e.g., "#FFFFFF", "red")
|
|
95
|
+
*/
|
|
96
|
+
borderColor: _propTypes.default.string
|
|
97
|
+
};
|
|
31
98
|
const allowedProps = exports.allowedProps = ['as', 'elementRef', 'margin', 'padding', 'height', 'width', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'children', 'textAlign', 'shadow', 'stacking', 'background', 'placement', 'debug', 'borderColor'];
|
package/lib/View/index.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.View = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var
|
|
10
|
+
var _getComputedStyle = require("@instructure/ui-dom-utils/lib/getComputedStyle.js");
|
|
11
11
|
var _textDirectionContextConsumer = require("@instructure/ui-i18n/lib/textDirectionContextConsumer.js");
|
|
12
12
|
var _console = require("@instructure/console");
|
|
13
13
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
@@ -74,17 +74,17 @@ let View = exports.View = (_dec = (0, _textDirectionContextConsumer.textDirectio
|
|
|
74
74
|
var _this$props$makeStyle2, _this$props2;
|
|
75
75
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
76
76
|
|
|
77
|
-
// Not calling
|
|
77
|
+
// Not calling getComputedStyle can save hundreds of ms in tests and production
|
|
78
78
|
if (process.env.NODE_ENV === 'development' && !this.spanMarginVerified) {
|
|
79
79
|
// We have to verify margins in the first 'componentDidUpdate',
|
|
80
80
|
// because that is when all styles are calculated,
|
|
81
81
|
// but we only want to check once, using a flag
|
|
82
82
|
this.spanMarginVerified = true;
|
|
83
|
-
(0, _console.logError)(!function verifySpanMargin(element, margin
|
|
83
|
+
(0, _console.logError)(!function verifySpanMargin(element, margin) {
|
|
84
84
|
if (!element) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
const display = (
|
|
87
|
+
const display = (0, _getComputedStyle.getComputedStyle)(element).display;
|
|
88
88
|
if (display !== 'inline') {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
@@ -140,7 +140,7 @@ let View = exports.View = (_dec = (0, _textDirectionContextConsumer.textDirectio
|
|
|
140
140
|
children: children
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
}, _View.displayName = "View", _View.componentId = 'View', _View.allowedProps = _props.allowedProps, _View.defaultProps = {
|
|
143
|
+
}, _View.displayName = "View", _View.componentId = 'View', _View.allowedProps = _props.allowedProps, _View.propTypes = _props.propTypes, _View.defaultProps = {
|
|
144
144
|
display: 'auto',
|
|
145
145
|
overflowX: 'visible',
|
|
146
146
|
overflowY: 'visible',
|
package/lib/View/props.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _cursor = require("@instructure/ui-prop-types/lib/cursor.js");
|
|
10
|
+
var _textDirectionContextConsumer = require("@instructure/ui-i18n/lib/textDirectionContextConsumer.js");
|
|
11
|
+
var _emotion = require("@instructure/emotion");
|
|
7
12
|
/*
|
|
8
13
|
* The MIT License (MIT)
|
|
9
14
|
*
|
|
@@ -28,6 +33,45 @@ exports.allowedProps = void 0;
|
|
|
28
33
|
* SOFTWARE.
|
|
29
34
|
*/
|
|
30
35
|
|
|
36
|
+
const propTypes = exports.propTypes = {
|
|
37
|
+
as: _propTypes.default.elementType,
|
|
38
|
+
elementRef: _propTypes.default.func,
|
|
39
|
+
display: _propTypes.default.oneOf(['auto', 'inline', 'block', 'inline-block', 'flex', 'inline-flex']),
|
|
40
|
+
overflowX: _propTypes.default.oneOf(['auto', 'hidden', 'visible']),
|
|
41
|
+
overflowY: _propTypes.default.oneOf(['auto', 'hidden', 'visible']),
|
|
42
|
+
margin: _propTypes.default.string,
|
|
43
|
+
padding: _propTypes.default.string,
|
|
44
|
+
height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
45
|
+
width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
46
|
+
maxHeight: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
47
|
+
maxWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
48
|
+
minHeight: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
49
|
+
minWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
50
|
+
children: _propTypes.default.node,
|
|
51
|
+
textAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
|
|
52
|
+
borderWidth: _emotion.ThemeablePropTypes.borderWidth,
|
|
53
|
+
borderRadius: _propTypes.default.string,
|
|
54
|
+
borderColor: _propTypes.default.string,
|
|
55
|
+
background: _propTypes.default.oneOf(['transparent', 'primary', 'secondary', 'primary-inverse', 'brand', 'info', 'alert', 'success', 'danger', 'warning']),
|
|
56
|
+
shadow: _emotion.ThemeablePropTypes.shadow,
|
|
57
|
+
stacking: _emotion.ThemeablePropTypes.stacking,
|
|
58
|
+
cursor: _cursor.cursor,
|
|
59
|
+
position: _propTypes.default.oneOf(['static', 'absolute', 'relative', 'sticky', 'fixed']),
|
|
60
|
+
insetInlineStart: _propTypes.default.string,
|
|
61
|
+
insetInlineEnd: _propTypes.default.string,
|
|
62
|
+
insetBlockStart: _propTypes.default.string,
|
|
63
|
+
insetBlockEnd: _propTypes.default.string,
|
|
64
|
+
withFocusOutline: _propTypes.default.bool,
|
|
65
|
+
focusPosition: _propTypes.default.oneOf(['offset', 'inset']),
|
|
66
|
+
focusColor: _propTypes.default.oneOf(['info', 'inverse', 'success', 'danger']),
|
|
67
|
+
shouldAnimateFocus: _propTypes.default.bool,
|
|
68
|
+
withVisualDebug: _propTypes.default.bool,
|
|
69
|
+
dir: _propTypes.default.oneOf(Object.values(_textDirectionContextConsumer.textDirectionContextConsumer.DIRECTION)),
|
|
70
|
+
overscrollBehavior: _propTypes.default.oneOf(['auto', 'contain', 'none']),
|
|
71
|
+
focusRingBorderRadius: _propTypes.default.string,
|
|
72
|
+
focusWithin: _propTypes.default.bool
|
|
73
|
+
};
|
|
74
|
+
|
|
31
75
|
// This variable will be attached as static property on the `View` component
|
|
32
76
|
// so we don't rely on the `PropTypes` validators for our internal logic.
|
|
33
77
|
// This means on prod builds the consuming applications can safely delete propTypes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-view",
|
|
3
|
-
"version": "10.26.
|
|
3
|
+
"version": "10.26.2",
|
|
4
4
|
"description": "A component for basic styles including spacing, sizing, borders, display, positioning, and focus states.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,26 +24,27 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.27.6",
|
|
27
|
-
"@instructure/console": "10.26.
|
|
28
|
-
"@instructure/emotion": "10.26.
|
|
29
|
-
"@instructure/shared-types": "10.26.
|
|
30
|
-
"@instructure/ui-color-utils": "10.26.
|
|
31
|
-
"@instructure/ui-dom-utils": "10.26.
|
|
32
|
-
"@instructure/ui-i18n": "10.26.
|
|
33
|
-
"@instructure/ui-position": "10.26.
|
|
34
|
-
"@instructure/ui-prop-types": "10.26.
|
|
35
|
-
"@instructure/ui-react-utils": "10.26.
|
|
27
|
+
"@instructure/console": "10.26.2",
|
|
28
|
+
"@instructure/emotion": "10.26.2",
|
|
29
|
+
"@instructure/shared-types": "10.26.2",
|
|
30
|
+
"@instructure/ui-color-utils": "10.26.2",
|
|
31
|
+
"@instructure/ui-dom-utils": "10.26.2",
|
|
32
|
+
"@instructure/ui-i18n": "10.26.2",
|
|
33
|
+
"@instructure/ui-position": "10.26.2",
|
|
34
|
+
"@instructure/ui-prop-types": "10.26.2",
|
|
35
|
+
"@instructure/ui-react-utils": "10.26.2",
|
|
36
|
+
"prop-types": "^15.8.1"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"@instructure/ui-axe-check": "10.26.
|
|
39
|
-
"@instructure/ui-babel-preset": "10.26.
|
|
40
|
-
"@instructure/ui-themes": "10.26.
|
|
39
|
+
"@instructure/ui-axe-check": "10.26.2",
|
|
40
|
+
"@instructure/ui-babel-preset": "10.26.2",
|
|
41
|
+
"@instructure/ui-themes": "10.26.2",
|
|
41
42
|
"@testing-library/jest-dom": "^6.6.3",
|
|
42
|
-
"@testing-library/react": "
|
|
43
|
+
"@testing-library/react": "^16.0.1",
|
|
43
44
|
"vitest": "^3.2.2"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
|
-
"react": ">=
|
|
47
|
+
"react": ">=16.14 <=18"
|
|
47
48
|
},
|
|
48
49
|
"publishConfig": {
|
|
49
50
|
"access": "public"
|
|
@@ -31,7 +31,7 @@ import { View } from '../View'
|
|
|
31
31
|
|
|
32
32
|
import generateStyle from './styles'
|
|
33
33
|
import generateComponentTheme from './theme'
|
|
34
|
-
import { allowedProps } from './props'
|
|
34
|
+
import { propTypes, allowedProps } from './props'
|
|
35
35
|
import type { ContextViewProps } from './props'
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -44,6 +44,7 @@ category: components
|
|
|
44
44
|
class ContextView extends Component<ContextViewProps> {
|
|
45
45
|
static readonly componentId = 'ContextView'
|
|
46
46
|
static allowedProps = allowedProps
|
|
47
|
+
static propTypes = propTypes
|
|
47
48
|
static defaultProps = {
|
|
48
49
|
as: 'span',
|
|
49
50
|
elementRef: () => {},
|
package/src/ContextView/props.ts
CHANGED
|
@@ -23,8 +23,14 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import { ThemeablePropTypes } from '@instructure/emotion'
|
|
29
|
+
import { PositionPropTypes } from '@instructure/ui-position'
|
|
30
|
+
|
|
26
31
|
import type {
|
|
27
32
|
AsElementType,
|
|
33
|
+
PropValidators,
|
|
28
34
|
ContextViewTheme,
|
|
29
35
|
OtherHTMLAttributes
|
|
30
36
|
} from '@instructure/shared-types'
|
|
@@ -72,6 +78,82 @@ type ContextViewStyle = ComponentStyle<
|
|
|
72
78
|
arrowSize: string | 0
|
|
73
79
|
arrowBorderWidth: string | 0
|
|
74
80
|
}
|
|
81
|
+
|
|
82
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
83
|
+
/**
|
|
84
|
+
* The element to render as the component root
|
|
85
|
+
*/
|
|
86
|
+
as: PropTypes.elementType,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* provides a reference to the underlying html root element
|
|
90
|
+
*/
|
|
91
|
+
elementRef: PropTypes.func,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
95
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
96
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
97
|
+
*/
|
|
98
|
+
margin: PropTypes.string,
|
|
99
|
+
/**
|
|
100
|
+
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
101
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
102
|
+
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
103
|
+
*/
|
|
104
|
+
padding: PropTypes.string,
|
|
105
|
+
|
|
106
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
107
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
108
|
+
maxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
109
|
+
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
110
|
+
minHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
111
|
+
minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The children to render inside the `<ContextView />`
|
|
115
|
+
*/
|
|
116
|
+
children: PropTypes.node,
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Designates the text alignment within the `<ContextView />`
|
|
120
|
+
*/
|
|
121
|
+
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Controls the shadow depth for the `<ContextView />`
|
|
125
|
+
*/
|
|
126
|
+
shadow: ThemeablePropTypes.shadow,
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Controls the z-index depth for the `<ContextView />`
|
|
130
|
+
*/
|
|
131
|
+
stacking: ThemeablePropTypes.stacking,
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Designates the background style of the `<ContextView />`
|
|
135
|
+
*/
|
|
136
|
+
background: PropTypes.oneOf(['default', 'inverse']),
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Specifies how the arrow for `<ContextView />` will be rendered.
|
|
140
|
+
* Ex. `placement="top"` will render with an arrow pointing down.
|
|
141
|
+
*/
|
|
142
|
+
placement: PositionPropTypes.placement,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Activate an outline around the component to make building your
|
|
146
|
+
* layout easier
|
|
147
|
+
*/
|
|
148
|
+
debug: PropTypes.bool,
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Sets the color of the ContextView border.
|
|
152
|
+
* Accepts a color string value (e.g., "#FFFFFF", "red")
|
|
153
|
+
*/
|
|
154
|
+
borderColor: PropTypes.string
|
|
155
|
+
}
|
|
156
|
+
|
|
75
157
|
const allowedProps: AllowedPropKeys = [
|
|
76
158
|
'as',
|
|
77
159
|
'elementRef',
|
|
@@ -94,4 +176,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
94
176
|
]
|
|
95
177
|
|
|
96
178
|
export type { ContextViewProps, ContextViewStyle }
|
|
97
|
-
export { allowedProps }
|
|
179
|
+
export { propTypes, allowedProps }
|
package/src/View/index.tsx
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component, ComponentType } from 'react'
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import { getComputedStyle } from '@instructure/ui-dom-utils'
|
|
28
28
|
import { textDirectionContextConsumer } from '@instructure/ui-i18n'
|
|
29
29
|
import { logError as error } from '@instructure/console'
|
|
30
30
|
import {
|
|
@@ -38,7 +38,7 @@ import { withStyle } from '@instructure/emotion'
|
|
|
38
38
|
import generateStyle from './styles'
|
|
39
39
|
import generateComponentTheme from './theme'
|
|
40
40
|
|
|
41
|
-
import { allowedProps } from './props'
|
|
41
|
+
import { propTypes, allowedProps } from './props'
|
|
42
42
|
import type { ViewProps } from './props'
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -52,6 +52,7 @@ category: components
|
|
|
52
52
|
class View extends Component<ViewProps> {
|
|
53
53
|
static componentId = 'View'
|
|
54
54
|
static allowedProps = allowedProps
|
|
55
|
+
static propTypes = propTypes
|
|
55
56
|
static defaultProps = {
|
|
56
57
|
display: 'auto',
|
|
57
58
|
overflowX: 'visible',
|
|
@@ -133,7 +134,7 @@ class View extends Component<ViewProps> {
|
|
|
133
134
|
componentDidUpdate() {
|
|
134
135
|
this.props.makeStyles?.()
|
|
135
136
|
|
|
136
|
-
// Not calling
|
|
137
|
+
// Not calling getComputedStyle can save hundreds of ms in tests and production
|
|
137
138
|
if (process.env.NODE_ENV === 'development' && !this.spanMarginVerified) {
|
|
138
139
|
// We have to verify margins in the first 'componentDidUpdate',
|
|
139
140
|
// because that is when all styles are calculated,
|
|
@@ -146,7 +147,7 @@ class View extends Component<ViewProps> {
|
|
|
146
147
|
return
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
const display =
|
|
150
|
+
const display = getComputedStyle(element).display
|
|
150
151
|
|
|
151
152
|
if (display !== 'inline') {
|
|
152
153
|
return
|