@fixefy/fixefy-ui-components 0.3.108 → 0.3.110

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 (123) hide show
  1. package/dist/FxAsyncDropdown/FxAsyncDropdown.js +3 -3
  2. package/dist/FxDatesProgress/styles/progress.styles.js +1 -1
  3. package/dist/FxUserImage/FxUserImage.js +2 -2
  4. package/dist/fixefy-ui-components/src/FxActionsTray/FxActionsTray.js +111 -0
  5. package/dist/fixefy-ui-components/src/FxActionsTray/index.js +11 -0
  6. package/dist/fixefy-ui-components/src/FxActionsTray/styles/actionsTray.style.js +114 -0
  7. package/dist/fixefy-ui-components/src/FxAggregationsBar/FxAggregations.js +41 -0
  8. package/dist/fixefy-ui-components/src/FxAggregationsBar/helpers/structureReader.js +80 -0
  9. package/dist/fixefy-ui-components/src/FxAggregationsBar/index.js +22 -0
  10. package/dist/fixefy-ui-components/src/FxAggregationsBar/operations/query.js +73 -0
  11. package/dist/fixefy-ui-components/src/FxAsyncDropdown/FxAsyncDropdown.js +500 -0
  12. package/dist/fixefy-ui-components/src/FxAsyncDropdown/components/CheckboxIcon.js +44 -0
  13. package/dist/fixefy-ui-components/src/FxAsyncDropdown/components/ChipOption.js +35 -0
  14. package/dist/fixefy-ui-components/src/FxAsyncDropdown/components/ChosenIcon.js +45 -0
  15. package/dist/fixefy-ui-components/src/FxAsyncDropdown/components/DeleteButton.js +37 -0
  16. package/dist/fixefy-ui-components/src/FxAsyncDropdown/components/LogoOption.js +101 -0
  17. package/dist/fixefy-ui-components/src/FxAsyncDropdown/components/TextOption.js +74 -0
  18. package/dist/fixefy-ui-components/src/FxAsyncDropdown/components/index.js +36 -0
  19. package/dist/fixefy-ui-components/src/FxAsyncDropdown/helpers/helpers.js +233 -0
  20. package/dist/fixefy-ui-components/src/FxAsyncDropdown/index.js +11 -0
  21. package/dist/fixefy-ui-components/src/FxAsyncDropdown/styles/dropdown.styles.js +211 -0
  22. package/dist/fixefy-ui-components/src/FxAsyncDropdown/types.js +4 -0
  23. package/dist/fixefy-ui-components/src/FxAvatar/FxAvatar.js +145 -0
  24. package/dist/fixefy-ui-components/src/FxAvatar/helpers/stringToColor.js +23 -0
  25. package/dist/fixefy-ui-components/src/FxAvatar/index.js +22 -0
  26. package/dist/fixefy-ui-components/src/FxAvatar/styles/avatar.styles.js +233 -0
  27. package/dist/fixefy-ui-components/src/FxButton/FxButton.js +106 -0
  28. package/dist/fixefy-ui-components/src/FxButton/index.js +19 -0
  29. package/dist/fixefy-ui-components/src/FxButton/styles/button.styles.js +28 -0
  30. package/dist/fixefy-ui-components/src/FxButtonModalWithComponent/FxButtonModalWithComponent.js +118 -0
  31. package/dist/fixefy-ui-components/src/FxButtonModalWithComponent/index.js +11 -0
  32. package/dist/fixefy-ui-components/src/FxButtonModalWithMenu/FxButtonModalWithMenu.js +126 -0
  33. package/dist/fixefy-ui-components/src/FxButtonModalWithMenu/index.js +11 -0
  34. package/dist/fixefy-ui-components/src/FxChip/FxChip.js +75 -0
  35. package/dist/fixefy-ui-components/src/FxChip/index.js +19 -0
  36. package/dist/fixefy-ui-components/src/FxChip/styles/chip.styles.js +147 -0
  37. package/dist/fixefy-ui-components/src/FxDatesProgress/FxDatesProgress.js +126 -0
  38. package/dist/fixefy-ui-components/src/FxDatesProgress/index.js +11 -0
  39. package/dist/fixefy-ui-components/src/FxDatesProgress/styles/progress.styles.js +24 -0
  40. package/dist/fixefy-ui-components/src/FxGeneralModal/FxGeneralModal.js +107 -0
  41. package/dist/fixefy-ui-components/src/FxGeneralModal/index.js +11 -0
  42. package/dist/fixefy-ui-components/src/FxGridEmptyState/FxGridEmptyState.js +86 -0
  43. package/dist/fixefy-ui-components/src/FxGridEmptyState/index.js +11 -0
  44. package/dist/fixefy-ui-components/src/FxGridError/FxGridError.js +91 -0
  45. package/dist/fixefy-ui-components/src/FxGridError/index.js +11 -0
  46. package/dist/fixefy-ui-components/src/FxIcon/FxIcon.js +118 -0
  47. package/dist/fixefy-ui-components/src/FxIcon/content/dynamic_icon.js +20 -0
  48. package/dist/fixefy-ui-components/src/FxIcon/content/index.js +20 -0
  49. package/dist/fixefy-ui-components/src/FxIcon/content/lazy_icon.js +87 -0
  50. package/dist/fixefy-ui-components/src/FxIcon/index.js +11 -0
  51. package/dist/fixefy-ui-components/src/FxMenuItemWithIcon/FxMenuItemWithIcon.js +84 -0
  52. package/dist/fixefy-ui-components/src/FxMenuItemWithIcon/index.js +11 -0
  53. package/dist/fixefy-ui-components/src/FxModal/FxModal.js +171 -0
  54. package/dist/fixefy-ui-components/src/FxModal/index.js +19 -0
  55. package/dist/fixefy-ui-components/src/FxModal/styles/modal.style.js +66 -0
  56. package/dist/fixefy-ui-components/src/FxNotes/FxNotes.js +216 -0
  57. package/dist/fixefy-ui-components/src/FxNotes/helpers/stringToColor.js +26 -0
  58. package/dist/fixefy-ui-components/src/FxNotes/index.js +22 -0
  59. package/dist/fixefy-ui-components/src/FxNotes/operations/queries.js +35 -0
  60. package/dist/fixefy-ui-components/src/FxNotes/styles/notes.styles.js +168 -0
  61. package/dist/fixefy-ui-components/src/FxNumberField/FxNumberField.js +108 -0
  62. package/dist/fixefy-ui-components/src/FxNumberField/index.js +19 -0
  63. package/dist/fixefy-ui-components/src/FxNumberField/styles/number_field.styles.js +99 -0
  64. package/dist/fixefy-ui-components/src/FxObjStaticDropdown/FxObjStaticDropdown.js +548 -0
  65. package/dist/fixefy-ui-components/src/FxObjStaticDropdown/index.js +25 -0
  66. package/dist/fixefy-ui-components/src/FxObjStaticDropdown/styles/dropdown.styles.js +211 -0
  67. package/dist/fixefy-ui-components/src/FxPopper/Popper.js +139 -0
  68. package/dist/fixefy-ui-components/src/FxPopper/PopperWithOutside.js +116 -0
  69. package/dist/fixefy-ui-components/src/FxPopper/content/PopperHeader.js +36 -0
  70. package/dist/fixefy-ui-components/src/FxPopper/content/index.js +11 -0
  71. package/dist/fixefy-ui-components/src/FxPopper/index.js +24 -0
  72. package/dist/fixefy-ui-components/src/FxPopper/styles/popper.styles.js +138 -0
  73. package/dist/fixefy-ui-components/src/FxProgressCircle/FxProgressCircle.js +65 -0
  74. package/dist/fixefy-ui-components/src/FxProgressCircle/index.js +19 -0
  75. package/dist/fixefy-ui-components/src/FxProgressCircle/styles/progress_circle.styles.js +106 -0
  76. package/dist/fixefy-ui-components/src/FxProgressCounter/ProgressCounter.js +168 -0
  77. package/dist/fixefy-ui-components/src/FxProgressCounter/index.js +19 -0
  78. package/dist/fixefy-ui-components/src/FxProgressCounter/styles/progress_counter.styles.js +66 -0
  79. package/dist/fixefy-ui-components/src/FxScore/FxScore.js +215 -0
  80. package/dist/fixefy-ui-components/src/FxScore/index.js +19 -0
  81. package/dist/fixefy-ui-components/src/FxScore/styles/score.styles.js +102 -0
  82. package/dist/fixefy-ui-components/src/FxShowMore/FxShowMore.js +80 -0
  83. package/dist/fixefy-ui-components/src/FxShowMore/index.js +19 -0
  84. package/dist/fixefy-ui-components/src/FxShowMore/styles/show_more.styles.js +143 -0
  85. package/dist/fixefy-ui-components/src/FxSlider/FxSlider.js +49 -0
  86. package/dist/fixefy-ui-components/src/FxSlider/index.js +19 -0
  87. package/dist/fixefy-ui-components/src/FxStatisticsBar/FxStatisticsBar.js +198 -0
  88. package/dist/fixefy-ui-components/src/FxStatisticsBar/index.js +19 -0
  89. package/dist/fixefy-ui-components/src/FxStatisticsBar/styles/statistics.styles.js +103 -0
  90. package/dist/fixefy-ui-components/src/FxStatusBar/FxStatusBar.js +149 -0
  91. package/dist/fixefy-ui-components/src/FxStatusBar/helpers/constants.js +22 -0
  92. package/dist/fixefy-ui-components/src/FxStatusBar/index.js +22 -0
  93. package/dist/fixefy-ui-components/src/FxStatusBar/styles/statusBar.styles.js +138 -0
  94. package/dist/fixefy-ui-components/src/FxStrStaticDropdown/FxStrStaticDropdown.js +382 -0
  95. package/dist/fixefy-ui-components/src/FxStrStaticDropdown/helpers/helpers.js +22 -0
  96. package/dist/fixefy-ui-components/src/FxStrStaticDropdown/index.js +11 -0
  97. package/dist/fixefy-ui-components/src/FxStrStaticDropdown/styles/dropdown.styles.js +190 -0
  98. package/dist/fixefy-ui-components/src/FxStyledButton/FxStyledButton.js +57 -0
  99. package/dist/fixefy-ui-components/src/FxStyledButton/index.js +11 -0
  100. package/dist/fixefy-ui-components/src/FxStyledComponents/index.js +319 -0
  101. package/dist/fixefy-ui-components/src/FxSwitch/FxSwitch.js +106 -0
  102. package/dist/fixefy-ui-components/src/FxSwitch/index.js +19 -0
  103. package/dist/fixefy-ui-components/src/FxSwitch/styles/switch.styles.js +42 -0
  104. package/dist/fixefy-ui-components/src/FxTabs/FxTabs.js +79 -0
  105. package/dist/fixefy-ui-components/src/FxTabs/index.js +11 -0
  106. package/dist/fixefy-ui-components/src/FxTag/FxTag.js +50 -0
  107. package/dist/fixefy-ui-components/src/FxTag/index.js +19 -0
  108. package/dist/fixefy-ui-components/src/FxTag/styles/tag.styles.js +106 -0
  109. package/dist/fixefy-ui-components/src/FxTextField/FxTextField.js +211 -0
  110. package/dist/fixefy-ui-components/src/FxTextField/index.js +19 -0
  111. package/dist/fixefy-ui-components/src/FxTodo/FxTodo.js +95 -0
  112. package/dist/fixefy-ui-components/src/FxTodo/index.js +22 -0
  113. package/dist/fixefy-ui-components/src/FxTodo/styles/todo.styles.js +183 -0
  114. package/dist/fixefy-ui-components/src/FxToggleButtons/FxToggleButtons.js +69 -0
  115. package/dist/fixefy-ui-components/src/FxToggleButtons/index.js +11 -0
  116. package/dist/fixefy-ui-components/src/FxUserImage/FxUserImage.js +236 -0
  117. package/dist/fixefy-ui-components/src/FxUserImage/index.js +11 -0
  118. package/dist/fixefy-ui-components/src/FxWizard/FxWizard.js +50 -0
  119. package/dist/fixefy-ui-components/src/FxWizard/index.js +19 -0
  120. package/dist/fixefy-ui-components/src/FxWizard/steps launcher/StepsLauncher.js +52 -0
  121. package/dist/fixefy-ui-components/src/FxWizard/steps launcher/index.js +18 -0
  122. package/dist/fixefy-ui-components/src/index.js +277 -0
  123. package/package.json +4 -5
@@ -0,0 +1,548 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FxObjStaticDropdown", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FxObjStaticDropdown;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
13
+ const _CheckBoxOutlineBlank = /*#__PURE__*/ _interop_require_default(require("@mui/icons-material/CheckBoxOutlineBlank"));
14
+ const _CheckBox = /*#__PURE__*/ _interop_require_default(require("@mui/icons-material/CheckBox"));
15
+ const _Button = /*#__PURE__*/ _interop_require_default(require("@mui/material/Button"));
16
+ const _Checkbox = /*#__PURE__*/ _interop_require_default(require("@mui/material/Checkbox"));
17
+ const _styles = require("@mui/material/styles");
18
+ const _Typography = /*#__PURE__*/ _interop_require_default(require("@mui/material/Typography"));
19
+ const _Box = /*#__PURE__*/ _interop_require_default(require("@mui/material/Box"));
20
+ const _Stack = /*#__PURE__*/ _interop_require_default(require("@mui/material/Stack"));
21
+ const _FxChip = require("../FxChip");
22
+ const _FxIcon = require("../FxIcon");
23
+ const _dropdownstyles = require("./styles/dropdown.styles");
24
+ const _fixefyuiutils = require("@fixefy/fixefy-ui-utils");
25
+ const _fixefyhooks = require("@fixefy/fixefy-hooks");
26
+ function _interop_require_default(obj) {
27
+ return obj && obj.__esModule ? obj : {
28
+ default: obj
29
+ };
30
+ }
31
+ function _getRequireWildcardCache(nodeInterop) {
32
+ if (typeof WeakMap !== "function") return null;
33
+ var cacheBabelInterop = new WeakMap();
34
+ var cacheNodeInterop = new WeakMap();
35
+ return (_getRequireWildcardCache = function(nodeInterop) {
36
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
37
+ })(nodeInterop);
38
+ }
39
+ function _interop_require_wildcard(obj, nodeInterop) {
40
+ if (!nodeInterop && obj && obj.__esModule) {
41
+ return obj;
42
+ }
43
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
44
+ return {
45
+ default: obj
46
+ };
47
+ }
48
+ var cache = _getRequireWildcardCache(nodeInterop);
49
+ if (cache && cache.has(obj)) {
50
+ return cache.get(obj);
51
+ }
52
+ var newObj = {
53
+ __proto__: null
54
+ };
55
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
56
+ for(var key in obj){
57
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
58
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
59
+ if (desc && (desc.get || desc.set)) {
60
+ Object.defineProperty(newObj, key, desc);
61
+ } else {
62
+ newObj[key] = obj[key];
63
+ }
64
+ }
65
+ }
66
+ newObj.default = obj;
67
+ if (cache) {
68
+ cache.set(obj, newObj);
69
+ }
70
+ return newObj;
71
+ }
72
+ const uncheckedIcon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_CheckBoxOutlineBlank.default, {
73
+ fontSize: "small"
74
+ });
75
+ const checkedIcon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_CheckBox.default, {
76
+ fontSize: "small"
77
+ });
78
+ const FxObjStaticDropdown = (props)=>{
79
+ const { assetUrl, onAdd, onRemoveOne, onRemoveAll, onUnselectAll, disabled, type = 'text', search_path, modal_type, multiple, name, query, isInitialOpen, placeholder, title_path, rootStylesOverride, logo_placeholder, logo_folder_name, _id, data, defaultValue } = props;
80
+ const ref = (0, _react.useRef)(null);
81
+ const theme = (0, _styles.useTheme)();
82
+ const [displayed, setDisplayed] = (0, _react.useState)(multiple ? [] : '');
83
+ const [options, setOptions] = (0, _react.useState)([]);
84
+ const [reason, setReason] = (0, _react.useState)('init');
85
+ const [isLastPage, setIsLastPage] = (0, _react.useState)(false);
86
+ const [isOpen, setIsOpen] = (0, _react.useState)(isInitialOpen);
87
+ const [searchValue, setSearchValue] = (0, _react.useState)(null);
88
+ const [page, setPage] = (0, _react.useState)(1);
89
+ const [prevPage, setPrevPage] = (0, _react.useState)(0);
90
+ const pageSize = 20;
91
+ (0, _react.useEffect)(()=>{
92
+ const storedData = sessionStorage.getItem(`dropdown-${query}-${name}-${_id}`);
93
+ if (storedData) {
94
+ const parsedData = JSON.parse(storedData);
95
+ const items = parsedData[name];
96
+ if (items) {
97
+ switch(multiple){
98
+ case true:
99
+ setDisplayed([
100
+ ...items
101
+ ]);
102
+ break;
103
+ default:
104
+ setDisplayed(items[0]);
105
+ }
106
+ }
107
+ }
108
+ }, [
109
+ query,
110
+ name
111
+ ]);
112
+ (0, _react.useEffect)(()=>{
113
+ if (data && !isLastPage && prevPage < page) {
114
+ if (data == null || data.length < pageSize) {
115
+ setIsLastPage(true);
116
+ }
117
+ if (reason !== 'loaded more') {
118
+ setOptions(data);
119
+ } else {
120
+ setOptions((prevOptions)=>[
121
+ ...prevOptions,
122
+ ...data
123
+ ]);
124
+ }
125
+ }
126
+ }, [
127
+ data,
128
+ reason
129
+ ]);
130
+ (0, _react.useEffect)(()=>{
131
+ if (searchValue) {
132
+ setOptions(data.filter((option)=>option[title_path].toLowerCase().includes(searchValue.toLowerCase())));
133
+ } else {
134
+ setOptions(data);
135
+ }
136
+ }, [
137
+ searchValue
138
+ ]);
139
+ const handleSearch = (e)=>{
140
+ setSearchValue(e.target.value);
141
+ setReason('searched');
142
+ setPage(1);
143
+ setPrevPage(0);
144
+ setIsLastPage(false);
145
+ };
146
+ const addToStoredDisplayed = (option)=>{
147
+ const prevStored = sessionStorage.getItem(`dropdown-${query}-${name}-${_id}`);
148
+ const data = prevStored ? JSON.parse(prevStored) : {};
149
+ if (data[name]) {
150
+ if (multiple) {
151
+ data[name] = [
152
+ ...data[name],
153
+ option
154
+ ];
155
+ } else {
156
+ data[name] = [
157
+ option
158
+ ];
159
+ }
160
+ } else {
161
+ data[name] = [
162
+ option
163
+ ];
164
+ }
165
+ sessionStorage.setItem(`dropdown-${query}-${name}-${_id}`, JSON.stringify(data));
166
+ };
167
+ const removeOneFromStoredDisplayed = (option)=>{
168
+ let storedDisplayed = sessionStorage.getItem(`dropdown-${query}-${name}-${_id}`);
169
+ if (storedDisplayed) {
170
+ storedDisplayed = JSON.parse(storedDisplayed);
171
+ if (multiple) {
172
+ const newDisplayed = storedDisplayed[name].filter((opt)=>opt[title_path] !== option[title_path]);
173
+ storedDisplayed[name] = newDisplayed;
174
+ } else {
175
+ delete storedDisplayed[name];
176
+ }
177
+ sessionStorage.setItem(`dropdown-${query}-${name}-${_id}`, JSON.stringify(storedDisplayed));
178
+ }
179
+ };
180
+ const handleOptionClick = (option)=>{
181
+ switch(multiple){
182
+ case true:
183
+ if (displayed.map((item)=>{
184
+ return item[title_path];
185
+ }).includes(option)) {
186
+ deleteOneItem(option);
187
+ } else {
188
+ onAdd(option);
189
+ setDisplayed((prev)=>[
190
+ ...prev,
191
+ option
192
+ ]);
193
+ addToStoredDisplayed(option);
194
+ if (!multiple) {
195
+ setIsOpen(false);
196
+ }
197
+ }
198
+ break;
199
+ default:
200
+ setDisplayed(option);
201
+ onAdd(option);
202
+ addToStoredDisplayed(option);
203
+ if (!multiple && !defaultValue) {
204
+ setIsOpen(false);
205
+ }
206
+ }
207
+ };
208
+ const deleteOneItem = (item)=>{
209
+ if (multiple) {
210
+ setDisplayed((prev)=>prev.filter((val)=>val[title_path] !== item[title_path]));
211
+ } else {
212
+ setDisplayed('');
213
+ }
214
+ onRemoveOne(item);
215
+ removeOneFromStoredDisplayed(item);
216
+ };
217
+ const isChecked = (option)=>{
218
+ if (typeof displayed === 'string') {
219
+ return false;
220
+ } else {
221
+ if (multiple) {
222
+ return displayed.map((item)=>{
223
+ return item[title_path];
224
+ }).includes(option);
225
+ } else {
226
+ return displayed[search_path] === option[title_path];
227
+ }
228
+ }
229
+ };
230
+ const selectAll = ()=>{
231
+ setDisplayed((prev)=>{
232
+ const unselectedOptions = options.filter((option)=>{
233
+ return !prev.map((item)=>item[title_path]).includes(option);
234
+ });
235
+ const opts = [
236
+ ...prev,
237
+ ...unselectedOptions
238
+ ];
239
+ onAdd(opts);
240
+ sessionStorage.setItem(`dropdown-${query}-${name}-${_id}`, JSON.stringify({
241
+ [name]: opts
242
+ }));
243
+ return opts;
244
+ });
245
+ };
246
+ const unSelectAll = ()=>{
247
+ if (onUnselectAll) {
248
+ onUnselectAll();
249
+ setDisplayed([]);
250
+ sessionStorage.removeItem(`dropdown-${query}-${name}-${_id}`);
251
+ }
252
+ };
253
+ const displayListOptions = ()=>{
254
+ switch(type){
255
+ case 'checkbox':
256
+ {
257
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
258
+ children: [
259
+ multiple && onUnselectAll && /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
260
+ onClick: ()=>{
261
+ if (displayed.length === options.length) {
262
+ unSelectAll();
263
+ } else {
264
+ selectAll();
265
+ }
266
+ },
267
+ children: [
268
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Checkbox.default, {
269
+ icon: uncheckedIcon,
270
+ checked: displayed.length === options.length,
271
+ checkedIcon: checkedIcon,
272
+ sx: {
273
+ mr: 1,
274
+ minWidth: 24,
275
+ minHeight: 24,
276
+ p: 0,
277
+ ['& svg']: {
278
+ fill: theme.palette.primary.light
279
+ }
280
+ }
281
+ }),
282
+ (0, _fixefyuiutils.titleCase)('select all')
283
+ ]
284
+ }),
285
+ options.map((option, i)=>{
286
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
287
+ onClick: ()=>{
288
+ handleOptionClick(option);
289
+ },
290
+ children: [
291
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Checkbox.default, {
292
+ icon: uncheckedIcon,
293
+ checked: isChecked(option),
294
+ checkedIcon: checkedIcon,
295
+ sx: {
296
+ mr: 1,
297
+ minWidth: 24,
298
+ minHeight: 24,
299
+ p: 0,
300
+ ['& svg']: {
301
+ fill: theme.palette.primary.light
302
+ }
303
+ }
304
+ }),
305
+ getSingleOptionFromListOrDisplayed(option, 'list')
306
+ ]
307
+ }, i);
308
+ }),
309
+ ' '
310
+ ]
311
+ });
312
+ }
313
+ case 'text':
314
+ default:
315
+ {
316
+ return options.map((option, i)=>{
317
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
318
+ onClick: ()=>{
319
+ handleOptionClick(option);
320
+ },
321
+ children: getSingleOptionFromListOrDisplayed(option, 'list')
322
+ }, i);
323
+ });
324
+ }
325
+ }
326
+ };
327
+ const loadMore = ()=>{
328
+ setPage((prevPage)=>prevPage + 1);
329
+ setPrevPage((prevPage)=>prevPage + 1);
330
+ };
331
+ const getCurrentValues = ()=>{
332
+ if (multiple) {
333
+ return getDisplayedValuesMultiple();
334
+ } else {
335
+ return getSingleOptionFromListOrDisplayed(displayed, 'displayed');
336
+ }
337
+ };
338
+ const OneOption = ({ option, curValue, modal, modal_type })=>{
339
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_Box.default, {
340
+ sx: {
341
+ display: 'flex',
342
+ justifyContent: 'space-between',
343
+ width: '100%',
344
+ gap: 1,
345
+ color: 'grey',
346
+ cursor: 'pointer'
347
+ },
348
+ children: [
349
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_Box.default, {
350
+ sx: {
351
+ width: '100%',
352
+ display: 'flex',
353
+ justifyContent: 'flex-start',
354
+ gap: 1
355
+ },
356
+ children: [
357
+ modal_type == 'logo' && /*#__PURE__*/ (0, _jsxruntime.jsx)(Logo, {
358
+ option: option
359
+ }),
360
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Typography.default, {
361
+ variant: "subtitle2",
362
+ color: theme.palette.typography.title,
363
+ children: (0, _fixefyuiutils.titleCase)(curValue)
364
+ }),
365
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(DeleteButton, {
366
+ option: option,
367
+ isDisplay: modal == 'displayed'
368
+ })
369
+ ]
370
+ }),
371
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(ChosenIcon, {
372
+ option: option,
373
+ isDisplay: modal == 'list'
374
+ })
375
+ ]
376
+ }, option === null || option === void 0 ? void 0 : option._id);
377
+ };
378
+ const DeleteButton = ({ option, isDisplay })=>{
379
+ const isDisplayButton = isDisplay && (multiple && (displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0 || !multiple && displayed[search_path] === option[title_path]);
380
+ switch(isDisplayButton){
381
+ case true:
382
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_Box.default, {
383
+ onClick: ()=>{
384
+ deleteOneItem(option);
385
+ },
386
+ children: "x"
387
+ });
388
+ default:
389
+ return null;
390
+ }
391
+ };
392
+ const ChosenIcon = ({ option, isDisplay })=>{
393
+ if (isDisplay && isChecked(option)) {
394
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
395
+ width: 16,
396
+ height: 16,
397
+ icon: 'filters/chosen_icon.svg',
398
+ assetUrl: assetUrl
399
+ });
400
+ }
401
+ return null;
402
+ };
403
+ const Logo = ({ option })=>{
404
+ var _option_name;
405
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
406
+ style: {
407
+ width: '70px'
408
+ },
409
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
410
+ assetUrl: assetUrl,
411
+ icon: `${option.logo ? `${logo_folder_name}/${option.logo}` : logo_placeholder ? logo_placeholder : (_option_name = option === null || option === void 0 ? void 0 : option[name]) !== null && _option_name !== void 0 ? _option_name : 'x'}`,
412
+ width: 70,
413
+ height: 16,
414
+ variant: "rounded",
415
+ fontSize: 17,
416
+ background: (0, _fixefyhooks.useRandomColor)()
417
+ })
418
+ });
419
+ };
420
+ const Chip = ({ option, curValue, modal })=>{
421
+ return modal == 'displayed' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
422
+ assetUrl: assetUrl,
423
+ status: curValue,
424
+ label: (0, _fixefyuiutils.titleCase)(curValue),
425
+ variant: "outlined",
426
+ onDelete: ()=>{
427
+ deleteOneItem(option);
428
+ }
429
+ }, option === null || option === void 0 ? void 0 : option._id) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
430
+ assetUrl: assetUrl,
431
+ status: curValue,
432
+ label: (0, _fixefyuiutils.titleCase)(curValue),
433
+ variant: "outlined"
434
+ }, option === null || option === void 0 ? void 0 : option._id);
435
+ };
436
+ const getSingleOptionFromListOrDisplayed = (option, modal)=>{
437
+ if (option) {
438
+ let rv = null;
439
+ switch(modal_type){
440
+ case 'chip':
441
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(Chip, {
442
+ option: option,
443
+ curValue: option[title_path],
444
+ modal: modal
445
+ });
446
+ break;
447
+ case 'logo':
448
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(OneOption, {
449
+ option: option,
450
+ curValue: option[title_path],
451
+ modal: modal,
452
+ modal_type: modal_type
453
+ });
454
+ break;
455
+ case 'text':
456
+ default:
457
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(OneOption, {
458
+ option: option,
459
+ curValue: option[title_path],
460
+ modal: modal
461
+ });
462
+ break;
463
+ }
464
+ return rv;
465
+ }
466
+ };
467
+ const getDisplayedValuesMultiple = ()=>{
468
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_Stack.default, {
469
+ direction: 'row',
470
+ sx: {
471
+ display: 'flex',
472
+ justifyContent: 'space-between'
473
+ },
474
+ children: [
475
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Stack.default, {
476
+ direction: 'row',
477
+ sx: {
478
+ overflow: 'hidden',
479
+ flexWrap: 'wrap',
480
+ gap: 1
481
+ },
482
+ children: displayed.map((item)=>{
483
+ return getSingleOptionFromListOrDisplayed(item, 'displayed');
484
+ })
485
+ }),
486
+ (displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Box.default, {
487
+ sx: {
488
+ minWidth: '20px',
489
+ maxWidth: '20px',
490
+ cursor: 'pointer',
491
+ paddingLeft: '3px'
492
+ },
493
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
494
+ assetUrl: assetUrl,
495
+ onClick: ()=>{
496
+ setDisplayed([]);
497
+ onRemoveAll();
498
+ sessionStorage.removeItem(`dropdown-${query}-${name}-${_id}`);
499
+ },
500
+ icon: 'filters/remove_all_button.svg',
501
+ width: 16,
502
+ height: 16
503
+ })
504
+ })
505
+ ]
506
+ });
507
+ };
508
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.Root, {
509
+ style: rootStylesOverride,
510
+ children: [
511
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_Box.default, {
512
+ children: [
513
+ getCurrentValues(),
514
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.InputWrapper, {
515
+ disabled: disabled,
516
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
517
+ autoFocus: true,
518
+ placeholder: placeholder || 'Select an option...',
519
+ onChange: (e)=>{
520
+ handleSearch(e);
521
+ },
522
+ onFocus: ()=>{
523
+ if (!isInitialOpen) {
524
+ setIsOpen(true);
525
+ }
526
+ }
527
+ })
528
+ })
529
+ ]
530
+ }),
531
+ (isInitialOpen || isOpen) && options && (options === null || options === void 0 ? void 0 : options.length) > 0 && !disabled ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.StyledListBox, {
532
+ ref: ref,
533
+ children: [
534
+ displayListOptions(),
535
+ !isLastPage && /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
536
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
537
+ onClick: ()=>{
538
+ setReason('loaded more');
539
+ loadMore();
540
+ },
541
+ children: "load more"
542
+ })
543
+ })
544
+ ]
545
+ }) : null
546
+ ]
547
+ });
548
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ AsyncDropdownPropsType: function() {
13
+ return _FxObjStaticDropdown.AsyncDropdownPropsType;
14
+ },
15
+ FxObjStaticDropdown: function() {
16
+ return _FxObjStaticDropdown.FxObjStaticDropdown;
17
+ },
18
+ Option: function() {
19
+ return _FxObjStaticDropdown.Option;
20
+ },
21
+ StylesOptions: function() {
22
+ return _FxObjStaticDropdown.StylesOptions;
23
+ }
24
+ });
25
+ const _FxObjStaticDropdown = require("./FxObjStaticDropdown");