@geneui/components 3.0.0-next-9ffcb93-16102024 → 3.0.0-next-48d0ef7-31102024

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/Avatar.js +63 -0
  2. package/CHANGELOG.md +7 -0
  3. package/Divider.js +23 -0
  4. package/{GeneUIProvider/index.js → GeneUIProvider.js} +52 -65
  5. package/HelperText.js +69 -0
  6. package/Info.js +64 -0
  7. package/Label.js +38 -0
  8. package/Loader.js +21 -0
  9. package/Pill.js +64 -0
  10. package/TextLink.js +20 -0
  11. package/{index-65217440.js → Tooltip.js} +104 -80
  12. package/{lib → components}/atoms/Avatar/Avatar.d.ts +7 -6
  13. package/components/atoms/Avatar/index.d.ts +1 -0
  14. package/{lib → components}/atoms/Divider/Divider.d.ts +5 -5
  15. package/components/atoms/Divider/index.d.ts +1 -0
  16. package/{lib → components}/atoms/HelperText/HelperText.d.ts +6 -5
  17. package/components/atoms/HelperText/index.d.ts +1 -0
  18. package/{lib → components}/atoms/Info/Info.d.ts +5 -5
  19. package/components/atoms/Info/index.d.ts +1 -0
  20. package/{lib → components}/atoms/Label/Label.d.ts +3 -3
  21. package/components/atoms/Label/index.d.ts +1 -0
  22. package/{lib → components}/atoms/Loader/Loader.d.ts +5 -5
  23. package/components/atoms/Loader/index.d.ts +1 -0
  24. package/{lib → components}/atoms/Pill/Pill.d.ts +7 -6
  25. package/components/atoms/Pill/index.d.ts +1 -0
  26. package/{lib → components}/atoms/TextLink/TextLink.d.ts +5 -5
  27. package/components/atoms/TextLink/index.d.ts +1 -0
  28. package/{lib → components}/molecules/Tooltip/Tooltip.d.ts +26 -21
  29. package/components/molecules/Tooltip/index.d.ts +1 -0
  30. package/components/providers/GeneUIProvider/GeneUIProvider.d.ts +30 -0
  31. package/components/providers/GeneUIProvider/index.d.ts +1 -0
  32. package/hooks/index.d.ts +2 -20
  33. package/hooks/useDebounceCallback/index.d.ts +1 -0
  34. package/hooks/useDebounceCallback/useDebounceCallback.d.ts +2 -0
  35. package/hooks/useEllipsisDetection/index.d.ts +1 -1
  36. package/hooks/useEllipsisDetection/useEllipsisDetection.d.ts +2 -2
  37. package/{index-031ff73c.js → index-ce02421b.js} +4 -4
  38. package/index.d.ts +11 -121
  39. package/index.js +12 -159
  40. package/package.json +24 -43
  41. package/tokens-0abb4e1b.js +6 -0
  42. package/types/index.d.ts +0 -3
  43. package/useEllipsisDetection-46d712b6.js +34 -0
  44. package/ActionableList/index.js +0 -1694
  45. package/AdvancedSearch/index.js +0 -892
  46. package/Alert/index.js +0 -98
  47. package/Avatar/index.js +0 -58
  48. package/Badge/index.js +0 -29
  49. package/Breadcrumb/index.js +0 -130
  50. package/BusyLoader/index.js +0 -31
  51. package/Button/index.js +0 -30
  52. package/Card/index.js +0 -502
  53. package/CardList/index.js +0 -662
  54. package/CellMeasurerCache-80be385d.js +0 -229
  55. package/Charts/index.js +0 -17662
  56. package/Checkbox/index.js +0 -229
  57. package/CheckboxGroup/index.js +0 -203
  58. package/CheckboxGroupWithSearch/index.js +0 -280
  59. package/Collapse/index.js +0 -195
  60. package/ColorPicker/index.js +0 -210
  61. package/ComboBox/index.js +0 -524
  62. package/Copy/index.js +0 -56
  63. package/Counter/index.js +0 -312
  64. package/DateFilter/index.js +0 -183
  65. package/DatePicker/index.js +0 -1229
  66. package/DatePickerInput/index.js +0 -883
  67. package/Divider/index.js +0 -23
  68. package/Drawer/index.js +0 -261
  69. package/Dropdown/index.js +0 -43
  70. package/Editor/index.js +0 -22975
  71. package/Empty/index.js +0 -76
  72. package/ExtendedInput/index.js +0 -590
  73. package/Form/index.js +0 -85
  74. package/FormContainer/index.js +0 -189
  75. package/FormableCheckbox/index.js +0 -24
  76. package/FormableDatePicker/index.js +0 -43
  77. package/FormableDropdown/index.js +0 -50
  78. package/FormableEditor/index.js +0 -26
  79. package/FormableHOC-85f89a81.js +0 -83
  80. package/FormableMultiSelectDropdown/index.js +0 -50
  81. package/FormableNumberInput/index.js +0 -34
  82. package/FormableRadio/index.js +0 -22
  83. package/FormableSwitcher/index.js +0 -22
  84. package/FormableTextInput/index.js +0 -34
  85. package/FormableUploader/index.js +0 -44
  86. package/Grid/index.js +0 -167
  87. package/HelperText/index.js +0 -86
  88. package/Holder/index.js +0 -261
  89. package/Icon/index.js +0 -62
  90. package/Image/index.js +0 -45
  91. package/ImagePreview/index.js +0 -217
  92. package/Info/index.js +0 -41
  93. package/InfoOutline-dd2e89d9.js +0 -29
  94. package/InteractiveWidget/index.js +0 -78
  95. package/KeyValue/index.js +0 -22
  96. package/Label/index.js +0 -48
  97. package/LinkButton/index.js +0 -34
  98. package/Loader/index.js +0 -23
  99. package/Menu/index.js +0 -281
  100. package/MobileNavigation/index.js +0 -94
  101. package/MobilePopup/index.js +0 -182
  102. package/Modal/index.js +0 -251
  103. package/ModuleTitle/index.js +0 -141
  104. package/NavigationMenu/index.js +0 -222
  105. package/Notification/index.js +0 -120
  106. package/Option/index.js +0 -184
  107. package/Overlay/index.js +0 -187
  108. package/Overspread/index.js +0 -291
  109. package/Pagination/index.js +0 -261
  110. package/Paper/index.js +0 -96
  111. package/Pill/index.js +0 -67
  112. package/Popover/index.js +0 -725
  113. package/PopoverV2/index.js +0 -19
  114. package/Portal/index.js +0 -58
  115. package/Products/index.js +0 -115
  116. package/Profile/index.js +0 -589
  117. package/Progress/index.js +0 -200
  118. package/QRCode/index.js +0 -814
  119. package/Radio/index.js +0 -151
  120. package/RadioGroup/index.js +0 -104
  121. package/Range/index.js +0 -191
  122. package/Rating/index.js +0 -174
  123. package/RichEditor/index.js +0 -13
  124. package/RichEditor-78c2617e.js +0 -228
  125. package/Scrollbar/index.js +0 -1585
  126. package/Search/index.js +0 -75
  127. package/SearchWithDropdown/index.js +0 -140
  128. package/Section/index.js +0 -61
  129. package/SkeletonLoader/index.js +0 -81
  130. package/Slider/index.js +0 -261
  131. package/Status/index.js +0 -97
  132. package/Steps/index.js +0 -314
  133. package/SuggestionList/index.js +0 -385
  134. package/Switcher/index.js +0 -193
  135. package/Table/index.js +0 -57
  136. package/TableCompositions/index.js +0 -16995
  137. package/Tabs/index.js +0 -235
  138. package/Tag/index.js +0 -102
  139. package/TextLink/index.js +0 -20
  140. package/Textarea/index.js +0 -242
  141. package/Time/index.js +0 -62
  142. package/TimePicker/index.js +0 -575
  143. package/Timeline/index.js +0 -113
  144. package/Title/index.js +0 -65
  145. package/Toaster/index.js +0 -116
  146. package/Tooltip/index.js +0 -6
  147. package/TransferList/index.js +0 -493
  148. package/Uploader/index.js +0 -992
  149. package/ValidatableCheckbox/index.js +0 -123
  150. package/ValidatableDatePicker/index.js +0 -316
  151. package/ValidatableDropdown/index.js +0 -141
  152. package/ValidatableElements/index.js +0 -67
  153. package/ValidatableMultiSelectDropdown/index.js +0 -152
  154. package/ValidatableNumberInput/index.js +0 -204
  155. package/ValidatableRadio/index.js +0 -116
  156. package/ValidatableSwitcher/index.js +0 -93
  157. package/ValidatableTextInput/index.js +0 -167
  158. package/ValidatableTimeInput/index.js +0 -174
  159. package/ValidatableUploader/index.js +0 -98
  160. package/Widget/index.js +0 -225
  161. package/_commonjsHelpers-24198af3.js +0 -35
  162. package/_rollupPluginBabelHelpers-a83240e1.js +0 -11
  163. package/callAfterDelay-7272faca.js +0 -12
  164. package/checkTimeValidation-e56771be.js +0 -16
  165. package/checkboxRadioSwitcher-5b69d7bd.js +0 -4
  166. package/clsx.m-2bb6df4b.js +0 -3
  167. package/config-1053d64d.js +0 -20
  168. package/configs-00612ce0.js +0 -103
  169. package/configs.js +0 -111
  170. package/dateValidation-67caec66.js +0 -225
  171. package/debounce-4419bc2f.js +0 -17
  172. package/guid-8ddf77b3.js +0 -16
  173. package/hooks/useBodyScroll.js +0 -16
  174. package/hooks/useClick.js +0 -18
  175. package/hooks/useClickOutside.js +0 -25
  176. package/hooks/useDebounce.js +0 -28
  177. package/hooks/useDeviceType.js +0 -17
  178. package/hooks/useDidMount.js +0 -15
  179. package/hooks/useForceUpdate.js +0 -8
  180. package/hooks/useHover.js +0 -20
  181. package/hooks/useImgDownload.js +0 -18
  182. package/hooks/useKeyDown.js +0 -21
  183. package/hooks/useMount.js +0 -13
  184. package/hooks/useMutationObserver.js +0 -21
  185. package/hooks/usePrevious.js +0 -10
  186. package/hooks/useThrottle.js +0 -16
  187. package/hooks/useToggle.js +0 -11
  188. package/hooks/useUpdatableRef.js +0 -14
  189. package/hooks/useUpdate.js +0 -10
  190. package/hooks/useWidth.js +0 -16
  191. package/hooks/useWindowSize.js +0 -40
  192. package/index-122432cd.js +0 -270
  193. package/index-262edd7a.js +0 -77
  194. package/index-2f5aa51e.js +0 -6483
  195. package/index-370f9acd.js +0 -4
  196. package/index-45eafea6.js +0 -90
  197. package/index-480fd7d9.js +0 -10032
  198. package/index-5f37f281.js +0 -168
  199. package/index-73aaa093.js +0 -1940
  200. package/index.mobile.d.ts +0 -14
  201. package/lib/atoms/Avatar/index.d.ts +0 -1
  202. package/lib/atoms/Badge/Badge.d.ts +0 -36
  203. package/lib/atoms/Badge/index.d.ts +0 -1
  204. package/lib/atoms/BusyLoader/BusyLoader.d.ts +0 -32
  205. package/lib/atoms/BusyLoader/BusyLoaderHolderHOC.d.ts +0 -8
  206. package/lib/atoms/BusyLoader/index.d.ts +0 -1
  207. package/lib/atoms/Button/Button.d.ts +0 -70
  208. package/lib/atoms/Button/index.d.ts +0 -1
  209. package/lib/atoms/Divider/index.d.ts +0 -1
  210. package/lib/atoms/Empty/Empty.d.ts +0 -39
  211. package/lib/atoms/Empty/index.d.ts +0 -1
  212. package/lib/atoms/Empty/utils.d.ts +0 -9
  213. package/lib/atoms/HelperText/index.d.ts +0 -1
  214. package/lib/atoms/Image/Image.d.ts +0 -51
  215. package/lib/atoms/Image/index.d.ts +0 -1
  216. package/lib/atoms/ImagePreview/ImagePreview.d.ts +0 -56
  217. package/lib/atoms/ImagePreview/ImagePreviewHOC.d.ts +0 -4
  218. package/lib/atoms/ImagePreview/Magnifier.d.ts +0 -40
  219. package/lib/atoms/ImagePreview/index.d.ts +0 -1
  220. package/lib/atoms/Info/index.d.ts +0 -1
  221. package/lib/atoms/KeyValue/KeyValue.d.ts +0 -29
  222. package/lib/atoms/KeyValue/index.d.ts +0 -1
  223. package/lib/atoms/Label/index.d.ts +0 -1
  224. package/lib/atoms/LinkButton/LinkButton.d.ts +0 -46
  225. package/lib/atoms/LinkButton/index.d.ts +0 -1
  226. package/lib/atoms/Loader/index.d.ts +0 -1
  227. package/lib/atoms/Pill/index.d.ts +0 -1
  228. package/lib/atoms/Rating/DefaultSvg.d.ts +0 -3
  229. package/lib/atoms/Rating/Rating.d.ts +0 -49
  230. package/lib/atoms/Rating/index.d.ts +0 -1
  231. package/lib/atoms/TextLink/index.d.ts +0 -1
  232. package/lib/molecules/Copy/Copy.d.ts +0 -38
  233. package/lib/molecules/Copy/index.d.ts +0 -1
  234. package/lib/molecules/InteractiveWidget/InteractiveWidget.d.ts +0 -70
  235. package/lib/molecules/InteractiveWidget/InteractiveWidgetIcon.d.ts +0 -8
  236. package/lib/molecules/InteractiveWidget/index.d.ts +0 -1
  237. package/lib/molecules/Tooltip/index.d.ts +0 -1
  238. package/lib/providers/GeneUIProvider/GeneUIProvider.d.ts +0 -30
  239. package/lib/providers/GeneUIProvider/index.d.ts +0 -1
  240. package/localization-4ba17032.js +0 -46
  241. package/objectWithoutPropertiesLoose-e1596bdb.js +0 -62
  242. package/rangeAndSlider-693a3d41.js +0 -8684
  243. package/react-beautiful-dnd.esm-b637016a.js +0 -10116
  244. package/react-lifecycles-compat.es-6e1f3768.js +0 -158
  245. package/redux-e591c1b8.js +0 -536
  246. package/tokens-8ab1179c.js +0 -6
  247. package/tslib.es6-f211516f.js +0 -35
  248. package/useEllipsisDetection-c1c9ad94.js +0 -38
@@ -1,385 +0,0 @@
1
- import React__default, { useMemo, useState, useRef, useCallback, useEffect } from 'react';
2
- import { c as classnames } from '../index-031ff73c.js';
3
- import { s as stopEvent } from '../index-5f37f281.js';
4
- import useKeyDown from '../hooks/useKeyDown.js';
5
- import '../configs-00612ce0.js';
6
- import useClickOutside from '../hooks/useClickOutside.js';
7
- import { k as keyDownKeys } from '../config-1053d64d.js';
8
- import CustomScrollbar from '../Scrollbar/index.js';
9
- import { s as styleInject } from '../style-inject.es-746bb8ed.js';
10
- import { c as callAfterDelay } from '../callAfterDelay-7272faca.js';
11
- import 'prop-types';
12
- import '../dateValidation-67caec66.js';
13
- import '../_commonjsHelpers-24198af3.js';
14
- import 'react-dom';
15
- import '../_rollupPluginBabelHelpers-a83240e1.js';
16
-
17
- const getCaretPos = (e, textarea, index, key) => {
18
- textarea.insertAdjacentHTML('afterend', "<div id='dummy'></div>");
19
- const dummy = document.getElementById('dummy');
20
- const style = getComputedStyle(textarea);
21
- ['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'wordWrap', 'whiteSpace', 'borderLeftWidth', 'paddingRight', 'borderTopWidth', 'borderRightWidth', 'borderBottomWidth'].forEach(key => {
22
- dummy.style[key] = style[key];
23
- });
24
- dummy.style.overflow = 'auto';
25
- dummy.style.paddingLeft = '6px';
26
- dummy.style.width = "".concat(textarea.offsetWidth, "px");
27
- dummy.style.height = "".concat(textarea.offsetHeight - 20, "px");
28
- dummy.style.position = 'absolute';
29
- dummy.style.left = "".concat(textarea.offsetLeft, "px");
30
- dummy.style.top = "".concat(textarea.offsetTop, "px");
31
- const val = textarea.value.replaceAll(/\n/g, '<br/>');
32
- let newVal = '';
33
- let ind = 0;
34
- val.split('').forEach(i => {
35
- if (ind !== null && i === key) {
36
- ind++;
37
- }
38
- if (ind === index) {
39
- newVal += "<span id='lastId'>".concat(i, "</span>");
40
- ind = null;
41
- } else {
42
- newVal += i === ' ' ? '&nbsp;' : i;
43
- }
44
- });
45
- dummy.innerHTML = newVal;
46
- dummy.scrollTo(0, textarea.scrollTop);
47
- const lastId = document.getElementById('lastId');
48
- const returnData = {
49
- top: lastId.getBoundingClientRect().top,
50
- left: lastId.getBoundingClientRect().left
51
- };
52
- dummy.remove();
53
- return returnData;
54
- };
55
- const getCursorPos = input => {
56
- if ('selectionStart' in input && document.activeElement === input) {
57
- return {
58
- start: input.selectionStart,
59
- end: input.selectionEnd
60
- };
61
- }
62
- if (input.createTextRange) {
63
- const sel = document.selection.createRange();
64
- if (sel.parentElement() === input) {
65
- const rng = input.createTextRange();
66
- rng.moveToBookmark(sel.getBookmark());
67
- let len;
68
- for (len = 0; rng.compareEndPoints('EndToStart', rng) > 0; rng.moveEnd('character', -1)) {
69
- len++;
70
- }
71
- rng.setEndPoint('StartToStart', input.createTextRange());
72
- let pos;
73
- for (pos = {
74
- start: 0,
75
- end: len
76
- }; rng.compareEndPoints('EndToStart', rng) > 0; rng.moveEnd('character', -1)) {
77
- pos.start++;
78
- pos.end++;
79
- }
80
- return pos;
81
- }
82
- }
83
- return -1;
84
- };
85
-
86
- var css_248z = "[data-gene-ui-version=\"2.16.3\"] .suggestion-list{background:var(--background);border:1px solid #0000000d;border-radius:1rem;box-shadow:0 .2rem .4rem 0 #0000000d,0 0 0 1px #ffffff14;overflow:hidden;position:fixed;width:200px;z-index:400}[data-gene-ui-version=\"2.16.3\"] .suggestion-list .suggestion-rows{font:600 1.4rem/1.8rem var(--font-family);width:100%}[data-gene-ui-version=\"2.16.3\"] .suggestion-list .suggestion-rows ul{width:100%}[data-gene-ui-version=\"2.16.3\"] .suggestion-list .suggestion-rows ul li{align-items:center;cursor:pointer;display:flex;height:4rem;padding-left:16px;transition:background .4s,color .4s;width:100%}[data-gene-ui-version=\"2.16.3\"] .suggestion-list .suggestion-rows ul li.hover{background:rgba(var(--background-sc-rgb),.05)}";
87
- styleInject(css_248z);
88
-
89
- const ROW_WIDTH = 300;
90
- const ROW_HEIGHT = 40;
91
- const ROW_COUNT = 5;
92
- function SuggestionList(_ref) {
93
- let {
94
- onChange,
95
- onHover,
96
- elemRef,
97
- data = []
98
- } = _ref;
99
- const keys = useMemo(() => data.map(i => i.key), [data]);
100
- const [suggestionData, setSuggestionData] = useState(null);
101
- const [hoveredState, setHoveredState] = useState(0);
102
- const hoveredRowRef = useRef(null);
103
- const scrollRef = useRef(null);
104
- const realText = useRef();
105
- const dataToShow = useMemo(() => {
106
- var _suggestionData$data;
107
- if (!suggestionData) return null;
108
- const returnedData = suggestionData.search ? (_suggestionData$data = suggestionData.data) === null || _suggestionData$data === void 0 ? void 0 : _suggestionData$data.filter(i => i.label.toUpperCase().includes(suggestionData.search.toUpperCase())) : suggestionData.data;
109
- return returnedData && returnedData.length ? returnedData : null;
110
- }, [suggestionData]);
111
- if (elemRef.current) {
112
- elemRef.current.isSuggestionListOpen = !!dataToShow;
113
- }
114
- const getKeyIndex = useCallback(inputValue => {
115
- const existingKey = {
116
- index: -1,
117
- key: null
118
- };
119
- keys.forEach(i => {
120
- if (inputValue.lastIndexOf(i) > existingKey.index) {
121
- existingKey.index = inputValue.lastIndexOf(i);
122
- existingKey.key = i;
123
- }
124
- });
125
- return existingKey.index > -1 ? existingKey : null;
126
- }, [keys]);
127
- const arrowDownHandler = useCallback(e => {
128
- stopEvent(e, true);
129
- if (hoveredState < suggestionData.data.length - 1) {
130
- setHoveredState(prev => prev + 1);
131
- hoverHandler(e, hoveredState + 1);
132
- }
133
- if (hoveredState === dataToShow.length - 1) return;
134
- const scrollElem = scrollRef.current.container.children[0];
135
- if (hoveredRowRef.current && scrollElem) {
136
- if (hoveredRowRef.current.getBoundingClientRect().top - scrollElem.getBoundingClientRect().top > ROW_HEIGHT * 3) {
137
- scrollElem.scrollTo(0, (hoveredState - 3) * ROW_HEIGHT);
138
- }
139
- }
140
- }, [dataToShow, hoveredRowRef, scrollRef, hoveredState, suggestionData]);
141
- const arrowUpHandler = useCallback(e => {
142
- stopEvent(e, true);
143
- if (hoveredState > 0) {
144
- setHoveredState(prev => prev - 1);
145
- hoverHandler(e, hoveredState - 1);
146
- }
147
- if (hoveredState === dataToShow.length - 1) return;
148
- const scrollElem = scrollRef.current.container.children[0];
149
- if (hoveredRowRef.current && scrollElem) {
150
- if (hoveredRowRef.current.getBoundingClientRect().top - scrollElem.getBoundingClientRect().top < ROW_HEIGHT * 2) {
151
- scrollElem.scrollTo(0, (hoveredState - 1) * ROW_HEIGHT);
152
- }
153
- }
154
- }, [dataToShow, hoveredRowRef, scrollRef, hoveredState]);
155
- const onEnterHandler = useCallback(e => {
156
- resetText();
157
- if (dataToShow && dataToShow.length) {
158
- if (e) {
159
- stopEvent(e, true);
160
- } else {
161
- elemRef.current.focus();
162
- }
163
- const to = getCursorPos(elemRef.current).end;
164
- callAfterDelay(() => {
165
- elemRef.current.selectionEnd = to + dataToShow[hoveredState].value.toString().length;
166
- });
167
- onChange({
168
- from: to - (suggestionData.search ? suggestionData.search.length : 0) - 1,
169
- data: dataToShow[hoveredState],
170
- key: suggestionData.key,
171
- to
172
- });
173
- }
174
- setSuggestionData(null);
175
- }, [suggestionData, setSuggestionData, hoveredState, onChange, elemRef, dataToShow]);
176
- const hoverHandler = useCallback((e, hoverIndex) => {
177
- if (dataToShow && dataToShow.length) {
178
- if (!realText.current) {
179
- realText.current = elemRef.current.value;
180
- }
181
- if (e) {
182
- stopEvent(e, true);
183
- } else {
184
- elemRef.current.focus();
185
- }
186
- const to = getCursorPos(elemRef.current).end;
187
- callAfterDelay(() => {
188
- elemRef.current.selectionEnd = to;
189
- });
190
- onHover({
191
- from: to - (suggestionData.search ? suggestionData.search.length : 0),
192
- data: dataToShow[hoverIndex],
193
- key: suggestionData.key,
194
- to
195
- });
196
- }
197
- }, [suggestionData, onHover, elemRef, realText, dataToShow]);
198
- const onBackSpaseHandler = useCallback(e => {
199
- resetText();
200
- if (keys.includes(e.target.value.slice(0, getCursorPos(elemRef.current).start).slice(-1))) {
201
- setSuggestionData(null);
202
- } else {
203
- callAfterDelay(() => {
204
- const inputValue = e.target.value;
205
- const {
206
- start
207
- } = getCursorPos(elemRef.current);
208
- if (!inputValue) {
209
- setSuggestionData(null);
210
- } else if (suggestionData && suggestionData.data.length) {
211
- const fromStartToKey = inputValue.slice(0, start);
212
- setSuggestionData({
213
- ...suggestionData,
214
- search: fromStartToKey.slice(fromStartToKey.lastIndexOf(suggestionData.key) + 1)
215
- });
216
- } else {
217
- const fromStartToKey = inputValue.slice(0, start);
218
- const lastKeyObj = getKeyIndex(fromStartToKey);
219
- if (lastKeyObj) {
220
- const stringAfterKey = inputValue.slice(lastKeyObj.index + 1, fromStartToKey.length);
221
- if (inputValue.length === 1 || stringAfterKey.search(keyDownKeys.space) === -1 && (lastKeyObj.index === 0 || inputValue[lastKeyObj.index - 1] === keyDownKeys.space || RegExp(/\n/g, 'u').test(inputValue[lastKeyObj.index - 1]))) {
222
- const list = data.find(i => i.key === lastKeyObj.key);
223
- if (list) {
224
- const caretPos = getCaretPos(e, elemRef.current, fromStartToKey.split(lastKeyObj.key).length - 1, lastKeyObj.key);
225
- setSuggestionData({
226
- ...list,
227
- search: stringAfterKey,
228
- ...caretPos
229
- });
230
- }
231
- }
232
- }
233
- }
234
- });
235
- }
236
- }, [setSuggestionData, suggestionData, data, keys, elemRef, getKeyIndex]);
237
- const onKeyHandler = useCallback(e => {
238
- callAfterDelay(() => {
239
- const inputValue = e.target.value;
240
- const {
241
- key
242
- } = e;
243
- const fromStartToKey = inputValue.slice(0, getCursorPos(elemRef.current).start);
244
- if ((inputValue.length === 1 || fromStartToKey.at(-2) === keyDownKeys.space || RegExp(/\n/g, 'u').test(fromStartToKey.at(-2))) && !suggestionData) {
245
- const list = data.find(i => i.key === key);
246
- if (list) {
247
- const caretPos = getCaretPos(e, elemRef.current, fromStartToKey.split(key).length - 1, key);
248
- setSuggestionData({
249
- ...list,
250
- ...caretPos
251
- });
252
- }
253
- } else {
254
- setSuggestionData(null);
255
- }
256
- });
257
- }, [elemRef, suggestionData, setSuggestionData, data]);
258
- const resetText = () => {
259
- if (realText.current) {
260
- const cursorPosition = elemRef.current.selectionStart;
261
- elemRef.current.value = realText.current;
262
- realText.current = undefined;
263
- elemRef.current.selectionStart = cursorPosition;
264
- elemRef.current.selectionEnd = cursorPosition;
265
- }
266
- };
267
- const onRestKeysPressHandler = useCallback(e => {
268
- // Symbol is pressed
269
- if (e.key.length === 1) {
270
- resetText();
271
- }
272
- callAfterDelay(() => {
273
- const inputValue = e.target.value;
274
- const fromStartToKey = inputValue.slice(0, getCursorPos(elemRef.current).start);
275
- const lastKeyObj = getKeyIndex(fromStartToKey);
276
- if (suggestionData && lastKeyObj) {
277
- setSuggestionData({
278
- ...suggestionData,
279
- search: fromStartToKey.slice(fromStartToKey.lastIndexOf(suggestionData.key) + 1)
280
- });
281
- } else if (lastKeyObj) {
282
- const stringAfterKey = inputValue.slice(lastKeyObj.index + 1, fromStartToKey.length);
283
- if (stringAfterKey.search(keyDownKeys.space) === -1 && inputValue[lastKeyObj.index - 1] === keyDownKeys.space && !RegExp(/\n/g, 'u').test(fromStartToKey.at(-1))) {
284
- const list = data.find(i => i.key === lastKeyObj.key);
285
- if (list) {
286
- const caretPos = getCaretPos(e, elemRef.current, fromStartToKey.split(lastKeyObj.key).length - 1, lastKeyObj.key);
287
- setSuggestionData({
288
- ...list,
289
- search: stringAfterKey,
290
- ...caretPos
291
- });
292
- }
293
- }
294
- } else {
295
- setSuggestionData(null);
296
- }
297
- });
298
- }, [elemRef, getKeyIndex, suggestionData]);
299
- const handleKeyPress = useCallback(e => {
300
- const {
301
- key
302
- } = e;
303
- switch (key) {
304
- case keyDownKeys.enter:
305
- onEnterHandler(e);
306
- break;
307
- case keyDownKeys.tab:
308
- case keyDownKeys.escape:
309
- case keyDownKeys.space:
310
- case keyDownKeys.arrowLeft:
311
- case keyDownKeys.arrowRight:
312
- setSuggestionData(null);
313
- resetText();
314
- break;
315
- case keyDownKeys.arrowUp:
316
- suggestionData && arrowUpHandler(e);
317
- break;
318
- case keyDownKeys.arrowDown:
319
- suggestionData && arrowDownHandler(e);
320
- break;
321
- case keyDownKeys.backspace:
322
- onBackSpaseHandler(e);
323
- break;
324
- case keys[keys.indexOf(key)]:
325
- onKeyHandler(e);
326
- resetText();
327
- break;
328
- default:
329
- onRestKeysPressHandler(e);
330
- }
331
- }, [onEnterHandler, setSuggestionData, suggestionData, onBackSpaseHandler, onKeyHandler, onRestKeysPressHandler]);
332
- const onMouseEnter = (e, index) => {
333
- setHoveredState(index);
334
- hoverHandler(e, index);
335
- };
336
- const height = useMemo(() => dataToShow ? dataToShow.length >= ROW_COUNT ? ROW_COUNT * ROW_HEIGHT : dataToShow.length * ROW_HEIGHT : 0, [dataToShow]);
337
- const handleOutsideClick = useClickOutside(() => {
338
- setSuggestionData(null);
339
- resetText();
340
- });
341
- useEffect(() => {
342
- if (!elemRef) return;
343
- const handlePasteAnywhere = () => setSuggestionData(null);
344
- elemRef.current.addEventListener('paste', handlePasteAnywhere);
345
- return () => {
346
- elemRef.current.removeEventListener('paste', handlePasteAnywhere);
347
- };
348
- }, [elemRef]);
349
- useEffect(() => {
350
- setHoveredState(0);
351
- hoverHandler(undefined, 0);
352
- }, [suggestionData]);
353
- useKeyDown(handleKeyPress, [handleKeyPress], elemRef, []);
354
- const onItemClick = event => {
355
- event.stopPropagation();
356
- onEnterHandler();
357
- };
358
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, dataToShow && /*#__PURE__*/React__default.createElement("div", {
359
- ref: handleOutsideClick,
360
- className: "suggestion-list",
361
- style: {
362
- top: suggestionData.top - (dataToShow.length >= ROW_COUNT ? ROW_HEIGHT * ROW_COUNT : dataToShow.length * ROW_HEIGHT),
363
- left: suggestionData.left,
364
- height,
365
- width: ROW_WIDTH
366
- }
367
- }, /*#__PURE__*/React__default.createElement("div", {
368
- className: "suggestion-rows"
369
- }, /*#__PURE__*/React__default.createElement(CustomScrollbar, {
370
- ref: scrollRef,
371
- autoHeight: true,
372
- autoHeightMax: ROW_COUNT * ROW_HEIGHT,
373
- size: "small"
374
- }, /*#__PURE__*/React__default.createElement("ul", null, dataToShow.map((i, index) => /*#__PURE__*/React__default.createElement("li", {
375
- className: classnames({
376
- hover: index === hoveredState
377
- }),
378
- ref: index === hoveredState ? hoveredRowRef : null,
379
- onMouseEnter: e => onMouseEnter(e, index),
380
- onClick: onItemClick,
381
- key: i.label
382
- }, /*#__PURE__*/React__default.createElement("span", null, i.label))))))));
383
- }
384
-
385
- export { SuggestionList as default };
package/Switcher/index.js DELETED
@@ -1,193 +0,0 @@
1
- import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
2
- import React__default, { forwardRef, useRef, useState, useMemo } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { c as classnames } from '../index-031ff73c.js';
5
- import { c as checkboxRadioSwitcherConfig } from '../configs-00612ce0.js';
6
- import { n as noop, i as interceptValue } from '../index-5f37f281.js';
7
- import useKeyDown from '../hooks/useKeyDown.js';
8
- import '../checkboxRadioSwitcher-5b69d7bd.js';
9
- import { s as styleInject } from '../style-inject.es-746bb8ed.js';
10
- import { g as guid } from '../guid-8ddf77b3.js';
11
- import '../dateValidation-67caec66.js';
12
- import '../_commonjsHelpers-24198af3.js';
13
- import 'react-dom';
14
-
15
- var css_248z = "[data-gene-ui-version=\"2.16.3\"] .switcher-element{--size:1.8rem;align-items:center;background:rgba(var(--background-sc-rgb),.38);border:1px solid #0000;border-radius:2rem;color:var(--background);cursor:pointer;display:flex;font:600 .8rem/1rem var(--font-family);height:var(--size);justify-content:center;min-width:calc(var(--size)*2);padding-inline-end:.3rem;padding-inline-start:var(--size);position:relative;transition:color .2s,background .2s,border-color .2s,min-width .2s,height .2s}[data-gene-ui-version=\"2.16.3\"] .switcher-element small{background:var(--background);border-radius:1.4rem;box-shadow:0 .2rem .4rem 0 #00000029;height:calc(var(--size) - 4px);position:absolute;top:1px;transition:width .2s,left .2s,right .2s,transform .2s,background .2s,box-shadow .2s;width:calc(var(--size) - 4px)}html:not([dir=rtl]) .switcher-element small{left:1px}html[dir=rtl] .switcher-element small{right:1px}@media (hover:hover){[data-gene-ui-version=\"2.16.3\"] .crs-component .switcher-element:hover,[data-gene-ui-version=\"2.16.3\"] .crs-holder:focus-within .switcher-element,[data-gene-ui-version=\"2.16.3\"] .crs-label:hover~.crs-component .switcher-element{color:#0000}[data-gene-ui-version=\"2.16.3\"] .crs-component .switcher-element:hover small,[data-gene-ui-version=\"2.16.3\"] .crs-holder:focus-within .switcher-element small,[data-gene-ui-version=\"2.16.3\"] .crs-label:hover~.crs-component .switcher-element small{width:var(--size)}}[data-gene-ui-version=\"2.16.3\"] .switcher-element.active{background:var(--hero);color:var(--hero-sc);padding-inline-end:var(--size);padding-inline-start:.3rem}[data-gene-ui-version=\"2.16.3\"] .switcher-element.active small{background:var(--hero-sc);transform:translateX(-100%)}html:not([dir=rtl]) .switcher-element.active small{left:calc(100% - 1px)}html[dir=rtl] .switcher-element.active small{right:calc(100% - 1px);transform:translateX(100%)}[data-gene-ui-version=\"2.16.3\"] .switcher-element.s-big{--size:2rem}[data-gene-ui-version=\"2.16.3\"] .switcher-element.error-color{background:var(--danger);color:var(--danger-sc)}[data-gene-ui-version=\"2.16.3\"] .switcher-element.error-color small{background:var(--danger-sc)}[data-gene-ui-version=\"2.16.3\"] .switcher-element.read-only{background:none;border-color:rgba(var(--background-sc-rgb),.38);color:rgba(var(--background-sc-rgb),.38)}[data-gene-ui-version=\"2.16.3\"] .switcher-element.read-only small{background:rgba(var(--background-sc-rgb),.38);box-shadow:none}[data-gene-ui-version=\"2.16.3\"] .switcher-element.read-only.active{color:var(--hero)}[data-gene-ui-version=\"2.16.3\"] .switcher-element.read-only.active small{background:var(--hero)}";
16
- styleInject(css_248z);
17
-
18
- const Switcher = /*#__PURE__*/forwardRef((props, ref) => {
19
- const {
20
- onText,
21
- offText,
22
- size,
23
- label,
24
- labelPosition,
25
- labelAlignment,
26
- description,
27
- readOnly,
28
- disabled,
29
- required,
30
- isValid,
31
- errorText,
32
- defaultChecked,
33
- onChange,
34
- changeOnEnter,
35
- value,
36
- className,
37
- ...restProps
38
- } = props;
39
- const containerRef = useRef(null);
40
- const [checkedState, setCheckedState] = useState(defaultChecked);
41
- const isControlled = ('checked' in props);
42
- const checked = isControlled ? props.checked : checkedState;
43
- const randomId = useMemo(guid, []);
44
- const handleChange = e => {
45
- const {
46
- checked
47
- } = e.target;
48
- !isControlled && setCheckedState(checked);
49
- onChange(interceptValue(e, value));
50
- };
51
- const hasError = !isValid;
52
-
53
- /*
54
- * Change value on Enter key down
55
- */
56
- useKeyDown(e => {
57
- if (changeOnEnter) {
58
- setCheckedState(checked => !checked);
59
- onChange(interceptValue(e, value));
60
- }
61
- }, [value, onChange], containerRef, ['Enter']);
62
- return /*#__PURE__*/React__default.createElement("div", {
63
- ref: containerRef,
64
- className: classnames('crs-holder', className, "lp-".concat(labelPosition), "la-".concat(labelAlignment), {
65
- disabled,
66
- error: hasError,
67
- 'read-only': readOnly
68
- })
69
- }, /*#__PURE__*/React__default.createElement("div", {
70
- className: classnames('label-holder', {
71
- 'has-label': !!label
72
- })
73
- }, label && /*#__PURE__*/React__default.createElement("div", {
74
- className: "crs-item crs-label"
75
- }, /*#__PURE__*/React__default.createElement("label", {
76
- className: "ellipsis-text",
77
- htmlFor: randomId
78
- }, required && "* ", label)), /*#__PURE__*/React__default.createElement("div", {
79
- className: "crs-item crs-component"
80
- }, /*#__PURE__*/React__default.createElement("input", _extends({
81
- type: "checkbox",
82
- onChange: handleChange,
83
- checked: checked,
84
- disabled: disabled,
85
- value: value,
86
- ref: ref,
87
- id: randomId
88
- }, restProps)), /*#__PURE__*/React__default.createElement("label", {
89
- className: classnames('switcher-element', "s-".concat(size), {
90
- active: checked,
91
- 'error-color': !checked && !errorText && hasError,
92
- 'read-only': readOnly
93
- }),
94
- htmlFor: randomId
95
- }, /*#__PURE__*/React__default.createElement("span", null, checked ? onText : offText), /*#__PURE__*/React__default.createElement("small", null)))), hasError && errorText && /*#__PURE__*/React__default.createElement("div", {
96
- className: "information-message color-danger"
97
- }, errorText), description && /*#__PURE__*/React__default.createElement("div", {
98
- className: "input-description"
99
- }, description));
100
- });
101
- Switcher.propTypes = {
102
- /**
103
- * Text to be written when on
104
- */
105
- onText: PropTypes.string,
106
- /**
107
- * Text to be written when off
108
- */
109
- offText: PropTypes.string,
110
- /**
111
- * Control Switcher state with this prop. When component is controled it will not switch automatically
112
- */
113
- checked: PropTypes.bool,
114
- /**
115
- * Switcher size
116
- */
117
- size: PropTypes.oneOf(checkboxRadioSwitcherConfig.size),
118
- /**
119
- * Will add a label for switcher. Any valid React node
120
- */
121
- label: PropTypes.node,
122
- /**
123
- * Specify label position
124
- */
125
- labelPosition: PropTypes.oneOf(checkboxRadioSwitcherConfig.labelPosition),
126
- /**
127
- * Specify label alignment
128
- */
129
- labelAlignment: PropTypes.oneOf(checkboxRadioSwitcherConfig.labelAlignment),
130
- /**
131
- * Will add a description for switcher. Any valid React node
132
- */
133
- description: PropTypes.node,
134
- /**
135
- * Switcher will become readonly when set to "true"
136
- */
137
- readOnly: PropTypes.bool,
138
- /**
139
- * Switcher will change when Enter key pressed (note: its will not work inside of form component)
140
- */
141
- changeOnEnter: PropTypes.bool,
142
- /**
143
- * Switcher will become disabled when set to "true"
144
- */
145
- disabled: PropTypes.bool,
146
- /**
147
- * Switcher will add an extra asterix to the "label". For more info see "ValidatableSwitcher"(integrated Radio with "Form" organism).
148
- */
149
- required: PropTypes.bool,
150
- /**
151
- * Control Switcher validation. For more info see "ValidatableSwitcher"(integrated Radio with "Form" organism).
152
- */
153
- isValid: PropTypes.bool,
154
- /**
155
- * Shows error text when "isValid" is set to "false".
156
- */
157
- errorText: PropTypes.string,
158
- /**
159
- * This prop will only applied once as defaultState for "checked" when Swticher mounts.
160
- * Note that specifing this prop is not mean controlling it.
161
- */
162
- defaultChecked: PropTypes.bool,
163
- /**
164
- * Fires an event when Switcher changes checked state((event: Event) => void).
165
- */
166
- onChange: PropTypes.func,
167
- /**
168
- * Pass a value to Switcher and get it back within "onChange" event
169
- */
170
- value: PropTypes.any,
171
- /**
172
- * Additional className
173
- */
174
- className: PropTypes.string
175
- };
176
- Switcher.defaultProps = {
177
- onText: '',
178
- offText: '',
179
- size: checkboxRadioSwitcherConfig.size[0],
180
- label: '',
181
- labelPosition: checkboxRadioSwitcherConfig.labelPosition[0],
182
- labelAlignment: checkboxRadioSwitcherConfig.labelAlignment[0],
183
- description: '',
184
- readOnly: false,
185
- onChange: noop,
186
- disabled: false,
187
- required: false,
188
- isValid: true,
189
- errorText: '',
190
- defaultChecked: false
191
- };
192
-
193
- export { Switcher as default };
package/Table/index.js DELETED
@@ -1,57 +0,0 @@
1
- import '../_rollupPluginBabelHelpers-a83240e1.js';
2
- import 'react';
3
- export { T as default } from '../index-2f5aa51e.js';
4
- import 'prop-types';
5
- import '../index-480fd7d9.js';
6
- import '../CellMeasurerCache-80be385d.js';
7
- import '../index-031ff73c.js';
8
- import '../index-5f37f281.js';
9
- import '../hooks/useMount.js';
10
- import '../hooks/useUpdate.js';
11
- import '../configs-00612ce0.js';
12
- import '../hooks/useThrottle.js';
13
- import '../Empty/index.js';
14
- import '../Scrollbar/index.js';
15
- import '../BusyLoader/index.js';
16
- import '../guid-8ddf77b3.js';
17
- import '../debounce-4419bc2f.js';
18
- import '../hooks/useMutationObserver.js';
19
- import '../Icon/index.js';
20
- import '../style-inject.es-746bb8ed.js';
21
- import '../index-65217440.js';
22
- import '../tslib.es6-f211516f.js';
23
- import 'react-dom';
24
- import '../GeneUIProvider/index.js';
25
- import '../Button/index.js';
26
- import '../dateValidation-67caec66.js';
27
- import '../_commonjsHelpers-24198af3.js';
28
- import '../SkeletonLoader/index.js';
29
- import '../Copy/index.js';
30
- import '../callAfterDelay-7272faca.js';
31
- import '../hooks/useHover.js';
32
- import '../Popover/index.js';
33
- import '../index-122432cd.js';
34
- import '../hooks/useDeviceType.js';
35
- import '../hooks/useWindowSize.js';
36
- import '../hooks/useDebounce.js';
37
- import '../hooks/useUpdatableRef.js';
38
- import '../hooks/useForceUpdate.js';
39
- import '../Portal/index.js';
40
- import '../ExtendedInput/index.js';
41
- import '../useEllipsisDetection-c1c9ad94.js';
42
- import '../SuggestionList/index.js';
43
- import '../hooks/useKeyDown.js';
44
- import '../hooks/useClickOutside.js';
45
- import '../config-1053d64d.js';
46
- import '../Menu/index.js';
47
- import '../Option/index.js';
48
- import '../index-73aaa093.js';
49
- import '../redux-e591c1b8.js';
50
- import '../objectWithoutPropertiesLoose-e1596bdb.js';
51
- import '../react-lifecycles-compat.es-6e1f3768.js';
52
- import '../clsx.m-2bb6df4b.js';
53
- import '../hooks/useClick.js';
54
- import '../Checkbox/index.js';
55
- import '../checkboxRadioSwitcher-5b69d7bd.js';
56
- import '../index-370f9acd.js';
57
- import '../Tag/index.js';