@instructure/ui-view 10.26.1 → 11.0.1-snapshot-0
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 +34 -2
- package/es/ContextView/index.js +2 -2
- package/es/ContextView/props.js +1 -67
- package/es/View/index.js +6 -6
- package/es/View/props.js +1 -44
- package/lib/ContextView/index.js +1 -1
- package/lib/ContextView/props.js +1 -68
- package/lib/View/index.js +5 -5
- package/lib/View/props.js +1 -45
- package/package.json +14 -16
- package/src/ContextView/index.tsx +1 -2
- package/src/ContextView/props.ts +1 -83
- package/src/View/index.tsx +4 -5
- package/src/View/props.ts +2 -72
- package/tsconfig.build.json +1 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ContextView/index.d.ts +0 -20
- package/types/ContextView/index.d.ts.map +1 -1
- package/types/ContextView/props.d.ts +2 -3
- package/types/ContextView/props.d.ts.map +1 -1
- package/types/View/index.d.ts +0 -1
- package/types/View/index.d.ts.map +1 -1
- package/types/View/props.d.ts +3 -4
- package/types/View/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,41 @@
|
|
|
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
|
-
## [
|
|
6
|
+
## [11.0.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v11.0.0...v11.0.1-snapshot-0) (2025-10-07)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-view:** remove ui-prop-types dependency that was left in accidentally after the v11 release ([93f129b](https://github.com/instructure/instructure-ui/commit/93f129b7dda2bbe7fe29ae3e181c28d664dfff56))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [11.0.0](https://github.com/instructure/instructure-ui/compare/v10.26.0...v11.0.0) (2025-10-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### BREAKING CHANGES
|
|
26
|
+
|
|
27
|
+
* **many:** InstUI v11 contains the following breaking changes:
|
|
28
|
+
- React 16 and 17 are no longer supported
|
|
29
|
+
- remove `PropTypes` from all packages
|
|
30
|
+
- remove `CodeEditor` component
|
|
31
|
+
- remove `@instui/theme-registry` package
|
|
32
|
+
- remove `@testable`, `@experimental`, `@hack` decorators
|
|
33
|
+
- InstUISettingsProvider's `as` prop is removed
|
|
34
|
+
- `canvas.use()`, `canvasHighContrast.use()` functions are removed
|
|
35
|
+
- `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
|
|
36
|
+
- `variables` field on theme objects are removed
|
|
37
|
+
- remove deprecated props from Table: Row's `isStacked`, Body's
|
|
38
|
+
`isStacked`, `hover`, and `headers`
|
|
39
|
+
- `Table`'s `caption` prop is now required
|
|
40
|
+
- `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
|
|
9
41
|
|
|
10
42
|
|
|
11
43
|
|
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 {
|
|
32
|
+
import { 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.
|
|
113
|
+
}, _ContextView.displayName = "ContextView", _ContextView.componentId = 'ContextView', _ContextView.allowedProps = allowedProps, _ContextView.defaultProps = {
|
|
114
114
|
as: 'span',
|
|
115
115
|
elementRef: () => {},
|
|
116
116
|
debug: false,
|
package/es/ContextView/props.js
CHANGED
|
@@ -22,71 +22,5 @@
|
|
|
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
|
-
};
|
|
91
25
|
const allowedProps = ['as', 'elementRef', 'margin', 'padding', 'height', 'width', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'children', 'textAlign', 'shadow', 'stacking', 'background', 'placement', 'debug', 'borderColor'];
|
|
92
|
-
export {
|
|
26
|
+
export { 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 { getCSSStyleDeclaration } 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 {
|
|
36
|
+
import { 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 getCSSStyleDeclaration 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, _getCSSStyleDeclarati) {
|
|
75
75
|
if (!element) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
const display =
|
|
78
|
+
const display = (_getCSSStyleDeclarati = getCSSStyleDeclaration(element)) === null || _getCSSStyleDeclarati === void 0 ? void 0 : _getCSSStyleDeclarati.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.
|
|
134
|
+
}, _View.displayName = "View", _View.componentId = 'View', _View.allowedProps = allowedProps, _View.defaultProps = {
|
|
135
135
|
display: 'auto',
|
|
136
136
|
overflowX: 'visible',
|
|
137
137
|
overflowY: 'visible',
|
package/es/View/props.js
CHANGED
|
@@ -22,51 +22,8 @@
|
|
|
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
|
-
|
|
68
25
|
// This variable will be attached as static property on the `View` component
|
|
69
26
|
// so we don't rely on the `PropTypes` validators for our internal logic.
|
|
70
27
|
// This means on prod builds the consuming applications can safely delete propTypes.
|
|
71
28
|
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'];
|
|
72
|
-
export {
|
|
29
|
+
export { 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.
|
|
119
|
+
}, _ContextView.displayName = "ContextView", _ContextView.componentId = 'ContextView', _ContextView.allowedProps = _props.allowedProps, _ContextView.defaultProps = {
|
|
120
120
|
as: 'span',
|
|
121
121
|
elementRef: () => {},
|
|
122
122
|
debug: false,
|
package/lib/ContextView/props.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _emotion = require("@instructure/emotion");
|
|
10
|
-
var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
|
|
6
|
+
exports.allowedProps = void 0;
|
|
11
7
|
/*
|
|
12
8
|
* The MIT License (MIT)
|
|
13
9
|
*
|
|
@@ -32,67 +28,4 @@ var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes
|
|
|
32
28
|
* SOFTWARE.
|
|
33
29
|
*/
|
|
34
30
|
|
|
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
|
-
};
|
|
98
31
|
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 _getCSSStyleDeclaration = require("@instructure/ui-dom-utils/lib/getCSSStyleDeclaration.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 getCSSStyleDeclaration 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, _getCSSStyleDeclarati) {
|
|
84
84
|
if (!element) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
const display = (0,
|
|
87
|
+
const display = (_getCSSStyleDeclarati = (0, _getCSSStyleDeclaration.getCSSStyleDeclaration)(element)) === null || _getCSSStyleDeclarati === void 0 ? void 0 : _getCSSStyleDeclarati.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.
|
|
143
|
+
}, _View.displayName = "View", _View.componentId = 'View', _View.allowedProps = _props.allowedProps, _View.defaultProps = {
|
|
144
144
|
display: 'auto',
|
|
145
145
|
overflowX: 'visible',
|
|
146
146
|
overflowY: 'visible',
|
package/lib/View/props.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
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");
|
|
6
|
+
exports.allowedProps = void 0;
|
|
12
7
|
/*
|
|
13
8
|
* The MIT License (MIT)
|
|
14
9
|
*
|
|
@@ -33,45 +28,6 @@ var _emotion = require("@instructure/emotion");
|
|
|
33
28
|
* SOFTWARE.
|
|
34
29
|
*/
|
|
35
30
|
|
|
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
|
-
|
|
75
31
|
// This variable will be attached as static property on the `View` component
|
|
76
32
|
// so we don't rely on the `PropTypes` validators for our internal logic.
|
|
77
33
|
// 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": "
|
|
3
|
+
"version": "11.0.1-snapshot-0",
|
|
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,27 +24,25 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.27.6",
|
|
27
|
-
"@instructure/console": "
|
|
28
|
-
"@instructure/emotion": "
|
|
29
|
-
"@instructure/shared-types": "
|
|
30
|
-
"@instructure/ui-color-utils": "
|
|
31
|
-
"@instructure/ui-dom-utils": "
|
|
32
|
-
"@instructure/ui-i18n": "
|
|
33
|
-
"@instructure/ui-position": "
|
|
34
|
-
"@instructure/ui-
|
|
35
|
-
"@instructure/ui-react-utils": "10.26.1",
|
|
36
|
-
"prop-types": "^15.8.1"
|
|
27
|
+
"@instructure/console": "11.0.1-snapshot-0",
|
|
28
|
+
"@instructure/emotion": "11.0.1-snapshot-0",
|
|
29
|
+
"@instructure/shared-types": "11.0.1-snapshot-0",
|
|
30
|
+
"@instructure/ui-color-utils": "11.0.1-snapshot-0",
|
|
31
|
+
"@instructure/ui-dom-utils": "11.0.1-snapshot-0",
|
|
32
|
+
"@instructure/ui-i18n": "11.0.1-snapshot-0",
|
|
33
|
+
"@instructure/ui-position": "11.0.1-snapshot-0",
|
|
34
|
+
"@instructure/ui-react-utils": "11.0.1-snapshot-0"
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|
|
39
|
-
"@instructure/ui-axe-check": "
|
|
40
|
-
"@instructure/ui-babel-preset": "
|
|
41
|
-
"@instructure/ui-themes": "
|
|
37
|
+
"@instructure/ui-axe-check": "11.0.1-snapshot-0",
|
|
38
|
+
"@instructure/ui-babel-preset": "11.0.1-snapshot-0",
|
|
39
|
+
"@instructure/ui-themes": "11.0.1-snapshot-0",
|
|
42
40
|
"@testing-library/jest-dom": "^6.6.3",
|
|
43
|
-
"@testing-library/react": "
|
|
41
|
+
"@testing-library/react": "15.0.7",
|
|
44
42
|
"vitest": "^3.2.2"
|
|
45
43
|
},
|
|
46
44
|
"peerDependencies": {
|
|
47
|
-
"react": ">=
|
|
45
|
+
"react": ">=18 <=19"
|
|
48
46
|
},
|
|
49
47
|
"publishConfig": {
|
|
50
48
|
"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 {
|
|
34
|
+
import { allowedProps } from './props'
|
|
35
35
|
import type { ContextViewProps } from './props'
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -44,7 +44,6 @@ category: components
|
|
|
44
44
|
class ContextView extends Component<ContextViewProps> {
|
|
45
45
|
static readonly componentId = 'ContextView'
|
|
46
46
|
static allowedProps = allowedProps
|
|
47
|
-
static propTypes = propTypes
|
|
48
47
|
static defaultProps = {
|
|
49
48
|
as: 'span',
|
|
50
49
|
elementRef: () => {},
|
package/src/ContextView/props.ts
CHANGED
|
@@ -23,14 +23,8 @@
|
|
|
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
|
-
|
|
31
26
|
import type {
|
|
32
27
|
AsElementType,
|
|
33
|
-
PropValidators,
|
|
34
28
|
ContextViewTheme,
|
|
35
29
|
OtherHTMLAttributes
|
|
36
30
|
} from '@instructure/shared-types'
|
|
@@ -78,82 +72,6 @@ type ContextViewStyle = ComponentStyle<
|
|
|
78
72
|
arrowSize: string | 0
|
|
79
73
|
arrowBorderWidth: string | 0
|
|
80
74
|
}
|
|
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
|
-
|
|
157
75
|
const allowedProps: AllowedPropKeys = [
|
|
158
76
|
'as',
|
|
159
77
|
'elementRef',
|
|
@@ -176,4 +94,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
176
94
|
]
|
|
177
95
|
|
|
178
96
|
export type { ContextViewProps, ContextViewStyle }
|
|
179
|
-
export {
|
|
97
|
+
export { 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 { getCSSStyleDeclaration } 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 {
|
|
41
|
+
import { allowedProps } from './props'
|
|
42
42
|
import type { ViewProps } from './props'
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -52,7 +52,6 @@ category: components
|
|
|
52
52
|
class View extends Component<ViewProps> {
|
|
53
53
|
static componentId = 'View'
|
|
54
54
|
static allowedProps = allowedProps
|
|
55
|
-
static propTypes = propTypes
|
|
56
55
|
static defaultProps = {
|
|
57
56
|
display: 'auto',
|
|
58
57
|
overflowX: 'visible',
|
|
@@ -134,7 +133,7 @@ class View extends Component<ViewProps> {
|
|
|
134
133
|
componentDidUpdate() {
|
|
135
134
|
this.props.makeStyles?.()
|
|
136
135
|
|
|
137
|
-
// Not calling
|
|
136
|
+
// Not calling getCSSStyleDeclaration can save hundreds of ms in tests and production
|
|
138
137
|
if (process.env.NODE_ENV === 'development' && !this.spanMarginVerified) {
|
|
139
138
|
// We have to verify margins in the first 'componentDidUpdate',
|
|
140
139
|
// because that is when all styles are calculated,
|
|
@@ -147,7 +146,7 @@ class View extends Component<ViewProps> {
|
|
|
147
146
|
return
|
|
148
147
|
}
|
|
149
148
|
|
|
150
|
-
const display =
|
|
149
|
+
const display = getCSSStyleDeclaration(element)?.display
|
|
151
150
|
|
|
152
151
|
if (display !== 'inline') {
|
|
153
152
|
return
|