carbon-react 102.4.2 → 102.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__internal__/popover/popover.component.js +4 -1
- package/lib/components/button/button.component.js +1 -0
- package/lib/components/checkbox/checkbox.style.js +4 -0
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.style.js +1 -1
- package/lib/components/icon/icon.component.js +5 -0
- package/lib/components/icon/icon.d.ts +2 -0
- package/lib/components/portal/portal.js +4 -1
- package/lib/style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component.js +20 -17
- package/package.json +7 -7
|
@@ -13,6 +13,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
|
|
14
14
|
var _core = require("@popperjs/core");
|
|
15
15
|
|
|
16
|
+
var _styledComponents = require("styled-components");
|
|
17
|
+
|
|
16
18
|
var _useResizeObserver = _interopRequireDefault(require("../../hooks/__internal__/useResizeObserver"));
|
|
17
19
|
|
|
18
20
|
var _carbonScopedTokensProvider = require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component");
|
|
@@ -32,10 +34,11 @@ const Popover = ({
|
|
|
32
34
|
modifiers
|
|
33
35
|
}) => {
|
|
34
36
|
const elementDOM = (0, _react.useRef)();
|
|
37
|
+
const theme = (0, _react.useContext)(_styledComponents.ThemeContext);
|
|
35
38
|
|
|
36
39
|
if (!elementDOM.current && !disablePortal) {
|
|
37
40
|
elementDOM.current = document.createElement("div");
|
|
38
|
-
elementDOM.current.classList.add(_carbonScopedTokensProvider.tokensClassName);
|
|
41
|
+
elementDOM.current.classList.add((0, _carbonScopedTokensProvider.tokensClassName)(theme === null || theme === void 0 ? void 0 : theme.name));
|
|
39
42
|
document.body.appendChild(elementDOM.current);
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -54,6 +54,7 @@ const Icon = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
54
54
|
inputSize,
|
|
55
55
|
role,
|
|
56
56
|
ariaLabel,
|
|
57
|
+
"aria-hidden": ariaHidden,
|
|
57
58
|
focusable = true,
|
|
58
59
|
...rest
|
|
59
60
|
}, ref) => {
|
|
@@ -113,6 +114,7 @@ const Icon = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
113
114
|
}, (0, _tags.default)("icon", rest), styleProps, {
|
|
114
115
|
hasTooltip: hasTooltip,
|
|
115
116
|
"aria-label": ariaLabel,
|
|
117
|
+
"aria-hidden": ariaHidden,
|
|
116
118
|
role: hasTooltip && role === undefined ? "tooltip" : role
|
|
117
119
|
}));
|
|
118
120
|
|
|
@@ -173,6 +175,9 @@ Icon.propTypes = { ...marginPropTypes,
|
|
|
173
175
|
/** Aria label for accessibility purposes */
|
|
174
176
|
ariaLabel: _propTypes.default.string,
|
|
175
177
|
|
|
178
|
+
/** Set whether icon should be recognised by assistive technologies */
|
|
179
|
+
"aria-hidden": _propTypes.default.bool,
|
|
180
|
+
|
|
176
181
|
/** The message to be displayed within the tooltip */
|
|
177
182
|
tooltipMessage: _propTypes.default.node,
|
|
178
183
|
|
|
@@ -221,6 +221,8 @@ export interface IconProps extends MarginProps {
|
|
|
221
221
|
disabled?: boolean;
|
|
222
222
|
/** Aria label for accessibility purposes */
|
|
223
223
|
ariaLabel?: string;
|
|
224
|
+
/** Set whether icon should be recognised by assistive technologies */
|
|
225
|
+
"aria-hidden"?: boolean;
|
|
224
226
|
/** The message to be displayed within the tooltip */
|
|
225
227
|
tooltipMessage?: React.ReactNode;
|
|
226
228
|
/** The position to display the tooltip */
|
|
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
13
|
|
|
14
|
+
var _styledComponents = require("styled-components");
|
|
15
|
+
|
|
14
16
|
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
15
17
|
|
|
16
18
|
var _browser = _interopRequireDefault(require("../../__internal__/utils/helpers/browser"));
|
|
@@ -31,6 +33,7 @@ const Portal = ({
|
|
|
31
33
|
}) => {
|
|
32
34
|
const [portalNode, setPortalNode] = (0, _react.useState)(null);
|
|
33
35
|
const uniqueId = (0, _react.useMemo)(() => (0, _guid.default)(), []);
|
|
36
|
+
const theme = (0, _react.useContext)(_styledComponents.ThemeContext);
|
|
34
37
|
(0, _react.useEffect)(() => {
|
|
35
38
|
if (onReposition) {
|
|
36
39
|
onReposition();
|
|
@@ -65,7 +68,7 @@ const Portal = ({
|
|
|
65
68
|
setPortalNode(node);
|
|
66
69
|
} else if (!node) {
|
|
67
70
|
node = document.createElement("div");
|
|
68
|
-
node.classList.add(portalClassName, _carbonScopedTokensProvider.tokensClassName);
|
|
71
|
+
node.classList.add(portalClassName, (0, _carbonScopedTokensProvider.tokensClassName)((theme === null || theme === void 0 ? void 0 : theme.name) || ""));
|
|
69
72
|
node.setAttribute("data-portal-exit", uniqueId);
|
|
70
73
|
|
|
71
74
|
if (id !== undefined) {
|
|
@@ -19,25 +19,34 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
-
|
|
24
22
|
/**
|
|
25
23
|
*
|
|
26
24
|
* Converts theme properties to css variables form and set them locally for
|
|
27
25
|
* given scope
|
|
28
26
|
*
|
|
29
27
|
*/
|
|
30
|
-
const
|
|
28
|
+
const activeThemes = {};
|
|
29
|
+
const carbonInstanceId = (0, _guid.default)();
|
|
30
|
+
|
|
31
|
+
const kebabCase = input => input && input.toString().toLowerCase().match(/\w*/gm).filter(Boolean).join("-");
|
|
32
|
+
|
|
33
|
+
const tokensClassName = theme => `sage-design-tokens-${kebabCase(theme)}-${carbonInstanceId}`;
|
|
34
|
+
|
|
31
35
|
exports.tokensClassName = tokensClassName;
|
|
32
36
|
const GlobalTokens = (0, _styledComponents.createGlobalStyle)`
|
|
33
|
-
|
|
34
|
-
${({
|
|
37
|
+
${({
|
|
35
38
|
theme
|
|
36
|
-
}) =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
}) => {
|
|
40
|
+
const className = tokensClassName(theme.name);
|
|
41
|
+
activeThemes[className] = activeThemes[className] || (0, _generateCssVariables.default)(theme.compatibility);
|
|
42
|
+
return Object.entries(activeThemes).reduce((acc, [name, definitions]) => `${acc} .${name} { ${definitions} }`, "");
|
|
43
|
+
}}`;
|
|
39
44
|
exports.GlobalTokens = GlobalTokens;
|
|
40
|
-
const TokensProviderWrapper = _styledComponents.default.div
|
|
45
|
+
const TokensProviderWrapper = _styledComponents.default.div.attrs(({
|
|
46
|
+
theme
|
|
47
|
+
}) => ({
|
|
48
|
+
className: tokensClassName(theme.name)
|
|
49
|
+
}))`
|
|
41
50
|
margin: 0;
|
|
42
51
|
padding: 0;
|
|
43
52
|
width: auto;
|
|
@@ -45,14 +54,8 @@ const TokensProviderWrapper = _styledComponents.default.div`
|
|
|
45
54
|
`;
|
|
46
55
|
|
|
47
56
|
const CarbonScopedTokensProvider = ({
|
|
48
|
-
children
|
|
49
|
-
|
|
50
|
-
...props
|
|
51
|
-
}) => /*#__PURE__*/_react.default.createElement(TokensProviderWrapper, _extends({}, props, {
|
|
52
|
-
className: tokensClassName
|
|
53
|
-
}), /*#__PURE__*/_react.default.createElement(GlobalTokens, {
|
|
54
|
-
theme: theme
|
|
55
|
-
}), children);
|
|
57
|
+
children
|
|
58
|
+
}) => /*#__PURE__*/_react.default.createElement(TokensProviderWrapper, null, /*#__PURE__*/_react.default.createElement(GlobalTokens, null), children);
|
|
56
59
|
|
|
57
60
|
var _default = CarbonScopedTokensProvider;
|
|
58
61
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "102.4.
|
|
3
|
+
"version": "102.4.6",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"engineStrict": true,
|
|
6
6
|
"engines": {
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@babel/preset-typescript": "7.12.7",
|
|
61
61
|
"@commitlint/cli": "^11.0.0",
|
|
62
62
|
"@commitlint/config-conventional": "^11.0.0",
|
|
63
|
-
"@cypress/react": "^5.
|
|
64
|
-
"@cypress/webpack-dev-server": "^1.
|
|
63
|
+
"@cypress/react": "^5.12.0",
|
|
64
|
+
"@cypress/webpack-dev-server": "^1.8.0",
|
|
65
65
|
"@semantic-release/changelog": "^6.0.1",
|
|
66
66
|
"@semantic-release/exec": "^6.0.2",
|
|
67
67
|
"@semantic-release/git": "^10.0.1",
|
|
@@ -98,12 +98,12 @@
|
|
|
98
98
|
"core-js": "^3.1.4",
|
|
99
99
|
"cpy-cli": "^3.1.1",
|
|
100
100
|
"cross-env": "^5.2.0",
|
|
101
|
-
"cypress": "^9.
|
|
101
|
+
"cypress": "^9.2.0",
|
|
102
102
|
"cypress-axe": "^0.13.0",
|
|
103
|
-
"cypress-cucumber-preprocessor": "^4.3.
|
|
104
|
-
"cypress-each": "^1.
|
|
103
|
+
"cypress-cucumber-preprocessor": "^4.3.1",
|
|
104
|
+
"cypress-each": "^1.10.0",
|
|
105
105
|
"cypress-plugin-tab": "^1.0.5",
|
|
106
|
-
"cypress-real-events": "^1.
|
|
106
|
+
"cypress-real-events": "^1.6.0",
|
|
107
107
|
"cypress-storybook": "^0.5.1",
|
|
108
108
|
"cz-conventional-changelog": "^3.3.0",
|
|
109
109
|
"draft-js": "^0.11.7",
|