@geneui/components 3.0.0-next-06dadf3-29102024 → 3.0.0-next-63cb5e7-01112024

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 (247) hide show
  1. package/Avatar.js +63 -0
  2. package/Divider.js +23 -0
  3. package/{GeneUIProvider/index.js → GeneUIProvider.js} +51 -64
  4. package/HelperText.js +69 -0
  5. package/Info.js +64 -0
  6. package/Label.js +38 -0
  7. package/Loader.js +21 -0
  8. package/Pill.js +64 -0
  9. package/TextLink.js +20 -0
  10. package/{index-c7646e48.js → Tooltip.js} +101 -79
  11. package/{lib → components}/atoms/Avatar/Avatar.d.ts +7 -6
  12. package/components/atoms/Avatar/index.d.ts +1 -0
  13. package/{lib → components}/atoms/Divider/Divider.d.ts +5 -5
  14. package/components/atoms/Divider/index.d.ts +1 -0
  15. package/{lib → components}/atoms/HelperText/HelperText.d.ts +6 -5
  16. package/components/atoms/HelperText/index.d.ts +1 -0
  17. package/{lib → components}/atoms/Info/Info.d.ts +5 -5
  18. package/components/atoms/Info/index.d.ts +1 -0
  19. package/{lib → components}/atoms/Label/Label.d.ts +3 -3
  20. package/components/atoms/Label/index.d.ts +1 -0
  21. package/{lib → components}/atoms/Loader/Loader.d.ts +5 -5
  22. package/components/atoms/Loader/index.d.ts +1 -0
  23. package/{lib → components}/atoms/Pill/Pill.d.ts +7 -6
  24. package/components/atoms/Pill/index.d.ts +1 -0
  25. package/{lib → components}/atoms/TextLink/TextLink.d.ts +5 -5
  26. package/components/atoms/TextLink/index.d.ts +1 -0
  27. package/{lib → components}/molecules/Tooltip/Tooltip.d.ts +26 -21
  28. package/components/molecules/Tooltip/index.d.ts +1 -0
  29. package/components/providers/GeneUIProvider/GeneUIProvider.d.ts +30 -0
  30. package/components/providers/GeneUIProvider/index.d.ts +1 -0
  31. package/hooks/index.d.ts +2 -20
  32. package/hooks/useDebounceCallback/index.d.ts +1 -0
  33. package/hooks/useDebounceCallback/useDebounceCallback.d.ts +2 -0
  34. package/hooks/useEllipsisDetection/index.d.ts +1 -1
  35. package/hooks/useEllipsisDetection/useEllipsisDetection.d.ts +2 -2
  36. package/{index-031ff73c.js → index-ce02421b.js} +4 -4
  37. package/index.d.ts +11 -121
  38. package/index.js +12 -159
  39. package/package.json +24 -43
  40. package/tokens-0abb4e1b.js +6 -0
  41. package/types/index.d.ts +0 -3
  42. package/useEllipsisDetection-46d712b6.js +34 -0
  43. package/ActionableList/index.js +0 -1694
  44. package/AdvancedSearch/index.js +0 -892
  45. package/Alert/index.js +0 -98
  46. package/Avatar/index.js +0 -58
  47. package/Badge/index.js +0 -29
  48. package/Breadcrumb/index.js +0 -130
  49. package/BusyLoader/index.js +0 -31
  50. package/Button/index.js +0 -30
  51. package/Card/index.js +0 -502
  52. package/CardList/index.js +0 -662
  53. package/CellMeasurerCache-26f3693c.js +0 -229
  54. package/Charts/index.js +0 -17662
  55. package/Checkbox/index.js +0 -229
  56. package/CheckboxGroup/index.js +0 -203
  57. package/CheckboxGroupWithSearch/index.js +0 -280
  58. package/Collapse/index.js +0 -195
  59. package/ColorPicker/index.js +0 -210
  60. package/ComboBox/index.js +0 -524
  61. package/Copy/index.js +0 -56
  62. package/Counter/index.js +0 -312
  63. package/DateFilter/index.js +0 -183
  64. package/DatePicker/index.js +0 -1229
  65. package/DatePickerInput/index.js +0 -883
  66. package/Divider/index.js +0 -23
  67. package/Drawer/index.js +0 -261
  68. package/Dropdown/index.js +0 -43
  69. package/Editor/index.js +0 -22975
  70. package/Empty/index.js +0 -76
  71. package/ExtendedInput/index.js +0 -590
  72. package/Form/index.js +0 -85
  73. package/FormContainer/index.js +0 -189
  74. package/FormableCheckbox/index.js +0 -24
  75. package/FormableDatePicker/index.js +0 -43
  76. package/FormableDropdown/index.js +0 -50
  77. package/FormableEditor/index.js +0 -26
  78. package/FormableHOC-85f89a81.js +0 -83
  79. package/FormableMultiSelectDropdown/index.js +0 -50
  80. package/FormableNumberInput/index.js +0 -34
  81. package/FormableRadio/index.js +0 -22
  82. package/FormableSwitcher/index.js +0 -22
  83. package/FormableTextInput/index.js +0 -34
  84. package/FormableUploader/index.js +0 -44
  85. package/Grid/index.js +0 -167
  86. package/HelperText/index.js +0 -86
  87. package/Holder/index.js +0 -261
  88. package/Icon/index.js +0 -62
  89. package/Image/index.js +0 -45
  90. package/ImagePreview/index.js +0 -217
  91. package/Info/index.js +0 -41
  92. package/InfoOutline-dd2e89d9.js +0 -29
  93. package/InteractiveWidget/index.js +0 -78
  94. package/KeyValue/index.js +0 -22
  95. package/Label/index.js +0 -48
  96. package/LinkButton/index.js +0 -34
  97. package/Loader/index.js +0 -23
  98. package/Menu/index.js +0 -281
  99. package/MobileNavigation/index.js +0 -94
  100. package/MobilePopup/index.js +0 -182
  101. package/Modal/index.js +0 -251
  102. package/ModuleTitle/index.js +0 -141
  103. package/NavigationMenu/index.js +0 -222
  104. package/Notification/index.js +0 -120
  105. package/Option/index.js +0 -184
  106. package/Overlay/index.js +0 -187
  107. package/Overspread/index.js +0 -291
  108. package/Pagination/index.js +0 -261
  109. package/Paper/index.js +0 -96
  110. package/Pill/index.js +0 -67
  111. package/Popover/index.js +0 -725
  112. package/PopoverV2/index.js +0 -19
  113. package/Portal/index.js +0 -58
  114. package/Products/index.js +0 -115
  115. package/Profile/index.js +0 -589
  116. package/Progress/index.js +0 -200
  117. package/QRCode/index.js +0 -814
  118. package/Radio/index.js +0 -151
  119. package/RadioGroup/index.js +0 -104
  120. package/Range/index.js +0 -191
  121. package/Rating/index.js +0 -174
  122. package/RichEditor/index.js +0 -13
  123. package/RichEditor-6ca8346f.js +0 -228
  124. package/Scrollbar/index.js +0 -1585
  125. package/Search/index.js +0 -75
  126. package/SearchWithDropdown/index.js +0 -140
  127. package/Section/index.js +0 -61
  128. package/SkeletonLoader/index.js +0 -81
  129. package/Slider/index.js +0 -261
  130. package/Status/index.js +0 -97
  131. package/Steps/index.js +0 -314
  132. package/SuggestionList/index.js +0 -385
  133. package/Switcher/index.js +0 -193
  134. package/Table/index.js +0 -57
  135. package/TableCompositions/index.js +0 -16995
  136. package/Tabs/index.js +0 -235
  137. package/Tag/index.js +0 -102
  138. package/TextLink/index.js +0 -20
  139. package/Textarea/index.js +0 -242
  140. package/Time/index.js +0 -62
  141. package/TimePicker/index.js +0 -575
  142. package/Timeline/index.js +0 -113
  143. package/Title/index.js +0 -65
  144. package/Toaster/index.js +0 -116
  145. package/Tooltip/index.js +0 -6
  146. package/TransferList/index.js +0 -493
  147. package/Uploader/index.js +0 -992
  148. package/ValidatableCheckbox/index.js +0 -123
  149. package/ValidatableDatePicker/index.js +0 -316
  150. package/ValidatableDropdown/index.js +0 -141
  151. package/ValidatableElements/index.js +0 -67
  152. package/ValidatableMultiSelectDropdown/index.js +0 -152
  153. package/ValidatableNumberInput/index.js +0 -204
  154. package/ValidatableRadio/index.js +0 -116
  155. package/ValidatableSwitcher/index.js +0 -93
  156. package/ValidatableTextInput/index.js +0 -167
  157. package/ValidatableTimeInput/index.js +0 -174
  158. package/ValidatableUploader/index.js +0 -98
  159. package/Widget/index.js +0 -225
  160. package/_commonjsHelpers-24198af3.js +0 -35
  161. package/_rollupPluginBabelHelpers-a83240e1.js +0 -11
  162. package/callAfterDelay-7272faca.js +0 -12
  163. package/checkTimeValidation-e56771be.js +0 -16
  164. package/checkboxRadioSwitcher-5b69d7bd.js +0 -4
  165. package/clsx.m-2bb6df4b.js +0 -3
  166. package/config-1053d64d.js +0 -20
  167. package/configs-00612ce0.js +0 -103
  168. package/configs.js +0 -111
  169. package/dateValidation-67caec66.js +0 -225
  170. package/debounce-4419bc2f.js +0 -17
  171. package/guid-8ddf77b3.js +0 -16
  172. package/hooks/useBodyScroll.js +0 -16
  173. package/hooks/useClick.js +0 -18
  174. package/hooks/useClickOutside.js +0 -25
  175. package/hooks/useDebounce.js +0 -28
  176. package/hooks/useDeviceType.js +0 -17
  177. package/hooks/useDidMount.js +0 -15
  178. package/hooks/useForceUpdate.js +0 -8
  179. package/hooks/useHover.js +0 -20
  180. package/hooks/useImgDownload.js +0 -18
  181. package/hooks/useKeyDown.js +0 -21
  182. package/hooks/useMount.js +0 -13
  183. package/hooks/useMutationObserver.js +0 -21
  184. package/hooks/usePrevious.js +0 -10
  185. package/hooks/useThrottle.js +0 -16
  186. package/hooks/useToggle.js +0 -11
  187. package/hooks/useUpdatableRef.js +0 -14
  188. package/hooks/useUpdate.js +0 -10
  189. package/hooks/useWidth.js +0 -16
  190. package/hooks/useWindowSize.js +0 -40
  191. package/index-122432cd.js +0 -270
  192. package/index-262edd7a.js +0 -77
  193. package/index-3188e46e.js +0 -1940
  194. package/index-45eafea6.js +0 -90
  195. package/index-5f37f281.js +0 -168
  196. package/index-ce12e4a9.js +0 -10032
  197. package/index-d0ecb950.js +0 -6483
  198. package/index-fcbae78d.js +0 -4
  199. package/index.mobile.d.ts +0 -14
  200. package/lib/atoms/Avatar/index.d.ts +0 -1
  201. package/lib/atoms/Badge/Badge.d.ts +0 -36
  202. package/lib/atoms/Badge/index.d.ts +0 -1
  203. package/lib/atoms/BusyLoader/BusyLoader.d.ts +0 -32
  204. package/lib/atoms/BusyLoader/BusyLoaderHolderHOC.d.ts +0 -8
  205. package/lib/atoms/BusyLoader/index.d.ts +0 -1
  206. package/lib/atoms/Button/Button.d.ts +0 -70
  207. package/lib/atoms/Button/index.d.ts +0 -1
  208. package/lib/atoms/Divider/index.d.ts +0 -1
  209. package/lib/atoms/Empty/Empty.d.ts +0 -39
  210. package/lib/atoms/Empty/index.d.ts +0 -1
  211. package/lib/atoms/Empty/utils.d.ts +0 -9
  212. package/lib/atoms/HelperText/index.d.ts +0 -1
  213. package/lib/atoms/Image/Image.d.ts +0 -51
  214. package/lib/atoms/Image/index.d.ts +0 -1
  215. package/lib/atoms/ImagePreview/ImagePreview.d.ts +0 -56
  216. package/lib/atoms/ImagePreview/ImagePreviewHOC.d.ts +0 -4
  217. package/lib/atoms/ImagePreview/Magnifier.d.ts +0 -40
  218. package/lib/atoms/ImagePreview/index.d.ts +0 -1
  219. package/lib/atoms/Info/index.d.ts +0 -1
  220. package/lib/atoms/KeyValue/KeyValue.d.ts +0 -29
  221. package/lib/atoms/KeyValue/index.d.ts +0 -1
  222. package/lib/atoms/Label/index.d.ts +0 -1
  223. package/lib/atoms/LinkButton/LinkButton.d.ts +0 -46
  224. package/lib/atoms/LinkButton/index.d.ts +0 -1
  225. package/lib/atoms/Loader/index.d.ts +0 -1
  226. package/lib/atoms/Pill/index.d.ts +0 -1
  227. package/lib/atoms/Rating/DefaultSvg.d.ts +0 -3
  228. package/lib/atoms/Rating/Rating.d.ts +0 -49
  229. package/lib/atoms/Rating/index.d.ts +0 -1
  230. package/lib/atoms/TextLink/index.d.ts +0 -1
  231. package/lib/molecules/Copy/Copy.d.ts +0 -38
  232. package/lib/molecules/Copy/index.d.ts +0 -1
  233. package/lib/molecules/InteractiveWidget/InteractiveWidget.d.ts +0 -70
  234. package/lib/molecules/InteractiveWidget/InteractiveWidgetIcon.d.ts +0 -8
  235. package/lib/molecules/InteractiveWidget/index.d.ts +0 -1
  236. package/lib/molecules/Tooltip/index.d.ts +0 -1
  237. package/lib/providers/GeneUIProvider/GeneUIProvider.d.ts +0 -30
  238. package/lib/providers/GeneUIProvider/index.d.ts +0 -1
  239. package/localization-4ba17032.js +0 -46
  240. package/objectWithoutPropertiesLoose-e1596bdb.js +0 -62
  241. package/rangeAndSlider-740a236c.js +0 -8676
  242. package/react-beautiful-dnd.esm-8c7b5a83.js +0 -10116
  243. package/react-lifecycles-compat.es-6e1f3768.js +0 -158
  244. package/redux-e591c1b8.js +0 -536
  245. package/tokens-8ab1179c.js +0 -6
  246. package/tslib.es6-f211516f.js +0 -35
  247. package/useEllipsisDetection-c1c9ad94.js +0 -38
@@ -1,167 +0,0 @@
1
- import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
2
- import React__default, { forwardRef, useState, useCallback, useEffect } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { n as noop } from '../index-5f37f281.js';
5
- import useMount from '../hooks/useMount.js';
6
- import '../configs-00612ce0.js';
7
- import ExtendedInput from '../ExtendedInput/index.js';
8
- import '../dateValidation-67caec66.js';
9
- import '../_commonjsHelpers-24198af3.js';
10
- import 'react-dom';
11
- import '../index-031ff73c.js';
12
- import '../hooks/useDeviceType.js';
13
- import '../hooks/useWindowSize.js';
14
- import '../hooks/useDebounce.js';
15
- import '../useEllipsisDetection-c1c9ad94.js';
16
- import '../Icon/index.js';
17
- import '../style-inject.es-746bb8ed.js';
18
- import '../SuggestionList/index.js';
19
- import '../hooks/useKeyDown.js';
20
- import '../hooks/useClickOutside.js';
21
- import '../config-1053d64d.js';
22
- import '../Scrollbar/index.js';
23
- import '../callAfterDelay-7272faca.js';
24
- import '../index-c7646e48.js';
25
- import '../tslib.es6-f211516f.js';
26
- import '../GeneUIProvider/index.js';
27
-
28
- const emailRegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
29
- function checkValidation(required, isValid, maxLength, minLength, isEmail) {
30
- let value = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
31
- const valueWithoutSpaces = value ? value.toString().trim() : value;
32
- if (isValid === false) return {
33
- key: 'customValidation',
34
- isValid: false
35
- };
36
- if (minLength && valueWithoutSpaces.length <= minLength) return {
37
- key: 'minLength',
38
- isValid: false
39
- };
40
- if (maxLength && valueWithoutSpaces.length >= maxLength) return {
41
- key: 'maxLength',
42
- isValid: false
43
- };
44
- if (valueWithoutSpaces.length > 0 && isEmail && !emailRegExp.test(valueWithoutSpaces)) return {
45
- key: 'isEmail',
46
- isValid: false
47
- };
48
- if (required && valueWithoutSpaces.length === 0) return {
49
- key: 'required',
50
- isValid: false
51
- };
52
- return {
53
- key: null,
54
- isValid: true
55
- };
56
- }
57
- const TextInput = /*#__PURE__*/forwardRef((props, ref) => {
58
- const {
59
- onChange,
60
- value,
61
- isValid,
62
- onBlur,
63
- required,
64
- maxLength,
65
- minLength,
66
- isEmail,
67
- isFieldValid,
68
- forceAllowValidation,
69
- defaultValue,
70
- ...restProps
71
- } = props;
72
- const isControlled = 'value' in props && typeof value !== 'undefined';
73
- const [validationState, setValidationState] = useState(true);
74
- const [allowValidation, setAllowValidation] = useState(false);
75
- const validate = useCallback(defaultValue => checkValidation(required, isValid, maxLength, minLength, isEmail, value || defaultValue).isValid, [value, required, isValid, maxLength, minLength, isEmail]);
76
- const handleChange = useCallback(e => {
77
- const {
78
- value
79
- } = e.target;
80
- const validation = checkValidation(required, isValid, maxLength, minLength, isEmail, value);
81
- setValidationState(validation.isValid);
82
- onChange && onChange(e, validation.isValid, validation.key);
83
- }, [onChange, required, isValid, maxLength, minLength, isEmail]);
84
-
85
- // we use this because need to show field validation after onBlur
86
- const handleBlur = useCallback(e => {
87
- setAllowValidation(true);
88
- onBlur(e);
89
- }, [onBlur]);
90
- useEffect(() => {
91
- isControlled && setValidationState(validate());
92
- }, [isControlled, validate]);
93
-
94
- // need this for handling user's `isValid` prop
95
- useEffect(() => {
96
- setValidationState(isValid);
97
- }, [isValid]);
98
-
99
- // call function when validation state changes
100
- useEffect(() => {
101
- isFieldValid(validationState);
102
- }, [validationState]);
103
-
104
- // set Allow validation true if submit button clicked
105
- useEffect(() => {
106
- forceAllowValidation && setAllowValidation(true);
107
- }, [forceAllowValidation]);
108
- useMount(() => setValidationState(validate(defaultValue)));
109
- return /*#__PURE__*/React__default.createElement(ExtendedInput, _extends({}, restProps, {
110
- ref: ref,
111
- value: value,
112
- isValid: !allowValidation || validationState,
113
- onChange: handleChange,
114
- required: required,
115
- defaultValue: defaultValue,
116
- onBlur: handleBlur
117
- }));
118
- });
119
- TextInput.propTypes = {
120
- /**
121
- * Value for text input
122
- */
123
- value: PropTypes.string,
124
- /**
125
- * Callback fires when field changes
126
- */
127
- onChange: PropTypes.func,
128
- /**
129
- * Callback fires when field blured
130
- */
131
- onBlur: PropTypes.func,
132
- /**
133
- * Define is field required or no.
134
- */
135
- required: PropTypes.bool,
136
- /**
137
- * Is field accept only email or no
138
- */
139
- isEmail: PropTypes.bool,
140
- /**
141
- * Maximum length of value
142
- */
143
- maxLength: PropTypes.number,
144
- /**
145
- * Minimum length of value
146
- */
147
- minLength: PropTypes.number,
148
- /**
149
- * Callback fires when field validation state changes
150
- */
151
- isFieldValid: PropTypes.func,
152
- /**
153
- * Additional validation state
154
- */
155
- isValid: PropTypes.bool,
156
- /**
157
- * Allow validation without onBlur, validate field when mount
158
- */
159
- forceAllowValidation: PropTypes.bool
160
- };
161
- TextInput.defaultProps = {
162
- isValid: true,
163
- isFieldValid: noop,
164
- onBlur: noop
165
- };
166
-
167
- export { TextInput as default };
@@ -1,174 +0,0 @@
1
- import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
2
- import React__default, { forwardRef, useState, useCallback, useEffect } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { d as dayjsWithPlugins } from '../dateValidation-67caec66.js';
5
- import { g as getBrowserDateFormat } from '../localization-4ba17032.js';
6
- import { c as checkTimeValidation } from '../checkTimeValidation-e56771be.js';
7
- import 'react-dom';
8
- import ExtendedInput from '../ExtendedInput/index.js';
9
- import '../_commonjsHelpers-24198af3.js';
10
- import '../index-031ff73c.js';
11
- import '../configs-00612ce0.js';
12
- import '../index-5f37f281.js';
13
- import '../hooks/useDeviceType.js';
14
- import '../hooks/useWindowSize.js';
15
- import '../hooks/useDebounce.js';
16
- import '../useEllipsisDetection-c1c9ad94.js';
17
- import '../Icon/index.js';
18
- import '../style-inject.es-746bb8ed.js';
19
- import '../SuggestionList/index.js';
20
- import '../hooks/useKeyDown.js';
21
- import '../hooks/useClickOutside.js';
22
- import '../config-1053d64d.js';
23
- import '../Scrollbar/index.js';
24
- import '../callAfterDelay-7272faca.js';
25
- import '../index-c7646e48.js';
26
- import '../tslib.es6-f211516f.js';
27
- import '../GeneUIProvider/index.js';
28
-
29
- const nonLettersRegex = /[\W_]+/g;
30
- const getFormatSeparator = format => format[format.search(nonLettersRegex)];
31
- const isUpperCase = str => str === str.toUpperCase();
32
- const isLowerCase = str => str === str.toLowerCase();
33
-
34
- /*
35
- * Splitting time to { format, value } object
36
- * For checking is value fit format
37
- * Formats are taken from day.js date formats list
38
- * */
39
- function splitTimeToObjects(dateParts, formatParts, meridiemValue, meridiemFormat) {
40
- const hourFormats = ['H', 'HH', 'h', 'hh'];
41
- const minuteFormats = ['m', 'mm'];
42
- const secondFormats = ['s', 'ss'];
43
- const hour = {};
44
- const minute = {};
45
- const second = {};
46
- const meridiem = {};
47
- formatParts.forEach((item, index) => {
48
- if (hourFormats.includes(item)) {
49
- hour.value = dateParts[index];
50
- hour.format = item;
51
- } else if (minuteFormats.includes(item)) {
52
- minute.value = dateParts[index];
53
- minute.format = item;
54
- } else if (secondFormats.includes(item)) {
55
- second.value = dateParts[index];
56
- second.format = item;
57
- }
58
- });
59
- if (meridiemFormat || meridiemValue) {
60
- meridiem.value = meridiemValue;
61
- meridiem.format = meridiemFormat;
62
- }
63
- return {
64
- hour,
65
- minute,
66
- second,
67
- meridiem
68
- };
69
- }
70
- const isHourInRightFormat = _ref => {
71
- let {
72
- value,
73
- format
74
- } = _ref;
75
- return value && (format === 'H' && value.length <= 2 && Number(value[0]) !== 0 || format === 'h' && value.length <= 2 && Number(value[0]) !== 0 || format === 'HH' && value.length === 2 || format === 'hh' && value.length === 2);
76
- };
77
- const isMinuteInRightFormat = _ref2 => {
78
- let {
79
- value,
80
- format
81
- } = _ref2;
82
- return value && (format === 'm' && value.length <= 2 && (value.length !== 2 || Number(value[0]) !== 0) || format === 'mm' && value.length === 2);
83
- };
84
- const isSecondInRightFormat = _ref3 => {
85
- let {
86
- value,
87
- format
88
- } = _ref3;
89
- return !format || value && (format === 's' && value.length <= 2 && (value.length !== 2 || Number(value[0]) !== 0) || format === 'ss' && value.length === 2);
90
- };
91
- const isMeridiemInRightFormat = _ref4 => {
92
- let {
93
- value,
94
- format
95
- } = _ref4;
96
- return !(format || value) || value && (format === 'A' && isUpperCase(value) || format === 'a' && isLowerCase(value));
97
- };
98
- const checkTimeFormat = _ref5 => {
99
- let {
100
- hour,
101
- minute,
102
- second,
103
- meridiem
104
- } = _ref5;
105
- return isHourInRightFormat(hour) && isMinuteInRightFormat(minute) && isSecondInRightFormat(second) && isMeridiemInRightFormat(meridiem);
106
- };
107
- function validateField() {
108
- let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
109
- let required = arguments.length > 1 ? arguments[1] : undefined;
110
- let customValidation = arguments.length > 2 ? arguments[2] : undefined;
111
- let min = arguments.length > 3 ? arguments[3] : undefined;
112
- let max = arguments.length > 4 ? arguments[4] : undefined;
113
- let format = arguments.length > 5 ? arguments[5] : undefined;
114
- const date = dayjsWithPlugins(value, format);
115
- const separator = getFormatSeparator(format);
116
- const splittedDate = value.split(' ');
117
- const splittedFormat = format.split(' ');
118
- const dateParts = splittedDate[0].split(separator);
119
- const formatParts = splittedFormat[0].split(separator);
120
- const timeObject = splitTimeToObjects(dateParts, formatParts, splittedDate[1], splittedFormat[1]);
121
- const isValidFormat = checkTimeFormat(timeObject);
122
- const isValidDate = checkTimeValidation(timeObject);
123
- const isSameLength = dateParts.length === formatParts.length;
124
- const isBefore = !max || date.isBefore(dayjsWithPlugins(max, format));
125
- const isAfter = !min || date.isAfter(dayjsWithPlugins(min, format));
126
- return (!customValidation || customValidation(value)) && (!required || value.length) && (!required && !value.length || isValidDate && isSameLength && isValidFormat && isBefore && isAfter);
127
- }
128
- const DateInput = /*#__PURE__*/forwardRef((_ref6, ref) => {
129
- let {
130
- onChange,
131
- value,
132
- customValidation,
133
- required,
134
- getInitialState,
135
- min,
136
- max,
137
- format,
138
- ...restProps
139
- } = _ref6;
140
- const [isValid, setValidation] = useState(() => validateField(value, required, customValidation, min, max, format));
141
- const handleChange = useCallback(e => {
142
- const {
143
- value
144
- } = e.target;
145
- const isValid = validateField(value, required, customValidation, min, max, format);
146
- setValidation(isValid);
147
- onChange && onChange(e, isValid);
148
- }, [onChange, required, customValidation, min, max, format]);
149
- useEffect(() => {
150
- getInitialState && getInitialState(isValid);
151
- }, [getInitialState, isValid]);
152
- useEffect(() => setValidation(validateField(value, required, customValidation, min, max, format)), [required, min, max, format, value, customValidation]);
153
- return /*#__PURE__*/React__default.createElement(ExtendedInput, _extends({
154
- ref: ref,
155
- value: value,
156
- isValid: isValid,
157
- onChange: handleChange
158
- }, restProps));
159
- });
160
- DateInput.propTypes = {
161
- value: PropTypes.string,
162
- onChange: PropTypes.func,
163
- required: PropTypes.bool,
164
- getInitialState: PropTypes.func,
165
- customValidation: PropTypes.func,
166
- min: PropTypes.string,
167
- max: PropTypes.string,
168
- format: PropTypes.string
169
- };
170
- DateInput.defaultProps = {
171
- format: getBrowserDateFormat()
172
- };
173
-
174
- export { DateInput as default };
@@ -1,98 +0,0 @@
1
- import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
2
- import React__default, { forwardRef, useState, useCallback, useEffect } from 'react';
3
- import PropTypes from 'prop-types';
4
- import useMount from '../hooks/useMount.js';
5
- import '../configs-00612ce0.js';
6
- import Uploader from '../Uploader/index.js';
7
- import '../index-5f37f281.js';
8
- import '../dateValidation-67caec66.js';
9
- import '../_commonjsHelpers-24198af3.js';
10
- import 'react-dom';
11
- import '../index-031ff73c.js';
12
- import '../Button/index.js';
13
- import '../tslib.es6-f211516f.js';
14
- import '../Icon/index.js';
15
- import '../style-inject.es-746bb8ed.js';
16
- import '../ExtendedInput/index.js';
17
- import '../hooks/useDeviceType.js';
18
- import '../hooks/useWindowSize.js';
19
- import '../hooks/useDebounce.js';
20
- import '../useEllipsisDetection-c1c9ad94.js';
21
- import '../SuggestionList/index.js';
22
- import '../hooks/useKeyDown.js';
23
- import '../hooks/useClickOutside.js';
24
- import '../config-1053d64d.js';
25
- import '../Scrollbar/index.js';
26
- import '../callAfterDelay-7272faca.js';
27
- import '../index-c7646e48.js';
28
- import '../GeneUIProvider/index.js';
29
- import '../Grid/index.js';
30
- import '../hooks/useWidth.js';
31
- import '../hooks/useImgDownload.js';
32
- import '../BusyLoader/index.js';
33
- import '../Image/index.js';
34
- import '../Empty/index.js';
35
- import '../Checkbox/index.js';
36
- import '../checkboxRadioSwitcher-5b69d7bd.js';
37
- import '../guid-8ddf77b3.js';
38
-
39
- function checkValidation(required, isValid) {
40
- let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
41
- if (isValid === false) return {
42
- key: 'customValidation',
43
- isValid: false
44
- };
45
- if (required && value.length === 0) return {
46
- key: 'required',
47
- isValid: false
48
- };
49
- return {
50
- key: null,
51
- isValid: true
52
- };
53
- }
54
- const UploaderField = /*#__PURE__*/forwardRef((_ref, ref) => {
55
- let {
56
- customValidation,
57
- onChange,
58
- required,
59
- forceAllowValidation,
60
- isValid,
61
- value,
62
- defaultValue,
63
- ...restProps
64
- } = _ref;
65
- const [validationState, setValidationState] = useState(true);
66
- const [allowValidation, setAllowValidation] = useState(false);
67
- const validate = useCallback(defaultValue => checkValidation(required, isValid, value || defaultValue).isValid, [value, required, isValid, defaultValue]);
68
- const handleChange = useCallback(e => {
69
- const {
70
- value
71
- } = e;
72
- const isValid = checkValidation(required, isValid, value);
73
- setValidationState(isValid);
74
- onChange && onChange(e, isValid);
75
- }, [onChange, isValid, required, customValidation]);
76
-
77
- // set Allow validation true if submit button clicked
78
- useEffect(() => {
79
- forceAllowValidation && setAllowValidation(true);
80
- }, [forceAllowValidation]);
81
- useMount(() => setValidationState(validate(defaultValue)));
82
- return /*#__PURE__*/React__default.createElement(Uploader, _extends({
83
- ref: ref,
84
- isValid: !allowValidation || validationState,
85
- onChange: handleChange,
86
- required: required
87
- }, restProps));
88
- });
89
- UploaderField.propTypes = {
90
- onChange: PropTypes.func,
91
- customValidation: PropTypes.func,
92
- /**
93
- * Additional validation state
94
- */
95
- isValid: PropTypes.bool
96
- };
97
-
98
- export { UploaderField as default };
package/Widget/index.js DELETED
@@ -1,225 +0,0 @@
1
- import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
2
- import React__default, { useMemo } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { c as classnames } from '../index-031ff73c.js';
5
- import { w as widgetConfig } from '../configs-00612ce0.js';
6
- import Icon from '../Icon/index.js';
7
- import KeyValue from '../KeyValue/index.js';
8
- import ModuleTitle from '../ModuleTitle/index.js';
9
- import { s as styleInject } from '../style-inject.es-746bb8ed.js';
10
- import '../tslib.es6-f211516f.js';
11
- import '../index-5f37f281.js';
12
- import '../dateValidation-67caec66.js';
13
- import '../_commonjsHelpers-24198af3.js';
14
- import 'react-dom';
15
- import '../index-c7646e48.js';
16
- import '../GeneUIProvider/index.js';
17
-
18
- var css_248z = "[data-gene-ui-version=\"2.16.4\"] .widget-holder{background:var(--background);border-radius:2rem;height:6rem;width:100%}[data-gene-ui-version=\"2.16.4\"] .widget-holder.s-small{--font-size:1.6rem;border-radius:1rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.s-medium{border-radius:1rem;height:8rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.s-big{height:11rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder .no-data{opacity:.5}[data-gene-ui-version=\"2.16.4\"] .widget-holder.shadow{box-shadow:0 .3rem .6rem 0 #0000000d}[data-gene-ui-version=\"2.16.4\"] .widget-holder.border{border:1px solid rgba(var(--background-sc-rgb),.05)}[data-gene-ui-version=\"2.16.4\"] .widget-holder .module-title{text-transform:uppercase}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid{display:grid;grid-template-areas:\"image head\" \"image text\";grid-template-columns:auto 1fr;grid-template-rows:1fr 1fr}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-default{padding-inline:2rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-default .module-title{font-size:1.2rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-default .module-header{padding:0}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-default .image{padding-inline-end:3.5rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-default .image img{height:5rem;width:5rem}[data-gene-ui-version=\"2.16.4\"] .s-small.widget-holder.widget-grid.t-default .image{padding-inline-end:1.5rem}[data-gene-ui-version=\"2.16.4\"] .s-small.widget-holder.widget-grid.t-default .image img{height:3.4rem;width:3.4rem}[data-gene-ui-version=\"2.16.4\"] .s-medium.widget-holder.widget-grid.t-default .image{padding-inline-end:2rem}[data-gene-ui-version=\"2.16.4\"] .s-medium.widget-holder.widget-grid.t-default .image img{height:4.8rem;width:4.8rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-compact .text.key-values,[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-default .text.key-values{display:grid;gap:1.6rem;grid-template-columns:.5fr .4fr 1fr}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-compact .text .widget-timeline-holder,[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-default .text .widget-timeline-holder{align-items:center;border-left:1px solid rgba(var(--background-sc-rgb),.05);display:flex;justify-content:space-between;text-align:center}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-compact{grid-template-areas:\"head head\" \"image text\";grid-template-rows:auto 1fr}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-compact .image{padding-inline-end:1.5rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-compact .image img{height:4.8rem;width:4.8rem}[data-gene-ui-version=\"2.16.4\"] .s-small.widget-holder.widget-grid.t-compact .image{display:none}[data-gene-ui-version=\"2.16.4\"] .s-medium.widget-holder.widget-grid.t-compact .image{padding-inline:2rem}[data-gene-ui-version=\"2.16.4\"] .s-medium.widget-holder.widget-grid.t-compact .image img{height:3rem;width:3rem}[data-gene-ui-version=\"2.16.4\"] .s-big.widget-holder.widget-grid.t-compact .image{padding-inline:2rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-compact .text{padding:0 2rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.widget-grid.t-compact .text:not(.bobol)>p{text-align:end}[data-gene-ui-version=\"2.16.4\"] .widget-holder>li{align-items:center;display:flex}[data-gene-ui-version=\"2.16.4\"] .widget-holder>li.image{grid-area:image;justify-content:center}[data-gene-ui-version=\"2.16.4\"] .widget-holder>li.head{grid-area:head;overflow:hidden;padding:0 0 1px}[data-gene-ui-version=\"2.16.4\"] .widget-holder>li.text{grid-area:text;overflow:hidden}[data-gene-ui-version=\"2.16.4\"] .widget-holder>li.text>p{flex:auto;font:700 var(--font-size,1.8rem)/3rem var(--font-family)}[data-gene-ui-version=\"2.16.4\"] .widget-holder>li.text .icon{flex-shrink:0}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-minimal{align-items:center;border-radius:1rem;display:flex;flex-direction:column;justify-content:center;padding:0 .8rem;text-align:center}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-minimal.shadow{box-shadow:0 .2rem .4rem 0 #0000000d}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-minimal>li{justify-content:center;width:100%}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-minimal>li:first-child{color:rgba(var(--background-sc-rgb),.61);font:600 1.2rem/1.6rem var(--font-family)}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-minimal>li:nth-child(2){font-weight:600;margin:1rem 0 0}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-minimal>li>i{border-radius:100%;display:block;flex-shrink:0;height:.8rem;width:.8rem}html:not([dir=rtl]) .widget-holder.t-minimal>li>i{margin-right:.8rem}html[dir=rtl] .widget-holder.t-minimal>li>i{margin-left:.8rem}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-colorful{border:1px solid var(--hero);display:block;max-width:100%;min-width:14rem;padding:1rem 1.4rem .8rem;position:relative;width:auto}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-colorful:before{background:var(--hero);border-radius:inherit;content:\"\";display:block;height:100%;left:0;opacity:.03;position:absolute;top:0;width:100%}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-colorful>li{position:relative}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-colorful .widget-c-title{font:600 1.2rem/1.6rem var(--font-family);margin:0 0 .4rem;opacity:.8}[data-gene-ui-version=\"2.16.4\"] .widget-holder.t-colorful .widget-c-text{font:700 1.6rem/2.2rem var(--font-family)}[data-gene-ui-version=\"2.16.4\"] .comparison-icons-holder{--status-color:inherit;align-items:center;color:var(--status-color);display:flex;flex-shrink:0;font:700 1.4rem/1.8rem var(--font-family);margin-inline-start:.6rem;transition:color .4s}[data-gene-ui-version=\"2.16.4\"] .comparison-icons-holder.cs-up{--status-color:#51cf78}[data-gene-ui-version=\"2.16.4\"] .comparison-icons-holder.cs-up .bc-icon-comparison-down{color:rgba(var(--background-sc-rgb),.1)}[data-gene-ui-version=\"2.16.4\"] .comparison-icons-holder.cs-down{--status-color:#e84855}[data-gene-ui-version=\"2.16.4\"] .comparison-icons-holder.cs-down .bc-icon-comparison-up{color:rgba(var(--background-sc-rgb),.1)}[data-gene-ui-version=\"2.16.4\"] .comparison-icons-holder .icon+.icon{left:0;position:absolute;top:0}[data-gene-ui-version=\"2.16.4\"] .comparison-icons{position:relative}";
19
- styleInject(css_248z);
20
-
21
- function Widget(_ref) {
22
- let {
23
- type,
24
- img,
25
- title,
26
- text,
27
- color,
28
- headerActions,
29
- noDataText,
30
- noData,
31
- className,
32
- withShadow,
33
- withBorder,
34
- titleIcon,
35
- showComparisonIcons,
36
- comparisonText,
37
- comparisonStatus,
38
- size,
39
- titleProps,
40
- keyValues,
41
- ...restProps
42
- } = _ref;
43
- const showKeyValues = useMemo(() => !!keyValues.length && size === widgetConfig.size[2], [size, keyValues]);
44
- return /*#__PURE__*/React__default.createElement("ul", _extends({}, restProps, {
45
- className: classnames(className, 'widget-holder', "t-".concat(type), "s-".concat(size), {
46
- 'widget-grid': type !== widgetConfig.type[2] && type !== widgetConfig.type[3],
47
- shadow: withShadow,
48
- border: withBorder
49
- }),
50
- style: {
51
- '--hero': color
52
- }
53
- }), type === widgetConfig.type[2] ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("li", null, /*#__PURE__*/React__default.createElement("i", {
54
- style: {
55
- background: color
56
- }
57
- }), /*#__PURE__*/React__default.createElement("span", {
58
- className: "ellipsis-text"
59
- }, title)), /*#__PURE__*/React__default.createElement("li", null, /*#__PURE__*/React__default.createElement("span", {
60
- className: classnames('ellipsis-text', {
61
- 'no-data': noData
62
- })
63
- }, noData ? noDataText : text), !noData && (showComparisonIcons || comparisonText) && /*#__PURE__*/React__default.createElement("div", {
64
- className: classnames('comparison-icons-holder', "cs-".concat(comparisonStatus))
65
- }, comparisonText && /*#__PURE__*/React__default.createElement("div", {
66
- className: "comparison-text"
67
- }, comparisonText), showComparisonIcons && /*#__PURE__*/React__default.createElement("div", {
68
- className: "comparison-icons"
69
- }, /*#__PURE__*/React__default.createElement(Icon, {
70
- type: "bc-icon-comparison-up"
71
- }), /*#__PURE__*/React__default.createElement(Icon, {
72
- type: "bc-icon-comparison-down"
73
- }))))) : type === widgetConfig.type[3] ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("li", {
74
- className: "widget-c-title"
75
- }, /*#__PURE__*/React__default.createElement("p", {
76
- className: "ellipsis-text"
77
- }, title)), /*#__PURE__*/React__default.createElement("li", {
78
- className: "widget-c-text"
79
- }, /*#__PURE__*/React__default.createElement("p", {
80
- className: classnames('ellipsis-text', {
81
- 'no-data': noData
82
- })
83
- }, noData ? noDataText : text))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, img && /*#__PURE__*/React__default.createElement("li", {
84
- className: "image"
85
- }, /*#__PURE__*/React__default.createElement("img", {
86
- src: img,
87
- alt: ""
88
- })), /*#__PURE__*/React__default.createElement("li", {
89
- className: "head"
90
- }, /*#__PURE__*/React__default.createElement(ModuleTitle, _extends({
91
- title: title,
92
- color: color,
93
- size: size,
94
- cornerRadius: "position-radius",
95
- titleIcon: titleIcon
96
- }, titleProps), headerActions)), /*#__PURE__*/React__default.createElement("li", {
97
- className: classnames('text', {
98
- 'key-values': showKeyValues
99
- })
100
- }, /*#__PURE__*/React__default.createElement("p", {
101
- className: classnames('ellipsis-text', {
102
- 'no-data': noData
103
- })
104
- }, noData ? noDataText : text), !noData && (showComparisonIcons || comparisonText) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
105
- className: classnames('comparison-icons-holder', "cs-".concat(comparisonStatus))
106
- }, comparisonText && /*#__PURE__*/React__default.createElement("div", {
107
- className: "comparison-text"
108
- }, comparisonText), showComparisonIcons && /*#__PURE__*/React__default.createElement("div", {
109
- className: "comparison-icons"
110
- }, /*#__PURE__*/React__default.createElement(Icon, {
111
- type: "bc-icon-comparison-up"
112
- }), /*#__PURE__*/React__default.createElement(Icon, {
113
- type: "bc-icon-comparison-down"
114
- }))), showKeyValues && /*#__PURE__*/React__default.createElement("div", {
115
- className: "widget-timeline-holder"
116
- }, keyValues.map((_ref2, index) => {
117
- let {
118
- label,
119
- value,
120
- className,
121
- ...rest
122
- } = _ref2;
123
- return /*#__PURE__*/React__default.createElement(KeyValue, _extends({
124
- key: index,
125
- label: label,
126
- value: value,
127
- className: className
128
- }, rest));
129
- }))))));
130
- }
131
- Widget.propTypes = {
132
- /**
133
- * Switching to different types of widget's view, can be
134
- * default, minimal, compact
135
- */
136
- type: PropTypes.oneOf(widgetConfig.type),
137
- /**
138
- * Setting image to widget
139
- */
140
- img: PropTypes.string,
141
- /**
142
- * Title for widget
143
- */
144
- title: PropTypes.node.isRequired,
145
- /**
146
- * Main text for widget
147
- */
148
- text: PropTypes.node,
149
- /**
150
- * Theme color for widget
151
- */
152
- color: PropTypes.string,
153
- /**
154
- * The prop allows you to specify actions for the widget's header.
155
- * It works only for types `default` and `compact`
156
- */
157
- headerActions: PropTypes.node,
158
- /**
159
- * Text for No data state
160
- */
161
- noDataText: PropTypes.string,
162
- /**
163
- * Show/hide No data state
164
- */
165
- noData: PropTypes.bool,
166
- /**
167
- * Additional className
168
- */
169
- className: PropTypes.string,
170
- /**
171
- * Show/Hide shadow effect for widget
172
- */
173
- withShadow: PropTypes.bool,
174
- /**
175
- * Show/Hide bordered effect
176
- */
177
- withBorder: PropTypes.bool,
178
- /**
179
- * Title can have icon, defining with this prop
180
- */
181
- titleIcon: PropTypes.string,
182
- /**
183
- * Show/Hide comparison icons
184
- */
185
- showComparisonIcons: PropTypes.bool,
186
- /**
187
- * Props for title component
188
- */
189
- titleProps: PropTypes.object,
190
- /**
191
- * Comparison text
192
- */
193
- comparisonText: PropTypes.string,
194
- /**
195
- * Defining status/state of comparison icon
196
- * can be one of `'initial','up','down'`
197
- */
198
- comparisonStatus: PropTypes.oneOf(widgetConfig.comparisonStatus),
199
- /**
200
- * Widget size
201
- * `small, big, medium`
202
- */
203
- size: PropTypes.oneOf(widgetConfig.size),
204
- /**
205
- * Widget keyValues is an array of keyValue
206
- * it will appear when the size is big
207
- */
208
- keyValues: PropTypes.arrayOf(PropTypes.shape({
209
- ...KeyValue.propTypes
210
- }))
211
- };
212
- Widget.defaultProps = {
213
- type: widgetConfig.type[0],
214
- noDataText: 'No Data',
215
- noData: false,
216
- titleProps: {},
217
- withShadow: true,
218
- withBorder: false,
219
- showComparisonIcons: false,
220
- comparisonStatus: widgetConfig.comparisonStatus[0],
221
- size: widgetConfig.size[1],
222
- keyValues: []
223
- };
224
-
225
- export { Widget as default };