sag_components 1.0.639 → 1.0.641
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/stories/components/DropdownMultiNew.js +248 -0
- package/dist/stories/components/DropdownMultiNew.style.js +29 -0
- package/dist/stories/components/DropdownNew.js +82 -0
- package/dist/stories/components/DropdownNew.style.js +13 -0
- package/dist/stories/components/DropdownSingleNew.js +207 -0
- package/dist/stories/components/DropdownSingleNew.style.js +27 -0
- package/dist/stories/components/FilterPanel.js +16 -7
- package/dist/stories/components/TabMenu.js +7 -0
- package/dist/stories/components/TotalCostModal.js +143 -0
- package/package.json +1 -1
- package/dist/stories/CampaignTool/PopupContent.stories.js +0 -284
- package/dist/stories/components/EventInfo.js +0 -92
- package/dist/stories/components/EventInfo.style.js +0 -20
- package/dist/stories/components/FilterButton.js +0 -47
- package/dist/stories/components/FilterButton.style.js +0 -12
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.DropdownMultiNew = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _CloseXIcon = require("./icons/CloseXIcon");
|
|
10
|
+
var _MenuItemUpIcon = require("./icons/MenuItemUpIcon");
|
|
11
|
+
var _MenuItemOpenIcon = require("./icons/MenuItemOpenIcon");
|
|
12
|
+
var _CheckBoxCheckedIcon = require("./icons/CheckBoxCheckedIcon");
|
|
13
|
+
var _CheckBoxNotCheckedIcon = require("./icons/CheckBoxNotCheckedIcon");
|
|
14
|
+
var _DropdownMultiNew = require("./DropdownMultiNew.style");
|
|
15
|
+
/* eslint-disable react/prop-types */
|
|
16
|
+
|
|
17
|
+
const DropdownMultiNew = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
label,
|
|
20
|
+
labelEmptyValue,
|
|
21
|
+
options,
|
|
22
|
+
selectedValue,
|
|
23
|
+
placeHolder,
|
|
24
|
+
onChange,
|
|
25
|
+
required,
|
|
26
|
+
disabled,
|
|
27
|
+
width,
|
|
28
|
+
error,
|
|
29
|
+
errorMessage,
|
|
30
|
+
labelColor,
|
|
31
|
+
checkBoxColor
|
|
32
|
+
} = _ref;
|
|
33
|
+
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
34
|
+
const [showOptions, setShowOptions] = (0, _react.useState)(false);
|
|
35
|
+
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
36
|
+
const [selectedOptions, setSelectedOptions] = (0, _react.useState)([]);
|
|
37
|
+
const [hoverInputContainer, setHoverInputContainer] = (0, _react.useState)(false);
|
|
38
|
+
const [hoverOptionsContainer, setHoverOptionsContainer] = (0, _react.useState)(false);
|
|
39
|
+
const inputRef = (0, _react.useRef)(null);
|
|
40
|
+
const containerRef = (0, _react.useRef)(null);
|
|
41
|
+
const filteredoptions = options === null || options === void 0 ? void 0 : options.filter(option => option.label.toLowerCase().includes(inputValue.toLowerCase()));
|
|
42
|
+
(0, _react.useEffect)(() => {
|
|
43
|
+
if (selectedValue) {
|
|
44
|
+
setSelectedOptions(selectedValue);
|
|
45
|
+
}
|
|
46
|
+
}, [selectedValue]);
|
|
47
|
+
(0, _react.useEffect)(() => {
|
|
48
|
+
if (isFocused && inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
49
|
+
var _inputRef$current;
|
|
50
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
51
|
+
}
|
|
52
|
+
}, [isFocused]);
|
|
53
|
+
(0, _react.useEffect)(() => {
|
|
54
|
+
if (!hoverInputContainer && !hoverOptionsContainer) {
|
|
55
|
+
setIsFocused(false);
|
|
56
|
+
setShowOptions(false);
|
|
57
|
+
}
|
|
58
|
+
}, [hoverInputContainer, hoverOptionsContainer]);
|
|
59
|
+
const handleFocus = () => {
|
|
60
|
+
setIsFocused(true);
|
|
61
|
+
setShowOptions(true);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// const handleBlur = () => {
|
|
65
|
+
// if (isMulti) return;
|
|
66
|
+
// setIsFocused(false);
|
|
67
|
+
// setTimeout(() => setShowOptions(false), 200); // Delay hiding options to allow clicking on them
|
|
68
|
+
// };
|
|
69
|
+
|
|
70
|
+
const toggleOption = option => {
|
|
71
|
+
if (disabled) return;
|
|
72
|
+
const selectedIndex = selectedOptions.findIndex(selectedOption => selectedOption.value === option.value);
|
|
73
|
+
let newDropdownedOptions;
|
|
74
|
+
if (selectedIndex === -1) {
|
|
75
|
+
newDropdownedOptions = [...selectedOptions, option];
|
|
76
|
+
setSelectedOptions([...selectedOptions, option]);
|
|
77
|
+
} else {
|
|
78
|
+
newDropdownedOptions = [...selectedOptions];
|
|
79
|
+
newDropdownedOptions.splice(selectedIndex, 1);
|
|
80
|
+
setSelectedOptions(newDropdownedOptions);
|
|
81
|
+
}
|
|
82
|
+
onChange({
|
|
83
|
+
newValue: newDropdownedOptions
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const handleInputChange = e => {
|
|
87
|
+
setIsFocused(true);
|
|
88
|
+
setInputValue(e.target.value);
|
|
89
|
+
};
|
|
90
|
+
const isDropdowned = option => selectedOptions.some(selectedOption => selectedOption.value === option.value);
|
|
91
|
+
const handleLabelClick = () => {
|
|
92
|
+
if (disabled) return;
|
|
93
|
+
setIsFocused(true);
|
|
94
|
+
setShowOptions(true);
|
|
95
|
+
};
|
|
96
|
+
const handleOpenCloseMenuClick = () => {
|
|
97
|
+
if (disabled) return;
|
|
98
|
+
if (showOptions) {
|
|
99
|
+
setShowOptions(false);
|
|
100
|
+
setIsFocused(false);
|
|
101
|
+
} else {
|
|
102
|
+
setShowOptions(true);
|
|
103
|
+
setIsFocused(true);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const handleClearClick = () => {
|
|
107
|
+
if (disabled) return;
|
|
108
|
+
setSelectedOptions([]);
|
|
109
|
+
setIsFocused(true);
|
|
110
|
+
if (inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
111
|
+
var _inputRef$current2;
|
|
112
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const displaySelectedOptions = () => {
|
|
116
|
+
const content = /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.SelectedOptionsContainer, {
|
|
117
|
+
className: "SelectedOptionsContainer"
|
|
118
|
+
}, selectedOptions.map((option, index) => {
|
|
119
|
+
var _option$label, _option$label2;
|
|
120
|
+
return index < 2 ? /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.SelectedOptionItem, {
|
|
121
|
+
className: "SelectedOptionItem",
|
|
122
|
+
key: option.value,
|
|
123
|
+
onClick: () => {
|
|
124
|
+
toggleOption(option);
|
|
125
|
+
setIsFocused(true);
|
|
126
|
+
if (inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
127
|
+
var _inputRef$current3;
|
|
128
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.focus();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}, option.label && ((_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.length) > 10 ? "".concat((_option$label2 = option.label) === null || _option$label2 === void 0 ? void 0 : _option$label2.substring(0, 10), "... ") : option.label, /*#__PURE__*/_react.default.createElement(_CloseXIcon.CloseXIcon, {
|
|
132
|
+
width: "8px",
|
|
133
|
+
height: "8px",
|
|
134
|
+
fill: "#212121"
|
|
135
|
+
})) : ' ';
|
|
136
|
+
}), selectedOptions.length > 2 ? /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.SelectedOptionItem, {
|
|
137
|
+
className: "SelectedOptionItem"
|
|
138
|
+
}, selectedOptions.length - 2, "+") : '');
|
|
139
|
+
return content;
|
|
140
|
+
};
|
|
141
|
+
return /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.DropdownWrapper, {
|
|
142
|
+
className: "DropdownWrapper",
|
|
143
|
+
width: width,
|
|
144
|
+
onMouseEnter: () => setHoverInputContainer(true),
|
|
145
|
+
onMouseLeave: () => setHoverInputContainer(false)
|
|
146
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.InputContainer, {
|
|
147
|
+
className: "InputContainer",
|
|
148
|
+
labelColor: labelColor,
|
|
149
|
+
disabled: disabled,
|
|
150
|
+
error: error,
|
|
151
|
+
isFocused: isFocused
|
|
152
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.InputSubContainer, {
|
|
153
|
+
className: "InputSubContainer",
|
|
154
|
+
ref: containerRef,
|
|
155
|
+
labelColor: labelColor,
|
|
156
|
+
disabled: disabled,
|
|
157
|
+
error: error,
|
|
158
|
+
onClick: handleLabelClick
|
|
159
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.Label, {
|
|
160
|
+
className: "Label",
|
|
161
|
+
isFocused: isFocused,
|
|
162
|
+
labelColor: labelColor,
|
|
163
|
+
hasValue: (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0 || inputValue,
|
|
164
|
+
disabled: disabled,
|
|
165
|
+
error: error,
|
|
166
|
+
errorMessage: errorMessage,
|
|
167
|
+
onClick: handleLabelClick
|
|
168
|
+
}, (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0 ? label : labelEmptyValue, required && /*#__PURE__*/_react.default.createElement("span", {
|
|
169
|
+
style: {
|
|
170
|
+
color: 'red'
|
|
171
|
+
}
|
|
172
|
+
}, "*")), displaySelectedOptions(), showOptions ? /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.StyledInput, {
|
|
173
|
+
className: "StyledInput",
|
|
174
|
+
ref: inputRef,
|
|
175
|
+
value: inputValue,
|
|
176
|
+
onChange: handleInputChange,
|
|
177
|
+
onFocus: handleFocus,
|
|
178
|
+
onClick: handleLabelClick,
|
|
179
|
+
type: "search",
|
|
180
|
+
disabled: disabled,
|
|
181
|
+
placeholder: placeHolder || 'Type to search...' // {isFocused ? placeHolder || 'Type to search...' : ''}
|
|
182
|
+
,
|
|
183
|
+
error: error,
|
|
184
|
+
isFocused: isFocused
|
|
185
|
+
}) : ' '), selectedOptions.length > 0 && /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.IconContainer, {
|
|
186
|
+
className: "IconContainer",
|
|
187
|
+
onClick: handleClearClick
|
|
188
|
+
}, /*#__PURE__*/_react.default.createElement(_CloseXIcon.CloseXIcon, {
|
|
189
|
+
width: "12px",
|
|
190
|
+
height: "12px",
|
|
191
|
+
fill: "#B1B1B1"
|
|
192
|
+
})), /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.IconContainer, {
|
|
193
|
+
className: "IconContainer",
|
|
194
|
+
onClick: handleOpenCloseMenuClick
|
|
195
|
+
}, showOptions ? /*#__PURE__*/_react.default.createElement(_MenuItemUpIcon.MenuItemUpIcon, {
|
|
196
|
+
width: "12px",
|
|
197
|
+
height: "12px",
|
|
198
|
+
color: "#B1B1B1"
|
|
199
|
+
}) : /*#__PURE__*/_react.default.createElement(_MenuItemOpenIcon.MenuItemOpenIcon, {
|
|
200
|
+
width: "12px",
|
|
201
|
+
height: "12px",
|
|
202
|
+
color: "#B1B1B1"
|
|
203
|
+
}))), error && (errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.length) > 0 && /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.ErrorMessage, null, errorMessage), /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.OptionsContainer, {
|
|
204
|
+
className: "OptionsContainer",
|
|
205
|
+
onMouseEnter: () => setHoverOptionsContainer(true),
|
|
206
|
+
onMouseLeave: () => setHoverOptionsContainer(false),
|
|
207
|
+
showoptions: showOptions,
|
|
208
|
+
disabled: disabled,
|
|
209
|
+
filteredoptions: filteredoptions
|
|
210
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.OptionsSubContainer, {
|
|
211
|
+
className: "OptionsSubContainer",
|
|
212
|
+
showoptions: showOptions,
|
|
213
|
+
disabled: disabled,
|
|
214
|
+
filteredoptions: filteredoptions
|
|
215
|
+
}, filteredoptions.map(option => /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.OptionItem, {
|
|
216
|
+
className: "OptionItem",
|
|
217
|
+
key: option.value,
|
|
218
|
+
onClick: () => toggleOption(option),
|
|
219
|
+
selected: isDropdowned(option)
|
|
220
|
+
}, ' ', /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.IconContainer, {
|
|
221
|
+
className: "IconContainer"
|
|
222
|
+
}, selectedOptions.find(itemSelectedOptions => option.value === itemSelectedOptions.value) ? /*#__PURE__*/_react.default.createElement(_CheckBoxCheckedIcon.CheckBoxCheckedIcon, {
|
|
223
|
+
width: "14px",
|
|
224
|
+
height: "14px",
|
|
225
|
+
color: disabled ? '#888' : checkBoxColor
|
|
226
|
+
}) : /*#__PURE__*/_react.default.createElement(_CheckBoxNotCheckedIcon.CheckBoxNotCheckedIcon, {
|
|
227
|
+
width: "14px",
|
|
228
|
+
height: "14px",
|
|
229
|
+
color: disabled ? '#888' : '#212121'
|
|
230
|
+
})), option.label)))));
|
|
231
|
+
};
|
|
232
|
+
exports.DropdownMultiNew = DropdownMultiNew;
|
|
233
|
+
var _default = exports.default = DropdownMultiNew;
|
|
234
|
+
DropdownMultiNew.defaultProps = {
|
|
235
|
+
placeHolder: 'Type...',
|
|
236
|
+
label: 'Label',
|
|
237
|
+
labelEmptyValue: 'All Labels',
|
|
238
|
+
labelColor: '#066768',
|
|
239
|
+
checkBoxColor: '#229E38',
|
|
240
|
+
required: true,
|
|
241
|
+
width: '300px',
|
|
242
|
+
disabled: false,
|
|
243
|
+
error: false,
|
|
244
|
+
errorMessage: '',
|
|
245
|
+
options: [],
|
|
246
|
+
selectedValue: [],
|
|
247
|
+
onChange: () => {}
|
|
248
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.StyledInput = exports.SelectedOptionsContainer = exports.SelectedOptionItem = exports.OptionsSubContainer = exports.OptionsContainer = exports.OptionItem = exports.Label = exports.InputSubContainer = exports.InputContainer = exports.IconContainer = exports.ErrorMessage = exports.DropdownWrapper = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
11
|
+
/* eslint-disable no-nested-ternary */
|
|
12
|
+
const DropdownWrapper = exports.DropdownWrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: flex;\n flex-direction: column;\n align-content: center;\n justify-content: center;\n align-items: flex-start;\n width: ", "; \n font-family: \"Poppins\", sans-serif;\n font-weight: 400;\n font-size: 14px;\n border-radius: 10px;\n"])), props => props.width || '300px');
|
|
13
|
+
const Label = exports.Label = _styledComponents.default.label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\n font-size: ", ";\n font-weight: 400;\n padding-inline-end: 5px;\n padding-inline-start: 5px;\n margin-right: 10px;\n z-index: 2;\n color: ", ";\n background-color: white;\n position: absolute;\n top: ", ";\n left: ", ";\n font-family: Poppins; \n transform: translateY(-50%);\n transition: top 0.3s ease, font-size 0.3s ease, color 0.3s ease;\n display: flex;\n align-items: center;\n box-sizing: border-box;\n gap: 4px;\n &:focus {\n border-radius: 12px 12px 0 0 ;\n }\n"])), props => props.isFocused || props.hasValue ? '14px' : '14px', props => props.error ? 'red' : props.disabled ? '#888' : props.labelColor, props => props.isFocused || props.hasValue ? '0px' : '27px', props => props.isFocused || props.hasValue ? '23px' : '10px');
|
|
14
|
+
const InputContainer = exports.InputContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\n display: flex; \n flex-direction: row;\n flex-wrap: nowrap; \n justify-content: flex-start;\n align-content: center; \n white-space: pre-wrap;\n align-items: center;\n overflow: hidden;\n padding: 0 5px 0 0;\n gap: 4px;\n width: 100%;\n height: 100%; \n box-sizing: border-box;\n background-color: #fff;\n border: ", " solid ", ";\n font-family: \"Poppins\", sans-serif;\n font-weight: 400;\n font-size: 14px;\n border-radius: 12px;\n outline: none;\n color: ", ";\n \n &:hover {\n border: 2px solid ", ";\n }\n\n &:focus { \n border: 2px solid ", "; \n }\n \n"])), props => props.isFocused ? '2px' : '1px', props => props.disabled ? '#bdbdbd' : props.error ? 'red' : props.labelColor, props => props.disabled ? '#888' : '#212121', props => props.disabled ? '#bdbdbd' : props.error ? 'red' : props.labelColor || '#212121', props => props.disabled ? '#bdbdbd' : props.error ? 'red' : props.labelColor || '#212121');
|
|
15
|
+
const InputSubContainer = exports.InputSubContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\n display: flex; \n flex-direction: column;\n flex-wrap: nowrap; \n align-content: center; \n align-items: flex-start;\n justify-content: center;\n white-space: pre-wrap;\n overflow: hidden;\n padding: 10px 4px 10px 10px;\n width: 100%;\n height: 100%;\n min-height: 53px;\n box-sizing: border-box;\n background-color: #fff; \n border-radius: 12px;\n outline: none;\n color: ", "; \n"])), props => props.disabled ? '#888' : '#212121');
|
|
16
|
+
const StyledInput = exports.StyledInput = _styledComponents.default.input(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n width: calc(100% - 20px);\n height: 25px;\n font-family: Poppins;\n font-weight: 400;\n font-size: 14px;\n outline: none; \n color: ", "; \n border: none; \n"])), props => props.disabled ? '#888' : '#212121');
|
|
17
|
+
const OptionsContainer = exports.OptionsContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)([" \n margin: 0; \n top: 100%; \n left: 0;\n z-index: 10;\n width: 100%;\n height: 8px;\n background-color: #fff; \n display: ", "; \n"])), props => {
|
|
18
|
+
var _props$filteredoption;
|
|
19
|
+
return props.showoptions && ((_props$filteredoption = props.filteredoptions) === null || _props$filteredoption === void 0 ? void 0 : _props$filteredoption.length) > 0 ? 'block' : 'none';
|
|
20
|
+
});
|
|
21
|
+
const OptionsSubContainer = exports.OptionsSubContainer = _styledComponents.default.ul(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n font-weight: 400;\n margin: 0;\n padding: 8px 12px;\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 10;\n width: calc(100% - 23px);\n font-family: Poppins; \n border-radius: 4px; \n background-color: #fff; \n display: ", ";\n box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.1);\n"])), props => {
|
|
22
|
+
var _props$filteredoption2;
|
|
23
|
+
return props.showoptions && ((_props$filteredoption2 = props.filteredoptions) === null || _props$filteredoption2 === void 0 ? void 0 : _props$filteredoption2.length) > 0 ? 'block' : 'none';
|
|
24
|
+
});
|
|
25
|
+
const OptionItem = exports.OptionItem = _styledComponents.default.li(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)([" \n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n gap: 8px;\n padding: 10px;\n cursor: pointer;\n color: #212121;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n transition: background-color 0.3s;\n\n &:hover {\n background-color: #EDF6FF;\n }\n"])));
|
|
26
|
+
const ErrorMessage = exports.ErrorMessage = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 12px;\n color: red;\n margin-top: 5px;\n"])));
|
|
27
|
+
const SelectedOptionsContainer = exports.SelectedOptionsContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex; \n flex-direction: row;\n flex-wrap: nowrap; \n justify-content: flex-start;\n align-content: center; \n align-items: center;\n white-space: pre-wrap;\n overflow: hidden;\n padding: 0;\n font-weight: 400;\n border-top: none;\n border-radius: 4px; \n background-color: #fff; \n gap: 4px; \n"])));
|
|
28
|
+
const SelectedOptionItem = exports.SelectedOptionItem = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)([" \n display: flex; \n margin: 0;\n flex-wrap: nowrap; \n white-space: pre-wrap;\n overflow: hidden;\n cursor: pointer;\n color: #212121;\n background-color: #E3E4E5;\n border-radius: 4px; \n align-items: center;\n padding: 4px 6px;\n font-size: 12px;\n"])));
|
|
29
|
+
const IconContainer = exports.IconContainer = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)([" \n display: flex; \n padding: 2px;\n cursor: pointer; \n"])));
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.DropdownNew = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _DropdownSingleNew = require("./DropdownSingleNew");
|
|
10
|
+
var _DropdownMultiNew = require("./DropdownMultiNew");
|
|
11
|
+
var _DropdownNew = require("./DropdownNew.style");
|
|
12
|
+
/* eslint-disable react/prop-types */
|
|
13
|
+
|
|
14
|
+
const DropdownNew = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
isMulti,
|
|
17
|
+
label,
|
|
18
|
+
labelEmptyValue,
|
|
19
|
+
options,
|
|
20
|
+
selectedValue,
|
|
21
|
+
placeHolder,
|
|
22
|
+
onChange,
|
|
23
|
+
required,
|
|
24
|
+
disabled,
|
|
25
|
+
width,
|
|
26
|
+
error,
|
|
27
|
+
errorMessage,
|
|
28
|
+
labelColor,
|
|
29
|
+
checkBoxColor
|
|
30
|
+
} = _ref;
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_DropdownNew.DropdownMain, {
|
|
32
|
+
className: "DropdownMain",
|
|
33
|
+
width: width
|
|
34
|
+
}, isMulti ? /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.DropdownMultiNew, {
|
|
35
|
+
className: "DropdownMultiNew",
|
|
36
|
+
placeHolder: placeHolder,
|
|
37
|
+
label: label,
|
|
38
|
+
labelEmptyValue: labelEmptyValue,
|
|
39
|
+
labelColor: labelColor,
|
|
40
|
+
checkBoxColor: checkBoxColor,
|
|
41
|
+
required: required,
|
|
42
|
+
options: options,
|
|
43
|
+
width: width,
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
error: error,
|
|
46
|
+
errorMessage: errorMessage,
|
|
47
|
+
selectedValue: selectedValue,
|
|
48
|
+
onChange: onChange
|
|
49
|
+
}) : /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.DropdownSingleNew, {
|
|
50
|
+
className: "DropdownSingleNew",
|
|
51
|
+
placeHolder: placeHolder,
|
|
52
|
+
label: label,
|
|
53
|
+
labelEmptyValue: labelEmptyValue,
|
|
54
|
+
labelColor: labelColor,
|
|
55
|
+
checkBoxColor: checkBoxColor,
|
|
56
|
+
required: required,
|
|
57
|
+
options: options,
|
|
58
|
+
width: width,
|
|
59
|
+
disabled: disabled,
|
|
60
|
+
error: error,
|
|
61
|
+
errorMessage: errorMessage,
|
|
62
|
+
selectedValue: selectedValue,
|
|
63
|
+
onChange: onChange
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
66
|
+
exports.DropdownNew = DropdownNew;
|
|
67
|
+
var _default = exports.default = DropdownNew;
|
|
68
|
+
DropdownNew.defaultProps = {
|
|
69
|
+
placeHolder: 'Type...',
|
|
70
|
+
label: 'Label',
|
|
71
|
+
labelEmptyValue: 'All Labels',
|
|
72
|
+
labelColor: '#066768',
|
|
73
|
+
checkBoxColor: '#229E38',
|
|
74
|
+
required: true,
|
|
75
|
+
width: '300px',
|
|
76
|
+
disabled: false,
|
|
77
|
+
error: false,
|
|
78
|
+
errorMessage: '',
|
|
79
|
+
options: [],
|
|
80
|
+
selectedValue: [],
|
|
81
|
+
onChange: () => {}
|
|
82
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DropdownMain = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _templateObject;
|
|
11
|
+
/* eslint-disable no-nested-ternary */
|
|
12
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
13
|
+
const DropdownMain = exports.DropdownMain = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: flex;\n flex-direction: column;\n align-content: center;\n justify-content: center;\n align-items: flex-start;\n width: ", "; \n font-family: \"Poppins\", sans-serif;\n font-weight: 400;\n font-size: 14px;\n border-radius: 10px;\n"])), props => props.width || '300px');
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.DropdownSingleNew = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _CloseXIcon = require("./icons/CloseXIcon");
|
|
10
|
+
var _MenuItemUpIcon = require("./icons/MenuItemUpIcon");
|
|
11
|
+
var _MenuItemOpenIcon = require("./icons/MenuItemOpenIcon");
|
|
12
|
+
var _DropdownSingleNew = require("./DropdownSingleNew.style");
|
|
13
|
+
/* eslint-disable react/prop-types */
|
|
14
|
+
|
|
15
|
+
const DropdownSingleNew = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
label,
|
|
18
|
+
labelEmptyValue,
|
|
19
|
+
options,
|
|
20
|
+
selectedValue,
|
|
21
|
+
placeHolder,
|
|
22
|
+
onChange,
|
|
23
|
+
required,
|
|
24
|
+
disabled,
|
|
25
|
+
width,
|
|
26
|
+
error,
|
|
27
|
+
errorMessage,
|
|
28
|
+
labelColor
|
|
29
|
+
} = _ref;
|
|
30
|
+
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
31
|
+
const [showOptions, setShowOptions] = (0, _react.useState)(false);
|
|
32
|
+
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
33
|
+
const [selectedOptions, setSelectedOptions] = (0, _react.useState)([]);
|
|
34
|
+
const [hoverInputContainer, setHoverInputContainer] = (0, _react.useState)(false);
|
|
35
|
+
const [hoverOptionsContainer, setHoverOptionsContainer] = (0, _react.useState)(false);
|
|
36
|
+
const inputRef = (0, _react.useRef)(null);
|
|
37
|
+
const containerRef = (0, _react.useRef)(null);
|
|
38
|
+
const filteredoptions = options === null || options === void 0 ? void 0 : options.filter(option => option.label.toLowerCase().includes(inputValue.toLowerCase()));
|
|
39
|
+
(0, _react.useEffect)(() => {
|
|
40
|
+
if (selectedValue) {
|
|
41
|
+
setSelectedOptions(selectedValue);
|
|
42
|
+
}
|
|
43
|
+
}, [selectedValue]);
|
|
44
|
+
(0, _react.useEffect)(() => {
|
|
45
|
+
if (isFocused && inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
46
|
+
var _inputRef$current;
|
|
47
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
48
|
+
}
|
|
49
|
+
}, [isFocused]);
|
|
50
|
+
(0, _react.useEffect)(() => {
|
|
51
|
+
if (!hoverInputContainer && !hoverOptionsContainer) {
|
|
52
|
+
setIsFocused(false);
|
|
53
|
+
setShowOptions(false);
|
|
54
|
+
}
|
|
55
|
+
}, [hoverInputContainer, hoverOptionsContainer]);
|
|
56
|
+
const toggleOption = option => {
|
|
57
|
+
if (disabled) return;
|
|
58
|
+
const newDropdownedOptions = [option];
|
|
59
|
+
setSelectedOptions(newDropdownedOptions);
|
|
60
|
+
setShowOptions(false);
|
|
61
|
+
setInputValue('');
|
|
62
|
+
setIsFocused(false);
|
|
63
|
+
onChange({
|
|
64
|
+
newValue: newDropdownedOptions
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const handleInputChange = e => {
|
|
68
|
+
setIsFocused(true);
|
|
69
|
+
setInputValue(e.target.value);
|
|
70
|
+
if (inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
71
|
+
var _inputRef$current2;
|
|
72
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const isDropdowned = option => selectedOptions.some(selectedOption => selectedOption.value === option.value);
|
|
76
|
+
const handleLabelClick = () => {
|
|
77
|
+
if (disabled) return;
|
|
78
|
+
setIsFocused(true);
|
|
79
|
+
setShowOptions(true);
|
|
80
|
+
if (inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
81
|
+
var _inputRef$current3;
|
|
82
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.focus();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const handleOpenCloseMenuClick = () => {
|
|
86
|
+
if (disabled) return;
|
|
87
|
+
if (showOptions) {
|
|
88
|
+
setShowOptions(false);
|
|
89
|
+
setIsFocused(false);
|
|
90
|
+
} else {
|
|
91
|
+
setShowOptions(true);
|
|
92
|
+
setIsFocused(true);
|
|
93
|
+
if (inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
94
|
+
var _inputRef$current4;
|
|
95
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.focus();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const handleClearClick = () => {
|
|
100
|
+
if (disabled) return;
|
|
101
|
+
setSelectedOptions([]);
|
|
102
|
+
setShowOptions(true);
|
|
103
|
+
setIsFocused(true);
|
|
104
|
+
if (inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
105
|
+
var _inputRef$current5;
|
|
106
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.focus();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
return /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.DropdownWrapper, {
|
|
110
|
+
className: "DropdownWrapper",
|
|
111
|
+
width: width,
|
|
112
|
+
onMouseEnter: () => setHoverInputContainer(true),
|
|
113
|
+
onMouseLeave: () => setHoverInputContainer(false)
|
|
114
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.InputContainer, {
|
|
115
|
+
className: "InputContainer",
|
|
116
|
+
labelColor: labelColor,
|
|
117
|
+
disabled: disabled,
|
|
118
|
+
error: error,
|
|
119
|
+
isFocused: isFocused
|
|
120
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.InputSubContainer, {
|
|
121
|
+
className: "InputSubContainer",
|
|
122
|
+
ref: containerRef,
|
|
123
|
+
labelColor: labelColor,
|
|
124
|
+
disabled: disabled,
|
|
125
|
+
error: error,
|
|
126
|
+
onClick: handleLabelClick
|
|
127
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.Label, {
|
|
128
|
+
className: "Label",
|
|
129
|
+
isFocused: isFocused,
|
|
130
|
+
labelColor: labelColor,
|
|
131
|
+
hasValue: (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0 || inputValue,
|
|
132
|
+
disabled: disabled,
|
|
133
|
+
error: error,
|
|
134
|
+
errorMessage: errorMessage,
|
|
135
|
+
onClick: handleLabelClick
|
|
136
|
+
}, (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0 ? label : labelEmptyValue, required && /*#__PURE__*/_react.default.createElement("span", {
|
|
137
|
+
style: {
|
|
138
|
+
color: 'red'
|
|
139
|
+
}
|
|
140
|
+
}, "*")), /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.StyledInput, {
|
|
141
|
+
className: "StyledInput",
|
|
142
|
+
ref: inputRef
|
|
143
|
+
// eslint-disable-next-line no-nested-ternary
|
|
144
|
+
,
|
|
145
|
+
value: selectedOptions && (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0 ? selectedOptions[0].label : inputValue && (inputValue === null || inputValue === void 0 ? void 0 : inputValue.length) > 0 ? inputValue[0].label : '',
|
|
146
|
+
onChange: handleInputChange,
|
|
147
|
+
onClick: handleLabelClick
|
|
148
|
+
// type="search"
|
|
149
|
+
,
|
|
150
|
+
disabled: disabled,
|
|
151
|
+
placeholder: placeHolder || 'Type to search...' // {isFocused ? placeHolder || 'Type to search...' : ''}
|
|
152
|
+
,
|
|
153
|
+
error: error,
|
|
154
|
+
isFocused: isFocused
|
|
155
|
+
})), selectedOptions.length > 0 && /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.IconContainer, {
|
|
156
|
+
className: "IconContainer",
|
|
157
|
+
onClick: handleClearClick
|
|
158
|
+
}, /*#__PURE__*/_react.default.createElement(_CloseXIcon.CloseXIcon, {
|
|
159
|
+
width: "12px",
|
|
160
|
+
height: "12px",
|
|
161
|
+
fill: "#B1B1B1"
|
|
162
|
+
})), /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.IconContainer, {
|
|
163
|
+
className: "IconContainer",
|
|
164
|
+
onClick: handleOpenCloseMenuClick
|
|
165
|
+
}, showOptions ? /*#__PURE__*/_react.default.createElement(_MenuItemUpIcon.MenuItemUpIcon, {
|
|
166
|
+
width: "12px",
|
|
167
|
+
height: "12px",
|
|
168
|
+
color: "#B1B1B1"
|
|
169
|
+
}) : /*#__PURE__*/_react.default.createElement(_MenuItemOpenIcon.MenuItemOpenIcon, {
|
|
170
|
+
width: "12px",
|
|
171
|
+
height: "12px",
|
|
172
|
+
color: "#B1B1B1"
|
|
173
|
+
}))), error && (errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.length) > 0 && /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.ErrorMessage, null, errorMessage), /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.OptionsContainer, {
|
|
174
|
+
className: "OptionsContainer",
|
|
175
|
+
onMouseEnter: () => setHoverOptionsContainer(true),
|
|
176
|
+
onMouseLeave: () => setHoverOptionsContainer(false),
|
|
177
|
+
showoptions: showOptions,
|
|
178
|
+
disabled: disabled,
|
|
179
|
+
filteredoptions: filteredoptions
|
|
180
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.OptionsSubContainer, {
|
|
181
|
+
className: "OptionsSubContainer",
|
|
182
|
+
showoptions: showOptions,
|
|
183
|
+
disabled: disabled,
|
|
184
|
+
filteredoptions: filteredoptions
|
|
185
|
+
}, filteredoptions.map(option => /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.OptionItem, {
|
|
186
|
+
className: "OptionItem",
|
|
187
|
+
key: option.value,
|
|
188
|
+
onClick: () => toggleOption(option),
|
|
189
|
+
selected: isDropdowned(option)
|
|
190
|
+
}, option.label)))));
|
|
191
|
+
};
|
|
192
|
+
exports.DropdownSingleNew = DropdownSingleNew;
|
|
193
|
+
var _default = exports.default = DropdownSingleNew;
|
|
194
|
+
DropdownSingleNew.defaultProps = {
|
|
195
|
+
placeHolder: 'Type...',
|
|
196
|
+
label: 'Label',
|
|
197
|
+
labelEmptyValue: 'All Labels',
|
|
198
|
+
labelColor: '#066768',
|
|
199
|
+
required: true,
|
|
200
|
+
width: '300px',
|
|
201
|
+
disabled: false,
|
|
202
|
+
error: false,
|
|
203
|
+
errorMessage: '',
|
|
204
|
+
options: [],
|
|
205
|
+
selectedValue: [],
|
|
206
|
+
onChange: () => {}
|
|
207
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.StyledInput = exports.OptionsSubContainer = exports.OptionsContainer = exports.OptionItem = exports.Label = exports.InputSubContainer = exports.InputContainer = exports.IconContainer = exports.ErrorMessage = exports.DropdownWrapper = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
11
|
+
/* eslint-disable no-nested-ternary */
|
|
12
|
+
const DropdownWrapper = exports.DropdownWrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: flex;\n flex-direction: column;\n align-content: center;\n justify-content: center;\n align-items: flex-start;\n width: ", "; \n font-family: \"Poppins\", sans-serif;\n font-weight: 400;\n font-size: 14px;\n border-radius: 10px;\n"])), props => props.width || '300px');
|
|
13
|
+
const Label = exports.Label = _styledComponents.default.label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\n font-size: ", ";\n font-weight: 400;\n padding-inline-end: 5px;\n padding-inline-start: 5px;\n margin-right: 10px; \n z-index: 2;\n color: ", ";\n background-color: white;\n position: absolute;\n top: ", ";\n left: ", ";\n font-family: Poppins; \n transform: translateY(-50%);\n transition: top 0.3s ease, font-size 0.3s ease, color 0.3s ease;\n display: flex;\n align-items: center;\n box-sizing: border-box;\n gap: 4px;\n &:focus {\n border-radius: 12px 12px 0 0 ;\n }\n"])), props => props.isFocused || props.hasValue ? '14px' : '14px', props => props.error ? 'red' : props.disabled ? '#888' : props.labelColor, props => props.isFocused || props.hasValue ? '0px' : '28px', props => props.isFocused || props.hasValue ? '23px' : '10px');
|
|
14
|
+
const InputContainer = exports.InputContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\n display: flex; \n flex-direction: row;\n flex-wrap: nowrap; \n justify-content: flex-start;\n align-content: center; \n white-space: pre-wrap;\n align-items: center;\n overflow: hidden;\n padding: 0 5px 0 0;\n gap: 4px;\n width: 100%;\n height: 100%; \n box-sizing: border-box;\n background-color: #fff;\n border: ", " solid ", ";\n font-family: \"Poppins\", sans-serif;\n font-weight: 400;\n font-size: 14px;\n border-radius: 12px;\n outline: none;\n color: ", ";\n \n &:hover {\n border: 2px solid ", ";\n }\n\n &:focus { \n border: 2px solid ", "; \n }\n \n"])), props => props.isFocused ? '2px' : '1px', props => props.disabled ? '#bdbdbd' : props.error ? 'red' : props.labelColor, props => props.disabled ? '#888' : '#212121', props => props.disabled ? '#bdbdbd' : props.error ? 'red' : props.labelColor || '#212121', props => props.disabled ? '#bdbdbd' : props.error ? 'red' : props.labelColor || '#212121');
|
|
15
|
+
const InputSubContainer = exports.InputSubContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\n display: flex; \n flex-direction: column;\n flex-wrap: nowrap; \n align-content: center; \n align-items: flex-start;\n justify-content: center;\n white-space: pre-wrap;\n overflow: hidden;\n padding: 10px 4px 10px 10px;\n width: 100%;\n height: 100%;\n min-height: 53px;\n box-sizing: border-box;\n background-color: #fff; \n border-radius: 12px;\n outline: none;\n color: ", "; \n"])), props => props.disabled ? '#888' : '#212121');
|
|
16
|
+
const StyledInput = exports.StyledInput = _styledComponents.default.input(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n width: calc(100% - 10px);\n height: 20px;\n font-family: Poppins;\n font-weight: 400;\n font-size: 14px;\n outline: none; \n color: ", "; \n border: none;\n"])), props => props.disabled ? '#888' : '#212121');
|
|
17
|
+
const OptionsContainer = exports.OptionsContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)([" \n margin: 0; \n top: 100%; \n left: 0;\n z-index: 10;\n width: 100%;\n height: 8px;\n background-color: #fff; \n display: ", "; \n"])), props => {
|
|
18
|
+
var _props$filteredoption;
|
|
19
|
+
return props.showoptions && ((_props$filteredoption = props.filteredoptions) === null || _props$filteredoption === void 0 ? void 0 : _props$filteredoption.length) > 0 ? 'block' : 'none';
|
|
20
|
+
});
|
|
21
|
+
const OptionsSubContainer = exports.OptionsSubContainer = _styledComponents.default.ul(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n font-weight: 400;\n margin: 0;\n padding: 8px 12px;\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 10;\n width: calc(100% - 23px);\n font-family: Poppins; \n border-radius: 4px; \n background-color: #fff; \n display: ", ";\n box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.1);\n"])), props => {
|
|
22
|
+
var _props$filteredoption2;
|
|
23
|
+
return props.showoptions && ((_props$filteredoption2 = props.filteredoptions) === null || _props$filteredoption2 === void 0 ? void 0 : _props$filteredoption2.length) > 0 ? 'block' : 'none';
|
|
24
|
+
});
|
|
25
|
+
const OptionItem = exports.OptionItem = _styledComponents.default.li(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)([" \n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n gap: 8px;\n padding: 10px;\n cursor: pointer;\n color: #212121;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n transition: background-color 0.3s;\n background-color: ", ";\n\n &:hover {\n background-color: #EDF6FF;\n }\n"])), props => props.selected ? '#C7E4FF' : '#fff');
|
|
26
|
+
const ErrorMessage = exports.ErrorMessage = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 12px;\n color: red;\n margin-top: 5px;\n"])));
|
|
27
|
+
const IconContainer = exports.IconContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)([" \n display: flex; \n padding: 2px;\n cursor: pointer; \n"])));
|
|
@@ -395,20 +395,29 @@ const FilterPanel = props => {
|
|
|
395
395
|
placeHolder: item.placeHolder,
|
|
396
396
|
placeHolderFontSize: "14px",
|
|
397
397
|
onChange: eventDropdownPeriodPicker => {
|
|
398
|
-
var _eventDropdownPeriodP, _eventDropdownPeriodP2;
|
|
398
|
+
var _eventDropdownPeriodP, _eventDropdownPeriodP2, _item$defaultValueYea4, _item$defaultValueYea5, _item$defaultValueYea6;
|
|
399
399
|
const newPeriodPickerSelectedValue = eventDropdownPeriodPicker !== null && eventDropdownPeriodPicker !== void 0 && (_eventDropdownPeriodP = eventDropdownPeriodPicker.newValue) !== null && _eventDropdownPeriodP !== void 0 && _eventDropdownPeriodP.value ? "".concat(eventDropdownPeriodPicker === null || eventDropdownPeriodPicker === void 0 ? void 0 : (_eventDropdownPeriodP2 = eventDropdownPeriodPicker.newValue) === null || _eventDropdownPeriodP2 === void 0 ? void 0 : _eventDropdownPeriodP2.value) : undefined;
|
|
400
|
-
const newFieldsDataState = FieldsDataState === null || FieldsDataState === void 0 ? void 0 : FieldsDataState.map(itemField =>
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
400
|
+
const newFieldsDataState = FieldsDataState === null || FieldsDataState === void 0 ? void 0 : FieldsDataState.map(itemField => {
|
|
401
|
+
var _item$defaultValueYea, _item$defaultValueYea2, _item$defaultValueYea3;
|
|
402
|
+
return itemField.name === item.name ? {
|
|
403
|
+
...itemField,
|
|
404
|
+
periodPickerSelectedValue: newPeriodPickerSelectedValue ? "".concat(newPeriodPickerSelectedValue) : undefined,
|
|
405
|
+
...(newPeriodPickerSelectedValue === 'year' && item !== null && item !== void 0 && (_item$defaultValueYea = item.defaultValueYears) !== null && _item$defaultValueYea !== void 0 && _item$defaultValueYea.value ? {
|
|
406
|
+
inputSubType: 'year'
|
|
407
|
+
} : ''),
|
|
408
|
+
selectedValue: newPeriodPickerSelectedValue === 'year' && item !== null && item !== void 0 && (_item$defaultValueYea2 = item.defaultValueYears) !== null && _item$defaultValueYea2 !== void 0 && _item$defaultValueYea2.value ? item === null || item === void 0 ? void 0 : (_item$defaultValueYea3 = item.defaultValueYears) === null || _item$defaultValueYea3 === void 0 ? void 0 : _item$defaultValueYea3.value : undefined
|
|
409
|
+
} : itemField;
|
|
410
|
+
});
|
|
405
411
|
setFieldsDataState(newFieldsDataState);
|
|
406
412
|
onItemValueChanged({
|
|
407
413
|
fieldsData: newFieldsDataState,
|
|
408
414
|
changedItem: {
|
|
409
415
|
name: item.name,
|
|
410
416
|
inputType: item.inputType,
|
|
411
|
-
|
|
417
|
+
...(newPeriodPickerSelectedValue === 'year' && item !== null && item !== void 0 && (_item$defaultValueYea4 = item.defaultValueYears) !== null && _item$defaultValueYea4 !== void 0 && _item$defaultValueYea4.value ? {
|
|
418
|
+
inputSubType: 'year'
|
|
419
|
+
} : ''),
|
|
420
|
+
selectedValue: newPeriodPickerSelectedValue === 'year' && item !== null && item !== void 0 && (_item$defaultValueYea5 = item.defaultValueYears) !== null && _item$defaultValueYea5 !== void 0 && _item$defaultValueYea5.value ? item === null || item === void 0 ? void 0 : (_item$defaultValueYea6 = item.defaultValueYears) === null || _item$defaultValueYea6 === void 0 ? void 0 : _item$defaultValueYea6.value : undefined
|
|
412
421
|
}
|
|
413
422
|
});
|
|
414
423
|
},
|
|
@@ -23,6 +23,7 @@ const TabMenu = props => {
|
|
|
23
23
|
onTabChange,
|
|
24
24
|
panelIsOpen,
|
|
25
25
|
activeColor,
|
|
26
|
+
currentTab,
|
|
26
27
|
onFilterButtonClick,
|
|
27
28
|
onSearchFieldTyping
|
|
28
29
|
} = props;
|
|
@@ -31,6 +32,11 @@ const TabMenu = props => {
|
|
|
31
32
|
onTabChange(index);
|
|
32
33
|
setActiveTab(index);
|
|
33
34
|
};
|
|
35
|
+
(0, _react.useEffect)(() => {
|
|
36
|
+
if (currentTab !== activeTab) {
|
|
37
|
+
setActiveTab(currentTab);
|
|
38
|
+
}
|
|
39
|
+
}, [currentTab]);
|
|
34
40
|
return /*#__PURE__*/_react.default.createElement(_TabMenu.TabMenuContainer, {
|
|
35
41
|
className: "TabMenuContainer"
|
|
36
42
|
}, /*#__PURE__*/_react.default.createElement(_TabMenu.Nav, {
|
|
@@ -88,6 +94,7 @@ TabMenu.defaultProps = {
|
|
|
88
94
|
showViewOptionsButton: true,
|
|
89
95
|
showSearchInput: true,
|
|
90
96
|
inputWidth: '100%',
|
|
97
|
+
currentTab: 0,
|
|
91
98
|
tabs: [
|
|
92
99
|
// { title: 'Tab 1', content: <ReportTable /> },
|
|
93
100
|
{
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
12
|
+
var _CodeEditor = _interopRequireDefault(require("./CodeEditor"));
|
|
13
|
+
var _TextField = _interopRequireDefault(require("./TextField"));
|
|
14
|
+
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
15
|
+
var _reactHookForm = require("react-hook-form");
|
|
16
|
+
var _Modal2 = require("./Modal.style");
|
|
17
|
+
var TotalCostModal = function TotalCostModal(_ref) {
|
|
18
|
+
var title = _ref.title,
|
|
19
|
+
isModalOpen = _ref.isModalOpen,
|
|
20
|
+
setModalOpen = _ref.setModalOpen,
|
|
21
|
+
setResult = _ref.setResult;
|
|
22
|
+
var _useState = (0, _react.useState)([{
|
|
23
|
+
id: "title",
|
|
24
|
+
label: "Title",
|
|
25
|
+
type: "text"
|
|
26
|
+
}, {
|
|
27
|
+
id: "dotCut",
|
|
28
|
+
label: "Do Cut",
|
|
29
|
+
type: "select",
|
|
30
|
+
options: ["true", "false"]
|
|
31
|
+
}, {
|
|
32
|
+
id: "currency",
|
|
33
|
+
label: "Currency",
|
|
34
|
+
type: "select",
|
|
35
|
+
options: ["true", "false"]
|
|
36
|
+
}, {
|
|
37
|
+
id: "currencyType",
|
|
38
|
+
label: "Currency Type",
|
|
39
|
+
type: "select",
|
|
40
|
+
options: ["USD", "EUR", "ILS", "GBP", "JPY"]
|
|
41
|
+
}, {
|
|
42
|
+
id: "width",
|
|
43
|
+
label: "Width",
|
|
44
|
+
type: "text"
|
|
45
|
+
}, {
|
|
46
|
+
id: "height",
|
|
47
|
+
label: "Height",
|
|
48
|
+
type: "text"
|
|
49
|
+
}, {
|
|
50
|
+
id: "textColor",
|
|
51
|
+
label: "Text Color",
|
|
52
|
+
type: "text"
|
|
53
|
+
}, {
|
|
54
|
+
id: "noDataText",
|
|
55
|
+
label: "No Data Text",
|
|
56
|
+
type: "text"
|
|
57
|
+
}]),
|
|
58
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
59
|
+
params = _useState2[0],
|
|
60
|
+
setParams = _useState2[1];
|
|
61
|
+
var _useState3 = (0, _react.useState)("Select PACKAGE_COST,REDEMPTION_COST,(PACKAGE_COST+REDEMPTION_COST) AS TOTAL_COST,from FACT_EVENT_MEASURES A INNER JOIN DIM_EVENTS B ON A.EVENT_CODE = B.EVENT_CODE"),
|
|
62
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
63
|
+
code = _useState4[0],
|
|
64
|
+
setCode = _useState4[1];
|
|
65
|
+
var _useForm = (0, _reactHookForm.useForm)(),
|
|
66
|
+
register = _useForm.register,
|
|
67
|
+
handleSubmit = _useForm.handleSubmit,
|
|
68
|
+
watch = _useForm.watch,
|
|
69
|
+
control = _useForm.control,
|
|
70
|
+
errors = _useForm.formState.errors;
|
|
71
|
+
var onSubmit = function onSubmit(data) {
|
|
72
|
+
return setResult(data);
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement("form", {
|
|
75
|
+
onSubmit: handleSubmit(onSubmit)
|
|
76
|
+
}, /*#__PURE__*/_react.default.createElement(_Modal.default, {
|
|
77
|
+
isOpen: isModalOpen,
|
|
78
|
+
onClose: function onClose() {
|
|
79
|
+
return setModalOpen(false);
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement("h2", null, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
82
|
+
style: {
|
|
83
|
+
gap: "10px",
|
|
84
|
+
display: "grid"
|
|
85
|
+
}
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement(_CodeEditor.default, {
|
|
87
|
+
value: code,
|
|
88
|
+
onChange: setCode
|
|
89
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
style: {
|
|
91
|
+
gap: "10px",
|
|
92
|
+
display: "grid",
|
|
93
|
+
gridTemplateColumns: "auto auto auto"
|
|
94
|
+
}
|
|
95
|
+
}, params.map(function (item) {
|
|
96
|
+
if (item.type === "text") {
|
|
97
|
+
return /*#__PURE__*/_react.default.createElement(_reactHookForm.Controller, {
|
|
98
|
+
control: control,
|
|
99
|
+
name: item.id,
|
|
100
|
+
render: function render(_ref2) {
|
|
101
|
+
var field = _ref2.field;
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement(_TextField.default, Object.assign({}, field, {
|
|
103
|
+
allowedInput: "all",
|
|
104
|
+
height: "100%",
|
|
105
|
+
label: item.label,
|
|
106
|
+
multiline: true,
|
|
107
|
+
placeHolder: "Type...",
|
|
108
|
+
shape: "round",
|
|
109
|
+
size: "small",
|
|
110
|
+
width: "300px"
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
return /*#__PURE__*/_react.default.createElement(_reactHookForm.Controller, {
|
|
116
|
+
control: control,
|
|
117
|
+
name: item.id,
|
|
118
|
+
render: function render(_ref3) {
|
|
119
|
+
var field = _ref3.field;
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement(_Dropdown.default, Object.assign({}, field, {
|
|
121
|
+
allowedInput: "all",
|
|
122
|
+
labelColor: "#1B30AA",
|
|
123
|
+
limitTagsOnMultiSelect: 0,
|
|
124
|
+
onInputChange: function onInputChange(e) {
|
|
125
|
+
var _e$inputValue;
|
|
126
|
+
console.log("e", e);
|
|
127
|
+
field.onChange((_e$inputValue = e === null || e === void 0 ? void 0 : e.inputValue) !== null && _e$inputValue !== void 0 ? _e$inputValue : "");
|
|
128
|
+
},
|
|
129
|
+
options: item.options,
|
|
130
|
+
placeHolder: "Type...",
|
|
131
|
+
shape: "round",
|
|
132
|
+
size: "small",
|
|
133
|
+
text: item.label,
|
|
134
|
+
width: "300px"
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}))), /*#__PURE__*/_react.default.createElement(_Modal2.SubmitButton, {
|
|
140
|
+
type: "submit"
|
|
141
|
+
})));
|
|
142
|
+
};
|
|
143
|
+
var _default = exports.default = TotalCostModal;
|
package/package.json
CHANGED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.ExamplePopupContent = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _PopupContent = _interopRequireDefault(require("../components/CampaignTool/PopupContent"));
|
|
10
|
-
const FieldsDataRow1 = [{
|
|
11
|
-
name: "FundationSource",
|
|
12
|
-
label: "Fundation Source",
|
|
13
|
-
disabled: false,
|
|
14
|
-
required: false,
|
|
15
|
-
inputType: "dropdown",
|
|
16
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
17
|
-
showInfo: true,
|
|
18
|
-
infoText: "This is one of the Popup content's fields",
|
|
19
|
-
placeHolder: "Select Source",
|
|
20
|
-
dropdownOptions: [{
|
|
21
|
-
value: 1,
|
|
22
|
-
label: "Source 1"
|
|
23
|
-
}, {
|
|
24
|
-
value: 2,
|
|
25
|
-
label: "Source 2"
|
|
26
|
-
}, {
|
|
27
|
-
value: 3,
|
|
28
|
-
label: "Source 3"
|
|
29
|
-
}],
|
|
30
|
-
dropdownDefaultValue: null
|
|
31
|
-
}, {
|
|
32
|
-
name: "Category",
|
|
33
|
-
label: "Category",
|
|
34
|
-
disabled: false,
|
|
35
|
-
required: false,
|
|
36
|
-
inputType: "dropdown",
|
|
37
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
38
|
-
showInfo: true,
|
|
39
|
-
infoText: "This is one of the Popup content's fields",
|
|
40
|
-
placeHolder: "Select Category",
|
|
41
|
-
dropdownOptions: [{
|
|
42
|
-
value: 1,
|
|
43
|
-
label: "Category 1"
|
|
44
|
-
}, {
|
|
45
|
-
value: 2,
|
|
46
|
-
label: "Category 2"
|
|
47
|
-
}, {
|
|
48
|
-
value: 3,
|
|
49
|
-
label: "Category 3"
|
|
50
|
-
}],
|
|
51
|
-
dropdownDefaultValue: null
|
|
52
|
-
}, {
|
|
53
|
-
name: "Supplier",
|
|
54
|
-
label: "Supplier",
|
|
55
|
-
disabled: false,
|
|
56
|
-
required: false,
|
|
57
|
-
inputType: "dropdown",
|
|
58
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
59
|
-
showInfo: true,
|
|
60
|
-
infoText: "This is one of the Popup content's fields",
|
|
61
|
-
placeHolder: "Select Supplier",
|
|
62
|
-
dropdownOptions: [{
|
|
63
|
-
value: 1,
|
|
64
|
-
label: "Supplier 1"
|
|
65
|
-
}, {
|
|
66
|
-
value: 2,
|
|
67
|
-
label: "Supplier 2"
|
|
68
|
-
}, {
|
|
69
|
-
value: 3,
|
|
70
|
-
label: "Supplier 3"
|
|
71
|
-
}],
|
|
72
|
-
dropdownDefaultValue: null
|
|
73
|
-
}, {
|
|
74
|
-
name: "ContactName",
|
|
75
|
-
label: "Contact Name",
|
|
76
|
-
disabled: false,
|
|
77
|
-
required: false,
|
|
78
|
-
inputType: "textbox",
|
|
79
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
80
|
-
showInfo: true,
|
|
81
|
-
infoText: "This is one of the Popup content's fields",
|
|
82
|
-
placeHolder: "Enter Contact Name",
|
|
83
|
-
dropdownOptions: null,
|
|
84
|
-
dropdownDefaultValue: null
|
|
85
|
-
}];
|
|
86
|
-
const FieldsDataRow2 = [{
|
|
87
|
-
name: "BrandName",
|
|
88
|
-
label: "Brand Name",
|
|
89
|
-
disabled: false,
|
|
90
|
-
required: false,
|
|
91
|
-
inputType: "dropdown",
|
|
92
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
93
|
-
showInfo: true,
|
|
94
|
-
infoText: "This is one of the Popup content's fields",
|
|
95
|
-
placeHolder: "Select Brand",
|
|
96
|
-
dropdownOptions: [{
|
|
97
|
-
value: 1,
|
|
98
|
-
label: "Brand 1"
|
|
99
|
-
}, {
|
|
100
|
-
value: 2,
|
|
101
|
-
label: "Brand 2"
|
|
102
|
-
}, {
|
|
103
|
-
value: 3,
|
|
104
|
-
label: "Brand 3"
|
|
105
|
-
}],
|
|
106
|
-
dropdownDefaultValue: null
|
|
107
|
-
}, {
|
|
108
|
-
name: "Budget",
|
|
109
|
-
label: "Budget",
|
|
110
|
-
disabled: false,
|
|
111
|
-
required: false,
|
|
112
|
-
inputType: "dropdown",
|
|
113
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
114
|
-
showInfo: true,
|
|
115
|
-
infoText: "This is one of the Popup content's fields",
|
|
116
|
-
placeHolder: "Select Budget",
|
|
117
|
-
dropdownOptions: [{
|
|
118
|
-
value: 1,
|
|
119
|
-
label: "Budget 1"
|
|
120
|
-
}, {
|
|
121
|
-
value: 2,
|
|
122
|
-
label: "Budget 2"
|
|
123
|
-
}, {
|
|
124
|
-
value: 3,
|
|
125
|
-
label: "Budget 3"
|
|
126
|
-
}],
|
|
127
|
-
dropdownDefaultValue: {
|
|
128
|
-
value: 1,
|
|
129
|
-
label: "Budget 1"
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
name: "CategoryManager",
|
|
133
|
-
label: "Category Manager",
|
|
134
|
-
disabled: false,
|
|
135
|
-
required: false,
|
|
136
|
-
inputType: "dropdown",
|
|
137
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
138
|
-
showInfo: true,
|
|
139
|
-
infoText: "This is one of the Popup content's fields",
|
|
140
|
-
placeHolder: "Select Category Manager",
|
|
141
|
-
dropdownOptions: [{
|
|
142
|
-
value: 1,
|
|
143
|
-
label: "Category Manager 1"
|
|
144
|
-
}, {
|
|
145
|
-
value: 2,
|
|
146
|
-
label: "Category Manager 2"
|
|
147
|
-
}, {
|
|
148
|
-
value: 3,
|
|
149
|
-
label: "Category Manager 3"
|
|
150
|
-
}],
|
|
151
|
-
dropdownDefaultValue: {
|
|
152
|
-
value: 3,
|
|
153
|
-
label: "Category Manager 3"
|
|
154
|
-
}
|
|
155
|
-
}, {
|
|
156
|
-
name: "ContactEmail",
|
|
157
|
-
label: "Contact Email",
|
|
158
|
-
disabled: false,
|
|
159
|
-
required: false,
|
|
160
|
-
inputType: "textbox",
|
|
161
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
162
|
-
showInfo: true,
|
|
163
|
-
infoText: "This is one of the Popup content's fields",
|
|
164
|
-
placeHolder: "Enter Contact Email",
|
|
165
|
-
dropdownOptions: null,
|
|
166
|
-
dropdownDefaultValue: null
|
|
167
|
-
}];
|
|
168
|
-
const FieldsDataRow3 = [{
|
|
169
|
-
name: "Broker",
|
|
170
|
-
label: "Broker",
|
|
171
|
-
disabled: false,
|
|
172
|
-
required: false,
|
|
173
|
-
inputType: "dropdown",
|
|
174
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
175
|
-
showInfo: true,
|
|
176
|
-
infoText: "This is one of the Popup content's fields",
|
|
177
|
-
placeHolder: "Select Broker",
|
|
178
|
-
dropdownOptions: [{
|
|
179
|
-
value: 1,
|
|
180
|
-
label: "Broker 1"
|
|
181
|
-
}, {
|
|
182
|
-
value: 2,
|
|
183
|
-
label: "Broker 2"
|
|
184
|
-
}, {
|
|
185
|
-
value: 3,
|
|
186
|
-
label: "Broker 3"
|
|
187
|
-
}],
|
|
188
|
-
dropdownDefaultValue: null
|
|
189
|
-
}, {
|
|
190
|
-
name: "SupplierOfferID",
|
|
191
|
-
label: "Supplier Offer ID",
|
|
192
|
-
disabled: false,
|
|
193
|
-
required: false,
|
|
194
|
-
inputType: "textbox",
|
|
195
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
196
|
-
showInfo: true,
|
|
197
|
-
infoText: "This is one of the Popup content's fields",
|
|
198
|
-
placeHolder: "Enter Supplier Offer ID",
|
|
199
|
-
dropdownOptions: null,
|
|
200
|
-
dropdownDefaultValue: null
|
|
201
|
-
}, {
|
|
202
|
-
name: "VendorID",
|
|
203
|
-
label: "Vendor ID",
|
|
204
|
-
disabled: false,
|
|
205
|
-
required: false,
|
|
206
|
-
inputType: "textbox",
|
|
207
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
208
|
-
showInfo: true,
|
|
209
|
-
infoText: "This is one of the Popup content's fields",
|
|
210
|
-
placeHolder: "Enter Vendor ID",
|
|
211
|
-
dropdownOptions: null,
|
|
212
|
-
dropdownDefaultValue: null
|
|
213
|
-
}, {
|
|
214
|
-
name: "ContactPhone",
|
|
215
|
-
label: "Contact Phone",
|
|
216
|
-
disabled: false,
|
|
217
|
-
required: true,
|
|
218
|
-
inputType: "textbox",
|
|
219
|
-
//aviliable values: textbox | dropdown | checkBox | datepicker
|
|
220
|
-
showInfo: true,
|
|
221
|
-
infoText: "This is one of the Popup content's fields",
|
|
222
|
-
placeHolder: "Enter Contact Phone",
|
|
223
|
-
dropdownOptions: null,
|
|
224
|
-
dropdownDefaultValue: null
|
|
225
|
-
}];
|
|
226
|
-
const RowsData1 = [{
|
|
227
|
-
fieldsArray: FieldsDataRow1
|
|
228
|
-
}, {
|
|
229
|
-
fieldsArray: FieldsDataRow2
|
|
230
|
-
}, {
|
|
231
|
-
fieldsArray: FieldsDataRow3
|
|
232
|
-
}];
|
|
233
|
-
var _default = exports.default = {
|
|
234
|
-
title: "Campaign Tool/PopupContent",
|
|
235
|
-
component: _PopupContent.default,
|
|
236
|
-
tags: ["autodocs"],
|
|
237
|
-
argTypes: {
|
|
238
|
-
FieldsData: {
|
|
239
|
-
name: "FieldsData",
|
|
240
|
-
control: {
|
|
241
|
-
type: "object"
|
|
242
|
-
},
|
|
243
|
-
description: " object: to fill kpi columns and buttons "
|
|
244
|
-
},
|
|
245
|
-
width: {
|
|
246
|
-
name: "width",
|
|
247
|
-
control: {
|
|
248
|
-
type: "text"
|
|
249
|
-
},
|
|
250
|
-
description: "width of the control (in px / %)"
|
|
251
|
-
},
|
|
252
|
-
height: {
|
|
253
|
-
name: "height",
|
|
254
|
-
control: {
|
|
255
|
-
type: "text"
|
|
256
|
-
},
|
|
257
|
-
description: "height of the control (in px / % )"
|
|
258
|
-
},
|
|
259
|
-
onClick: {
|
|
260
|
-
action: "onClick",
|
|
261
|
-
description: "onClick event - returns an object of check box {true/false} "
|
|
262
|
-
},
|
|
263
|
-
onChange: {
|
|
264
|
-
action: "onChange",
|
|
265
|
-
description: "onChange event "
|
|
266
|
-
},
|
|
267
|
-
borderColor: {
|
|
268
|
-
name: "borderColor",
|
|
269
|
-
description: "Sets the border color",
|
|
270
|
-
control: {
|
|
271
|
-
type: "color",
|
|
272
|
-
presetColors: ["#ffffff", "#ff0000", "#00ff00", "#0000ff"]
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
const Template = args => /*#__PURE__*/_react.default.createElement(_PopupContent.default, args);
|
|
278
|
-
const ExamplePopupContent = exports.ExamplePopupContent = Template.bind({});
|
|
279
|
-
ExamplePopupContent.args = {
|
|
280
|
-
rowsData: RowsData1,
|
|
281
|
-
borderColor: "#066768",
|
|
282
|
-
width: "100%",
|
|
283
|
-
height: "100%"
|
|
284
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _MenuItemOpenIcon = require("./icons/MenuItemOpenIcon");
|
|
10
|
-
var _MenuItemUpIcon = require("./icons/MenuItemUpIcon");
|
|
11
|
-
var _SpotlightProductIcon = require("./icons/SpotlightProductIcon");
|
|
12
|
-
var _BannersDropdown = require("./BannersDropdown");
|
|
13
|
-
var _EventInfo = require("./EventInfo.style");
|
|
14
|
-
const EventInfo = props => {
|
|
15
|
-
const {
|
|
16
|
-
title,
|
|
17
|
-
subTitle,
|
|
18
|
-
productsData,
|
|
19
|
-
onSpotlightProductClick,
|
|
20
|
-
onClickBannersDropdown
|
|
21
|
-
} = props;
|
|
22
|
-
const [IsProductsListOpen, setIsProductsListOpen] = (0, _react.useState)(false);
|
|
23
|
-
const displayBannersDropdown = () => /*#__PURE__*/_react.default.createElement(_BannersDropdown.BannersDropdown, {
|
|
24
|
-
banners: [{
|
|
25
|
-
checked: true,
|
|
26
|
-
name: 'StopAndShop'
|
|
27
|
-
}, {
|
|
28
|
-
checked: true,
|
|
29
|
-
name: 'FoodLion'
|
|
30
|
-
}, {
|
|
31
|
-
checked: true,
|
|
32
|
-
name: 'GiantFood'
|
|
33
|
-
}, {
|
|
34
|
-
checked: true,
|
|
35
|
-
name: 'TheGiantCompany'
|
|
36
|
-
}, {
|
|
37
|
-
checked: true,
|
|
38
|
-
name: 'Hannaford'
|
|
39
|
-
}],
|
|
40
|
-
onClick: banners => {
|
|
41
|
-
onClickBannersDropdown({
|
|
42
|
-
banners
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement(_EventInfo.EventInfoMainContainer, {
|
|
47
|
-
id: "EventInfoMainContainer"
|
|
48
|
-
}, /*#__PURE__*/_react.default.createElement(_EventInfo.EventInfoContainer, {
|
|
49
|
-
id: "EventInfoContainer"
|
|
50
|
-
}, /*#__PURE__*/_react.default.createElement(_EventInfo.EventInfoTitleContainer, {
|
|
51
|
-
id: "EventInfoTitleContainer"
|
|
52
|
-
}, /*#__PURE__*/_react.default.createElement(_EventInfo.EventInfoTitle, {
|
|
53
|
-
id: "EventInfoTitle"
|
|
54
|
-
}, title), /*#__PURE__*/_react.default.createElement(_EventInfo.EventInfoSubTitle, {
|
|
55
|
-
id: "EventInfoSubTitle"
|
|
56
|
-
}, "|"), /*#__PURE__*/_react.default.createElement(_EventInfo.EventInfoSubTitle, {
|
|
57
|
-
id: "EventInfoSubTitle"
|
|
58
|
-
}, productsData ? productsData === null || productsData === void 0 ? void 0 : productsData.length : ''), displayBannersDropdown()), /*#__PURE__*/_react.default.createElement(_EventInfo.ProductButtonContainer, {
|
|
59
|
-
id: "ProductButtonContainer",
|
|
60
|
-
onClick: () => {
|
|
61
|
-
setIsProductsListOpen(!IsProductsListOpen);
|
|
62
|
-
}
|
|
63
|
-
}, IsProductsListOpen ? /*#__PURE__*/_react.default.createElement(_MenuItemUpIcon.MenuItemUpIcon, {
|
|
64
|
-
color: "#212121"
|
|
65
|
-
}) : /*#__PURE__*/_react.default.createElement(_MenuItemOpenIcon.MenuItemOpenIcon, {
|
|
66
|
-
color: "#212121"
|
|
67
|
-
}))), IsProductsListOpen && /*#__PURE__*/_react.default.createElement(_EventInfo.EventInfoContentContainer, {
|
|
68
|
-
id: "EventInfoContentContainer"
|
|
69
|
-
}, /*#__PURE__*/_react.default.createElement(_EventInfo.ProductsTitle, {
|
|
70
|
-
id: "ProductsTitle"
|
|
71
|
-
}, subTitle), productsData === null || productsData === void 0 ? void 0 : productsData.map(item => /*#__PURE__*/_react.default.createElement(_EventInfo.ProductContainer, {
|
|
72
|
-
id: "ProductContainer"
|
|
73
|
-
}, /*#__PURE__*/_react.default.createElement(_EventInfo.Product, {
|
|
74
|
-
id: "Product"
|
|
75
|
-
}, item.label), item.ShowSpotlightProductButton ? /*#__PURE__*/_react.default.createElement(_EventInfo.ProductButtonContainer, {
|
|
76
|
-
id: "ProductButtonContainer",
|
|
77
|
-
background: "#F8CD00",
|
|
78
|
-
onClick: () => {
|
|
79
|
-
onSpotlightProductClick({
|
|
80
|
-
value: item.value,
|
|
81
|
-
label: item.label
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}, /*#__PURE__*/_react.default.createElement(_SpotlightProductIcon.SpotlightProductIcon, null)) : ''))));
|
|
85
|
-
};
|
|
86
|
-
var _default = exports.default = EventInfo;
|
|
87
|
-
EventInfo.defaultProps = {
|
|
88
|
-
title: 'Products Variety',
|
|
89
|
-
subTitle: 'Product Name',
|
|
90
|
-
onSpotlightProductClick: () => {},
|
|
91
|
-
onClickBannersDropdown: () => {}
|
|
92
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ProductsTitle = exports.ProductContainer = exports.ProductButtonContainer = exports.Product = exports.EventInfoTitleContainer = exports.EventInfoTitle = exports.EventInfoSubTitle = exports.EventInfoMainContainer = exports.EventInfoContentContainer = exports.EventInfoContainer = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
9
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
11
|
-
const EventInfoMainContainer = exports.EventInfoMainContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n margin: 0;\n padding: 10px;\n border-radius: 12px;\n box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.2);\n"])));
|
|
12
|
-
const EventInfoContainer = exports.EventInfoContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin: 0 10px;\n"])));
|
|
13
|
-
const EventInfoTitleContainer = exports.EventInfoTitleContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n font-family: \"Poppins\", sans-serif;\n font-style: normal;\n font-size: 20px;\n line-height: 25px;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: 10px;\n gap: 15px;\n"])));
|
|
14
|
-
const EventInfoTitle = exports.EventInfoTitle = _styledComponents.default.h3(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 20px;\n\n margin: 0;\n"])));
|
|
15
|
-
const EventInfoSubTitle = exports.EventInfoSubTitle = _styledComponents.default.h3(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n color: #757171;\n font-weight: 500;\n font-size: 20px;\n margin: 0;\n"])));
|
|
16
|
-
const EventInfoContentContainer = exports.EventInfoContentContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n font-family: \"Poppins\", sans-serif;\n font-style: normal;\n font-size: 20px;\n line-height: 25px;\n display: flex;\n justify-content: flex-start;\n flex-direction: column;\n align-items: flex-start;\n margin: 10px;\n padding: 10px 20px 20px 50px;\n"])));
|
|
17
|
-
const ProductsTitle = exports.ProductsTitle = _styledComponents.default.h3(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 600;\n font-size: 14px;\n margin: 10px 0;\n"])));
|
|
18
|
-
const ProductContainer = exports.ProductContainer = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: flex-start;\n align-items: center;\n border-bottom: 1px solid #00000010;\n width: 100%;\n gap: 20px;\n"])));
|
|
19
|
-
const Product = exports.Product = _styledComponents.default.h3(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 400;\n font-size: 14px;\n border-radius: 12px;\n"])));
|
|
20
|
-
const ProductButtonContainer = exports.ProductButtonContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n background: ", ";\n border-radius: 12px;\n height: 25px;\n padding: 0 15px;\n user-select: none;\n &:hover {\n background-color: #f0f0f0;\n cursor: pointer;\n }\n gap: 10px;\n"])), props => props.background || '#ffffff');
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.FilterButton = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _FilterButton = require("./FilterButton.style");
|
|
10
|
-
var _FilterIcon = require("./icons/FilterIcon");
|
|
11
|
-
const FilterButton = props => {
|
|
12
|
-
const {
|
|
13
|
-
color,
|
|
14
|
-
height,
|
|
15
|
-
buttonText,
|
|
16
|
-
iconWidth,
|
|
17
|
-
iconHeight,
|
|
18
|
-
disabled,
|
|
19
|
-
onButtonClick
|
|
20
|
-
} = props;
|
|
21
|
-
const onClickHandler = event => {
|
|
22
|
-
onButtonClick(event);
|
|
23
|
-
};
|
|
24
|
-
return /*#__PURE__*/_react.default.createElement(_FilterButton.FilterButtonWrapper, {
|
|
25
|
-
height: height,
|
|
26
|
-
color: color,
|
|
27
|
-
disabled: disabled,
|
|
28
|
-
onClick: event => {
|
|
29
|
-
onClickHandler(event);
|
|
30
|
-
}
|
|
31
|
-
}, /*#__PURE__*/_react.default.createElement(_FilterIcon.FilterIcon, {
|
|
32
|
-
width: iconWidth,
|
|
33
|
-
height: iconHeight,
|
|
34
|
-
color: color
|
|
35
|
-
}), /*#__PURE__*/_react.default.createElement(_FilterButton.SpanText, null, buttonText));
|
|
36
|
-
};
|
|
37
|
-
exports.FilterButton = FilterButton;
|
|
38
|
-
var _default = exports.default = FilterButton;
|
|
39
|
-
FilterButton.defaultProps = {
|
|
40
|
-
buttonText: 'Filter',
|
|
41
|
-
height: '40px',
|
|
42
|
-
color: '#212121',
|
|
43
|
-
iconHeight: 12,
|
|
44
|
-
iconWidth: 12,
|
|
45
|
-
disabled: false,
|
|
46
|
-
onButtonClick: () => {}
|
|
47
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.SpanText = exports.FilterButtonWrapper = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
9
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
-
var _templateObject, _templateObject2;
|
|
11
|
-
const FilterButtonWrapper = exports.FilterButtonWrapper = _styledComponents.default.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: ", ";\n font-size: 14px;\n font-weight: 400;\n display: flex;\n gap: 8px;\n align-items: center;\n justify-content: center;\n padding: 8px 18px;\n color: ", ";\n border-radius: 8px;\n border: 1px solid #B1B1B1;\n background: transparent;\n transition: box-shadow 0.3s ease;\n &:hover, &:focus {\n cursor: pointer;\n box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.1);\n }\n"])), props => props.height, props => props.color);
|
|
12
|
-
const SpanText = exports.SpanText = _styledComponents.default.span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n"])));
|