wini-web-components 0.5.0 → 0.5.2
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/component/calendar/calendar.d.ts +46 -0
- package/dist/component/calendar/calendar.js +426 -0
- package/dist/component/checkbox/checkbox.d.ts +20 -0
- package/dist/component/checkbox/checkbox.js +79 -0
- package/dist/component/component-status.d.ts +8 -0
- package/dist/component/component-status.js +32 -0
- package/dist/component/date-picker/date-picker.d.ts +31 -0
- package/dist/component/date-picker/date-picker.js +358 -0
- package/dist/component/dialog/dialog.d.ts +33 -0
- package/dist/component/dialog/dialog.js +96 -0
- package/dist/component/import-file/import-file.d.ts +35 -0
- package/dist/component/import-file/import-file.js +117 -0
- package/dist/component/infinite-scroll/infinite-scroll.d.ts +16 -0
- package/dist/component/infinite-scroll/infinite-scroll.js +102 -0
- package/dist/component/input-multi-select/input-multi-select.d.ts +39 -0
- package/dist/component/input-multi-select/input-multi-select.js +249 -0
- package/dist/component/pagination/pagination.d.ts +11 -0
- package/dist/component/pagination/pagination.js +46 -0
- package/dist/component/popup/popup.d.ts +31 -0
- package/dist/component/popup/popup.js +105 -0
- package/dist/component/progress-bar/progress-bar.d.ts +16 -0
- package/dist/component/progress-bar/progress-bar.js +39 -0
- package/dist/component/progress-circle/progress-circle.d.ts +13 -0
- package/dist/component/progress-circle/progress-circle.js +31 -0
- package/dist/component/radio-button/radio-button.d.ts +20 -0
- package/dist/component/radio-button/radio-button.js +64 -0
- package/dist/component/rating/rating.d.ts +23 -0
- package/dist/component/rating/rating.js +76 -0
- package/dist/component/select1/select1.d.ts +38 -0
- package/dist/component/select1/select1.js +185 -0
- package/dist/component/slider/slider.d.ts +31 -0
- package/dist/component/slider/slider.js +83 -0
- package/dist/component/switch/switch.d.ts +23 -0
- package/dist/component/switch/switch.js +81 -0
- package/dist/component/table/table.d.ts +46 -0
- package/dist/component/table/table.js +119 -0
- package/dist/component/text/text.d.ts +14 -0
- package/dist/component/text/text.js +50 -0
- package/dist/component/text-area/text-area.d.ts +25 -0
- package/dist/component/text-area/text-area.js +47 -0
- package/dist/component/text-field/text-field.d.ts +28 -0
- package/dist/component/text-field/text-field.js +50 -0
- package/dist/component/toast-noti/toast-noti.d.ts +4 -0
- package/dist/component/toast-noti/toast-noti.js +27 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +59 -1
- package/dist/skin/color.css +17 -0
- package/dist/skin/layout.css +601 -0
- package/dist/skin/typography.css +378 -0
- package/package.json +4 -2
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.Popup = exports.closePopup = exports.showPopup = void 0;
|
|
33
|
+
var react_1 = __importDefault(require("react"));
|
|
34
|
+
var react_dom_1 = __importDefault(require("react-dom"));
|
|
35
|
+
require("./popup.css");
|
|
36
|
+
var showPopup = function (_a) {
|
|
37
|
+
var _b;
|
|
38
|
+
var ref = _a.ref, heading = _a.heading, content = _a.content, footer = _a.footer, clickOverlayClosePopup = _a.clickOverlayClosePopup, style = _a.style, hideButtonClose = _a.hideButtonClose;
|
|
39
|
+
(_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.onOpen({
|
|
40
|
+
heading: heading,
|
|
41
|
+
content: content,
|
|
42
|
+
footer: footer,
|
|
43
|
+
clickOverlayClosePopup: clickOverlayClosePopup,
|
|
44
|
+
style: style,
|
|
45
|
+
hideButtonClose: hideButtonClose
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.showPopup = showPopup;
|
|
49
|
+
var closePopup = function (ref) {
|
|
50
|
+
ref.current.onClose();
|
|
51
|
+
};
|
|
52
|
+
exports.closePopup = closePopup;
|
|
53
|
+
var Popup = /** @class */ (function (_super) {
|
|
54
|
+
__extends(Popup, _super);
|
|
55
|
+
function Popup(props) {
|
|
56
|
+
var _this = _super.call(this, props) || this;
|
|
57
|
+
_this.state = {
|
|
58
|
+
open: false,
|
|
59
|
+
};
|
|
60
|
+
_this.ref = react_1.default.createRef();
|
|
61
|
+
return _this;
|
|
62
|
+
}
|
|
63
|
+
Popup.prototype.onOpen = function (data) {
|
|
64
|
+
this.setState(__assign({ open: true }, data));
|
|
65
|
+
};
|
|
66
|
+
Popup.prototype.onClose = function () {
|
|
67
|
+
this.setState({ open: false });
|
|
68
|
+
};
|
|
69
|
+
Popup.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
70
|
+
var _a;
|
|
71
|
+
if (prevState.open !== this.state.open && this.state.open && this.state.style) {
|
|
72
|
+
var thisPopupRect = (_a = this.ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
73
|
+
if (thisPopupRect) {
|
|
74
|
+
var style = void 0;
|
|
75
|
+
if (thisPopupRect.right > document.body.offsetWidth) {
|
|
76
|
+
style = __assign(__assign({}, this.state.style), { right: '0.4rem' });
|
|
77
|
+
delete style.left;
|
|
78
|
+
}
|
|
79
|
+
if (thisPopupRect.bottom > document.body.offsetHeight) {
|
|
80
|
+
style = style ? __assign(__assign({}, style), { bottom: '0.4rem' }) : __assign(__assign({}, this.state.style), { bottom: '0.4rem' });
|
|
81
|
+
delete style.top;
|
|
82
|
+
}
|
|
83
|
+
if (style)
|
|
84
|
+
this.setState(__assign(__assign({}, this.state), { style: style }));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
Popup.prototype.render = function () {
|
|
89
|
+
var _this = this;
|
|
90
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, this.state.open &&
|
|
91
|
+
react_dom_1.default.createPortal(react_1.default.createElement("div", { className: "popup-overlay ".concat(this.state.clickOverlayClosePopup ? 'hidden-overlay' : ''), onClick: this.state.clickOverlayClosePopup ? function (ev) {
|
|
92
|
+
if (ev.target.classList.contains('popup-overlay'))
|
|
93
|
+
_this.onClose();
|
|
94
|
+
} : undefined },
|
|
95
|
+
react_1.default.createElement("div", { ref: this.ref, className: 'popup-container col', onClick: function (e) { return e.stopPropagation(); }, style: this.state.style },
|
|
96
|
+
this.state.heading,
|
|
97
|
+
this.state.content,
|
|
98
|
+
this.state.footer,
|
|
99
|
+
this.state.hideButtonClose ? null : react_1.default.createElement("button", { type: 'button', onClick: function () { return _this.onClose(); }, className: 'popup-close-btn row' },
|
|
100
|
+
react_1.default.createElement("svg", { width: '100%', height: '100%', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', style: { width: '2rem', height: '2rem' } },
|
|
101
|
+
react_1.default.createElement("path", { fillRule: 'evenodd', clipRule: 'evenodd', d: 'M16.4223 4.7559C16.7477 4.43047 16.7477 3.90283 16.4223 3.57739C16.0968 3.25195 15.5692 3.25195 15.2438 3.57739L9.99967 8.82147L4.7556 3.57739C4.43016 3.25195 3.90252 3.25195 3.57709 3.57739C3.25165 3.90283 3.25165 4.43047 3.57709 4.7559L8.82116 9.99998L3.57709 15.2441C3.25165 15.5695 3.25165 16.0971 3.57709 16.4226C3.90252 16.748 4.43016 16.748 4.7556 16.4226L9.99967 11.1785L15.2438 16.4226C15.5692 16.748 16.0968 16.748 16.4223 16.4226C16.7477 16.0971 16.7477 15.5695 16.4223 15.2441L11.1782 9.99998L16.4223 4.7559Z', fill: '#00204D', fillOpacity: 0.6 }))))), document.body)));
|
|
102
|
+
};
|
|
103
|
+
return Popup;
|
|
104
|
+
}(react_1.default.Component));
|
|
105
|
+
exports.Popup = Popup;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import './progress-bar.css';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { ComponentStatus } from '../../index';
|
|
5
|
+
export declare function ProgressBar({ status, percent, titleText, title, hideTitle, progressBarOnly, fullColor, percentColor, style, progressBarStyle }: {
|
|
6
|
+
percent: number;
|
|
7
|
+
titleText?: string;
|
|
8
|
+
title?: ReactNode;
|
|
9
|
+
hideTitle: boolean;
|
|
10
|
+
progressBarOnly: boolean;
|
|
11
|
+
fullColor: string;
|
|
12
|
+
percentColor: string;
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
status: ComponentStatus;
|
|
15
|
+
progressBarStyle?: CSSProperties;
|
|
16
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ProgressBar = void 0;
|
|
18
|
+
var react_1 = require("react");
|
|
19
|
+
require("./progress-bar.css");
|
|
20
|
+
var react_2 = __importDefault(require("react"));
|
|
21
|
+
var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
22
|
+
var free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
23
|
+
var index_1 = require("../../index");
|
|
24
|
+
function ProgressBar(_a) {
|
|
25
|
+
var _b = _a.status, status = _b === void 0 ? 1 /* ComponentStatus.INFOR */ : _b, _c = _a.percent, percent = _c === void 0 ? 100 : _c, titleText = _a.titleText, title = _a.title, _d = _a.hideTitle, hideTitle = _d === void 0 ? false : _d, _e = _a.progressBarOnly, progressBarOnly = _e === void 0 ? false : _e, _f = _a.fullColor, fullColor = _f === void 0 ? 'var(--background)' : _f, _g = _a.percentColor, percentColor = _g === void 0 ? 'var(--infor-color)' : _g, style = _a.style, progressBarStyle = _a.progressBarStyle;
|
|
26
|
+
var _h = (0, react_1.useState)(true), openDetails = _h[0], setOpenDetails = _h[1];
|
|
27
|
+
return react_2.default.createElement("div", { className: "progress-bar-container col", style: style ? __assign({ padding: progressBarOnly ? '0' : '1.6rem 2.4rem' }, style) : { padding: progressBarOnly ? '0' : '1.6rem 2.4rem' } },
|
|
28
|
+
(hideTitle || progressBarOnly) ? null : (title !== null && title !== void 0 ? title : react_2.default.createElement("div", { className: "progress-bar-title row" },
|
|
29
|
+
react_2.default.createElement("div", { className: "heading-text" }, titleText),
|
|
30
|
+
react_2.default.createElement("button", { type: "button", className: "suffix-action", onClick: function () { setOpenDetails(!openDetails); } },
|
|
31
|
+
react_2.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: openDetails ? free_solid_svg_icons_1.faChevronDown : free_solid_svg_icons_1.faChevronUp })))),
|
|
32
|
+
openDetails ? react_2.default.createElement("div", { className: 'progress-bar-tile row' },
|
|
33
|
+
react_2.default.createElement("div", { className: "progress-bar-value", style: __assign({ '--percent-color': percentColor, '--full-color': fullColor, '--percent': "".concat(percent, "%") }, (progressBarStyle !== null && progressBarStyle !== void 0 ? progressBarStyle : {})) }),
|
|
34
|
+
progressBarOnly || status === 1 /* ComponentStatus.INFOR */ ? null : react_2.default.createElement("div", { className: 'status-icon' }, (0, index_1.getStatusIcon)(status)),
|
|
35
|
+
progressBarOnly ? null : react_2.default.createElement("div", { className: 'text-value' },
|
|
36
|
+
percent,
|
|
37
|
+
"/100")) : null);
|
|
38
|
+
}
|
|
39
|
+
exports.ProgressBar = ProgressBar;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import './progress-circle.css';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export declare function ProgressCircle({ percent, style, fillColor, percentColor, strokeWidth, strokeColor, textStyle }: {
|
|
5
|
+
/** value: 0 - 100 (%)*/
|
|
6
|
+
percent?: number;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
fillColor?: string;
|
|
9
|
+
percentColor?: string;
|
|
10
|
+
strokeWidth?: number;
|
|
11
|
+
strokeColor?: string;
|
|
12
|
+
textStyle?: CSSProperties;
|
|
13
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ProgressCircle = void 0;
|
|
18
|
+
require("./progress-circle.css");
|
|
19
|
+
var react_1 = __importDefault(require("react"));
|
|
20
|
+
function ProgressCircle(_a) {
|
|
21
|
+
var percent = _a.percent, style = _a.style, fillColor = _a.fillColor, percentColor = _a.percentColor, strokeWidth = _a.strokeWidth, strokeColor = _a.strokeColor, textStyle = _a.textStyle;
|
|
22
|
+
var radius = 30 - (strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : 4);
|
|
23
|
+
var diameter = Math.PI * 2 * radius;
|
|
24
|
+
var strokeOffset = (1 - ((percent !== null && percent !== void 0 ? percent : 0) / 100)) * diameter;
|
|
25
|
+
return react_1.default.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 60 60", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: __assign({ width: 60, height: 60 }, (style !== null && style !== void 0 ? style : {})) },
|
|
26
|
+
react_1.default.createElement("path", { d: "M 30,30 m 0,-".concat(radius, " a ").concat(radius, ",").concat(radius, " 0 1 1 0,").concat(2 * radius, " a ").concat(radius, ",").concat(radius, " 0 1 1 0,-").concat(2 * radius), style: { fill: "none", stroke: strokeColor !== null && strokeColor !== void 0 ? strokeColor : "#E6EAF0", strokeWidth: strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : '4px', } }),
|
|
27
|
+
react_1.default.createElement("path", { d: "M 30,30 m 0,-".concat(radius, " a ").concat(radius, ",").concat(radius, " 0 1 1 0,").concat(2 * radius, " a ").concat(radius, ",").concat(radius, " 0 1 1 0,-").concat(2 * radius), style: { fill: fillColor !== null && fillColor !== void 0 ? fillColor : "none", stroke: percentColor !== null && percentColor !== void 0 ? percentColor : "var(--infor-color)", strokeWidth: strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : '4px', strokeLinecap: 'round', strokeDasharray: "".concat(diameter, "px ").concat(diameter, "px"), strokeDashoffset: "".concat(strokeOffset, "px") } }),
|
|
28
|
+
react_1.default.createElement("text", { x: "50%", y: "50%", fill: "#00204D", dy: ".3em", textAnchor: "middle", fontSize: 16, fontWeight: '600', style: textStyle }, percent !== null && percent !== void 0 ? percent : 0,
|
|
29
|
+
"%"));
|
|
30
|
+
}
|
|
31
|
+
exports.ProgressCircle = ProgressCircle;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import './radio-button.css';
|
|
3
|
+
import { UseFormRegister } from 'react-hook-form';
|
|
4
|
+
interface RadioButtonProps {
|
|
5
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
6
|
+
value?: string | number | readonly string[];
|
|
7
|
+
disabled: false;
|
|
8
|
+
style: CSSProperties;
|
|
9
|
+
size?: number | string;
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
name?: string;
|
|
12
|
+
activeColor?: string;
|
|
13
|
+
offColor?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
register?: UseFormRegister<{}>;
|
|
16
|
+
}
|
|
17
|
+
export declare class RadioButton extends React.Component<RadioButtonProps> {
|
|
18
|
+
render(): React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.RadioButton = void 0;
|
|
33
|
+
var react_1 = __importDefault(require("react"));
|
|
34
|
+
require("./radio-button.css");
|
|
35
|
+
var RadioButton = /** @class */ (function (_super) {
|
|
36
|
+
__extends(RadioButton, _super);
|
|
37
|
+
function RadioButton() {
|
|
38
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
39
|
+
}
|
|
40
|
+
RadioButton.prototype.render = function () {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
var convertStyle = {
|
|
43
|
+
'--off-color': (_a = this.props.offColor) !== null && _a !== void 0 ? _a : '#ccd7e6',
|
|
44
|
+
'--active-color': (_b = this.props.activeColor) !== null && _b !== void 0 ? _b : 'var(--infor-color)',
|
|
45
|
+
'--size': this.props.size ? (typeof this.props.size === 'number') ? "".concat(this.props.size, "px") : this.props.size : '20px'
|
|
46
|
+
};
|
|
47
|
+
if (this.props.style) {
|
|
48
|
+
delete this.props.style.width;
|
|
49
|
+
delete this.props.style.minWidth;
|
|
50
|
+
delete this.props.style.maxWidth;
|
|
51
|
+
delete this.props.style.height;
|
|
52
|
+
delete this.props.style.minHeight;
|
|
53
|
+
delete this.props.style.maxHeight;
|
|
54
|
+
convertStyle = __assign(__assign({}, this.props.style), convertStyle);
|
|
55
|
+
}
|
|
56
|
+
return react_1.default.createElement("label", { className: "radio-btn-container row ".concat((_c = this.props.className) !== null && _c !== void 0 ? _c : ''), style: convertStyle },
|
|
57
|
+
this.props.register ?
|
|
58
|
+
react_1.default.createElement("input", __assign({}, this.props.register, { type: "radio", value: this.props.value, disabled: this.props.disabled })) :
|
|
59
|
+
react_1.default.createElement("input", { type: "radio", name: this.props.name, value: this.props.value, defaultChecked: this.props.defaultChecked, disabled: this.props.disabled, onChange: this.props.onChange }),
|
|
60
|
+
react_1.default.createElement("span", { className: "checkmark" }));
|
|
61
|
+
};
|
|
62
|
+
return RadioButton;
|
|
63
|
+
}(react_1.default.Component));
|
|
64
|
+
exports.RadioButton = RadioButton;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
|
+
import './rating.css';
|
|
3
|
+
interface RatingProps {
|
|
4
|
+
/**
|
|
5
|
+
value: 0-5
|
|
6
|
+
*/
|
|
7
|
+
value?: number;
|
|
8
|
+
size?: number | string;
|
|
9
|
+
onChange?: (e: number) => {};
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
strokeColor?: string;
|
|
13
|
+
fillColor?: string;
|
|
14
|
+
}
|
|
15
|
+
interface RatingState {
|
|
16
|
+
value: number;
|
|
17
|
+
}
|
|
18
|
+
export declare class Rating extends React.Component<RatingProps, RatingState> {
|
|
19
|
+
state: Readonly<RatingState>;
|
|
20
|
+
componentDidUpdate(prevProps: Readonly<RatingProps>): void;
|
|
21
|
+
render(): React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.Rating = void 0;
|
|
22
|
+
var react_1 = __importDefault(require("react"));
|
|
23
|
+
require("./rating.css");
|
|
24
|
+
var autoKeyId = function () { return ("".concat(1e7 + -1e3 + -4e3 + -8e3 + -1e11)).replace(/[018]/g, function (c) {
|
|
25
|
+
return (parseFloat(c) ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (parseFloat(c) / 4)))).toString(16);
|
|
26
|
+
}); };
|
|
27
|
+
var Rating = /** @class */ (function (_super) {
|
|
28
|
+
__extends(Rating, _super);
|
|
29
|
+
function Rating() {
|
|
30
|
+
var _this = this;
|
|
31
|
+
var _a;
|
|
32
|
+
_this = _super.apply(this, arguments) || this;
|
|
33
|
+
_this.state = {
|
|
34
|
+
value: (_a = _this.props.value) !== null && _a !== void 0 ? _a : 0
|
|
35
|
+
};
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
Rating.prototype.componentDidUpdate = function (prevProps) {
|
|
39
|
+
var _a;
|
|
40
|
+
if (prevProps.value !== this.props.value) {
|
|
41
|
+
this.setState({ value: (_a = this.props.value) !== null && _a !== void 0 ? _a : 0 });
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
Rating.prototype.render = function () {
|
|
45
|
+
var _this = this;
|
|
46
|
+
var _a;
|
|
47
|
+
return react_1.default.createElement("div", { className: "row rating-container ".concat((_a = this.props.className) !== null && _a !== void 0 ? _a : ''), style: this.props.style }, Array.from({ length: 5 }).map(function (_, i) {
|
|
48
|
+
var _a, _b, _c, _d, _e;
|
|
49
|
+
var uniqueId = 'rating-star-grad-0';
|
|
50
|
+
var stopValue = 0;
|
|
51
|
+
if (_this.state.value >= 5) {
|
|
52
|
+
uniqueId = 'rating-star-grad-5';
|
|
53
|
+
stopValue = 100;
|
|
54
|
+
}
|
|
55
|
+
else if (_this.state.value >= i) {
|
|
56
|
+
uniqueId = autoKeyId();
|
|
57
|
+
stopValue = (_this.state.value - i) * 100;
|
|
58
|
+
}
|
|
59
|
+
return react_1.default.createElement("svg", { onClick: function () {
|
|
60
|
+
if (_this.props.onChange) {
|
|
61
|
+
_this.setState({ value: i + 1 });
|
|
62
|
+
_this.props.onChange(i + 1);
|
|
63
|
+
}
|
|
64
|
+
}, 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" },
|
|
65
|
+
react_1.default.createElement("defs", null,
|
|
66
|
+
react_1.default.createElement("linearGradient", { id: uniqueId, x1: "0%", x2: "100%", y1: "0%", y2: "0%" },
|
|
67
|
+
react_1.default.createElement("stop", { offset: "0%", stopColor: (_c = _this.props.fillColor) !== null && _c !== void 0 ? _c : '#FC6B03' }),
|
|
68
|
+
react_1.default.createElement("stop", { offset: "".concat(stopValue, "%"), stopColor: (_d = _this.props.fillColor) !== null && _d !== void 0 ? _d : '#FC6B03' }),
|
|
69
|
+
react_1.default.createElement("stop", { offset: "".concat(stopValue, "%"), stopColor: "#00000000" }))),
|
|
70
|
+
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", fill: (_e = _this.props.strokeColor) !== null && _e !== void 0 ? _e : '#667994' }),
|
|
71
|
+
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, ")") }));
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
return Rating;
|
|
75
|
+
}(react_1.default.Component));
|
|
76
|
+
exports.Rating = Rating;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import './select1.css';
|
|
3
|
+
interface OptionsItem {
|
|
4
|
+
id: string | number;
|
|
5
|
+
name: string | ReactNode;
|
|
6
|
+
title?: string | ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface Select1Props {
|
|
9
|
+
value?: any;
|
|
10
|
+
options: Required<Array<OptionsItem>>;
|
|
11
|
+
onChange?: (value?: OptionsItem) => void;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
helperText?: string;
|
|
16
|
+
helperTextColor?: string;
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
searchPlaceholder?: string;
|
|
19
|
+
hideSearch?: boolean;
|
|
20
|
+
handleSearch?: (e: string) => Promise<Array<OptionsItem>>;
|
|
21
|
+
}
|
|
22
|
+
interface Select1State {
|
|
23
|
+
value?: string | number;
|
|
24
|
+
offset: DOMRect;
|
|
25
|
+
isOpen: boolean;
|
|
26
|
+
onSelect: any;
|
|
27
|
+
search?: Array<OptionsItem>;
|
|
28
|
+
style?: Object;
|
|
29
|
+
}
|
|
30
|
+
export declare class Select1 extends React.Component<Select1Props, Select1State> {
|
|
31
|
+
constructor(props: Select1Props);
|
|
32
|
+
private parseValue;
|
|
33
|
+
componentDidUpdate(prevProps: Select1Props, prevState: Select1State): void;
|
|
34
|
+
private onChangeValue;
|
|
35
|
+
private search;
|
|
36
|
+
render(): React.JSX.Element;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,185 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.Select1 = void 0;
|
|
33
|
+
var react_1 = __importDefault(require("react"));
|
|
34
|
+
var free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
35
|
+
var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
36
|
+
var react_dom_1 = __importDefault(require("react-dom"));
|
|
37
|
+
require("./select1.css");
|
|
38
|
+
;
|
|
39
|
+
;
|
|
40
|
+
var Select1 = /** @class */ (function (_super) {
|
|
41
|
+
__extends(Select1, _super);
|
|
42
|
+
function Select1(props) {
|
|
43
|
+
var _this = _super.call(this, props) || this;
|
|
44
|
+
_this.state = {
|
|
45
|
+
value: _this.props.value,
|
|
46
|
+
offset: {
|
|
47
|
+
x: 0,
|
|
48
|
+
y: 0,
|
|
49
|
+
height: 0,
|
|
50
|
+
width: 0,
|
|
51
|
+
bottom: 0,
|
|
52
|
+
left: 0,
|
|
53
|
+
right: 0,
|
|
54
|
+
top: 0,
|
|
55
|
+
toJSON: function () {
|
|
56
|
+
throw new Error('Function not implemented.');
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
isOpen: false,
|
|
60
|
+
onSelect: null,
|
|
61
|
+
};
|
|
62
|
+
_this.parseValue = _this.parseValue.bind(_this);
|
|
63
|
+
_this.onChangeValue = _this.onChangeValue.bind(_this);
|
|
64
|
+
_this.search = _this.search.bind(_this);
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
Select1.prototype.parseValue = function (value) {
|
|
68
|
+
if (value === null || value === undefined || value === '') {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
switch (typeof this.props.options[0].id) {
|
|
72
|
+
case 'number':
|
|
73
|
+
return parseFloat(value);
|
|
74
|
+
default:
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
Select1.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
79
|
+
var _a;
|
|
80
|
+
if (prevProps.value !== this.props.value) {
|
|
81
|
+
this.setState(__assign(__assign({}, this.state), { value: this.props.value }));
|
|
82
|
+
}
|
|
83
|
+
if (prevState.isOpen !== this.state.isOpen && this.state.isOpen) {
|
|
84
|
+
var thisPopupRect = (_a = document.body.querySelector('.select1-popup')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
85
|
+
if (thisPopupRect) {
|
|
86
|
+
var style = void 0;
|
|
87
|
+
if (thisPopupRect.right > document.body.offsetWidth) {
|
|
88
|
+
style = {
|
|
89
|
+
top: this.state.offset.y + this.state.offset.height + 2 + 'px',
|
|
90
|
+
width: "".concat(this.state.offset.width, "px"),
|
|
91
|
+
right: document.body.offsetWidth - this.state.offset.right + 'px'
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (thisPopupRect.bottom > document.body.offsetHeight) {
|
|
95
|
+
style = style ? __assign(__assign({}, style), { top: undefined, bottom: document.body.offsetHeight - this.state.offset.bottom + 'px' }) : {
|
|
96
|
+
left: this.state.offset.x + 'px',
|
|
97
|
+
width: "".concat(this.state.offset.width, "px"),
|
|
98
|
+
bottom: document.body.offsetHeight - this.state.offset.bottom + 'px'
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (style)
|
|
102
|
+
this.setState(__assign(__assign({}, this.state), { style: style }));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
Select1.prototype.onChangeValue = function (ev) {
|
|
107
|
+
var _this = this;
|
|
108
|
+
var _a, _b;
|
|
109
|
+
if ((_b = (_a = this.state.onSelect) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.contains('select1-tile')) {
|
|
110
|
+
var item = this.props.options.find(function (e) { return e.id === _this.parseValue(_this.state.onSelect.id); });
|
|
111
|
+
this.setState(__assign(__assign({}, this.state), { isOpen: false, onSelect: null, value: item === null || item === void 0 ? void 0 : item.id }));
|
|
112
|
+
if (this.props.onChange)
|
|
113
|
+
this.props.onChange(item);
|
|
114
|
+
}
|
|
115
|
+
else if (this.state.onSelect) {
|
|
116
|
+
ev.target.focus();
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
this.setState(__assign(__assign({}, this.state), { isOpen: false, onSelect: null }));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
Select1.prototype.search = function (ev) {
|
|
123
|
+
var _this = this;
|
|
124
|
+
if (ev.target.value.trim().length) {
|
|
125
|
+
if (this.props.handleSearch) {
|
|
126
|
+
this.props.handleSearch(ev.target.value.trim()).then(function (res) {
|
|
127
|
+
_this.setState(__assign(__assign({}, _this.state), { search: res }));
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
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()); }) }));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.setState(__assign(__assign({}, this.state), { search: undefined }));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
Select1.prototype.render = function () {
|
|
139
|
+
var _this = this;
|
|
140
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
141
|
+
var selectedValue = ((_a = this.props.options) !== null && _a !== void 0 ? _a : []).find(function (e) { return e.id === _this.state.value; });
|
|
142
|
+
return react_1.default.createElement("div", { className: "select1-container row ".concat((_b = this.props.className) !== null && _b !== void 0 ? _b : 'placeholder-2', " ").concat(this.props.disabled ? 'disabled' : '', " ").concat(((_c = this.props.helperText) === null || _c === void 0 ? void 0 : _c.length) && 'helper-text'), "helper-text": this.props.helperText, style: this.props.style ? __assign(__assign({}, { '--helper-text-color': (_d = this.props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' }), this.props.style) : { '--helper-text-color': (_e = this.props.helperTextColor) !== null && _e !== void 0 ? _e : '#e14337' }, onClick: function (ev) {
|
|
143
|
+
var _a;
|
|
144
|
+
if (!_this.state.isOpen) {
|
|
145
|
+
var _offset = ((_a = ev.target.closest('.select1-container')) !== null && _a !== void 0 ? _a : ev.target).getBoundingClientRect();
|
|
146
|
+
if (_offset.bottom + 32 > document.body.offsetHeight) {
|
|
147
|
+
_this.setState(__assign(__assign({}, _this.state), { isOpen: true, offset: _offset, style: {
|
|
148
|
+
left: _offset.x + 'px',
|
|
149
|
+
bottom: (document.body.offsetHeight - _offset.y) + 'px',
|
|
150
|
+
width: "".concat(_offset.width / 10, "rem")
|
|
151
|
+
} }));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
_this.setState(__assign(__assign({}, _this.state), { isOpen: true, offset: _offset, style: undefined }));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} },
|
|
158
|
+
(selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.name) ? (react_1.default.createElement("div", { className: 'select1-value-name' }, selectedValue.name)) : (react_1.default.createElement("div", { className: 'select1-placeholder' }, this.props.placeholder)),
|
|
159
|
+
react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: this.state.isOpen ? free_solid_svg_icons_1.faChevronUp : free_solid_svg_icons_1.faChevronDown, style: { fontSize: '1.2rem', color: '#888' } }),
|
|
160
|
+
this.state.isOpen &&
|
|
161
|
+
react_dom_1.default.createPortal(react_1.default.createElement("div", { className: 'select1-popup col', style: (_f = this.state.style) !== null && _f !== void 0 ? _f : {
|
|
162
|
+
top: this.state.offset.y + this.state.offset.height + 2 + 'px',
|
|
163
|
+
left: this.state.offset.x + 'px',
|
|
164
|
+
width: this.state.offset.width,
|
|
165
|
+
}, onMouseOver: function (ev) {
|
|
166
|
+
_this.setState(__assign(__assign({}, _this.state), { onSelect: ev.target }));
|
|
167
|
+
}, onMouseOut: function () {
|
|
168
|
+
return _this.setState(__assign(__assign({}, _this.state), { onSelect: null }));
|
|
169
|
+
} },
|
|
170
|
+
react_1.default.createElement("div", { className: 'row header-search', style: this.props.hideSearch ? { marginTop: '-4rem' } : undefined },
|
|
171
|
+
react_1.default.createElement("input", { autoFocus: true, placeholder: (_g = this.props.searchPlaceholder) !== null && _g !== void 0 ? _g : 'Tìm kiếm', onChange: this.search, onBlur: function (ev) {
|
|
172
|
+
_this.onChangeValue(ev);
|
|
173
|
+
} }),
|
|
174
|
+
react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faSearch, style: { fontSize: '1.2rem', color: '#161D24D9' } })),
|
|
175
|
+
react_1.default.createElement("div", { className: 'col select1-body' },
|
|
176
|
+
react_1.default.createElement("div", { className: 'col select1-scroll-view' },
|
|
177
|
+
((_h = this.state.search) !== null && _h !== void 0 ? _h : this.props.options).map(function (item) {
|
|
178
|
+
var _a;
|
|
179
|
+
return (react_1.default.createElement("button", { type: 'button', key: item.id, className: 'select1-tile label-3 row', id: "".concat(item.id), style: { backgroundColor: (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.id) === item.id ? 'var(--selected-background)' : '#00000000' } }, (_a = item.title) !== null && _a !== void 0 ? _a : item.name));
|
|
180
|
+
}),
|
|
181
|
+
(((_j = this.state.search) === null || _j === void 0 ? void 0 : _j.length) === 0 || ((_k = this.props.options) === null || _k === void 0 ? void 0 : _k.length) === 0) && (react_1.default.createElement("div", { className: 'no-results-found' }, "No result found"))))), document.body));
|
|
182
|
+
};
|
|
183
|
+
return Select1;
|
|
184
|
+
}(react_1.default.Component));
|
|
185
|
+
exports.Select1 = Select1;
|