@fixefy/fixefy-ui-components 0.3.38 → 0.3.40
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.
- package/dist/FxObjStaticDropdown/FxObjStaticDropdown.d.ts +34 -0
- package/dist/FxObjStaticDropdown/FxObjStaticDropdown.js +532 -0
- package/dist/FxObjStaticDropdown/index.d.ts +1 -0
- package/dist/FxObjStaticDropdown/index.js +25 -0
- package/dist/FxObjStaticDropdown/styles/dropdown.styles.d.ts +4 -0
- package/dist/FxObjStaticDropdown/styles/dropdown.styles.js +211 -0
- package/dist/FxStrStaticDropdown/FxStrStaticDropdown.d.ts +24 -0
- package/dist/FxStrStaticDropdown/FxStrStaticDropdown.js +368 -0
- package/dist/FxStrStaticDropdown/helpers/helpers.d.ts +2 -0
- package/dist/FxStrStaticDropdown/helpers/helpers.js +22 -0
- package/dist/FxStrStaticDropdown/index.d.ts +1 -0
- package/dist/FxStrStaticDropdown/index.js +11 -0
- package/dist/FxStrStaticDropdown/styles/dropdown.styles.d.ts +3 -0
- package/dist/FxStrStaticDropdown/styles/dropdown.styles.js +190 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/package.json +1 -1
|
@@ -0,0 +1,211 @@
|
|
|
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
|
+
Loading: function() {
|
|
16
|
+
return Loading;
|
|
17
|
+
},
|
|
18
|
+
Root: function() {
|
|
19
|
+
return Root;
|
|
20
|
+
},
|
|
21
|
+
StyledListBox: function() {
|
|
22
|
+
return StyledListBox;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const _styles = require("@mui/material/styles");
|
|
26
|
+
function _define_property(obj, key, value) {
|
|
27
|
+
if (key in obj) {
|
|
28
|
+
Object.defineProperty(obj, key, {
|
|
29
|
+
value: value,
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true
|
|
33
|
+
});
|
|
34
|
+
} else {
|
|
35
|
+
obj[key] = value;
|
|
36
|
+
}
|
|
37
|
+
return obj;
|
|
38
|
+
}
|
|
39
|
+
function _object_spread(target) {
|
|
40
|
+
for(var i = 1; i < arguments.length; i++){
|
|
41
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
42
|
+
var ownKeys = Object.keys(source);
|
|
43
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
44
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
45
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
ownKeys.forEach(function(key) {
|
|
49
|
+
_define_property(target, key, source[key]);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return target;
|
|
53
|
+
}
|
|
54
|
+
function ownKeys(object, enumerableOnly) {
|
|
55
|
+
var keys = Object.keys(object);
|
|
56
|
+
if (Object.getOwnPropertySymbols) {
|
|
57
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
58
|
+
if (enumerableOnly) {
|
|
59
|
+
symbols = symbols.filter(function(sym) {
|
|
60
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
keys.push.apply(keys, symbols);
|
|
64
|
+
}
|
|
65
|
+
return keys;
|
|
66
|
+
}
|
|
67
|
+
function _object_spread_props(target, source) {
|
|
68
|
+
source = source != null ? source : {};
|
|
69
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
70
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
71
|
+
} else {
|
|
72
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
73
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return target;
|
|
77
|
+
}
|
|
78
|
+
const Root = (0, _styles.styled)('div')(({ props })=>{
|
|
79
|
+
return _object_spread_props(_object_spread({
|
|
80
|
+
color: 'rgba(0,0,0,.85)',
|
|
81
|
+
fontSize: 14,
|
|
82
|
+
background: '#FFFFFF',
|
|
83
|
+
padding: '0 16px',
|
|
84
|
+
position: 'relative',
|
|
85
|
+
' & .MuiBox-root': {
|
|
86
|
+
['& > div']: {
|
|
87
|
+
padding: 0
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
minWidth: 270
|
|
91
|
+
}, props), {
|
|
92
|
+
width: 'min-content'
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
const Loading = (0, _styles.styled)('div')(()=>({
|
|
96
|
+
width: 30,
|
|
97
|
+
height: 30,
|
|
98
|
+
display: 'flex',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
['& span']: {
|
|
102
|
+
width: '20px !important',
|
|
103
|
+
height: '20px !important'
|
|
104
|
+
}
|
|
105
|
+
}));
|
|
106
|
+
const InputWrapper = (0, _styles.styled)('div')(({ theme, hasValue, disabled })=>{
|
|
107
|
+
const disabledBorder = `1px solid ${theme.palette.greyscale[200]}`;
|
|
108
|
+
const activeBorder = `1px solid ${theme.palette.primary[500]}`;
|
|
109
|
+
return {
|
|
110
|
+
backgroundColor: theme.palette.common.white,
|
|
111
|
+
borderRadius: 4,
|
|
112
|
+
padding: 1,
|
|
113
|
+
display: 'flex',
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
flexWrap: 'wrap',
|
|
116
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
117
|
+
width: '100%',
|
|
118
|
+
border: 'none !important',
|
|
119
|
+
outline: 'none !important',
|
|
120
|
+
['&:hover']: {
|
|
121
|
+
border: disabled ? disabledBorder : activeBorder,
|
|
122
|
+
borderRadius: 4
|
|
123
|
+
},
|
|
124
|
+
['&:focus']: {
|
|
125
|
+
border: disabled ? disabledBorder : activeBorder,
|
|
126
|
+
borderRadius: 4
|
|
127
|
+
},
|
|
128
|
+
['& > svg']: {
|
|
129
|
+
color: disabled ? theme.palette.greyscale[300] : theme.palette.primary['500'],
|
|
130
|
+
marginRight: 8
|
|
131
|
+
},
|
|
132
|
+
['& input']: _object_spread_props(_object_spread({
|
|
133
|
+
border: 'none',
|
|
134
|
+
outline: 'none',
|
|
135
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
136
|
+
backgroundColor: theme.palette.common.white,
|
|
137
|
+
color: theme.palette.typography.title,
|
|
138
|
+
height: 36,
|
|
139
|
+
boxSizing: 'border-box',
|
|
140
|
+
width: 0,
|
|
141
|
+
minWidth: 30,
|
|
142
|
+
flexGrow: 1,
|
|
143
|
+
margin: 0
|
|
144
|
+
}, theme.typography.body1), {
|
|
145
|
+
lineHeight: '20px',
|
|
146
|
+
['& ::placeholder']: {
|
|
147
|
+
color: hasValue ? theme.palette.typography.title : theme.palette.greyscale[400]
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
const StyledListBox = (0, _styles.styled)('ul')(({ theme })=>{
|
|
153
|
+
return {
|
|
154
|
+
margin: 0,
|
|
155
|
+
padding: '8px 0px',
|
|
156
|
+
listStyle: 'none',
|
|
157
|
+
backgroundColor: theme.palette.common.white,
|
|
158
|
+
overflow: 'auto',
|
|
159
|
+
zIndex: 1,
|
|
160
|
+
textOverflow: 'ellipsis',
|
|
161
|
+
whiteSpace: 'nowrap',
|
|
162
|
+
overflowX: 'hidden',
|
|
163
|
+
minWidth: 270,
|
|
164
|
+
'&::-webkit-scrollbar': {
|
|
165
|
+
width: '8px',
|
|
166
|
+
backgroundColor: 'transparent'
|
|
167
|
+
},
|
|
168
|
+
'&::-webkit-scrollbar-thumb': {
|
|
169
|
+
backgroundColor: '#8B9092',
|
|
170
|
+
borderRadius: '8px'
|
|
171
|
+
},
|
|
172
|
+
// To support Firefox
|
|
173
|
+
scrollbarWidth: 'thin',
|
|
174
|
+
scrollbarColor: '#8B9092 transparent',
|
|
175
|
+
maxHeight: '300px',
|
|
176
|
+
overflowY: 'auto',
|
|
177
|
+
['& div']: {
|
|
178
|
+
textOverflow: 'ellipsis',
|
|
179
|
+
whiteSpace: 'nowrap',
|
|
180
|
+
overflow: 'hidden',
|
|
181
|
+
margin: 'auto 0'
|
|
182
|
+
},
|
|
183
|
+
['& li']: {
|
|
184
|
+
display: 'flex',
|
|
185
|
+
alignItems: 'center',
|
|
186
|
+
justifyContent: 'flex-start',
|
|
187
|
+
height: 40,
|
|
188
|
+
cursor: 'pointer',
|
|
189
|
+
textOverflow: 'ellipsis',
|
|
190
|
+
whiteSpace: 'nowrap',
|
|
191
|
+
overflow: 'hidden',
|
|
192
|
+
width: '100%',
|
|
193
|
+
minWidth: 270,
|
|
194
|
+
marginBottom: 2
|
|
195
|
+
},
|
|
196
|
+
['& li:hover']: {
|
|
197
|
+
backgroundColor: '#F6F9FA'
|
|
198
|
+
},
|
|
199
|
+
["& li[aria-selected='true']"]: {
|
|
200
|
+
fontWeight: 900,
|
|
201
|
+
backgroundColor: '#F6F9FA'
|
|
202
|
+
},
|
|
203
|
+
["& li[data-focus='true']"]: {
|
|
204
|
+
backgroundColor: '#F6F9FA',
|
|
205
|
+
cursor: 'pointer',
|
|
206
|
+
['& svg ']: {
|
|
207
|
+
color: 'currentColor'
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
name: string;
|
|
18
|
+
query: string;
|
|
19
|
+
isInitialOpen?: boolean;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
data: string[];
|
|
22
|
+
rootStylesOverride?: any;
|
|
23
|
+
};
|
|
24
|
+
export declare const FxStrStaticDropdown: React.ForwardRefExoticComponent<StaticDropdownPropsType & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "FxStrStaticDropdown", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return FxStrStaticDropdown;
|
|
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 FxStrStaticDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
68
|
+
const { onAdd, onRemoveOne, onRemoveAll, type = 'text', modal_type, multiple, name, query, isInitialOpen, placeholder, data, rootStylesOverride } = 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, setIsOpen] = (0, _react.useState)(isInitialOpen);
|
|
73
|
+
(0, _react.useEffect)(()=>{
|
|
74
|
+
const storedData = sessionStorage.getItem(`dropdown-${query}-${name}`);
|
|
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
|
+
]);
|
|
86
|
+
const addToStoredDisplayed = (option)=>{
|
|
87
|
+
const prevStored = sessionStorage.getItem(`dropdown-${query}-${name}`);
|
|
88
|
+
let data = prevStored ? JSON.parse(prevStored) : {};
|
|
89
|
+
if (data === null || data === void 0 ? void 0 : data.length) {
|
|
90
|
+
if (multiple) {
|
|
91
|
+
data = [
|
|
92
|
+
...data,
|
|
93
|
+
option
|
|
94
|
+
];
|
|
95
|
+
} else {
|
|
96
|
+
data = [
|
|
97
|
+
option
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
data = [
|
|
102
|
+
option
|
|
103
|
+
];
|
|
104
|
+
}
|
|
105
|
+
sessionStorage.setItem(`dropdown-${query}-${name}`, JSON.stringify(data));
|
|
106
|
+
};
|
|
107
|
+
const removeOneFromStoredDisplayed = (option)=>{
|
|
108
|
+
let storedDisplayed = sessionStorage.getItem(`dropdown-${query}-${name}`);
|
|
109
|
+
if (storedDisplayed) {
|
|
110
|
+
storedDisplayed = JSON.parse(storedDisplayed);
|
|
111
|
+
if (multiple) {
|
|
112
|
+
const newDisplayed = storedDisplayed.filter((opt)=>{
|
|
113
|
+
opt !== option;
|
|
114
|
+
});
|
|
115
|
+
storedDisplayed = newDisplayed;
|
|
116
|
+
} else {
|
|
117
|
+
storedDisplayed = storedDisplayed.filter((opt)=>opt !== option);
|
|
118
|
+
}
|
|
119
|
+
sessionStorage.setItem(`dropdown-${query}-${name}`, JSON.stringify(storedDisplayed));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const handleOptionClick = (option)=>{
|
|
123
|
+
switch(multiple){
|
|
124
|
+
case true:
|
|
125
|
+
if (displayed.includes(option)) {
|
|
126
|
+
deleteOneItem(option);
|
|
127
|
+
} else {
|
|
128
|
+
onAdd && onAdd(option);
|
|
129
|
+
setDisplayed((prev)=>[
|
|
130
|
+
...prev,
|
|
131
|
+
option
|
|
132
|
+
]);
|
|
133
|
+
addToStoredDisplayed(option);
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
default:
|
|
137
|
+
setDisplayed(option);
|
|
138
|
+
onAdd && onAdd(option);
|
|
139
|
+
addToStoredDisplayed(option);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const deleteOneItem = (item)=>{
|
|
143
|
+
if (multiple) {
|
|
144
|
+
setDisplayed((prev)=>prev.filter((val)=>val !== item));
|
|
145
|
+
} else {
|
|
146
|
+
setDisplayed('');
|
|
147
|
+
}
|
|
148
|
+
onRemoveOne && onRemoveOne(item);
|
|
149
|
+
removeOneFromStoredDisplayed(item);
|
|
150
|
+
};
|
|
151
|
+
const isChecked = (option)=>{
|
|
152
|
+
return multiple ? displayed.includes(option) : displayed === option;
|
|
153
|
+
};
|
|
154
|
+
const displayListOptions = ()=>{
|
|
155
|
+
switch(type){
|
|
156
|
+
case 'checkbox':
|
|
157
|
+
{
|
|
158
|
+
return data.map((option)=>{
|
|
159
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
|
|
160
|
+
onClick: ()=>{
|
|
161
|
+
handleOptionClick(option);
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
|
|
165
|
+
icon: icon,
|
|
166
|
+
checked: isChecked(option),
|
|
167
|
+
checkedIcon: checkedIcon,
|
|
168
|
+
sx: {
|
|
169
|
+
mr: 1,
|
|
170
|
+
minWidth: 24,
|
|
171
|
+
minHeight: 24,
|
|
172
|
+
p: 0,
|
|
173
|
+
['& svg']: {
|
|
174
|
+
fill: theme.palette.primary.light
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}),
|
|
178
|
+
getSingleOptionFromListOrDisplayed(option, 'list')
|
|
179
|
+
]
|
|
180
|
+
}, option);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
case 'text':
|
|
184
|
+
default:
|
|
185
|
+
{
|
|
186
|
+
return data.map((option, i)=>{
|
|
187
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
|
|
188
|
+
onClick: ()=>{
|
|
189
|
+
handleOptionClick(option);
|
|
190
|
+
},
|
|
191
|
+
children: getSingleOptionFromListOrDisplayed(option, 'list')
|
|
192
|
+
}, i);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const getCurrentValues = ()=>{
|
|
198
|
+
if (multiple) {
|
|
199
|
+
return getMultipleDisplayedValues();
|
|
200
|
+
} else {
|
|
201
|
+
return getSingleOptionFromListOrDisplayed(displayed, 'displayed');
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const DeleteButton = ({ option, isDisplay })=>{
|
|
205
|
+
const isDisplayButton = isDisplay && multiple && (displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0 || !multiple && displayed === option;
|
|
206
|
+
if (isDisplayButton) {
|
|
207
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
208
|
+
onClick: ()=>{
|
|
209
|
+
deleteOneItem(option);
|
|
210
|
+
},
|
|
211
|
+
children: "x"
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
};
|
|
216
|
+
const Chip = ({ option, modal })=>{
|
|
217
|
+
return modal == 'displayed' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
|
|
218
|
+
status: option,
|
|
219
|
+
label: (0, _helpers.titleCase)(option),
|
|
220
|
+
variant: "outlined",
|
|
221
|
+
onDelete: ()=>{
|
|
222
|
+
deleteOneItem(option);
|
|
223
|
+
}
|
|
224
|
+
}, option) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
|
|
225
|
+
status: option,
|
|
226
|
+
label: (0, _helpers.titleCase)(option),
|
|
227
|
+
variant: "outlined"
|
|
228
|
+
}, option);
|
|
229
|
+
};
|
|
230
|
+
const ChosenIcon = ({ option, isDisplay })=>{
|
|
231
|
+
if (isDisplay && isChecked(option)) {
|
|
232
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
|
|
233
|
+
width: 16,
|
|
234
|
+
height: 16,
|
|
235
|
+
icon: 'filters/chosen_icon.svg'
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
return null;
|
|
239
|
+
};
|
|
240
|
+
const OneOption = ({ option, modal })=>{
|
|
241
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
242
|
+
sx: {
|
|
243
|
+
display: 'flex',
|
|
244
|
+
justifyContent: 'space-between',
|
|
245
|
+
width: '100%',
|
|
246
|
+
gap: 1,
|
|
247
|
+
color: 'grey',
|
|
248
|
+
cursor: 'pointer'
|
|
249
|
+
},
|
|
250
|
+
children: [
|
|
251
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
252
|
+
sx: {
|
|
253
|
+
width: '100%',
|
|
254
|
+
display: 'flex',
|
|
255
|
+
justifyContent: 'flex-start',
|
|
256
|
+
gap: 1
|
|
257
|
+
},
|
|
258
|
+
children: [
|
|
259
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
260
|
+
variant: "subtitle2",
|
|
261
|
+
color: theme.palette.typography.title,
|
|
262
|
+
children: (0, _helpers.titleCase)(option)
|
|
263
|
+
}),
|
|
264
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(DeleteButton, {
|
|
265
|
+
option: option,
|
|
266
|
+
isDisplay: modal == 'displayed'
|
|
267
|
+
})
|
|
268
|
+
]
|
|
269
|
+
}),
|
|
270
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(ChosenIcon, {
|
|
271
|
+
option: option,
|
|
272
|
+
isDisplay: modal == 'list'
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
}, option);
|
|
276
|
+
};
|
|
277
|
+
const getSingleOptionFromListOrDisplayed = (option, modal)=>{
|
|
278
|
+
if (option) {
|
|
279
|
+
let rv = null;
|
|
280
|
+
switch(modal_type){
|
|
281
|
+
case 'chip':
|
|
282
|
+
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(Chip, {
|
|
283
|
+
option: option,
|
|
284
|
+
modal: modal
|
|
285
|
+
});
|
|
286
|
+
break;
|
|
287
|
+
case 'text':
|
|
288
|
+
default:
|
|
289
|
+
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(OneOption, {
|
|
290
|
+
option: option,
|
|
291
|
+
modal: modal
|
|
292
|
+
});
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
return rv;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
const getMultipleDisplayedValues = ()=>{
|
|
299
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
300
|
+
direction: 'row',
|
|
301
|
+
sx: {
|
|
302
|
+
maxWidth: 214,
|
|
303
|
+
minWidth: 214,
|
|
304
|
+
display: 'flex',
|
|
305
|
+
justifyContent: 'space-between'
|
|
306
|
+
},
|
|
307
|
+
children: [
|
|
308
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
309
|
+
direction: 'row',
|
|
310
|
+
sx: {
|
|
311
|
+
overflow: 'hidden',
|
|
312
|
+
flexWrap: 'wrap',
|
|
313
|
+
gap: 1
|
|
314
|
+
},
|
|
315
|
+
children: displayed.map((item)=>{
|
|
316
|
+
return getSingleOptionFromListOrDisplayed(item, 'displayed');
|
|
317
|
+
})
|
|
318
|
+
}),
|
|
319
|
+
(displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
320
|
+
sx: {
|
|
321
|
+
minWidth: '20px',
|
|
322
|
+
maxWidth: '20px',
|
|
323
|
+
cursor: 'pointer',
|
|
324
|
+
paddingLeft: '3px'
|
|
325
|
+
},
|
|
326
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
|
|
327
|
+
onClick: ()=>{
|
|
328
|
+
setDisplayed([]);
|
|
329
|
+
onRemoveAll && onRemoveAll();
|
|
330
|
+
sessionStorage.removeItem(`dropdown-${query}-${name}`);
|
|
331
|
+
},
|
|
332
|
+
icon: `filters/remove_all_button.svg`,
|
|
333
|
+
width: 16,
|
|
334
|
+
height: 16
|
|
335
|
+
})
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.Root, {
|
|
341
|
+
style: rootStylesOverride,
|
|
342
|
+
children: [
|
|
343
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
344
|
+
children: [
|
|
345
|
+
getCurrentValues(),
|
|
346
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.InputWrapper, {
|
|
347
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
|
|
348
|
+
autoFocus: true,
|
|
349
|
+
placeholder: placeholder || 'Select an option...',
|
|
350
|
+
onFocus: ()=>{
|
|
351
|
+
!isInitialOpen && setIsOpen(true);
|
|
352
|
+
},
|
|
353
|
+
onBlur: ()=>{
|
|
354
|
+
setTimeout(()=>{
|
|
355
|
+
!isInitialOpen && setIsOpen(false);
|
|
356
|
+
}, 200);
|
|
357
|
+
}
|
|
358
|
+
})
|
|
359
|
+
})
|
|
360
|
+
]
|
|
361
|
+
}),
|
|
362
|
+
(isInitialOpen || isOpen) && data && (data === null || data === void 0 ? void 0 : data.length) > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.StyledListBox, {
|
|
363
|
+
ref: ref,
|
|
364
|
+
children: displayListOptions()
|
|
365
|
+
})
|
|
366
|
+
]
|
|
367
|
+
});
|
|
368
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
titleCase: function() {
|
|
13
|
+
return titleCase;
|
|
14
|
+
},
|
|
15
|
+
toPascalCase: function() {
|
|
16
|
+
return toPascalCase;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const titleCase = (str = '')=>str && toPascalCase(str.toString(), true);
|
|
20
|
+
const toPascalCase = (string, title = false)=>{
|
|
21
|
+
return string && string.replace(/(_[a-z])?(^[a-z])?(_|\s[a-z])?/g, ($1)=>$1.toUpperCase().replace('_', title ? ' ' : ''));
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FxStrStaticDropdown, type StaticDropdownStylesOptions, type StaticDropdownPropsType } from './FxStrStaticDropdown';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "FxStrStaticDropdown", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _FxStrStaticDropdown.FxStrStaticDropdown;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _FxStrStaticDropdown = require("./FxStrStaticDropdown");
|