carbon-react 106.7.0 → 107.1.1
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/__internal__/click-away-wrapper/click-away-wrapper.component.d.ts +12 -0
- package/esm/__internal__/click-away-wrapper/click-away-wrapper.component.js +43 -0
- package/esm/__internal__/click-away-wrapper/index.d.ts +2 -0
- package/esm/__internal__/click-away-wrapper/index.js +1 -0
- 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/date/date.component.js +19 -20
- package/esm/components/date/date.d.ts +10 -1
- package/esm/components/date/index.d.ts +1 -0
- package/esm/components/date-range/date-range.d.ts +3 -3
- package/esm/components/date-range/index.d.ts +1 -0
- 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/__internal__/submenu/submenu.component.js +11 -17
- 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/popover-container/popover-container.component.js +16 -3
- 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/__internal__/click-away-wrapper/click-away-wrapper.component.d.ts +12 -0
- package/lib/__internal__/click-away-wrapper/click-away-wrapper.component.js +59 -0
- package/lib/__internal__/click-away-wrapper/index.d.ts +2 -0
- package/lib/{components/menu/submenu-block → __internal__/click-away-wrapper}/index.js +2 -2
- package/lib/{components/scrollable-list → __internal__/click-away-wrapper}/package.json +1 -1
- 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/date/date.component.js +20 -20
- package/lib/components/date/date.d.ts +10 -1
- package/lib/components/date/index.d.ts +1 -0
- package/lib/components/date-range/date-range.d.ts +3 -3
- package/lib/components/date-range/index.d.ts +1 -0
- 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/__internal__/submenu/submenu.component.js +12 -17
- 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/popover-container/popover-container.component.js +17 -3
- 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/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/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,306 +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
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
-
|
|
25
|
-
import React, { Component } from "react";
|
|
26
|
-
import PropTypes from "prop-types";
|
|
27
|
-
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
28
|
-
import Events from "../../__internal__/utils/helpers/events";
|
|
29
|
-
import asScrollableListItem from "./as-scrollable-list-item.wrapper";
|
|
30
|
-
import ScrollableListContext from "./scrollable-list.context";
|
|
31
|
-
import ScrollableListContainer from "./scrollable-list.style";
|
|
32
|
-
import Logger from "../../__internal__/utils/logger";
|
|
33
|
-
let deprecatedWarnTriggered = false;
|
|
34
|
-
|
|
35
|
-
let ScrollableList = /*#__PURE__*/function (_Component) {
|
|
36
|
-
_inherits(ScrollableList, _Component);
|
|
37
|
-
|
|
38
|
-
var _super = _createSuper(ScrollableList);
|
|
39
|
-
|
|
40
|
-
function ScrollableList(props) {
|
|
41
|
-
var _this;
|
|
42
|
-
|
|
43
|
-
_classCallCheck(this, ScrollableList);
|
|
44
|
-
|
|
45
|
-
_this = _super.call(this, props);
|
|
46
|
-
|
|
47
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
48
|
-
selectedItem: -1 // defaults to nothing being highlighted
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
_defineProperty(_assertThisInitialized(_this), "blockOptionsHover", false);
|
|
53
|
-
|
|
54
|
-
_defineProperty(_assertThisInitialized(_this), "scrollBox", /*#__PURE__*/React.createRef());
|
|
55
|
-
|
|
56
|
-
_defineProperty(_assertThisInitialized(_this), "selectItem", itemIndex => {
|
|
57
|
-
const selectedItem = _this.props.children[itemIndex];
|
|
58
|
-
if (!_this.props.onSelect || !selectedItem) return;
|
|
59
|
-
|
|
60
|
-
_this.props.onSelect(selectedItem.props.id);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
_defineProperty(_assertThisInitialized(_this), "handleMouseMove", () => {
|
|
64
|
-
_this.blockOptionsHover = false;
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "handleMouseOver", selectedItem => {
|
|
68
|
-
if (!_this.blockOptionsHover) {
|
|
69
|
-
_this.setState({
|
|
70
|
-
selectedItem
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
_defineProperty(_assertThisInitialized(_this), "handleScroll", ({
|
|
76
|
-
target: {
|
|
77
|
-
scrollTop,
|
|
78
|
-
scrollHeight
|
|
79
|
-
}
|
|
80
|
-
}) => {
|
|
81
|
-
if (!_this.props.onLazyLoad) return;
|
|
82
|
-
if (scrollHeight - scrollTop < 300) _this.props.onLazyLoad();
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", e => {
|
|
86
|
-
_this.blockOptionsHover = true;
|
|
87
|
-
const {
|
|
88
|
-
selectedItem
|
|
89
|
-
} = _this.state;
|
|
90
|
-
let newPos = selectedItem;
|
|
91
|
-
|
|
92
|
-
if (Events.isUpKey(e)) {
|
|
93
|
-
e.preventDefault();
|
|
94
|
-
newPos = _this.nextSelectable("up", newPos);
|
|
95
|
-
} else if (Events.isDownKey(e)) {
|
|
96
|
-
e.preventDefault();
|
|
97
|
-
newPos = _this.nextSelectable("down", newPos);
|
|
98
|
-
} else if (Events.isEndKey(e)) {
|
|
99
|
-
e.preventDefault();
|
|
100
|
-
newPos = _this.selectLastItem();
|
|
101
|
-
} else if (Events.isHomeKey(e)) {
|
|
102
|
-
e.preventDefault();
|
|
103
|
-
newPos = _this.selectFirstItem();
|
|
104
|
-
} else if (Events.isEnterKey(e)) {
|
|
105
|
-
e.preventDefault();
|
|
106
|
-
|
|
107
|
-
_this.selectItem(selectedItem);
|
|
108
|
-
|
|
109
|
-
return;
|
|
110
|
-
} else if (Events.isTabKey(e)) {
|
|
111
|
-
const index = _this.state.selectedItem;
|
|
112
|
-
if (index > -1) _this.selectItem(index);
|
|
113
|
-
return;
|
|
114
|
-
} else {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
_this.updateScroll(newPos);
|
|
119
|
-
|
|
120
|
-
_this.setState({
|
|
121
|
-
selectedItem: newPos
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
if (!deprecatedWarnTriggered) {
|
|
126
|
-
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
127
|
-
|
|
128
|
-
Logger.deprecate("`Scrollable List` component is deprecated and will soon be removed.");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return _this;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
_createClass(ScrollableList, [{
|
|
135
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
136
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
137
|
-
// if selected item is beyond the number of children then reset it (eg. through filtering)
|
|
138
|
-
if (this.state.selectedItem + 1 > React.Children.count(nextProps.children)) {
|
|
139
|
-
let selectedItem = -1;
|
|
140
|
-
if (nextProps.alwaysHighlight) selectedItem = this.nextSelectable("down", selectedItem);
|
|
141
|
-
this.setState({
|
|
142
|
-
selectedItem
|
|
143
|
-
});
|
|
144
|
-
this.scrollBox.current.scrollTop = 0;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}, {
|
|
148
|
-
key: "componentDidUpdate",
|
|
149
|
-
value: function componentDidUpdate(prevProps) {
|
|
150
|
-
if (prevProps.keyNavigation && !this.props.keyNavigation) {
|
|
151
|
-
document.removeEventListener("keydown", this.handleKeyDown);
|
|
152
|
-
} else if (!prevProps.keyNavigation && this.props.keyNavigation) {
|
|
153
|
-
document.addEventListener("keydown", this.handleKeyDown);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}, {
|
|
157
|
-
key: "componentDidMount",
|
|
158
|
-
value: function componentDidMount() {
|
|
159
|
-
if (this.props.keyNavigation) {
|
|
160
|
-
document.addEventListener("keydown", this.handleKeyDown);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (this.props.alwaysHighlight) {
|
|
164
|
-
const selectedItem = this.nextSelectable("down", -1);
|
|
165
|
-
this.setState({
|
|
166
|
-
selectedItem
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}, {
|
|
171
|
-
key: "componentWillUnmount",
|
|
172
|
-
value: function componentWillUnmount() {
|
|
173
|
-
document.removeEventListener("keydown", this.handleKeyDown);
|
|
174
|
-
}
|
|
175
|
-
}, {
|
|
176
|
-
key: "updateScroll",
|
|
177
|
-
value: function updateScroll(item) {
|
|
178
|
-
const {
|
|
179
|
-
current: list
|
|
180
|
-
} = this.scrollBox;
|
|
181
|
-
if (!list) return;
|
|
182
|
-
const {
|
|
183
|
-
offsetHeight: listHeight,
|
|
184
|
-
children
|
|
185
|
-
} = list;
|
|
186
|
-
if (!children[item]) return;
|
|
187
|
-
const {
|
|
188
|
-
offsetTop: itemTop,
|
|
189
|
-
offsetHeight: itemHeight
|
|
190
|
-
} = children[item];
|
|
191
|
-
|
|
192
|
-
if (itemTop + itemHeight > listHeight) {
|
|
193
|
-
// set the bottom of the scroll box to the bottom of the selected item
|
|
194
|
-
list.scrollTop = this.setScrollTop({
|
|
195
|
-
item,
|
|
196
|
-
children,
|
|
197
|
-
listHeight,
|
|
198
|
-
itemHeight
|
|
199
|
-
});
|
|
200
|
-
} else {
|
|
201
|
-
list.scrollTop = 0;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}, {
|
|
205
|
-
key: "setScrollTop",
|
|
206
|
-
value: function setScrollTop({
|
|
207
|
-
item,
|
|
208
|
-
children,
|
|
209
|
-
listHeight,
|
|
210
|
-
itemHeight
|
|
211
|
-
}) {
|
|
212
|
-
// total height of list up to selected item
|
|
213
|
-
const scrollPos = [...children].slice(0, item).reduce(this.buildHeightReducer, 0);
|
|
214
|
-
return scrollPos - listHeight + itemHeight;
|
|
215
|
-
}
|
|
216
|
-
}, {
|
|
217
|
-
key: "buildHeightReducer",
|
|
218
|
-
value: function buildHeightReducer(acc, {
|
|
219
|
-
offsetHeight
|
|
220
|
-
}) {
|
|
221
|
-
return acc + offsetHeight;
|
|
222
|
-
}
|
|
223
|
-
}, {
|
|
224
|
-
key: "nextSelectable",
|
|
225
|
-
value: function nextSelectable(direction, position) {
|
|
226
|
-
const {
|
|
227
|
-
isLoopable,
|
|
228
|
-
children
|
|
229
|
-
} = this.props;
|
|
230
|
-
if (!children) return null;
|
|
231
|
-
const limit = children.length;
|
|
232
|
-
if (!limit) return null;
|
|
233
|
-
const change = direction === "down" ? 1 : -1;
|
|
234
|
-
const nextPosition = position + change;
|
|
235
|
-
|
|
236
|
-
if (nextPosition <= -1) {
|
|
237
|
-
return isLoopable ? this.nextSelectable(direction, limit) : this.nextSelectable("down", -1);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (nextPosition === limit) {
|
|
241
|
-
return isLoopable ? this.nextSelectable(direction, -1) : this.nextSelectable("up", limit);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
const testNode = children[nextPosition];
|
|
245
|
-
return this.isSelectable(testNode) ? nextPosition : this.nextSelectable(direction, nextPosition);
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "isSelectable",
|
|
249
|
-
value: function isSelectable(node) {
|
|
250
|
-
return node.props.isSelectable;
|
|
251
|
-
}
|
|
252
|
-
}, {
|
|
253
|
-
key: "selectLastItem",
|
|
254
|
-
value: function selectLastItem() {
|
|
255
|
-
const limit = this.props.children.length;
|
|
256
|
-
return this.nextSelectable("up", limit);
|
|
257
|
-
}
|
|
258
|
-
}, {
|
|
259
|
-
key: "selectFirstItem",
|
|
260
|
-
value: function selectFirstItem() {
|
|
261
|
-
return this.nextSelectable("down", -1);
|
|
262
|
-
}
|
|
263
|
-
}, {
|
|
264
|
-
key: "renderChildren",
|
|
265
|
-
value: function renderChildren(children) {
|
|
266
|
-
return React.Children.map(children, (child, index) => {
|
|
267
|
-
if (!child.props.isSelectable) return child;
|
|
268
|
-
const isSelected = index === this.state.selectedItem;
|
|
269
|
-
return asScrollableListItem(child, index, isSelected);
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
}, {
|
|
273
|
-
key: "render",
|
|
274
|
-
value: function render() {
|
|
275
|
-
const {
|
|
276
|
-
children,
|
|
277
|
-
onLazyLoad,
|
|
278
|
-
...props
|
|
279
|
-
} = this.props;
|
|
280
|
-
return /*#__PURE__*/React.createElement(ScrollableListContainer, _extends({
|
|
281
|
-
ref: this.scrollBox,
|
|
282
|
-
onScroll: this.handleScroll,
|
|
283
|
-
onMouseMove: this.handleMouseMove
|
|
284
|
-
}, props, tagComponent("scrollable-list", props)), /*#__PURE__*/React.createElement(ScrollableListContext.Provider, {
|
|
285
|
-
value: {
|
|
286
|
-
onMouseOver: this.handleMouseOver,
|
|
287
|
-
onClick: this.selectItem
|
|
288
|
-
}
|
|
289
|
-
}, this.renderChildren(children)));
|
|
290
|
-
}
|
|
291
|
-
}]);
|
|
292
|
-
|
|
293
|
-
return ScrollableList;
|
|
294
|
-
}(Component);
|
|
295
|
-
|
|
296
|
-
ScrollableList.propTypes = {
|
|
297
|
-
alwaysHighlight: PropTypes.bool,
|
|
298
|
-
// ensures an item is always highlighted
|
|
299
|
-
isLoopable: PropTypes.bool,
|
|
300
|
-
children: PropTypes.node,
|
|
301
|
-
keyNavigation: PropTypes.bool,
|
|
302
|
-
maxHeight: PropTypes.string,
|
|
303
|
-
onLazyLoad: PropTypes.func,
|
|
304
|
-
onSelect: PropTypes.func
|
|
305
|
-
};
|
|
306
|
-
export default ScrollableList;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
const ScrollableListContainer = styled.ul`
|
|
3
|
-
background-color: white;
|
|
4
|
-
border: 1px solid rgb(20, 20, 20, 0.5);
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
box-shadow: 0 5px 5px 0 rgba(0, 20, 29, 0.2),
|
|
7
|
-
0 10px 10px 0 rgba(0, 20, 29, 0.1);
|
|
8
|
-
list-style-type: none;
|
|
9
|
-
max-height: ${props => `${props.maxHeight}`};
|
|
10
|
-
margin: 0;
|
|
11
|
-
overflow-x: hidden;
|
|
12
|
-
overflow-y: scroll;
|
|
13
|
-
padding: 0;
|
|
14
|
-
width: 100%;
|
|
15
|
-
|
|
16
|
-
&::-webkit-scrollbar {
|
|
17
|
-
-webkit-appearance: none;
|
|
18
|
-
background-color: #eee;
|
|
19
|
-
width: 8px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&::-webkit-scrollbar-thumb {
|
|
23
|
-
background-color: #777777;
|
|
24
|
-
border-radius: 4px;
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
27
|
-
ScrollableListContainer.defaultProps = {
|
|
28
|
-
maxHeight: "180px"
|
|
29
|
-
};
|
|
30
|
-
export default ScrollableListContainer;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { makeArrayKeys } from "../../__spec_helper__/test-utils";
|
|
3
|
-
import ScrollableListItem from "./scrollable-list-item.component";
|
|
4
|
-
|
|
5
|
-
const listItemReducer = ({
|
|
6
|
-
nonSelectables = [],
|
|
7
|
-
customSelectables = []
|
|
8
|
-
}) => {
|
|
9
|
-
// generate jsx for selectable list items, based on indexes in config
|
|
10
|
-
return (acc, item, index) => {
|
|
11
|
-
if (nonSelectables.includes(item)) return [...acc, /*#__PURE__*/React.createElement("div", null)];
|
|
12
|
-
if (customSelectables.includes(item)) return [...acc, /*#__PURE__*/React.createElement("div", {
|
|
13
|
-
isSelectable: true
|
|
14
|
-
})];
|
|
15
|
-
return [...acc, /*#__PURE__*/React.createElement(ScrollableListItem, {
|
|
16
|
-
id: index
|
|
17
|
-
})];
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const renderListItems = opts => {
|
|
22
|
-
return makeArrayKeys(opts.num).reduce(listItemReducer(opts), []);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default renderListItems;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export default AppWrapper;
|
|
2
|
-
/**
|
|
3
|
-
* Manages the width and containment of your application.
|
|
4
|
-
*/
|
|
5
|
-
declare class AppWrapper extends React.Component<any, any, any> {
|
|
6
|
-
constructor(...args: any[]);
|
|
7
|
-
/**
|
|
8
|
-
* Returns the classes for the component.
|
|
9
|
-
*
|
|
10
|
-
* @method classes
|
|
11
|
-
* @return {String}
|
|
12
|
-
*/
|
|
13
|
-
classes(): string;
|
|
14
|
-
/**
|
|
15
|
-
* @method render
|
|
16
|
-
*/
|
|
17
|
-
render(): JSX.Element;
|
|
18
|
-
}
|
|
19
|
-
declare namespace AppWrapper {
|
|
20
|
-
namespace propTypes {
|
|
21
|
-
const children: Node;
|
|
22
|
-
const className: string;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
import React from "react";
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
15
|
-
|
|
16
|
-
var _appWrapper = _interopRequireDefault(require("./app-wrapper.style"));
|
|
17
|
-
|
|
18
|
-
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
|
-
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); } }
|
|
27
|
-
|
|
28
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
|
-
|
|
30
|
-
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); }
|
|
31
|
-
|
|
32
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
-
|
|
34
|
-
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); }; }
|
|
35
|
-
|
|
36
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
37
|
-
|
|
38
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
-
|
|
40
|
-
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; } }
|
|
41
|
-
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
44
|
-
let deprecatedWarnTriggered = false;
|
|
45
|
-
/**
|
|
46
|
-
* Manages the width and containment of your application.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
let AppWrapper = /*#__PURE__*/function (_React$Component) {
|
|
50
|
-
_inherits(AppWrapper, _React$Component);
|
|
51
|
-
|
|
52
|
-
var _super = _createSuper(AppWrapper);
|
|
53
|
-
|
|
54
|
-
function AppWrapper(...args) {
|
|
55
|
-
var _this;
|
|
56
|
-
|
|
57
|
-
_classCallCheck(this, AppWrapper);
|
|
58
|
-
|
|
59
|
-
_this = _super.call(this, ...args);
|
|
60
|
-
_this.classes = _this.classes.bind(_assertThisInitialized(_this));
|
|
61
|
-
|
|
62
|
-
if (!deprecatedWarnTriggered) {
|
|
63
|
-
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
64
|
-
|
|
65
|
-
_logger.default.deprecate("`AppWrapper` component is now deprecated and will soon be removed. Please use the `Box` component instead.");
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return _this;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Returns the classes for the component.
|
|
72
|
-
*
|
|
73
|
-
* @method classes
|
|
74
|
-
* @return {String}
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
_createClass(AppWrapper, [{
|
|
79
|
-
key: "classes",
|
|
80
|
-
value: function classes() {
|
|
81
|
-
return (0, _classnames.default)("carbon-app-wrapper", this.props.className);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @method render
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
}, {
|
|
88
|
-
key: "render",
|
|
89
|
-
value: function render() {
|
|
90
|
-
const {
|
|
91
|
-
children
|
|
92
|
-
} = this.props;
|
|
93
|
-
return /*#__PURE__*/_react.default.createElement(_appWrapper.default, _extends({}, this.props, {
|
|
94
|
-
className: this.classes()
|
|
95
|
-
}, (0, _tags.default)("app-wrapper", this.props)), children);
|
|
96
|
-
}
|
|
97
|
-
}]);
|
|
98
|
-
|
|
99
|
-
return AppWrapper;
|
|
100
|
-
}(_react.default.Component);
|
|
101
|
-
|
|
102
|
-
AppWrapper.propTypes = {
|
|
103
|
-
/**
|
|
104
|
-
* Children elements
|
|
105
|
-
*
|
|
106
|
-
* @property children
|
|
107
|
-
* @type {Node}
|
|
108
|
-
*/
|
|
109
|
-
children: _propTypes.default.node,
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Custom className
|
|
113
|
-
*
|
|
114
|
-
* @property className
|
|
115
|
-
* @type {String}
|
|
116
|
-
*/
|
|
117
|
-
className: _propTypes.default.string
|
|
118
|
-
};
|
|
119
|
-
var _default = AppWrapper;
|
|
120
|
-
exports.default = _default;
|
|
@@ -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,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
const StyledAppWrapper = _styledComponents.default.div`
|
|
13
|
-
box-sizing: border-box;
|
|
14
|
-
max-width: 1600px;
|
|
15
|
-
min-width: 958px;
|
|
16
|
-
margin: 0 auto;
|
|
17
|
-
padding: 0 40px;
|
|
18
|
-
|
|
19
|
-
@media only screen and (max-width: 1366px) {
|
|
20
|
-
padding: 0 30px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@media only screen and (max-width: 1024px) {
|
|
24
|
-
padding: 0 25px;
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
27
|
-
var _default = StyledAppWrapper;
|
|
28
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./app-wrapper";
|
|
@@ -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 _appWrapper.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
var _appWrapper = _interopRequireDefault(require("./app-wrapper.component"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -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,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _submenuBlock = _interopRequireDefault(require("./submenu-block.style"));
|
|
13
|
-
|
|
14
|
-
var _menu = _interopRequireDefault(require("../menu.context"));
|
|
15
|
-
|
|
16
|
-
var _logger = _interopRequireDefault(require("../../../__internal__/utils/logger"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
21
|
-
|
|
22
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
|
-
let deprecatedWarnTriggered = false;
|
|
25
|
-
|
|
26
|
-
const SubmenuBlock = ({
|
|
27
|
-
children,
|
|
28
|
-
variant = "default"
|
|
29
|
-
}) => {
|
|
30
|
-
const menuContext = (0, _react.useContext)(_menu.default);
|
|
31
|
-
|
|
32
|
-
if (!deprecatedWarnTriggered) {
|
|
33
|
-
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
34
|
-
|
|
35
|
-
_logger.default.deprecate("`The `SubmenuBlock` component is deprecated and will soon be removed. Please use a `MenuItem` component with the `submenu` prop instead.");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return /*#__PURE__*/_react.default.createElement(_submenuBlock.default, {
|
|
39
|
-
"data-component": "submenu-block",
|
|
40
|
-
menuType: menuContext.menuType,
|
|
41
|
-
variant: variant
|
|
42
|
-
}, children);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
SubmenuBlock.propTypes = {
|
|
46
|
-
/** Children elements */
|
|
47
|
-
children: _propTypes.default.node.isRequired,
|
|
48
|
-
|
|
49
|
-
/** set the colour variant for a menuType */
|
|
50
|
-
variant: _propTypes.default.oneOf(["default", "alternate"])
|
|
51
|
-
};
|
|
52
|
-
var _default = SubmenuBlock;
|
|
53
|
-
exports.default = _default;
|