@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,500 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FxAsyncDropdown", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FxAsyncDropdown;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
13
+ const _Button = /*#__PURE__*/ _interop_require_default(require("@mui/material/Button"));
14
+ const _CircularProgress = /*#__PURE__*/ _interop_require_default(require("@mui/material/CircularProgress"));
15
+ const _Box = /*#__PURE__*/ _interop_require_default(require("@mui/material/Box"));
16
+ const _Stack = /*#__PURE__*/ _interop_require_default(require("@mui/material/Stack"));
17
+ const _FxIcon = require("../FxIcon");
18
+ const _graphqltag = require("graphql-tag");
19
+ const _dropdownstyles = require("./styles/dropdown.styles");
20
+ const _helpers = require("./helpers/helpers");
21
+ const _hooks = require("@apollo/client/react/hooks");
22
+ const _fixefycookies = require("@fixefy/fixefy-cookies");
23
+ const _components = require("./components");
24
+ function _define_property(obj, key, value) {
25
+ if (key in obj) {
26
+ Object.defineProperty(obj, key, {
27
+ value: value,
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true
31
+ });
32
+ } else {
33
+ obj[key] = value;
34
+ }
35
+ return obj;
36
+ }
37
+ function _interop_require_default(obj) {
38
+ return obj && obj.__esModule ? obj : {
39
+ default: obj
40
+ };
41
+ }
42
+ function _getRequireWildcardCache(nodeInterop) {
43
+ if (typeof WeakMap !== "function") return null;
44
+ var cacheBabelInterop = new WeakMap();
45
+ var cacheNodeInterop = new WeakMap();
46
+ return (_getRequireWildcardCache = function(nodeInterop) {
47
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
48
+ })(nodeInterop);
49
+ }
50
+ function _interop_require_wildcard(obj, nodeInterop) {
51
+ if (!nodeInterop && obj && obj.__esModule) {
52
+ return obj;
53
+ }
54
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
55
+ return {
56
+ default: obj
57
+ };
58
+ }
59
+ var cache = _getRequireWildcardCache(nodeInterop);
60
+ if (cache && cache.has(obj)) {
61
+ return cache.get(obj);
62
+ }
63
+ var newObj = {
64
+ __proto__: null
65
+ };
66
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
67
+ for(var key in obj){
68
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
69
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
70
+ if (desc && (desc.get || desc.set)) {
71
+ Object.defineProperty(newObj, key, desc);
72
+ } else {
73
+ newObj[key] = obj[key];
74
+ }
75
+ }
76
+ }
77
+ newObj.default = obj;
78
+ if (cache) {
79
+ cache.set(obj, newObj);
80
+ }
81
+ return newObj;
82
+ }
83
+ function _object_spread(target) {
84
+ for(var i = 1; i < arguments.length; i++){
85
+ var source = arguments[i] != null ? arguments[i] : {};
86
+ var ownKeys = Object.keys(source);
87
+ if (typeof Object.getOwnPropertySymbols === "function") {
88
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
89
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
90
+ }));
91
+ }
92
+ ownKeys.forEach(function(key) {
93
+ _define_property(target, key, source[key]);
94
+ });
95
+ }
96
+ return target;
97
+ }
98
+ function ownKeys(object, enumerableOnly) {
99
+ var keys = Object.keys(object);
100
+ if (Object.getOwnPropertySymbols) {
101
+ var symbols = Object.getOwnPropertySymbols(object);
102
+ if (enumerableOnly) {
103
+ symbols = symbols.filter(function(sym) {
104
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
105
+ });
106
+ }
107
+ keys.push.apply(keys, symbols);
108
+ }
109
+ return keys;
110
+ }
111
+ function _object_spread_props(target, source) {
112
+ source = source != null ? source : {};
113
+ if (Object.getOwnPropertyDescriptors) {
114
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
115
+ } else {
116
+ ownKeys(Object(source)).forEach(function(key) {
117
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
118
+ });
119
+ }
120
+ return target;
121
+ }
122
+ const FxAsyncDropdown = (props)=>{
123
+ var _fetcher_query;
124
+ const { assetUrl, onAdd, onRemoveAll, onUnselectAll, fetcher, disabled, defaultValue, type = 'text', variables, search_path, modal_type, multiple, name, query, isInitialOpen, placeholder, title_path, rootStylesOverride, options_path, _id } = props;
125
+ const ref = (0, _react.useRef)(null);
126
+ const { method_name } = variables !== null && variables !== void 0 ? variables : {};
127
+ var _fetcher_queryOptions_variables;
128
+ const { where, sort } = (_fetcher_queryOptions_variables = fetcher.queryOptions.variables) !== null && _fetcher_queryOptions_variables !== void 0 ? _fetcher_queryOptions_variables : {};
129
+ var _CookieHelper_getAll;
130
+ const { ws } = (_CookieHelper_getAll = _fixefycookies.CookieHelper.getAll(null)) !== null && _CookieHelper_getAll !== void 0 ? _CookieHelper_getAll : {};
131
+ const isLocal = fetcher === null || fetcher === void 0 ? void 0 : (_fetcher_query = fetcher.query) === null || _fetcher_query === void 0 ? void 0 : _fetcher_query.loc;
132
+ const gqlQuery = isLocal ? fetcher.query.loc.source.body : fetcher.query;
133
+ const [defaultValueWhere, setDefaultValueWhere] = (0, _react.useState)(where);
134
+ const [displayed, setDisplayed] = (0, _react.useState)(multiple ? [] : '');
135
+ const [options, setOptions] = (0, _react.useState)([]);
136
+ const [reason, setReason] = (0, _react.useState)('init');
137
+ const [isLastPage, setIsLastPage] = (0, _react.useState)(false);
138
+ const [isOpen, setIsOpen] = (0, _react.useState)(isInitialOpen);
139
+ const [searchValue, setSearchValue] = (0, _react.useState)(null);
140
+ const [page, setPage] = (0, _react.useState)(1);
141
+ const [prevPage, setPrevPage] = (0, _react.useState)(0);
142
+ const pageSize = 20;
143
+ const getWhere = ()=>{
144
+ if (method_name == 'workspace') {
145
+ return searchValue ? _object_spread_props(_object_spread({}, where), {
146
+ _id: ws,
147
+ [search_path]: {
148
+ $regex: searchValue,
149
+ $options: 'i'
150
+ }
151
+ }) : _object_spread_props(_object_spread({}, where), {
152
+ _id: ws
153
+ });
154
+ } else {
155
+ return searchValue ? _object_spread_props(_object_spread({}, where), {
156
+ [search_path]: {
157
+ $regex: searchValue,
158
+ $options: 'i'
159
+ }
160
+ }) : _object_spread({}, where);
161
+ }
162
+ };
163
+ const loadMore = ()=>{
164
+ setPage((prevPage)=>prevPage + 1);
165
+ setPrevPage((prevPage)=>prevPage + 1);
166
+ };
167
+ const [fetch, { data, loading }] = (0, _hooks.useLazyQuery)((0, _graphqltag.gql)(gqlQuery), _object_spread_props(_object_spread({}, fetcher.queryOptions), {
168
+ variables: {
169
+ where: getWhere(),
170
+ skip: page * pageSize - pageSize,
171
+ limit: pageSize,
172
+ sort: sort || {}
173
+ }
174
+ }));
175
+ const [defaultValueFetch, { data: defaultValueData }] = (0, _hooks.useLazyQuery)((0, _graphqltag.gql)(gqlQuery), _object_spread_props(_object_spread({}, fetcher.queryOptions), {
176
+ variables: {
177
+ where: defaultValueWhere,
178
+ sort: sort || {}
179
+ }
180
+ }));
181
+ (0, _react.useEffect)(()=>{
182
+ if (!disabled) {
183
+ fetch();
184
+ }
185
+ }, []);
186
+ (0, _react.useEffect)(()=>{
187
+ if (!disabled && defaultValue) {
188
+ defaultValueFetch();
189
+ }
190
+ }, []);
191
+ (0, _react.useEffect)(()=>{
192
+ const storedData = sessionStorage.getItem(`dropdown-${query}-${name}-${_id}`);
193
+ if (storedData) {
194
+ const parsedData = JSON.parse(storedData);
195
+ const items = parsedData[name];
196
+ if (items) {
197
+ if (multiple) {
198
+ setDisplayed([
199
+ ...items
200
+ ]);
201
+ } else {
202
+ setDisplayed(items[0]);
203
+ }
204
+ }
205
+ }
206
+ }, [
207
+ query,
208
+ name
209
+ ]);
210
+ (0, _react.useEffect)(()=>{
211
+ if (data && !isLastPage && prevPage < page) {
212
+ const newOptions = options_path ? (0, _helpers.getJPart)(data, options_path) : (0, _helpers.getJPart)(data, method_name);
213
+ if (newOptions == null || newOptions.length < pageSize) {
214
+ setIsLastPage(true);
215
+ }
216
+ if (reason !== 'loaded more') {
217
+ setOptions(newOptions);
218
+ } else {
219
+ setOptions([
220
+ ...options,
221
+ ...newOptions
222
+ ]);
223
+ }
224
+ }
225
+ }, [
226
+ data,
227
+ reason
228
+ ]);
229
+ (0, _react.useEffect)(()=>{
230
+ if (defaultValue) {
231
+ setDefaultValueWhere(_object_spread_props(_object_spread({}, where), {
232
+ [title_path]: defaultValue
233
+ }));
234
+ }
235
+ }, []);
236
+ (0, _react.useEffect)(()=>{
237
+ var _defaultValueData_method_name;
238
+ if (defaultValue && (defaultValueData === null || defaultValueData === void 0 ? void 0 : (_defaultValueData_method_name = defaultValueData[method_name]) === null || _defaultValueData_method_name === void 0 ? void 0 : _defaultValueData_method_name.length) == 1) {
239
+ //choose default value
240
+ handleOptionClick(defaultValueData === null || defaultValueData === void 0 ? void 0 : defaultValueData[method_name][0]);
241
+ if (onAdd) {
242
+ onAdd(defaultValueData === null || defaultValueData === void 0 ? void 0 : defaultValueData[method_name][0]);
243
+ }
244
+ }
245
+ }, [
246
+ defaultValue,
247
+ defaultValueData
248
+ ]);
249
+ const handleSearch = (e)=>{
250
+ setSearchValue(e.target.value);
251
+ setReason('searched');
252
+ setPage(1);
253
+ setPrevPage(0);
254
+ setIsLastPage(false);
255
+ };
256
+ const handleOptionClick = (option)=>{
257
+ const clicked = (0, _helpers.getOption)(option, title_path);
258
+ switch(multiple){
259
+ case true:
260
+ if (displayed.map((item)=>{
261
+ return item[title_path];
262
+ }).includes(clicked)) {
263
+ (0, _helpers.deleteOneItem)(option, props, displayed, setDisplayed);
264
+ } else {
265
+ if (onAdd) {
266
+ onAdd(option);
267
+ }
268
+ if (!multiple) {
269
+ setIsOpen(false);
270
+ }
271
+ const opts = [
272
+ ...displayed,
273
+ option
274
+ ];
275
+ setDisplayed(opts);
276
+ (0, _helpers.addToStoredDisplayed)(option, props);
277
+ }
278
+ break;
279
+ default:
280
+ setDisplayed(option);
281
+ if (onAdd) {
282
+ onAdd(option);
283
+ }
284
+ (0, _helpers.addToStoredDisplayed)(option, props);
285
+ if (!multiple && !defaultValue) {
286
+ setIsOpen(false);
287
+ }
288
+ }
289
+ };
290
+ const selectAll = ()=>{
291
+ const unselectedOptions = options.filter((option)=>{
292
+ return !displayed.map((item)=>item[title_path]).includes((0, _helpers.getOption)(option, title_path));
293
+ });
294
+ const opts = [
295
+ ...displayed,
296
+ ...unselectedOptions
297
+ ];
298
+ setDisplayed(opts);
299
+ if (onAdd) {
300
+ onAdd(opts);
301
+ }
302
+ sessionStorage.setItem(`dropdown-${query}-${name}-${_id}`, JSON.stringify({
303
+ [name]: opts
304
+ }));
305
+ };
306
+ const unSelectAll = ()=>{
307
+ if (onUnselectAll) {
308
+ onUnselectAll();
309
+ setDisplayed([]);
310
+ sessionStorage.removeItem(`dropdown-${query}-${name}-${_id}`);
311
+ }
312
+ };
313
+ const displayListOptions = ()=>{
314
+ switch(type){
315
+ case 'checkbox':
316
+ {
317
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
318
+ children: [
319
+ multiple && onUnselectAll && /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
320
+ onClick: ()=>{
321
+ if (displayed.length === options.length) {
322
+ unSelectAll();
323
+ } else {
324
+ selectAll();
325
+ }
326
+ },
327
+ children: [
328
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.CheckboxIcon, {
329
+ checked: displayed.length === options.length
330
+ }),
331
+ (0, _helpers.titleCase)('select all')
332
+ ]
333
+ }),
334
+ options.map((option)=>{
335
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
336
+ onClick: ()=>{
337
+ handleOptionClick(option);
338
+ },
339
+ children: [
340
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.CheckboxIcon, {
341
+ checked: (0, _helpers.isChecked)(option, displayed, props)
342
+ }),
343
+ getSingleOptionFromListOrDisplayed(option, 'list')
344
+ ]
345
+ }, option._id);
346
+ })
347
+ ]
348
+ });
349
+ }
350
+ case 'text':
351
+ default:
352
+ {
353
+ return options.map((option)=>{
354
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
355
+ onClick: ()=>{
356
+ handleOptionClick(option);
357
+ },
358
+ children: getSingleOptionFromListOrDisplayed(option, 'list')
359
+ }, option._id);
360
+ });
361
+ }
362
+ }
363
+ };
364
+ const getCurrentValues = ()=>{
365
+ if (multiple) {
366
+ return getDisplayedValuesMultiple();
367
+ } else {
368
+ return getSingleOptionFromListOrDisplayed(displayed, 'displayed');
369
+ }
370
+ };
371
+ const getSingleOptionFromListOrDisplayed = (option, modal)=>{
372
+ if (option) {
373
+ let rv = null;
374
+ const clicked = (0, _helpers.getOption)(option, title_path);
375
+ switch(modal_type){
376
+ case 'chip':
377
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ChipOption, {
378
+ option: option,
379
+ curValue: clicked,
380
+ modal: modal,
381
+ fetchedProps: props,
382
+ displayed: displayed,
383
+ setDisplayed: setDisplayed
384
+ });
385
+ break;
386
+ case 'logo':
387
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.LogoOption, {
388
+ option: option,
389
+ curValue: clicked,
390
+ modal: modal,
391
+ fetchedProps: props,
392
+ displayed: displayed,
393
+ setDisplayed: setDisplayed
394
+ });
395
+ break;
396
+ case 'text':
397
+ default:
398
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.TextOption, {
399
+ option: option,
400
+ curValue: clicked,
401
+ modal: modal,
402
+ fetchedProps: props,
403
+ displayed: displayed,
404
+ setDisplayed: setDisplayed
405
+ });
406
+ break;
407
+ }
408
+ return rv;
409
+ }
410
+ };
411
+ const getDisplayedValuesMultiple = ()=>{
412
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_Stack.default, {
413
+ direction: 'row',
414
+ sx: {
415
+ display: 'flex',
416
+ justifyContent: 'space-between'
417
+ },
418
+ children: [
419
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Stack.default, {
420
+ direction: 'row',
421
+ sx: {
422
+ overflow: 'hidden',
423
+ flexWrap: 'wrap',
424
+ gap: 1,
425
+ width: '100%'
426
+ },
427
+ children: Array.isArray(displayed) && (displayed === null || displayed === void 0 ? void 0 : displayed.map((item)=>{
428
+ return getSingleOptionFromListOrDisplayed(item, 'displayed');
429
+ }))
430
+ }),
431
+ (displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Box.default, {
432
+ sx: {
433
+ minWidth: '20px',
434
+ maxWidth: '20px',
435
+ cursor: 'pointer',
436
+ paddingLeft: '3px'
437
+ },
438
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
439
+ assetUrl: assetUrl,
440
+ onClick: ()=>{
441
+ setDisplayed([]);
442
+ if (onRemoveAll) {
443
+ onRemoveAll();
444
+ }
445
+ sessionStorage.removeItem(`dropdown-${query}-${name}-${_id}`);
446
+ },
447
+ icon: 'filters/remove_all_button.svg',
448
+ width: 16,
449
+ height: 16
450
+ })
451
+ })
452
+ ]
453
+ });
454
+ };
455
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.Root, {
456
+ style: rootStylesOverride,
457
+ children: [
458
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_Box.default, {
459
+ children: [
460
+ getCurrentValues(),
461
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.InputWrapper, {
462
+ disabled: disabled,
463
+ children: [
464
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
465
+ autoFocus: true,
466
+ placeholder: placeholder || 'Select an option...',
467
+ onChange: (e)=>{
468
+ handleSearch(e);
469
+ },
470
+ onFocus: ()=>{
471
+ if (!isInitialOpen) {
472
+ setIsOpen(true);
473
+ }
474
+ }
475
+ }),
476
+ loading && /*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.Loading, {
477
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_CircularProgress.default, {})
478
+ })
479
+ ]
480
+ })
481
+ ]
482
+ }),
483
+ (isInitialOpen || isOpen) && options && (options === null || options === void 0 ? void 0 : options.length) > 0 && !disabled ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.StyledListBox, {
484
+ ref: ref,
485
+ children: [
486
+ displayListOptions(),
487
+ !isLastPage && /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
488
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
489
+ onClick: ()=>{
490
+ setReason('loaded more');
491
+ loadMore();
492
+ },
493
+ children: "load more"
494
+ })
495
+ })
496
+ ]
497
+ }) : null
498
+ ]
499
+ });
500
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "CheckboxIcon", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return CheckboxIcon;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
13
+ const _Checkbox = /*#__PURE__*/ _interop_require_default(require("@mui/material/Checkbox"));
14
+ const _styles = require("@mui/material/styles");
15
+ const _CheckBoxOutlineBlank = /*#__PURE__*/ _interop_require_default(require("@mui/icons-material/CheckBoxOutlineBlank"));
16
+ const _CheckBox = /*#__PURE__*/ _interop_require_default(require("@mui/icons-material/CheckBox"));
17
+ function _interop_require_default(obj) {
18
+ return obj && obj.__esModule ? obj : {
19
+ default: obj
20
+ };
21
+ }
22
+ const uncheckedIcon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_CheckBoxOutlineBlank.default, {
23
+ fontSize: "small"
24
+ });
25
+ const checkedIcon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_CheckBox.default, {
26
+ fontSize: "small"
27
+ });
28
+ const CheckboxIcon = ({ checked })=>{
29
+ const theme = (0, _styles.useTheme)();
30
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_Checkbox.default, {
31
+ icon: uncheckedIcon,
32
+ checked: checked,
33
+ checkedIcon: checkedIcon,
34
+ sx: {
35
+ mr: 1,
36
+ minWidth: 24,
37
+ minHeight: 24,
38
+ p: 0,
39
+ ['& svg']: {
40
+ fill: theme.palette.primary.light
41
+ }
42
+ }
43
+ });
44
+ };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "ChipOption", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return ChipOption;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
13
+ const _FxChip = require("../../FxChip");
14
+ const _helpers = require("../helpers/helpers");
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ const ChipOption = ({ option, curValue, modal, fetchedProps, displayed, setDisplayed })=>{
21
+ return modal == 'displayed' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
22
+ assetUrl: fetchedProps.assetUrl,
23
+ status: curValue,
24
+ label: (0, _helpers.titleCase)(curValue),
25
+ variant: "outlined",
26
+ onDelete: ()=>{
27
+ (0, _helpers.deleteOneItem)(option, fetchedProps, displayed, setDisplayed);
28
+ }
29
+ }, option._id) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
30
+ assetUrl: fetchedProps.assetUrl,
31
+ status: curValue,
32
+ label: (0, _helpers.titleCase)(curValue),
33
+ variant: "outlined"
34
+ }, option._id);
35
+ };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "ChosenIcon", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return ChosenIcon;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
13
+ const _FxIcon = require("../../FxIcon");
14
+ const _helpers = require("../helpers/helpers");
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ const ChosenIcon = ({ option, isDisplay, fetchedProps, displayed })=>{
21
+ const { assetUrl, title_path, multiple, search_path } = fetchedProps;
22
+ const isChecked = (option)=>{
23
+ const clicked = (0, _helpers.getOption)(option, title_path);
24
+ if (typeof displayed === 'string') {
25
+ return false;
26
+ } else {
27
+ if (multiple) {
28
+ return Array.isArray(displayed) && displayed.map((item)=>{
29
+ return item[title_path];
30
+ }).includes(clicked);
31
+ } else {
32
+ return displayed[search_path] === clicked;
33
+ }
34
+ }
35
+ };
36
+ if (isDisplay && isChecked(option)) {
37
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
38
+ width: 16,
39
+ height: 16,
40
+ icon: 'filters/chosen_icon.svg',
41
+ assetUrl: assetUrl
42
+ });
43
+ }
44
+ return null;
45
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "DeleteButton", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return DeleteButton;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
13
+ const _Box = /*#__PURE__*/ _interop_require_default(require("@mui/material/Box"));
14
+ const _helpers = require("../helpers/helpers");
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ const DeleteButton = ({ option, isDisplay, fetchedProps, displayed, setDisplayed })=>{
21
+ const { multiple, search_path, title_path } = fetchedProps !== null && fetchedProps !== void 0 ? fetchedProps : {};
22
+ const isDisplayButton = isDisplay && (multiple && (displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0 || !multiple && displayed[search_path] === (0, _helpers.getOption)(option, title_path));
23
+ switch(isDisplayButton){
24
+ case true:
25
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_Box.default, {
26
+ sx: {
27
+ margin: '0 5px'
28
+ },
29
+ onClick: ()=>{
30
+ (0, _helpers.deleteOneItem)(option, fetchedProps, displayed, setDisplayed);
31
+ },
32
+ children: "x"
33
+ });
34
+ default:
35
+ return null;
36
+ }
37
+ };