carbon-react 106.7.0 → 107.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/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
- package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
- package/esm/components/badge/badge.style.d.ts +1 -1
- package/esm/components/button/button.component.d.ts +1 -3
- package/esm/components/button/button.component.js +1 -12
- package/esm/components/button/button.style.d.ts +1 -1
- package/esm/components/button-toggle-group/button-toggle-group.component.js +1 -1
- package/esm/components/confirm/confirm.component.d.ts +1 -5
- package/esm/components/confirm/confirm.component.js +2 -14
- package/esm/components/confirm/confirm.d.ts +0 -2
- package/esm/components/dialog-full-screen/content.style.js +4 -10
- package/esm/components/heading/heading.component.d.ts +27 -52
- package/esm/components/heading/heading.component.js +86 -170
- package/esm/components/heading/heading.d.ts +5 -3
- package/esm/components/i18n-provider/i18n-provider.component.d.ts +0 -9
- package/esm/components/i18n-provider/i18n-provider.component.js +0 -9
- package/esm/components/menu/index.d.ts +0 -1
- package/esm/components/menu/index.js +0 -1
- package/esm/components/menu/menu-item/menu-item.component.js +0 -6
- package/esm/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +1 -11
- package/esm/components/navigation-bar/navigation-bar.component.d.ts +1 -6
- package/esm/components/navigation-bar/navigation-bar.component.js +1 -15
- package/esm/components/navigation-bar/navigation-bar.style.d.ts +0 -4
- package/esm/components/navigation-bar/navigation-bar.style.js +0 -8
- package/esm/components/radio-button/radio-button-group.component.js +1 -1
- package/esm/components/select/select-list/select-list.component.js +2 -2
- package/esm/components/simple-color-picker/simple-color-picker.component.js +1 -1
- package/esm/components/split-button/split-button-toggle.style.d.ts +1 -1
- package/esm/components/split-button/split-button.component.d.ts +1 -4
- package/esm/components/split-button/split-button.component.js +3 -16
- package/esm/components/split-button/split-button.d.ts +0 -2
- package/esm/components/tile/tile.component.d.ts +1 -2
- package/esm/components/tile/tile.component.js +1 -13
- package/esm/components/tile/tile.d.ts +0 -2
- package/esm/components/tile-select/tile-select-group.component.js +1 -1
- package/esm/components/toast/toast.component.d.ts +1 -4
- package/esm/components/toast/toast.component.js +1 -13
- package/esm/components/toast/toast.d.ts +0 -2
- package/esm/locales/en-gb.js +0 -9
- package/esm/locales/locale.d.ts +0 -9
- package/esm/locales/pl-pl.js +0 -9
- package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
- package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
- package/lib/components/badge/badge.style.d.ts +1 -1
- package/lib/components/button/button.component.d.ts +1 -3
- package/lib/components/button/button.component.js +1 -14
- package/lib/components/button/button.style.d.ts +1 -1
- package/lib/components/button-toggle-group/button-toggle-group.component.js +1 -1
- package/lib/components/confirm/confirm.component.d.ts +1 -5
- package/lib/components/confirm/confirm.component.js +2 -17
- package/lib/components/confirm/confirm.d.ts +0 -2
- package/lib/components/dialog-full-screen/content.style.js +4 -10
- package/lib/components/heading/heading.component.d.ts +27 -52
- package/lib/components/heading/heading.component.js +86 -170
- package/lib/components/heading/heading.d.ts +5 -3
- package/lib/components/i18n-provider/i18n-provider.component.d.ts +0 -9
- package/lib/components/i18n-provider/i18n-provider.component.js +0 -9
- package/lib/components/menu/index.d.ts +0 -1
- package/lib/components/menu/index.js +0 -8
- package/lib/components/menu/menu-item/menu-item.component.js +0 -7
- package/lib/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +1 -14
- package/lib/components/navigation-bar/navigation-bar.component.d.ts +1 -6
- package/lib/components/navigation-bar/navigation-bar.component.js +1 -18
- package/lib/components/navigation-bar/navigation-bar.style.d.ts +0 -4
- package/lib/components/navigation-bar/navigation-bar.style.js +0 -8
- package/lib/components/radio-button/radio-button-group.component.js +1 -1
- package/lib/components/select/select-list/select-list.component.js +2 -2
- package/lib/components/simple-color-picker/simple-color-picker.component.js +1 -1
- package/lib/components/split-button/split-button-toggle.style.d.ts +1 -1
- package/lib/components/split-button/split-button.component.d.ts +1 -4
- package/lib/components/split-button/split-button.component.js +3 -18
- package/lib/components/split-button/split-button.d.ts +0 -2
- package/lib/components/tile/tile.component.d.ts +1 -2
- package/lib/components/tile/tile.component.js +1 -16
- package/lib/components/tile/tile.d.ts +0 -2
- package/lib/components/tile-select/tile-select-group.component.js +1 -1
- package/lib/components/toast/toast.component.d.ts +1 -4
- package/lib/components/toast/toast.component.js +1 -16
- package/lib/components/toast/toast.d.ts +0 -2
- package/lib/locales/en-gb.js +0 -9
- package/lib/locales/locale.d.ts +0 -9
- package/lib/locales/pl-pl.js +0 -9
- package/package.json +1 -1
- package/esm/components/app-wrapper/app-wrapper.component.d.ts +0 -25
- package/esm/components/app-wrapper/app-wrapper.component.js +0 -104
- package/esm/components/app-wrapper/app-wrapper.d.ts +0 -12
- package/esm/components/app-wrapper/app-wrapper.style.d.ts +0 -2
- package/esm/components/app-wrapper/app-wrapper.style.js +0 -17
- package/esm/components/app-wrapper/index.d.ts +0 -1
- package/esm/components/app-wrapper/index.js +0 -1
- package/esm/components/menu/submenu-block/index.d.ts +0 -2
- package/esm/components/menu/submenu-block/index.js +0 -1
- package/esm/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
- package/esm/components/menu/submenu-block/submenu-block.component.js +0 -34
- package/esm/components/menu/submenu-block/submenu-block.d.ts +0 -12
- package/esm/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
- package/esm/components/menu/submenu-block/submenu-block.style.js +0 -16
- package/esm/components/mount-in-app/__spec__.d.ts +0 -1
- package/esm/components/mount-in-app/__spec__.js +0 -47
- package/esm/components/mount-in-app/index.d.ts +0 -1
- package/esm/components/mount-in-app/mount-in-app.d.ts +0 -12
- package/esm/components/mount-in-app/mount-in-app.js +0 -90
- package/esm/components/mount-in-app/package.json +0 -3
- package/esm/components/multi-step-wizard/__spec__.d.ts +0 -1
- package/esm/components/multi-step-wizard/__spec__.js +0 -191
- package/esm/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
- package/esm/components/multi-step-wizard/multi-step-wizard.js +0 -383
- package/esm/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
- package/esm/components/multi-step-wizard/multi-step-wizard.style.js +0 -10
- package/esm/components/multi-step-wizard/package.json +0 -4
- package/esm/components/multi-step-wizard/step/__spec__.d.ts +0 -1
- package/esm/components/multi-step-wizard/step/__spec__.js +0 -399
- package/esm/components/multi-step-wizard/step/package.json +0 -4
- package/esm/components/multi-step-wizard/step/step.d.ts +0 -166
- package/esm/components/multi-step-wizard/step/step.js +0 -407
- package/esm/components/multi-step-wizard/step/step.style.d.ts +0 -13
- package/esm/components/multi-step-wizard/step/step.style.js +0 -138
- package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
- package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -10
- package/esm/components/scrollable-list/index.d.ts +0 -4
- package/esm/components/scrollable-list/index.js +0 -4
- package/esm/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
- package/esm/components/scrollable-list/scrollable-list-item.component.js +0 -26
- package/esm/components/scrollable-list/scrollable-list.component.d.ts +0 -52
- package/esm/components/scrollable-list/scrollable-list.component.js +0 -306
- package/esm/components/scrollable-list/scrollable-list.context.d.ts +0 -3
- package/esm/components/scrollable-list/scrollable-list.context.js +0 -2
- package/esm/components/scrollable-list/scrollable-list.style.d.ts +0 -2
- package/esm/components/scrollable-list/scrollable-list.style.js +0 -30
- package/esm/components/scrollable-list/test-utils.d.ts +0 -2
- package/esm/components/scrollable-list/test-utils.js +0 -25
- package/lib/components/app-wrapper/app-wrapper.component.d.ts +0 -25
- package/lib/components/app-wrapper/app-wrapper.component.js +0 -120
- package/lib/components/app-wrapper/app-wrapper.d.ts +0 -12
- package/lib/components/app-wrapper/app-wrapper.style.d.ts +0 -2
- package/lib/components/app-wrapper/app-wrapper.style.js +0 -28
- package/lib/components/app-wrapper/index.d.ts +0 -1
- package/lib/components/app-wrapper/index.js +0 -15
- package/lib/components/app-wrapper/package.json +0 -6
- package/lib/components/menu/submenu-block/index.d.ts +0 -2
- package/lib/components/menu/submenu-block/index.js +0 -15
- package/lib/components/menu/submenu-block/package.json +0 -6
- package/lib/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
- package/lib/components/menu/submenu-block/submenu-block.component.js +0 -53
- package/lib/components/menu/submenu-block/submenu-block.d.ts +0 -12
- package/lib/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
- package/lib/components/menu/submenu-block/submenu-block.style.js +0 -33
- package/lib/components/mount-in-app/__spec__.d.ts +0 -1
- package/lib/components/mount-in-app/__spec__.js +0 -55
- package/lib/components/mount-in-app/index.d.ts +0 -1
- package/lib/components/mount-in-app/mount-in-app.d.ts +0 -12
- package/lib/components/mount-in-app/mount-in-app.js +0 -105
- package/lib/components/mount-in-app/package.json +0 -3
- package/lib/components/multi-step-wizard/__spec__.d.ts +0 -1
- package/lib/components/multi-step-wizard/__spec__.js +0 -202
- package/lib/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
- package/lib/components/multi-step-wizard/multi-step-wizard.js +0 -397
- package/lib/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
- package/lib/components/multi-step-wizard/multi-step-wizard.style.js +0 -21
- package/lib/components/multi-step-wizard/package.json +0 -4
- package/lib/components/multi-step-wizard/step/__spec__.d.ts +0 -1
- package/lib/components/multi-step-wizard/step/__spec__.js +0 -409
- package/lib/components/multi-step-wizard/step/package.json +0 -4
- package/lib/components/multi-step-wizard/step/step.d.ts +0 -166
- package/lib/components/multi-step-wizard/step/step.js +0 -421
- package/lib/components/multi-step-wizard/step/step.style.d.ts +0 -13
- package/lib/components/multi-step-wizard/step/step.style.js +0 -162
- package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
- package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -21
- package/lib/components/scrollable-list/index.d.ts +0 -4
- package/lib/components/scrollable-list/index.js +0 -31
- package/lib/components/scrollable-list/package.json +0 -6
- package/lib/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
- package/lib/components/scrollable-list/scrollable-list-item.component.js +0 -42
- package/lib/components/scrollable-list/scrollable-list.component.d.ts +0 -52
- package/lib/components/scrollable-list/scrollable-list.component.js +0 -328
- package/lib/components/scrollable-list/scrollable-list.context.d.ts +0 -3
- package/lib/components/scrollable-list/scrollable-list.context.js +0 -14
- package/lib/components/scrollable-list/scrollable-list.style.d.ts +0 -2
- package/lib/components/scrollable-list/scrollable-list.style.js +0 -41
- package/lib/components/scrollable-list/test-utils.d.ts +0 -2
- package/lib/components/scrollable-list/test-utils.js +0 -37
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
|
|
3
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
-
|
|
5
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
-
|
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
8
|
-
|
|
9
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
-
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
-
|
|
13
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
|
|
15
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
16
|
-
|
|
17
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
-
|
|
19
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
-
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
|
|
23
|
-
import React from "react";
|
|
24
|
-
import PropTypes from "prop-types";
|
|
25
|
-
import classNames from "classnames";
|
|
26
|
-
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
27
|
-
import StyledAppWrapper from "./app-wrapper.style";
|
|
28
|
-
import Logger from "../../__internal__/utils/logger";
|
|
29
|
-
let deprecatedWarnTriggered = false;
|
|
30
|
-
/**
|
|
31
|
-
* Manages the width and containment of your application.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
let AppWrapper = /*#__PURE__*/function (_React$Component) {
|
|
35
|
-
_inherits(AppWrapper, _React$Component);
|
|
36
|
-
|
|
37
|
-
var _super = _createSuper(AppWrapper);
|
|
38
|
-
|
|
39
|
-
function AppWrapper(...args) {
|
|
40
|
-
var _this;
|
|
41
|
-
|
|
42
|
-
_classCallCheck(this, AppWrapper);
|
|
43
|
-
|
|
44
|
-
_this = _super.call(this, ...args);
|
|
45
|
-
_this.classes = _this.classes.bind(_assertThisInitialized(_this));
|
|
46
|
-
|
|
47
|
-
if (!deprecatedWarnTriggered) {
|
|
48
|
-
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
49
|
-
|
|
50
|
-
Logger.deprecate("`AppWrapper` component is now deprecated and will soon be removed. Please use the `Box` component instead.");
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return _this;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Returns the classes for the component.
|
|
57
|
-
*
|
|
58
|
-
* @method classes
|
|
59
|
-
* @return {String}
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
_createClass(AppWrapper, [{
|
|
64
|
-
key: "classes",
|
|
65
|
-
value: function classes() {
|
|
66
|
-
return classNames("carbon-app-wrapper", this.props.className);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @method render
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
}, {
|
|
73
|
-
key: "render",
|
|
74
|
-
value: function render() {
|
|
75
|
-
const {
|
|
76
|
-
children
|
|
77
|
-
} = this.props;
|
|
78
|
-
return /*#__PURE__*/React.createElement(StyledAppWrapper, _extends({}, this.props, {
|
|
79
|
-
className: this.classes()
|
|
80
|
-
}, tagComponent("app-wrapper", this.props)), children);
|
|
81
|
-
}
|
|
82
|
-
}]);
|
|
83
|
-
|
|
84
|
-
return AppWrapper;
|
|
85
|
-
}(React.Component);
|
|
86
|
-
|
|
87
|
-
AppWrapper.propTypes = {
|
|
88
|
-
/**
|
|
89
|
-
* Children elements
|
|
90
|
-
*
|
|
91
|
-
* @property children
|
|
92
|
-
* @type {Node}
|
|
93
|
-
*/
|
|
94
|
-
children: PropTypes.node,
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Custom className
|
|
98
|
-
*
|
|
99
|
-
* @property className
|
|
100
|
-
* @type {String}
|
|
101
|
-
*/
|
|
102
|
-
className: PropTypes.string
|
|
103
|
-
};
|
|
104
|
-
export default AppWrapper;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
export interface AppWrapperProps {
|
|
4
|
-
/** Children elements */
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
/** Custom className */
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare class AppWrapper extends React.Component<AppWrapperProps> {}
|
|
11
|
-
|
|
12
|
-
export default AppWrapper;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
const StyledAppWrapper = styled.div`
|
|
3
|
-
box-sizing: border-box;
|
|
4
|
-
max-width: 1600px;
|
|
5
|
-
min-width: 958px;
|
|
6
|
-
margin: 0 auto;
|
|
7
|
-
padding: 0 40px;
|
|
8
|
-
|
|
9
|
-
@media only screen and (max-width: 1366px) {
|
|
10
|
-
padding: 0 30px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@media only screen and (max-width: 1024px) {
|
|
14
|
-
padding: 0 25px;
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
export default StyledAppWrapper;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./app-wrapper";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./app-wrapper.component";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./submenu-block.component";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default SubmenuBlock;
|
|
2
|
-
declare function SubmenuBlock({ children, variant }: {
|
|
3
|
-
children: any;
|
|
4
|
-
variant?: string | undefined;
|
|
5
|
-
}): JSX.Element;
|
|
6
|
-
declare namespace SubmenuBlock {
|
|
7
|
-
namespace propTypes {
|
|
8
|
-
const children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
9
|
-
const variant: PropTypes.Requireable<string>;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
import PropTypes from "prop-types";
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import StyledSubmenuBlock from "./submenu-block.style";
|
|
4
|
-
import MenuContext from "../menu.context";
|
|
5
|
-
import Logger from "../../../__internal__/utils/logger";
|
|
6
|
-
let deprecatedWarnTriggered = false;
|
|
7
|
-
|
|
8
|
-
const SubmenuBlock = ({
|
|
9
|
-
children,
|
|
10
|
-
variant = "default"
|
|
11
|
-
}) => {
|
|
12
|
-
const menuContext = useContext(MenuContext);
|
|
13
|
-
|
|
14
|
-
if (!deprecatedWarnTriggered) {
|
|
15
|
-
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
16
|
-
|
|
17
|
-
Logger.deprecate("`The `SubmenuBlock` component is deprecated and will soon be removed. Please use a `MenuItem` component with the `submenu` prop instead.");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return /*#__PURE__*/React.createElement(StyledSubmenuBlock, {
|
|
21
|
-
"data-component": "submenu-block",
|
|
22
|
-
menuType: menuContext.menuType,
|
|
23
|
-
variant: variant
|
|
24
|
-
}, children);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
SubmenuBlock.propTypes = {
|
|
28
|
-
/** Children elements */
|
|
29
|
-
children: PropTypes.node.isRequired,
|
|
30
|
-
|
|
31
|
-
/** set the colour variant for a menuType */
|
|
32
|
-
variant: PropTypes.oneOf(["default", "alternate"])
|
|
33
|
-
};
|
|
34
|
-
export default SubmenuBlock;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
export interface SubmenuBlockProps {
|
|
4
|
-
/** Children elements */
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
/** set the colour variant for a menuType */
|
|
7
|
-
variant?: "default" | "alternate";
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare function SubmenuBlock(props: SubmenuBlockProps): JSX.Element;
|
|
11
|
-
|
|
12
|
-
export default SubmenuBlock;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import styled, { css } from "styled-components";
|
|
2
|
-
import StyledMenuItemWrapper from "../menu-item/menu-item.style";
|
|
3
|
-
import menuConfigVariants from "../menu.config";
|
|
4
|
-
const StyledSubmenuBlock = styled.div`
|
|
5
|
-
${({
|
|
6
|
-
menuType,
|
|
7
|
-
variant
|
|
8
|
-
}) => css`
|
|
9
|
-
background-color: ${menuConfigVariants[menuType].submenuItemBackground};
|
|
10
|
-
|
|
11
|
-
${StyledMenuItemWrapper} {
|
|
12
|
-
background-color: ${variant === "default" ? "transparent" : menuConfigVariants[menuType].alternate};
|
|
13
|
-
}
|
|
14
|
-
`}
|
|
15
|
-
`;
|
|
16
|
-
export default StyledSubmenuBlock;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { mount } from "enzyme";
|
|
3
|
-
import MountInApp from "./";
|
|
4
|
-
import TestUtils from "react-dom/test-utils";
|
|
5
|
-
describe("MountInApp", () => {
|
|
6
|
-
let instance, placeholder;
|
|
7
|
-
|
|
8
|
-
function renderComponent() {
|
|
9
|
-
placeholder = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement("div", null));
|
|
10
|
-
instance = mount( /*#__PURE__*/React.createElement(MountInApp, {
|
|
11
|
-
targetId: "say_hello_here"
|
|
12
|
-
}, /*#__PURE__*/React.createElement("div", null, "Hello!!")));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
describe("if the target element does not exist", () => {
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
renderComponent();
|
|
18
|
-
});
|
|
19
|
-
it("doesn't mount anything inside of the placeholder", () => {
|
|
20
|
-
expect(placeholder.children.length).toEqual(0);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
describe("if the target element exists", () => {
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
spyOn(document, "getElementById").and.callFake(elementId => {
|
|
26
|
-
return elementId === "say_hello_here" ? placeholder : null;
|
|
27
|
-
});
|
|
28
|
-
renderComponent();
|
|
29
|
-
});
|
|
30
|
-
it("mounts the specified children in the placeholder", () => {
|
|
31
|
-
expect(placeholder.children.length).toEqual(1);
|
|
32
|
-
let wrapperDiv = placeholder.children[0];
|
|
33
|
-
expect(wrapperDiv.tagName).toEqual("DIV");
|
|
34
|
-
expect(wrapperDiv.className).toEqual("carbon-mount-in-app");
|
|
35
|
-
expect(wrapperDiv.children.length).toEqual(1);
|
|
36
|
-
let contentDiv = wrapperDiv.children[0];
|
|
37
|
-
expect(contentDiv.tagName).toEqual("DIV");
|
|
38
|
-
expect(contentDiv.textContent).toEqual("Hello!!");
|
|
39
|
-
});
|
|
40
|
-
describe("componentWillUnmount", () => {
|
|
41
|
-
it("removes all children", () => {
|
|
42
|
-
instance.unmount();
|
|
43
|
-
expect(placeholder.children.length).toEqual(0);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./mount-in-app";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
export interface MountInAppProps {
|
|
4
|
-
/** Children elements */
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
/** ID of the element in which the children components will be rendered. */
|
|
7
|
-
targetId?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare class MountInApp extends React.Component<MountInAppProps> {}
|
|
11
|
-
|
|
12
|
-
export default MountInApp;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
-
|
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4
|
-
|
|
5
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
6
|
-
|
|
7
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
-
|
|
9
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
-
|
|
11
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
14
|
-
|
|
15
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
16
|
-
|
|
17
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
|
-
|
|
19
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
-
|
|
21
|
-
import React from "react";
|
|
22
|
-
import PropTypes from "prop-types";
|
|
23
|
-
import ReactDOM from "react-dom";
|
|
24
|
-
import Logger from "../../__internal__/utils/logger";
|
|
25
|
-
let deprecatedWarnTriggered = false;
|
|
26
|
-
|
|
27
|
-
let MountInApp = /*#__PURE__*/function (_React$Component) {
|
|
28
|
-
_inherits(MountInApp, _React$Component);
|
|
29
|
-
|
|
30
|
-
var _super = _createSuper(MountInApp);
|
|
31
|
-
|
|
32
|
-
function MountInApp() {
|
|
33
|
-
_classCallCheck(this, MountInApp);
|
|
34
|
-
|
|
35
|
-
return _super.apply(this, arguments);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
_createClass(MountInApp, [{
|
|
39
|
-
key: "componentDidMount",
|
|
40
|
-
value: function componentDidMount() {
|
|
41
|
-
if (this.targetElement) {
|
|
42
|
-
ReactDOM.render(this.contentHtml, this.targetElement);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!deprecatedWarnTriggered) {
|
|
46
|
-
deprecatedWarnTriggered = true;
|
|
47
|
-
Logger.deprecate( // eslint-disable-next-line max-len
|
|
48
|
-
"The `MountInApp` component is deprecated and will soon be removed. We recommend using React Portals instead (https://reactjs.org/docs/portals.html)");
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "componentWillUnmount",
|
|
53
|
-
value: function componentWillUnmount() {
|
|
54
|
-
this.targetElement.removeChild(this.targetElement.firstChild);
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
key: "contentHtml",
|
|
58
|
-
get: function () {
|
|
59
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
"data-component": "mount-in-app",
|
|
61
|
-
className: "carbon-mount-in-app"
|
|
62
|
-
}, this.props.children);
|
|
63
|
-
}
|
|
64
|
-
}, {
|
|
65
|
-
key: "targetElement",
|
|
66
|
-
get: function () {
|
|
67
|
-
return document.getElementById(this.props.targetId);
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
key: "render",
|
|
71
|
-
value: function render() {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}]);
|
|
75
|
-
|
|
76
|
-
return MountInApp;
|
|
77
|
-
}(React.Component);
|
|
78
|
-
|
|
79
|
-
MountInApp.propTypes = {
|
|
80
|
-
/**
|
|
81
|
-
* Children elements
|
|
82
|
-
*/
|
|
83
|
-
children: PropTypes.node,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* ID of the element in which the children components will be rendered.
|
|
87
|
-
*/
|
|
88
|
-
targetId: PropTypes.string
|
|
89
|
-
};
|
|
90
|
-
export default MountInApp;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import TestUtils from "react-dom/test-utils";
|
|
3
|
-
import { shallow } from "enzyme";
|
|
4
|
-
import MultiStepWizard from "./multi-step-wizard";
|
|
5
|
-
import MultiActionButton from "./../multi-action-button";
|
|
6
|
-
import Button from "./../button";
|
|
7
|
-
import { elementsTagTest, rootTagTest } from "../../__internal__/utils/helpers/tags/tags-specs";
|
|
8
|
-
describe("MultiStepWizard", () => {
|
|
9
|
-
let instance,
|
|
10
|
-
spySubmitHandler = jasmine.createSpy("submitHandler");
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
instance = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(MultiStepWizard, {
|
|
13
|
-
steps: [/*#__PURE__*/React.createElement("div", null, "Step 1"), /*#__PURE__*/React.createElement("div", null, "Step 2")],
|
|
14
|
-
onSubmit: spySubmitHandler
|
|
15
|
-
}));
|
|
16
|
-
});
|
|
17
|
-
describe("lifecycle", () => {
|
|
18
|
-
describe("componentWillMount", () => {
|
|
19
|
-
it("sets the states", () => {
|
|
20
|
-
spyOn(instance, "validateStepProps").and.returnValue({
|
|
21
|
-
currentStep: 1,
|
|
22
|
-
completed: false
|
|
23
|
-
});
|
|
24
|
-
expect(instance.state.currentStep).toEqual(1);
|
|
25
|
-
expect(instance.state.completed).toEqual(false);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
describe("componentWillReceiveProps", () => {
|
|
29
|
-
it("sets the states", () => {
|
|
30
|
-
spyOn(instance, "validateStepProps").and.returnValue({
|
|
31
|
-
currentStep: 3,
|
|
32
|
-
completed: true
|
|
33
|
-
});
|
|
34
|
-
instance.UNSAFE_componentWillReceiveProps({});
|
|
35
|
-
expect(instance.state.currentStep).toEqual(3);
|
|
36
|
-
expect(instance.state.completed).toEqual(true);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
describe("initialize", () => {
|
|
41
|
-
it("sets current step", () => {
|
|
42
|
-
expect(instance.state.currentStep).toBeTruthy();
|
|
43
|
-
});
|
|
44
|
-
it("sets completed to false", () => {
|
|
45
|
-
expect(instance.state.completed).toBeFalsy();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
describe("totalSteps", () => {
|
|
49
|
-
it("returns the total number of steps", () => {
|
|
50
|
-
expect(instance.totalSteps).toEqual(2);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
describe("validateStepProps", () => {
|
|
54
|
-
describe("when the completed prop equals to true", () => {
|
|
55
|
-
it("returns the valid props", () => {
|
|
56
|
-
let props = instance.validateStepProps({
|
|
57
|
-
completed: true,
|
|
58
|
-
steps: [1, 2, 3]
|
|
59
|
-
});
|
|
60
|
-
expect(props.currentStep).toEqual(3);
|
|
61
|
-
expect(props.completed).toEqual(true);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
describe("when the currentStep prop is not number", () => {
|
|
65
|
-
it("returns the valid props", () => {
|
|
66
|
-
let props = instance.validateStepProps({
|
|
67
|
-
currentStep: "test",
|
|
68
|
-
steps: [1, 2, 3]
|
|
69
|
-
});
|
|
70
|
-
expect(props.currentStep).toEqual(1);
|
|
71
|
-
expect(props.completed).toEqual(false);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
describe("when the currentStep prop is less than 1", () => {
|
|
75
|
-
it("returns the valid props", () => {
|
|
76
|
-
let props = instance.validateStepProps({
|
|
77
|
-
currentStep: 0,
|
|
78
|
-
steps: [1, 2, 3]
|
|
79
|
-
});
|
|
80
|
-
expect(props.currentStep).toEqual(1);
|
|
81
|
-
expect(props.completed).toEqual(false);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
describe("when the currentStep prop is larger than the total of steps", () => {
|
|
85
|
-
it("returns the valid props", () => {
|
|
86
|
-
let props = instance.validateStepProps({
|
|
87
|
-
currentStep: 4,
|
|
88
|
-
steps: [1, 2, 3]
|
|
89
|
-
});
|
|
90
|
-
expect(props.currentStep).toEqual(1);
|
|
91
|
-
expect(props.completed).toEqual(false);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
describe("when the currentStep prop is valid", () => {
|
|
95
|
-
it("returns the valid props", () => {
|
|
96
|
-
let props = instance.validateStepProps({
|
|
97
|
-
currentStep: 2,
|
|
98
|
-
steps: [1, 2, 3]
|
|
99
|
-
});
|
|
100
|
-
expect(props.currentStep).toEqual(2);
|
|
101
|
-
expect(props.completed).toEqual(false);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
describe("next", () => {
|
|
106
|
-
beforeEach(() => {
|
|
107
|
-
spyOn(instance, "setState").and.callThrough();
|
|
108
|
-
});
|
|
109
|
-
describe("when current step is less than the total of steps", () => {
|
|
110
|
-
it("moves the step forward", () => {
|
|
111
|
-
instance.next();
|
|
112
|
-
expect(instance.state.currentStep).toEqual(2);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
describe("when current step is not less than the total of steps", () => {
|
|
116
|
-
it("does nothing", () => {
|
|
117
|
-
instance.state.currentStep = 3;
|
|
118
|
-
instance.next();
|
|
119
|
-
expect(instance.setState).not.toHaveBeenCalled();
|
|
120
|
-
expect(instance.state.currentStep).toEqual(3);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
describe("back", () => {
|
|
125
|
-
beforeEach(() => {
|
|
126
|
-
spyOn(instance, "setState").and.callThrough();
|
|
127
|
-
});
|
|
128
|
-
describe("when current step is larger than 1", () => {
|
|
129
|
-
it("moves the step backward", () => {
|
|
130
|
-
instance.state.currentStep = 2;
|
|
131
|
-
instance.back();
|
|
132
|
-
expect(instance.state.completed).toEqual(false);
|
|
133
|
-
expect(instance.state.currentStep).toEqual(1);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
describe("when current step is not larger than 1", () => {
|
|
137
|
-
it("does nothing", () => {
|
|
138
|
-
instance.back();
|
|
139
|
-
expect(instance.setState).not.toHaveBeenCalled();
|
|
140
|
-
expect(instance.state.currentStep).toEqual(1);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
describe("complete", () => {
|
|
145
|
-
beforeEach(() => {
|
|
146
|
-
spyOn(instance, "setState").and.callThrough();
|
|
147
|
-
});
|
|
148
|
-
describe("when current step is the last step", () => {
|
|
149
|
-
it("completes the wizard", () => {
|
|
150
|
-
instance.state.currentStep = 2;
|
|
151
|
-
instance.complete();
|
|
152
|
-
expect(instance.setState).toHaveBeenCalledWith({
|
|
153
|
-
completed: true
|
|
154
|
-
});
|
|
155
|
-
expect(instance.state.completed).toBeTruthy();
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
describe("when current step is not the last step", () => {
|
|
159
|
-
it("does nothing", () => {
|
|
160
|
-
instance.complete();
|
|
161
|
-
expect(instance.setState).not.toHaveBeenCalled();
|
|
162
|
-
expect(instance.state.completed).toBeFalsy();
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
describe("wizardStepsHTML", () => {
|
|
167
|
-
describe("when passing the steps prop", () => {
|
|
168
|
-
it("returns step components", () => {
|
|
169
|
-
let steps = instance.wizardStepsHTML,
|
|
170
|
-
step1 = steps[0],
|
|
171
|
-
step2 = steps[1];
|
|
172
|
-
expect(steps.length).toEqual(2);
|
|
173
|
-
expect(step1.props.children.props.children).toEqual("Step 1");
|
|
174
|
-
expect(step1.props.stepNumber).toEqual(1);
|
|
175
|
-
expect(step1.props.defaultButton).toEqual(true);
|
|
176
|
-
expect(step2.props.children.props.children).toEqual("Step 2");
|
|
177
|
-
expect(step2.props.stepNumber).toEqual(2);
|
|
178
|
-
expect(step2.props.defaultButton).toEqual(true);
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
describe("when not passing the steps prop", () => {
|
|
182
|
-
it("does not returns step components", () => {
|
|
183
|
-
instance = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(MultiStepWizard, {
|
|
184
|
-
steps: [],
|
|
185
|
-
onSubmit: spySubmitHandler
|
|
186
|
-
}));
|
|
187
|
-
expect(instance.wizardStepsHTML).toEqual([]);
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
});
|