@geneui/components 3.0.0-next-06dadf3-29102024 → 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 (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,892 +0,0 @@
1
- import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
2
- import React__default, { useRef, useState, useCallback, useEffect, useMemo } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { c as classnames } from '../index-031ff73c.js';
5
- import { a as dayjs } from '../dateValidation-67caec66.js';
6
- import { h as advancedSearchConfig } from '../configs-00612ce0.js';
7
- import useDebounce from '../hooks/useDebounce.js';
8
- import { n as noop } from '../index-5f37f281.js';
9
- import useKeyDown from '../hooks/useKeyDown.js';
10
- import useClickOutside from '../hooks/useClickOutside.js';
11
- import { P as PopoverV2 } from '../index-3188e46e.js';
12
- import ExtendedInput from '../ExtendedInput/index.js';
13
- import CustomScrollbar from '../Scrollbar/index.js';
14
- import LinkButton from '../LinkButton/index.js';
15
- import { u as useEllipsisDetection } from '../useEllipsisDetection-c1c9ad94.js';
16
- import Icon from '../Icon/index.js';
17
- import Checkbox from '../Checkbox/index.js';
18
- import { T as Tooltip } from '../index-c7646e48.js';
19
- import SkeletonLoader from '../SkeletonLoader/index.js';
20
- import Badge from '../Badge/index.js';
21
- import Empty from '../Empty/index.js';
22
- import 'react-dom';
23
- import Button from '../Button/index.js';
24
- import { s as styleInject } from '../style-inject.es-746bb8ed.js';
25
- import '../_commonjsHelpers-24198af3.js';
26
- import '../index-122432cd.js';
27
- import '../hooks/useDeviceType.js';
28
- import '../hooks/useWindowSize.js';
29
- import '../GeneUIProvider/index.js';
30
- import '../debounce-4419bc2f.js';
31
- import '../SuggestionList/index.js';
32
- import '../config-1053d64d.js';
33
- import '../callAfterDelay-7272faca.js';
34
- import '../tslib.es6-f211516f.js';
35
- import '../checkboxRadioSwitcher-5b69d7bd.js';
36
- import '../guid-8ddf77b3.js';
37
-
38
- function ListElementWithCheckbox(_ref) {
39
- let {
40
- item,
41
- onSelect
42
- } = _ref;
43
- const {
44
- checked,
45
- icon,
46
- name
47
- } = item;
48
- const checkboxRef = useRef(null);
49
- const [isFocused, setIsFocused] = useState(false);
50
- const nameRef = useRef(null);
51
- const isNameTruncated = useEllipsisDetection(nameRef);
52
-
53
- // Handle blur event to clear focus state
54
- const handleBlur = useCallback(() => setIsFocused(false), []);
55
-
56
- // Handle Focus event to add focus state
57
- const handleFocus = useCallback(() => setIsFocused(true), []);
58
- return /*#__PURE__*/React__default.createElement("li", {
59
- className: classnames('listElementWithCheckbox', {
60
- 'listElementWithCheckbox-hover': isFocused
61
- })
62
- }, /*#__PURE__*/React__default.createElement("label", {
63
- className: "listElementWithCheckbox__label"
64
- }, item.hasOwnProperty('checked') && /*#__PURE__*/React__default.createElement(Checkbox, {
65
- ref: checkboxRef,
66
- checked: checked,
67
- onChange: () => {
68
- onSelect(item);
69
- },
70
- className: "listElementWithCheckbox__checkbox",
71
- onBlur: handleBlur,
72
- onFocus: handleFocus
73
- }), icon && /*#__PURE__*/React__default.createElement(Icon, {
74
- type: icon,
75
- className: "listElementWithCheckbox__icon"
76
- }), name && /*#__PURE__*/React__default.createElement(Tooltip, {
77
- text: name,
78
- isVisible: isNameTruncated
79
- }, /*#__PURE__*/React__default.createElement("span", {
80
- className: "listElementWithCheckbox__name ellipsis-text",
81
- ref: nameRef
82
- }, name))));
83
- }
84
- ListElementWithCheckbox.defaultProps = {
85
- onSelect: noop,
86
- item: {
87
- checked: false
88
- }
89
- };
90
- ListElementWithCheckbox.propTypes = {
91
- item: PropTypes.shape({
92
- name: PropTypes.string,
93
- value: PropTypes.string,
94
- checked: PropTypes.bool,
95
- icon: PropTypes.string
96
- })
97
- };
98
-
99
- function SkeletonSet(_ref) {
100
- let {
101
- count,
102
- searchResult
103
- } = _ref;
104
- return searchResult ? /*#__PURE__*/React__default.createElement("ul", {
105
- className: "skeleton"
106
- }, Array(count || 1).fill('').map((_, i) => /*#__PURE__*/React__default.createElement("li", {
107
- className: "skeleton__searchElement",
108
- key: i
109
- }, /*#__PURE__*/React__default.createElement(SkeletonLoader, {
110
- duration: +"".concat(2, ".0", i),
111
- width: "100%",
112
- isBusy: true
113
- })))) : /*#__PURE__*/React__default.createElement("ul", null, Array(count || 1).fill('').map((_, i) => /*#__PURE__*/React__default.createElement("li", {
114
- className: "skeleton__filter",
115
- key: i
116
- }, /*#__PURE__*/React__default.createElement(SkeletonLoader, {
117
- duration: 2,
118
- height: "23px",
119
- width: "23px",
120
- isBusy: true
121
- }), /*#__PURE__*/React__default.createElement("span", {
122
- style: {
123
- width: '10px'
124
- }
125
- }), /*#__PURE__*/React__default.createElement(SkeletonLoader, {
126
- duration: +"".concat(2, ".0", i),
127
- height: "23px",
128
- width: "".concat(Math.floor(Math.random() * 51) + 50, "%"),
129
- isBusy: true
130
- }))));
131
- }
132
- SkeletonSet.defaultProps = {};
133
- SkeletonSet.propTypes = {};
134
-
135
- function FilterList(_ref) {
136
- let {
137
- data,
138
- skeletonCount,
139
- onSelect
140
- } = _ref;
141
- const {
142
- data: filterData,
143
- isLoading,
144
- onShowMoreClick,
145
- sectionNameText,
146
- hasActiveShowMore,
147
- showMoreText
148
- } = data;
149
- const listRef = useRef(null);
150
- const scrollbarRef = useRef(null);
151
- const [ableToScroll, setAbleToScroll] = useState(false);
152
- const [dataLengthSnapshots, setDataLengthSnapshots] = useState([]);
153
- const [elementTopToScroll, setElementTopToScroll] = useState(0);
154
- const onShowMoreHandler = useCallback(e => {
155
- onShowMoreClick(e);
156
- setAbleToScroll(true);
157
- }, []);
158
- useEffect(() => {
159
- setDataLengthSnapshots(prev => [...prev, filterData === null || filterData === void 0 ? void 0 : filterData.length]);
160
- }, [filterData === null || filterData === void 0 ? void 0 : filterData.length]);
161
- useEffect(() => {
162
- var _listRef$current, _listRef$current$chil;
163
- const scrollToElementTop = +(listRef === null || listRef === void 0 ? void 0 : (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : (_listRef$current$chil = _listRef$current.children[dataLengthSnapshots[(dataLengthSnapshots === null || dataLengthSnapshots === void 0 ? void 0 : dataLengthSnapshots.length) - 1] - 1]) === null || _listRef$current$chil === void 0 ? void 0 : _listRef$current$chil.offsetTop);
164
- if (!isLoading && ableToScroll) {
165
- setElementTopToScroll(scrollToElementTop);
166
- setAbleToScroll(false);
167
- }
168
- }, [isLoading]);
169
- return /*#__PURE__*/React__default.createElement("div", {
170
- className: "filterList__filter"
171
- }, /*#__PURE__*/React__default.createElement(CustomScrollbar, {
172
- autoHeightMax: 500,
173
- className: "filterList__scrollbar",
174
- style: {
175
- height: '100%'
176
- },
177
- ref: scrollbarRef,
178
- scrollTop: elementTopToScroll,
179
- withSmoothScroll: true
180
- }, /*#__PURE__*/React__default.createElement("h6", {
181
- className: "filterList__filterHeader"
182
- }, sectionNameText), /*#__PURE__*/React__default.createElement("ul", {
183
- className: "filterList__filterList",
184
- ref: listRef
185
- }, isLoading ? /*#__PURE__*/React__default.createElement(SkeletonSet, {
186
- count: skeletonCount
187
- }) : filterData === null || filterData === void 0 ? void 0 : filterData.map((item, index) => /*#__PURE__*/React__default.createElement(ListElementWithCheckbox, {
188
- key: index,
189
- onSelect: onSelect,
190
- item: item
191
- })), hasActiveShowMore && /*#__PURE__*/React__default.createElement("li", {
192
- className: "filterList__showMoreLi"
193
- }, /*#__PURE__*/React__default.createElement(LinkButton, {
194
- tabIndex: 0,
195
- ariaLabel: showMoreText,
196
- onClick: onShowMoreHandler,
197
- className: "filterList__showMoreLink"
198
- }, showMoreText)))));
199
- }
200
- FilterList.defaultProps = {
201
- data: {
202
- data: []
203
- },
204
- onSelect: noop,
205
- skeletonCount: 5,
206
- showMoreIsLoading: false
207
- };
208
- FilterList.propTypes = {
209
- /**
210
- * data structure for secondary filter
211
- */
212
- data: PropTypes.shape({
213
- sectionNameText: PropTypes.string,
214
- onChange: PropTypes.func,
215
- hasActiveShowMore: PropTypes.bool,
216
- showMoreText: PropTypes.string,
217
- showMoreIsLoading: PropTypes.bool,
218
- onShowMoreClick: PropTypes.func,
219
- isLoading: PropTypes.bool,
220
- data: PropTypes.arrayOf(PropTypes.shape({
221
- name: PropTypes.string,
222
- value: PropTypes.string,
223
- checked: PropTypes.bool,
224
- icon: PropTypes.string,
225
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
226
- }))
227
- }),
228
- skeleton: PropTypes.element,
229
- onSelect: PropTypes.func,
230
- skeletonCount: PropTypes.number
231
- };
232
-
233
- function SearchResultRow(_ref) {
234
- let {
235
- element
236
- } = _ref;
237
- const {
238
- icon,
239
- id,
240
- title,
241
- name,
242
- date,
243
- actions
244
- } = element;
245
- const [isFocused, setIsFocused] = useState(false);
246
- const [focusedIndex, setFocusedIndex] = useState(null);
247
- const titleRef = useRef(null);
248
- const isTitleTruncated = useEllipsisDetection(titleRef);
249
- const nameRef = useRef(null);
250
- const isNameTruncated = useEllipsisDetection(nameRef);
251
-
252
- // Handle blur event to clear focus state
253
- const handleBlur = useCallback(() => {
254
- setFocusedIndex(null);
255
- setIsFocused(false);
256
- }, [element]);
257
-
258
- // Handle Focus event to add focus state
259
- const handleFocus = useCallback(index => {
260
- setFocusedIndex(index);
261
- setIsFocused(true);
262
- }, [element]);
263
- return /*#__PURE__*/React__default.createElement("li", {
264
- className: classnames('searchResultRow', {
265
- 'searchResultRow-hover': isFocused
266
- })
267
- }, icon && /*#__PURE__*/React__default.createElement(Icon, {
268
- type: element.icon,
269
- className: "searchResultRow__icon"
270
- }), /*#__PURE__*/React__default.createElement("div", {
271
- className: "searchResultRow__info"
272
- }, (id || title) && /*#__PURE__*/React__default.createElement("div", {
273
- className: "searchResultRow__titleWrapper"
274
- }, id && /*#__PURE__*/React__default.createElement("span", {
275
- className: "searchResultRow__id"
276
- }, id), title && /*#__PURE__*/React__default.createElement(Tooltip, {
277
- text: title,
278
- isVisible: isTitleTruncated
279
- }, /*#__PURE__*/React__default.createElement("span", {
280
- className: "searchResultRow__title ellipsis-text",
281
- ref: titleRef
282
- }, title))), (name || date) && /*#__PURE__*/React__default.createElement("div", {
283
- className: "searchResultRow__nameWrapper"
284
- }, name && /*#__PURE__*/React__default.createElement(Tooltip, {
285
- text: name,
286
- isVisible: isNameTruncated
287
- }, /*#__PURE__*/React__default.createElement("span", {
288
- className: "searchResultRow__name ellipsis-text",
289
- ref: nameRef
290
- }, name)), name && date && /*#__PURE__*/React__default.createElement(Icon, {
291
- type: "bc-icon-dot",
292
- className: "searchResultRow__dateSeparator"
293
- }), date && /*#__PURE__*/React__default.createElement("div", {
294
- className: "searchResultRow__dateWrapper"
295
- }, date.labelText && /*#__PURE__*/React__default.createElement("span", {
296
- className: "searchResultRow__dateText"
297
- }, date.labelText), date.date && /*#__PURE__*/React__default.createElement("span", {
298
- className: "searchResultRow__date"
299
- }, date.date)))), /*#__PURE__*/React__default.createElement("div", {
300
- className: classnames('searchResultRow__actions', {
301
- 'searchResultRow__actions-hover': isFocused
302
- })
303
- }, actions === null || actions === void 0 ? void 0 : actions.map((action, index) => /*#__PURE__*/React__default.createElement(Tooltip, {
304
- key: index,
305
- text: action === null || action === void 0 ? void 0 : action.description,
306
- isVisible: !!(action !== null && action !== void 0 && action.description),
307
- alwaysShow: !!(action !== null && action !== void 0 && action.description) && index === focusedIndex
308
- }, /*#__PURE__*/React__default.createElement(Button, {
309
- tabIndex: 0,
310
- size: "medium",
311
- icon: action.icon,
312
- onBlur: handleBlur,
313
- appearance: "minimal",
314
- onFocus: () => {
315
- handleFocus(index);
316
- },
317
- cornerRadius: "smooth",
318
- onClick: () => action === null || action === void 0 ? void 0 : action.onClick(element),
319
- className: "searchResultRow__action",
320
- ariaLabel: action.name || action.icon
321
- })))));
322
- }
323
- SearchResultRow.defaultProps = {
324
- element: {}
325
- };
326
- SearchResultRow.propTypes = {
327
- element: PropTypes.shape({
328
- icon: PropTypes.string,
329
- id: PropTypes.string,
330
- title: PropTypes.string,
331
- type: PropTypes.string,
332
- name: PropTypes.string,
333
- date: PropTypes.shape({
334
- labelText: PropTypes.string,
335
- date: PropTypes.oneOfType([PropTypes.instanceOf(dayjs), PropTypes.instanceOf(Date), PropTypes.string, PropTypes.number])
336
- }),
337
- actions: PropTypes.arrayOf(PropTypes.shape({
338
- name: PropTypes.string,
339
- icon: PropTypes.string.isRequired,
340
- onClick: PropTypes.func,
341
- description: PropTypes.string
342
- }))
343
- })
344
- };
345
-
346
- function SearchResult(_ref) {
347
- let {
348
- data,
349
- totalCount,
350
- noDataText,
351
- initialData,
352
- showMoreText,
353
- totalCountMax,
354
- totalCountText,
355
- onShowMoreClick,
356
- isSearchLoading,
357
- showMoreIsLoading,
358
- hasActiveShowMore,
359
- initialDataDescription
360
- } = _ref;
361
- const listRef = useRef(null);
362
- const scrollbarRef = useRef(null);
363
- const [ableToScroll, setAbleToScroll] = useState(false);
364
- const [dataLengthSnapshots, setDataLengthSnapshots] = useState([]);
365
- const [elementTopToScroll, setElementTopToScroll] = useState(0);
366
- const onShowMoreHandler = useCallback(e => {
367
- onShowMoreClick(e);
368
- setAbleToScroll(true);
369
- }, []);
370
- useEffect(() => {
371
- setDataLengthSnapshots(prev => [...prev, data.length]);
372
- }, [data.length]);
373
- useEffect(() => {
374
- var _listRef$current, _listRef$current$chil;
375
- // Formula for getting the top of the element and adding 29px for showing showMore link and half of the last visible row.
376
- const scrollToElementTop = +(listRef === null || listRef === void 0 ? void 0 : (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : (_listRef$current$chil = _listRef$current.children[dataLengthSnapshots[dataLengthSnapshots.length - 2] - 1]) === null || _listRef$current$chil === void 0 ? void 0 : _listRef$current$chil.offsetTop) + 29;
377
- if (!isSearchLoading && ableToScroll) {
378
- setElementTopToScroll(scrollToElementTop);
379
- setAbleToScroll(false);
380
- }
381
- }, [isSearchLoading]);
382
- return /*#__PURE__*/React__default.createElement("div", {
383
- className: "searchResult"
384
- }, isSearchLoading && /*#__PURE__*/React__default.createElement(SkeletonSet, {
385
- searchResult: true,
386
- count: 8
387
- }), /*#__PURE__*/React__default.createElement(CustomScrollbar, {
388
- autoHeightMax: 500,
389
- className: classnames('searchResult__scrollbar', {
390
- 'searchResult__scrollbar-loading': isSearchLoading
391
- }),
392
- ref: scrollbarRef,
393
- scrollTop: elementTopToScroll,
394
- withSmoothScroll: true
395
- }, /*#__PURE__*/React__default.createElement("div", {
396
- className: "searchResult__header"
397
- }, /*#__PURE__*/React__default.createElement("span", {
398
- className: "searchResult__text"
399
- }, totalCount > 0 && totalCountText || initialData.length > 0 && initialDataDescription), totalCount > 0 && /*#__PURE__*/React__default.createElement(Badge, {
400
- className: "searchResult__badge",
401
- count: totalCount,
402
- maxCount: totalCountMax,
403
- size: "default",
404
- color: "primary"
405
- })), (data === null || data === void 0 ? void 0 : data.length) > 0 || initialData.length > 0 ? /*#__PURE__*/React__default.createElement("ul", {
406
- className: "searchResult__list",
407
- role: "navigation",
408
- ref: listRef
409
- }, initialData.length > 0 ? initialData.map((elem, index) => /*#__PURE__*/React__default.createElement(SearchResultRow, {
410
- key: index,
411
- element: elem
412
- })) : data === null || data === void 0 ? void 0 : data.map((elem, index) => /*#__PURE__*/React__default.createElement(SearchResultRow, {
413
- key: index,
414
- element: elem
415
- })), hasActiveShowMore && /*#__PURE__*/React__default.createElement("li", {
416
- className: "searchResult__showMoreLi"
417
- }, /*#__PURE__*/React__default.createElement(LinkButton, {
418
- tabIndex: 0,
419
- ariaLabel: showMoreText,
420
- onClick: onShowMoreHandler,
421
- className: "searchResult__showMoreLink"
422
- }, showMoreText))) : /*#__PURE__*/React__default.createElement(Empty, {
423
- appearance: "without-circles",
424
- title: noDataText,
425
- type: "search",
426
- className: "searchResult__empty"
427
- })));
428
- }
429
- SearchResult.defaultProps = {
430
- initialDataDescription: 'initial data description',
431
- isSearchLoading: false,
432
- showMoreIsLoading: false
433
- };
434
- SearchResult.propTypes = {
435
- /**
436
- * total count of data to show in badge
437
- */
438
- totalCount: PropTypes.number,
439
- /**
440
- * text for no data to display
441
- */
442
- noDataText: PropTypes.string,
443
- /**
444
- * If search field is empty, will show initialData for example (Recently modified data).
445
- */
446
- initialData: PropTypes.arrayOf(PropTypes.shape({
447
- icon: PropTypes.string,
448
- id: PropTypes.string,
449
- title: PropTypes.string,
450
- type: PropTypes.string,
451
- name: PropTypes.string,
452
- date: PropTypes.shape({
453
- labelText: PropTypes.string,
454
- date: PropTypes.oneOfType([PropTypes.instanceOf(dayjs), PropTypes.instanceOf(Date), PropTypes.string, PropTypes.number])
455
- }),
456
- actions: PropTypes.arrayOf(PropTypes.shape({
457
- name: PropTypes.string,
458
- icon: PropTypes.string.isRequired,
459
- onClick: PropTypes.func,
460
- description: PropTypes.string
461
- }))
462
- })),
463
- /**
464
- * text for link under search result
465
- */
466
- showMoreText: PropTypes.string,
467
- /**
468
- * total max count of data to show totalCountMax+ in badge
469
- */
470
- totalCountMax: PropTypes.number,
471
- /**
472
- * label text for badge component
473
- */
474
- totalCountText: PropTypes.string,
475
- /**
476
- * Fires an event when clicked on link under search result
477
- */
478
- onShowMoreClick: PropTypes.func,
479
- /**
480
- * To control showMore loading state
481
- */
482
- showMoreIsLoading: PropTypes.bool,
483
- /**
484
- * search loading state
485
- */
486
- isSearchLoading: PropTypes.bool,
487
- /**
488
- * if hasActive hasActiveShowMore is true you will see show more link under search result
489
- */
490
- hasActiveShowMore: PropTypes.bool,
491
- /**
492
- * If search field is empty, initialDataDescription is describing witch data is showing by default for example (Recently modified data).
493
- */
494
- initialDataDescription: PropTypes.string,
495
- /**
496
- * data structure
497
- * */
498
- data: PropTypes.arrayOf(PropTypes.shape({
499
- icon: PropTypes.string,
500
- id: PropTypes.string,
501
- title: PropTypes.string,
502
- type: PropTypes.string,
503
- name: PropTypes.string,
504
- date: PropTypes.shape({
505
- labelText: PropTypes.string,
506
- date: PropTypes.oneOfType([PropTypes.instanceOf(dayjs), PropTypes.instanceOf(Date), PropTypes.string, PropTypes.number])
507
- }),
508
- actions: PropTypes.arrayOf(PropTypes.shape({
509
- name: PropTypes.string,
510
- icon: PropTypes.string.isRequired,
511
- onClick: PropTypes.func,
512
- description: PropTypes.string
513
- }))
514
- }))
515
- };
516
-
517
- function Content(_ref) {
518
- let {
519
- data,
520
- totalCount,
521
- noDataText,
522
- initialData,
523
- showMoreText,
524
- totalCountMax,
525
- totalCountText,
526
- isSearchLoading,
527
- onShowMoreClick,
528
- hasActiveShowMore,
529
- primaryFilterData,
530
- secondaryFilterData,
531
- initialDataDescription
532
- } = _ref;
533
- const [clonedPrimaryFilterData, setClonedPrimaryFilterData] = useState({
534
- ...primaryFilterData
535
- });
536
- const [clonedSecondaryFilterData, setClonedSecondaryFilterData] = useState({
537
- ...secondaryFilterData
538
- });
539
- useEffect(() => setClonedPrimaryFilterData({
540
- ...primaryFilterData
541
- }), [primaryFilterData]);
542
- useEffect(() => setClonedSecondaryFilterData({
543
- ...secondaryFilterData
544
- }), [secondaryFilterData]);
545
- const newFilterData = useCallback((clonedData, selectedElement) => ({
546
- ...clonedData,
547
- data: clonedData === null || clonedData === void 0 ? void 0 : clonedData.data.map(elem => {
548
- if (elem.id === selectedElement.id) {
549
- elem.checked = !elem.checked;
550
- }
551
- return elem;
552
- })
553
- }), []);
554
- const handleSelectPrimary = useCallback(selectedElement => {
555
- const newPrimaryFilterData = newFilterData(clonedPrimaryFilterData, selectedElement);
556
- setClonedPrimaryFilterData(newPrimaryFilterData);
557
- primaryFilterData.onChange(newPrimaryFilterData.data);
558
- }, [clonedPrimaryFilterData]);
559
- const handleSelectSecondary = useCallback(selectedElement => {
560
- const newSecondaryFilterData = newFilterData(clonedSecondaryFilterData, selectedElement);
561
- setClonedSecondaryFilterData(newSecondaryFilterData);
562
- secondaryFilterData.onChange(newSecondaryFilterData.data);
563
- }, [clonedSecondaryFilterData.data]);
564
- const skeletonCount = useMemo(() => primaryFilterData && secondaryFilterData ? 5 : 11, [primaryFilterData, secondaryFilterData]);
565
- return /*#__PURE__*/React__default.createElement("div", {
566
- className: "advancedSearch__content"
567
- }, /*#__PURE__*/React__default.createElement("div", {
568
- className: classnames('advancedSearch__searchResult', {
569
- 'advancedSearch__searchResult-border': primaryFilterData || secondaryFilterData
570
- })
571
- }, /*#__PURE__*/React__default.createElement(SearchResult, {
572
- data: data,
573
- noDataText: noDataText,
574
- totalCount: totalCount,
575
- initialData: initialData,
576
- showMoreText: showMoreText,
577
- totalCountMax: totalCountMax,
578
- totalCountText: totalCountText,
579
- onShowMoreClick: onShowMoreClick,
580
- isSearchLoading: isSearchLoading,
581
- hasActiveShowMore: hasActiveShowMore,
582
- initialDataDescription: initialDataDescription
583
- })), (primaryFilterData || secondaryFilterData) && /*#__PURE__*/React__default.createElement("div", {
584
- className: "advancedSearch__filters"
585
- }, primaryFilterData && /*#__PURE__*/React__default.createElement(FilterList, {
586
- data: primaryFilterData,
587
- skeletonCount: skeletonCount,
588
- onSelect: handleSelectPrimary
589
- }), secondaryFilterData && primaryFilterData && /*#__PURE__*/React__default.createElement("div", {
590
- className: "advancedSearch__divider"
591
- }), secondaryFilterData && /*#__PURE__*/React__default.createElement(FilterList, {
592
- data: secondaryFilterData,
593
- skeletonCount: skeletonCount,
594
- onSelect: handleSelectSecondary
595
- })));
596
- }
597
- Content.defaultProps = {};
598
- Content.propTypes = {};
599
-
600
- var css_248z = "[data-gene-ui-version=\"2.16.4\"] .advancedSearch{margin-left:auto;margin-right:0;min-height:3.6rem;min-width:10rem;position:relative;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}[data-gene-ui-version=\"2.16.4\"] .advancedSearch-left{margin-left:0;margin-right:auto}[data-gene-ui-version=\"2.16.4\"] .advancedSearch__wrapper{color:rgba(var(--background-sc-rgb),.75);left:auto;max-width:var(--advanced-search-width);position:absolute;right:0;top:0;width:100vw}[data-gene-ui-version=\"2.16.4\"] .advancedSearch__wrapper-left{left:0;right:auto}[data-gene-ui-version=\"2.16.4\"] .advancedSearch__popover{min-height:50rem;width:var(--advanced-search-width)}[data-gene-ui-version=\"2.16.4\"] .advancedSearch__content{color:rgba(var(--background-sc-rgb),.75);display:flex;height:52rem;justify-content:space-between;max-height:50rem!important}[data-gene-ui-version=\"2.16.4\"] .advancedSearch__searchResult{flex-grow:3;height:auto;max-height:100%}[data-gene-ui-version=\"2.16.4\"] .advancedSearch__searchResult-border{border-left:none;border-right:1px solid rgba(var(--background-sc-rgb),.3)}[data-gene-ui-version=\"2.16.4\"] [dir=rtl] .advancedSearch__searchResult-border{border-left:1px solid rgba(var(--background-sc-rgb),.3);border-right:none}[data-gene-ui-version=\"2.16.4\"] .advancedSearch__filters{width:27rem}[data-gene-ui-version=\"2.16.4\"] .advancedSearch__divider{border-bottom:1px solid rgba(var(--background-sc-rgb),.3)}[data-gene-ui-version=\"2.16.4\"] .filterList__filter{height:50%;min-height:50%;padding:.8rem 0;padding-inline-end:0;width:100%}[data-gene-ui-version=\"2.16.4\"] .filterList__filterHeader{font-size:1.2rem;padding:.8rem}[data-gene-ui-version=\"2.16.4\"] .filterList__filterList{display:flex;flex-direction:column}[data-gene-ui-version=\"2.16.4\"] .filterList__showMoreLi{margin:.8rem}[data-gene-ui-version=\"2.16.4\"] .filterList__showMoreLink{padding:.4rem .8rem}[data-gene-ui-version=\"2.16.4\"] .listElementWithCheckbox{align-items:center;display:flex;flex-wrap:nowrap;height:4rem;padding:0 1.6rem}[data-gene-ui-version=\"2.16.4\"] .listElementWithCheckbox-hover,[data-gene-ui-version=\"2.16.4\"] .listElementWithCheckbox:hover{background:rgba(var(--background-sc-rgb),.03)}[data-gene-ui-version=\"2.16.4\"] .listElementWithCheckbox__label{align-items:center;cursor:pointer;display:flex;-webkit-user-select:none;user-select:none;width:100%}[data-gene-ui-version=\"2.16.4\"] .listElementWithCheckbox__icon,[data-gene-ui-version=\"2.16.4\"] .listElementWithCheckbox__name{margin-inline-start:.8rem}[data-gene-ui-version=\"2.16.4\"] .searchResult{height:100%;padding:.8rem 0;padding-inline-end:0;position:relative}[data-gene-ui-version=\"2.16.4\"] .searchResult__scrollbar{height:100%}[data-gene-ui-version=\"2.16.4\"] .searchResult__scrollbar-loading{visibility:hidden}[data-gene-ui-version=\"2.16.4\"] .searchResult__header{align-items:center;display:flex;justify-content:flex-start;padding:.8rem;width:100%}[data-gene-ui-version=\"2.16.4\"] .searchResult__list{width:100%}[data-gene-ui-version=\"2.16.4\"] .searchResult__text{font-size:1.2rem}[data-gene-ui-version=\"2.16.4\"] .searchResult__badge{margin-inline-start:.8rem}[data-gene-ui-version=\"2.16.4\"] .searchResult__showMoreLi{margin:.8rem;padding:.8rem 0;padding-inline-start:.8rem}[data-gene-ui-version=\"2.16.4\"] .searchResult__showMoreLink{padding:.4rem}[data-gene-ui-version=\"2.16.4\"] .searchResult__empty{height:calc(100% - 5.5rem)}[data-gene-ui-version=\"2.16.4\"] .searchResultRow{align-items:center;display:flex;height:4.5rem;justify-content:space-between;margin:.4rem 0;max-width:100%;padding:.4rem .8rem;width:100%}[data-gene-ui-version=\"2.16.4\"] .searchResultRow-hover,[data-gene-ui-version=\"2.16.4\"] .searchResultRow:hover{background:rgba(var(--background-sc-rgb),.03)}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__icon{padding:0 .8rem}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__info{display:flex;flex-direction:column;flex-grow:2;height:100%;justify-content:space-between;overflow:hidden;padding-inline-start:.8rem;width:100%}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__titleWrapper{align-items:center;display:flex;font-weight:600}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__id{color:rgba(var(--background-sc-rgb),.6);margin-inline-end:.8rem}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__title{color:var(--background-sc-rgb)}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__nameWrapper{align-items:center;color:rgba(var(--background-sc-rgb),.6);display:flex;flex-wrap:nowrap}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__name{font-size:1.2rem;white-space:nowrap}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__dateSeparator{font-size:1.2rem;padding-top:.3rem}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__dateWrapper{align-items:center;display:flex;font-size:1rem;padding-top:.3rem}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__dateText{font-style:italic;margin-inline-end:.4rem}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__actions{display:flex;height:100%}[data-gene-ui-version=\"2.16.4\"] .searchResultRow__action{color:var(--hero);cursor:pointer;margin:0 .4rem}[data-gene-ui-version=\"2.16.4\"] .skeleton{height:100%;left:0;position:absolute;top:0;width:100%}[data-gene-ui-version=\"2.16.4\"] .skeleton__filter{align-items:center;display:flex;flex-wrap:nowrap;height:4rem;padding:0 .8rem}[data-gene-ui-version=\"2.16.4\"] .skeleton__searchElement{align-items:center;display:flex;height:44px;margin:1.5rem .8rem;padding-inline-end:.8rem}";
601
- styleInject(css_248z);
602
-
603
- function AdvancedSearch(_ref) {
604
- let {
605
- data,
606
- isOpen,
607
- position,
608
- onSearch,
609
- totalCount,
610
- noDataText,
611
- initialData,
612
- showMoreText,
613
- totalCountMax,
614
- totalCountText,
615
- onOutsideClick,
616
- onShowMoreClick,
617
- isSearchLoading,
618
- openedInputWidth,
619
- closedInputWidth,
620
- hasActiveShowMore,
621
- primaryFilterData,
622
- secondaryFilterData,
623
- extendedInputConfigs,
624
- initialDataDescription
625
- } = _ref;
626
- const parentRef = useRef(null);
627
- const searchRef = useRef(null);
628
- const [popoverOpen, setPopoverOpen] = useState(false);
629
- const [initialDataState, setInitialDataState] = useState([]);
630
- const [searchValue, setSearchValue] = useState(null);
631
- const debouncedSearchValue = useDebounce(searchValue, 300);
632
- const isOpenControlled = useMemo(() => isOpen !== undefined, [isOpen]);
633
- useEffect(() => {
634
- if (debouncedSearchValue === null) return;
635
- onSearch(debouncedSearchValue);
636
- }, [debouncedSearchValue]);
637
- const openPopoverHandler = e => {
638
- e && (e.currentTarget.onFocus = true);
639
- if (!popoverOpen) setPopoverOpen(true);
640
- };
641
- const closePopoverHandler = useCallback(() => setPopoverOpen(false), []);
642
- useKeyDown(e => {
643
- var _searchRef$current;
644
- switch (e.key) {
645
- case 'Escape':
646
- (searchRef === null || searchRef === void 0 ? void 0 : searchRef.current) && (searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.blur());
647
- closePopoverHandler();
648
- break;
649
- }
650
- }, [close, focus, blur, popoverOpen], parentRef, ['Escape']);
651
-
652
- // initial data setter
653
- useEffect(() => {
654
- setInitialDataState((debouncedSearchValue === null || debouncedSearchValue === void 0 ? void 0 : debouncedSearchValue.length) > 0 ? [] : initialData);
655
- }, [debouncedSearchValue]);
656
- const inputAndPopoverWidthVariable = useMemo(() => ({
657
- '--advanced-search-width': (isOpenControlled ? isOpen : popoverOpen) ? "".concat(openedInputWidth, "vw") : closedInputWidth
658
- }), [popoverOpen, isOpenControlled, isOpen, openedInputWidth, closedInputWidth]);
659
- const handleOutsideClick = useClickOutside(onOutsideClick);
660
- return /*#__PURE__*/React__default.createElement("div", {
661
- className: classnames('advancedSearch', {
662
- 'advancedSearch-left': position === advancedSearchConfig.positions.left
663
- }),
664
- ref: handleOutsideClick
665
- }, /*#__PURE__*/React__default.createElement("div", {
666
- className: classnames('advancedSearch__wrapper', {
667
- 'advancedSearch__wrapper-left': position === advancedSearchConfig.positions.left
668
- }),
669
- style: inputAndPopoverWidthVariable,
670
- ref: parentRef
671
- }, /*#__PURE__*/React__default.createElement(PopoverV2, {
672
- position: "bottom",
673
- screenType: "desktop",
674
- isOpen: isOpenControlled ? isOpen : popoverOpen,
675
- scrollbarNeeded: false,
676
- extendTargetWidth: false,
677
- className: "advancedSearch__popover",
678
- onClickOutside: closePopoverHandler,
679
- containerParent: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current,
680
- Content: /*#__PURE__*/React__default.createElement(Content, {
681
- data: data,
682
- noDataText: noDataText,
683
- totalCount: totalCount,
684
- showMoreText: showMoreText,
685
- totalCountMax: totalCountMax,
686
- initialData: initialDataState,
687
- totalCountText: totalCountText,
688
- onShowMoreClick: onShowMoreClick,
689
- isSearchLoading: isSearchLoading,
690
- primaryFilterData: primaryFilterData,
691
- hasActiveShowMore: hasActiveShowMore,
692
- secondaryFilterData: secondaryFilterData,
693
- initialDataDescription: initialDataDescription
694
- })
695
- }, /*#__PURE__*/React__default.createElement(ExtendedInput, _extends({
696
- canClear: true,
697
- clickableIcon: true,
698
- ref: searchRef,
699
- value: searchValue,
700
- description: false,
701
- icon: "bc-icon-search",
702
- flexibility: "content-size",
703
- onChange: _ref2 => {
704
- let {
705
- target
706
- } = _ref2;
707
- return setSearchValue(target.value);
708
- },
709
- onClick: openPopoverHandler,
710
- onFocus: openPopoverHandler,
711
- placeholder: "Advanced Search",
712
- className: "advancedSearch__extendedInput"
713
- }, extendedInputConfigs)))), /*#__PURE__*/React__default.createElement("div", {
714
- "data-comment": "for-popover-accessibility-to-close",
715
- tabIndex: "0",
716
- style: {
717
- height: 0,
718
- width: 0,
719
- opacity: 0
720
- },
721
- onFocus: closePopoverHandler
722
- }));
723
- }
724
- AdvancedSearch.propTypes = {
725
- /**
726
- * Position of the AdvancedSearch component.
727
- * If set to 'right', it will stretch from right to left, and if set to 'left', it will stretch from left to right.
728
- * By default, the component stretches from right to left.
729
- */
730
- position: PropTypes.oneOf(Object.values(advancedSearchConfig.positions)),
731
- /**
732
- * Width of closed AdvancedSearch input.
733
- * if you set number it will be px, or you can set string for Example 20vw
734
- */
735
- closedInputWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
736
- /**
737
- * Width of opened AdvancedSearch input.
738
- * It can be only with a number and it will be converted to vw(viewport's width), which is equal to viewport %
739
- */
740
- openedInputWidth: PropTypes.number,
741
- /**
742
- * See ExtendedInput components docs
743
- */
744
- extendedInputConfigs: PropTypes.shape({
745
- ...ExtendedInput.propTypes
746
- }),
747
- /**
748
- * data structure for primary filter
749
- */
750
- primaryFilterData: PropTypes.shape({
751
- sectionNameText: PropTypes.string,
752
- onChange: PropTypes.func,
753
- hasActiveShowMore: PropTypes.bool,
754
- showMoreText: PropTypes.string,
755
- showMoreIsLoading: PropTypes.bool,
756
- onShowMoreClick: PropTypes.func,
757
- isLoading: PropTypes.bool,
758
- data: PropTypes.arrayOf(PropTypes.shape({
759
- name: PropTypes.string,
760
- value: PropTypes.string,
761
- checked: PropTypes.bool,
762
- icon: PropTypes.string,
763
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
764
- }))
765
- }),
766
- /**
767
- * data structure for secondary filter
768
- */
769
- secondaryFilterData: PropTypes.shape({
770
- sectionNameText: PropTypes.string,
771
- onChange: PropTypes.func,
772
- hasActiveShowMore: PropTypes.bool,
773
- showMoreText: PropTypes.string,
774
- showMoreIsLoading: PropTypes.bool,
775
- onShowMoreClick: PropTypes.func,
776
- isLoading: PropTypes.bool,
777
- data: PropTypes.arrayOf(PropTypes.shape({
778
- name: PropTypes.string,
779
- value: PropTypes.string,
780
- checked: PropTypes.bool,
781
- icon: PropTypes.string,
782
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
783
- }))
784
- }),
785
- /**
786
- * Fires event when a user clicks outside from the component.
787
- */
788
- onSearch: PropTypes.func,
789
- /**
790
- * Fires event when user clicks on outside of component.
791
- */
792
- onOutsideClick: PropTypes.func,
793
- /**
794
- * If search field is empty, initialDataDescription is describing witch data is showing by default for example (Recently modified data).
795
- */
796
- initialDataDescription: PropTypes.string,
797
- /**
798
- * If search field is empty, will show initialData for example (Recently modified data).
799
- */
800
- initialData: PropTypes.arrayOf(PropTypes.shape({
801
- icon: PropTypes.string,
802
- id: PropTypes.string,
803
- title: PropTypes.string,
804
- type: PropTypes.string,
805
- name: PropTypes.string,
806
- date: PropTypes.shape({
807
- labelText: PropTypes.string,
808
- date: PropTypes.oneOfType([PropTypes.instanceOf(dayjs), PropTypes.instanceOf(Date), PropTypes.string, PropTypes.number])
809
- }),
810
- actions: PropTypes.arrayOf(PropTypes.shape({
811
- name: PropTypes.string,
812
- icon: PropTypes.string.isRequired,
813
- onClick: PropTypes.func,
814
- description: PropTypes.string
815
- }))
816
- })),
817
- /**
818
- * if hasActive hasActiveShowMore is true you will see show more link under search result
819
- */
820
- hasActiveShowMore: PropTypes.bool,
821
- /**
822
- * text for link under search result
823
- */
824
- showMoreText: PropTypes.string,
825
- /**
826
- * To control showMore loading state
827
- */
828
- showMoreIsLoading: PropTypes.bool,
829
- /**
830
- * Fires an event when clicked on link under search result
831
- */
832
- onShowMoreClick: PropTypes.func,
833
- /**
834
- * search loading state
835
- */
836
- isSearchLoading: PropTypes.bool,
837
- /**
838
- * total count of data to show in badge
839
- */
840
- totalCount: PropTypes.number,
841
- /**
842
- * total max count of data to show totalCountMax+ in badge
843
- */
844
- totalCountMax: PropTypes.number,
845
- /**
846
- * label text for badge component
847
- */
848
- totalCountText: PropTypes.string,
849
- /**
850
- * data structure
851
- * */
852
- data: PropTypes.arrayOf(PropTypes.shape({
853
- icon: PropTypes.string,
854
- id: PropTypes.string,
855
- title: PropTypes.string,
856
- type: PropTypes.string,
857
- name: PropTypes.string,
858
- date: PropTypes.shape({
859
- labelText: PropTypes.string,
860
- date: PropTypes.oneOfType([PropTypes.instanceOf(dayjs), PropTypes.instanceOf(Date), PropTypes.string, PropTypes.number])
861
- }),
862
- actions: PropTypes.arrayOf(PropTypes.shape({
863
- name: PropTypes.string,
864
- icon: PropTypes.string.isRequired,
865
- onClick: PropTypes.func,
866
- description: PropTypes.string
867
- }))
868
- })),
869
- /**
870
- * text for no data to display
871
- */
872
- noDataText: PropTypes.string,
873
- /**
874
- * A boolean prop to control the popover's open and close state.
875
- */
876
- isOpen: PropTypes.bool
877
- };
878
- AdvancedSearch.defaultProps = {
879
- onSearch: noop,
880
- openedInputWidth: 65,
881
- onShowMoreClick: noop,
882
- onOutsideClick: noop,
883
- closedInputWidth: '200px',
884
- hasActiveShowMore: false,
885
- showMoreIsLoading: false,
886
- showMoreText: 'Show more',
887
- noDataText: 'No Data to Display',
888
- position: advancedSearchConfig.positions.right,
889
- initialDataDescription: 'initial data description'
890
- };
891
-
892
- export { AdvancedSearch as default };