@geneui/components 2.11.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.
Files changed (154) hide show
  1. package/ActionableList.js +1761 -0
  2. package/AdvancedSearch.js +872 -0
  3. package/Alert.js +98 -0
  4. package/Avatar.js +77 -0
  5. package/Badge.js +76 -0
  6. package/Breadcrumb.js +128 -0
  7. package/BusyLoader.js +69 -0
  8. package/Button.js +130 -0
  9. package/CHANGELOG.md +424 -0
  10. package/Card.js +513 -0
  11. package/CardList.js +705 -0
  12. package/CellMeasurerCache-c11cec83.js +229 -0
  13. package/Charts.js +99 -0
  14. package/Checkbox.js +232 -0
  15. package/CheckboxGroup.js +206 -0
  16. package/CheckboxGroupWithSearch.js +279 -0
  17. package/Collapse.js +196 -0
  18. package/ColorPicker.js +210 -0
  19. package/ComboBox.js +99 -0
  20. package/Counter.js +99 -0
  21. package/DateFilter.js +179 -0
  22. package/DatePicker.js +1231 -0
  23. package/DatePickerInput.js +30 -0
  24. package/Divider.js +56 -0
  25. package/Drawer.js +264 -0
  26. package/Dropdown.js +99 -0
  27. package/Editor.js +22965 -0
  28. package/Empty.js +132 -0
  29. package/ExtendedInput.js +578 -0
  30. package/Form.js +116 -0
  31. package/FormContainer.js +189 -0
  32. package/FormableCheckbox.js +27 -0
  33. package/FormableDatePicker.js +39 -0
  34. package/FormableDropdown.js +105 -0
  35. package/FormableEditor.js +24 -0
  36. package/FormableHOC-21051057.js +83 -0
  37. package/FormableMultiSelectDropdown.js +105 -0
  38. package/FormableNumberInput.js +31 -0
  39. package/FormableRadio.js +23 -0
  40. package/FormableSwitcher.js +23 -0
  41. package/FormableTextInput.js +31 -0
  42. package/FormableUploader.js +40 -0
  43. package/GeneUIProvider.js +256 -0
  44. package/Grid.js +166 -0
  45. package/Holder.js +99 -0
  46. package/Icon.js +63 -0
  47. package/Image.js +130 -0
  48. package/ImagePreview.js +99 -0
  49. package/KeyValue.js +63 -0
  50. package/Label.js +58 -0
  51. package/LinkButton.js +104 -0
  52. package/Menu.js +277 -0
  53. package/MobileNavigation.js +95 -0
  54. package/MobilePopup.js +180 -0
  55. package/Modal.js +251 -0
  56. package/ModuleTitle.js +99 -0
  57. package/NavigationMenu.js +212 -0
  58. package/Notification.js +120 -0
  59. package/Option.js +186 -0
  60. package/Overlay.js +99 -0
  61. package/Overspread.js +343 -0
  62. package/Pagination.js +258 -0
  63. package/Paper.js +97 -0
  64. package/Popover-f4d1cac0.js +411 -0
  65. package/Popover.js +20 -0
  66. package/PopoverV2.js +19 -0
  67. package/Portal.js +58 -0
  68. package/Products.js +115 -0
  69. package/Profile.js +99 -0
  70. package/Progress.js +200 -0
  71. package/QRCode.js +816 -0
  72. package/README.md +90 -0
  73. package/Radio.js +152 -0
  74. package/RadioGroup.js +105 -0
  75. package/Range.js +14 -0
  76. package/RichEditor-b7928765.js +228 -0
  77. package/RichEditor.js +13 -0
  78. package/Scrollbar.js +1587 -0
  79. package/Search.js +72 -0
  80. package/SearchWithDropdown.js +195 -0
  81. package/Section.js +62 -0
  82. package/SkeletonLoader.js +82 -0
  83. package/Slider.js +256 -0
  84. package/Status.js +104 -0
  85. package/Steps.js +312 -0
  86. package/SuggestionList.js +15 -0
  87. package/Switcher.js +194 -0
  88. package/Table.js +102 -0
  89. package/TableCompositions.js +17028 -0
  90. package/Tabs.js +236 -0
  91. package/Tag.js +103 -0
  92. package/TextLink.js +22 -0
  93. package/Textarea.js +239 -0
  94. package/Time.js +63 -0
  95. package/TimePicker.js +99 -0
  96. package/Timeline.js +114 -0
  97. package/Title.js +66 -0
  98. package/Toaster.js +116 -0
  99. package/Tooltip.js +157 -0
  100. package/TransferList.js +502 -0
  101. package/Uploader.js +32 -0
  102. package/ValidatableCheckbox.js +126 -0
  103. package/ValidatableDatePicker.js +312 -0
  104. package/ValidatableDropdown.js +99 -0
  105. package/ValidatableElements.js +99 -0
  106. package/ValidatableMultiSelectDropdown.js +99 -0
  107. package/ValidatableNumberInput.js +194 -0
  108. package/ValidatableRadio.js +117 -0
  109. package/ValidatableSwitcher.js +94 -0
  110. package/ValidatableTextInput.js +164 -0
  111. package/ValidatableTimeInput.js +171 -0
  112. package/ValidatableUploader.js +94 -0
  113. package/Widget.js +99 -0
  114. package/_commonjsHelpers-24198af3.js +35 -0
  115. package/_rollupPluginBabelHelpers-e8fb2e5c.js +16 -0
  116. package/checkTimeValidation-e56771be.js +16 -0
  117. package/checkboxRadioSwitcher-5b69d7bd.js +4 -0
  118. package/clsx.m-2bb6df4b.js +3 -0
  119. package/configs-91c86664.js +96 -0
  120. package/configs.js +131 -0
  121. package/dateValidation-67caec66.js +225 -0
  122. package/debounce-4419bc2f.js +17 -0
  123. package/globalStyling-9c60a159.js +4 -0
  124. package/guid-8ddf77b3.js +16 -0
  125. package/index-00fe8887.js +193 -0
  126. package/index-0cf65939.js +30991 -0
  127. package/index-122432cd.js +270 -0
  128. package/index-262edd7a.js +77 -0
  129. package/index-5cea9a7d.js +407 -0
  130. package/index-5e722d91.js +867 -0
  131. package/index-67f4d4d1.js +6568 -0
  132. package/index-6ff23041.js +66 -0
  133. package/index-702bf24a.js +1938 -0
  134. package/index-a4635754.js +329 -0
  135. package/index-a59530cd.js +4 -0
  136. package/index-ac59cb10.js +169 -0
  137. package/index-b7a33c58.js +11 -0
  138. package/index-d9e8a888.js +987 -0
  139. package/index-e0af0caf.js +1182 -0
  140. package/index-e8776f3d.js +807 -0
  141. package/index.js +128 -0
  142. package/localization-4ba17032.js +46 -0
  143. package/objectWithoutPropertiesLoose-299691d8.js +78 -0
  144. package/package.json +190 -0
  145. package/rangeAndSlider-20599da4.js +8839 -0
  146. package/react-beautiful-dnd.esm-38c37304.js +10117 -0
  147. package/style-inject.es-746bb8ed.js +28 -0
  148. package/useClickOutside-5183e396.js +25 -0
  149. package/useDeviceType-dd51db38.js +15 -0
  150. package/useEllipsisDetection-ef536015.js +23 -0
  151. package/useKeyDown-38102ae7.js +21 -0
  152. package/useMount-6fef51a5.js +9 -0
  153. package/useWidth-9f4647f8.js +15 -0
  154. package/useWindowSize-80369d76.js +33 -0
package/Modal.js ADDED
@@ -0,0 +1,251 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default, { useRef, useState, useCallback } from 'react';
3
+ import { c as classnames } from './index-6ff23041.js';
4
+ import { p as propTypesExports } from './index-e0af0caf.js';
5
+ import { n as noop } from './index-ac59cb10.js';
6
+ import { u as useKeyDown } from './useKeyDown-38102ae7.js';
7
+ import './configs-91c86664.js';
8
+ import Button from './Button.js';
9
+ import Portal from './Portal.js';
10
+ import './globalStyling-9c60a159.js';
11
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
12
+ import './dateValidation-67caec66.js';
13
+ import './_commonjsHelpers-24198af3.js';
14
+ import 'react-dom';
15
+ import './Icon.js';
16
+ import './GeneUIProvider.js';
17
+
18
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .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.11.0\"] .modal-splash.p-top{padding-top:0}[data-gene-ui-version=\"2.11.0\"] .modal-splash.p-bottom{padding-bottom:0}[data-gene-ui-version=\"2.11.0\"] .modal-splash.light-background{background:#fff9}[data-gene-ui-version=\"2.11.0\"] .modal-splash.dark-background{background:#0006}[data-gene-ui-version=\"2.11.0\"] .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.11.0\"] .modal-content.s-default{width:35rem}[data-gene-ui-version=\"2.11.0\"] .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.11.0\"] .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.11.0\"] .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.11.0\"] .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.11.0\"] .modal-head .modal-close{top:50%;transform:translateY(-50%)}[data-gene-ui-version=\"2.11.0\"] .a-compact .modal-head{border-bottom:0;line-height:1.6rem;margin:2.6rem 0 .6rem;min-height:inherit}[data-gene-ui-version=\"2.11.0\"] .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.11.0\"] .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.11.0\"] .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: propTypesExports.bool,
135
+ /**
136
+ * Controls modal size
137
+ */
138
+ size: propTypesExports.oneOf(sizes),
139
+ /**
140
+ * Controls background color of modal
141
+ */
142
+ background: propTypesExports.oneOf(backgrounds),
143
+ /**
144
+ * Controls divider between modal's header and body
145
+ */
146
+ appearance: propTypesExports.oneOf(appearances),
147
+ /**
148
+ * Controls modal position on screen
149
+ */
150
+ position: propTypesExports.oneOf(positions),
151
+ /**
152
+ * Displays close button on modal,
153
+ * Fires onCancel function when clicked
154
+ */
155
+ closable: propTypesExports.bool,
156
+ /**
157
+ * Disables footer in modal
158
+ */
159
+ disableFooter: propTypesExports.bool,
160
+ /**
161
+ * Enables footers Ok button in modal
162
+ */
163
+ isOkActive: propTypesExports.bool,
164
+ /**
165
+ * Custom text for cancel button
166
+ */
167
+ cancelText: propTypesExports.string,
168
+ /**
169
+ * Custom text for ok button
170
+ */
171
+ okText: propTypesExports.string,
172
+ /**
173
+ * Custom title for modal
174
+ */
175
+ title: propTypesExports.any,
176
+ /**
177
+ * Wraps component with Portal component if [true]
178
+ */
179
+ withPortal: propTypesExports.bool,
180
+ portalContainer: propTypesExports.any,
181
+ /**
182
+ * Custom value to override default css value
183
+ */
184
+ width: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.number]),
185
+ /**
186
+ * Custom zIndex value to overRide default css value
187
+ */
188
+ zIndex: propTypesExports.number,
189
+ /**
190
+ * Valid React elements for modal body
191
+ */
192
+ children: propTypesExports.node,
193
+ /**
194
+ * Additional classname
195
+ */
196
+ className: propTypesExports.string,
197
+ /**
198
+ * Fires event when user clicks on ok button
199
+ * (event: Event) => void
200
+ */
201
+ onOK: propTypesExports.func,
202
+ /**
203
+ * Fires event when user clicks on Cancel button
204
+ * (event: Event) => void
205
+ */
206
+ onCancel: propTypesExports.func,
207
+ /**
208
+ * Custom footer element for modal
209
+ */
210
+ footer: propTypesExports.element,
211
+ /**
212
+ * Pass [true] if you need to hide a modal when people click outside of it's content
213
+ */
214
+ closeOnClickOutside: propTypesExports.bool,
215
+ /**
216
+ * Custom action elements for modal's header
217
+ */
218
+ customActions: propTypesExports.node,
219
+ /**
220
+ * Enable keyboard Enter
221
+ */
222
+ needEnter: propTypesExports.bool,
223
+ /**
224
+ * Fires event when user clicks on Close icon
225
+ * (event: Event) => void
226
+ */
227
+ onClose: propTypesExports.func,
228
+ /**
229
+ * Loader for ok button
230
+ */
231
+ isOkButtonLoading: propTypesExports.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.js ADDED
@@ -0,0 +1,99 @@
1
+ import './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import 'react';
3
+ import './index-e0af0caf.js';
4
+ import './index-6ff23041.js';
5
+ import './configs-91c86664.js';
6
+ import './index-ac59cb10.js';
7
+ import './Icon.js';
8
+ import './globalStyling-9c60a159.js';
9
+ export { M as default } from './index-0cf65939.js';
10
+ import './Grid.js';
11
+ import './Tabs.js';
12
+ import './Steps.js';
13
+ import './Timeline.js';
14
+ import './RadioGroup.js';
15
+ import './Checkbox.js';
16
+ import './Card.js';
17
+ import './Tag.js';
18
+ import './Alert.js';
19
+ import './Tooltip.js';
20
+ import './index-00fe8887.js';
21
+ import './Slider.js';
22
+ import './Pagination.js';
23
+ import './ExtendedInput.js';
24
+ import './Editor.js';
25
+ import './ValidatableUploader.js';
26
+ import './ValidatableRadio.js';
27
+ import './ValidatableCheckbox.js';
28
+ import './ValidatableSwitcher.js';
29
+ import './ValidatableNumberInput.js';
30
+ import './ValidatableTextInput.js';
31
+ import './ValidatableDatePicker.js';
32
+ import './Notification.js';
33
+ import './Modal.js';
34
+ import './Collapse.js';
35
+ import './Status.js';
36
+ import './Menu.js';
37
+ import './Progress.js';
38
+ import './MobileNavigation.js';
39
+ import './MobilePopup.js';
40
+ import './index-d9e8a888.js';
41
+ import './Products.js';
42
+ import './Search.js';
43
+ import './index-5e722d91.js';
44
+ import './Breadcrumb.js';
45
+ import './Section.js';
46
+ import './ColorPicker.js';
47
+ import './NavigationMenu.js';
48
+ import './Textarea.js';
49
+ import './AdvancedSearch.js';
50
+ import './dateValidation-67caec66.js';
51
+ import './_commonjsHelpers-24198af3.js';
52
+ import 'react-dom';
53
+ import './style-inject.es-746bb8ed.js';
54
+ import './useEllipsisDetection-ef536015.js';
55
+ import './Switcher.js';
56
+ import './useKeyDown-38102ae7.js';
57
+ import './checkboxRadioSwitcher-5b69d7bd.js';
58
+ import './guid-8ddf77b3.js';
59
+ import './useMount-6fef51a5.js';
60
+ import './objectWithoutPropertiesLoose-299691d8.js';
61
+ import './rangeAndSlider-20599da4.js';
62
+ import './clsx.m-2bb6df4b.js';
63
+ import './useDeviceType-dd51db38.js';
64
+ import './useWindowSize-80369d76.js';
65
+ import './useClickOutside-5183e396.js';
66
+ import './index-a4635754.js';
67
+ import './Popover-f4d1cac0.js';
68
+ import './index-122432cd.js';
69
+ import './GeneUIProvider.js';
70
+ import './Portal.js';
71
+ import './Scrollbar.js';
72
+ import './index-5cea9a7d.js';
73
+ import './BusyLoader.js';
74
+ import './index-702bf24a.js';
75
+ import './debounce-4419bc2f.js';
76
+ import './Empty.js';
77
+ import './index-a59530cd.js';
78
+ import './Button.js';
79
+ import './Divider.js';
80
+ import './Avatar.js';
81
+ import './TextLink.js';
82
+ import './Label.js';
83
+ import './Radio.js';
84
+ import './Paper.js';
85
+ import './Badge.js';
86
+ import './configs.js';
87
+ import './SkeletonLoader.js';
88
+ import './Time.js';
89
+ import './localization-4ba17032.js';
90
+ import './Title.js';
91
+ import './Image.js';
92
+ import './KeyValue.js';
93
+ import './Option.js';
94
+ import './index-b7a33c58.js';
95
+ import './QRCode.js';
96
+ import './useWidth-9f4647f8.js';
97
+ import './checkTimeValidation-e56771be.js';
98
+ import './DatePicker.js';
99
+ import './LinkButton.js';
@@ -0,0 +1,212 @@
1
+ import React__default, { memo, useState, useRef, useMemo, useCallback, useEffect } from 'react';
2
+ import { p as propTypesExports } from './index-e0af0caf.js';
3
+ import { n as noop } from './index-ac59cb10.js';
4
+ import Icon from './Icon.js';
5
+ import Option from './Option.js';
6
+ import { P as Popover } from './index-a4635754.js';
7
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
8
+ import './dateValidation-67caec66.js';
9
+ import { d as debounce } from './debounce-4419bc2f.js';
10
+ import 'react-dom';
11
+ import { u as useDeviceType } from './useDeviceType-dd51db38.js';
12
+ import Menu from './Menu.js';
13
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
14
+ import './index-6ff23041.js';
15
+ import './globalStyling-9c60a159.js';
16
+ import './configs-91c86664.js';
17
+ import './useEllipsisDetection-ef536015.js';
18
+ import './Tooltip.js';
19
+ import './Popover-f4d1cac0.js';
20
+ import './_commonjsHelpers-24198af3.js';
21
+ import './GeneUIProvider.js';
22
+ import './useWindowSize-80369d76.js';
23
+ import './index-122432cd.js';
24
+ import './Portal.js';
25
+ import './Scrollbar.js';
26
+ import './guid-8ddf77b3.js';
27
+
28
+ const getTitle = (id, data) => {
29
+ if (data) {
30
+ const matchedDatum = data.find(datum => datum.id === id);
31
+ return matchedDatum && matchedDatum.title ? matchedDatum.title : data.map(datum => getTitle(id, datum.data)).filter(Boolean)[0];
32
+ }
33
+ };
34
+ const getTitlesArray = (ids, data) => ids.map(id => getTitle(id, data)).filter(Boolean);
35
+ const navigationOptionsToMenuMenu = navigationOptions => navigationOptions.map(_ref => {
36
+ let {
37
+ data,
38
+ ...rest
39
+ } = _ref;
40
+ return {
41
+ ...rest,
42
+ ...(data ? {
43
+ children: navigationOptionsToMenuMenu(data)
44
+ } : {})
45
+ };
46
+ });
47
+ const indexStackFromItems = (stack, items, selectedItemId) => {
48
+ if (!(items !== null && items !== void 0 && items.length)) {
49
+ return [];
50
+ }
51
+ for (const itemIndex in items) {
52
+ const item = items[itemIndex];
53
+ if (item.id === selectedItemId) {
54
+ return stack;
55
+ }
56
+ if (item.children) {
57
+ const currentIndexStack = indexStackFromItems([...stack, Number(itemIndex)], item.children, selectedItemId);
58
+ if (currentIndexStack.length) {
59
+ return currentIndexStack;
60
+ }
61
+ }
62
+ }
63
+ return [];
64
+ };
65
+
66
+ function NavigationMenuContent(_ref) {
67
+ let {
68
+ depth,
69
+ path,
70
+ options,
71
+ onChange,
72
+ splitedValue
73
+ } = _ref;
74
+ const [activeItem, setActiveItem] = useState();
75
+ const navigationRef = useRef(null);
76
+ const isHovered = useRef(true);
77
+ const optionId = useMemo(() => splitedValue === null || splitedValue === void 0 ? void 0 : splitedValue[depth], [depth, splitedValue]);
78
+ const isActiveItem = useMemo(() => (activeItem === null || activeItem === void 0 ? void 0 : activeItem.id) && optionId === activeItem.id, [activeItem, optionId]);
79
+ const mobileOptions = useMemo(() => options ? navigationOptionsToMenuMenu(options) : undefined, [options]);
80
+ const initialIndexStack = useMemo(() => indexStackFromItems([], mobileOptions, optionId), [mobileOptions, activeItem]);
81
+ const {
82
+ isMobile
83
+ } = useDeviceType();
84
+ const onMouseEnterHandler = useCallback(debounce(_ref2 => {
85
+ let {
86
+ isColaps,
87
+ item
88
+ } = _ref2;
89
+ if (!isHovered.current) return;
90
+ isColaps ? setActiveItem(item) : setActiveItem(null);
91
+ }, 200), [isHovered, setActiveItem]);
92
+ useEffect(() => {
93
+ if (optionId && options !== null && options !== void 0 && options.length) {
94
+ const item = options.find(item => item.id === optionId);
95
+ item && setActiveItem(item);
96
+ }
97
+ }, [optionId, options]);
98
+ const onItemClick = item => {
99
+ onChange(path ? "".concat(path, "/").concat(item.id) : item.id, item);
100
+ setActiveItem(item);
101
+ };
102
+ if (isMobile) {
103
+ return /*#__PURE__*/React__default.createElement(Menu, {
104
+ data: mobileOptions,
105
+ onSelect: (_, item) => onItemClick(item),
106
+ selectedItem: activeItem,
107
+ initialIndexStack: initialIndexStack
108
+ });
109
+ }
110
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, (options === null || options === void 0 ? void 0 : options.length) > 0 && /*#__PURE__*/React__default.createElement("div", {
111
+ className: "bc-navigation-menu_content-menu",
112
+ ref: navigationRef,
113
+ onMouseEnter: () => isHovered.current = true,
114
+ onMouseLeave: () => isHovered.current = false
115
+ }, options.map(item => {
116
+ const isColaps = !!(item.data && item.data.length);
117
+ return item.isHidden !== true && /*#__PURE__*/React__default.createElement(Option, _extends({}, item, {
118
+ key: item.id,
119
+ active: optionId === item.id,
120
+ forwardMark: isColaps,
121
+ onClick: () => !isColaps && onItemClick(item),
122
+ onMouseEnter: () => onMouseEnterHandler({
123
+ isColaps,
124
+ item
125
+ })
126
+ }));
127
+ })), activeItem && /*#__PURE__*/React__default.createElement(NavigationMenuContent, {
128
+ depth: depth + 1,
129
+ path: path ? "".concat(path, "/").concat(activeItem.id) : activeItem.id,
130
+ options: activeItem.data,
131
+ onChange: onChange,
132
+ splitedValue: isActiveItem && splitedValue
133
+ }));
134
+ }
135
+ NavigationMenuContent.defaultProps = {
136
+ depth: 0
137
+ };
138
+ var NavigationMenuContent$1 = /*#__PURE__*/memo(NavigationMenuContent);
139
+
140
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .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.11.0\"] .bc-navigation-menu:hover{background:#ffffff1a}}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu.active{background:#ffffff1a}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu:disabled{opacity:.5;pointer-events:none}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu_head{align-items:center;display:flex;justify-content:center;pointer-events:none}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu_layer{align-items:center;display:flex;margin:0 .8rem;opacity:.7}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu_layer:last-child{opacity:1}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu_layer:not(.bc-navigation-menu_layer:last-child):after{background-color:#fff;content:\"\";display:block;height:2.3rem;margin-left:1.5rem;transform:rotate(15deg);width:1px}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu_layer.active{opacity:1}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu_content{display:flex;padding:1rem 0}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu_content-menu{width:25.8rem}[data-gene-ui-version=\"2.11.0\"] .bc-navigation-menu_content-menu:not(.bc-navigation-menu_content-menu:last-child){border-right:1px solid #0000001a}";
141
+ styleInject(css_248z);
142
+
143
+ function NavigationMenu(_ref) {
144
+ let {
145
+ data,
146
+ value,
147
+ onChange,
148
+ disabled
149
+ } = _ref;
150
+ const [isOpen, setIsOpen] = useState(false);
151
+ const splitedValue = useMemo(() => value && value.split('/').filter(Boolean), [value]);
152
+ const title = useMemo(() => getTitlesArray(splitedValue, data), [splitedValue, data]);
153
+ const handleChange = useCallback(function () {
154
+ setIsOpen(false);
155
+ onChange(...arguments);
156
+ }, [onChange]);
157
+ const handleToggle = useCallback(() => setIsOpen(prev => !prev), []);
158
+ return /*#__PURE__*/React__default.createElement(Popover, {
159
+ isOpen: isOpen,
160
+ extendTargetWidth: false,
161
+ toggleHandler: handleToggle,
162
+ fullHeight: true,
163
+ children: /*#__PURE__*/React__default.createElement("button", {
164
+ className: "bc-navigation-menu",
165
+ disabled: disabled
166
+ }, /*#__PURE__*/React__default.createElement("div", {
167
+ className: "bc-navigation-menu_head"
168
+ }, title.map((item, index) => /*#__PURE__*/React__default.createElement("span", {
169
+ key: index,
170
+ className: "bc-navigation-menu_layer"
171
+ }, item))), /*#__PURE__*/React__default.createElement(Icon, {
172
+ type: "bc-icon-arrow-down"
173
+ })),
174
+ Content: /*#__PURE__*/React__default.createElement("div", {
175
+ className: "bc-navigation-menu_content"
176
+ }, /*#__PURE__*/React__default.createElement(NavigationMenuContent$1, {
177
+ options: data,
178
+ onChange: handleChange,
179
+ splitedValue: splitedValue
180
+ }))
181
+ });
182
+ }
183
+ NavigationMenu.propTypes = {
184
+ /**
185
+ * This is where you send data (options) for the menu, if you need to send
186
+ * nested options, send the date to the option in the same structure as the options.
187
+ * example => data={[{ id: 'item_1', title: 'Item 1', isHidden: false, data: [ { id: 'item_1_1', title: 'Item 1.1', isHidden: false } ]}]}
188
+ */
189
+ data: propTypesExports.arrayOf(propTypesExports.shape(Option.propTypes)).isRequired,
190
+ /**
191
+ * For value you need to send id selectable options id,
192
+ * and if you select the nested option, then you need to send the id to the hierarchy.
193
+ * example => 'item_1/item_1_1'
194
+ */
195
+ value: propTypesExports.string.isRequired,
196
+ /**
197
+ * onChange handler is called by clicking on the option
198
+ * This callback gives you the option you clicked on and its id and
199
+ * if it is nested then the give and parent option id are associated with a forward slash.
200
+ * (id: NavigationMenu.value, item: Option) => void
201
+ */
202
+ onChange: propTypesExports.func,
203
+ /**
204
+ * Disabled status for the navigation menu button
205
+ */
206
+ disabled: propTypesExports.bool
207
+ };
208
+ NavigationMenu.defaultProps = {
209
+ onChange: noop
210
+ };
211
+
212
+ export { NavigationMenu as default };
@@ -0,0 +1,120 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default from 'react';
3
+ import { c as classnames } from './index-6ff23041.js';
4
+ import { p as propTypesExports } from './index-e0af0caf.js';
5
+ import './dateValidation-67caec66.js';
6
+ import 'react-dom';
7
+ import { u as useDeviceType } from './useDeviceType-dd51db38.js';
8
+ import { s as screenTypes } from './configs-91c86664.js';
9
+ import Icon from './Icon.js';
10
+ import './globalStyling-9c60a159.js';
11
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
12
+ import './_commonjsHelpers-24198af3.js';
13
+ import './useWindowSize-80369d76.js';
14
+
15
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .notifier-block{align-items:flex-start;background:var(--background);border:1px solid rgba(var(--background-sc-rgb),.1);border-radius:1rem;box-shadow:0 .2rem .4rem 0 #0000001a;cursor:pointer;display:flex;height:8.5rem;transition:border-color .3s;width:100%}[data-gene-ui-version=\"2.11.0\"] .notifier-block.mobile-view{border-radius:0;border-width:0 0 1px;box-shadow:none}[data-gene-ui-version=\"2.11.0\"] .notifier-block>li{flex-shrink:0}[data-gene-ui-version=\"2.11.0\"] .notifier-block>li.notifier-icon{align-self:stretch}[data-gene-ui-version=\"2.11.0\"] .notifier-block>li.notifier-content{flex:auto;overflow:hidden;padding:1.2rem 1.4rem;width:10rem}[data-gene-ui-version=\"2.11.0\"] .notifier-block>li.notifier-action{padding:1rem 1.5rem 0 0}html[dir=rtl] .notifier-block>li.notifier-action{padding:1rem 0 0 1.5rem}[data-gene-ui-version=\"2.11.0\"] .notifier-block>li.notifier-action .icon{cursor:pointer}@media (hover:hover){[data-gene-ui-version=\"2.11.0\"] .notifier-block>li.notifier-action .icon:hover{color:var(--hero)}[data-gene-ui-version=\"2.11.0\"] .notifier-block:hover{border-color:var(--hero)}}[data-gene-ui-version=\"2.11.0\"] .notifier-icon{align-items:center;background:rgba(var(--hero-rgb),.28);border-radius:.9rem 0 0 .9rem;color:var(--background);display:flex;font-size:4.2rem;justify-content:center;width:8.5rem}html[dir=rtl] .notifier-icon{border-radius:0 .9rem .9rem 0}[data-gene-ui-version=\"2.11.0\"] .notifier-block.mobile-view .notifier-icon{border-radius:0}[data-gene-ui-version=\"2.11.0\"] .type-clean .notifier-icon{background:none;color:rgba(var(--hero-rgb),.48)}html:not([dir=rtl]) .type-clean .notifier-icon{border-right:1px solid rgba(var(--background-sc-rgb),.1)}html[dir=rtl] .type-clean .notifier-icon{border-left:1px solid rgba(var(--background-sc-rgb),.1)}[data-gene-ui-version=\"2.11.0\"] .notifier-title{font:600 1.4rem/1.36 var(--font-family);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[data-gene-ui-version=\"2.11.0\"] .notifier-c-t{margin:.8rem 0 0}[data-gene-ui-version=\"2.11.0\"] .notifier-c-t>ul{display:grid;font:600 1.2rem/1.42 var(--font-family);grid-template-areas:\"c1 c2\";grid-template-columns:auto 1fr}[data-gene-ui-version=\"2.11.0\"] .notifier-c-t>ul>li{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[data-gene-ui-version=\"2.11.0\"] .notifier-c-t>ul>li:first-child{grid-area:c1;opacity:.5;width:6.4rem}[data-gene-ui-version=\"2.11.0\"] .notifier-c-t>ul>li:nth-child(2){grid-area:c2}";
16
+ styleInject(css_248z);
17
+
18
+ const notificationTypes = ['default', 'clean'];
19
+ function Notification(_ref) {
20
+ let {
21
+ type,
22
+ onClose,
23
+ closable,
24
+ content,
25
+ title,
26
+ heading,
27
+ className,
28
+ screenType,
29
+ additionalHeading,
30
+ notificationIcon,
31
+ onContentClick,
32
+ description,
33
+ additionalDescription,
34
+ ...restProps
35
+ } = _ref;
36
+ const {
37
+ isMobile
38
+ } = useDeviceType(screenType);
39
+ return /*#__PURE__*/React__default.createElement("ul", _extends({
40
+ onClick: onContentClick,
41
+ className: classnames('notifier-block', className, "type-".concat(type), {
42
+ 'mobile-view': isMobile
43
+ })
44
+ }, restProps), type && /*#__PURE__*/React__default.createElement("li", {
45
+ className: classnames('notifier-icon', notificationIcon)
46
+ }), /*#__PURE__*/React__default.createElement("li", {
47
+ className: "notifier-content"
48
+ }, /*#__PURE__*/React__default.createElement("div", {
49
+ className: "notifier-title"
50
+ }, title), content || /*#__PURE__*/React__default.createElement("div", {
51
+ className: "notifier-c-t"
52
+ }, heading && /*#__PURE__*/React__default.createElement("ul", null, /*#__PURE__*/React__default.createElement("li", null, /*#__PURE__*/React__default.createElement("span", null, heading)), /*#__PURE__*/React__default.createElement("li", null, description)), additionalHeading && /*#__PURE__*/React__default.createElement("ul", null, /*#__PURE__*/React__default.createElement("li", null, /*#__PURE__*/React__default.createElement("span", null, additionalHeading)), /*#__PURE__*/React__default.createElement("li", null, additionalDescription)))), closable && /*#__PURE__*/React__default.createElement("li", {
53
+ className: "notifier-action",
54
+ onClick: onClose
55
+ }, /*#__PURE__*/React__default.createElement(Icon, {
56
+ type: "bc-icon-close"
57
+ })));
58
+ }
59
+ Notification.propTypes = {
60
+ /**
61
+ * Type of the Notification component.
62
+ */
63
+ type: propTypesExports.oneOf(notificationTypes),
64
+ /**
65
+ * If true displays close button
66
+ */
67
+ closable: propTypesExports.bool,
68
+ /**
69
+ * CSS class name for element
70
+ */
71
+ className: propTypesExports.string,
72
+ /**
73
+ * Fires event when user clicks on close button
74
+ * (event: Event) => void
75
+ */
76
+ onClose: propTypesExports.func,
77
+ /**
78
+ * Custom content form notification
79
+ */
80
+ content: propTypesExports.element,
81
+ /**
82
+ * Fires when user click on notification modal
83
+ * (event: Event) => void
84
+ */
85
+ onContentClick: propTypesExports.func,
86
+ /**
87
+ * Heading text for notification modal
88
+ */
89
+ heading: propTypesExports.string,
90
+ /**
91
+ * Descriptions text fro notification
92
+ */
93
+ description: propTypesExports.string,
94
+ /**
95
+ * Controls screen type
96
+ */
97
+ screenType: propTypesExports.oneOf(screenTypes),
98
+ /**
99
+ * Additional heading text for notification
100
+ */
101
+ additionalHeading: propTypesExports.string,
102
+ /**
103
+ * Notification icon
104
+ */
105
+ notificationIcon: propTypesExports.string.isRequired,
106
+ /**
107
+ * Additional info for notification
108
+ */
109
+ additionalDescription: propTypesExports.string,
110
+ /**
111
+ * Title for notification
112
+ */
113
+ title: propTypesExports.string.isRequired
114
+ };
115
+ Notification.defaultProps = {
116
+ type: notificationTypes[0],
117
+ closable: false
118
+ };
119
+
120
+ export { Notification as default, notificationTypes };