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