wini-web-components 2.6.0 → 2.6.1

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.
Files changed (34) hide show
  1. package/dist/component/button/button.js +9 -29
  2. package/dist/component/calendar/calendar.js +140 -173
  3. package/dist/component/checkbox/checkbox.js +26 -56
  4. package/dist/component/ck-editor/ckeditor.js +18 -29
  5. package/dist/component/component-status.js +6 -6
  6. package/dist/component/date-picker/date-picker.js +141 -174
  7. package/dist/component/dialog/dialog.js +37 -67
  8. package/dist/component/import-file/import-file.js +67 -106
  9. package/dist/component/infinite-scroll/infinite-scroll.js +17 -83
  10. package/dist/component/input-multi-select/input-multi-select.js +102 -178
  11. package/dist/component/input-otp/input-otp.js +29 -69
  12. package/dist/component/number-picker/number-picker.js +21 -33
  13. package/dist/component/pagination/pagination.js +19 -22
  14. package/dist/component/popup/popup.d.ts +2 -1
  15. package/dist/component/popup/popup.js +44 -70
  16. package/dist/component/progress-bar/progress-bar.js +12 -24
  17. package/dist/component/progress-circle/progress-circle.js +8 -19
  18. package/dist/component/radio-button/radio-button.js +11 -42
  19. package/dist/component/rating/rating.js +29 -48
  20. package/dist/component/select1/select1.js +91 -160
  21. package/dist/component/slider/slider.js +36 -54
  22. package/dist/component/switch/switch.js +22 -52
  23. package/dist/component/table/table.js +36 -89
  24. package/dist/component/tag/tag.js +8 -28
  25. package/dist/component/text/text.js +9 -40
  26. package/dist/component/text-area/text-area.js +12 -41
  27. package/dist/component/text-field/text-field.js +17 -47
  28. package/dist/component/toast-noti/toast-noti.js +7 -10
  29. package/dist/component/wini-icon/winicon.js +55 -113
  30. package/dist/form/login/view.js +28 -28
  31. package/dist/index.js +1 -1
  32. package/dist/index.js.LICENSE.txt +1 -11
  33. package/dist/language/i18n.js +4 -4
  34. package/package.json +1 -1
@@ -1,73 +1,54 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
4
  };
20
5
  Object.defineProperty(exports, "__esModule", { value: true });
21
6
  exports.Rating = void 0;
22
- var react_1 = __importDefault(require("react"));
23
- var rating_module_css_1 = __importDefault(require("./rating.module.css"));
24
- var autoKeyId = function () { return window.crypto.randomUUID().replace(/-/g, ''); };
25
- var Rating = /** @class */ (function (_super) {
26
- __extends(Rating, _super);
27
- function Rating() {
7
+ const react_1 = __importDefault(require("react"));
8
+ const rating_module_css_1 = __importDefault(require("./rating.module.css"));
9
+ const autoKeyId = () => window.crypto.randomUUID().replace(/-/g, '');
10
+ class Rating extends react_1.default.Component {
11
+ constructor() {
28
12
  var _a;
29
- var _this = _super.apply(this, arguments) || this;
30
- _this.state = {
31
- value: (_a = _this.props.value) !== null && _a !== void 0 ? _a : 0
13
+ super(...arguments);
14
+ this.state = {
15
+ value: (_a = this.props.value) !== null && _a !== void 0 ? _a : 0
32
16
  };
33
- return _this;
34
17
  }
35
- Rating.prototype.componentDidUpdate = function (prevProps) {
18
+ componentDidUpdate(prevProps) {
36
19
  var _a;
37
20
  if (prevProps.value !== this.props.value) {
38
21
  this.setState({ value: (_a = this.props.value) !== null && _a !== void 0 ? _a : 0 });
39
22
  }
40
- };
41
- Rating.prototype.render = function () {
42
- var _this = this;
23
+ }
24
+ render() {
43
25
  var _a;
44
- return react_1.default.createElement("div", { id: this.props.id, className: "row ".concat(rating_module_css_1.default['rating-container'], " ").concat((_a = this.props.className) !== null && _a !== void 0 ? _a : ''), style: this.props.style }, Array.from({ length: 5 }).map(function (_, i) {
26
+ return react_1.default.createElement("div", { id: this.props.id, className: `row ${rating_module_css_1.default['rating-container']} ${(_a = this.props.className) !== null && _a !== void 0 ? _a : ''}`, style: this.props.style }, Array.from({ length: 5 }).map((_, i) => {
45
27
  var _a, _b, _c, _d, _e;
46
- var uniqueId = 'rating-star-grad-0';
47
- var stopValue = 0;
48
- if (_this.state.value >= 5) {
28
+ let uniqueId = 'rating-star-grad-0';
29
+ let stopValue = 0;
30
+ if (this.state.value >= 5) {
49
31
  uniqueId = 'rating-star-grad-5';
50
32
  stopValue = 100;
51
33
  }
52
- else if (_this.state.value >= i) {
34
+ else if (this.state.value >= i) {
53
35
  uniqueId = autoKeyId();
54
- stopValue = (_this.state.value - i) * 100;
36
+ stopValue = (this.state.value - i) * 100;
55
37
  }
56
- return react_1.default.createElement("svg", { onClick: function () {
57
- if (_this.props.onChange) {
58
- _this.setState({ value: i + 1 });
59
- _this.props.onChange(i + 1);
38
+ return react_1.default.createElement("svg", { onClick: () => {
39
+ if (this.props.onChange) {
40
+ this.setState({ value: i + 1 });
41
+ this.props.onChange(i + 1);
60
42
  }
61
- }, key: 'rate-' + i, width: "100%", height: "100%", style: { width: (_a = _this.props.size) !== null && _a !== void 0 ? _a : '2rem', height: (_b = _this.props.size) !== null && _b !== void 0 ? _b : '2rem' }, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
43
+ }, key: 'rate-' + i, width: "100%", height: "100%", style: { width: (_a = this.props.size) !== null && _a !== void 0 ? _a : '2rem', height: (_b = this.props.size) !== null && _b !== void 0 ? _b : '2rem' }, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
62
44
  react_1.default.createElement("defs", null,
63
45
  react_1.default.createElement("linearGradient", { id: uniqueId, x1: "0%", x2: "100%", y1: "0%", y2: "0%" },
64
- react_1.default.createElement("stop", { offset: "0%", style: { stopColor: (_c = _this.props.fillColor) !== null && _c !== void 0 ? _c : 'var(--secondary3-main-color,#FAAD1E)' } }),
65
- react_1.default.createElement("stop", { offset: "".concat(stopValue, "%"), style: { stopColor: (_d = _this.props.fillColor) !== null && _d !== void 0 ? _d : 'var(--secondary3-main-color,#FAAD1E)' } }),
66
- react_1.default.createElement("stop", { offset: "".concat(stopValue, "%"), style: { stopColor: '#00000000' } }))),
67
- react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10 1.66667C10.2884 1.66667 10.5518 1.82993 10.6794 2.0878L12.844 6.46194L17.6847 7.16325C17.97 7.20459 18.2071 7.4039 18.2962 7.67736C18.3853 7.95082 18.311 8.25101 18.1045 8.45172L14.6018 11.8563L15.4285 16.6636C15.4772 16.947 15.3604 17.2334 15.127 17.4024C14.8937 17.5714 14.5844 17.5937 14.3292 17.4599L10 15.1897L5.67081 17.4599C5.41557 17.5937 5.10627 17.5714 4.87295 17.4024C4.63964 17.2334 4.52278 16.947 4.57151 16.6636L5.39815 11.8563L1.89545 8.45172C1.68896 8.25101 1.61465 7.95082 1.70377 7.67736C1.79288 7.4039 2.02996 7.20459 2.31533 7.16325L7.15599 6.46194L9.32063 2.0878C9.44825 1.82993 9.71162 1.66667 10 1.66667ZM10 4.12915L8.33846 7.48665C8.22811 7.70963 8.01479 7.86418 7.76802 7.89993L4.05223 8.43827L6.74094 11.0517C6.91947 11.2252 7.00094 11.4752 6.95881 11.7203L6.3243 15.4102L9.64738 13.6676C9.86813 13.5519 10.1319 13.5519 10.3526 13.6676L13.6757 15.4102L13.0412 11.7203C12.9991 11.4752 13.0805 11.2252 13.2591 11.0517L15.9478 8.43827L12.232 7.89993C11.9852 7.86418 11.7719 7.70963 11.6615 7.48665L10 4.12915Z", style: { fill: (_e = _this.props.strokeColor) !== null && _e !== void 0 ? _e : 'var(--neutral-text-placeholder-color,#878792)' } }),
68
- react_1.default.createElement("path", { d: "M17.738 7.18949L12.8212 6.47499L10.6249 2.02268C10.5611 1.91426 10.47 1.82438 10.3608 1.76194C10.2515 1.6995 10.1279 1.66666 10.0021 1.66666C9.87623 1.66666 9.75259 1.6995 9.64335 1.76194C9.53411 1.82438 9.44306 1.91426 9.37921 2.02268L7.17875 6.47499L2.26191 7.18949C2.13368 7.208 2.0132 7.26201 1.91406 7.34542C1.81493 7.42882 1.74111 7.5383 1.70095 7.66147C1.66078 7.78463 1.65588 7.91658 1.68678 8.04239C1.71769 8.1682 1.78317 8.28286 1.87583 8.3734L5.43449 11.8411L4.59499 16.7385C4.57311 16.8662 4.58739 16.9975 4.63622 17.1175C4.68505 17.2375 4.76648 17.3414 4.8713 17.4175C4.97612 17.4937 5.10016 17.539 5.22938 17.5483C5.3586 17.5577 5.48785 17.5306 5.60252 17.4704L9.99998 15.1588L14.3974 17.4704C14.5121 17.5306 14.6414 17.5577 14.7706 17.5483C14.8998 17.539 15.0238 17.4937 15.1286 17.4175C15.2335 17.3414 15.3149 17.2375 15.3637 17.1175C15.4126 16.9975 15.4268 16.8662 15.405 16.7385L14.5655 11.8411L18.1241 8.3734C18.2168 8.28295 18.2823 8.16841 18.3132 8.0427C18.3442 7.91699 18.3394 7.78512 18.2994 7.66199C18.2594 7.53886 18.1858 7.42937 18.0868 7.34587C17.9879 7.26238 17.8675 7.20822 17.7394 7.18949H17.738Z", fill: "url(#".concat(uniqueId, ")") }));
46
+ react_1.default.createElement("stop", { offset: "0%", style: { stopColor: (_c = this.props.fillColor) !== null && _c !== void 0 ? _c : 'var(--secondary3-main-color,#FAAD1E)' } }),
47
+ react_1.default.createElement("stop", { offset: `${stopValue}%`, style: { stopColor: (_d = this.props.fillColor) !== null && _d !== void 0 ? _d : 'var(--secondary3-main-color,#FAAD1E)' } }),
48
+ react_1.default.createElement("stop", { offset: `${stopValue}%`, style: { stopColor: '#00000000' } }))),
49
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10 1.66667C10.2884 1.66667 10.5518 1.82993 10.6794 2.0878L12.844 6.46194L17.6847 7.16325C17.97 7.20459 18.2071 7.4039 18.2962 7.67736C18.3853 7.95082 18.311 8.25101 18.1045 8.45172L14.6018 11.8563L15.4285 16.6636C15.4772 16.947 15.3604 17.2334 15.127 17.4024C14.8937 17.5714 14.5844 17.5937 14.3292 17.4599L10 15.1897L5.67081 17.4599C5.41557 17.5937 5.10627 17.5714 4.87295 17.4024C4.63964 17.2334 4.52278 16.947 4.57151 16.6636L5.39815 11.8563L1.89545 8.45172C1.68896 8.25101 1.61465 7.95082 1.70377 7.67736C1.79288 7.4039 2.02996 7.20459 2.31533 7.16325L7.15599 6.46194L9.32063 2.0878C9.44825 1.82993 9.71162 1.66667 10 1.66667ZM10 4.12915L8.33846 7.48665C8.22811 7.70963 8.01479 7.86418 7.76802 7.89993L4.05223 8.43827L6.74094 11.0517C6.91947 11.2252 7.00094 11.4752 6.95881 11.7203L6.3243 15.4102L9.64738 13.6676C9.86813 13.5519 10.1319 13.5519 10.3526 13.6676L13.6757 15.4102L13.0412 11.7203C12.9991 11.4752 13.0805 11.2252 13.2591 11.0517L15.9478 8.43827L12.232 7.89993C11.9852 7.86418 11.7719 7.70963 11.6615 7.48665L10 4.12915Z", style: { fill: (_e = this.props.strokeColor) !== null && _e !== void 0 ? _e : 'var(--neutral-text-placeholder-color,#878792)' } }),
50
+ react_1.default.createElement("path", { d: "M17.738 7.18949L12.8212 6.47499L10.6249 2.02268C10.5611 1.91426 10.47 1.82438 10.3608 1.76194C10.2515 1.6995 10.1279 1.66666 10.0021 1.66666C9.87623 1.66666 9.75259 1.6995 9.64335 1.76194C9.53411 1.82438 9.44306 1.91426 9.37921 2.02268L7.17875 6.47499L2.26191 7.18949C2.13368 7.208 2.0132 7.26201 1.91406 7.34542C1.81493 7.42882 1.74111 7.5383 1.70095 7.66147C1.66078 7.78463 1.65588 7.91658 1.68678 8.04239C1.71769 8.1682 1.78317 8.28286 1.87583 8.3734L5.43449 11.8411L4.59499 16.7385C4.57311 16.8662 4.58739 16.9975 4.63622 17.1175C4.68505 17.2375 4.76648 17.3414 4.8713 17.4175C4.97612 17.4937 5.10016 17.539 5.22938 17.5483C5.3586 17.5577 5.48785 17.5306 5.60252 17.4704L9.99998 15.1588L14.3974 17.4704C14.5121 17.5306 14.6414 17.5577 14.7706 17.5483C14.8998 17.539 15.0238 17.4937 15.1286 17.4175C15.2335 17.3414 15.3149 17.2375 15.3637 17.1175C15.4126 16.9975 15.4268 16.8662 15.405 16.7385L14.5655 11.8411L18.1241 8.3734C18.2168 8.28295 18.2823 8.16841 18.3132 8.0427C18.3442 7.91699 18.3394 7.78512 18.2994 7.66199C18.2594 7.53886 18.1858 7.42937 18.0868 7.34587C17.9879 7.26238 17.8675 7.20822 17.7394 7.18949H17.738Z", fill: `url(#${uniqueId})` }));
69
51
  }));
70
- };
71
- return Rating;
72
- }(react_1.default.Component));
52
+ }
53
+ }
73
54
  exports.Rating = Rating;
@@ -1,30 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29
3
  if (k2 === undefined) k2 = k;
30
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -67,76 +41,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
67
41
  step((generator = generator.apply(thisArg, _arguments || [])).next());
68
42
  });
69
43
  };
70
- var __generator = (this && this.__generator) || function (thisArg, body) {
71
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
72
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
73
- function verb(n) { return function (v) { return step([n, v]); }; }
74
- function step(op) {
75
- if (f) throw new TypeError("Generator is already executing.");
76
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
77
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
78
- if (y = 0, t) op = [op[0] & 2, t.value];
79
- switch (op[0]) {
80
- case 0: case 1: t = op; break;
81
- case 4: _.label++; return { value: op[1], done: false };
82
- case 5: _.label++; y = op[1]; op = [0]; continue;
83
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
84
- default:
85
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
86
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
87
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
88
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
89
- if (t[2]) _.ops.pop();
90
- _.trys.pop(); continue;
91
- }
92
- op = body.call(thisArg, _);
93
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
94
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
95
- }
96
- };
97
44
  var __importDefault = (this && this.__importDefault) || function (mod) {
98
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
99
46
  };
100
47
  Object.defineProperty(exports, "__esModule", { value: true });
101
48
  exports.Select1 = void 0;
102
- var select1_module_css_1 = __importDefault(require("./select1.module.css"));
103
- var react_1 = __importStar(require("react"));
104
- var winicon_1 = require("../wini-icon/winicon");
105
- var text_1 = require("../text/text");
106
- var react_i18next_1 = require("react-i18next");
107
- var popup_1 = require("../popup/popup");
49
+ const select1_module_css_1 = __importDefault(require("./select1.module.css"));
50
+ const react_1 = __importStar(require("react"));
51
+ const winicon_1 = require("../wini-icon/winicon");
52
+ const text_1 = require("../text/text");
53
+ const react_i18next_1 = require("react-i18next");
54
+ const popup_1 = require("../popup/popup");
108
55
  ;
109
- var TSelect1 = /** @class */ (function (_super) {
110
- __extends(TSelect1, _super);
111
- function TSelect1(props) {
56
+ class TSelect1 extends react_1.default.Component {
57
+ constructor(props) {
112
58
  var _a, _b;
113
- var _this = _super.call(this, props) || this;
114
- _this.containerRef = (0, react_1.createRef)();
115
- _this.inputRef = (0, react_1.createRef)();
116
- _this.onKeyDown = function (ev) {
59
+ super(props);
60
+ this.containerRef = (0, react_1.createRef)();
61
+ this.inputRef = (0, react_1.createRef)();
62
+ this.onKeyDown = (ev) => {
117
63
  var _a, _b, _c, _d, _e, _f, _g;
118
- if ((((_a = _this.state.options) === null || _a === void 0 ? void 0 : _a.length) || ((_b = _this.state.search) === null || _b === void 0 ? void 0 : _b.length)) && _this.state.isOpen) {
64
+ if ((((_a = this.state.options) === null || _a === void 0 ? void 0 : _a.length) || ((_b = this.state.search) === null || _b === void 0 ? void 0 : _b.length)) && this.state.isOpen) {
119
65
  switch (ev.key.toLowerCase()) {
120
66
  case "enter":
121
67
  ev.preventDefault();
122
- var _selectItem = ((_c = _this.state.search) !== null && _c !== void 0 ? _c : _this.state.options).find(function (e) { return e.id === _this.state.selected; });
68
+ const _selectItem = ((_c = this.state.search) !== null && _c !== void 0 ? _c : this.state.options).find(e => e.id === this.state.selected);
123
69
  if (_selectItem)
124
- _this.onSelect(_selectItem);
70
+ this.onSelect(_selectItem);
125
71
  break;
126
72
  case "arrowup":
127
73
  ev.preventDefault();
128
- if (_this.state.selected) {
129
- var _index = ((_d = _this.state.search) !== null && _d !== void 0 ? _d : _this.state.options).findIndex(function (e) { return e.id === _this.state.selected; });
130
- _index = ((_index === 0) ? _this.props.options.length : _index) - 1;
131
- _this.setState(__assign(__assign({}, _this.state), { selected: (_e = _this.props.options[_index]) === null || _e === void 0 ? void 0 : _e.id }));
74
+ if (this.state.selected) {
75
+ let _index = ((_d = this.state.search) !== null && _d !== void 0 ? _d : this.state.options).findIndex((e) => e.id === this.state.selected);
76
+ _index = ((_index === 0) ? this.props.options.length : _index) - 1;
77
+ this.setState(Object.assign(Object.assign({}, this.state), { selected: (_e = this.props.options[_index]) === null || _e === void 0 ? void 0 : _e.id }));
132
78
  }
133
79
  break;
134
80
  case "arrowdown":
135
81
  ev.preventDefault();
136
- if (_this.state.selected) {
137
- var _index = ((_f = _this.state.search) !== null && _f !== void 0 ? _f : _this.state.options).findIndex(function (e) { return e.id === _this.state.selected; });
138
- _index = ((_index + 1 === _this.props.options.length) ? -1 : _index) + 1;
139
- _this.setState(__assign(__assign({}, _this.state), { selected: (_g = _this.props.options[_index]) === null || _g === void 0 ? void 0 : _g.id }));
82
+ if (this.state.selected) {
83
+ let _index = ((_f = this.state.search) !== null && _f !== void 0 ? _f : this.state.options).findIndex((e) => e.id === this.state.selected);
84
+ _index = ((_index + 1 === this.props.options.length) ? -1 : _index) + 1;
85
+ this.setState(Object.assign(Object.assign({}, this.state), { selected: (_g = this.props.options[_index]) === null || _g === void 0 ? void 0 : _g.id }));
140
86
  }
141
87
  break;
142
88
  default:
@@ -144,7 +90,7 @@ var TSelect1 = /** @class */ (function (_super) {
144
90
  }
145
91
  }
146
92
  };
147
- _this.state = {
93
+ this.state = {
148
94
  value: props.value,
149
95
  options: props.options,
150
96
  offset: {
@@ -163,148 +109,133 @@ var TSelect1 = /** @class */ (function (_super) {
163
109
  isOpen: false,
164
110
  onSelect: null,
165
111
  };
166
- _this.search = _this.search.bind(_this);
167
- _this.onSelect = _this.onSelect.bind(_this);
168
- _this.onKeyDown = _this.onKeyDown.bind(_this);
169
- if (_this.inputRef.current)
170
- _this.inputRef.current.value = "".concat((_b = (_a = _this.state.options.find(function (e) { return e.id === _this.state.value; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "");
171
- return _this;
112
+ this.search = this.search.bind(this);
113
+ this.onSelect = this.onSelect.bind(this);
114
+ this.onKeyDown = this.onKeyDown.bind(this);
115
+ if (this.inputRef.current)
116
+ this.inputRef.current.value = `${(_b = (_a = this.state.options.find(e => e.id === this.state.value)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : ""}`;
172
117
  }
173
- TSelect1.prototype.search = function (ev) {
174
- return __awaiter(this, void 0, void 0, function () {
175
- var res;
118
+ search(ev) {
119
+ return __awaiter(this, void 0, void 0, function* () {
176
120
  var _a;
177
- return __generator(this, function (_b) {
178
- switch (_b.label) {
179
- case 0:
180
- if (!ev.target.value.trim().length) return [3 /*break*/, 4];
181
- if (!((_a = this.props) === null || _a === void 0 ? void 0 : _a.handleSearch)) return [3 /*break*/, 2];
182
- return [4 /*yield*/, this.props.handleSearch(ev.target.value.trim())];
183
- case 1:
184
- res = _b.sent();
185
- this.setState(__assign(__assign({}, this.state), { search: res }));
186
- return [3 /*break*/, 3];
187
- case 2:
188
- this.setState(__assign(__assign({}, this.state), { search: this.props.options.filter(function (e) { return typeof e.name === "string" && e.name.toLowerCase().includes(ev.target.value.trim().toLowerCase()); }) }));
189
- _b.label = 3;
190
- case 3: return [3 /*break*/, 5];
191
- case 4:
192
- this.setState(__assign(__assign({}, this.state), { search: undefined }));
193
- _b.label = 5;
194
- case 5: return [2 /*return*/];
121
+ if (ev.target.value.trim().length) {
122
+ if ((_a = this.props) === null || _a === void 0 ? void 0 : _a.handleSearch) {
123
+ const res = yield this.props.handleSearch(ev.target.value.trim());
124
+ this.setState(Object.assign(Object.assign({}, this.state), { search: res }));
125
+ }
126
+ else {
127
+ this.setState(Object.assign(Object.assign({}, this.state), { search: this.props.options.filter(e => typeof e.name === "string" && e.name.toLowerCase().includes(ev.target.value.trim().toLowerCase())) }));
195
128
  }
196
- });
129
+ }
130
+ else {
131
+ this.setState(Object.assign(Object.assign({}, this.state), { search: undefined }));
132
+ }
197
133
  });
198
- };
199
- TSelect1.prototype.onSelect = function (item) {
134
+ }
135
+ onSelect(item) {
200
136
  var _a, _b;
201
137
  if (item.disabled) {
202
- this.setState(__assign(__assign({}, this.state), { isOpen: false, onSelect: undefined, selected: undefined }));
138
+ this.setState(Object.assign(Object.assign({}, this.state), { isOpen: false, onSelect: undefined, selected: undefined }));
203
139
  (_a = this.inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
204
140
  }
205
141
  else {
206
- var newState = __assign(__assign({}, this.state), { isOpen: false, value: item.id, onSelect: undefined, selected: undefined });
207
- if (!newState.options.some(function (e) { return e.id === item.id; }))
142
+ let newState = Object.assign(Object.assign({}, this.state), { isOpen: false, value: item.id, onSelect: undefined, selected: undefined });
143
+ if (!newState.options.some(e => e.id === item.id))
208
144
  newState.options.push(item);
209
145
  this.setState(newState);
210
146
  (_b = this.inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
211
147
  }
212
148
  if (this.props.onChange)
213
149
  this.props.onChange(item);
214
- };
215
- TSelect1.prototype.componentDidUpdate = function (prevProps, prevState) {
216
- var _this = this;
150
+ }
151
+ componentDidUpdate(prevProps, prevState) {
217
152
  var _a, _b, _c, _d, _e, _f, _g, _h;
218
153
  if (prevProps.options !== this.props.options) {
219
- this.setState(__assign(__assign({}, this.state), { options: this.props.options }));
154
+ this.setState(Object.assign(Object.assign({}, this.state), { options: this.props.options }));
220
155
  if (this.inputRef.current)
221
- this.inputRef.current.value = "".concat((_b = (_a = this.props.options.find(function (e) { return e.id === _this.state.value; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "");
156
+ this.inputRef.current.value = `${(_b = (_a = this.props.options.find(e => e.id === this.state.value)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : ""}`;
222
157
  }
223
158
  if (prevProps.value !== this.props.value)
224
- this.setState(__assign(__assign({}, this.state), { value: this.props.value }));
159
+ this.setState(Object.assign(Object.assign({}, this.state), { value: this.props.value }));
225
160
  if (prevState.value !== this.state.value && this.inputRef.current)
226
- this.inputRef.current.value = "".concat((_d = (_c = this.state.options.find(function (e) { return e.id === _this.state.value; })) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : "");
161
+ this.inputRef.current.value = `${(_d = (_c = this.state.options.find(e => e.id === this.state.value)) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : ""}`;
227
162
  //
228
163
  if (this.state.isOpen && prevState.isOpen !== this.state.isOpen) {
229
- var thisPopupRect = (_e = this.containerRef.current.querySelector(".select1-popup")) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect();
164
+ const thisPopupRect = (_e = this.containerRef.current.querySelector(`.select1-popup`)) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect();
230
165
  if (thisPopupRect) {
231
- var style = void 0;
166
+ let style;
232
167
  if (thisPopupRect.right > document.body.offsetWidth) {
233
168
  style = {
234
169
  top: this.state.offset.y + this.state.offset.height + 2 + 'px',
235
170
  right: document.body.offsetWidth - this.state.offset.right + 'px'
236
171
  };
237
172
  }
238
- var _bottom = thisPopupRect.bottom - 8;
239
- var thisContainerRect = (_f = this.containerRef.current) === null || _f === void 0 ? void 0 : _f.getBoundingClientRect();
173
+ let _bottom = thisPopupRect.bottom - 8;
174
+ const thisContainerRect = (_f = this.containerRef.current) === null || _f === void 0 ? void 0 : _f.getBoundingClientRect();
240
175
  if (thisContainerRect) {
241
176
  if (_bottom > document.body.offsetHeight) {
242
- style = __assign(__assign({}, (style !== null && style !== void 0 ? style : {})), { top: "".concat(thisContainerRect.y - 2 - thisPopupRect.height, "px") });
177
+ style = Object.assign(Object.assign({}, (style !== null && style !== void 0 ? style : {})), { top: `${thisContainerRect.y - 2 - thisPopupRect.height}px` });
243
178
  }
244
179
  }
245
180
  if (style) {
246
- (_g = style.left) !== null && _g !== void 0 ? _g : (style.left = style.right ? undefined : "".concat(this.state.offset.x, "px"));
247
- (_h = style.width) !== null && _h !== void 0 ? _h : (style.width = "".concat(this.state.offset.width, "px"));
248
- this.setState(__assign(__assign({}, this.state), { style: style }));
181
+ (_g = style.left) !== null && _g !== void 0 ? _g : (style.left = style.right ? undefined : `${this.state.offset.x}px`);
182
+ (_h = style.width) !== null && _h !== void 0 ? _h : (style.width = `${this.state.offset.width}px`);
183
+ this.setState(Object.assign(Object.assign({}, this.state), { style: style }));
249
184
  }
250
185
  }
251
186
  }
252
- };
253
- TSelect1.prototype.componentDidMount = function () {
254
- var _this = this;
187
+ }
188
+ componentDidMount() {
255
189
  var _a, _b;
256
190
  if (this.inputRef.current)
257
- this.inputRef.current.value = "".concat((_b = (_a = this.state.options.find(function (e) { return e.id === _this.state.value; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "");
258
- };
259
- TSelect1.prototype.render = function () {
260
- var _this = this;
191
+ this.inputRef.current.value = `${(_b = (_a = this.state.options.find(e => e.id === this.state.value)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : ""}`;
192
+ }
193
+ render() {
261
194
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
262
- var t = this.props.t;
263
- var _value = this.state.options.find(function (e) { return e.id === _this.state.value; });
264
- return react_1.default.createElement("div", { id: this.props.id, ref: this.containerRef, className: "".concat(select1_module_css_1.default['select1-container'], " row ").concat(this.props.disabled ? select1_module_css_1.default['disabled'] : '', " ").concat(((_a = this.props.helperText) === null || _a === void 0 ? void 0 : _a.length) && select1_module_css_1.default['helper-text'], " ").concat((_b = this.props.className) !== null && _b !== void 0 ? _b : 'body-3'), "helper-text": this.props.helperText, style: this.props.style ? __assign(__assign({}, { '--helper-text-color': (_c = this.props.helperTextColor) !== null && _c !== void 0 ? _c : '#e14337' }), this.props.style) : { '--helper-text-color': (_d = this.props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' }, onClick: function () {
195
+ const { t } = this.props;
196
+ const _value = this.state.options.find(e => e.id === this.state.value);
197
+ return react_1.default.createElement("div", { id: this.props.id, ref: this.containerRef, className: `${select1_module_css_1.default['select1-container']} row ${this.props.disabled ? select1_module_css_1.default['disabled'] : ''} ${((_a = this.props.helperText) === null || _a === void 0 ? void 0 : _a.length) && select1_module_css_1.default['helper-text']} ${(_b = this.props.className) !== null && _b !== void 0 ? _b : 'body-3'}`, "helper-text": this.props.helperText, style: this.props.style ? Object.assign(Object.assign({}, { '--helper-text-color': (_c = this.props.helperTextColor) !== null && _c !== void 0 ? _c : '#e14337' }), this.props.style) : { '--helper-text-color': (_d = this.props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' }, onClick: () => {
265
198
  var _a, _b, _c;
266
- if (!_this.state.isOpen) {
267
- _this.setState(__assign(__assign({}, _this.state), { isOpen: true, style: undefined, offset: (_b = (_a = _this.containerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect() }));
268
- (_c = _this.inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
199
+ if (!this.state.isOpen) {
200
+ this.setState(Object.assign(Object.assign({}, this.state), { isOpen: true, style: undefined, offset: (_b = (_a = this.containerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect() }));
201
+ (_c = this.inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
269
202
  }
270
203
  } },
271
204
  this.props.prefix,
272
- (!_value || typeof _value.name === "string" || typeof _value.name === "number") ? react_1.default.createElement("input", { ref: this.inputRef, readOnly: this.props.readOnly, onChange: this.search, placeholder: this.props.placeholder, onBlur: function (ev) {
273
- if (_this.state.onSelect && !_this.props.readOnly)
205
+ (!_value || typeof _value.name === "string" || typeof _value.name === "number") ? react_1.default.createElement("input", { ref: this.inputRef, readOnly: this.props.readOnly, onChange: this.search, placeholder: this.props.placeholder, onBlur: ev => {
206
+ if (this.state.onSelect && !this.props.readOnly)
274
207
  ev.target.focus();
275
- } }) : _value.name, (_e = this.props.suffix) !== null && _e !== void 0 ? _e : react_1.default.createElement("div", { ref: function (iconRef) {
208
+ } }) : _value.name, (_e = this.props.suffix) !== null && _e !== void 0 ? _e : react_1.default.createElement("div", { ref: iconRef => {
276
209
  if ((iconRef === null || iconRef === void 0 ? void 0 : iconRef.parentElement) && iconRef.parentElement.getBoundingClientRect().width < 88)
277
210
  iconRef.style.display = "none";
278
211
  }, className: 'row' },
279
212
  react_1.default.createElement(winicon_1.Winicon, { src: this.state.isOpen ? "fill/arrows/up-arrow" : "fill/arrows/down-arrow", size: "1.2rem" })),
280
- this.state.isOpen && react_1.default.createElement(popup_1.PopupOverlay, { onOpen: this.props.onOpenOptions, className: "hidden-overlay", onClose: function (ev) {
281
- if (ev.target !== _this.inputRef.current)
282
- _this.setState(__assign(__assign({}, _this.state), { isOpen: false }));
213
+ this.state.isOpen && react_1.default.createElement(popup_1.PopupOverlay, { onOpen: this.props.onOpenOptions, className: `hidden-overlay`, onClose: (ev) => {
214
+ if (ev.target !== this.inputRef.current)
215
+ this.setState(Object.assign(Object.assign({}, this.state), { isOpen: false }));
283
216
  } },
284
- react_1.default.createElement("div", { className: "".concat(select1_module_css_1.default['select1-popup'], " select1-popup col ").concat((_f = this.props.popupClassName) !== null && _f !== void 0 ? _f : ""), style: (_g = this.state.style) !== null && _g !== void 0 ? _g : {
217
+ react_1.default.createElement("div", { className: `${select1_module_css_1.default['select1-popup']} select1-popup col ${(_f = this.props.popupClassName) !== null && _f !== void 0 ? _f : ""}`, style: (_g = this.state.style) !== null && _g !== void 0 ? _g : {
285
218
  top: this.state.offset.y + this.state.offset.height + 2 + 'px',
286
219
  left: this.state.offset.x + 'px',
287
220
  width: this.state.offset.width,
288
221
  } },
289
- react_1.default.createElement("div", { className: "col ".concat(select1_module_css_1.default['select-body']), onScroll: this.props.handleLoadmore ? function (ev) {
290
- if (_this.props.handleLoadmore) {
291
- var scrollElement = ev.target;
292
- _this.props.handleLoadmore(Math.round(scrollElement.offsetHeight + scrollElement.scrollTop) >= (scrollElement.scrollHeight - 1), ev);
222
+ react_1.default.createElement("div", { className: `col ${select1_module_css_1.default['select-body']}`, onScroll: this.props.handleLoadmore ? (ev) => {
223
+ if (this.props.handleLoadmore) {
224
+ let scrollElement = ev.target;
225
+ this.props.handleLoadmore(Math.round(scrollElement.offsetHeight + scrollElement.scrollTop) >= (scrollElement.scrollHeight - 1), ev);
293
226
  }
294
227
  } : undefined },
295
- ((_h = this.state.search) !== null && _h !== void 0 ? _h : this.state.options).filter(function (e) { return !e.parentId; }).map(function (item) {
228
+ ((_h = this.state.search) !== null && _h !== void 0 ? _h : this.state.options).filter(e => !e.parentId).map(item => {
296
229
  var _a, _b;
297
- return react_1.default.createElement(OptionsItemTile, { key: item.id, item: item, children: ((_a = _this.state.search) !== null && _a !== void 0 ? _a : _this.state.options).filter(function (e) { return e.parentId === item.id; }), selected: _this.state.selected === item.id, onClick: _this.onSelect, treeData: ((_b = _this.state.search) !== null && _b !== void 0 ? _b : _this.state.options).some(function (e) { return e.parentId; }) });
230
+ return react_1.default.createElement(OptionsItemTile, { key: item.id, item: item, children: ((_a = this.state.search) !== null && _a !== void 0 ? _a : this.state.options).filter(e => e.parentId === item.id), selected: this.state.selected === item.id, onClick: this.onSelect, treeData: ((_b = this.state.search) !== null && _b !== void 0 ? _b : this.state.options).some(e => e.parentId) });
298
231
  }),
299
232
  (!((_j = this.state.search) === null || _j === void 0 ? void 0 : _j.length) && !((_k = this.props.options) === null || _k === void 0 ? void 0 : _k.length)) && (react_1.default.createElement("div", { className: select1_module_css_1.default['no-results-found'] }, t("noResultFound")))))));
300
- };
301
- return TSelect1;
302
- }(react_1.default.Component));
303
- function OptionsItemTile(_a) {
304
- var item = _a.item, children = _a.children, selected = _a.selected, onClick = _a.onClick, treeData = _a.treeData;
305
- var _b = (0, react_1.useState)(false), isOpen = _b[0], setIsOpen = _b[1];
233
+ }
234
+ }
235
+ function OptionsItemTile({ item, children, selected, onClick, treeData }) {
236
+ const [isOpen, setIsOpen] = (0, react_1.useState)(false);
306
237
  return item.title && typeof item.title !== "string" ? react_1.default.createElement(react_1.default.Fragment, null, item.title(onClick)) : react_1.default.createElement("div", { className: 'col', style: { width: '100%' } },
307
- react_1.default.createElement("div", { className: "".concat(select1_module_css_1.default['select-tile'], " row ").concat(item.disabled ? select1_module_css_1.default["disabled"] : ""), style: { paddingLeft: item.parentId ? '4.4rem' : undefined, backgroundColor: selected ? "var(--neutral-selected-background-color)" : undefined }, onClick: function () {
238
+ react_1.default.createElement("div", { className: `${select1_module_css_1.default['select-tile']} row ${item.disabled ? select1_module_css_1.default["disabled"] : ""}`, style: { paddingLeft: item.parentId ? '4.4rem' : undefined, backgroundColor: selected ? "var(--neutral-selected-background-color)" : undefined }, onClick: () => {
308
239
  if (children === null || children === void 0 ? void 0 : children.length) {
309
240
  setIsOpen(!isOpen);
310
241
  }
@@ -313,6 +244,6 @@ function OptionsItemTile(_a) {
313
244
  } },
314
245
  treeData ? react_1.default.createElement("div", { className: 'row', style: { width: '1.4rem', height: '1.4rem' } }, (children === null || children === void 0 ? void 0 : children.length) ? react_1.default.createElement(winicon_1.Winicon, { src: isOpen ? "fill/arrows/triangle-down" : "fill/arrows/triangle-right", size: "1.2rem" }) : null) : undefined,
315
246
  ((item.title && typeof item.title === "string") || typeof item.name === "string") ? react_1.default.createElement(text_1.Text, { className: 'body-3' }, item.title && typeof item.title === "string" ? item.title : item.name) : item.name),
316
- (children === null || children === void 0 ? void 0 : children.length) ? react_1.default.createElement("div", { className: 'col', style: { display: isOpen ? "flex" : "none", width: '100%' } }, children.map(function (e) { return react_1.default.createElement(OptionsItemTile, { key: e.id, item: e, onClick: onClick }); })) : undefined);
247
+ (children === null || children === void 0 ? void 0 : children.length) ? react_1.default.createElement("div", { className: 'col', style: { display: isOpen ? "flex" : "none", width: '100%' } }, children.map(e => react_1.default.createElement(OptionsItemTile, { key: e.id, item: e, onClick: onClick }))) : undefined);
317
248
  }
318
249
  exports.Select1 = (0, react_i18next_1.withTranslation)()(TSelect1);
@@ -1,82 +1,64 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
4
  };
20
5
  Object.defineProperty(exports, "__esModule", { value: true });
21
6
  exports.CustomSlider = void 0;
22
- var react_1 = __importDefault(require("react"));
23
- var react_awesome_slider_1 = __importDefault(require("react-awesome-slider"));
7
+ const react_1 = __importDefault(require("react"));
8
+ const react_awesome_slider_1 = __importDefault(require("react-awesome-slider"));
24
9
  require("./slider.css");
25
- var winicon_1 = require("../wini-icon/winicon");
26
- var CustomSlider = /** @class */ (function (_super) {
27
- __extends(CustomSlider, _super);
28
- function CustomSlider(props) {
10
+ const winicon_1 = require("../wini-icon/winicon");
11
+ class CustomSlider extends react_1.default.Component {
12
+ constructor(props) {
29
13
  var _a;
30
- var _this = _super.call(this, props) || this;
31
- _this.nextPage = function () {
14
+ super(props);
15
+ this.nextPage = () => {
32
16
  var _a, _b, _c;
33
- var index = (_b = (_a = _this.state) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 0;
34
- if (((_c = _this.props) === null || _c === void 0 ? void 0 : _c.children) && (index + 1) < _this.props.children.length) {
35
- _this.setState({ page: index + 1 });
36
- if (_this.props.onChage)
37
- _this.props.onChage(index + 1);
17
+ let index = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 0;
18
+ if (((_c = this.props) === null || _c === void 0 ? void 0 : _c.children) && (index + 1) < this.props.children.length) {
19
+ this.setState({ page: index + 1 });
20
+ if (this.props.onChage)
21
+ this.props.onChage(index + 1);
38
22
  }
39
23
  };
40
- _this.previousPage = function () {
24
+ this.previousPage = () => {
41
25
  var _a, _b, _c;
42
- var index = (_b = (_a = _this.state) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 0;
43
- if (((_c = _this.props) === null || _c === void 0 ? void 0 : _c.children) && index > 0) {
44
- _this.setState({ page: index - 1 });
45
- if (_this.props.onChage)
46
- _this.props.onChage(index - 1);
26
+ let index = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 0;
27
+ if (((_c = this.props) === null || _c === void 0 ? void 0 : _c.children) && index > 0) {
28
+ this.setState({ page: index - 1 });
29
+ if (this.props.onChage)
30
+ this.props.onChage(index - 1);
47
31
  }
48
32
  };
49
- _this.autoPlay = function () {
33
+ this.autoPlay = () => {
50
34
  var _a, _b, _c;
51
- var index = (_b = (_a = _this.state) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 0;
52
- if (((_c = _this.props) === null || _c === void 0 ? void 0 : _c.children) && (index + 1) === _this.props.children.length)
35
+ let index = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 0;
36
+ if (((_c = this.props) === null || _c === void 0 ? void 0 : _c.children) && (index + 1) === this.props.children.length)
53
37
  index = -1;
54
- _this.setState({ page: index + 1 });
55
- if (_this.props.onChage)
56
- _this.props.onChage(index + 1);
38
+ this.setState({ page: index + 1 });
39
+ if (this.props.onChage)
40
+ this.props.onChage(index + 1);
57
41
  };
58
42
  (_a = props.buttons) !== null && _a !== void 0 ? _a : (props.buttons = true);
59
- _this.state = {
43
+ this.state = {
60
44
  page: 0
61
45
  };
62
- _this.autoPlay = _this.autoPlay.bind(_this);
63
- _this.nextPage = _this.nextPage.bind(_this);
64
- _this.previousPage = _this.previousPage.bind(_this);
65
- return _this;
46
+ this.autoPlay = this.autoPlay.bind(this);
47
+ this.nextPage = this.nextPage.bind(this);
48
+ this.previousPage = this.previousPage.bind(this);
66
49
  }
67
- CustomSlider.prototype.componentDidMount = function () {
50
+ componentDidMount() {
68
51
  var _a;
69
52
  if (this.props.autoPlay)
70
53
  this.intervalPlay = setInterval(this.autoPlay, (_a = this.props.duration) !== null && _a !== void 0 ? _a : 2000);
71
- };
72
- CustomSlider.prototype.componentDidUpdate = function (prevProps, prevState) {
54
+ }
55
+ componentDidUpdate(prevProps, prevState) {
73
56
  if (this.props.autoPlay !== prevProps.autoPlay && !this.props.autoPlay)
74
57
  clearInterval(this.intervalPlay);
75
- };
76
- CustomSlider.prototype.render = function () {
58
+ }
59
+ render() {
77
60
  var _a, _b, _c, _d, _e, _f;
78
- return react_1.default.createElement(react_awesome_slider_1.default, { style: this.props.style, className: "custom-slider-container ".concat((_a = this.props.className) !== null && _a !== void 0 ? _a : ''), selected: this.state.page, bullets: false, buttons: this.props.buttons ? (this.props.children && ((_b = this.props.children) === null || _b === void 0 ? void 0 : _b.length) > 1) : false, organicArrows: false, buttonContentLeft: (_c = this.props.prevButton) !== null && _c !== void 0 ? _c : react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/circle-ctrl-left", size: "2.4rem", color: (_d = this.props.iconColor) !== null && _d !== void 0 ? _d : "var(--neutral-absolute-background-color)" }), buttonContentRight: (_e = this.props.nextButton) !== null && _e !== void 0 ? _e : react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/circle-ctrl-right", size: "2.4rem", color: (_f = this.props.iconColor) !== null && _f !== void 0 ? _f : "var(--neutral-absolute-background-color)" }) }, this.props.children);
79
- };
80
- return CustomSlider;
81
- }(react_1.default.Component));
61
+ return react_1.default.createElement(react_awesome_slider_1.default, { style: this.props.style, className: `custom-slider-container ${(_a = this.props.className) !== null && _a !== void 0 ? _a : ''}`, selected: this.state.page, bullets: false, buttons: this.props.buttons ? (this.props.children && ((_b = this.props.children) === null || _b === void 0 ? void 0 : _b.length) > 1) : false, organicArrows: false, buttonContentLeft: (_c = this.props.prevButton) !== null && _c !== void 0 ? _c : react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/circle-ctrl-left", size: "2.4rem", color: (_d = this.props.iconColor) !== null && _d !== void 0 ? _d : "var(--neutral-absolute-background-color)" }), buttonContentRight: (_e = this.props.nextButton) !== null && _e !== void 0 ? _e : react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/circle-ctrl-right", size: "2.4rem", color: (_f = this.props.iconColor) !== null && _f !== void 0 ? _f : "var(--neutral-absolute-background-color)" }) }, this.props.children);
62
+ }
63
+ }
82
64
  exports.CustomSlider = CustomSlider;