carbon-react 99.1.0 → 101.0.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/lib/__internal__/focus-trap/focus-trap.component.js +30 -1
- package/lib/__spec_helper__/index.js +2 -0
- package/lib/components/carbon-provider/carbon-provider.component.js +3 -1
- package/lib/components/date-range/date-range.component.js +210 -252
- package/lib/components/date-range/date-range.d.ts +1 -1
- package/lib/components/modal/__internal__/modal-manager.js +49 -5
- package/lib/components/modal/modal.component.js +4 -2
- package/lib/components/pages/index.d.ts +1 -0
- package/lib/components/pages/index.js +8 -0
- package/lib/style/design-tokens/{carbon-scoped-story-provider → carbon-scoped-tokens-provider}/carbon-scoped-tokens-provider.component.js +1 -1
- package/lib/style/design-tokens/{carbon-scoped-story-provider → carbon-scoped-tokens-provider}/index.js +0 -0
- package/lib/style/themes/aegean/aegean-theme.config.js +8 -0
- package/lib/style/themes/base/base-theme.config.js +42 -0
- package/lib/style/themes/base/index.js +1 -7
- package/lib/style/themes/mint/mint-theme.config.js +8 -0
- package/lib/style/themes/sage/index.js +1 -1
- package/package.json +11 -2
- package/lib/style/design-tokens/carbon-global-tokens-provider/carbon-global-tokens-provider.component.js +0 -25
- package/lib/style/design-tokens/carbon-global-tokens-provider/index.js +0 -15
- package/lib/style/design-tokens/theme-compatibility.util.js +0 -709
|
@@ -17,6 +17,8 @@ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _
|
|
|
17
17
|
|
|
18
18
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
19
19
|
|
|
20
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
21
|
+
|
|
20
22
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
21
23
|
|
|
22
24
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
@@ -25,39 +27,73 @@ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) {
|
|
|
25
27
|
|
|
26
28
|
var _modalList = /*#__PURE__*/new WeakMap();
|
|
27
29
|
|
|
30
|
+
var _getTopModal = /*#__PURE__*/new WeakSet();
|
|
31
|
+
|
|
28
32
|
let ModalManagerInstance = /*#__PURE__*/function () {
|
|
29
33
|
function ModalManagerInstance() {
|
|
30
34
|
_classCallCheck(this, ModalManagerInstance);
|
|
31
35
|
|
|
36
|
+
_getTopModal.add(this);
|
|
37
|
+
|
|
32
38
|
_modalList.set(this, {
|
|
33
39
|
writable: true,
|
|
34
40
|
value: []
|
|
35
41
|
});
|
|
36
42
|
|
|
37
|
-
_defineProperty(this, "addModal", modal => {
|
|
38
|
-
|
|
43
|
+
_defineProperty(this, "addModal", (modal, setTriggerRefocusFlag) => {
|
|
44
|
+
const {
|
|
45
|
+
modal: topModal,
|
|
46
|
+
setTriggerRefocusFlag: setTrapFlag
|
|
47
|
+
} = _classPrivateMethodGet(this, _getTopModal, _getTopModal2).call(this);
|
|
48
|
+
|
|
49
|
+
if (topModal && setTrapFlag) {
|
|
50
|
+
setTrapFlag(false);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_classPrivateFieldGet(this, _modalList).push({
|
|
54
|
+
modal,
|
|
55
|
+
setTriggerRefocusFlag
|
|
56
|
+
});
|
|
39
57
|
});
|
|
40
58
|
}
|
|
41
59
|
|
|
42
60
|
_createClass(ModalManagerInstance, [{
|
|
43
61
|
key: "isTopmost",
|
|
44
62
|
value: function isTopmost(modal) {
|
|
45
|
-
|
|
63
|
+
const {
|
|
64
|
+
modal: topModal
|
|
65
|
+
} = _classPrivateMethodGet(this, _getTopModal, _getTopModal2).call(this);
|
|
66
|
+
|
|
67
|
+
if (!modal || !topModal) {
|
|
46
68
|
return false;
|
|
47
69
|
}
|
|
48
70
|
|
|
49
|
-
return
|
|
71
|
+
return modal === topModal;
|
|
50
72
|
}
|
|
51
73
|
}, {
|
|
52
74
|
key: "removeModal",
|
|
53
75
|
value: function removeModal(modal) {
|
|
54
|
-
const modalIndex = _classPrivateFieldGet(this, _modalList).
|
|
76
|
+
const modalIndex = _classPrivateFieldGet(this, _modalList).findIndex(({
|
|
77
|
+
modal: m
|
|
78
|
+
}) => m === modal);
|
|
55
79
|
|
|
56
80
|
if (modalIndex === -1) {
|
|
57
81
|
return;
|
|
58
82
|
}
|
|
59
83
|
|
|
60
84
|
_classPrivateFieldGet(this, _modalList).splice(modalIndex, 1);
|
|
85
|
+
|
|
86
|
+
if (!_classPrivateFieldGet(this, _modalList).length) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const {
|
|
91
|
+
setTriggerRefocusFlag
|
|
92
|
+
} = _classPrivateMethodGet(this, _getTopModal, _getTopModal2).call(this);
|
|
93
|
+
|
|
94
|
+
if (setTriggerRefocusFlag) {
|
|
95
|
+
setTriggerRefocusFlag(true);
|
|
96
|
+
}
|
|
61
97
|
}
|
|
62
98
|
}, {
|
|
63
99
|
key: "clearList",
|
|
@@ -69,6 +105,14 @@ let ModalManagerInstance = /*#__PURE__*/function () {
|
|
|
69
105
|
return ModalManagerInstance;
|
|
70
106
|
}();
|
|
71
107
|
|
|
108
|
+
function _getTopModal2() {
|
|
109
|
+
if (!_classPrivateFieldGet(this, _modalList).length) {
|
|
110
|
+
return {};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return _classPrivateFieldGet(this, _modalList)[_classPrivateFieldGet(this, _modalList).length - 1];
|
|
114
|
+
}
|
|
115
|
+
|
|
72
116
|
const ModalManager = new ModalManagerInstance();
|
|
73
117
|
var _default = ModalManager;
|
|
74
118
|
exports.default = _default;
|
|
@@ -46,6 +46,7 @@ const Modal = ({
|
|
|
46
46
|
const modalRegistered = (0, _react.useRef)(false);
|
|
47
47
|
const originalOverflow = (0, _react.useRef)(undefined);
|
|
48
48
|
const [isAnimationComplete, setAnimationComplete] = (0, _react.useState)(false);
|
|
49
|
+
const [triggerRefocusFlag, setTriggerRefocusFlag] = (0, _react.useState)(false);
|
|
49
50
|
const setOverflow = (0, _react.useCallback)(() => {
|
|
50
51
|
if (typeof originalOverflow.current === "undefined" && !enableBackgroundUI) {
|
|
51
52
|
originalOverflow.current = document.documentElement.style.overflow;
|
|
@@ -110,7 +111,7 @@ const Modal = ({
|
|
|
110
111
|
const registerModal = (0, _react.useCallback)(() => {
|
|
111
112
|
/* istanbul ignore else */
|
|
112
113
|
if (!modalRegistered.current) {
|
|
113
|
-
_modalManager.default.addModal(ref.current);
|
|
114
|
+
_modalManager.default.addModal(ref.current, setTriggerRefocusFlag);
|
|
114
115
|
|
|
115
116
|
modalRegistered.current = true;
|
|
116
117
|
}
|
|
@@ -164,7 +165,8 @@ const Modal = ({
|
|
|
164
165
|
timeout: timeout
|
|
165
166
|
}, /*#__PURE__*/_react.default.createElement(ModalContext.Provider, {
|
|
166
167
|
value: {
|
|
167
|
-
isAnimationComplete
|
|
168
|
+
isAnimationComplete,
|
|
169
|
+
triggerRefocusFlag
|
|
168
170
|
}
|
|
169
171
|
}, content)))));
|
|
170
172
|
};
|
|
@@ -9,7 +9,15 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
return _pages.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "Page", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _page.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
|
|
13
19
|
var _pages = _interopRequireDefault(require("./pages.component"));
|
|
14
20
|
|
|
21
|
+
var _page = _interopRequireDefault(require("./page/page.component"));
|
|
22
|
+
|
|
15
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -24,7 +24,7 @@ const CarbonScopedTokensProvider = _styledComponents.default.div`
|
|
|
24
24
|
display: inline;
|
|
25
25
|
${({
|
|
26
26
|
theme
|
|
27
|
-
}) => (0, _generateCssVariables.default)(theme)}
|
|
27
|
+
}) => (0, _generateCssVariables.default)(theme.compatibility)}
|
|
28
28
|
`;
|
|
29
29
|
var _default = CarbonScopedTokensProvider;
|
|
30
30
|
exports.default = _default;
|
|
File without changes
|
|
@@ -26,7 +26,15 @@ var _default = palette => {
|
|
|
26
26
|
},
|
|
27
27
|
stepSequence: {
|
|
28
28
|
completedText: palette.productBlueShade(23)
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
get compatibility() {
|
|
32
|
+
return {
|
|
33
|
+
colorsActionMajor500: this.colors.primary,
|
|
34
|
+
colorsActionMajor600: this.colors.secondary
|
|
35
|
+
};
|
|
29
36
|
}
|
|
37
|
+
|
|
30
38
|
};
|
|
31
39
|
};
|
|
32
40
|
|
|
@@ -337,7 +337,49 @@ var _default = palette => {
|
|
|
337
337
|
fullScreenModal: 5000,
|
|
338
338
|
notification: 6000,
|
|
339
339
|
aboveAll: 9999
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
get compatibility() {
|
|
343
|
+
return {
|
|
344
|
+
colorsActionMajor500: this.colors.primary,
|
|
345
|
+
colorsActionMajor600: this.colors.secondary,
|
|
346
|
+
colorsActionDisabled500: this.disabled.background,
|
|
347
|
+
colorsSemanticFocus500: this.colors.focus,
|
|
348
|
+
colorsSemanticPositive500: this.colors.success,
|
|
349
|
+
colorsSemanticNegative500: this.colors.error,
|
|
350
|
+
colorsSemanticNegative600: this.colors.destructive.hover,
|
|
351
|
+
colorsSemanticCaution500: this.colors.warning,
|
|
352
|
+
colorsSemanticInfo500: this.colors.info,
|
|
353
|
+
spacing000: `${this.space[0]}px`,
|
|
354
|
+
// 0px
|
|
355
|
+
spacing025: "2px",
|
|
356
|
+
spacing050: "4px",
|
|
357
|
+
spacing075: "6px",
|
|
358
|
+
spacing100: `${this.space[1]}px`,
|
|
359
|
+
// 8px
|
|
360
|
+
spacing125: "10px",
|
|
361
|
+
spacing150: "12px",
|
|
362
|
+
spacing200: `${this.space[2]}px`,
|
|
363
|
+
// 16px
|
|
364
|
+
spacing250: "20px",
|
|
365
|
+
spacing300: `${this.space[3]}px`,
|
|
366
|
+
// 24px
|
|
367
|
+
spacing400: `${this.space[4]}px`,
|
|
368
|
+
// 32px
|
|
369
|
+
spacing500: `${this.space[5]}px`,
|
|
370
|
+
// 40px
|
|
371
|
+
spacing600: `${this.space[6]}px`,
|
|
372
|
+
// 48px
|
|
373
|
+
spacing700: `${this.space[7]}px`,
|
|
374
|
+
// 56px
|
|
375
|
+
spacing800: `${this.space[8]}px`,
|
|
376
|
+
// 64px
|
|
377
|
+
spacing900: `${this.space[9]}px`,
|
|
378
|
+
// 72px
|
|
379
|
+
fontSizes100: this.text.size
|
|
380
|
+
};
|
|
340
381
|
}
|
|
382
|
+
|
|
341
383
|
};
|
|
342
384
|
};
|
|
343
385
|
|
|
@@ -17,8 +17,6 @@ var _palette = _interopRequireDefault(require("../../palette"));
|
|
|
17
17
|
|
|
18
18
|
var _addHexSymbols = _interopRequireDefault(require("../../utils/add-hex-symbols"));
|
|
19
19
|
|
|
20
|
-
var _themeCompatibility = _interopRequireDefault(require("../../design-tokens/theme-compatibility.util"));
|
|
21
|
-
|
|
22
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
21
|
|
|
24
22
|
const colors = (0, _palette.default)(_colorConfig.default);
|
|
@@ -36,13 +34,9 @@ exports.default = _default;
|
|
|
36
34
|
|
|
37
35
|
const mergeWithBase = configureTheme => {
|
|
38
36
|
const themeToMergeWithBase = configureTheme(palette);
|
|
39
|
-
|
|
37
|
+
return { ...(0, _mergeDeep.mergeDeep)(baseTheme, themeToMergeWithBase),
|
|
40
38
|
palette
|
|
41
39
|
};
|
|
42
|
-
return { ...mergedThemes,
|
|
43
|
-
...(0, _themeCompatibility.default)(mergedThemes),
|
|
44
|
-
name: mergedThemes.name
|
|
45
|
-
};
|
|
46
40
|
};
|
|
47
41
|
|
|
48
42
|
exports.mergeWithBase = mergeWithBase;
|
|
@@ -20,7 +20,15 @@ var _default = palette => {
|
|
|
20
20
|
},
|
|
21
21
|
stepSequence: {
|
|
22
22
|
completedText: palette.productGreenShade(23)
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
get compatibility() {
|
|
26
|
+
return {
|
|
27
|
+
colorsActionMajor500: this.colors.primary,
|
|
28
|
+
colorsActionMajor600: this.colors.secondary
|
|
29
|
+
};
|
|
23
30
|
}
|
|
31
|
+
|
|
24
32
|
};
|
|
25
33
|
};
|
|
26
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "101.0.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"engineStrict": true,
|
|
6
6
|
"engines": {
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"babel": "cross-env NODE_ENV=production babel ./src --config-file ./babel.config.js --out-dir ./lib --ignore '**/*/__spec__.js','**/*.spec.js','**/__definition__.js' --quiet",
|
|
31
31
|
"clean-lib": "rimraf ./lib",
|
|
32
32
|
"copy-files": "cpy \"**/\" \"!**/(*.js|*.md|*.mdx|*.stories.*|*.snap)\" ../lib/ --cwd=src --parents",
|
|
33
|
-
"commit": "git-cz"
|
|
33
|
+
"commit": "git-cz",
|
|
34
|
+
"generate-metadata": "node ./scripts/generate_metadata/index.mjs"
|
|
34
35
|
},
|
|
35
36
|
"repository": {
|
|
36
37
|
"type": "git",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"@commitlint/cli": "^11.0.0",
|
|
60
61
|
"@commitlint/config-conventional": "^11.0.0",
|
|
61
62
|
"@semantic-release/changelog": "^5.0.1",
|
|
63
|
+
"@semantic-release/exec": "^6.0.2",
|
|
62
64
|
"@semantic-release/git": "^9.0.0",
|
|
63
65
|
"@storybook/addon-a11y": "^6.3.6",
|
|
64
66
|
"@storybook/addon-actions": "^6.3.6",
|
|
@@ -120,6 +122,7 @@
|
|
|
120
122
|
"husky": "^4.3.6",
|
|
121
123
|
"jest": "^26.6.3",
|
|
122
124
|
"jest-canvas-mock": "^2.3.1",
|
|
125
|
+
"jest-fetch-mock": "^3.0.3",
|
|
123
126
|
"jest-styled-components": "^6.3.1",
|
|
124
127
|
"lint-staged": "^10.5.3",
|
|
125
128
|
"mockdate": "^2.0.2",
|
|
@@ -203,6 +206,12 @@
|
|
|
203
206
|
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
|
|
204
207
|
}
|
|
205
208
|
],
|
|
209
|
+
[
|
|
210
|
+
"@semantic-release/exec",
|
|
211
|
+
{
|
|
212
|
+
"successCmd": "echo \"SEMVER_VERSION=${nextRelease.version}\" >> $GITHUB_ENV"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
206
215
|
"@semantic-release/github"
|
|
207
216
|
]
|
|
208
217
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _styledComponents = require("styled-components");
|
|
9
|
-
|
|
10
|
-
var _generateCssVariables = _interopRequireDefault(require("../generate-css-variables.util"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* Converts theme properties to css variables form and set them globally
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
const CarbonGlobalTokensProvider = (0, _styledComponents.createGlobalStyle)`
|
|
20
|
-
:root {
|
|
21
|
-
${props => (0, _generateCssVariables.default)(props.theme)}
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
var _default = CarbonGlobalTokensProvider;
|
|
25
|
-
exports.default = _default;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _carbonGlobalTokensProvider.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
var _carbonGlobalTokensProvider = _interopRequireDefault(require("./carbon-global-tokens-provider.component"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|