sag_components 1.0.8 → 1.0.9
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/App.js +120 -0
- package/dist/App.test.js +10 -0
- package/dist/index.js +17 -0
- package/dist/stories/Button.stories.js +117 -0
- package/dist/stories/Button.style.js +14 -0
- package/dist/stories/Dropdown.stories.js +252 -0
- package/dist/stories/Dropdown.style.js +14 -0
- package/dist/stories/OneColumnContainer.stories.js +22 -0
- package/dist/stories/OneColumnContainer.style.js +28 -0
- package/dist/stories/SegmentedButton.stories.js +187 -0
- package/dist/stories/SegmentedButton.style.js +39 -0
- package/dist/stories/components/Button.js +59 -0
- package/dist/stories/components/Dropdown.js +237 -0
- package/dist/stories/components/InfoIcon.js +38 -0
- package/dist/stories/components/OneColumnContainer.js +50 -0
- package/dist/stories/components/SegmentedButton.js +119 -0
- package/package.json +1 -1
- package/build/favicon.ico +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
|
@@ -0,0 +1,187 @@
|
|
|
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.SegmentedFilter = exports.Period = exports.DollarsOrUnits = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _SegmentedButton = require("./components/SegmentedButton");
|
|
10
|
+
var arrSegmentedFilters = [{
|
|
11
|
+
value: "Total"
|
|
12
|
+
}, {
|
|
13
|
+
value: "Ecommerce"
|
|
14
|
+
}, {
|
|
15
|
+
value: "In Store"
|
|
16
|
+
}];
|
|
17
|
+
var arrDollarsOrUnits = [{
|
|
18
|
+
value: "Dollars"
|
|
19
|
+
}, {
|
|
20
|
+
value: "Units"
|
|
21
|
+
}];
|
|
22
|
+
var arrPeriod = [{
|
|
23
|
+
value: "52 w"
|
|
24
|
+
}, {
|
|
25
|
+
value: "26 w"
|
|
26
|
+
}, {
|
|
27
|
+
value: "13 w"
|
|
28
|
+
}];
|
|
29
|
+
var _default = {
|
|
30
|
+
title: "SAG/SegmentedButton",
|
|
31
|
+
component: _SegmentedButton.SegmentedButton,
|
|
32
|
+
tags: ["autodocs"],
|
|
33
|
+
argTypes: {
|
|
34
|
+
name: {
|
|
35
|
+
name: "name",
|
|
36
|
+
control: {
|
|
37
|
+
type: "text"
|
|
38
|
+
},
|
|
39
|
+
description: "name of the object"
|
|
40
|
+
},
|
|
41
|
+
backgroundColor: {
|
|
42
|
+
name: "backgroundColor",
|
|
43
|
+
description: "Sets Background Color",
|
|
44
|
+
control: {
|
|
45
|
+
type: "color",
|
|
46
|
+
presetColors: ["#ffffff", "#ff0000", "#00ff00", "#0000ff"]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
selectedSegmentColor: {
|
|
50
|
+
name: "selectedSegmentColor",
|
|
51
|
+
description: "Sets selected Segment Color Color",
|
|
52
|
+
control: {
|
|
53
|
+
type: "color",
|
|
54
|
+
presetColors: ["#ffffff", "#ff0000", "#00ff00", "#0000ff"]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
selectedTextColor: {
|
|
58
|
+
name: "selectedTextColor",
|
|
59
|
+
description: "Sets selected text Color",
|
|
60
|
+
control: {
|
|
61
|
+
type: "color",
|
|
62
|
+
presetColors: ["#000000", "#ffffff", "#ff0000", "#00ff00", "#0000ff"]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
unselectedTextColor: {
|
|
66
|
+
name: "unselectedTextColor",
|
|
67
|
+
description: "Sets unselected text Color",
|
|
68
|
+
control: {
|
|
69
|
+
type: "color",
|
|
70
|
+
presetColors: ["#000000", "#ffffff", "#ff0000", "#00ff00", "#0000ff"]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
defaultIndex: {
|
|
74
|
+
name: "defaultIndex",
|
|
75
|
+
control: {
|
|
76
|
+
type: "number",
|
|
77
|
+
min: 0,
|
|
78
|
+
max: 20
|
|
79
|
+
},
|
|
80
|
+
description: "set default index to init segmented button component (in px)"
|
|
81
|
+
},
|
|
82
|
+
segmentWidth: {
|
|
83
|
+
name: "segmentWidth",
|
|
84
|
+
control: {
|
|
85
|
+
type: "number",
|
|
86
|
+
min: 0,
|
|
87
|
+
max: 300
|
|
88
|
+
},
|
|
89
|
+
description: "width of the segment in the control (in px)"
|
|
90
|
+
},
|
|
91
|
+
controlRadius: {
|
|
92
|
+
name: "controlRadius",
|
|
93
|
+
control: {
|
|
94
|
+
type: "number",
|
|
95
|
+
min: 0,
|
|
96
|
+
max: 40
|
|
97
|
+
},
|
|
98
|
+
description: "radius of the control corners (in px) "
|
|
99
|
+
},
|
|
100
|
+
segmentRadius: {
|
|
101
|
+
name: "segmentRadius",
|
|
102
|
+
control: {
|
|
103
|
+
type: "number",
|
|
104
|
+
min: 0,
|
|
105
|
+
max: 40
|
|
106
|
+
},
|
|
107
|
+
description: "radius of the selected segment corners (in px)"
|
|
108
|
+
},
|
|
109
|
+
segmentHeigth: {
|
|
110
|
+
name: "segmentHeigth",
|
|
111
|
+
control: {
|
|
112
|
+
type: "number",
|
|
113
|
+
min: 0,
|
|
114
|
+
max: 100
|
|
115
|
+
},
|
|
116
|
+
description: "height of the segments "
|
|
117
|
+
},
|
|
118
|
+
fontSize: {
|
|
119
|
+
name: "fontSize",
|
|
120
|
+
control: {
|
|
121
|
+
type: "number",
|
|
122
|
+
min: 9,
|
|
123
|
+
max: 40
|
|
124
|
+
},
|
|
125
|
+
description: "font size (in px)"
|
|
126
|
+
},
|
|
127
|
+
options: {
|
|
128
|
+
description: "array [] of objects: {value: string } to fill segmented buttons "
|
|
129
|
+
},
|
|
130
|
+
onClick: {
|
|
131
|
+
action: "onClick",
|
|
132
|
+
description: "onClick event - returns an object of selected button {index: number, value: string} "
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
exports.default = _default;
|
|
137
|
+
var Template = function Template(args) {
|
|
138
|
+
return /*#__PURE__*/_react.default.createElement(_SegmentedButton.SegmentedButton, args);
|
|
139
|
+
};
|
|
140
|
+
var SegmentedFilter = Template.bind({});
|
|
141
|
+
exports.SegmentedFilter = SegmentedFilter;
|
|
142
|
+
SegmentedFilter.args = {
|
|
143
|
+
name: "segmentedFilter",
|
|
144
|
+
options: arrSegmentedFilters,
|
|
145
|
+
defaultIndex: 0,
|
|
146
|
+
segmentWidth: 120,
|
|
147
|
+
controlRadius: 8,
|
|
148
|
+
segmentRadius: 8,
|
|
149
|
+
segmentHeigth: 40,
|
|
150
|
+
fontSize: 14,
|
|
151
|
+
backgroundColor: "#ECF0FF",
|
|
152
|
+
selectedSegmentColor: '#fcfcfc',
|
|
153
|
+
selectedTextColor: '#000000',
|
|
154
|
+
unselectedTextColor: '#000000'
|
|
155
|
+
};
|
|
156
|
+
var DollarsOrUnits = Template.bind({});
|
|
157
|
+
exports.DollarsOrUnits = DollarsOrUnits;
|
|
158
|
+
DollarsOrUnits.args = {
|
|
159
|
+
name: "segmentedDollarsOrUnits",
|
|
160
|
+
options: arrDollarsOrUnits,
|
|
161
|
+
defaultIndex: 1,
|
|
162
|
+
segmentWidth: 100,
|
|
163
|
+
controlRadius: 8,
|
|
164
|
+
segmentRadius: 8,
|
|
165
|
+
segmentHeigth: 40,
|
|
166
|
+
fontSize: 14,
|
|
167
|
+
backgroundColor: "#ECF0FF",
|
|
168
|
+
selectedSegmentColor: 'rgba(61, 154, 242, 0.83)',
|
|
169
|
+
selectedTextColor: '#ffffff',
|
|
170
|
+
unselectedTextColor: '#000000'
|
|
171
|
+
};
|
|
172
|
+
var Period = Template.bind({});
|
|
173
|
+
exports.Period = Period;
|
|
174
|
+
Period.args = {
|
|
175
|
+
name: "period",
|
|
176
|
+
options: arrPeriod,
|
|
177
|
+
defaultIndex: 1,
|
|
178
|
+
segmentWidth: 60,
|
|
179
|
+
controlRadius: 8,
|
|
180
|
+
segmentRadius: 8,
|
|
181
|
+
segmentHeigth: 41,
|
|
182
|
+
fontSize: 14,
|
|
183
|
+
backgroundColor: "#ECF0FF",
|
|
184
|
+
selectedSegmentColor: 'rgba(61, 154, 242, 0.83)',
|
|
185
|
+
selectedTextColor: '#ffffff',
|
|
186
|
+
unselectedTextColor: '#000000'
|
|
187
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SegmentLabel = exports.Segment = exports.ControlsInput = exports.ControlsContainer = exports.Controls = 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;
|
|
11
|
+
var ControlsContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex; \n font: ", "; \n margin: 100px 0 25px;\n --highlight-width: auto;\n --highlight-x-pos: 0;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n"])), function (props) {
|
|
12
|
+
var _props$fontSize;
|
|
13
|
+
return (_props$fontSize = props.fontSize) === null || _props$fontSize === void 0 ? void 0 : _props$fontSize.toString().concat("", "px Lato, sans-serif");
|
|
14
|
+
});
|
|
15
|
+
exports.ControlsContainer = ControlsContainer;
|
|
16
|
+
var Controls = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: inline-flex;\n justify-content: space-between; \n background: ", ";\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);\n border-radius: ", "; //12px\n // max-width: 500px; //use this to limit max lenght of the control \n padding: 6px; \n margin: auto;\n overflow: hidden;\n position: relative;\n &.controls::before {\n content: \"\";\n background: ", "; /* #3a9df9; #5465ff;*/\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);\n border-radius: ", "; //12px\n width: var(--highlight-width);\n transform: translateX(var(--highlight-x-pos));\n position: absolute;\n top: 6px;\n bottom: 6px;\n left: 0;\n z-index: 0;\n }\n &.controls.ready::before {\n transition: transform 0.3s ease, width 0.3s ease;\n }\n"])), function (props) {
|
|
17
|
+
return props.backgroundColor;
|
|
18
|
+
}, function (props) {
|
|
19
|
+
return props.controlRadius.toString().concat("", "px");
|
|
20
|
+
}, function (props) {
|
|
21
|
+
return props.selectedSegmentColor;
|
|
22
|
+
}, function (props) {
|
|
23
|
+
return props.segmentRadius.toString().concat("", "px");
|
|
24
|
+
});
|
|
25
|
+
exports.Controls = Controls;
|
|
26
|
+
var ControlsInput = _styledComponents.default.input(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n opacity: 0;\n margin: 0;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n position: absolute;\n width: 100%;\n cursor: pointer;\n height: 100%;\n"])));
|
|
27
|
+
exports.ControlsInput = ControlsInput;
|
|
28
|
+
var Segment = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n /* width: 100%; uncomment for each segment to have matching width */ \n min-width: ", "; //120px;\n position: relative;\n text-align: center;\n z-index: 1; \n"])), function (props) {
|
|
29
|
+
return props.segmentWidth.toString().concat("", "px");
|
|
30
|
+
});
|
|
31
|
+
exports.Segment = Segment;
|
|
32
|
+
var SegmentLabel = _styledComponents.default.label(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n cursor: pointer;\n display: block;\n //font-weight: 550;\n padding: ", "; //10px;\n transition: color 0.5s ease;\n &.active {\n color: ", ";\n }\n &.inactive {\n color: ", ";\n }\n"])), function (props) {
|
|
33
|
+
return props.segmentHeigth.toString().concat("", "px");
|
|
34
|
+
}, function (props) {
|
|
35
|
+
return props.selectedTextColor;
|
|
36
|
+
}, function (props) {
|
|
37
|
+
return props.unselectedTextColor;
|
|
38
|
+
});
|
|
39
|
+
exports.SegmentLabel = SegmentLabel;
|
|
@@ -0,0 +1,59 @@
|
|
|
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.Button = void 0;
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
12
|
+
var _Stack = _interopRequireDefault(require("@mui/material/Stack"));
|
|
13
|
+
var _excluded = ["text", "shape", "size", "disabled", "radius", "textColor", "backgroundColor", "onClick"];
|
|
14
|
+
var Button = function Button(_ref) {
|
|
15
|
+
var text = _ref.text,
|
|
16
|
+
shape = _ref.shape,
|
|
17
|
+
size = _ref.size,
|
|
18
|
+
disabled = _ref.disabled,
|
|
19
|
+
radius = _ref.radius,
|
|
20
|
+
textColor = _ref.textColor,
|
|
21
|
+
backgroundColor = _ref.backgroundColor,
|
|
22
|
+
_onClick = _ref.onClick,
|
|
23
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
24
|
+
var getTextColor = function getTextColor() {
|
|
25
|
+
if (!textColor || textColor == "" || textColor == "none") {
|
|
26
|
+
//default when parameter was not set
|
|
27
|
+
if (shape === "contained") {
|
|
28
|
+
return "white";
|
|
29
|
+
} else {
|
|
30
|
+
return "black";
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
return textColor;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/React.createElement(_Stack.default, {
|
|
37
|
+
direction: "row",
|
|
38
|
+
spacing: 2
|
|
39
|
+
}, /*#__PURE__*/React.createElement(_Button.default, {
|
|
40
|
+
sx: {
|
|
41
|
+
textTransform: "none",
|
|
42
|
+
borderRadius: radius * 0.05,
|
|
43
|
+
color: getTextColor(),
|
|
44
|
+
// shape === "contained" ? "white" : "black",
|
|
45
|
+
backgroundColor: {
|
|
46
|
+
backgroundColor: backgroundColor
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
variant: shape,
|
|
50
|
+
size: size,
|
|
51
|
+
disabled: disabled ? true : false,
|
|
52
|
+
onClick: function onClick(event) {
|
|
53
|
+
_onClick(event);
|
|
54
|
+
}
|
|
55
|
+
}, text));
|
|
56
|
+
};
|
|
57
|
+
exports.Button = Button;
|
|
58
|
+
var _default = Button;
|
|
59
|
+
exports.default = _default;
|
|
@@ -0,0 +1,237 @@
|
|
|
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 = exports.Dropdown = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _DropdownStyle = require("../Dropdown.style.js");
|
|
13
|
+
var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete"));
|
|
14
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
15
|
+
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
16
|
+
var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
|
|
17
|
+
var _Icon = _interopRequireDefault(require("@mui/material/Icon"));
|
|
18
|
+
var _CheckBoxOutlineBlank = _interopRequireDefault(require("@mui/icons-material/CheckBoxOutlineBlank"));
|
|
19
|
+
var _CheckBox = _interopRequireDefault(require("@mui/icons-material/CheckBox"));
|
|
20
|
+
var _Search = _interopRequireDefault(require("@mui/icons-material/Search.js"));
|
|
21
|
+
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown.js"));
|
|
22
|
+
//import PropTypes from "prop-types";
|
|
23
|
+
|
|
24
|
+
// import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
25
|
+
// import { faChevronDown, faAsterisk } from "@fortawesome/free-solid-svg-icons";
|
|
26
|
+
var icon = /*#__PURE__*/_react.default.createElement(_CheckBoxOutlineBlank.default, {
|
|
27
|
+
fontSize: "small"
|
|
28
|
+
});
|
|
29
|
+
var checkedIcon = /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
|
|
30
|
+
fontSize: "small"
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* SAG Dropdown
|
|
35
|
+
*/
|
|
36
|
+
var Dropdown = function Dropdown(_ref) {
|
|
37
|
+
var width = _ref.width,
|
|
38
|
+
size = _ref.size,
|
|
39
|
+
text = _ref.text,
|
|
40
|
+
shape = _ref.shape,
|
|
41
|
+
placeHolder = _ref.placeHolder,
|
|
42
|
+
multiSelect = _ref.multiSelect,
|
|
43
|
+
limitTagsOnMultiSelect = _ref.limitTagsOnMultiSelect,
|
|
44
|
+
showPopupIcon = _ref.showPopupIcon,
|
|
45
|
+
showSearchIcon = _ref.showSearchIcon,
|
|
46
|
+
options = _ref.options,
|
|
47
|
+
onChange = _ref.onChange,
|
|
48
|
+
onInputChange = _ref.onInputChange;
|
|
49
|
+
/**
|
|
50
|
+
* SAG Dropdown
|
|
51
|
+
*/
|
|
52
|
+
var _useState = (0, _react.useState)(null),
|
|
53
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
54
|
+
currentInputValue = _useState2[0],
|
|
55
|
+
setCurrentInputValue = _useState2[1];
|
|
56
|
+
var _useState3 = (0, _react.useState)(null),
|
|
57
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
58
|
+
currentOption = _useState4[0],
|
|
59
|
+
setCurrentOption = _useState4[1];
|
|
60
|
+
(0, _react.useEffect)(function () {
|
|
61
|
+
var delayDebounceFn = setTimeout(function () {
|
|
62
|
+
onInputChange(currentInputValue);
|
|
63
|
+
}, 1000);
|
|
64
|
+
return function () {
|
|
65
|
+
return clearTimeout(delayDebounceFn);
|
|
66
|
+
};
|
|
67
|
+
}, [currentInputValue]);
|
|
68
|
+
|
|
69
|
+
//defines shape: squire or round
|
|
70
|
+
var getTextFieldStyle = function getTextFieldStyle() {
|
|
71
|
+
if (shape === "round") {
|
|
72
|
+
// round
|
|
73
|
+
return {
|
|
74
|
+
"& .MuiOutlinedInput-root": {
|
|
75
|
+
borderRadius: "50px",
|
|
76
|
+
legend: {
|
|
77
|
+
marginLeft: "30px"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"& .MuiAutocomplete-inputRoot": {
|
|
81
|
+
paddingLeft: "20px !important",
|
|
82
|
+
borderRadius: "50px"
|
|
83
|
+
},
|
|
84
|
+
"& .MuiInputLabel-outlined": {
|
|
85
|
+
paddingLeft: "20px"
|
|
86
|
+
},
|
|
87
|
+
"& .MuiInputLabel-shrink": {
|
|
88
|
+
marginLeft: "20px",
|
|
89
|
+
paddingLeft: "10px",
|
|
90
|
+
paddingRight: 0,
|
|
91
|
+
background: "white"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
} else {
|
|
95
|
+
//square
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var onInputChangeHandler = function onInputChangeHandler(event, newInputValue) {
|
|
100
|
+
setCurrentInputValue({
|
|
101
|
+
syntheticBaseEvent: event,
|
|
102
|
+
inputValue: newInputValue
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
var onChangeHandler = function onChangeHandler(event, newValue) {
|
|
106
|
+
setCurrentOption(newValue);
|
|
107
|
+
onChange(event, newValue);
|
|
108
|
+
};
|
|
109
|
+
var getAutocompleteSingle = function getAutocompleteSingle() {
|
|
110
|
+
return /*#__PURE__*/_react.default.createElement(_Autocomplete.default, {
|
|
111
|
+
onChange: function onChange(event, newValue) {
|
|
112
|
+
onChangeHandler(event, newValue);
|
|
113
|
+
},
|
|
114
|
+
onInputChange: function onInputChange(event, newInputValue) {
|
|
115
|
+
onInputChangeHandler(event, newInputValue);
|
|
116
|
+
},
|
|
117
|
+
disablePortal: true,
|
|
118
|
+
id: "combo-box",
|
|
119
|
+
options: options,
|
|
120
|
+
sx: {
|
|
121
|
+
width: width
|
|
122
|
+
},
|
|
123
|
+
popupIcon: showPopupIcon ? /*#__PURE__*/_react.default.createElement(_ArrowDropDown.default, null) : null,
|
|
124
|
+
forcePopupIcon: "auto",
|
|
125
|
+
renderInput: function renderInput(params) {
|
|
126
|
+
return /*#__PURE__*/_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
127
|
+
label: text,
|
|
128
|
+
size: size,
|
|
129
|
+
sx: getTextFieldStyle(),
|
|
130
|
+
placeholder: placeHolder,
|
|
131
|
+
InputProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params.InputProps), {}, {
|
|
132
|
+
startAdornment: showSearchIcon ? /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
133
|
+
position: "start"
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement(_Search.default, {
|
|
135
|
+
fontSize: "medium"
|
|
136
|
+
})) : null
|
|
137
|
+
})
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
var getAutocompleteMulti = function getAutocompleteMulti() {
|
|
143
|
+
return /*#__PURE__*/_react.default.createElement(_Autocomplete.default, {
|
|
144
|
+
onChange: function onChange(event, newValue) {
|
|
145
|
+
onChangeHandler(event, newValue);
|
|
146
|
+
},
|
|
147
|
+
onInputChange: function onInputChange(event, newInputValue) {
|
|
148
|
+
onInputChangeHandler(event, newInputValue);
|
|
149
|
+
},
|
|
150
|
+
multiple: true,
|
|
151
|
+
limitTags: limitTagsOnMultiSelect,
|
|
152
|
+
size: size,
|
|
153
|
+
id: "checkboxes-tags",
|
|
154
|
+
options: options,
|
|
155
|
+
disableCloseOnSelect: true,
|
|
156
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
157
|
+
return option.label;
|
|
158
|
+
},
|
|
159
|
+
popupIcon: showPopupIcon ? /*#__PURE__*/_react.default.createElement(_ArrowDropDown.default, null) : null,
|
|
160
|
+
renderOption: function renderOption(props, option, _ref2) {
|
|
161
|
+
var selected = _ref2.selected;
|
|
162
|
+
return /*#__PURE__*/_react.default.createElement("li", props, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
163
|
+
icon: icon,
|
|
164
|
+
checkedIcon: checkedIcon,
|
|
165
|
+
style: {
|
|
166
|
+
marginRight: 8
|
|
167
|
+
},
|
|
168
|
+
checked: selected
|
|
169
|
+
}), option.label);
|
|
170
|
+
},
|
|
171
|
+
style: {
|
|
172
|
+
width: width
|
|
173
|
+
},
|
|
174
|
+
renderInput: function renderInput(params) {
|
|
175
|
+
return showSearchIcon && (!currentOption || currentOption && currentOption.length === 0) ? /*#__PURE__*/_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
176
|
+
label: text,
|
|
177
|
+
size: size,
|
|
178
|
+
sx: getTextFieldStyle(),
|
|
179
|
+
placeholder: placeHolder,
|
|
180
|
+
InputProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params.InputProps), {}, {
|
|
181
|
+
startAdornment: /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
182
|
+
position: "start"
|
|
183
|
+
}, /*#__PURE__*/_react.default.createElement(_Search.default, {
|
|
184
|
+
fontSize: "medium"
|
|
185
|
+
}))
|
|
186
|
+
})
|
|
187
|
+
})) : /*#__PURE__*/_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
188
|
+
label: text,
|
|
189
|
+
size: size,
|
|
190
|
+
sx: getTextFieldStyle(),
|
|
191
|
+
placeholder: placeHolder
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
return /*#__PURE__*/_react.default.createElement(_DropdownStyle.DropdownContainer, {
|
|
197
|
+
width: width
|
|
198
|
+
}, multiSelect ? getAutocompleteMulti() : getAutocompleteSingle());
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// Dropdown.propTypes = {
|
|
202
|
+
// /**
|
|
203
|
+
// * dropdown width
|
|
204
|
+
// */
|
|
205
|
+
// width: PropTypes.string,
|
|
206
|
+
|
|
207
|
+
// /**
|
|
208
|
+
// * dropdown size: small/large
|
|
209
|
+
// */
|
|
210
|
+
// size: PropTypes.string,
|
|
211
|
+
|
|
212
|
+
// /**
|
|
213
|
+
// * dropdown initial input text
|
|
214
|
+
// */
|
|
215
|
+
// text: PropTypes.string,
|
|
216
|
+
|
|
217
|
+
// /**
|
|
218
|
+
// * arrayOf <T> - options array to load into dropdown
|
|
219
|
+
// */
|
|
220
|
+
// options: PropTypes.arrayOf,
|
|
221
|
+
|
|
222
|
+
// /**
|
|
223
|
+
// * shape: round/square
|
|
224
|
+
// */
|
|
225
|
+
// shape: PropTypes.string,
|
|
226
|
+
// };
|
|
227
|
+
|
|
228
|
+
// Dropdown.defaultProps = {
|
|
229
|
+
// width: 300,
|
|
230
|
+
// size: "small",
|
|
231
|
+
// text: "Select retailer...",
|
|
232
|
+
// options: [],
|
|
233
|
+
// shape: "round",
|
|
234
|
+
// };
|
|
235
|
+
exports.Dropdown = Dropdown;
|
|
236
|
+
var _default = Dropdown;
|
|
237
|
+
exports.default = _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
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.InfoIcon = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var InfoIcon = function InfoIcon(_ref) {
|
|
10
|
+
var clicked = _ref.clicked;
|
|
11
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
fill: "none",
|
|
15
|
+
stroke: clicked ? "white" : "black",
|
|
16
|
+
strokeWidth: "2",
|
|
17
|
+
strokeLinecap: "round",
|
|
18
|
+
strokeLinejoin: "round",
|
|
19
|
+
className: "feather feather-info"
|
|
20
|
+
}, /*#__PURE__*/_react.default.createElement("circle", {
|
|
21
|
+
cx: "12",
|
|
22
|
+
cy: "12",
|
|
23
|
+
r: "10"
|
|
24
|
+
}), /*#__PURE__*/_react.default.createElement("line", {
|
|
25
|
+
x1: "12",
|
|
26
|
+
y1: "16",
|
|
27
|
+
x2: "12",
|
|
28
|
+
y2: "12"
|
|
29
|
+
}), /*#__PURE__*/_react.default.createElement("line", {
|
|
30
|
+
x1: "12",
|
|
31
|
+
y1: "8",
|
|
32
|
+
x2: "12",
|
|
33
|
+
y2: "8"
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
exports.InfoIcon = InfoIcon;
|
|
37
|
+
var _default = InfoIcon;
|
|
38
|
+
exports.default = _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
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.OneColumnContainer = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _OneColumnContainer = require("../OneColumnContainer.style");
|
|
13
|
+
var _InfoIcon = require("./InfoIcon");
|
|
14
|
+
var _excluded = ["className", "ref", "width", "height", "infoText"];
|
|
15
|
+
/**
|
|
16
|
+
* Primary UI component for user interaction
|
|
17
|
+
*/
|
|
18
|
+
var OneColumnContainer = function OneColumnContainer(_ref) {
|
|
19
|
+
var className = _ref.className,
|
|
20
|
+
ref = _ref.ref,
|
|
21
|
+
width = _ref.width,
|
|
22
|
+
height = _ref.height,
|
|
23
|
+
infoText = _ref.infoText,
|
|
24
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
25
|
+
var _useState = (0, _react.useState)(false),
|
|
26
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
27
|
+
clicked = _useState2[0],
|
|
28
|
+
setClicked = _useState2[1];
|
|
29
|
+
var onInfoClick = function onInfoClick() {
|
|
30
|
+
setClicked(!clicked);
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_OneColumnContainer.StyledContainer, {
|
|
33
|
+
className: className,
|
|
34
|
+
ref: ref,
|
|
35
|
+
width: width,
|
|
36
|
+
height: height
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_OneColumnContainer.InfoTextContainer, {
|
|
38
|
+
clicked: clicked,
|
|
39
|
+
width: width,
|
|
40
|
+
height: height
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_OneColumnContainer.InfoTextLabel, null, infoText)), /*#__PURE__*/_react.default.createElement(_OneColumnContainer.IconContainer, {
|
|
42
|
+
onClick: onInfoClick
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_InfoIcon.InfoIcon, {
|
|
44
|
+
clicked: clicked
|
|
45
|
+
})));
|
|
46
|
+
};
|
|
47
|
+
exports.OneColumnContainer = OneColumnContainer;
|
|
48
|
+
OneColumnContainer.defaultProps = {};
|
|
49
|
+
var _default = OneColumnContainer;
|
|
50
|
+
exports.default = _default;
|