wini-web-components 1.5.9 → 1.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.
- package/dist/component/dialog/dialog.d.ts +3 -2
- package/dist/component/dialog/dialog.js +13 -15
- package/dist/component/progress-bar/progress-bar.js +1 -1
- package/dist/component/select1/select1.d.ts +0 -1
- package/dist/component/select1/select1.js +7 -7
- package/dist/component/switch/switch.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import './dialog.css';
|
|
3
2
|
import { ComponentStatus } from '../../index';
|
|
4
3
|
export declare enum DialogAlignment {
|
|
5
4
|
start = "start",
|
|
@@ -13,15 +12,17 @@ interface DialogState {
|
|
|
13
12
|
content: string;
|
|
14
13
|
onSubmit: Function;
|
|
15
14
|
submitTitle?: string;
|
|
15
|
+
cancelTitle?: string;
|
|
16
16
|
alignment?: DialogAlignment;
|
|
17
17
|
}
|
|
18
|
-
export declare const showDialog: ({ ref, title, status, content, onSubmit, submitTitle, alignment }: {
|
|
18
|
+
export declare const showDialog: ({ ref, title, status, content, onSubmit, submitTitle, cancelTitle, alignment }: {
|
|
19
19
|
ref: React.MutableRefObject<Dialog>;
|
|
20
20
|
title?: string | undefined;
|
|
21
21
|
status?: ComponentStatus | undefined;
|
|
22
22
|
content?: string | undefined;
|
|
23
23
|
onSubmit?: Function | undefined;
|
|
24
24
|
submitTitle?: string | undefined;
|
|
25
|
+
cancelTitle?: string | undefined;
|
|
25
26
|
alignment?: DialogAlignment | undefined;
|
|
26
27
|
}) => void;
|
|
27
28
|
export declare class Dialog extends React.Component<Object, DialogState> {
|
|
@@ -32,7 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
exports.Dialog = exports.showDialog = exports.DialogAlignment = void 0;
|
|
33
33
|
var react_1 = __importDefault(require("react"));
|
|
34
34
|
var react_dom_1 = __importDefault(require("react-dom"));
|
|
35
|
-
require("./dialog.css");
|
|
35
|
+
var dialog_module_css_1 = __importDefault(require("./dialog.module.css"));
|
|
36
36
|
var index_1 = require("../../index");
|
|
37
37
|
var DialogAlignment;
|
|
38
38
|
(function (DialogAlignment) {
|
|
@@ -41,13 +41,14 @@ var DialogAlignment;
|
|
|
41
41
|
DialogAlignment["end"] = "end";
|
|
42
42
|
})(DialogAlignment = exports.DialogAlignment || (exports.DialogAlignment = {}));
|
|
43
43
|
var showDialog = function (_a) {
|
|
44
|
-
var ref = _a.ref, title = _a.title, status = _a.status, content = _a.content, onSubmit = _a.onSubmit, submitTitle = _a.submitTitle, alignment = _a.alignment;
|
|
44
|
+
var ref = _a.ref, title = _a.title, status = _a.status, content = _a.content, onSubmit = _a.onSubmit, submitTitle = _a.submitTitle, cancelTitle = _a.cancelTitle, alignment = _a.alignment;
|
|
45
45
|
ref.current.showDialogNoti({
|
|
46
46
|
title: title !== null && title !== void 0 ? title : '',
|
|
47
47
|
status: status !== null && status !== void 0 ? status : index_1.ComponentStatus.INFOR,
|
|
48
48
|
content: content !== null && content !== void 0 ? content : '',
|
|
49
49
|
onSubmit: onSubmit !== null && onSubmit !== void 0 ? onSubmit : (function () { }),
|
|
50
50
|
submitTitle: submitTitle,
|
|
51
|
+
cancelTitle: cancelTitle,
|
|
51
52
|
alignment: alignment
|
|
52
53
|
});
|
|
53
54
|
};
|
|
@@ -73,23 +74,20 @@ var Dialog = /** @class */ (function (_super) {
|
|
|
73
74
|
};
|
|
74
75
|
Dialog.prototype.render = function () {
|
|
75
76
|
var _this = this;
|
|
76
|
-
var _a;
|
|
77
|
+
var _a, _b;
|
|
77
78
|
return (react_1.default.createElement(react_1.default.Fragment, null, this.state.open &&
|
|
78
|
-
react_dom_1.default.createPortal(react_1.default.createElement("div", { className: 'dialog-overlay' },
|
|
79
|
-
react_1.default.createElement("div", { className: 'dialog-container col
|
|
80
|
-
react_1.default.createElement("div", { key: 'dialog-body', className: 'dialog-body col
|
|
81
|
-
react_1.default.createElement("div", { className: 'dialog-status row
|
|
82
|
-
react_1.default.createElement("div", { className: 'dialog-title', style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.title),
|
|
83
|
-
react_1.default.createElement("div", { className: 'dialog-content', style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.content)),
|
|
84
|
-
react_1.default.createElement("div", { key: 'dialog-footer', className: 'dialog-footer row
|
|
85
|
-
react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: function () { return _this.setState({ open: false }); }, className: 'dialog-action' }, "Quay
|
|
79
|
+
react_dom_1.default.createPortal(react_1.default.createElement("div", { className: dialog_module_css_1.default['dialog-overlay'] },
|
|
80
|
+
react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-container'], " col"), style: { width: '41.4rem', alignItems: this.state.alignment }, "dialog-type": this.state.status, onClick: function (e) { return e.stopPropagation(); } },
|
|
81
|
+
react_1.default.createElement("div", { key: 'dialog-body', className: "".concat(dialog_module_css_1.default['dialog-body'], " col"), style: { alignItems: 'inherit' } },
|
|
82
|
+
react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-status'], " row") }, (0, index_1.getStatusIcon)(this.state.status)),
|
|
83
|
+
react_1.default.createElement("div", { className: dialog_module_css_1.default['dialog-title'], style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.title),
|
|
84
|
+
react_1.default.createElement("div", { className: dialog_module_css_1.default['dialog-content'], style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.content)),
|
|
85
|
+
react_1.default.createElement("div", { key: 'dialog-footer', className: "".concat(dialog_module_css_1.default['dialog-footer'], " row") },
|
|
86
|
+
react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: function () { return _this.setState({ open: false }); }, className: dialog_module_css_1.default['dialog-action'] }, (_a = this.state.cancelTitle) !== null && _a !== void 0 ? _a : "Quay lại"),
|
|
86
87
|
react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: function () {
|
|
87
88
|
_this.state.onSubmit();
|
|
88
89
|
_this.setState({ open: false });
|
|
89
|
-
}, className: 'dialog-action dialog-submit' }, (
|
|
90
|
-
react_1.default.createElement("button", { type: 'button', onClick: function () { return _this.setState({ open: false }); }, className: 'dialog-close-btn row' },
|
|
91
|
-
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' } },
|
|
92
|
-
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)));
|
|
90
|
+
}, className: "".concat(dialog_module_css_1.default['dialog-action'], " ").concat(dialog_module_css_1.default['dialog-submit']) }, (_b = this.state.submitTitle) !== null && _b !== void 0 ? _b : 'Xác nhận')))), document.body)));
|
|
93
91
|
};
|
|
94
92
|
return Dialog;
|
|
95
93
|
}(react_1.default.Component));
|
|
@@ -22,7 +22,7 @@ var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
|
22
22
|
var free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
23
23
|
var index_1 = require("../../index");
|
|
24
24
|
function ProgressBar(_a) {
|
|
25
|
-
var id = _a.id, _b = _a.status, status = _b === void 0 ? index_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;
|
|
25
|
+
var id = _a.id, _b = _a.status, status = _b === void 0 ? index_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(--neutral-background-main)' : _f, _g = _a.percentColor, percentColor = _g === void 0 ? 'var(--infor-color)' : _g, style = _a.style, progressBarStyle = _a.progressBarStyle;
|
|
26
26
|
var _h = (0, react_1.useState)(true), openDetails = _h[0], setOpenDetails = _h[1];
|
|
27
27
|
return react_2.default.createElement("div", { id: id, className: "progress-bar-container col", style: style ? __assign({ padding: progressBarOnly ? '0' : '1.6rem 2.4rem' }, style) : { padding: progressBarOnly ? '0' : '1.6rem 2.4rem' } },
|
|
28
28
|
(hideTitle || progressBarOnly) ? null : (title !== null && title !== void 0 ? title : react_2.default.createElement("div", { className: "progress-bar-title row" },
|
|
@@ -89,11 +89,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
89
89
|
};
|
|
90
90
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91
91
|
exports.Select1 = void 0;
|
|
92
|
+
var select1_module_css_1 = __importDefault(require("./select1.module.css"));
|
|
92
93
|
var free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
93
94
|
var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
94
95
|
var react_1 = __importStar(require("react"));
|
|
95
96
|
var react_dom_1 = __importDefault(require("react-dom"));
|
|
96
|
-
require("./select1.css");
|
|
97
97
|
var text_1 = require("../text/text");
|
|
98
98
|
;
|
|
99
99
|
var Select1 = /** @class */ (function (_super) {
|
|
@@ -207,7 +207,7 @@ var Select1 = /** @class */ (function (_super) {
|
|
|
207
207
|
children = ((_a = this.state.search) !== null && _a !== void 0 ? _a : this.state.options).filter(function (e) { return e.parentId === item.id; });
|
|
208
208
|
//
|
|
209
209
|
return react_1.default.createElement("div", { key: item.id, className: 'col', style: { width: '100%' } },
|
|
210
|
-
react_1.default.createElement("div", { className: "select-tile row ".concat(item.disabled ? "disabled" : ""), style: { paddingLeft: item.parentId ? '4.4rem' : undefined, backgroundColor: this.state.selected === item.id ? "var(--selected-background)" : undefined }, onClick: children.length ? function () {
|
|
210
|
+
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: this.state.selected === item.id ? "var(--selected-background)" : undefined }, onClick: children.length ? function () {
|
|
211
211
|
if (_this.state.search) {
|
|
212
212
|
_this.setState(__assign(__assign({}, _this.state), { search: _this.state.search.map(function (e) {
|
|
213
213
|
if (e.id === item.id)
|
|
@@ -245,7 +245,7 @@ var Select1 = /** @class */ (function (_super) {
|
|
|
245
245
|
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 : "");
|
|
246
246
|
//
|
|
247
247
|
if (this.state.isOpen && prevState.isOpen !== this.state.isOpen) {
|
|
248
|
-
var thisPopupRect = (_e = document.body.querySelector('.select1-popup')) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect();
|
|
248
|
+
var thisPopupRect = (_e = document.body.querySelector(':scope > .col[class*="select1-popup"]')) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect();
|
|
249
249
|
if (thisPopupRect) {
|
|
250
250
|
var style = void 0;
|
|
251
251
|
if (thisPopupRect.right > document.body.offsetWidth) {
|
|
@@ -279,7 +279,7 @@ var Select1 = /** @class */ (function (_super) {
|
|
|
279
279
|
var _this = this;
|
|
280
280
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
281
281
|
var _value = this.state.options.find(function (e) { return e.id === _this.state.value; });
|
|
282
|
-
return react_1.default.createElement("div", { id: this.props.id, ref: this.containerRef, className: "select1-container row ".concat(this.props.disabled ? 'disabled' : '', " ").concat(((_a = this.props.helperText) === null || _a === void 0 ? void 0 : _a.length) && '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 () {
|
|
282
|
+
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 () {
|
|
283
283
|
var _a, _b, _c;
|
|
284
284
|
if (!_this.state.isOpen) {
|
|
285
285
|
_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() }));
|
|
@@ -300,14 +300,14 @@ var Select1 = /** @class */ (function (_super) {
|
|
|
300
300
|
react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faXmarkCircle, style: { fontSize: '1.6rem', color: "var(--neutral-text-color-subtitle)" } })) : react_1.default.createElement("div", { className: 'row', style: { display: (!this.containerRef.current || this.containerRef.current.getBoundingClientRect().width >= 120) ? "flex" : "none" } },
|
|
301
301
|
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.1rem', color: "var(--neutral-text-color-subtitle)" } })),
|
|
302
302
|
this.state.isOpen &&
|
|
303
|
-
react_dom_1.default.createPortal(react_1.default.createElement("div", { className: "select1-popup col ".concat((_e = this.props.popupClassName) !== null && _e !== void 0 ? _e : ""), style: (_f = this.state.style) !== null && _f !== void 0 ? _f : {
|
|
303
|
+
react_dom_1.default.createPortal(react_1.default.createElement("div", { className: "".concat(select1_module_css_1.default['select1-popup'], " col ").concat((_e = this.props.popupClassName) !== null && _e !== void 0 ? _e : ""), style: (_f = this.state.style) !== null && _f !== void 0 ? _f : {
|
|
304
304
|
top: this.state.offset.y + this.state.offset.height + 2 + 'px',
|
|
305
305
|
left: this.state.offset.x + 'px',
|
|
306
306
|
width: this.state.offset.width,
|
|
307
307
|
}, onMouseOver: function (ev) { return _this.setState(__assign(__assign({}, _this.state), { onSelect: ev.target })); }, onMouseOut: function () { return _this.setState(__assign(__assign({}, _this.state), { onSelect: null })); } },
|
|
308
|
-
react_1.default.createElement("div", { className:
|
|
308
|
+
react_1.default.createElement("div", { className: "col ".concat(select1_module_css_1.default['select-body']) },
|
|
309
309
|
((_g = this.state.search) !== null && _g !== void 0 ? _g : this.state.options).filter(function (e) { return !e.parentId; }).map(function (item) { return _this.renderOptions(item); }),
|
|
310
|
-
(((_h = this.state.search) === null || _h === void 0 ? void 0 : _h.length) === 0 || ((_j = this.props.options) === null || _j === void 0 ? void 0 : _j.length) === 0) && (react_1.default.createElement("div", { className: 'no-results-found' }, "No result found")))), document.body));
|
|
310
|
+
(((_h = this.state.search) === null || _h === void 0 ? void 0 : _h.length) === 0 || ((_j = this.props.options) === null || _j === void 0 ? void 0 : _j.length) === 0) && (react_1.default.createElement("div", { className: select1_module_css_1.default['no-results-found'] }, "No result found")))), document.body));
|
|
311
311
|
};
|
|
312
312
|
return Select1;
|
|
313
313
|
}(react_1.default.Component));
|
|
@@ -52,7 +52,7 @@ var Switch = /** @class */ (function (_super) {
|
|
|
52
52
|
var _this = this;
|
|
53
53
|
var _a, _b, _c, _d;
|
|
54
54
|
var propStyle = {
|
|
55
|
-
'--off-bg': (_a = this.props.offBackground) !== null && _a !== void 0 ? _a : 'var(--background)',
|
|
55
|
+
'--off-bg': (_a = this.props.offBackground) !== null && _a !== void 0 ? _a : 'var(--neutral-background-main)',
|
|
56
56
|
'--on-bg': (_b = this.props.onBackground) !== null && _b !== void 0 ? _b : 'var(--infor-color)',
|
|
57
57
|
'--dot-color': (_c = this.props.dotColor) !== null && _c !== void 0 ? _c : '#ffffff',
|
|
58
58
|
'--size': this.props.size ? (typeof this.props.size === 'number') ? "".concat(this.props.size, "px") : this.props.size : '2rem'
|
package/dist/index.d.ts
CHANGED