@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/Time.js ADDED
@@ -0,0 +1,63 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default, { useMemo, useState, useEffect } from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { a as dayjs, d as dayjsWithPlugins } from './dateValidation-67caec66.js';
5
+ import { a as getBrowserTimeFormat } from './localization-4ba17032.js';
6
+ import 'react-dom';
7
+ import Icon from './Icon.js';
8
+ import './globalStyling-9c60a159.js';
9
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
10
+ import './_commonjsHelpers-24198af3.js';
11
+ import './index-6ff23041.js';
12
+
13
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .time-holder{align-items:center;display:flex;font-weight:600;line-height:3.2rem;white-space:nowrap}[data-gene-ui-version=\"2.11.0\"] .time-holder>*+*{margin:0 0 0 .3rem}html[dir=rtl] .time-holder>*+*{margin:0 .3rem 0 0}";
14
+ styleInject(css_248z);
15
+
16
+ function Time(_ref) {
17
+ let {
18
+ format,
19
+ showIcon,
20
+ startDate,
21
+ showSeconds,
22
+ ...restProps
23
+ } = _ref;
24
+ const startDateValue = useMemo(() => startDate && dayjs(startDate), [startDate]);
25
+ const difference = useMemo(() => startDateValue ? startDateValue.diff(dayjs()) : 0, [startDateValue]);
26
+ const [time, setTime] = useState(() => Date.now() + difference);
27
+ const timeFormat = format || getBrowserTimeFormat(showSeconds);
28
+ useEffect(() => {
29
+ const intervalId = setInterval(() => {
30
+ setTime(Date.now() + difference);
31
+ }, 1000);
32
+ return () => clearInterval(intervalId);
33
+ }, [difference]);
34
+ return /*#__PURE__*/React__default.createElement("div", _extends({
35
+ className: "time-holder"
36
+ }, restProps), showIcon && /*#__PURE__*/React__default.createElement(Icon, {
37
+ type: "bc-icon-clock"
38
+ }), /*#__PURE__*/React__default.createElement("p", null, dayjsWithPlugins(time).format(timeFormat)));
39
+ }
40
+ Time.propTypes = {
41
+ /**
42
+ * Displays a clock icon when set to "true"
43
+ */
44
+ showIcon: propTypesExports.bool,
45
+ /**
46
+ * Display format
47
+ */
48
+ format: propTypesExports.string,
49
+ /**
50
+ * Display seconds when set to "true"
51
+ */
52
+ showSeconds: propTypesExports.bool,
53
+ /**
54
+ * Specifing this prop will make the Time atom a counter starting from "startDate"
55
+ */
56
+ startDate: propTypesExports.oneOfType([propTypesExports.instanceOf(dayjs), propTypesExports.instanceOf(Date), propTypesExports.string, propTypesExports.number])
57
+ };
58
+ Time.defaultProps = {
59
+ showIcon: false,
60
+ showSeconds: true
61
+ };
62
+
63
+ export { Time as default };
package/TimePicker.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 './useDeviceType-dd51db38.js';
8
+ import './Scrollbar.js';
9
+ import './index-a4635754.js';
10
+ import './Icon.js';
11
+ export { T as default } from './index-0cf65939.js';
12
+ import './Editor.js';
13
+ import './ValidatableUploader.js';
14
+ import './ValidatableRadio.js';
15
+ import './ValidatableCheckbox.js';
16
+ import './ValidatableSwitcher.js';
17
+ import './ValidatableNumberInput.js';
18
+ import './ValidatableTextInput.js';
19
+ import './ValidatableDatePicker.js';
20
+ import './ExtendedInput.js';
21
+ import './dateValidation-67caec66.js';
22
+ import './_commonjsHelpers-24198af3.js';
23
+ import 'react-dom';
24
+ import './useWindowSize-80369d76.js';
25
+ import './globalStyling-9c60a159.js';
26
+ import './style-inject.es-746bb8ed.js';
27
+ import './Popover-f4d1cac0.js';
28
+ import './index-122432cd.js';
29
+ import './GeneUIProvider.js';
30
+ import './Portal.js';
31
+ import './guid-8ddf77b3.js';
32
+ import './index-d9e8a888.js';
33
+ import './Grid.js';
34
+ import './useWidth-9f4647f8.js';
35
+ import './Button.js';
36
+ import './useKeyDown-38102ae7.js';
37
+ import './BusyLoader.js';
38
+ import './Image.js';
39
+ import './Empty.js';
40
+ import './Tooltip.js';
41
+ import './Checkbox.js';
42
+ import './checkboxRadioSwitcher-5b69d7bd.js';
43
+ import './useEllipsisDetection-ef536015.js';
44
+ import './Switcher.js';
45
+ import './Tabs.js';
46
+ import './Steps.js';
47
+ import './debounce-4419bc2f.js';
48
+ import './Timeline.js';
49
+ import './RadioGroup.js';
50
+ import './Radio.js';
51
+ import './Card.js';
52
+ import './MobilePopup.js';
53
+ import './useClickOutside-5183e396.js';
54
+ import './Menu.js';
55
+ import './Option.js';
56
+ import './SkeletonLoader.js';
57
+ import './KeyValue.js';
58
+ import './configs.js';
59
+ import './Tag.js';
60
+ import './Alert.js';
61
+ import './index-00fe8887.js';
62
+ import './rangeAndSlider-20599da4.js';
63
+ import './Slider.js';
64
+ import './useMount-6fef51a5.js';
65
+ import './index-5cea9a7d.js';
66
+ import './Pagination.js';
67
+ import './Divider.js';
68
+ import './objectWithoutPropertiesLoose-299691d8.js';
69
+ import './clsx.m-2bb6df4b.js';
70
+ import './index-5e722d91.js';
71
+ import './index-702bf24a.js';
72
+ import './DatePicker.js';
73
+ import './localization-4ba17032.js';
74
+ import './index-a59530cd.js';
75
+ import './Notification.js';
76
+ import './Modal.js';
77
+ import './Collapse.js';
78
+ import './Status.js';
79
+ import './Avatar.js';
80
+ import './Search.js';
81
+ import './TextLink.js';
82
+ import './Label.js';
83
+ import './Paper.js';
84
+ import './Badge.js';
85
+ import './Time.js';
86
+ import './Title.js';
87
+ import './index-b7a33c58.js';
88
+ import './QRCode.js';
89
+ import './Progress.js';
90
+ import './MobileNavigation.js';
91
+ import './Products.js';
92
+ import './Breadcrumb.js';
93
+ import './Section.js';
94
+ import './ColorPicker.js';
95
+ import './NavigationMenu.js';
96
+ import './Textarea.js';
97
+ import './AdvancedSearch.js';
98
+ import './LinkButton.js';
99
+ import './checkTimeValidation-e56771be.js';
package/Timeline.js ADDED
@@ -0,0 +1,114 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { c as classnames } from './index-6ff23041.js';
5
+ import { c as childrenOf } from './index-ac59cb10.js';
6
+ import Icon from './Icon.js';
7
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
8
+ import './globalStyling-9c60a159.js';
9
+ import './dateValidation-67caec66.js';
10
+ import './_commonjsHelpers-24198af3.js';
11
+ import 'react-dom';
12
+
13
+ var css_248z$1 = "[data-gene-ui-version=\"2.11.0\"] .timeline-item{display:flex;font-weight:600;line-height:1.36}[data-gene-ui-version=\"2.11.0\"] .timeline-item.c-success{--hero:var(--confirm);--hero-hover:var(--confirm-hover);--hero-sc:var(--confirm-sc);--hero-rgb:var(--confirm-rgb);--hero-sc-rgb:var(--confirm-sc-rgb)}[data-gene-ui-version=\"2.11.0\"] .timeline-item.c-danger{--hero:var(--danger);--hero-hover:var(--danger-hover);--hero-sc:var(--danger-sc);--hero-rgb:var(--danger-rgb);--hero-sc-rgb:var(--danger-sc-rgb)}[data-gene-ui-version=\"2.11.0\"] .timeline-item:not(:last-child).with-line .t-line:before{background:rgba(var(--background-sc-rgb),.1)}[data-gene-ui-version=\"2.11.0\"] .timeline-item:not(:last-child) .t-texts{padding:0 0 2rem}[data-gene-ui-version=\"2.11.0\"] .timeline-item>li{display:flex}[data-gene-ui-version=\"2.11.0\"] .timeline-item.a-default .t-texts>*+*{margin:0 0 0 1rem}html[dir=rtl] .timeline-item.a-default .t-texts>*+*{margin:0 1rem 0 0}[data-gene-ui-version=\"2.11.0\"] .timeline-item.a-compact .t-texts{flex-direction:column}[data-gene-ui-version=\"2.11.0\"] .timeline-item.a-compact .t-texts>*+*{margin:.5rem 0 0}[data-gene-ui-version=\"2.11.0\"] .timeline-item .t-line{flex-shrink:0;position:relative}[data-gene-ui-version=\"2.11.0\"] .timeline-item .t-line:before{content:\"\";display:block;height:100%;margin:0 .5rem;width:1px}[data-gene-ui-version=\"2.11.0\"] .timeline-item .t-texts{flex:auto;margin:0 0 0 1.5rem}html[dir=rtl] .timeline-item .t-texts{margin:0 1.5rem 0 0}[data-gene-ui-version=\"2.11.0\"] .timeline-item .t-description{color:rgba(var(--background-sc-rgb),.6);font:600 1.2rem/1.8rem var(--font-family)}[data-gene-ui-version=\"2.11.0\"] .timeline-item .t-description,[data-gene-ui-version=\"2.11.0\"] .timeline-item .t-title{max-width:100%}[data-gene-ui-version=\"2.11.0\"] .timeline-item .icon{background:var(--background);border-radius:100%;color:var(--hero);left:50%;position:absolute;top:0;transform:translate3d(-50%,-.3rem,0)}[data-gene-ui-version=\"2.11.0\"] .timeline-item .t-icon{background:var(--background);border:.2rem solid var(--hero);border-radius:100%;box-shadow:0 0 0 .4rem var(--background);font-size:1.5rem;height:1.1rem;left:0;position:absolute;top:.4rem;width:1.1rem}[data-gene-ui-version=\"2.11.0\"] .timeline-item .t-icon.bc-icon-loader{top:.2rem}";
14
+ styleInject(css_248z$1);
15
+
16
+ const timelineColors = ['hero', 'success', 'danger'];
17
+ const timelineAppearances = ['default', 'compact'];
18
+ function TimelineItem(props) {
19
+ const {
20
+ icon,
21
+ title,
22
+ color,
23
+ withLine,
24
+ isLoading,
25
+ className,
26
+ appearance,
27
+ description,
28
+ ...restProps
29
+ } = props;
30
+ return /*#__PURE__*/React__default.createElement("ul", _extends({
31
+ className: classnames('timeline-item', "a-".concat(appearance), "c-".concat(color), className, {
32
+ 'with-line': withLine
33
+ })
34
+ }, restProps), /*#__PURE__*/React__default.createElement("li", {
35
+ className: "t-line"
36
+ }, isLoading ? /*#__PURE__*/React__default.createElement(Icon, {
37
+ type: "bc-icon-loader"
38
+ }) : icon ? /*#__PURE__*/React__default.createElement(Icon, {
39
+ type: icon
40
+ }) : /*#__PURE__*/React__default.createElement("div", {
41
+ className: "t-icon"
42
+ })), /*#__PURE__*/React__default.createElement("li", {
43
+ className: "t-texts"
44
+ }, !!title && /*#__PURE__*/React__default.createElement("div", {
45
+ className: "t-title"
46
+ }, title), !!description && /*#__PURE__*/React__default.createElement("div", {
47
+ className: "t-description"
48
+ }, description)));
49
+ }
50
+ TimelineItem.propTypes = {
51
+ /**
52
+ * Is loading state.
53
+ */
54
+ isLoading: propTypesExports.bool,
55
+ /**
56
+ * Title for item
57
+ */
58
+ title: propTypesExports.string,
59
+ /**
60
+ * Icon for item
61
+ */
62
+ icon: propTypesExports.string,
63
+ /**
64
+ * Render line between items
65
+ */
66
+ withLine: propTypesExports.bool,
67
+ /**
68
+ * Description fot item
69
+ */
70
+ description: propTypesExports.string,
71
+ /**
72
+ * External/Additional className
73
+ */
74
+ className: propTypesExports.string,
75
+ /**
76
+ * Different colors for items
77
+ */
78
+ color: propTypesExports.oneOf(timelineColors),
79
+ /**
80
+ * Any valid React node.
81
+ */
82
+ appearance: propTypesExports.oneOf(timelineAppearances)
83
+ };
84
+ TimelineItem.defaultProps = {
85
+ color: timelineColors[0],
86
+ withLine: true,
87
+ appearance: timelineAppearances[0]
88
+ };
89
+
90
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .timeline-holder{display:flex;flex-direction:column}";
91
+ styleInject(css_248z);
92
+
93
+ function Timeline(props) {
94
+ const {
95
+ children,
96
+ className,
97
+ ...restProps
98
+ } = props;
99
+ return /*#__PURE__*/React__default.createElement("div", _extends({
100
+ className: classnames('timeline-holder', className)
101
+ }, restProps), children);
102
+ }
103
+ Timeline.propTypes = {
104
+ /**
105
+ * External/Additional className
106
+ */
107
+ className: propTypesExports.string,
108
+ /**
109
+ * Any valid React node.
110
+ */
111
+ children: childrenOf([TimelineItem])
112
+ };
113
+
114
+ export { Timeline, TimelineItem, timelineAppearances, timelineColors };
package/Title.js ADDED
@@ -0,0 +1,66 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { c as classnames } from './index-6ff23041.js';
5
+ import { b as titleConfig } from './configs-91c86664.js';
6
+ import Icon from './Icon.js';
7
+ import './globalStyling-9c60a159.js';
8
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
9
+
10
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .title-holder{align-items:center;display:flex;font:600 1.4rem/1.8rem var(--font-family);min-height:3.2rem;width:100%}[data-gene-ui-version=\"2.11.0\"] .title-holder.c-hero .title-text{color:var(--hero)}[data-gene-ui-version=\"2.11.0\"] .title-holder>li{align-items:center;display:flex;flex-shrink:0}[data-gene-ui-version=\"2.11.0\"] .title-holder>li.line{flex:auto}[data-gene-ui-version=\"2.11.0\"] .title-holder>li.line i{background:rgba(var(--background-sc-rgb),.1);display:block;height:1px;width:100%}[data-gene-ui-version=\"2.11.0\"] .title-holder>li~li{margin:0 0 0 1rem}html[dir=rtl] .title-holder>li~li{margin:0 1rem 0 0}[data-gene-ui-version=\"2.11.0\"] .title-holder .divider{margin:0 1rem}";
11
+ styleInject(css_248z);
12
+
13
+ function Title(_ref) {
14
+ let {
15
+ icon,
16
+ text,
17
+ actions,
18
+ color,
19
+ withLine,
20
+ className,
21
+ ...restProps
22
+ } = _ref;
23
+ return /*#__PURE__*/React__default.createElement("ul", _extends({
24
+ className: classnames('title-holder', "c-".concat(color), className)
25
+ }, restProps), icon && /*#__PURE__*/React__default.createElement("li", null, /*#__PURE__*/React__default.createElement(Icon, {
26
+ type: icon
27
+ })), /*#__PURE__*/React__default.createElement("li", {
28
+ className: "title-text"
29
+ }, /*#__PURE__*/React__default.createElement("div", {
30
+ className: "ellipsis-text"
31
+ }, text)), /*#__PURE__*/React__default.createElement("li", {
32
+ className: "line"
33
+ }, withLine && /*#__PURE__*/React__default.createElement("i", null)), actions && /*#__PURE__*/React__default.createElement("li", null, actions));
34
+ }
35
+ Title.propTypes = {
36
+ /**
37
+ * Display an icon. Values are the same as "Icon" atoms type prop
38
+ */
39
+ icon: propTypesExports.string,
40
+ /**
41
+ * Text/Component to be displayed. Any valid React node
42
+ */
43
+ text: propTypesExports.node.isRequired,
44
+ /**
45
+ * Actions to be displayed. Any valid React node
46
+ */
47
+ actions: propTypesExports.node,
48
+ /**
49
+ * Title color
50
+ */
51
+ color: propTypesExports.oneOf(titleConfig.color),
52
+ /**
53
+ * Displays a divider line
54
+ */
55
+ withLine: propTypesExports.bool,
56
+ /**
57
+ * Additional className
58
+ */
59
+ className: propTypesExports.string
60
+ };
61
+ Title.defaultProps = {
62
+ color: titleConfig.color[1],
63
+ withLine: false
64
+ };
65
+
66
+ export { Title as default };
package/Toaster.js ADDED
@@ -0,0 +1,116 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default, { useState, useCallback, useEffect } from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { c as classnames } from './index-6ff23041.js';
5
+ import './dateValidation-67caec66.js';
6
+ import { g as guid } from './guid-8ddf77b3.js';
7
+ import 'react-dom';
8
+ import Portal from './Portal.js';
9
+ import Notification from './Notification.js';
10
+ import Alert, { alertTypes } from './Alert.js';
11
+ import './globalStyling-9c60a159.js';
12
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
13
+ import './_commonjsHelpers-24198af3.js';
14
+ import './GeneUIProvider.js';
15
+ import './useDeviceType-dd51db38.js';
16
+ import './configs-91c86664.js';
17
+ import './useWindowSize-80369d76.js';
18
+ import './Icon.js';
19
+
20
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .toaster-holder{max-width:38rem;padding:1.5rem;position:fixed;width:100%;z-index:500}[data-gene-ui-version=\"2.11.0\"] .toaster-holder>*+*{margin:2rem 0 0}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.left-top{left:0;top:var(--header-height,0)}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.left-bottom{bottom:0;left:0}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.right-top{right:0;top:var(--header-height,0)}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.right-bottom{bottom:0;right:0}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.bottom,[data-gene-ui-version=\"2.11.0\"] .toaster-holder.top{left:50%;transform:translate3d(-50%,0,0)}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.top{top:var(--header-height,0)}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.bottom{bottom:0}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.mobile-view{transform:none;width:100%}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.mobile-view:not(.top,.bottom){padding:0}[data-gene-ui-version=\"2.11.0\"] .toaster-holder.mobile-view.center:not(.top,.bottom){padding:0 1.5rem}[data-gene-ui-version=\"2.11.0\"] .toaster-holder:empty{pointer-events:none}";
21
+ styleInject(css_248z);
22
+
23
+ const toasterPositions = ['top', 'bottom', 'center', 'left-top', 'left-bottom', 'right-top', 'right-bottom'];
24
+ function Toaster(_ref) {
25
+ let {
26
+ defaultDuration,
27
+ toasterPosition,
28
+ notificationPosition
29
+ } = _ref;
30
+ const [messages, setMessages] = useState([]);
31
+ const [notifications, setNotifications] = useState([]);
32
+ const removeItem = useCallback((key, id) => {
33
+ const setState = key === 'messages' ? setMessages : setNotifications;
34
+ setState(prev => prev.filter(item => item.id !== id));
35
+ }, []);
36
+ const runRenderTask = useCallback((key, duration, option) => {
37
+ const timerId = setTimeout(() => {
38
+ removeItem(key, option.id);
39
+ }, duration || defaultDuration);
40
+ const setState = key === 'messages' ? setMessages : setNotifications;
41
+ setState(prev => [...prev, {
42
+ ...option,
43
+ onClose: e => {
44
+ removeItem(key, option.id);
45
+ clearTimeout(timerId);
46
+ option.onClose && option.onClose(e);
47
+ }
48
+ }]);
49
+ }, [defaultDuration, removeItem]);
50
+ useEffect(() => {
51
+ Toaster.notify = options => {
52
+ const {
53
+ duration,
54
+ ...rest
55
+ } = options;
56
+ const notification = {
57
+ ...rest,
58
+ id: guid()
59
+ };
60
+ runRenderTask('notifications', duration, notification);
61
+ };
62
+ alertTypes.forEach(type => {
63
+ Toaster[type] = options => {
64
+ const {
65
+ duration,
66
+ ...rest
67
+ } = options;
68
+ const message = {
69
+ ...rest,
70
+ type,
71
+ id: guid()
72
+ };
73
+ runRenderTask('messages', duration, message);
74
+ };
75
+ });
76
+ }, [runRenderTask]);
77
+ const createPortal = (Comp, options, className, position) => /*#__PURE__*/React__default.createElement(Portal, {
78
+ isOpen: !!options.length,
79
+ className: classnames(className, position)
80
+ }, options.map(option => {
81
+ const {
82
+ Component,
83
+ id,
84
+ ...rest
85
+ } = option;
86
+ return /*#__PURE__*/React__default.isValidElement(Component) ? /*#__PURE__*/React__default.createElement(Component, _extends({
87
+ key: id
88
+ }, rest)) : /*#__PURE__*/React__default.createElement(Comp, _extends({
89
+ key: id
90
+ }, rest));
91
+ }));
92
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, createPortal(Alert, messages, 'toaster-holder', toasterPosition), createPortal(Notification, notifications, 'toaster-holder', notificationPosition));
93
+ }
94
+ Toaster.propTypes = {
95
+ /**
96
+ * Determines how long should component be displayed
97
+ */
98
+ defaultDuration: propTypesExports.number,
99
+ /**
100
+ * Determines toaster position on window,
101
+ * On of ['top', 'bottom', 'center', 'left-top', 'left-bottom', 'right-top', 'right-bottom']
102
+ */
103
+ toasterPosition: propTypesExports.string,
104
+ /**
105
+ * Determines notification position on window,
106
+ * On of ['top', 'bottom', 'center', 'left-top', 'left-bottom', 'right-top', 'right-bottom']
107
+ */
108
+ notificationPosition: propTypesExports.string
109
+ };
110
+ Toaster.defaultProps = {
111
+ defaultDuration: 4000,
112
+ toasterPosition: 'right-top',
113
+ notificationPosition: 'right-top'
114
+ };
115
+
116
+ export { Toaster as default, toasterPositions };
package/Tooltip.js ADDED
@@ -0,0 +1,157 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default, { useState, useContext, useCallback, useEffect } from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { c as classnames } from './index-6ff23041.js';
5
+ import { _ as _default } from './Popover-f4d1cac0.js';
6
+ import { p as positions } from './configs-91c86664.js';
7
+ import { n as noop } from './index-ac59cb10.js';
8
+ import { u as useDeviceType } from './useDeviceType-dd51db38.js';
9
+ import { GeneUIDesignSystemContext } from './GeneUIProvider.js';
10
+ import './globalStyling-9c60a159.js';
11
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
12
+ import './_commonjsHelpers-24198af3.js';
13
+ import 'react-dom';
14
+ import './dateValidation-67caec66.js';
15
+ import './useWindowSize-80369d76.js';
16
+
17
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .react-tiny-popover-container{z-index:500}[data-gene-ui-version=\"2.11.0\"] .tooltip-c-p{pointer-events:none}[data-gene-ui-version=\"2.11.0\"] .s-small .tooltip-c-p{padding:1.5rem}[data-gene-ui-version=\"2.11.0\"] .tooltip-content{background:rgba(var(--background-sc-rgb),.6);border-radius:.4rem;color:rgba(var(--background-rgb),.7);font:600 1.2rem/1.6rem var(--font-family);max-width:20rem;padding:.6rem 1rem;word-break:break-word}[data-gene-ui-version=\"2.11.0\"] .tooltip-content>*+*{margin:.2rem 0 0}[data-gene-ui-version=\"2.11.0\"] .tooltip-content .tooltip-title{color:var(--background)}[data-gene-ui-version=\"2.11.0\"] .s-small .tooltip-content{font:600 1rem/1.4rem var(--font-family);padding:.6rem .8rem}";
18
+ styleInject(css_248z);
19
+
20
+ function Tooltip(_ref) {
21
+ let {
22
+ children,
23
+ position,
24
+ size,
25
+ style,
26
+ text,
27
+ title,
28
+ transitionDuration,
29
+ customPosition,
30
+ alwaysShow,
31
+ disableReposition,
32
+ onClick,
33
+ padding,
34
+ screenType,
35
+ isVisible,
36
+ ...props
37
+ } = _ref;
38
+ const {
39
+ isMobile
40
+ } = useDeviceType(screenType);
41
+ const [isPopoverOpen, setPopoverState] = useState(false);
42
+ const {
43
+ geneUIProviderRef
44
+ } = useContext(GeneUIDesignSystemContext);
45
+ const mouseEnterHandler = useCallback(() => !alwaysShow && setPopoverState(true), [alwaysShow]);
46
+ const mouseLeaveHandler = useCallback(() => !alwaysShow && setPopoverState(false), [alwaysShow]);
47
+ useEffect(() => {
48
+ if (children.props.disabled) {
49
+ mouseLeaveHandler();
50
+ }
51
+ }, [children.props.disabled]);
52
+ const preferredPosition = position === 'auto' ? positions : position;
53
+ const checkNudged = useCallback(_ref2 => {
54
+ let {
55
+ nudgedLeft,
56
+ nudgedTop
57
+ } = _ref2;
58
+ return isMobile ? !(nudgedTop || nudgedLeft) : true;
59
+ }, [isMobile]);
60
+ return isVisible ? /*#__PURE__*/React__default.createElement(_default, {
61
+ contentDestination: geneUIProviderRef.current,
62
+ transitionDuration: transitionDuration,
63
+ disableReposition: disableReposition,
64
+ isOpen: alwaysShow || isPopoverOpen,
65
+ position: preferredPosition,
66
+ contentLocation: customPosition,
67
+ align: "center",
68
+ padding: padding,
69
+ content: rect => checkNudged(rect) && /*#__PURE__*/React__default.createElement("div", _extends({
70
+ className: classnames('tooltip-c-p', "s-".concat(size)),
71
+ style: {
72
+ ...style
73
+ }
74
+ }, props), (title || text) && /*#__PURE__*/React__default.createElement("div", {
75
+ className: "tooltip-content"
76
+ }, title && /*#__PURE__*/React__default.createElement("div", {
77
+ className: "tooltip-title"
78
+ }, title), text && /*#__PURE__*/React__default.createElement("div", {
79
+ className: "tooltip-text"
80
+ }, text)))
81
+ }, children ? /*#__PURE__*/React__default.cloneElement(children, {
82
+ onMouseEnter: mouseEnterHandler,
83
+ onMouseLeave: mouseLeaveHandler,
84
+ onClick: e => {
85
+ const {
86
+ onClick: onClickHandler
87
+ } = children.props;
88
+ typeof onClickHandler === 'function' && onClickHandler(e);
89
+ onClick(e);
90
+ }
91
+ }) : null) : children;
92
+ }
93
+ Tooltip.propTypes = {
94
+ /**
95
+ * Different sizes for 'Tooltip'.
96
+ */
97
+ size: propTypesExports.oneOf(['default', 'small']),
98
+ /**
99
+ * Text for 'Tooltip'.
100
+ */
101
+ text: propTypesExports.oneOfType([propTypesExports.object, propTypesExports.string]),
102
+ /**
103
+ * Title for 'Tooltip'.
104
+ */
105
+ title: propTypesExports.string,
106
+ /**
107
+ * Style object, to have extra styles.
108
+ */
109
+ style: propTypesExports.object,
110
+ /**
111
+ * Have always visible 'Tooltip'.
112
+ */
113
+ alwaysShow: propTypesExports.bool,
114
+ /**
115
+ * Custom positions(left, top) for 'Tooltip'.
116
+ */
117
+ customPosition: propTypesExports.shape({
118
+ left: propTypesExports.number,
119
+ top: propTypesExports.number
120
+ }),
121
+ /**
122
+ * Duration for showing 'Tooltip'.
123
+ */
124
+ transitionDuration: propTypesExports.number,
125
+ /**
126
+ * Any valid React node.
127
+ */
128
+ children: propTypesExports.node,
129
+ /**
130
+ * Disable/Enable repositions.
131
+ */
132
+ disableReposition: propTypesExports.bool,
133
+ /**
134
+ * 'Tooltip' position to be displayed
135
+ */
136
+ position: propTypesExports.oneOf(['auto', ...positions]),
137
+ /**
138
+ * 'Tooltip' padding from the target element
139
+ */
140
+ padding: propTypesExports.number,
141
+ /**
142
+ * If isVisible is false, the component will render only children without a tooltip wrapped.
143
+ */
144
+ isVisible: propTypesExports.bool
145
+ };
146
+ Tooltip.defaultProps = {
147
+ position: 'auto',
148
+ size: 'default',
149
+ transitionDuration: 0,
150
+ disableReposition: false,
151
+ onClick: noop,
152
+ padding: 5,
153
+ screenType: 'desktop',
154
+ isVisible: true
155
+ };
156
+
157
+ export { Tooltip as default };