sag_components 1.0.975 → 1.0.976
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/Button.test.js +10 -10
- package/dist/LinkButton.test.js +10 -10
- package/dist/SingleBar.test.js +2 -2
- package/dist/index.js +1 -1
- package/dist/stories/components/AttachedFile/AttachedFile.js +1 -1
- package/dist/stories/components/AttachedFile/AttachedFile.style.js +40 -6
- package/dist/stories/components/BannerEventBox/BannerEventBox.js +33 -23
- package/dist/stories/components/BannerEventBox/BannerEventBox.style.js +71 -15
- package/dist/stories/components/BannerEventBoxList/BannerEventBoxList.js +10 -5
- package/dist/stories/components/BannerEventBoxList/BannerEventBoxList.style.js +182 -16
- package/dist/stories/components/BannersDropdown/BannersDropdown.style.js +91 -10
- package/dist/stories/components/BarChart/BarChart.js +5 -3
- package/dist/stories/components/BarChart/BarChart.stories.js +29 -20
- package/dist/stories/components/BarChart/BarChart.style.js +52 -10
- package/dist/stories/components/BarChartTwoRows/BarChartTwoRows.js +53 -44
- package/dist/stories/components/BarChartTwoRows/BarChartTwoRows.stories.js +166 -40
- package/dist/stories/components/BarChartTwoRows/BarChartTwoRows.style.js +72 -11
- package/dist/stories/components/BarChartsByWeeks/BarChartsByWeeks.js +7 -3
- package/dist/stories/components/BarChartsByWeeks/BarChartsByWeeks.style.js +88 -13
- package/dist/stories/components/Benchmark/Benchmark.style.js +53 -7
- package/dist/stories/components/Button/Button.js +1 -1
- package/dist/stories/components/Button/Button.style.js +82 -7
- package/dist/stories/components/CampaignDemoReport/CampaignDemoReport.style.js +40 -7
- package/dist/stories/components/Card/Card.style.js +57 -10
- package/dist/stories/components/CheckBox/CheckBox.style.js +28 -6
- package/dist/stories/components/CheckBoxButton/CheckBoxButton.style.js +31 -6
- package/dist/stories/components/CodeEditor/CodeEditor.style.js +4 -3
- package/dist/stories/components/CollapseData/CollapseData.js +5 -5
- package/dist/stories/components/CollapseData/CollapseData.style.js +119 -13
- package/dist/stories/components/CollapseHeader/CollapseHeader.js +2 -1
- package/dist/stories/components/CollapseHeader/CollapseHeader.style.js +192 -27
- package/dist/stories/components/CollapseMenuItem/CollapseMenuItem.style.js +53 -9
- package/dist/stories/components/Datepicker/Datepicker.style.js +9 -3
- package/dist/stories/components/DownloadProgress/DownloadProgress.style.js +43 -6
- package/dist/stories/components/Dropdown/Dropdown.style.js +9 -3
- package/dist/stories/components/DropdownMulti/DropdownMulti.js +290 -0
- package/dist/stories/components/DropdownMulti/DropdownMulti.stories.js +220 -0
- package/dist/stories/components/DropdownMulti/DropdownMulti.style.js +11 -0
- package/dist/stories/components/DropdownMultiNew/DropdownMultiNew.js +49 -36
- package/dist/stories/components/DropdownMultiNew/DropdownMultiNew.style.js +204 -16
- package/dist/stories/components/DropdownNew/DropdownNew.js +21 -11
- package/dist/stories/components/DropdownNew/DropdownNew.stories.js +18 -9
- package/dist/stories/components/DropdownNew/DropdownNew.style.js +13 -3
- package/dist/stories/components/DropdownSingleNew/DropdownSingleNew.js +30 -10
- package/dist/stories/components/DropdownSingleNew/DropdownSingleNew.style.js +175 -14
- package/dist/stories/components/EventDetailsCard/EventDetailsCard.style.js +86 -10
- package/dist/stories/components/EventList/EventList.style.js +30 -6
- package/dist/stories/components/EventListItem/EventListItem.style.js +39 -6
- package/dist/stories/components/FilterContainer/FilterContainer.style.js +22 -5
- package/dist/stories/components/FilterPanel/FilterPanel.js +22 -17
- package/dist/stories/components/FilterPanel/FilterPanel.style.js +81 -13
- package/dist/stories/components/FilterPanel.js +4 -0
- package/dist/stories/components/FormattedValue/FormattedValue.style.js +83 -10
- package/dist/stories/components/IconButton/IconButton.style.js +56 -7
- package/dist/stories/components/Input/Input.style.js +122 -9
- package/dist/stories/components/InputOld/InputOld.style.js +61 -8
- package/dist/stories/components/KpiFilter/KpiFilter.js +18 -1
- package/dist/stories/components/KpiFilter/KpiFilter.style.js +124 -18
- package/dist/stories/components/LinkButton/LinkButton.style.js +45 -6
- package/dist/stories/components/LinnerDataBox/LinnerDataBox.js +4 -2
- package/dist/stories/components/LinnerDataBox/LinnerDataBox.stories.js +32 -10
- package/dist/stories/components/LinnerDataBox/LinnerDataBox.style.js +60 -14
- package/dist/stories/components/ListBox/ListBox.style.js +40 -6
- package/dist/stories/components/MarketShareDescription/MarketShareDescription.stories.js +17 -3
- package/dist/stories/components/MarketShareDescription/MarketShareDescription.style.js +207 -19
- package/dist/stories/components/Modal/Modal.style.js +56 -8
- package/dist/stories/components/Modal/ModalTotalBenchmark.js +6 -6
- package/dist/stories/components/MonthPicker/MonthPicker.js +2 -2
- package/dist/stories/components/MonthPicker/MonthPicker.style.js +95 -10
- package/dist/stories/components/MonthPicker/MonthPopupPicker.js +91 -13
- package/dist/stories/components/MultipleCard/MultipleCard.style.js +5 -3
- package/dist/stories/components/NoDataFoundMessage/NoDataFoundMessage.style.js +31 -5
- package/dist/stories/components/OneColumnContainer/OneColumnContainer.style.js +99 -12
- package/dist/stories/components/PageFilterBar/PageFilterBar.style.js +14 -4
- package/dist/stories/components/PerformanceAnalytics/PerformanceAnalytics.js +16 -9
- package/dist/stories/components/PerformanceAnalytics/PerformanceAnalytics.style.js +136 -17
- package/dist/stories/components/PerformanceAnalyticsLegend/PerformanceAnalyticsLegend.js +14 -13
- package/dist/stories/components/PerformanceAnalyticsLegend/PerformanceAnalyticsLegend.style.js +55 -8
- package/dist/stories/components/PerformanceAnalyticsOneColumn/PerformanceAnalyticsOneColumn.js +12 -5
- package/dist/stories/components/PerformanceAnalyticsOneColumn/PerformanceAnalyticsOneColumn.style.js +108 -15
- package/dist/stories/components/PerformanceAnalyticsTotals/PerformanceAnalyticsTotals.js +1 -1
- package/dist/stories/components/PerformanceAnalyticsTotals/PerformanceAnalyticsTotals.style.js +81 -12
- package/dist/stories/components/Popup/Popup.style.js +114 -16
- package/dist/stories/components/PopupCharts/PopupCharts.style.js +100 -15
- package/dist/stories/components/PopupContent/PopupContent.style.js +64 -11
- package/dist/stories/components/ProductsVariety/ProductsVariety.style.js +78 -12
- package/dist/stories/components/ProgressBar/ProgressBar.style.js +15 -4
- package/dist/stories/components/QuarterPicker/QuarterPicker.js +2 -2
- package/dist/stories/components/QuarterPicker/QuarterPicker.style.js +94 -10
- package/dist/stories/components/QuarterPicker/QuarterPopupPicker.js +85 -12
- package/dist/stories/components/QuickFilter/QuickFilter.style.js +13 -3
- package/dist/stories/components/QuickFilter/QuickFilterDropdownMultiSelection.js +2 -2
- package/dist/stories/components/QuickFilter/QuickFilterDropdownMultiSelection.style.js +182 -16
- package/dist/stories/components/QuickFilter/QuickFilterDropdownSingle.js +1 -1
- package/dist/stories/components/QuickFilter/QuickFilterDropdownSingle.style.js +127 -15
- package/dist/stories/components/QuickFilterDropdownMultiSelection.js +1 -1
- package/dist/stories/components/QuickFilterDropdownSingle.js +1 -1
- package/dist/stories/components/RangePicker/RangeDatePicker.js +95 -12
- package/dist/stories/components/RangePicker/RangePicker.js +2 -2
- package/dist/stories/components/RangePicker/RangePicker.style.js +99 -10
- package/dist/stories/components/ReportTable/ReportTable.style.js +123 -14
- package/dist/stories/components/SagButton/SagButton.style.js +39 -5
- package/dist/stories/components/SagIconButton/SagIconButton.style.js +22 -4
- package/dist/stories/components/SagInput/SagInput.style.js +33 -5
- package/dist/stories/components/SalesAndROI/SalesAndROI.style.js +103 -11
- package/dist/stories/components/SearchInput/SearchInput.style.js +29 -4
- package/dist/stories/components/SegmentedButton/SegmentedButton.js +5 -5
- package/dist/stories/components/SegmentedButton/SegmentedButton.style.js +90 -9
- package/dist/stories/components/Select/Select.style.js +92 -9
- package/dist/stories/components/TabMenu/TabMenu.js +19 -7
- package/dist/stories/components/TabMenu/TabMenu.style.js +105 -14
- package/dist/stories/components/Table/Table.js +2 -2
- package/dist/stories/components/Table/Table.style.js +78 -9
- package/dist/stories/components/TextField/TextField.style.js +10 -3
- package/dist/stories/components/TitleDescription/TitleDescription.style.js +214 -28
- package/dist/stories/components/Tooltip/Tooltip.js +1 -1
- package/dist/stories/components/Tooltip/Tooltip.style.js +90 -5
- package/dist/stories/components/TopToggleList/TopToggleList.style.js +43 -8
- package/dist/stories/components/TotalBenchmark/TotalBenchmark.style.js +71 -11
- package/dist/stories/components/TotalBenchmarkAreachart/TotalBenchmarkAreachart.js +3 -3
- package/dist/stories/components/TotalBenchmarkAreachart/TotalBenchmarkAreachart.style.js +163 -22
- package/dist/stories/components/TotalBenchmarkArrows/TotalBenchmarkArrows.style.js +100 -16
- package/dist/stories/components/TotalBenchmarkBarchart/TotalBenchmarkBarchart.style.js +69 -12
- package/dist/stories/components/TotalDoughnutChart/TotalDoughnutChart.js +3 -3
- package/dist/stories/components/TotalDoughnutChart/TotalDoughnutChart.style.js +170 -22
- package/dist/stories/components/TotalHorizontalCharts/TotalHorizontalCharts.js +47 -32
- package/dist/stories/components/TotalHorizontalCharts/TotalHorizontalCharts.stories.js +52 -14
- package/dist/stories/components/TotalHorizontalCharts/TotalHorizontalCharts.style.js +51 -13
- package/dist/stories/components/TspanTooltip/TspanTooltip.js +3 -3
- package/dist/stories/components/TspanTooltip/TspanTooltip.style.js +97 -5
- package/dist/stories/components/TwoBarCharts/TwoBarCharts.js +6 -4
- package/dist/stories/components/TwoBarCharts/TwoBarCharts.stories.js +88 -23
- package/dist/stories/components/TwoBarCharts/TwoBarCharts.style.js +52 -10
- package/dist/stories/utils/CommonFunctions.js +13 -8
- package/package.json +1 -1
- package/dist/stories/components/HaiTooltip.js +0 -71
- package/dist/stories/components/HaiTooltip.style.js +0 -12
- package/dist/stories/components/Rbackup.js +0 -453
- package/dist/stories/components/TableTooltip.js +0 -71
- package/dist/stories/components/TableTooltip.style.js +0 -12
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.DropdownMulti = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete"));
|
|
11
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
12
|
+
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _CheckBoxOutlineBlank = _interopRequireDefault(require("@mui/icons-material/CheckBoxOutlineBlank"));
|
|
15
|
+
var _CheckBox = _interopRequireDefault(require("@mui/icons-material/CheckBox"));
|
|
16
|
+
var _ArrowDropDownIcon = require("../../icons/ArrowDropDownIcon");
|
|
17
|
+
var _DropdownMulti = require("./DropdownMulti.style");
|
|
18
|
+
const icon = /*#__PURE__*/_react.default.createElement(_CheckBoxOutlineBlank.default, {
|
|
19
|
+
fontSize: "small"
|
|
20
|
+
});
|
|
21
|
+
const checkedIcon = /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
|
|
22
|
+
fontSize: "small"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* SAG DropdownMulti
|
|
27
|
+
*/
|
|
28
|
+
const DropdownMulti = props => {
|
|
29
|
+
const {
|
|
30
|
+
name,
|
|
31
|
+
width = '100%',
|
|
32
|
+
size,
|
|
33
|
+
text,
|
|
34
|
+
shape,
|
|
35
|
+
placeHolder,
|
|
36
|
+
limitTagsOnMultiSelect,
|
|
37
|
+
showPopupIcon,
|
|
38
|
+
options,
|
|
39
|
+
onChange,
|
|
40
|
+
onInputChange,
|
|
41
|
+
labelColor = '#1B30AA',
|
|
42
|
+
required,
|
|
43
|
+
inputRef,
|
|
44
|
+
allowedInput = 'all',
|
|
45
|
+
reset = false,
|
|
46
|
+
disableClearable = false,
|
|
47
|
+
disabled = false,
|
|
48
|
+
dropdownListfontSize = '14px',
|
|
49
|
+
placeHolderFontSize = '14px',
|
|
50
|
+
dropdownMultiMaxWidth
|
|
51
|
+
} = props;
|
|
52
|
+
const [currentInputValue, setCurrentInputValue] = (0, _react.useState)(null);
|
|
53
|
+
const [selectedOptionsState, setSelectedOptionsState] = (0, _react.useState)([]);
|
|
54
|
+
(0, _react.useEffect)(() => {
|
|
55
|
+
setSelectedOptionsState([]);
|
|
56
|
+
}, [reset]);
|
|
57
|
+
(0, _react.useEffect)(() => {
|
|
58
|
+
const delayDebounceFn = setTimeout(() => {
|
|
59
|
+
onInputChange(currentInputValue);
|
|
60
|
+
}, 1000);
|
|
61
|
+
return () => clearTimeout(delayDebounceFn);
|
|
62
|
+
}, [currentInputValue]);
|
|
63
|
+
const theme = (0, _styles.createTheme)({
|
|
64
|
+
components: {
|
|
65
|
+
MuiFormLabel: {
|
|
66
|
+
styleOverrides: {
|
|
67
|
+
asterisk: {
|
|
68
|
+
color: '#db3131'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// ---------------------------- Multi Text Style -----------------------------------------
|
|
76
|
+
const getTextFieldStyleMulti = () => {
|
|
77
|
+
if (shape === 'round') {
|
|
78
|
+
// round
|
|
79
|
+
return {
|
|
80
|
+
'& .MuiOutlinedInput-root': {
|
|
81
|
+
borderRadius: '12px',
|
|
82
|
+
legend: {
|
|
83
|
+
marginLeft: '10px'
|
|
84
|
+
}
|
|
85
|
+
// '& .MuiAutocomplete-endAdornment': {
|
|
86
|
+
// marginRight: '10px',
|
|
87
|
+
// },
|
|
88
|
+
},
|
|
89
|
+
'& .MuiAutocomplete-inputRoot': {
|
|
90
|
+
paddingLeft: '10px !important',
|
|
91
|
+
borderRadius: '12px',
|
|
92
|
+
// This matches the specificity of the default styles at https://github.com/mui-org/material-ui/blob/v4.11.3/packages/material-ui-lab/src/Autocomplete/Autocomplete.js#L90
|
|
93
|
+
'&[class*="MuiOutlinedInput-root"] .MuiAutocomplete-input:first-of-type': {
|
|
94
|
+
// Default left padding is 6px
|
|
95
|
+
paddingLeft: '10px'
|
|
96
|
+
},
|
|
97
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
|
98
|
+
borderColor: '#E7E7E7'
|
|
99
|
+
},
|
|
100
|
+
'&:hover .MuiOutlinedInput-notchedOutline': {
|
|
101
|
+
borderColor: disabled ? '#E7E7E7' : labelColor
|
|
102
|
+
},
|
|
103
|
+
'&.Mui-focused .MuiOutlinedInput-notchedOutline': {
|
|
104
|
+
borderColor: disabled ? '#E7E7E7' : labelColor
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
'& .MuiInputLabel-outlined:not(.MuiInputLabel-shrink)': {
|
|
108
|
+
// Default transform is "translate(14px, 20px) scale(1)""
|
|
109
|
+
// This lines up the label with the initial cursor position in the input
|
|
110
|
+
// after changing its padding-left.
|
|
111
|
+
transform: 'translate(14px, 18px) scale(1);',
|
|
112
|
+
fontSize: '14px',
|
|
113
|
+
color: disabled ? '#E7E7E7' : currentInputValue && currentInputValue.length > 0 ? '#212121' : '#757575'
|
|
114
|
+
},
|
|
115
|
+
'& .MuiInputLabel-outlined': {
|
|
116
|
+
paddingLeft: '10px',
|
|
117
|
+
color: disabled ? '#E7E7E7' : labelColor,
|
|
118
|
+
fontSize: '18px'
|
|
119
|
+
},
|
|
120
|
+
'& .MuiInputLabel-shrink': {
|
|
121
|
+
marginLeft: '1px',
|
|
122
|
+
paddingLeft: '4px',
|
|
123
|
+
paddingRight: '6px',
|
|
124
|
+
background: 'white'
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
// square
|
|
129
|
+
return null;
|
|
130
|
+
};
|
|
131
|
+
const onInputChangeHandler = (event, newInputValue) => {
|
|
132
|
+
setCurrentInputValue({
|
|
133
|
+
syntheticBaseEvent: event,
|
|
134
|
+
inputValue: newInputValue
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
const onChangeHandler = (event, newValue) => {
|
|
138
|
+
// const newSelectedOptionsSet = new Set(newValue?.map((item) => item) ?? []);
|
|
139
|
+
// const newSelectedOptions = Array.from(newSelectedOptionsSet).map((item) => {
|
|
140
|
+
// return item;
|
|
141
|
+
// });
|
|
142
|
+
|
|
143
|
+
const newSelectedOptions = newValue === null || newValue === void 0 ? void 0 : newValue.filter((value, index, self) => index === self.findIndex(item => item.id === value.id && item.label === value.label));
|
|
144
|
+
setSelectedOptionsState(newSelectedOptions);
|
|
145
|
+
onChange({
|
|
146
|
+
syntheticBaseEvent: event,
|
|
147
|
+
newValue: newSelectedOptions
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
const isInputAllowed = inputChar => {
|
|
151
|
+
const NUMERIC_REGEX = /^[0-9-]+$/;
|
|
152
|
+
const ALPHA_REGEX = /^[a-zA-Z]+$/;
|
|
153
|
+
const ALPHA_NUMERIC_REGEX = /^[a-zA-Z0-9-]+$/;
|
|
154
|
+
switch (allowedInput) {
|
|
155
|
+
case 'all':
|
|
156
|
+
return true;
|
|
157
|
+
case 'alpha':
|
|
158
|
+
if (ALPHA_REGEX.test(inputChar)) return true;
|
|
159
|
+
return false;
|
|
160
|
+
case 'numeric':
|
|
161
|
+
if (NUMERIC_REGEX.test(inputChar)) return true;
|
|
162
|
+
return false;
|
|
163
|
+
case 'alphaNumeric':
|
|
164
|
+
if (ALPHA_NUMERIC_REGEX.test(inputChar)) return true;
|
|
165
|
+
return false;
|
|
166
|
+
default:
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// --------------------------------------- DropdownMulti--------------------------------
|
|
172
|
+
const getAutocompleteMulti = () => selectedOptionsState && /*#__PURE__*/_react.default.createElement(_styles.ThemeProvider, {
|
|
173
|
+
theme: theme
|
|
174
|
+
}, /*#__PURE__*/_react.default.createElement(_Autocomplete.default, {
|
|
175
|
+
class: name,
|
|
176
|
+
onChange: (event, newValue) => {
|
|
177
|
+
onChangeHandler(event, newValue);
|
|
178
|
+
},
|
|
179
|
+
onInputChange: (event, newInputValue) => {
|
|
180
|
+
onInputChangeHandler(event, newInputValue);
|
|
181
|
+
},
|
|
182
|
+
multiple: true,
|
|
183
|
+
style: {
|
|
184
|
+
maxWidth: dropdownMultiMaxWidth ? "".concat(dropdownMultiMaxWidth) : undefined
|
|
185
|
+
},
|
|
186
|
+
limitTags: limitTagsOnMultiSelect,
|
|
187
|
+
id: "checkboxes-tags",
|
|
188
|
+
options: options,
|
|
189
|
+
value: selectedOptionsState,
|
|
190
|
+
disabled: disabled,
|
|
191
|
+
disableCloseOnSelect: true,
|
|
192
|
+
disableClearable: disableClearable,
|
|
193
|
+
getOptionLabel: option => option.label,
|
|
194
|
+
popupIcon: showPopupIcon ? /*#__PURE__*/_react.default.createElement(_ArrowDropDownIcon.ArrowDropDownIcon, {
|
|
195
|
+
width: "0.5em",
|
|
196
|
+
height: "0.5em"
|
|
197
|
+
}) : null,
|
|
198
|
+
renderOption: (props, option, _ref) => {
|
|
199
|
+
let {
|
|
200
|
+
selected
|
|
201
|
+
} = _ref;
|
|
202
|
+
return /*#__PURE__*/_react.default.createElement("li", props, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
203
|
+
icon: icon,
|
|
204
|
+
checkedIcon: checkedIcon,
|
|
205
|
+
checked: isOptionChecked(option)
|
|
206
|
+
}), option.label);
|
|
207
|
+
},
|
|
208
|
+
renderInput: params =>
|
|
209
|
+
/*#__PURE__*/
|
|
210
|
+
// showSearchIcon &&
|
|
211
|
+
_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
212
|
+
variant: "outlined",
|
|
213
|
+
label: text,
|
|
214
|
+
size: size,
|
|
215
|
+
sx: getTextFieldStyleMulti(),
|
|
216
|
+
placeholder: placeHolder,
|
|
217
|
+
InputProps: {
|
|
218
|
+
...params.InputProps,
|
|
219
|
+
style: {
|
|
220
|
+
fontSize: placeHolderFontSize,
|
|
221
|
+
fontFamily: 'Poppins'
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// endAdornment: (
|
|
225
|
+
// <>
|
|
226
|
+
// { selectedOptionsState && Object.values( selectedOptionsState)?.map((option, index) => (
|
|
227
|
+
// <span key={index} style={{ margin: '0 5px' }}>
|
|
228
|
+
// {option.label}
|
|
229
|
+
// </span>
|
|
230
|
+
// ))}
|
|
231
|
+
// {params.InputProps.endAdornment}
|
|
232
|
+
|
|
233
|
+
// </>
|
|
234
|
+
// ),
|
|
235
|
+
},
|
|
236
|
+
onKeyDown: event => {
|
|
237
|
+
if (!isInputAllowed(event.key)) {
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
inputRef: inputRef || null,
|
|
242
|
+
required: required
|
|
243
|
+
})),
|
|
244
|
+
ListboxProps: {
|
|
245
|
+
style: {
|
|
246
|
+
fontSize: dropdownListfontSize,
|
|
247
|
+
// default: 14px
|
|
248
|
+
fontFamily: 'Poppins'
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}));
|
|
252
|
+
const isOptionChecked = option => {
|
|
253
|
+
var _Object$values;
|
|
254
|
+
if (selectedOptionsState && (_Object$values = Object.values(selectedOptionsState)) !== null && _Object$values !== void 0 && _Object$values.map(itemFilter => itemFilter.label).includes(option.label)) {
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
return false;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// --------------------------------- MAIN -------------------------------------
|
|
261
|
+
return /*#__PURE__*/_react.default.createElement(_DropdownMulti.DropdownContainer, {
|
|
262
|
+
className: "DropdownContainer",
|
|
263
|
+
width: width
|
|
264
|
+
}, getAutocompleteMulti());
|
|
265
|
+
};
|
|
266
|
+
exports.DropdownMulti = DropdownMulti;
|
|
267
|
+
var _default = exports.default = DropdownMulti;
|
|
268
|
+
DropdownMulti.defaultProps = {
|
|
269
|
+
name: 'MultiSelectLarge',
|
|
270
|
+
width: '500px',
|
|
271
|
+
size: 'large',
|
|
272
|
+
text: 'Retailer',
|
|
273
|
+
limitTagsOnMultiSelect: 2,
|
|
274
|
+
placeHolder: 'Type...',
|
|
275
|
+
shape: 'round',
|
|
276
|
+
showPopupIcon: true,
|
|
277
|
+
options: [],
|
|
278
|
+
onChange: () => {},
|
|
279
|
+
onInputChange: () => {},
|
|
280
|
+
labelColor: '#1B30AA',
|
|
281
|
+
required: true,
|
|
282
|
+
inputRef: undefined,
|
|
283
|
+
allowedInput: 'all',
|
|
284
|
+
disableClearable: false,
|
|
285
|
+
disabled: false,
|
|
286
|
+
reset: false,
|
|
287
|
+
dropdownListfontSize: '14px',
|
|
288
|
+
placeHolderFontSize: '14px',
|
|
289
|
+
dropdownMultiMaxWidth: undefined
|
|
290
|
+
};
|
|
@@ -0,0 +1,220 @@
|
|
|
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.MultiSelectLarge = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _DropdownMulti = require("./DropdownMulti");
|
|
10
|
+
const options = [{
|
|
11
|
+
id: 0,
|
|
12
|
+
label: 'Shufersal'
|
|
13
|
+
}, {
|
|
14
|
+
id: 1,
|
|
15
|
+
label: 'EPC'
|
|
16
|
+
}, {
|
|
17
|
+
id: 2,
|
|
18
|
+
label: 'Food Lion'
|
|
19
|
+
}, {
|
|
20
|
+
id: 3,
|
|
21
|
+
label: 'Hannaford'
|
|
22
|
+
}, {
|
|
23
|
+
id: 4,
|
|
24
|
+
label: 'Giant Food'
|
|
25
|
+
}, {
|
|
26
|
+
id: 5,
|
|
27
|
+
label: 'The Giant Company'
|
|
28
|
+
}, {
|
|
29
|
+
id: 6,
|
|
30
|
+
label: 'Stop&Shop'
|
|
31
|
+
}, {
|
|
32
|
+
id: 7,
|
|
33
|
+
label: 'Price Chopper'
|
|
34
|
+
}, {
|
|
35
|
+
id: 8,
|
|
36
|
+
label: 'South Eastern Grocers'
|
|
37
|
+
}];
|
|
38
|
+
const filterMultiSelectData1 = [{
|
|
39
|
+
id: 2,
|
|
40
|
+
label: 'Food Lion'
|
|
41
|
+
}, {
|
|
42
|
+
id: 3,
|
|
43
|
+
label: 'Hannaford'
|
|
44
|
+
}];
|
|
45
|
+
|
|
46
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
|
|
47
|
+
var _default = exports.default = {
|
|
48
|
+
title: 'SAG/DropdownMulti',
|
|
49
|
+
component: _DropdownMulti.DropdownMulti,
|
|
50
|
+
tags: ['autodocs'],
|
|
51
|
+
argTypes: {
|
|
52
|
+
width: {
|
|
53
|
+
control: {
|
|
54
|
+
type: 'text'
|
|
55
|
+
},
|
|
56
|
+
description: 'width of the input field',
|
|
57
|
+
defaultValue: '300px'
|
|
58
|
+
},
|
|
59
|
+
size: {
|
|
60
|
+
control: {
|
|
61
|
+
type: 'radio'
|
|
62
|
+
},
|
|
63
|
+
options: ['small', 'large'],
|
|
64
|
+
description: 'size: small/large'
|
|
65
|
+
},
|
|
66
|
+
text: {
|
|
67
|
+
name: 'text',
|
|
68
|
+
control: {
|
|
69
|
+
type: 'text'
|
|
70
|
+
},
|
|
71
|
+
description: 'text inside of the input field',
|
|
72
|
+
defaultValue: 'Search...'
|
|
73
|
+
},
|
|
74
|
+
placeHolder: {
|
|
75
|
+
name: 'placeHolder',
|
|
76
|
+
control: {
|
|
77
|
+
type: 'text'
|
|
78
|
+
},
|
|
79
|
+
description: 'notify the user how to type a text',
|
|
80
|
+
defaultValue: 'Type...'
|
|
81
|
+
},
|
|
82
|
+
multiSelect: {
|
|
83
|
+
name: 'multiSelect',
|
|
84
|
+
// control: { type: "boolean",
|
|
85
|
+
// },
|
|
86
|
+
control: false,
|
|
87
|
+
description: 'true/false - allows multi select - (switch multiSelect / singleSelect is disabled in this story)'
|
|
88
|
+
},
|
|
89
|
+
limitTagsOnMultiSelect: {
|
|
90
|
+
name: 'limitTagsOnMultiSelect',
|
|
91
|
+
control: {
|
|
92
|
+
type: 'number'
|
|
93
|
+
},
|
|
94
|
+
description: 'limit noumber displayed tags on multi select when not focused'
|
|
95
|
+
},
|
|
96
|
+
options: {
|
|
97
|
+
description: 'array [] of objects: {id: string1 , label: string2 } to fill DropdownMulti options '
|
|
98
|
+
},
|
|
99
|
+
shape: {
|
|
100
|
+
control: {
|
|
101
|
+
type: 'radio'
|
|
102
|
+
},
|
|
103
|
+
options: ['round', 'square'],
|
|
104
|
+
description: 'shape: round/square'
|
|
105
|
+
},
|
|
106
|
+
showPopupIcon: {
|
|
107
|
+
name: 'showPopupIcon',
|
|
108
|
+
control: {
|
|
109
|
+
type: 'boolean'
|
|
110
|
+
},
|
|
111
|
+
description: 'show/hide popup (up/down arrow) icon'
|
|
112
|
+
},
|
|
113
|
+
showSearchIcon: {
|
|
114
|
+
name: 'showSearchIcon',
|
|
115
|
+
control: {
|
|
116
|
+
type: 'boolean'
|
|
117
|
+
},
|
|
118
|
+
description: 'show/hide search icon '
|
|
119
|
+
},
|
|
120
|
+
onChange: {
|
|
121
|
+
action: 'onChange',
|
|
122
|
+
description: 'returns an option (object) selected by the user'
|
|
123
|
+
},
|
|
124
|
+
onInputChange: {
|
|
125
|
+
action: 'onInputChange',
|
|
126
|
+
description: 'returns a value (string) displayed in the textbox'
|
|
127
|
+
},
|
|
128
|
+
labelColor: {
|
|
129
|
+
name: 'labelColor',
|
|
130
|
+
description: 'Sets label color',
|
|
131
|
+
control: {
|
|
132
|
+
type: 'color',
|
|
133
|
+
presetColors: ['#ffffff', '#ff0000', '#00ff00', '#1B30AA']
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
required: {
|
|
137
|
+
name: 'required',
|
|
138
|
+
control: {
|
|
139
|
+
type: 'boolean'
|
|
140
|
+
},
|
|
141
|
+
description: 'defines if this field is required'
|
|
142
|
+
},
|
|
143
|
+
disableClearable: {
|
|
144
|
+
name: 'disableClearable',
|
|
145
|
+
control: {
|
|
146
|
+
type: 'boolean'
|
|
147
|
+
},
|
|
148
|
+
description: 'disable Clearable functionality'
|
|
149
|
+
},
|
|
150
|
+
reset: {
|
|
151
|
+
name: 'reset',
|
|
152
|
+
control: {
|
|
153
|
+
type: 'boolean'
|
|
154
|
+
},
|
|
155
|
+
description: 'reset component'
|
|
156
|
+
},
|
|
157
|
+
allowedInput: {
|
|
158
|
+
name: 'allowedInput',
|
|
159
|
+
control: {
|
|
160
|
+
type: 'radio'
|
|
161
|
+
},
|
|
162
|
+
options: ['alpha', 'numeric', 'alphaNumeric', 'all'],
|
|
163
|
+
description: 'allowed input characters: numbers, alphabet ot both'
|
|
164
|
+
},
|
|
165
|
+
disabled: {
|
|
166
|
+
name: 'disabled',
|
|
167
|
+
control: {
|
|
168
|
+
type: 'boolean'
|
|
169
|
+
},
|
|
170
|
+
description: 'disable component'
|
|
171
|
+
},
|
|
172
|
+
dropdownListfontSize: {
|
|
173
|
+
name: 'dropdownListfontSize',
|
|
174
|
+
control: {
|
|
175
|
+
type: 'text'
|
|
176
|
+
},
|
|
177
|
+
description: 'DropdownMulti List font Size'
|
|
178
|
+
},
|
|
179
|
+
placeHolderFontSize: {
|
|
180
|
+
name: 'placeHolderFontSize',
|
|
181
|
+
control: {
|
|
182
|
+
type: 'text'
|
|
183
|
+
},
|
|
184
|
+
description: 'Place holder Font Size'
|
|
185
|
+
},
|
|
186
|
+
// filterOptionsMultiSelect: {
|
|
187
|
+
// description:
|
|
188
|
+
// "array [] of objects: {id: string1 , label: string2 } to fill DropdownMulti filter - only for multiselect ",
|
|
189
|
+
// },
|
|
190
|
+
|
|
191
|
+
dropdownMultiMaxWidth: {
|
|
192
|
+
name: 'dropdownMultiMaxWidth',
|
|
193
|
+
control: {
|
|
194
|
+
type: 'text'
|
|
195
|
+
},
|
|
196
|
+
description: 'dropdownMulti Fixed Max Width'
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const Template = args => /*#__PURE__*/_react.default.createElement(_DropdownMulti.DropdownMulti, args);
|
|
201
|
+
const MultiSelectLarge = exports.MultiSelectLarge = Template.bind({});
|
|
202
|
+
MultiSelectLarge.args = {
|
|
203
|
+
name: 'MultiSelectLarge',
|
|
204
|
+
width: '500px',
|
|
205
|
+
size: 'large',
|
|
206
|
+
text: 'Retailer',
|
|
207
|
+
limitTagsOnMultiSelect: 2,
|
|
208
|
+
placeHolder: 'Type...',
|
|
209
|
+
shape: 'round',
|
|
210
|
+
showPopupIcon: true,
|
|
211
|
+
showSearchIcon: false,
|
|
212
|
+
options,
|
|
213
|
+
labelColor: '#1B30AA',
|
|
214
|
+
required: true,
|
|
215
|
+
allowedInput: 'all',
|
|
216
|
+
reset: false,
|
|
217
|
+
dropdownListfontSize: '14px',
|
|
218
|
+
placeHolderFontSize: '14px',
|
|
219
|
+
dropdownMultiMaxWidth: '300px'
|
|
220
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DropdownContainer = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _templateObject;
|
|
11
|
+
const DropdownContainer = exports.DropdownContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: ", ";\n text-align: left; \n position: relative; \n align-items: center;\n justify-content: center;\n font-family: \"Poppins\", sans-serif; \n font-size: 14px; \n"])), props => props.width);
|