@fixefy/fixefy-ui-components 0.2.20 → 0.2.22

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.
@@ -27,5 +27,6 @@ export type AsyncDropdownPropsType = {
27
27
  query: string;
28
28
  isInitialOpen?: boolean;
29
29
  placeholder?: string;
30
+ rootStyle?: any;
30
31
  };
31
32
  export declare const FxAsyncDropdown: React.ForwardRefExoticComponent<Omit<AsyncDropdownPropsType, "ref"> & React.RefAttributes<unknown>>;
@@ -120,7 +120,7 @@ const checkedIcon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.CheckBox,
120
120
  fontSize: "small"
121
121
  });
122
122
  const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
123
- const { onAdd, onRemoveOne, onRemoveAll, fetcher, disabled, type = 'text', variables, search_path, modal_type, multiple, name, query, isInitialOpen, placeholder, title_path } = props;
123
+ const { onAdd, onRemoveOne, onRemoveAll, fetcher, disabled, type = 'text', variables, search_path, modal_type, multiple, name, query, isInitialOpen, placeholder, title_path, rootStyle } = props;
124
124
  const ref = (0, _react.useRef)(null);
125
125
  const theme = (0, _material.useTheme)();
126
126
  const [displayed, setDisplayed] = (0, _react.useState)(multiple ? [] : '');
@@ -532,6 +532,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
532
532
  });
533
533
  };
534
534
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.Root, {
535
+ style: rootStyle,
535
536
  children: [
536
537
  /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
537
538
  children: [
@@ -84,13 +84,20 @@ function _object_spread_props(target, source) {
84
84
  }
85
85
  return target;
86
86
  }
87
- const Root = (0, _styles.styled)('div')(()=>({
87
+ const Root = (0, _styles.styled)('div')(({ props })=>{
88
+ return _object_spread_props(_object_spread({}, props), {
88
89
  color: 'rgba(0,0,0,.85)',
89
90
  fontSize: 14,
90
91
  background: '#FFFFFF',
91
92
  padding: '0 16px',
92
- position: 'relative'
93
- }));
93
+ position: 'relative',
94
+ ' & .MuiBox-root': {
95
+ ['& > div']: {
96
+ padding: 0
97
+ }
98
+ }
99
+ });
100
+ });
94
101
  const Label = (0, _styles.styled)('label')(()=>({
95
102
  padding: '0 0 4px',
96
103
  lineHeight: '1.5',
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ export interface StaticDropdownStylesOptions {
3
+ width?: string | number;
4
+ maxWidth?: string | number;
5
+ inputSx?: object;
6
+ menuSx?: object;
7
+ }
8
+ export type StaticDropdownPropsType = {
9
+ initialValue?: string | any;
10
+ styles?: StaticDropdownStylesOptions;
11
+ multiple?: boolean;
12
+ onAdd?: (value: any) => void;
13
+ onRemoveOne?: (value: any) => void;
14
+ onRemoveAll?: () => void;
15
+ type?: 'checkbox' | 'text';
16
+ modal_type?: string;
17
+ query: string;
18
+ isInitialOpen?: boolean;
19
+ placeholder?: string;
20
+ data: string[];
21
+ rootStyle?: any;
22
+ };
23
+ export declare const FxStaticDropdown: React.ForwardRefExoticComponent<StaticDropdownPropsType & React.RefAttributes<unknown>>;
@@ -0,0 +1,414 @@
1
+ // @ts-ignore
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "FxStaticDropdown", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return FxStaticDropdown;
10
+ }
11
+ });
12
+ const _jsxruntime = require("react/jsx-runtime");
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
14
+ const _iconsmaterial = require("@mui/icons-material");
15
+ const _material = require("@mui/material");
16
+ const _FxChip = require("../FxChip");
17
+ const _FxIcon = require("../FxIcon");
18
+ const _dropdownstyles = require("./styles/dropdown.styles");
19
+ const _helpers = require("./helpers/helpers");
20
+ function _getRequireWildcardCache(nodeInterop) {
21
+ if (typeof WeakMap !== "function") return null;
22
+ var cacheBabelInterop = new WeakMap();
23
+ var cacheNodeInterop = new WeakMap();
24
+ return (_getRequireWildcardCache = function(nodeInterop) {
25
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
26
+ })(nodeInterop);
27
+ }
28
+ function _interop_require_wildcard(obj, nodeInterop) {
29
+ if (!nodeInterop && obj && obj.__esModule) {
30
+ return obj;
31
+ }
32
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
33
+ return {
34
+ default: obj
35
+ };
36
+ }
37
+ var cache = _getRequireWildcardCache(nodeInterop);
38
+ if (cache && cache.has(obj)) {
39
+ return cache.get(obj);
40
+ }
41
+ var newObj = {
42
+ __proto__: null
43
+ };
44
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
45
+ for(var key in obj){
46
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
47
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
48
+ if (desc && (desc.get || desc.set)) {
49
+ Object.defineProperty(newObj, key, desc);
50
+ } else {
51
+ newObj[key] = obj[key];
52
+ }
53
+ }
54
+ }
55
+ newObj.default = obj;
56
+ if (cache) {
57
+ cache.set(obj, newObj);
58
+ }
59
+ return newObj;
60
+ }
61
+ const icon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.CheckBoxOutlineBlank, {
62
+ fontSize: "small"
63
+ });
64
+ const checkedIcon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.CheckBox, {
65
+ fontSize: "small"
66
+ });
67
+ const FxStaticDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
68
+ const { onAdd, onRemoveOne, onRemoveAll, type = 'text', modal_type, multiple, query, isInitialOpen, placeholder, data, rootStyle } = props;
69
+ const ref = (0, _react.useRef)(null);
70
+ const theme = (0, _material.useTheme)();
71
+ const [displayed, setDisplayed] = (0, _react.useState)(multiple ? [] : '');
72
+ const [isOpen, setIOpen] = (0, _react.useState)(isInitialOpen);
73
+ (0, _react.useEffect)(()=>{
74
+ const storedData = sessionStorage.getItem(`dropdown-${query}`);
75
+ if (storedData) {
76
+ const parsedData = JSON.parse(storedData);
77
+ if (parsedData) {
78
+ multiple ? setDisplayed([
79
+ ...parsedData
80
+ ]) : setDisplayed(parsedData[0]);
81
+ }
82
+ }
83
+ }, [
84
+ query,
85
+ name
86
+ ]);
87
+ const addToStoredDisplayed = (option)=>{
88
+ const prevStored = sessionStorage.getItem(`dropdown-${query}`);
89
+ let data = prevStored ? JSON.parse(prevStored) : {};
90
+ if (data) {
91
+ if (multiple) {
92
+ data = [
93
+ ...data,
94
+ option
95
+ ];
96
+ } else {
97
+ data = [
98
+ option
99
+ ];
100
+ }
101
+ } else {
102
+ data = [
103
+ option
104
+ ];
105
+ }
106
+ sessionStorage.setItem(`dropdown-${query}`, JSON.stringify(data));
107
+ };
108
+ const removeOneFromStoredDisplayed = (option)=>{
109
+ let storedDisplayed = sessionStorage.getItem(`dropdown-${query}`);
110
+ if (storedDisplayed) {
111
+ storedDisplayed = JSON.parse(storedDisplayed);
112
+ if (multiple) {
113
+ const newDisplayed = storedDisplayed.filter((opt)=>{
114
+ opt !== option;
115
+ });
116
+ storedDisplayed = newDisplayed;
117
+ } else {
118
+ storedDisplayed = storedDisplayed.filter((opt)=>opt !== option);
119
+ }
120
+ sessionStorage.setItem(`dropdown-${query}`, JSON.stringify(storedDisplayed));
121
+ }
122
+ };
123
+ const handleOptionClick = (option)=>{
124
+ switch(multiple){
125
+ case true:
126
+ if (displayed.includes(option)) {
127
+ deleteOneItem(option);
128
+ } else {
129
+ onAdd && onAdd(option);
130
+ setDisplayed((prev)=>[
131
+ ...prev,
132
+ option
133
+ ]);
134
+ addToStoredDisplayed(option);
135
+ }
136
+ break;
137
+ default:
138
+ setDisplayed(option);
139
+ onAdd && onAdd(option);
140
+ addToStoredDisplayed(option);
141
+ }
142
+ };
143
+ const deleteOneItem = (item)=>{
144
+ if (multiple) {
145
+ setDisplayed((prev)=>prev.filter((val)=>val !== item));
146
+ } else {
147
+ setDisplayed('');
148
+ }
149
+ onRemoveOne && onRemoveOne(item);
150
+ removeOneFromStoredDisplayed(item);
151
+ };
152
+ const isChecked = (option)=>{
153
+ if (multiple) {
154
+ return displayed.includes(option);
155
+ } else {
156
+ return displayed === option;
157
+ }
158
+ };
159
+ const displayListOptions = ()=>{
160
+ switch(type){
161
+ case 'checkbox':
162
+ {
163
+ return data.map((option)=>{
164
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
165
+ onClick: ()=>{
166
+ handleOptionClick(option);
167
+ },
168
+ children: [
169
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
170
+ icon: icon,
171
+ checked: isChecked(option),
172
+ checkedIcon: checkedIcon,
173
+ sx: {
174
+ mr: 1,
175
+ minWidth: 24,
176
+ minHeight: 24,
177
+ p: 0,
178
+ ['& svg']: {
179
+ fill: theme.palette.primary.light
180
+ }
181
+ }
182
+ }),
183
+ getSingleValueByModalType(option, 'list')
184
+ ]
185
+ }, option);
186
+ });
187
+ }
188
+ case 'text':
189
+ default:
190
+ {
191
+ return data.map((option)=>{
192
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
193
+ onClick: ()=>{
194
+ handleOptionClick(option);
195
+ },
196
+ children: getSingleValueByModalType(option, 'list')
197
+ }, option._id);
198
+ });
199
+ }
200
+ }
201
+ };
202
+ const getCurrentValues = ()=>{
203
+ if (multiple) {
204
+ return getMultipleDisplayedValues();
205
+ } else {
206
+ return getSingleValueByModalType(displayed, 'displayed');
207
+ }
208
+ };
209
+ const DeleteButton = ({ option })=>{
210
+ let rv = null;
211
+ switch(multiple){
212
+ case true:
213
+ if ((displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0) {
214
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
215
+ onClick: ()=>{
216
+ deleteOneItem(option);
217
+ },
218
+ children: "x"
219
+ });
220
+ }
221
+ break;
222
+ case false:
223
+ default:
224
+ if (displayed === option) {
225
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
226
+ onClick: ()=>{
227
+ deleteOneItem(option);
228
+ },
229
+ children: "x"
230
+ });
231
+ }
232
+ break;
233
+ }
234
+ return rv;
235
+ };
236
+ const getSingleValueByModalType = (option, modal)=>{
237
+ if (option) {
238
+ let rv = null;
239
+ switch(modal_type){
240
+ case 'chip':
241
+ rv = modal === 'displayed' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
242
+ status: option,
243
+ label: (0, _helpers.titleCase)(option),
244
+ variant: "outlined",
245
+ onDelete: ()=>{
246
+ deleteOneItem(option);
247
+ }
248
+ }, option) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
249
+ status: option,
250
+ label: (0, _helpers.titleCase)(option),
251
+ variant: "outlined"
252
+ }, option);
253
+ break;
254
+ case 'logo':
255
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
256
+ sx: {
257
+ display: 'flex',
258
+ gap: 1,
259
+ color: 'grey',
260
+ cursor: 'pointer',
261
+ width: '100%'
262
+ },
263
+ children: [
264
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
265
+ style: {
266
+ width: '70px'
267
+ },
268
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
269
+ icon: `companies/${option.logo ? option.logo : 'logo_placeholder/logo_placeholder.svg'}`,
270
+ width: 70,
271
+ height: 16
272
+ })
273
+ }),
274
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
275
+ sx: {
276
+ width: '170px',
277
+ overflow: 'hidden',
278
+ display: 'flex',
279
+ justifyContent: 'flex-start',
280
+ gap: 1
281
+ },
282
+ children: [
283
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
284
+ variant: "subtitle2",
285
+ color: theme.palette.typography.title,
286
+ children: (0, _helpers.titleCase)(option)
287
+ }),
288
+ modal === 'displayed' && /*#__PURE__*/ (0, _jsxruntime.jsx)(DeleteButton, {
289
+ option: option
290
+ })
291
+ ]
292
+ }),
293
+ modal === 'list' && isChecked(option) && /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
294
+ width: 16,
295
+ height: 16,
296
+ icon: 'filters/chosen_icon.svg'
297
+ })
298
+ ]
299
+ }, option._id);
300
+ break;
301
+ case 'text':
302
+ default:
303
+ rv = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
304
+ sx: {
305
+ display: 'flex',
306
+ justifyContent: 'space-between',
307
+ width: '100%',
308
+ maxWidth: '250px',
309
+ gap: 1,
310
+ color: 'grey',
311
+ cursor: 'pointer'
312
+ },
313
+ children: [
314
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
315
+ sx: {
316
+ width: '210px',
317
+ overflow: 'hidden',
318
+ display: 'flex',
319
+ justifyContent: 'flex-start',
320
+ gap: 1
321
+ },
322
+ children: [
323
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
324
+ variant: "subtitle2",
325
+ color: theme.palette.typography.title,
326
+ children: (0, _helpers.titleCase)(option)
327
+ }),
328
+ modal === 'displayed' && /*#__PURE__*/ (0, _jsxruntime.jsx)(DeleteButton, {
329
+ option: option
330
+ })
331
+ ]
332
+ }),
333
+ modal === 'list' && isChecked(option) && /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
334
+ width: 16,
335
+ height: 16,
336
+ icon: 'filters/chosen_icon.svg'
337
+ })
338
+ ]
339
+ }, option._id);
340
+ break;
341
+ }
342
+ return rv;
343
+ }
344
+ };
345
+ const getMultipleDisplayedValues = ()=>{
346
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
347
+ direction: 'row',
348
+ sx: {
349
+ maxWidth: 214,
350
+ minWidth: 214,
351
+ display: 'flex',
352
+ justifyContent: 'space-between'
353
+ },
354
+ children: [
355
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
356
+ direction: 'row',
357
+ sx: {
358
+ overflow: 'hidden',
359
+ flexWrap: 'wrap',
360
+ gap: 1
361
+ },
362
+ children: displayed.map((item)=>{
363
+ return getSingleValueByModalType(item, 'displayed');
364
+ })
365
+ }),
366
+ (displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
367
+ sx: {
368
+ minWidth: '20px',
369
+ maxWidth: '20px',
370
+ cursor: 'pointer'
371
+ },
372
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
373
+ onClick: ()=>{
374
+ setDisplayed([]);
375
+ onRemoveAll && onRemoveAll();
376
+ sessionStorage.removeItem(`dropdown-${query}`);
377
+ },
378
+ icon: `filters/remove_all_button.svg`,
379
+ width: 16,
380
+ height: 16
381
+ })
382
+ })
383
+ ]
384
+ });
385
+ };
386
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.Root, {
387
+ style: rootStyle,
388
+ children: [
389
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
390
+ children: [
391
+ getCurrentValues(),
392
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.InputWrapper, {
393
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
394
+ autoFocus: true,
395
+ placeholder: placeholder || 'Select an option...',
396
+ onFocus: ()=>{
397
+ !isInitialOpen && setIOpen(true);
398
+ },
399
+ onBlur: ()=>{
400
+ setTimeout(()=>{
401
+ !isInitialOpen && setIOpen(false);
402
+ }, 200);
403
+ }
404
+ })
405
+ })
406
+ ]
407
+ }),
408
+ (isInitialOpen || isOpen) && data && (data === null || data === void 0 ? void 0 : data.length) > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.StyledListBox, {
409
+ ref: ref,
410
+ children: displayListOptions()
411
+ })
412
+ ]
413
+ });
414
+ });
@@ -0,0 +1,6 @@
1
+ export declare const getJPart: (j: any, jsonPath: string, defaultValue?: any) => any;
2
+ export declare const isArrayValid: (arr: any[], minLength?: number, maxLength?: number) => boolean;
3
+ export declare const isObjectValid: (obj: any, isCheckKeys?: boolean) => boolean;
4
+ export declare const isStringValid: (str: string, minLength?: number | null, maxLength?: number | null, isValidateType?: boolean) => boolean;
5
+ export declare const titleCase: (str?: string) => string;
6
+ export declare const toPascalCase: (string: string, title?: boolean) => string;
@@ -0,0 +1,161 @@
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
+ getJPart: function() {
13
+ return getJPart;
14
+ },
15
+ isArrayValid: function() {
16
+ return isArrayValid;
17
+ },
18
+ isObjectValid: function() {
19
+ return isObjectValid;
20
+ },
21
+ isStringValid: function() {
22
+ return isStringValid;
23
+ },
24
+ titleCase: function() {
25
+ return titleCase;
26
+ },
27
+ toPascalCase: function() {
28
+ return toPascalCase;
29
+ }
30
+ });
31
+ function _define_property(obj, key, value) {
32
+ if (key in obj) {
33
+ Object.defineProperty(obj, key, {
34
+ value: value,
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true
38
+ });
39
+ } else {
40
+ obj[key] = value;
41
+ }
42
+ return obj;
43
+ }
44
+ function _object_spread(target) {
45
+ for(var i = 1; i < arguments.length; i++){
46
+ var source = arguments[i] != null ? arguments[i] : {};
47
+ var ownKeys = Object.keys(source);
48
+ if (typeof Object.getOwnPropertySymbols === "function") {
49
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
50
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
51
+ }));
52
+ }
53
+ ownKeys.forEach(function(key) {
54
+ _define_property(target, key, source[key]);
55
+ });
56
+ }
57
+ return target;
58
+ }
59
+ function ownKeys(object, enumerableOnly) {
60
+ var keys = Object.keys(object);
61
+ if (Object.getOwnPropertySymbols) {
62
+ var symbols = Object.getOwnPropertySymbols(object);
63
+ if (enumerableOnly) {
64
+ symbols = symbols.filter(function(sym) {
65
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
66
+ });
67
+ }
68
+ keys.push.apply(keys, symbols);
69
+ }
70
+ return keys;
71
+ }
72
+ function _object_spread_props(target, source) {
73
+ source = source != null ? source : {};
74
+ if (Object.getOwnPropertyDescriptors) {
75
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
76
+ } else {
77
+ ownKeys(Object(source)).forEach(function(key) {
78
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
79
+ });
80
+ }
81
+ return target;
82
+ }
83
+ const getJPart = (j, jsonPath, defaultValue)=>{
84
+ // input check - if key is invalid - return error
85
+ if (isObjectValid(j) === false) return defaultValue;
86
+ // convert indexes to properties
87
+ jsonPath = jsonPath.replace(/\[(\w+)\]/g, '.$1');
88
+ // strip a leading dot
89
+ jsonPath = jsonPath.replace(/^\./, '');
90
+ // split path by '.'
91
+ let _isArrayValid = false;
92
+ let _isStringValid = false;
93
+ let currentPathPart;
94
+ let isLoop = true;
95
+ const pathParts = jsonPath.split('.');
96
+ for(let i = 0, n = pathParts.length; isLoop && i < n; ++i){
97
+ currentPathPart = pathParts[i];
98
+ _isStringValid = isStringValid(j);
99
+ _isArrayValid = isArrayValid(j);
100
+ if (_isStringValid === true || _isArrayValid === true) {
101
+ if (_isStringValid === true) {
102
+ j = JSON.parse(j);
103
+ } else {
104
+ j = j.reduce((acc, cur)=>{
105
+ const innerJ = getJPart(cur, pathParts.slice(i).join('.'), defaultValue);
106
+ if (isArrayValid(innerJ)) {
107
+ acc.push(...innerJ);
108
+ } else {
109
+ acc.push(_object_spread_props(_object_spread({}, innerJ), {
110
+ value: innerJ._id
111
+ }));
112
+ }
113
+ return acc;
114
+ }, []);
115
+ isLoop = false;
116
+ }
117
+ } else {
118
+ if (currentPathPart in j) {
119
+ j = j[currentPathPart];
120
+ } else {
121
+ // if something in the process failed:
122
+ // 1. set the rv as the default value
123
+ // 2. stop the loop`
124
+ j = defaultValue;
125
+ isLoop = false;
126
+ }
127
+ }
128
+ }
129
+ return j;
130
+ };
131
+ const isArrayValid = (arr, minLength = 1, maxLength = 0)=>{
132
+ let rv = isObjectValid(arr) && arr.length >= minLength && //arr instanceof Array
133
+ Object.prototype.toString.call(arr) == '[object Array]';
134
+ if (maxLength > 0) {
135
+ rv = rv && arr.length <= maxLength;
136
+ }
137
+ return rv;
138
+ };
139
+ const isObjectValid = (obj, isCheckKeys = false)=>{
140
+ let rv = typeof obj !== 'undefined' && obj !== null;
141
+ if (isCheckKeys) {
142
+ rv = rv && Object.keys(obj).length > 0;
143
+ }
144
+ return rv;
145
+ };
146
+ const isStringValid = (str, minLength = null, maxLength = null, isValidateType = true)=>{
147
+ let rv = isObjectValid(str) && str.toString().length > 0 && (isValidateType ? typeof str === 'string' : true);
148
+ if (rv === false) return false;
149
+ if (minLength && isNaN(minLength) === false && minLength > 0) {
150
+ rv = rv && str.toString().length >= minLength;
151
+ }
152
+ if (rv === false) return false;
153
+ if (maxLength && isNaN(maxLength) === false && maxLength > 0) {
154
+ rv = rv && str.toString().length <= maxLength;
155
+ }
156
+ return rv;
157
+ };
158
+ const titleCase = (str = '')=>str && toPascalCase(str.toString(), true);
159
+ const toPascalCase = (string, title = false)=>{
160
+ return string && string.replace(/(_[a-z])?(^[a-z])?(_|\s[a-z])?/g, ($1)=>$1.toUpperCase().replace('_', title ? ' ' : ''));
161
+ };
@@ -0,0 +1 @@
1
+ export { FxStaticDropdown, type StaticDropdownStylesOptions, type StaticDropdownPropsType } from './FxStaticDropdown';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FxStaticDropdown", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _FxStaticDropdown.FxStaticDropdown;
9
+ }
10
+ });
11
+ const _FxStaticDropdown = require("./FxStaticDropdown");
@@ -0,0 +1,3 @@
1
+ export declare const Root: any;
2
+ export declare const InputWrapper: any;
3
+ export declare const StyledListBox: any;
@@ -0,0 +1,197 @@
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
+ InputWrapper: function() {
13
+ return InputWrapper;
14
+ },
15
+ Root: function() {
16
+ return Root;
17
+ },
18
+ StyledListBox: function() {
19
+ return StyledListBox;
20
+ }
21
+ });
22
+ const _styles = require("@mui/material/styles");
23
+ function _define_property(obj, key, value) {
24
+ if (key in obj) {
25
+ Object.defineProperty(obj, key, {
26
+ value: value,
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true
30
+ });
31
+ } else {
32
+ obj[key] = value;
33
+ }
34
+ return obj;
35
+ }
36
+ function _object_spread(target) {
37
+ for(var i = 1; i < arguments.length; i++){
38
+ var source = arguments[i] != null ? arguments[i] : {};
39
+ var ownKeys = Object.keys(source);
40
+ if (typeof Object.getOwnPropertySymbols === "function") {
41
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
42
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
43
+ }));
44
+ }
45
+ ownKeys.forEach(function(key) {
46
+ _define_property(target, key, source[key]);
47
+ });
48
+ }
49
+ return target;
50
+ }
51
+ function ownKeys(object, enumerableOnly) {
52
+ var keys = Object.keys(object);
53
+ if (Object.getOwnPropertySymbols) {
54
+ var symbols = Object.getOwnPropertySymbols(object);
55
+ if (enumerableOnly) {
56
+ symbols = symbols.filter(function(sym) {
57
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
58
+ });
59
+ }
60
+ keys.push.apply(keys, symbols);
61
+ }
62
+ return keys;
63
+ }
64
+ function _object_spread_props(target, source) {
65
+ source = source != null ? source : {};
66
+ if (Object.getOwnPropertyDescriptors) {
67
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
68
+ } else {
69
+ ownKeys(Object(source)).forEach(function(key) {
70
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
71
+ });
72
+ }
73
+ return target;
74
+ }
75
+ const Root = (0, _styles.styled)('div')(({ props })=>{
76
+ return _object_spread_props(_object_spread({}, props), {
77
+ color: 'rgba(0,0,0,.85)',
78
+ fontSize: 14,
79
+ background: '#FFFFFF',
80
+ padding: '0 16px',
81
+ position: 'relative',
82
+ ' & .MuiBox-root': {
83
+ ['& > div']: {
84
+ padding: 0
85
+ }
86
+ }
87
+ });
88
+ });
89
+ const InputWrapper = (0, _styles.styled)('div')(({ theme, hasValue, disabled })=>{
90
+ const disabledBorder = `1px solid ${theme.palette.greyscale[200]}`;
91
+ const activeBorder = `1px solid ${theme.palette.primary[500]}`;
92
+ return {
93
+ backgroundColor: theme.palette.common.white,
94
+ borderRadius: 4,
95
+ padding: 1,
96
+ display: 'flex',
97
+ alignItems: 'center',
98
+ flexWrap: 'wrap',
99
+ cursor: disabled ? 'not-allowed' : 'pointer',
100
+ width: '100%',
101
+ border: 'none !important',
102
+ outline: 'none !important',
103
+ ['&:hover']: {
104
+ border: disabled ? disabledBorder : activeBorder,
105
+ borderRadius: 4
106
+ },
107
+ ['&:focus']: {
108
+ border: disabled ? disabledBorder : activeBorder,
109
+ borderRadius: 4
110
+ },
111
+ ['& > svg']: {
112
+ color: disabled ? theme.palette.greyscale[300] : theme.palette.primary['500'],
113
+ marginRight: 8
114
+ },
115
+ ['& input']: _object_spread_props(_object_spread({
116
+ border: 'none',
117
+ outline: 'none',
118
+ cursor: disabled ? 'not-allowed' : 'pointer',
119
+ backgroundColor: theme.palette.common.white,
120
+ color: theme.palette.typography.title,
121
+ height: 36,
122
+ boxSizing: 'border-box',
123
+ width: 0,
124
+ minWidth: 30,
125
+ flexGrow: 1,
126
+ margin: 0
127
+ }, theme.typography.body1), {
128
+ lineHeight: '20px',
129
+ ['& ::placeholder']: {
130
+ color: hasValue ? theme.palette.typography.title : theme.palette.greyscale[400]
131
+ }
132
+ })
133
+ };
134
+ });
135
+ const StyledListBox = (0, _styles.styled)('ul')(({ theme })=>({
136
+ position: 'absolute',
137
+ top: '100%',
138
+ left: 0,
139
+ width: '100%',
140
+ margin: 0,
141
+ marginTop: '1px',
142
+ padding: 0,
143
+ listStyle: 'none',
144
+ backgroundColor: theme.palette.common.white,
145
+ overflow: 'auto',
146
+ zIndex: 1,
147
+ textOverflow: 'ellipsis',
148
+ whiteSpace: 'nowrap',
149
+ overflowX: 'hidden',
150
+ paddingTop: 8,
151
+ paddingBottom: 8,
152
+ // maxWidth: 270,
153
+ // minWidth: 270,
154
+ '&::-webkit-scrollbar': {
155
+ width: '8px',
156
+ backgroundColor: 'transparent'
157
+ },
158
+ '&::-webkit-scrollbar-thumb': {
159
+ backgroundColor: '#8B9092',
160
+ borderRadius: '8px'
161
+ },
162
+ // To support Firefox
163
+ scrollbarWidth: 'thin',
164
+ scrollbarColor: '#8B9092 transparent',
165
+ maxHeight: '300px',
166
+ overflowY: 'auto',
167
+ ['& div']: {
168
+ textOverflow: 'ellipsis',
169
+ whiteSpace: 'nowrap',
170
+ overflow: 'hidden'
171
+ },
172
+ ['& li']: {
173
+ display: 'flex',
174
+ alignItems: 'center',
175
+ justifyContent: 'flex-start',
176
+ height: 40,
177
+ cursor: 'pointer',
178
+ textOverflow: 'ellipsis',
179
+ whiteSpace: 'nowrap',
180
+ overflow: 'hidden',
181
+ width: '100%'
182
+ },
183
+ ['& li:hover']: {
184
+ backgroundColor: '#F6F9FA'
185
+ },
186
+ ["& li[aria-selected='true']"]: {
187
+ fontWeight: 900,
188
+ backgroundColor: '#F6F9FA'
189
+ },
190
+ ["& li[data-focus='true']"]: {
191
+ backgroundColor: '#F6F9FA',
192
+ cursor: 'pointer',
193
+ ['& svg ']: {
194
+ color: 'currentColor'
195
+ }
196
+ }
197
+ }));
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export { FxProgressCounter, ProgressCounterPropsType } from './FxProgressCounter
15
15
  export { FxScore, ScorePropsType } from './FxScore';
16
16
  export { FxShowMore, ShowMorePropsType } from './FxShowMore';
17
17
  export { FxSlider, SliderPropsType } from './FxSlider';
18
+ export { FxStaticDropdown, StaticDropdownStylesOptions, StaticDropdownPropsType } from './FxStaticDropdown';
18
19
  export { FxStatisticsBar, StatisticsPropsType } from './FxStatisticsBar';
19
20
  export { FxStatusBar, StatusBarPropsType, Options } from './FxStatusBar';
20
21
  export { FxTag, TagPropsType } from './FxTag';
package/dist/index.js CHANGED
@@ -96,6 +96,9 @@ _export(exports, {
96
96
  FxSlider: function() {
97
97
  return _FxSlider.FxSlider;
98
98
  },
99
+ FxStaticDropdown: function() {
100
+ return _FxStaticDropdown.FxStaticDropdown;
101
+ },
99
102
  FxStatisticsBar: function() {
100
103
  return _FxStatisticsBar.FxStatisticsBar;
101
104
  },
@@ -165,6 +168,12 @@ _export(exports, {
165
168
  SliderPropsType: function() {
166
169
  return _FxSlider.SliderPropsType;
167
170
  },
171
+ StaticDropdownPropsType: function() {
172
+ return _FxStaticDropdown.StaticDropdownPropsType;
173
+ },
174
+ StaticDropdownStylesOptions: function() {
175
+ return _FxStaticDropdown.StaticDropdownStylesOptions;
176
+ },
168
177
  StatisticsPropsType: function() {
169
178
  return _FxStatisticsBar.StatisticsPropsType;
170
179
  },
@@ -213,6 +222,7 @@ const _FxProgressCounter = require("./FxProgressCounter");
213
222
  const _FxScore = require("./FxScore");
214
223
  const _FxShowMore = require("./FxShowMore");
215
224
  const _FxSlider = require("./FxSlider");
225
+ const _FxStaticDropdown = require("./FxStaticDropdown");
216
226
  const _FxStatisticsBar = require("./FxStatisticsBar");
217
227
  const _FxStatusBar = require("./FxStatusBar");
218
228
  const _FxTag = require("./FxTag");
package/package.json CHANGED
@@ -65,5 +65,5 @@
65
65
  "require": "./dist/index.js"
66
66
  }
67
67
  },
68
- "version": "0.2.20"
68
+ "version": "0.2.22"
69
69
  }