@geneui/components 3.0.0-next-9ffcb93-16102024 → 3.0.0-next-48d0ef7-31102024
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/Avatar.js +63 -0
- package/CHANGELOG.md +7 -0
- package/Divider.js +23 -0
- package/{GeneUIProvider/index.js → GeneUIProvider.js} +52 -65
- package/HelperText.js +69 -0
- package/Info.js +64 -0
- package/Label.js +38 -0
- package/Loader.js +21 -0
- package/Pill.js +64 -0
- package/TextLink.js +20 -0
- package/{index-65217440.js → Tooltip.js} +104 -80
- package/{lib → components}/atoms/Avatar/Avatar.d.ts +7 -6
- package/components/atoms/Avatar/index.d.ts +1 -0
- package/{lib → components}/atoms/Divider/Divider.d.ts +5 -5
- package/components/atoms/Divider/index.d.ts +1 -0
- package/{lib → components}/atoms/HelperText/HelperText.d.ts +6 -5
- package/components/atoms/HelperText/index.d.ts +1 -0
- package/{lib → components}/atoms/Info/Info.d.ts +5 -5
- package/components/atoms/Info/index.d.ts +1 -0
- package/{lib → components}/atoms/Label/Label.d.ts +3 -3
- package/components/atoms/Label/index.d.ts +1 -0
- package/{lib → components}/atoms/Loader/Loader.d.ts +5 -5
- package/components/atoms/Loader/index.d.ts +1 -0
- package/{lib → components}/atoms/Pill/Pill.d.ts +7 -6
- package/components/atoms/Pill/index.d.ts +1 -0
- package/{lib → components}/atoms/TextLink/TextLink.d.ts +5 -5
- package/components/atoms/TextLink/index.d.ts +1 -0
- package/{lib → components}/molecules/Tooltip/Tooltip.d.ts +26 -21
- package/components/molecules/Tooltip/index.d.ts +1 -0
- package/components/providers/GeneUIProvider/GeneUIProvider.d.ts +30 -0
- package/components/providers/GeneUIProvider/index.d.ts +1 -0
- package/hooks/index.d.ts +2 -20
- package/hooks/useDebounceCallback/index.d.ts +1 -0
- package/hooks/useDebounceCallback/useDebounceCallback.d.ts +2 -0
- package/hooks/useEllipsisDetection/index.d.ts +1 -1
- package/hooks/useEllipsisDetection/useEllipsisDetection.d.ts +2 -2
- package/{index-031ff73c.js → index-ce02421b.js} +4 -4
- package/index.d.ts +11 -121
- package/index.js +12 -159
- package/package.json +24 -43
- package/tokens-0abb4e1b.js +6 -0
- package/types/index.d.ts +0 -3
- package/useEllipsisDetection-46d712b6.js +34 -0
- package/ActionableList/index.js +0 -1694
- package/AdvancedSearch/index.js +0 -892
- package/Alert/index.js +0 -98
- package/Avatar/index.js +0 -58
- package/Badge/index.js +0 -29
- package/Breadcrumb/index.js +0 -130
- package/BusyLoader/index.js +0 -31
- package/Button/index.js +0 -30
- package/Card/index.js +0 -502
- package/CardList/index.js +0 -662
- package/CellMeasurerCache-80be385d.js +0 -229
- package/Charts/index.js +0 -17662
- package/Checkbox/index.js +0 -229
- package/CheckboxGroup/index.js +0 -203
- package/CheckboxGroupWithSearch/index.js +0 -280
- package/Collapse/index.js +0 -195
- package/ColorPicker/index.js +0 -210
- package/ComboBox/index.js +0 -524
- package/Copy/index.js +0 -56
- package/Counter/index.js +0 -312
- package/DateFilter/index.js +0 -183
- package/DatePicker/index.js +0 -1229
- package/DatePickerInput/index.js +0 -883
- package/Divider/index.js +0 -23
- package/Drawer/index.js +0 -261
- package/Dropdown/index.js +0 -43
- package/Editor/index.js +0 -22975
- package/Empty/index.js +0 -76
- package/ExtendedInput/index.js +0 -590
- package/Form/index.js +0 -85
- package/FormContainer/index.js +0 -189
- package/FormableCheckbox/index.js +0 -24
- package/FormableDatePicker/index.js +0 -43
- package/FormableDropdown/index.js +0 -50
- package/FormableEditor/index.js +0 -26
- package/FormableHOC-85f89a81.js +0 -83
- package/FormableMultiSelectDropdown/index.js +0 -50
- package/FormableNumberInput/index.js +0 -34
- package/FormableRadio/index.js +0 -22
- package/FormableSwitcher/index.js +0 -22
- package/FormableTextInput/index.js +0 -34
- package/FormableUploader/index.js +0 -44
- package/Grid/index.js +0 -167
- package/HelperText/index.js +0 -86
- package/Holder/index.js +0 -261
- package/Icon/index.js +0 -62
- package/Image/index.js +0 -45
- package/ImagePreview/index.js +0 -217
- package/Info/index.js +0 -41
- package/InfoOutline-dd2e89d9.js +0 -29
- package/InteractiveWidget/index.js +0 -78
- package/KeyValue/index.js +0 -22
- package/Label/index.js +0 -48
- package/LinkButton/index.js +0 -34
- package/Loader/index.js +0 -23
- package/Menu/index.js +0 -281
- package/MobileNavigation/index.js +0 -94
- package/MobilePopup/index.js +0 -182
- package/Modal/index.js +0 -251
- package/ModuleTitle/index.js +0 -141
- package/NavigationMenu/index.js +0 -222
- package/Notification/index.js +0 -120
- package/Option/index.js +0 -184
- package/Overlay/index.js +0 -187
- package/Overspread/index.js +0 -291
- package/Pagination/index.js +0 -261
- package/Paper/index.js +0 -96
- package/Pill/index.js +0 -67
- package/Popover/index.js +0 -725
- package/PopoverV2/index.js +0 -19
- package/Portal/index.js +0 -58
- package/Products/index.js +0 -115
- package/Profile/index.js +0 -589
- package/Progress/index.js +0 -200
- package/QRCode/index.js +0 -814
- package/Radio/index.js +0 -151
- package/RadioGroup/index.js +0 -104
- package/Range/index.js +0 -191
- package/Rating/index.js +0 -174
- package/RichEditor/index.js +0 -13
- package/RichEditor-78c2617e.js +0 -228
- package/Scrollbar/index.js +0 -1585
- package/Search/index.js +0 -75
- package/SearchWithDropdown/index.js +0 -140
- package/Section/index.js +0 -61
- package/SkeletonLoader/index.js +0 -81
- package/Slider/index.js +0 -261
- package/Status/index.js +0 -97
- package/Steps/index.js +0 -314
- package/SuggestionList/index.js +0 -385
- package/Switcher/index.js +0 -193
- package/Table/index.js +0 -57
- package/TableCompositions/index.js +0 -16995
- package/Tabs/index.js +0 -235
- package/Tag/index.js +0 -102
- package/TextLink/index.js +0 -20
- package/Textarea/index.js +0 -242
- package/Time/index.js +0 -62
- package/TimePicker/index.js +0 -575
- package/Timeline/index.js +0 -113
- package/Title/index.js +0 -65
- package/Toaster/index.js +0 -116
- package/Tooltip/index.js +0 -6
- package/TransferList/index.js +0 -493
- package/Uploader/index.js +0 -992
- package/ValidatableCheckbox/index.js +0 -123
- package/ValidatableDatePicker/index.js +0 -316
- package/ValidatableDropdown/index.js +0 -141
- package/ValidatableElements/index.js +0 -67
- package/ValidatableMultiSelectDropdown/index.js +0 -152
- package/ValidatableNumberInput/index.js +0 -204
- package/ValidatableRadio/index.js +0 -116
- package/ValidatableSwitcher/index.js +0 -93
- package/ValidatableTextInput/index.js +0 -167
- package/ValidatableTimeInput/index.js +0 -174
- package/ValidatableUploader/index.js +0 -98
- package/Widget/index.js +0 -225
- package/_commonjsHelpers-24198af3.js +0 -35
- package/_rollupPluginBabelHelpers-a83240e1.js +0 -11
- package/callAfterDelay-7272faca.js +0 -12
- package/checkTimeValidation-e56771be.js +0 -16
- package/checkboxRadioSwitcher-5b69d7bd.js +0 -4
- package/clsx.m-2bb6df4b.js +0 -3
- package/config-1053d64d.js +0 -20
- package/configs-00612ce0.js +0 -103
- package/configs.js +0 -111
- package/dateValidation-67caec66.js +0 -225
- package/debounce-4419bc2f.js +0 -17
- package/guid-8ddf77b3.js +0 -16
- package/hooks/useBodyScroll.js +0 -16
- package/hooks/useClick.js +0 -18
- package/hooks/useClickOutside.js +0 -25
- package/hooks/useDebounce.js +0 -28
- package/hooks/useDeviceType.js +0 -17
- package/hooks/useDidMount.js +0 -15
- package/hooks/useForceUpdate.js +0 -8
- package/hooks/useHover.js +0 -20
- package/hooks/useImgDownload.js +0 -18
- package/hooks/useKeyDown.js +0 -21
- package/hooks/useMount.js +0 -13
- package/hooks/useMutationObserver.js +0 -21
- package/hooks/usePrevious.js +0 -10
- package/hooks/useThrottle.js +0 -16
- package/hooks/useToggle.js +0 -11
- package/hooks/useUpdatableRef.js +0 -14
- package/hooks/useUpdate.js +0 -10
- package/hooks/useWidth.js +0 -16
- package/hooks/useWindowSize.js +0 -40
- package/index-122432cd.js +0 -270
- package/index-262edd7a.js +0 -77
- package/index-2f5aa51e.js +0 -6483
- package/index-370f9acd.js +0 -4
- package/index-45eafea6.js +0 -90
- package/index-480fd7d9.js +0 -10032
- package/index-5f37f281.js +0 -168
- package/index-73aaa093.js +0 -1940
- package/index.mobile.d.ts +0 -14
- package/lib/atoms/Avatar/index.d.ts +0 -1
- package/lib/atoms/Badge/Badge.d.ts +0 -36
- package/lib/atoms/Badge/index.d.ts +0 -1
- package/lib/atoms/BusyLoader/BusyLoader.d.ts +0 -32
- package/lib/atoms/BusyLoader/BusyLoaderHolderHOC.d.ts +0 -8
- package/lib/atoms/BusyLoader/index.d.ts +0 -1
- package/lib/atoms/Button/Button.d.ts +0 -70
- package/lib/atoms/Button/index.d.ts +0 -1
- package/lib/atoms/Divider/index.d.ts +0 -1
- package/lib/atoms/Empty/Empty.d.ts +0 -39
- package/lib/atoms/Empty/index.d.ts +0 -1
- package/lib/atoms/Empty/utils.d.ts +0 -9
- package/lib/atoms/HelperText/index.d.ts +0 -1
- package/lib/atoms/Image/Image.d.ts +0 -51
- package/lib/atoms/Image/index.d.ts +0 -1
- package/lib/atoms/ImagePreview/ImagePreview.d.ts +0 -56
- package/lib/atoms/ImagePreview/ImagePreviewHOC.d.ts +0 -4
- package/lib/atoms/ImagePreview/Magnifier.d.ts +0 -40
- package/lib/atoms/ImagePreview/index.d.ts +0 -1
- package/lib/atoms/Info/index.d.ts +0 -1
- package/lib/atoms/KeyValue/KeyValue.d.ts +0 -29
- package/lib/atoms/KeyValue/index.d.ts +0 -1
- package/lib/atoms/Label/index.d.ts +0 -1
- package/lib/atoms/LinkButton/LinkButton.d.ts +0 -46
- package/lib/atoms/LinkButton/index.d.ts +0 -1
- package/lib/atoms/Loader/index.d.ts +0 -1
- package/lib/atoms/Pill/index.d.ts +0 -1
- package/lib/atoms/Rating/DefaultSvg.d.ts +0 -3
- package/lib/atoms/Rating/Rating.d.ts +0 -49
- package/lib/atoms/Rating/index.d.ts +0 -1
- package/lib/atoms/TextLink/index.d.ts +0 -1
- package/lib/molecules/Copy/Copy.d.ts +0 -38
- package/lib/molecules/Copy/index.d.ts +0 -1
- package/lib/molecules/InteractiveWidget/InteractiveWidget.d.ts +0 -70
- package/lib/molecules/InteractiveWidget/InteractiveWidgetIcon.d.ts +0 -8
- package/lib/molecules/InteractiveWidget/index.d.ts +0 -1
- package/lib/molecules/Tooltip/index.d.ts +0 -1
- package/lib/providers/GeneUIProvider/GeneUIProvider.d.ts +0 -30
- package/lib/providers/GeneUIProvider/index.d.ts +0 -1
- package/localization-4ba17032.js +0 -46
- package/objectWithoutPropertiesLoose-e1596bdb.js +0 -62
- package/rangeAndSlider-693a3d41.js +0 -8684
- package/react-beautiful-dnd.esm-b637016a.js +0 -10116
- package/react-lifecycles-compat.es-6e1f3768.js +0 -158
- package/redux-e591c1b8.js +0 -536
- package/tokens-8ab1179c.js +0 -6
- package/tslib.es6-f211516f.js +0 -35
- package/useEllipsisDetection-c1c9ad94.js +0 -38
package/Modal/index.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
|
|
2
|
-
import React__default, { useRef, useState, useCallback } from 'react';
|
|
3
|
-
import { c as classnames } from '../index-031ff73c.js';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { n as noop } from '../index-5f37f281.js';
|
|
6
|
-
import useKeyDown from '../hooks/useKeyDown.js';
|
|
7
|
-
import '../configs-00612ce0.js';
|
|
8
|
-
import Button from '../Button/index.js';
|
|
9
|
-
import Portal from '../Portal/index.js';
|
|
10
|
-
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
11
|
-
import '../dateValidation-67caec66.js';
|
|
12
|
-
import '../_commonjsHelpers-24198af3.js';
|
|
13
|
-
import 'react-dom';
|
|
14
|
-
import '../tslib.es6-f211516f.js';
|
|
15
|
-
import '../Icon/index.js';
|
|
16
|
-
import '../GeneUIProvider/index.js';
|
|
17
|
-
|
|
18
|
-
var css_248z = "[data-gene-ui-version=\"2.16.3\"] .modal-splash{animation:modal-splash .3s forwards;display:flex;height:calc(100% - var(--header-height, 0px));left:0;opacity:0;overflow-y:auto;padding:2.8rem;position:fixed;top:var(--header-height,0);width:100%;z-index:300}@keyframes modal-splash{to{opacity:1}}[data-gene-ui-version=\"2.16.3\"] .modal-splash.p-top{padding-top:0}[data-gene-ui-version=\"2.16.3\"] .modal-splash.p-bottom{padding-bottom:0}[data-gene-ui-version=\"2.16.3\"] .modal-splash.light-background{background:#fff9}[data-gene-ui-version=\"2.16.3\"] .modal-splash.dark-background{background:#0006}[data-gene-ui-version=\"2.16.3\"] .modal-content{animation:modal-content .4s .1s forwards;background:var(--background);border:1px solid rgba(var(--background-sc-rgb),.1);border-radius:2rem;box-shadow:0 .2rem .4rem 0 #0000001a;display:flex;flex-direction:column;margin:auto;max-width:100%;opacity:0;position:relative}@keyframes modal-content{to{opacity:1}}[data-gene-ui-version=\"2.16.3\"] .modal-content.s-default{width:35rem}[data-gene-ui-version=\"2.16.3\"] .modal-content .modal-close{position:absolute;top:.5rem}html:not([dir=rtl]) .modal-content .modal-close{right:1.6rem}html[dir=rtl] .modal-content .modal-close{left:1.6rem}[data-gene-ui-version=\"2.16.3\"] .modal-splash.p-top .modal-content{align-self:flex-start;border-top-left-radius:0;border-top-right-radius:0;margin:0 auto}[data-gene-ui-version=\"2.16.3\"] .modal-splash.p-bottom .modal-content{align-self:flex-end;border-bottom-left-radius:0;border-bottom-right-radius:0;box-shadow:0 -.2rem .4rem 0 #0000001a;margin:0 auto}[data-gene-ui-version=\"2.16.3\"] .modal-head{align-items:center;border-bottom:1px solid rgba(var(--background-sc-rgb),.1);display:flex;font:700 1.4rem/1.8rem var(--font-family);justify-content:center;min-height:4rem;padding:0 5.4rem;position:relative;text-align:center;width:100%}[data-gene-ui-version=\"2.16.3\"] .modal-head .modal-close{top:50%;transform:translateY(-50%)}[data-gene-ui-version=\"2.16.3\"] .a-compact .modal-head{border-bottom:0;line-height:1.6rem;margin:2.6rem 0 .6rem;min-height:inherit}[data-gene-ui-version=\"2.16.3\"] .modal-body{color:rgba(var(--background-sc-rgb),.62);font:600 1.2rem/1.42 var(--font-family);padding:2rem;width:100%}[data-gene-ui-version=\"2.16.3\"] .modal-footer{border-top:1px solid rgba(var(--background-sc-rgb),.1);display:flex;justify-content:center;padding:1.5rem 2.5rem;width:100%}[data-gene-ui-version=\"2.16.3\"] .modal-footer>*{margin:0 .5rem}";
|
|
19
|
-
styleInject(css_248z);
|
|
20
|
-
|
|
21
|
-
const sizes = ['default', 'content-size'];
|
|
22
|
-
const backgrounds = ['transparent', 'light-background', 'dark-background'];
|
|
23
|
-
const appearances = ['default', 'compact'];
|
|
24
|
-
const positions = ['center', 'top', 'bottom'];
|
|
25
|
-
const KEYBOARD_ENTER_KEY = 13;
|
|
26
|
-
const KEYBOARD_ESC_KEY = 27;
|
|
27
|
-
function Modal(_ref) {
|
|
28
|
-
let {
|
|
29
|
-
visible,
|
|
30
|
-
size,
|
|
31
|
-
background,
|
|
32
|
-
appearance,
|
|
33
|
-
withPortal,
|
|
34
|
-
portalContainer,
|
|
35
|
-
customActions,
|
|
36
|
-
position,
|
|
37
|
-
closable,
|
|
38
|
-
cancelText,
|
|
39
|
-
okText,
|
|
40
|
-
title,
|
|
41
|
-
width,
|
|
42
|
-
zIndex,
|
|
43
|
-
children,
|
|
44
|
-
onOK,
|
|
45
|
-
onCancel,
|
|
46
|
-
footer,
|
|
47
|
-
isOkActive,
|
|
48
|
-
className,
|
|
49
|
-
disableFooter,
|
|
50
|
-
needEnter,
|
|
51
|
-
closeOnClickOutside,
|
|
52
|
-
onClose,
|
|
53
|
-
isOkButtonLoading,
|
|
54
|
-
...rest
|
|
55
|
-
} = _ref;
|
|
56
|
-
const modalSplashRef = useRef(null);
|
|
57
|
-
const [mouseDown, setMouseDown] = useState(false);
|
|
58
|
-
|
|
59
|
-
// We need this 2 functions, because must be closed only when
|
|
60
|
-
// mouseDown and mouseUp are outside of modal
|
|
61
|
-
const handleMouseDown = useCallback(e => e.target === modalSplashRef.current && setMouseDown(true), [modalSplashRef.current]);
|
|
62
|
-
const handleMouseUp = useCallback(e => {
|
|
63
|
-
if (mouseDown && e.target === modalSplashRef.current) {
|
|
64
|
-
closeOnClickOutside && onCancel(e);
|
|
65
|
-
setMouseDown(false);
|
|
66
|
-
} else if (e.target !== modalSplashRef.current) {
|
|
67
|
-
setMouseDown(false);
|
|
68
|
-
}
|
|
69
|
-
}, [closeOnClickOutside, onCancel, modalSplashRef.current, mouseDown]);
|
|
70
|
-
useKeyDown(e => {
|
|
71
|
-
if (visible) {
|
|
72
|
-
e.keyCode === KEYBOARD_ESC_KEY && onCancel(e);
|
|
73
|
-
e.keyCode === KEYBOARD_ENTER_KEY && isOkActive && needEnter && onOK(e);
|
|
74
|
-
}
|
|
75
|
-
}, [visible, isOkActive, onCancel, onOK], {
|
|
76
|
-
current: window
|
|
77
|
-
}, ['Escape', 'Enter']);
|
|
78
|
-
const Content = /*#__PURE__*/React__default.createElement("div", _extends({
|
|
79
|
-
className: classnames('modal-splash', "".concat(background), "a-".concat(appearance), "p-".concat(position), className),
|
|
80
|
-
onMouseDown: handleMouseDown,
|
|
81
|
-
onMouseUp: handleMouseUp,
|
|
82
|
-
style: {
|
|
83
|
-
zIndex
|
|
84
|
-
},
|
|
85
|
-
ref: modalSplashRef
|
|
86
|
-
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
87
|
-
className: classnames('modal-content', "s-".concat(size)),
|
|
88
|
-
style: {
|
|
89
|
-
width
|
|
90
|
-
}
|
|
91
|
-
}, closable && !title && /*#__PURE__*/React__default.createElement(Button, {
|
|
92
|
-
icon: "bc-icon-close",
|
|
93
|
-
size: "medium",
|
|
94
|
-
className: "modal-close",
|
|
95
|
-
appearance: "minimal",
|
|
96
|
-
color: "default",
|
|
97
|
-
onClick: onClose || onCancel
|
|
98
|
-
}), (title || customActions) && /*#__PURE__*/React__default.createElement("div", {
|
|
99
|
-
className: "modal-head"
|
|
100
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
101
|
-
className: "ellipsis-text"
|
|
102
|
-
}, title), closable && /*#__PURE__*/React__default.createElement(Button, {
|
|
103
|
-
icon: "bc-icon-close",
|
|
104
|
-
size: "medium",
|
|
105
|
-
className: "modal-close",
|
|
106
|
-
appearance: "minimal",
|
|
107
|
-
color: "default",
|
|
108
|
-
onClick: onClose || onCancel
|
|
109
|
-
}), customActions), children && /*#__PURE__*/React__default.createElement("div", {
|
|
110
|
-
className: "modal-body"
|
|
111
|
-
}, children), !disableFooter && /*#__PURE__*/React__default.createElement("div", {
|
|
112
|
-
className: "modal-footer"
|
|
113
|
-
}, footer || /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button, {
|
|
114
|
-
appearance: "minimal",
|
|
115
|
-
size: "medium",
|
|
116
|
-
color: "default",
|
|
117
|
-
onClick: onCancel
|
|
118
|
-
}, cancelText), /*#__PURE__*/React__default.createElement(Button, {
|
|
119
|
-
disabled: !isOkActive || isOkButtonLoading,
|
|
120
|
-
size: "medium",
|
|
121
|
-
onClick: onOK,
|
|
122
|
-
loading: isOkButtonLoading
|
|
123
|
-
}, okText)))));
|
|
124
|
-
const portalWrapper = withPortal ? /*#__PURE__*/React__default.createElement(Portal, {
|
|
125
|
-
isOpen: visible,
|
|
126
|
-
container: portalContainer
|
|
127
|
-
}, Content) : Content;
|
|
128
|
-
return visible && portalWrapper;
|
|
129
|
-
}
|
|
130
|
-
Modal.propTypes = {
|
|
131
|
-
/**
|
|
132
|
-
* Displays modal if [true]
|
|
133
|
-
*/
|
|
134
|
-
visible: PropTypes.bool,
|
|
135
|
-
/**
|
|
136
|
-
* Controls modal size
|
|
137
|
-
*/
|
|
138
|
-
size: PropTypes.oneOf(sizes),
|
|
139
|
-
/**
|
|
140
|
-
* Controls background color of modal
|
|
141
|
-
*/
|
|
142
|
-
background: PropTypes.oneOf(backgrounds),
|
|
143
|
-
/**
|
|
144
|
-
* Controls divider between modal's header and body
|
|
145
|
-
*/
|
|
146
|
-
appearance: PropTypes.oneOf(appearances),
|
|
147
|
-
/**
|
|
148
|
-
* Controls modal position on screen
|
|
149
|
-
*/
|
|
150
|
-
position: PropTypes.oneOf(positions),
|
|
151
|
-
/**
|
|
152
|
-
* Displays close button on modal,
|
|
153
|
-
* Fires onCancel function when clicked
|
|
154
|
-
*/
|
|
155
|
-
closable: PropTypes.bool,
|
|
156
|
-
/**
|
|
157
|
-
* Disables footer in modal
|
|
158
|
-
*/
|
|
159
|
-
disableFooter: PropTypes.bool,
|
|
160
|
-
/**
|
|
161
|
-
* Enables footers Ok button in modal
|
|
162
|
-
*/
|
|
163
|
-
isOkActive: PropTypes.bool,
|
|
164
|
-
/**
|
|
165
|
-
* Custom text for cancel button
|
|
166
|
-
*/
|
|
167
|
-
cancelText: PropTypes.string,
|
|
168
|
-
/**
|
|
169
|
-
* Custom text for ok button
|
|
170
|
-
*/
|
|
171
|
-
okText: PropTypes.string,
|
|
172
|
-
/**
|
|
173
|
-
* Custom title for modal
|
|
174
|
-
*/
|
|
175
|
-
title: PropTypes.any,
|
|
176
|
-
/**
|
|
177
|
-
* Wraps component with Portal component if [true]
|
|
178
|
-
*/
|
|
179
|
-
withPortal: PropTypes.bool,
|
|
180
|
-
portalContainer: PropTypes.any,
|
|
181
|
-
/**
|
|
182
|
-
* Custom value to override default css value
|
|
183
|
-
*/
|
|
184
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
185
|
-
/**
|
|
186
|
-
* Custom zIndex value to overRide default css value
|
|
187
|
-
*/
|
|
188
|
-
zIndex: PropTypes.number,
|
|
189
|
-
/**
|
|
190
|
-
* Valid React elements for modal body
|
|
191
|
-
*/
|
|
192
|
-
children: PropTypes.node,
|
|
193
|
-
/**
|
|
194
|
-
* Additional classname
|
|
195
|
-
*/
|
|
196
|
-
className: PropTypes.string,
|
|
197
|
-
/**
|
|
198
|
-
* Fires event when user clicks on ok button
|
|
199
|
-
* (event: Event) => void
|
|
200
|
-
*/
|
|
201
|
-
onOK: PropTypes.func,
|
|
202
|
-
/**
|
|
203
|
-
* Fires event when user clicks on Cancel button
|
|
204
|
-
* (event: Event) => void
|
|
205
|
-
*/
|
|
206
|
-
onCancel: PropTypes.func,
|
|
207
|
-
/**
|
|
208
|
-
* Custom footer element for modal
|
|
209
|
-
*/
|
|
210
|
-
footer: PropTypes.element,
|
|
211
|
-
/**
|
|
212
|
-
* Pass [true] if you need to hide a modal when people click outside of it's content
|
|
213
|
-
*/
|
|
214
|
-
closeOnClickOutside: PropTypes.bool,
|
|
215
|
-
/**
|
|
216
|
-
* Custom action elements for modal's header
|
|
217
|
-
*/
|
|
218
|
-
customActions: PropTypes.node,
|
|
219
|
-
/**
|
|
220
|
-
* Enable keyboard Enter
|
|
221
|
-
*/
|
|
222
|
-
needEnter: PropTypes.bool,
|
|
223
|
-
/**
|
|
224
|
-
* Fires event when user clicks on Close icon
|
|
225
|
-
* (event: Event) => void
|
|
226
|
-
*/
|
|
227
|
-
onClose: PropTypes.func,
|
|
228
|
-
/**
|
|
229
|
-
* Loader for ok button
|
|
230
|
-
*/
|
|
231
|
-
isOkButtonLoading: PropTypes.bool
|
|
232
|
-
};
|
|
233
|
-
Modal.defaultProps = {
|
|
234
|
-
visible: false,
|
|
235
|
-
size: sizes[0],
|
|
236
|
-
onOK: noop,
|
|
237
|
-
onCancel: noop,
|
|
238
|
-
background: backgrounds[2],
|
|
239
|
-
appearance: appearances[0],
|
|
240
|
-
position: positions[0],
|
|
241
|
-
closable: true,
|
|
242
|
-
cancelText: 'Cancel',
|
|
243
|
-
okText: 'OK',
|
|
244
|
-
closeOnClickOutside: true,
|
|
245
|
-
isOkActive: true,
|
|
246
|
-
disableFooter: false,
|
|
247
|
-
needEnter: true,
|
|
248
|
-
isOkButtonLoading: false
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
export { Modal as default };
|
package/ModuleTitle/index.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { c as classnames } from '../index-031ff73c.js';
|
|
5
|
-
import { b as moduleTitleConfig } from '../configs-00612ce0.js';
|
|
6
|
-
import { n as noop } from '../index-5f37f281.js';
|
|
7
|
-
import Icon from '../Icon/index.js';
|
|
8
|
-
import { T as Tooltip } from '../index-65217440.js';
|
|
9
|
-
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
10
|
-
import '../dateValidation-67caec66.js';
|
|
11
|
-
import '../_commonjsHelpers-24198af3.js';
|
|
12
|
-
import 'react-dom';
|
|
13
|
-
import '../tslib.es6-f211516f.js';
|
|
14
|
-
import '../GeneUIProvider/index.js';
|
|
15
|
-
|
|
16
|
-
var css_248z = "[data-gene-ui-version=\"2.16.3\"] .module-header{background:var(--background);display:flex;flex-shrink:0;height:5rem;padding:0 .5rem 0 2rem;width:100%}html[dir=rtl] .module-header{padding:0 2rem 0 .5rem}[data-gene-ui-version=\"2.16.3\"] .module-header.headerBorder.p-top{border-bottom:1px solid rgba(var(--background-sc-rgb),.1)}[data-gene-ui-version=\"2.16.3\"] .module-header.headerBorder.p-top.cr-position-radius{border-radius:2rem 2rem 0 0}[data-gene-ui-version=\"2.16.3\"] .module-header.headerBorder.p-bottom{border-top:1px solid rgba(var(--background-sc-rgb),.1)}[data-gene-ui-version=\"2.16.3\"] .module-header.headerBorder.p-bottom.cr-position-radius{border-radius:0 0 2rem 2rem}[data-gene-ui-version=\"2.16.3\"] .module-header.cr-full-radius{border-radius:2rem}[data-gene-ui-version=\"2.16.3\"] .module-header>li{align-items:center;display:flex}[data-gene-ui-version=\"2.16.3\"] .module-header>li.left-content{flex:auto;overflow:hidden;position:relative}[data-gene-ui-version=\"2.16.3\"] .module-header>li.left-content .left-inner{max-width:100%}[data-gene-ui-version=\"2.16.3\"] .module-header>li.left-content .left-inner:nth-last-child(2){max-width:calc(100% - 3.2rem)}[data-gene-ui-version=\"2.16.3\"] .module-header>li.left-content .left-inner-icon{margin-inline-start:.8rem}[data-gene-ui-version=\"2.16.3\"] .module-header>li.right-content{flex-shrink:0}[data-gene-ui-version=\"2.16.3\"] .module-header.s-small{height:3rem}[data-gene-ui-version=\"2.16.3\"] .module-header.s-small .module-description-title .m-title,[data-gene-ui-version=\"2.16.3\"] .module-header.s-small .module-title{font-size:1.2rem;line-height:normal}[data-gene-ui-version=\"2.16.3\"] .module-header.s-medium{height:4rem}[data-gene-ui-version=\"2.16.3\"] .module-header.s-extra-big{height:6rem}[data-gene-ui-version=\"2.16.3\"] .module-title{font:600 1.4rem/1.8rem var(--font-family)}[data-gene-ui-version=\"2.16.3\"] .module-title:before{background:var(--hero);content:\"\";display:block;height:.3rem;position:absolute;width:3.4rem}html:not([dir=rtl]) .module-title:before{left:0}html[dir=rtl] .module-title:before{right:0}[data-gene-ui-version=\"2.16.3\"] .p-top .module-title:before{bottom:0}[data-gene-ui-version=\"2.16.3\"] .p-bottom .module-title:before{top:0}[data-gene-ui-version=\"2.16.3\"] .module-title-without-border{font:600 1.4rem/1.8rem var(--font-family)}[data-gene-ui-version=\"2.16.3\"] .module-description-title{width:100%}[data-gene-ui-version=\"2.16.3\"] .module-description-title .m-description{font:600 1.2rem/1.6rem var(--font-family)}[data-gene-ui-version=\"2.16.3\"] .module-description-title .m-title{font:600 1.6rem/2.8rem var(--font-family)}";
|
|
17
|
-
styleInject(css_248z);
|
|
18
|
-
|
|
19
|
-
function IconWithTooltip(_ref) {
|
|
20
|
-
let {
|
|
21
|
-
toolTip,
|
|
22
|
-
children
|
|
23
|
-
} = _ref;
|
|
24
|
-
return toolTip ? /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
25
|
-
title: toolTip
|
|
26
|
-
}, children) : children;
|
|
27
|
-
}
|
|
28
|
-
function ModuleTitle(_ref2) {
|
|
29
|
-
let {
|
|
30
|
-
size,
|
|
31
|
-
title,
|
|
32
|
-
color,
|
|
33
|
-
hideBeforeBorder,
|
|
34
|
-
position,
|
|
35
|
-
children,
|
|
36
|
-
className,
|
|
37
|
-
description,
|
|
38
|
-
cornerRadius,
|
|
39
|
-
headerBorder,
|
|
40
|
-
titleIcon,
|
|
41
|
-
titleIconTooltip,
|
|
42
|
-
onTitleIconClick,
|
|
43
|
-
...restProps
|
|
44
|
-
} = _ref2;
|
|
45
|
-
return /*#__PURE__*/React__default.createElement("ul", _extends({
|
|
46
|
-
className: classnames('module-header', "cr-".concat(cornerRadius), "p-".concat(position), "s-".concat(size), className, {
|
|
47
|
-
headerBorder
|
|
48
|
-
})
|
|
49
|
-
}, restProps), /*#__PURE__*/React__default.createElement("li", {
|
|
50
|
-
className: "left-content",
|
|
51
|
-
style: {
|
|
52
|
-
'--hero': color || ''
|
|
53
|
-
}
|
|
54
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
55
|
-
className: "left-inner"
|
|
56
|
-
}, description ? /*#__PURE__*/React__default.createElement("div", {
|
|
57
|
-
className: "module-description-title"
|
|
58
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
59
|
-
className: "m-description ellipsis-text"
|
|
60
|
-
}, description), /*#__PURE__*/React__default.createElement("div", {
|
|
61
|
-
className: "m-title ellipsis-text"
|
|
62
|
-
}, title)) : title && /*#__PURE__*/React__default.createElement("div", {
|
|
63
|
-
className: classnames('ellipsis-text', {
|
|
64
|
-
'module-title-without-border': hideBeforeBorder,
|
|
65
|
-
'module-title': !hideBeforeBorder
|
|
66
|
-
}),
|
|
67
|
-
title: typeof title === 'string' ? title : ''
|
|
68
|
-
}, title)), titleIcon && /*#__PURE__*/React__default.createElement(IconWithTooltip, {
|
|
69
|
-
toolTip: titleIconTooltip
|
|
70
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
71
|
-
className: "left-inner-icon"
|
|
72
|
-
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
73
|
-
type: titleIcon,
|
|
74
|
-
onClick: onTitleIconClick
|
|
75
|
-
})))), /*#__PURE__*/React__default.createElement("li", {
|
|
76
|
-
className: "right-content"
|
|
77
|
-
}, children));
|
|
78
|
-
}
|
|
79
|
-
ModuleTitle.propTypes = {
|
|
80
|
-
/**
|
|
81
|
-
* Title property. Any valid React node.
|
|
82
|
-
*/
|
|
83
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
84
|
-
/**
|
|
85
|
-
* Additonal description. Any valid React node
|
|
86
|
-
*/
|
|
87
|
-
description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
88
|
-
/**
|
|
89
|
-
* ModuleTitle sizing
|
|
90
|
-
*/
|
|
91
|
-
size: PropTypes.oneOf(moduleTitleConfig.size),
|
|
92
|
-
/**
|
|
93
|
-
* Addional className
|
|
94
|
-
*/
|
|
95
|
-
className: PropTypes.string,
|
|
96
|
-
/**
|
|
97
|
-
* Hide border after title
|
|
98
|
-
*/
|
|
99
|
-
hideBeforeBorder: PropTypes.bool,
|
|
100
|
-
/**
|
|
101
|
-
* Hide header main border
|
|
102
|
-
*/
|
|
103
|
-
headerBorder: PropTypes.bool,
|
|
104
|
-
/**
|
|
105
|
-
* ModuleTitle positioning
|
|
106
|
-
*/
|
|
107
|
-
position: PropTypes.oneOf(moduleTitleConfig.position),
|
|
108
|
-
/**
|
|
109
|
-
* ModuleTitle corner radius
|
|
110
|
-
*/
|
|
111
|
-
cornerRadius: PropTypes.oneOf(moduleTitleConfig.cornerRadius),
|
|
112
|
-
/**
|
|
113
|
-
* Module title content can be passed as child. Any valid React node.
|
|
114
|
-
*/
|
|
115
|
-
children: PropTypes.node,
|
|
116
|
-
/**
|
|
117
|
-
* Use this prop to override ModuleTitle's underline color. Will not work when "descroiption" prop is specified
|
|
118
|
-
*/
|
|
119
|
-
color: PropTypes.string,
|
|
120
|
-
/**
|
|
121
|
-
* Will add an "Icon" atom to the left side of ModuleTitle. Valid values are the same as "type" prop for "Icon" atom
|
|
122
|
-
*/
|
|
123
|
-
titleIcon: PropTypes.string,
|
|
124
|
-
/**
|
|
125
|
-
* Tooltip for icon
|
|
126
|
-
*/
|
|
127
|
-
titleIconTooltip: PropTypes.string,
|
|
128
|
-
/**
|
|
129
|
-
* Title Icon onClick event
|
|
130
|
-
*/
|
|
131
|
-
onTitleIconClick: PropTypes.func
|
|
132
|
-
};
|
|
133
|
-
ModuleTitle.defaultProps = {
|
|
134
|
-
onTitleIconClick: noop,
|
|
135
|
-
headerBorder: true,
|
|
136
|
-
size: moduleTitleConfig.size[2],
|
|
137
|
-
position: moduleTitleConfig.position[0],
|
|
138
|
-
cornerRadius: moduleTitleConfig.cornerRadius[0]
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export { ModuleTitle as default };
|
package/NavigationMenu/index.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import React__default, { memo, useState, useRef, useMemo, useCallback, useEffect } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { n as noop } from '../index-5f37f281.js';
|
|
4
|
-
import useDeviceType from '../hooks/useDeviceType.js';
|
|
5
|
-
import Icon from '../Icon/index.js';
|
|
6
|
-
import Option from '../Option/index.js';
|
|
7
|
-
import Popover from '../Popover/index.js';
|
|
8
|
-
import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
|
|
9
|
-
import '../dateValidation-67caec66.js';
|
|
10
|
-
import { d as debounce } from '../debounce-4419bc2f.js';
|
|
11
|
-
import 'react-dom';
|
|
12
|
-
import Menu from '../Menu/index.js';
|
|
13
|
-
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
14
|
-
import '../configs-00612ce0.js';
|
|
15
|
-
import '../hooks/useWindowSize.js';
|
|
16
|
-
import '../hooks/useDebounce.js';
|
|
17
|
-
import '../index-031ff73c.js';
|
|
18
|
-
import '../useEllipsisDetection-c1c9ad94.js';
|
|
19
|
-
import '../index-65217440.js';
|
|
20
|
-
import '../tslib.es6-f211516f.js';
|
|
21
|
-
import '../GeneUIProvider/index.js';
|
|
22
|
-
import '../_commonjsHelpers-24198af3.js';
|
|
23
|
-
import '../index-122432cd.js';
|
|
24
|
-
import '../hooks/useUpdatableRef.js';
|
|
25
|
-
import '../hooks/useForceUpdate.js';
|
|
26
|
-
import '../Portal/index.js';
|
|
27
|
-
import '../Scrollbar/index.js';
|
|
28
|
-
import '../guid-8ddf77b3.js';
|
|
29
|
-
|
|
30
|
-
const getTitle = (id, data) => {
|
|
31
|
-
if (data) {
|
|
32
|
-
const matchedDatum = data.find(datum => datum.id === id);
|
|
33
|
-
return matchedDatum && matchedDatum.title ? matchedDatum : data.map(datum => getTitle(id, datum.data)).filter(Boolean)[0];
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const getTitlesArray = (ids, data) => ids.map(id => getTitle(id, data)).filter(Boolean);
|
|
37
|
-
const navigationOptionsToMenu = (navigationOptions, optionId) => navigationOptions.map(_ref => {
|
|
38
|
-
let {
|
|
39
|
-
data,
|
|
40
|
-
...rest
|
|
41
|
-
} = _ref;
|
|
42
|
-
return {
|
|
43
|
-
...rest,
|
|
44
|
-
active: (optionId === null || optionId === void 0 ? void 0 : optionId.toString()) === rest.id.toString(),
|
|
45
|
-
...(data ? {
|
|
46
|
-
children: navigationOptionsToMenu(data, optionId)
|
|
47
|
-
} : {})
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
const indexStackFromItems = (stack, items, selectedItemId) => {
|
|
51
|
-
if (!(items !== null && items !== void 0 && items.length)) {
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
for (const itemIndex in items) {
|
|
55
|
-
const item = items[itemIndex];
|
|
56
|
-
if (item.id === selectedItemId) {
|
|
57
|
-
return stack;
|
|
58
|
-
}
|
|
59
|
-
if (item.children) {
|
|
60
|
-
const currentIndexStack = indexStackFromItems([...stack, Number(itemIndex)], item.children, selectedItemId);
|
|
61
|
-
if (currentIndexStack.length) {
|
|
62
|
-
return currentIndexStack;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return [];
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
function NavigationMenuContent(_ref) {
|
|
70
|
-
let {
|
|
71
|
-
depth,
|
|
72
|
-
path,
|
|
73
|
-
options,
|
|
74
|
-
onChange,
|
|
75
|
-
splitedValue
|
|
76
|
-
} = _ref;
|
|
77
|
-
const [activeItem, setActiveItem] = useState();
|
|
78
|
-
const navigationRef = useRef(null);
|
|
79
|
-
const isHovered = useRef(true);
|
|
80
|
-
const optionId = useMemo(() => splitedValue === null || splitedValue === void 0 ? void 0 : splitedValue[depth], [depth, splitedValue]);
|
|
81
|
-
const isActiveItem = useMemo(() => (activeItem === null || activeItem === void 0 ? void 0 : activeItem.id) && optionId === activeItem.id, [activeItem, optionId]);
|
|
82
|
-
const mobileOptions = useMemo(() => options ? navigationOptionsToMenu(options, optionId) : undefined, [options, optionId]);
|
|
83
|
-
const initialIndexStack = useMemo(() => indexStackFromItems([], mobileOptions, optionId), [mobileOptions, activeItem]);
|
|
84
|
-
const {
|
|
85
|
-
isMobile
|
|
86
|
-
} = useDeviceType();
|
|
87
|
-
const onMouseEnterHandler = useCallback(debounce(_ref2 => {
|
|
88
|
-
let {
|
|
89
|
-
isColaps,
|
|
90
|
-
item
|
|
91
|
-
} = _ref2;
|
|
92
|
-
if (!isHovered.current) return;
|
|
93
|
-
isColaps ? setActiveItem(item) : setActiveItem(null);
|
|
94
|
-
}, 200), [isHovered, setActiveItem]);
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
if (optionId && options !== null && options !== void 0 && options.length) {
|
|
97
|
-
const item = options.find(item => item.id === optionId);
|
|
98
|
-
item && setActiveItem(item);
|
|
99
|
-
}
|
|
100
|
-
}, [optionId, options]);
|
|
101
|
-
const onItemClick = item => {
|
|
102
|
-
onChange(path ? "".concat(path, "/").concat(item.id) : item.id, item);
|
|
103
|
-
setActiveItem(item);
|
|
104
|
-
};
|
|
105
|
-
if (isMobile) {
|
|
106
|
-
return /*#__PURE__*/React__default.createElement(Menu, {
|
|
107
|
-
data: mobileOptions,
|
|
108
|
-
onSelect: (_, item) => onItemClick(item),
|
|
109
|
-
selectedItem: activeItem,
|
|
110
|
-
initialIndexStack: initialIndexStack
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, (options === null || options === void 0 ? void 0 : options.length) > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
114
|
-
className: "bc-navigation-menu_content-menu",
|
|
115
|
-
ref: navigationRef,
|
|
116
|
-
onMouseEnter: () => isHovered.current = true,
|
|
117
|
-
onMouseLeave: () => isHovered.current = false
|
|
118
|
-
}, options.map(item => {
|
|
119
|
-
const isColaps = !!(item.data && item.data.length);
|
|
120
|
-
return item.isHidden !== true && /*#__PURE__*/React__default.createElement(Option, _extends({}, item, {
|
|
121
|
-
key: item.id,
|
|
122
|
-
active: optionId === item.id,
|
|
123
|
-
forwardMark: isColaps,
|
|
124
|
-
onClick: () => !isColaps && onItemClick(item),
|
|
125
|
-
onMouseEnter: () => onMouseEnterHandler({
|
|
126
|
-
isColaps,
|
|
127
|
-
item
|
|
128
|
-
})
|
|
129
|
-
}));
|
|
130
|
-
})), activeItem && /*#__PURE__*/React__default.createElement(NavigationMenuContent, {
|
|
131
|
-
depth: depth + 1,
|
|
132
|
-
path: path ? "".concat(path, "/").concat(activeItem.id) : activeItem.id,
|
|
133
|
-
options: activeItem.data,
|
|
134
|
-
onChange: onChange,
|
|
135
|
-
splitedValue: isActiveItem && splitedValue
|
|
136
|
-
}));
|
|
137
|
-
}
|
|
138
|
-
NavigationMenuContent.defaultProps = {
|
|
139
|
-
depth: 0
|
|
140
|
-
};
|
|
141
|
-
var NavigationMenuContent$1 = /*#__PURE__*/memo(NavigationMenuContent);
|
|
142
|
-
|
|
143
|
-
var css_248z = "[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu{--size:3.6rem;align-items:center;border:1px solid #0000;border-radius:var(--button-external-size,var(--size));color:#fff;cursor:pointer;display:flex;font:600 1.4rem/2rem var(--font-family);justify-content:center;min-height:var(--button-external-size,var(--size));min-width:var(--button-external-size,var(--size));padding:0 1rem;position:relative;transition:color .3s,background .3s,opacity .2s;-webkit-user-select:none;user-select:none}@media (hover:hover){[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu:hover{background:#ffffff1a}}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu.active{background:#ffffff1a}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu:disabled{opacity:.5;pointer-events:none}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu_head{align-items:center;display:flex;justify-content:center;pointer-events:none}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu_layer{align-items:center;display:flex;margin:0 .8rem;opacity:.7}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu_layer.active,[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu_layer:last-child{opacity:1}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu_content{display:flex;padding:1rem 0}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu_content-menu{width:25.8rem}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu_content-menu:not(.bc-navigation-menu_content-menu:last-child){border-right:1px solid #0000001a}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu_title-wrapper{align-items:center;display:flex;justify-content:center}[data-gene-ui-version=\"2.16.3\"] .bc-navigation-menu_title-wrapper:not(.bc-navigation-menu_title-wrapper:last-child):after{background-color:#fff;content:\"\";display:block;height:2.3rem;margin-inline:.6rem;transform:rotate(15deg);width:1px}";
|
|
144
|
-
styleInject(css_248z);
|
|
145
|
-
|
|
146
|
-
function NavigationMenu(_ref) {
|
|
147
|
-
let {
|
|
148
|
-
data,
|
|
149
|
-
value,
|
|
150
|
-
onChange,
|
|
151
|
-
disabled
|
|
152
|
-
} = _ref;
|
|
153
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
154
|
-
const {
|
|
155
|
-
isMobile
|
|
156
|
-
} = useDeviceType();
|
|
157
|
-
const splitedValue = useMemo(() => value && value.split('/').filter(Boolean), [value]);
|
|
158
|
-
const title = useMemo(() => getTitlesArray(splitedValue, data), [splitedValue, data]);
|
|
159
|
-
const handleChange = useCallback(function () {
|
|
160
|
-
setIsOpen(false);
|
|
161
|
-
onChange(...arguments);
|
|
162
|
-
}, [onChange]);
|
|
163
|
-
const handleToggle = useCallback(() => setIsOpen(prev => !prev), []);
|
|
164
|
-
return /*#__PURE__*/React__default.createElement(Popover, {
|
|
165
|
-
isOpen: isOpen,
|
|
166
|
-
extendTargetWidth: false,
|
|
167
|
-
toggleHandler: handleToggle,
|
|
168
|
-
fullHeight: true,
|
|
169
|
-
children: /*#__PURE__*/React__default.createElement("button", {
|
|
170
|
-
className: "bc-navigation-menu",
|
|
171
|
-
disabled: disabled
|
|
172
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
173
|
-
className: "bc-navigation-menu_head"
|
|
174
|
-
}, title.map((item, index) => /*#__PURE__*/React__default.createElement("div", {
|
|
175
|
-
className: "bc-navigation-menu_title-wrapper"
|
|
176
|
-
}, (item === null || item === void 0 ? void 0 : item.icon) && isMobile && /*#__PURE__*/React__default.createElement(Icon, {
|
|
177
|
-
type: item.icon
|
|
178
|
-
}), /*#__PURE__*/React__default.createElement("span", {
|
|
179
|
-
key: index,
|
|
180
|
-
className: "bc-navigation-menu_layer"
|
|
181
|
-
}, item.title)))), /*#__PURE__*/React__default.createElement(Icon, {
|
|
182
|
-
type: "bc-icon-arrow-down"
|
|
183
|
-
})),
|
|
184
|
-
Content: /*#__PURE__*/React__default.createElement("div", {
|
|
185
|
-
className: "bc-navigation-menu_content"
|
|
186
|
-
}, /*#__PURE__*/React__default.createElement(NavigationMenuContent$1, {
|
|
187
|
-
options: data,
|
|
188
|
-
onChange: handleChange,
|
|
189
|
-
splitedValue: splitedValue
|
|
190
|
-
}))
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
NavigationMenu.propTypes = {
|
|
194
|
-
/**
|
|
195
|
-
* This is where you send data (options) for the menu, if you need to send
|
|
196
|
-
* nested options, send the date to the option in the same structure as the options.
|
|
197
|
-
* example => data={[{ id: 'item_1', title: 'Item 1', isHidden: false, data: [ { id: 'item_1_1', title: 'Item 1.1', isHidden: false } ]}]}
|
|
198
|
-
*/
|
|
199
|
-
data: PropTypes.arrayOf(PropTypes.shape(Option.propTypes)).isRequired,
|
|
200
|
-
/**
|
|
201
|
-
* For value you need to send id selectable options id,
|
|
202
|
-
* and if you select the nested option, then you need to send the id to the hierarchy.
|
|
203
|
-
* example => 'item_1/item_1_1'
|
|
204
|
-
*/
|
|
205
|
-
value: PropTypes.string.isRequired,
|
|
206
|
-
/**
|
|
207
|
-
* onChange handler is called by clicking on the option
|
|
208
|
-
* This callback gives you the option you clicked on and its id and
|
|
209
|
-
* if it is nested then the give and parent option id are associated with a forward slash.
|
|
210
|
-
* (id: NavigationMenu.value, item: Option) => void
|
|
211
|
-
*/
|
|
212
|
-
onChange: PropTypes.func,
|
|
213
|
-
/**
|
|
214
|
-
* Disabled status for the navigation menu button
|
|
215
|
-
*/
|
|
216
|
-
disabled: PropTypes.bool
|
|
217
|
-
};
|
|
218
|
-
NavigationMenu.defaultProps = {
|
|
219
|
-
onChange: noop
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export { NavigationMenu as default };
|