@desynova-digital/components 9.0.26 → 9.1.0
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/_helpers/globals.js +9 -10
- package/_helpers/pagination.js +10 -15
- package/_helpers/story-example.js +16 -39
- package/_helpers/story-helpers.js +15 -14
- package/_helpers/story-stack.js +22 -43
- package/_helpers/uniqueId.js +2 -5
- package/_helpers/utils.js +28 -4
- package/atoms/avatar/avatar.js +19 -42
- package/atoms/avatar/avatar.story.js +25 -58
- package/atoms/avatar/index.js +13 -11
- package/atoms/badge/badge.js +14 -37
- package/atoms/badge/badge.story.js +45 -103
- package/atoms/badge/index.js +12 -10
- package/atoms/button/button.js +85 -161
- package/atoms/button/button.story.js +354 -508
- package/atoms/button/index.js +5 -9
- package/atoms/card/card.js +26 -55
- package/atoms/card/card.story.js +39 -88
- package/atoms/card/index.js +12 -10
- package/atoms/cardStack/cardStack.js +88 -147
- package/atoms/cardStack/cardStack.story.js +106 -210
- package/atoms/cardStack/index.js +12 -10
- package/atoms/cardV2/cardV2.js +57 -106
- package/atoms/cardV2/cardV2.story.js +184 -232
- package/atoms/cardV2/content.js +154 -256
- package/atoms/cardV2/index.js +4 -8
- package/atoms/cardV2/thumbnail.js +138 -208
- package/atoms/cardV2/timeline.js +167 -123
- package/atoms/checkbox/checkbox.js +85 -157
- package/atoms/checkbox/checkbox.story.js +237 -365
- package/atoms/checkbox/index.js +4 -9
- package/atoms/customSelect/customSelect.js +136 -215
- package/atoms/customSelect/customSelect.story.js +745 -851
- package/atoms/customSelect/index.js +4 -8
- package/atoms/datePicker/datePicker.js +299 -431
- package/atoms/datePicker/datePicker.story.js +453 -501
- package/atoms/datePicker/index.js +4 -8
- package/atoms/dateTime/dateTime.js +3 -6
- package/atoms/dateTime/dateTime.story.js +17 -63
- package/atoms/dateTime/index.js +5 -9
- package/atoms/draftInputText/draftInputText.js +121 -189
- package/atoms/draftInputText/draftInputText.story.js +200 -249
- package/atoms/draftInputText/index.js +5 -9
- package/atoms/dropdown/dropdown.js +38 -66
- package/atoms/dropdown/dropdown.story.js +102 -262
- package/atoms/dropdown/index.js +4 -8
- package/atoms/dropdownList/dropdownList.js +78 -108
- package/atoms/dropdownList/dropdownList.story.js +1546 -1621
- package/atoms/dropdownList/index.js +4 -8
- package/atoms/graphs/barGraph/barGraph.js +95 -146
- package/atoms/graphs/barGraph/barGraph.story.js +65 -87
- package/atoms/graphs/barGraph/index.js +4 -8
- package/atoms/graphs/circleDonut/circleDonut.js +177 -229
- package/atoms/graphs/circleDonut/circleDonut.story.js +328 -394
- package/atoms/graphs/circleDonut/index.js +5 -9
- package/atoms/graphs/circleGraph/circleGraph.js +60 -90
- package/atoms/graphs/circleGraph/circleGraph.story.js +36 -54
- package/atoms/graphs/circleGraph/index.js +4 -8
- package/atoms/graphs/circleNested/circleNested.js +216 -262
- package/atoms/graphs/circleNested/circleNested.story.js +91 -116
- package/atoms/graphs/circleNested/index.js +5 -9
- package/atoms/graphs/pieChart/index.js +4 -8
- package/atoms/graphs/pieChart/pieChart.js +162 -191
- package/atoms/graphs/pieChart/pieChart.story.js +147 -176
- package/atoms/graphs/verticalBarGraph/index.js +5 -9
- package/atoms/graphs/verticalBarGraph/verticalBarGraph.js +75 -98
- package/atoms/graphs/verticalBarGraph/verticalBarGraph.story.js +26 -45
- package/atoms/icon/icon.js +41 -72
- package/atoms/icon/icon.story.js +831 -260
- package/atoms/icon/index.js +19 -12
- package/atoms/image/image.js +18 -32
- package/atoms/image/image.story.js +10 -19
- package/atoms/image/index.js +4 -8
- package/atoms/inputText/index.js +4 -8
- package/atoms/inputText/inputText.js +86 -131
- package/atoms/inputText/inputText.story.js +191 -255
- package/atoms/label/index.js +4 -8
- package/atoms/label/label.js +25 -50
- package/atoms/label/label.story.js +42 -83
- package/atoms/loader/CircleLoader.js +29 -63
- package/atoms/loader/ShimmerComponent/CollabShimmerCard.js +39 -50
- package/atoms/loader/ShimmerComponent/CollabShimmerCardTray.js +41 -42
- package/atoms/loader/ShimmerComponent/FiltersShimmer.js +30 -30
- package/atoms/loader/ShimmerComponent/GraphDetailShimmer.js +21 -34
- package/atoms/loader/ShimmerComponent/GraphTitleShimmer.js +30 -34
- package/atoms/loader/ShimmerComponent/GraphsComponentShimmer.js +23 -32
- package/atoms/loader/ShimmerComponent/Shimmer.js +24 -32
- package/atoms/loader/ThreeDotLoader.js +14 -29
- package/atoms/loader/index.js +13 -11
- package/atoms/loader/loader.js +34 -58
- package/atoms/loader/loader.story.js +48 -52
- package/atoms/loader/spinningLoader.js +23 -34
- package/atoms/popup/index.js +5 -9
- package/atoms/popup/popup.js +123 -208
- package/atoms/popup/popup.story.js +97 -131
- package/atoms/radio/index.js +18 -11
- package/atoms/radio/radio.js +58 -112
- package/atoms/radio/radio.story.js +197 -420
- package/atoms/select/index.js +4 -8
- package/atoms/select/select.js +48 -86
- package/atoms/sideBar/index.js +5 -9
- package/atoms/sideBar/sidebar.js +89 -140
- package/atoms/switch/index.js +4 -8
- package/atoms/switch/switch.js +56 -86
- package/atoms/switch/switch.story.js +268 -415
- package/atoms/tag/index.js +12 -10
- package/atoms/tag/tag.js +29 -63
- package/atoms/tag/tag.story.js +135 -209
- package/atoms/textarea/index.js +5 -9
- package/atoms/textarea/textarea.js +55 -99
- package/atoms/textarea/textarea.story.js +48 -41
- package/atoms/thematicBreak/index.js +12 -10
- package/atoms/thematicBreak/thematicBreak.js +20 -38
- package/atoms/thematicBreak/thematicBreak.story.js +25 -37
- package/atoms/timeCodeInput/index.js +4 -8
- package/atoms/timeCodeInput/timCodeInput.story.js +21 -35
- package/atoms/timeCodeInput/timeCodeInput.js +33 -51
- package/atoms/timer/index.js +5 -9
- package/atoms/timer/timer.js +57 -108
- package/atoms/timer/timer.story.js +13 -26
- package/atoms/toast/index.js +5 -9
- package/atoms/toast/toast.js +81 -116
- package/atoms/toast/toast.story.js +50 -76
- package/atoms/videoCard/index.js +12 -10
- package/atoms/videoCard/videoCard.js +265 -447
- package/atoms/videoCard/videoCard.story.js +495 -710
- package/components.js +411 -294
- package/index.js +350 -61
- package/molecules/carousel/carousel.js +121 -207
- package/molecules/carousel/carousel.story.js +240 -223
- package/molecules/carousel/index.js +5 -9
- package/molecules/errorScreen/CollabErrorScreen.js +35 -66
- package/molecules/errorScreen/TableErrorScreen.js +109 -102
- package/molecules/errorScreen/TableErrorScreen.jsx +7 -6
- package/molecules/errorScreen/errorScreen.js +41 -94
- package/molecules/filter/constants.js +1 -0
- package/molecules/filter/filter.js +378 -562
- package/molecules/filter/filter.story.js +79 -104
- package/molecules/filter/index.js +5 -9
- package/molecules/graphCard/graphCard.js +97 -193
- package/molecules/graphCard/graphCard.story.js +159 -191
- package/molecules/graphCard/index.js +4 -8
- package/molecules/graphCard/loader.js +28 -68
- package/molecules/graphDetailCard/graphDetailCard.js +115 -183
- package/molecules/graphDetailCard/graphDetailCard.story.js +218 -254
- package/molecules/graphDetailCard/index.js +5 -9
- package/molecules/pageHeader/index.js +12 -10
- package/molecules/pageHeader/pageHeader.js +38 -79
- package/molecules/pageHeader/pageHeader.story.js +34 -55
- package/molecules/pagination/index.js +4 -8
- package/molecules/pagination/pagination.js +126 -202
- package/molecules/pagination/pagination.story.js +40 -52
- package/molecules/richTextInput/RichTextInput.js +354 -0
- package/molecules/richTextInput/RichTextInput.story.js +50 -0
- package/molecules/richTextInput/index.js +9 -0
- package/molecules/table/index.js +4 -8
- package/molecules/table/table-column.js +10 -16
- package/molecules/table/table-header.js +31 -72
- package/molecules/table/table.js +743 -1075
- package/molecules/table/table.story.js +274 -304
- package/molecules/tabs/index.js +4 -8
- package/molecules/tabs/tabs.js +112 -184
- package/molecules/tabs/tabs.story.js +66 -133
- package/molecules/videoCardList/index.js +4 -8
- package/molecules/videoCardList/videoCardList.js +24 -41
- package/molecules/videoCardList/videoCardList.story.js +449 -664
- package/molecules/videoPlayer/index.js +4 -8
- package/molecules/videoPlayer/videoPlayer.js +1019 -1097
- package/molecules/videoPlayer/videoPlayer.story.js +10 -21
- package/package.json +2 -2
|
@@ -1,51 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
var _tag2 = _interopRequireDefault(_tag);
|
|
31
|
-
|
|
32
|
-
var _dropdownList = require('../dropdownList');
|
|
33
|
-
|
|
34
|
-
var _dropdownList2 = _interopRequireDefault(_dropdownList);
|
|
35
|
-
|
|
36
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
-
|
|
38
|
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
39
|
-
|
|
40
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
41
|
-
|
|
42
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
43
|
-
|
|
44
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
45
|
-
|
|
46
|
-
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
47
|
-
|
|
48
|
-
var CustomSelectContorl = _styledComponents2.default.div(_templateObject, function (props) {
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
20
|
+
var _tokens = require("@desynova-digital/tokens");
|
|
21
|
+
var _tag = _interopRequireDefault(require("../tag"));
|
|
22
|
+
var _dropdownList = _interopRequireDefault(require("../dropdownList"));
|
|
23
|
+
var _templateObject, _templateObject2;
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
26
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
29
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
30
|
+
var CustomSelectContorl = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n\n.form-input input{ \n width: 100%;\n box-sizing: border-box;\n\n background: ", ";\n\n border:none;\n border-radius:0px;\n -webkit-appearance: none;\n border-bottom: 1px solid ", ";\n\n\n font-family: inherit;\n color: ", ";\n\n\n cursor: ", ";\n\n font-size:14px;\n padding:7px 15px 2px 0px;\n margin-top:15px;\n \n display:block;\n\n &:hover {\n border-color: ", ";\n }\n &:disabled:hover {\n border-color: ", ";\n }\n &:disabled {\n border-color: ", ";\n color: ", ";\n }\n &:focus { \n outline: none;\n }\n &::placeholder {\n\n color: ", ";\n\n opacity: ", "; /* Firefox */\n transition:0.2s ease all; \n }\n\n &:focus::placeholder {\n\n color: ", ";\n\n opacity: ", ";\n }\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n.dropdownbox{\n display: block;\n position: relative;\n min-height: 21px;\n font-family: SFUIText-Regular;\n}\n.dropdown-options{\n margin-left: auto;\n margin-right: auto;\n display: none;\n background:", ";\n color:", "; \n}\n.dropdownbox.open .dropdown-options{\n display: block;\n position: absolute;\n left:0px;\n z-index:1;\n width:100%;\n top:", "; \n}\n.dropdownbox.open .selected-chips{\n display: none;\n}\n\n.dropdownbox.open .form-input input{\n //display: none;\n visibility: hidden;\n}\n\n.dropdownbox .form-input input{\n display: block;\n}\n\n.dropdownbox .form-input label{\n display: block;\n}\n\n.form-input {\n background: transparent;\n font-family: 'SFUIText-Medium';\n position: relative;\n width: 100%;\n}\n\n\n.form-input label,\n.open .form-input label,\n.open .form-input label.floaton{\n color: ", "; \n font-size:14px;\n\n font-family: inherit;\n position:absolute;\n pointer-events:none;\n text-transform: none;\n left: 0px;\n top: 5px;\n transition:0.2s ease all; \n -moz-transition:0.2s ease all; \n -webkit-transition:0.2s ease all;\n}\n\n\n.form-input label.floaton{\n top:-5px;\n left: 0px;\n font-size:10px;\n color:", ";\n text-transform: uppercase;\n}\n.open .chip-selection-box{\n display:none;\n}\n\n\n\n.dropdown-options-box{\n max-height: 200px;\n overflow: auto;\n border: 1px solid #ddd;\n border-left: 0px;\n border-right: 0px;\n}\n\n.dropdown-options .search-input{\n position:absolute;\n width:100%;\n & .loading{\n position: absolute;\n top: 7px;\n right: 5px;\n }\n}\n\n.dropdown-options .search-input input{\n width:100%;\n}\n\n\n\n.chip-selection-box{\n overflow-y: auto;\n padding-top:10px;\n\n}\n.selected-chips{\n text-align: left;\n border: 1px solid ", ";;\n padding: 10px 10px 5px;\n}\n.selected-chips:hover{\n border: 1px solid ", ";;\n}\n\n"])), function (props) {
|
|
49
31
|
return _tokens.colors[props.theme].inputCommon.background;
|
|
50
32
|
}, function (props) {
|
|
51
33
|
if (props.error) {
|
|
@@ -98,32 +80,24 @@ var CustomSelectContorl = _styledComponents2.default.div(_templateObject, functi
|
|
|
98
80
|
}, function (props) {
|
|
99
81
|
return _tokens.colors[props.theme].customSelect.chipSelectionBox.borderHover;
|
|
100
82
|
});
|
|
101
|
-
|
|
102
|
-
var InputError = _styledComponents2.default.span(_templateObject2, function (props) {
|
|
83
|
+
var InputError = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n padding-top: 5px;\n display: inline-block;\n font-size: 13px;\n font-family: inherit;\n width: 100%;\n text-align: left;\n"])), function (props) {
|
|
103
84
|
return _tokens.colors[props.theme].inputError.color;
|
|
104
85
|
});
|
|
105
|
-
|
|
106
|
-
var CustomSelect = function (_Component) {
|
|
107
|
-
_inherits(CustomSelect, _Component);
|
|
108
|
-
|
|
86
|
+
var CustomSelect = /*#__PURE__*/function (_Component) {
|
|
109
87
|
function CustomSelect(props) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
_this.setSelection = function (selectedObj, selectedElement, groupLabel) {
|
|
88
|
+
var _this;
|
|
89
|
+
(0, _classCallCheck2["default"])(this, CustomSelect);
|
|
90
|
+
_this = _callSuper(this, CustomSelect, [props]);
|
|
91
|
+
(0, _defineProperty2["default"])(_this, "setSelection", function (selectedObj, selectedElement, groupLabel) {
|
|
115
92
|
if (_this.checkIfSelectable(selectedElement.className)) {
|
|
116
93
|
if (_this.props.type === "multiselect") {
|
|
117
|
-
|
|
118
94
|
if (selectedElement.className.split("selected").length > 1) {
|
|
119
95
|
var filterItems = _this.state.selected.filter(function (selectedItem) {
|
|
120
96
|
return JSON.stringify(selectedObj) !== JSON.stringify(selectedItem);
|
|
121
97
|
});
|
|
122
|
-
|
|
123
98
|
_this.setState({
|
|
124
99
|
selected: filterItems
|
|
125
100
|
}, function () {
|
|
126
|
-
|
|
127
101
|
if (_this.searchInput && _this.searchInput.current) {
|
|
128
102
|
_this.searchInput.current.value = '';
|
|
129
103
|
}
|
|
@@ -138,7 +112,6 @@ var CustomSelect = function (_Component) {
|
|
|
138
112
|
selected: prevState.selected.concat(selectedObj)
|
|
139
113
|
};
|
|
140
114
|
}, function () {
|
|
141
|
-
|
|
142
115
|
if (_this.searchInput && _this.searchInput.current) {
|
|
143
116
|
_this.searchInput.current.value = '';
|
|
144
117
|
}
|
|
@@ -153,7 +126,7 @@ var CustomSelect = function (_Component) {
|
|
|
153
126
|
} else {
|
|
154
127
|
_this.setState(function (prevState) {
|
|
155
128
|
return {
|
|
156
|
-
selected: [
|
|
129
|
+
selected: [_objectSpread({}, selectedObj)]
|
|
157
130
|
};
|
|
158
131
|
}, function () {
|
|
159
132
|
if (_this.searchInput && _this.searchInput.current) {
|
|
@@ -166,9 +139,8 @@ var CustomSelect = function (_Component) {
|
|
|
166
139
|
}
|
|
167
140
|
}
|
|
168
141
|
}
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
_this.handleKeyPress = function (event) {
|
|
142
|
+
});
|
|
143
|
+
(0, _defineProperty2["default"])(_this, "handleKeyPress", function (event) {
|
|
172
144
|
var noOfSelectable = document.querySelectorAll('.open .dropdown-options .selectable').length;
|
|
173
145
|
if (event.key === 'ArrowDown') {
|
|
174
146
|
if (_this.focusItem < noOfSelectable - 1) {
|
|
@@ -184,26 +156,24 @@ var CustomSelect = function (_Component) {
|
|
|
184
156
|
document.querySelectorAll('.open .dropdown-options .selectable:focus')[0].click();
|
|
185
157
|
_this.handleClick();
|
|
186
158
|
}
|
|
187
|
-
};
|
|
188
|
-
|
|
159
|
+
});
|
|
189
160
|
_this.state = {
|
|
190
161
|
options: props.options,
|
|
191
|
-
selected: _this.props.defaultSelected ? []
|
|
162
|
+
selected: _this.props.defaultSelected ? (0, _toConsumableArray2["default"])(_this.props.defaultSelected) : [],
|
|
192
163
|
selectedLabel: '',
|
|
193
164
|
popupVisible: false
|
|
194
165
|
};
|
|
195
166
|
_this.focusItem = -1;
|
|
196
|
-
_this.searchInput =
|
|
167
|
+
_this.searchInput = /*#__PURE__*/_react["default"].createRef();
|
|
197
168
|
_this.handleClick = _this.handleClick.bind(_this);
|
|
198
169
|
_this.handleOutsideClick = _this.handleOutsideClick.bind(_this);
|
|
199
170
|
_this.searchTextChange = _this.searchTextChange.bind(_this);
|
|
200
171
|
_this.setSelection = _this.setSelection.bind(_this);
|
|
201
|
-
|
|
202
172
|
return _this;
|
|
203
173
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
key:
|
|
174
|
+
(0, _inherits2["default"])(CustomSelect, _Component);
|
|
175
|
+
return (0, _createClass2["default"])(CustomSelect, [{
|
|
176
|
+
key: "handleClick",
|
|
207
177
|
value: function handleClick() {
|
|
208
178
|
if (!this.state.popupVisible) {
|
|
209
179
|
// attach/remove event handler
|
|
@@ -214,7 +184,6 @@ var CustomSelect = function (_Component) {
|
|
|
214
184
|
document.removeEventListener('click', this.handleOutsideClick, false);
|
|
215
185
|
document.removeEventListener('keydown', this.handleKeyPress, false);
|
|
216
186
|
}
|
|
217
|
-
|
|
218
187
|
this.setState(function (prevState) {
|
|
219
188
|
return {
|
|
220
189
|
popupVisible: !prevState.popupVisible
|
|
@@ -222,7 +191,7 @@ var CustomSelect = function (_Component) {
|
|
|
222
191
|
});
|
|
223
192
|
}
|
|
224
193
|
}, {
|
|
225
|
-
key:
|
|
194
|
+
key: "handleOutsideClick",
|
|
226
195
|
value: function handleOutsideClick(e) {
|
|
227
196
|
// ignore clicks on the component itself
|
|
228
197
|
if (this.state.node) {
|
|
@@ -230,11 +199,10 @@ var CustomSelect = function (_Component) {
|
|
|
230
199
|
return;
|
|
231
200
|
}
|
|
232
201
|
}
|
|
233
|
-
|
|
234
202
|
this.handleClick();
|
|
235
203
|
}
|
|
236
204
|
}, {
|
|
237
|
-
key:
|
|
205
|
+
key: "checkIfSelectable",
|
|
238
206
|
value: function checkIfSelectable(classes) {
|
|
239
207
|
if (classes.split("selectable").length > 1) {
|
|
240
208
|
return true;
|
|
@@ -243,7 +211,7 @@ var CustomSelect = function (_Component) {
|
|
|
243
211
|
}
|
|
244
212
|
}
|
|
245
213
|
}, {
|
|
246
|
-
key:
|
|
214
|
+
key: "searchTextChange",
|
|
247
215
|
value: function searchTextChange(newText) {
|
|
248
216
|
var minchar = this.props.minchar ? this.props.minchar : 0;
|
|
249
217
|
if (this.searchInput && this.searchInput.current) {
|
|
@@ -253,10 +221,9 @@ var CustomSelect = function (_Component) {
|
|
|
253
221
|
}
|
|
254
222
|
}
|
|
255
223
|
}, {
|
|
256
|
-
key:
|
|
224
|
+
key: "deleteSelection",
|
|
257
225
|
value: function deleteSelection(delSelection) {
|
|
258
226
|
var _this2 = this;
|
|
259
|
-
|
|
260
227
|
var filterItems = this.state.selected.filter(function (selectedItem) {
|
|
261
228
|
return JSON.stringify(delSelection) !== JSON.stringify(selectedItem);
|
|
262
229
|
});
|
|
@@ -264,157 +231,111 @@ var CustomSelect = function (_Component) {
|
|
|
264
231
|
selected: filterItems
|
|
265
232
|
}, function () {
|
|
266
233
|
if (_this2.searchInput && _this2.searchInput.current) _this2.searchInput.current.value = '';
|
|
267
|
-
|
|
268
234
|
_this2.props.selectionChangeCallback(_this2.state.selected, _this2.state.selected.map(function (item) {
|
|
269
235
|
return item.data;
|
|
270
236
|
}));
|
|
271
237
|
});
|
|
272
238
|
}
|
|
273
239
|
}, {
|
|
274
|
-
key:
|
|
240
|
+
key: "render",
|
|
275
241
|
value: function render() {
|
|
276
242
|
var _this3 = this;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
_react2.default.createElement(
|
|
367
|
-
'div',
|
|
368
|
-
{ className: "dropdown-options", ref: function ref(node) {
|
|
369
|
-
_this3.state.node = node;
|
|
370
|
-
} },
|
|
371
|
-
this.props.searchable ? _react2.default.createElement(
|
|
372
|
-
'div',
|
|
373
|
-
{ className: 'search-input' },
|
|
374
|
-
_react2.default.createElement('input', {
|
|
375
|
-
type: 'text',
|
|
376
|
-
placeholder: 'search...',
|
|
377
|
-
ref: this.searchInput,
|
|
378
|
-
onChange: function onChange(e) {
|
|
379
|
-
return _this3.searchTextChange(e.target.value);
|
|
380
|
-
} }),
|
|
381
|
-
this.props.loadingOption ? _react2.default.createElement(
|
|
382
|
-
'div',
|
|
383
|
-
{ className: "loading" },
|
|
384
|
-
'*'
|
|
385
|
-
) : null
|
|
386
|
-
) : '',
|
|
387
|
-
_react2.default.createElement(
|
|
388
|
-
'div',
|
|
389
|
-
{ className: "dropdown-options-box" },
|
|
390
|
-
_react2.default.createElement(_dropdownList2.default, {
|
|
391
|
-
theme: this.props.theme,
|
|
392
|
-
options: this.props.loadingOption ? [{
|
|
393
|
-
type: 'disabled',
|
|
394
|
-
value: '',
|
|
395
|
-
label: 'Working...',
|
|
396
|
-
display: 'item'
|
|
397
|
-
}] : this.props.options,
|
|
398
|
-
selectedOptions: this.state.selected,
|
|
399
|
-
itemOnClick: this.setSelection,
|
|
400
|
-
keyboardAction: this.props.keyboardAction
|
|
401
|
-
})
|
|
402
|
-
)
|
|
403
|
-
)
|
|
404
|
-
)
|
|
405
|
-
);
|
|
243
|
+
return /*#__PURE__*/_react["default"].createElement(CustomSelectContorl, {
|
|
244
|
+
theme: this.props.theme,
|
|
245
|
+
type: this.props.type,
|
|
246
|
+
error: this.props.error,
|
|
247
|
+
label: this.props.label && this.props.label.length ? this.props.label : false
|
|
248
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
249
|
+
className: this.state.popupVisible ? "dropdownbox open" : "dropdownbox"
|
|
250
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
251
|
+
className: "dropdown-action"
|
|
252
|
+
}, this.props.type === "multiselect" ? this.state.selected.length < 1 ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
253
|
+
className: "form-input"
|
|
254
|
+
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
255
|
+
className: this.state.selected.length > 0 ? 'floaton' : ''
|
|
256
|
+
}, this.props.label), /*#__PURE__*/_react["default"].createElement("input", {
|
|
257
|
+
name: this.props.name,
|
|
258
|
+
type: "text",
|
|
259
|
+
placeholder: this.props.placeholder,
|
|
260
|
+
onClick: this.handleClick,
|
|
261
|
+
theme: this.props.theme,
|
|
262
|
+
label: this.props.label && this.props.label.length ? this.props.label : false
|
|
263
|
+
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
264
|
+
className: "form-input"
|
|
265
|
+
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
266
|
+
className: this.state.selected.length > 0 ? 'floaton' : ''
|
|
267
|
+
}, this.props.label), /*#__PURE__*/_react["default"].createElement("div", {
|
|
268
|
+
className: "chip-selection-box",
|
|
269
|
+
onClick: this.handleClick
|
|
270
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
271
|
+
className: "selected-chips"
|
|
272
|
+
}, /*#__PURE__*/_react["default"].createElement(_tag["default"].Group, {
|
|
273
|
+
theme: this.props.theme
|
|
274
|
+
}, this.state.selected.map(function (selectedoption, index) {
|
|
275
|
+
return /*#__PURE__*/_react["default"].createElement(_tag["default"], {
|
|
276
|
+
theme: _this3.props.theme,
|
|
277
|
+
key: selectedoption.value,
|
|
278
|
+
onRemove: function onRemove(evt) {
|
|
279
|
+
_this3.deleteSelection(selectedoption);
|
|
280
|
+
}
|
|
281
|
+
}, (selectedoption.groupLabel.length > 0 ? selectedoption.groupLabel + ": " : '') + selectedoption.label);
|
|
282
|
+
}))))) : this.props.type === "select" ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
283
|
+
className: "form-input"
|
|
284
|
+
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
285
|
+
className: this.state.selected.length > 0 ? 'floaton' : ''
|
|
286
|
+
}, this.props.label), /*#__PURE__*/_react["default"].createElement("input", {
|
|
287
|
+
ref: this.searchInput,
|
|
288
|
+
type: "text",
|
|
289
|
+
placeholder: this.props.placeholder,
|
|
290
|
+
onClick: this.handleClick,
|
|
291
|
+
name: this.props.name,
|
|
292
|
+
required: this.props.required
|
|
293
|
+
// value={(this.state.selected[0])?((groupLabel.length > 0)? groupLabel+' - ':'') +this.state.selected[0].label:''}
|
|
294
|
+
,
|
|
295
|
+
value: this.searchInput.current ? this.searchInput.current.value : '',
|
|
296
|
+
theme: this.props.theme,
|
|
297
|
+
label: this.props.label && this.props.label.length ? this.props.label : false
|
|
298
|
+
}), !this.state.popupVisible && this.props.error && this.props.error.length > 0 ? /*#__PURE__*/_react["default"].createElement(InputError, {
|
|
299
|
+
theme: this.props.theme
|
|
300
|
+
}, this.props.error) : '') : /*#__PURE__*/_react["default"].createElement("div", {
|
|
301
|
+
onClick: this.handleClick
|
|
302
|
+
}, this.props.children)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
303
|
+
className: "dropdown-options",
|
|
304
|
+
ref: function ref(node) {
|
|
305
|
+
_this3.state.node = node;
|
|
306
|
+
}
|
|
307
|
+
}, this.props.searchable ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
308
|
+
className: "search-input"
|
|
309
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
310
|
+
type: "text",
|
|
311
|
+
placeholder: "search...",
|
|
312
|
+
ref: this.searchInput,
|
|
313
|
+
onChange: function onChange(e) {
|
|
314
|
+
return _this3.searchTextChange(e.target.value);
|
|
315
|
+
}
|
|
316
|
+
}), this.props.loadingOption ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
317
|
+
className: "loading"
|
|
318
|
+
}, "*") : null) : '', /*#__PURE__*/_react["default"].createElement("div", {
|
|
319
|
+
className: "dropdown-options-box"
|
|
320
|
+
}, /*#__PURE__*/_react["default"].createElement(_dropdownList["default"], {
|
|
321
|
+
theme: this.props.theme,
|
|
322
|
+
options: this.props.loadingOption ? [{
|
|
323
|
+
type: 'disabled',
|
|
324
|
+
value: '',
|
|
325
|
+
label: 'Working...',
|
|
326
|
+
display: 'item'
|
|
327
|
+
}] : this.props.options,
|
|
328
|
+
selectedOptions: this.state.selected,
|
|
329
|
+
itemOnClick: this.setSelection,
|
|
330
|
+
keyboardAction: this.props.keyboardAction
|
|
331
|
+
})))));
|
|
406
332
|
}
|
|
407
333
|
}]);
|
|
408
|
-
|
|
409
|
-
return CustomSelect;
|
|
410
334
|
}(_react.Component);
|
|
411
|
-
|
|
412
335
|
;
|
|
413
|
-
|
|
414
336
|
CustomSelect.defaultProps = {
|
|
415
337
|
theme: 'light',
|
|
416
338
|
keyboardAction: true,
|
|
417
339
|
loadingOption: false
|
|
418
340
|
};
|
|
419
|
-
|
|
420
|
-
exports.default = CustomSelect;
|
|
341
|
+
var _default = exports["default"] = CustomSelect;
|