wini-web-components 2.2.7 → 2.3.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 (63) hide show
  1. package/dist/component/button/button.d.ts +16 -16
  2. package/dist/component/button/button.js +39 -39
  3. package/dist/component/calendar/calendar.d.ts +30 -46
  4. package/dist/component/calendar/calendar.js +437 -432
  5. package/dist/component/checkbox/checkbox.d.ts +22 -22
  6. package/dist/component/checkbox/checkbox.js +80 -81
  7. package/dist/component/component-status.d.ts +8 -8
  8. package/dist/component/component-status.js +39 -39
  9. package/dist/component/date-picker/date-picker.d.ts +25 -36
  10. package/dist/component/date-picker/date-picker.js +362 -359
  11. package/dist/component/dialog/dialog.d.ts +36 -34
  12. package/dist/component/dialog/dialog.js +99 -97
  13. package/dist/component/import-file/import-file.d.ts +24 -36
  14. package/dist/component/import-file/import-file.js +154 -119
  15. package/dist/component/infinite-scroll/infinite-scroll.d.ts +17 -17
  16. package/dist/component/infinite-scroll/infinite-scroll.js +103 -103
  17. package/dist/component/input-multi-select/input-multi-select.d.ts +21 -38
  18. package/dist/component/input-multi-select/input-multi-select.js +334 -323
  19. package/dist/component/input-opt/input-opt.d.ts +21 -0
  20. package/dist/component/input-opt/input-opt.js +157 -0
  21. package/dist/component/number-picker/number-picker.d.ts +19 -19
  22. package/dist/component/number-picker/number-picker.js +137 -127
  23. package/dist/component/pagination/pagination.d.ts +13 -13
  24. package/dist/component/pagination/pagination.js +93 -82
  25. package/dist/component/popup/popup.d.ts +33 -33
  26. package/dist/component/popup/popup.js +138 -105
  27. package/dist/component/progress-bar/progress-bar.d.ts +16 -16
  28. package/dist/component/progress-bar/progress-bar.js +35 -36
  29. package/dist/component/progress-circle/progress-circle.d.ts +14 -14
  30. package/dist/component/progress-circle/progress-circle.js +30 -31
  31. package/dist/component/radio-button/radio-button.d.ts +20 -20
  32. package/dist/component/radio-button/radio-button.js +64 -64
  33. package/dist/component/rating/rating.d.ts +23 -23
  34. package/dist/component/rating/rating.js +73 -74
  35. package/dist/component/select1/select1.d.ts +31 -50
  36. package/dist/component/select1/select1.js +320 -309
  37. package/dist/component/slider/slider.d.ts +31 -31
  38. package/dist/component/slider/slider.js +80 -81
  39. package/dist/component/switch/switch.d.ts +23 -23
  40. package/dist/component/switch/switch.js +80 -81
  41. package/dist/component/table/table.d.ts +51 -51
  42. package/dist/component/table/table.js +119 -119
  43. package/dist/component/tag/tag.d.ts +17 -17
  44. package/dist/component/tag/tag.js +39 -39
  45. package/dist/component/text/text.d.ts +16 -16
  46. package/dist/component/text/text.js +51 -51
  47. package/dist/component/text-area/text-area.d.ts +28 -28
  48. package/dist/component/text-area/text-area.js +83 -73
  49. package/dist/component/text-field/text-field.d.ts +33 -33
  50. package/dist/component/text-field/text-field.js +107 -97
  51. package/dist/component/toast-noti/toast-noti.d.ts +5 -5
  52. package/dist/component/toast-noti/toast-noti.js +28 -28
  53. package/dist/component/wini-icon/winicon.d.ts +16 -16
  54. package/dist/component/wini-icon/winicon.js +121 -112
  55. package/dist/form/login/view.d.ts +40 -40
  56. package/dist/form/login/view.js +66 -65
  57. package/dist/i18n.d.ts +2 -0
  58. package/dist/i18n.js +125 -0
  59. package/dist/index.d.ts +32 -30
  60. package/dist/index.js +1 -1
  61. package/dist/language/i18n.d.ts +2 -0
  62. package/dist/language/i18n.js +125 -0
  63. package/package.json +5 -3
@@ -1,82 +1,93 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Pagination = void 0;
30
- var react_1 = __importStar(require("react"));
31
- var react_paginate_1 = __importDefault(require("react-paginate"));
32
- var pagination_module_css_1 = __importDefault(require("./pagination.module.css"));
33
- var select1_1 = require("../select1/select1");
34
- var text_1 = require("../text/text");
35
- var text_field_1 = require("../text-field/text-field");
36
- var winicon_1 = require("../wini-icon/winicon");
37
- function Pagination(_a) {
38
- var id = _a.id, currentPage = _a.currentPage, itemPerPage = _a.itemPerPage, totalItem = _a.totalItem, onChangePage = _a.onChangePage, _b = _a.hidePageSize, hidePageSize = _b === void 0 ? false : _b, _c = _a.hideGoToPage, hideGoToPage = _c === void 0 ? false : _c, style = _a.style;
39
- var goToPageRef = (0, react_1.useRef)();
40
- (0, react_1.useEffect)(function () {
41
- if (goToPageRef.current) {
42
- var _inputPage = goToPageRef.current.getInput();
43
- if (_inputPage)
44
- _inputPage.value = currentPage.toString();
45
- }
46
- }, [currentPage]);
47
- if (currentPage > 1 && (totalItem === 0 || (Math.floor(totalItem / itemPerPage) + (totalItem % itemPerPage === 0 ? 0 : 1)) < currentPage)) {
48
- onChangePage(1, itemPerPage);
49
- return react_1.default.createElement("div", null);
50
- }
51
- else if (totalItem > 0) {
52
- return react_1.default.createElement("div", { id: id, className: "".concat(pagination_module_css_1.default['custom-pagination'], " row"), style: style },
53
- hidePageSize ? null : react_1.default.createElement("div", { className: "row", style: { gap: '0.8rem' } },
54
- react_1.default.createElement(select1_1.Select1, { readOnly: true, placeholder: itemPerPage.toString(), options: [10, 20, 50, 80, 100, 150, 200].map(function (item, _) { return { id: item, name: item }; }), style: { borderRadius: '0.4rem', width: '5.6rem', padding: '0 0.8rem', height: '2.4rem' }, onChange: function (ev) {
55
- onChangePage(currentPage, isNaN(parseInt(ev.id)) ? itemPerPage : parseInt(ev.id));
56
- } }),
57
- react_1.default.createElement(text_1.Text, { className: "body-3" },
58
- "of ",
59
- totalItem,
60
- " items")),
61
- react_1.default.createElement("div", { style: { flex: 1 } }),
62
- react_1.default.createElement(react_paginate_1.default, { onPageChange: function (ev) {
63
- onChangePage(ev.selected + 1, itemPerPage);
64
- }, forcePage: currentPage - 1, breakClassName: "row button-text-3", breakLabel: "...", pageCount: Math.ceil(totalItem / itemPerPage), previousClassName: "row", previousLabel: react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/left-arrow", size: "1.4rem" }), nextClassName: "row", nextLabel: react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/right-arrow", size: "1.4rem" }), containerClassName: "".concat(pagination_module_css_1.default['pagination'], " row"), pageClassName: "row button-text-3", activeClassName: pagination_module_css_1.default['active'], hrefBuilder: function (pageIndex) {
65
- return pageIndex >= 1 && pageIndex <= Math.ceil(totalItem / itemPerPage) ? "/page/".concat(pageIndex) : '#';
66
- }, renderOnZeroPageCount: null }),
67
- hideGoToPage ? null : react_1.default.createElement(react_1.default.Fragment, null,
68
- react_1.default.createElement("div", { style: { height: '1.6rem', backgroundColor: "var(--neutral-bolder-border-color)", width: 1 } }),
69
- react_1.default.createElement(text_1.Text, { className: "label-3" }, "Go to page"),
70
- react_1.default.createElement(text_field_1.TextField, { ref: goToPageRef, style: { width: '4.8rem', textAlign: "center", padding: 0, height: '2.4rem', borderRadius: '0.4rem' }, className: "body-3", type: "number", onBlur: function (ev) {
71
- var _tmp = ev.target.value.trim().length ? parseInt(ev.target.value.trim()) : undefined;
72
- if (_tmp && !isNaN(_tmp) && _tmp > 0 && _tmp <= Math.ceil(totalItem / itemPerPage)) {
73
- onChangePage(_tmp, itemPerPage);
74
- }
75
- else
76
- ev.target.value = "";
77
- } })));
78
- }
79
- else
80
- return react_1.default.createElement("div", { id: id });
81
- }
82
- exports.Pagination = Pagination;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Pagination = Pagination;
40
+ var react_1 = __importStar(require("react"));
41
+ var react_paginate_1 = __importDefault(require("react-paginate"));
42
+ var pagination_module_css_1 = __importDefault(require("./pagination.module.css"));
43
+ var select1_1 = require("../select1/select1");
44
+ var text_1 = require("../text/text");
45
+ var text_field_1 = require("../text-field/text-field");
46
+ var winicon_1 = require("../wini-icon/winicon");
47
+ var react_i18next_1 = require("react-i18next");
48
+ function Pagination(_a) {
49
+ var id = _a.id, currentPage = _a.currentPage, itemPerPage = _a.itemPerPage, totalItem = _a.totalItem, onChangePage = _a.onChangePage, _b = _a.hidePageSize, hidePageSize = _b === void 0 ? false : _b, _c = _a.hideGoToPage, hideGoToPage = _c === void 0 ? false : _c, style = _a.style;
50
+ var goToPageRef = (0, react_1.useRef)(null);
51
+ var t = (0, react_i18next_1.useTranslation)().t;
52
+ (0, react_1.useEffect)(function () {
53
+ if (goToPageRef.current) {
54
+ var _inputPage = goToPageRef.current.getInput();
55
+ if (_inputPage)
56
+ _inputPage.value = currentPage.toString();
57
+ }
58
+ }, [currentPage]);
59
+ if (currentPage > 1 && (totalItem === 0 || (Math.floor(totalItem / itemPerPage) + (totalItem % itemPerPage === 0 ? 0 : 1)) < currentPage)) {
60
+ onChangePage(1, itemPerPage);
61
+ return react_1.default.createElement("div", null);
62
+ }
63
+ else if (totalItem > 0) {
64
+ return react_1.default.createElement("div", { id: id, className: "".concat(pagination_module_css_1.default['custom-pagination'], " row"), style: style },
65
+ hidePageSize ? null : react_1.default.createElement("div", { className: "row", style: { gap: '0.8rem' } },
66
+ react_1.default.createElement(select1_1.Select1, { readOnly: true, placeholder: itemPerPage.toString(), options: [10, 20, 50, 80, 100, 150, 200].map(function (item, _) { return { id: item, name: item }; }), style: { borderRadius: '0.4rem', width: '5.6rem', padding: '0 0.8rem', height: '2.4rem' }, onChange: function (ev) {
67
+ onChangePage(currentPage, isNaN(parseInt(ev.id)) ? itemPerPage : parseInt(ev.id));
68
+ } }),
69
+ react_1.default.createElement(text_1.Text, { className: "body-3" }, t("ofItems", { totalItem: totalItem }))),
70
+ react_1.default.createElement("div", { style: { flex: 1 } }),
71
+ react_1.default.createElement(react_paginate_1.default, { onPageChange: function (ev) {
72
+ onChangePage(ev.selected + 1, itemPerPage);
73
+ }, forcePage: currentPage - 1, breakClassName: "row button-text-3", breakLabel: "...", pageCount: Math.ceil(totalItem / itemPerPage), previousClassName: "row", previousLabel: react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/left-arrow", size: "1.4rem" }), nextClassName: "row", nextLabel: react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/right-arrow", size: "1.4rem" }), containerClassName: "".concat(pagination_module_css_1.default['pagination'], " row"), pageClassName: "row button-text-3", activeClassName: pagination_module_css_1.default['active'], hrefBuilder: function (pageIndex) {
74
+ return pageIndex >= 1 && pageIndex <= Math.ceil(totalItem / itemPerPage) ? "/page/".concat(pageIndex) : '#';
75
+ }, renderOnZeroPageCount: null }),
76
+ hideGoToPage ? null : react_1.default.createElement(react_1.default.Fragment, null,
77
+ react_1.default.createElement("div", { style: { height: '1.6rem', backgroundColor: "var(--neutral-bolder-border-color)", width: 1 } }),
78
+ react_1.default.createElement(text_1.Text, { className: "label-3" },
79
+ t("go"),
80
+ " ",
81
+ t("page").toLowerCase()),
82
+ react_1.default.createElement(text_field_1.TextField, { ref: goToPageRef, style: { width: '4.8rem', textAlign: "center", padding: 0, height: '2.4rem', borderRadius: '0.4rem' }, className: "body-3", type: "number", onBlur: function (ev) {
83
+ var _tmp = ev.target.value.trim().length ? parseInt(ev.target.value.trim()) : undefined;
84
+ if (_tmp && !isNaN(_tmp) && _tmp > 0 && _tmp <= Math.ceil(totalItem / itemPerPage)) {
85
+ onChangePage(_tmp, itemPerPage);
86
+ }
87
+ else
88
+ ev.target.value = "";
89
+ } })));
90
+ }
91
+ else
92
+ return react_1.default.createElement("div", { id: id });
93
+ }
@@ -1,33 +1,33 @@
1
- import React, { CSSProperties, ReactNode } from 'react';
2
- import './popup.css';
3
- interface PopupState {
4
- readonly open?: boolean;
5
- heading?: ReactNode;
6
- body?: ReactNode;
7
- content?: ReactNode;
8
- footer?: ReactNode;
9
- clickOverlayClosePopup?: boolean;
10
- style?: CSSProperties;
11
- hideButtonClose?: boolean;
12
- }
13
- export declare const showPopup: (props: {
14
- ref: React.MutableRefObject<Popup | undefined>;
15
- heading?: ReactNode;
16
- content?: ReactNode;
17
- body?: ReactNode;
18
- footer?: ReactNode;
19
- clickOverlayClosePopup?: boolean;
20
- style?: CSSProperties;
21
- hideButtonClose?: boolean;
22
- }) => void;
23
- export declare const closePopup: (ref: React.MutableRefObject<Popup>) => void;
24
- export declare class Popup extends React.Component<Object, PopupState> {
25
- private ref;
26
- constructor(props: Object | Readonly<Object>);
27
- state: Readonly<PopupState>;
28
- onOpen(data: PopupState): void;
29
- onClose(): void;
30
- componentDidUpdate(prevProps: Readonly<Object>, prevState: Readonly<PopupState>): void;
31
- render(): React.JSX.Element;
32
- }
33
- export {};
1
+ import React, { CSSProperties, ReactNode } from 'react';
2
+ import './popup.css';
3
+ interface PopupState {
4
+ readonly open?: boolean;
5
+ heading?: ReactNode;
6
+ body?: ReactNode;
7
+ content?: ReactNode;
8
+ footer?: ReactNode;
9
+ clickOverlayClosePopup?: boolean;
10
+ style?: CSSProperties;
11
+ hideButtonClose?: boolean;
12
+ }
13
+ export declare const showPopup: (props: {
14
+ ref: React.MutableRefObject<Popup | undefined>;
15
+ heading?: ReactNode;
16
+ content?: ReactNode;
17
+ body?: ReactNode;
18
+ footer?: ReactNode;
19
+ clickOverlayClosePopup?: boolean;
20
+ style?: CSSProperties;
21
+ hideButtonClose?: boolean;
22
+ }) => void;
23
+ export declare const closePopup: (ref: React.MutableRefObject<Popup>) => void;
24
+ export declare class Popup extends React.Component<Object, PopupState> {
25
+ private ref;
26
+ constructor(props: Object | Readonly<Object>);
27
+ state: Readonly<PopupState>;
28
+ onOpen(data: PopupState): void;
29
+ onClose(): void;
30
+ componentDidUpdate(prevProps: Readonly<Object>, prevState: Readonly<PopupState>): void;
31
+ render(): React.JSX.Element;
32
+ }
33
+ export {};
@@ -1,105 +1,138 @@
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 (props) {
37
- var _a, _b;
38
- (_b = (_a = props.ref) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.onOpen({
39
- heading: props.heading,
40
- content: props.content,
41
- body: props.body,
42
- footer: props.footer,
43
- clickOverlayClosePopup: props.clickOverlayClosePopup,
44
- style: props.style,
45
- hideButtonClose: props.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
- var _a;
91
- return (react_1.default.createElement(react_1.default.Fragment, null, this.state.open &&
92
- 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) {
93
- if (ev.target.classList.contains('popup-overlay'))
94
- _this.onClose();
95
- } : undefined }, (_a = this.state.content) !== null && _a !== void 0 ? _a : 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.body,
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;
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ var desc = Object.getOwnPropertyDescriptor(m, k);
31
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
32
+ desc = { enumerable: true, get: function() { return m[k]; } };
33
+ }
34
+ Object.defineProperty(o, k2, desc);
35
+ }) : (function(o, m, k, k2) {
36
+ if (k2 === undefined) k2 = k;
37
+ o[k2] = m[k];
38
+ }));
39
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
40
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
41
+ }) : function(o, v) {
42
+ o["default"] = v;
43
+ });
44
+ var __importStar = (this && this.__importStar) || (function () {
45
+ var ownKeys = function(o) {
46
+ ownKeys = Object.getOwnPropertyNames || function (o) {
47
+ var ar = [];
48
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
49
+ return ar;
50
+ };
51
+ return ownKeys(o);
52
+ };
53
+ return function (mod) {
54
+ if (mod && mod.__esModule) return mod;
55
+ var result = {};
56
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
57
+ __setModuleDefault(result, mod);
58
+ return result;
59
+ };
60
+ })();
61
+ var __importDefault = (this && this.__importDefault) || function (mod) {
62
+ return (mod && mod.__esModule) ? mod : { "default": mod };
63
+ };
64
+ Object.defineProperty(exports, "__esModule", { value: true });
65
+ exports.Popup = exports.closePopup = exports.showPopup = void 0;
66
+ var react_1 = __importStar(require("react"));
67
+ var react_dom_1 = __importDefault(require("react-dom"));
68
+ require("./popup.css");
69
+ var showPopup = function (props) {
70
+ var _a, _b;
71
+ (_b = (_a = props.ref) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.onOpen({
72
+ heading: props.heading,
73
+ content: props.content,
74
+ body: props.body,
75
+ footer: props.footer,
76
+ clickOverlayClosePopup: props.clickOverlayClosePopup,
77
+ style: props.style,
78
+ hideButtonClose: props.hideButtonClose
79
+ });
80
+ };
81
+ exports.showPopup = showPopup;
82
+ var closePopup = function (ref) {
83
+ ref.current.onClose();
84
+ };
85
+ exports.closePopup = closePopup;
86
+ var Popup = /** @class */ (function (_super) {
87
+ __extends(Popup, _super);
88
+ function Popup(props) {
89
+ var _this = _super.call(this, props) || this;
90
+ _this.ref = (0, react_1.createRef)();
91
+ _this.state = {
92
+ open: false,
93
+ };
94
+ return _this;
95
+ }
96
+ Popup.prototype.onOpen = function (data) {
97
+ this.setState(__assign({ open: true }, data));
98
+ };
99
+ Popup.prototype.onClose = function () {
100
+ this.setState({ open: false });
101
+ };
102
+ Popup.prototype.componentDidUpdate = function (prevProps, prevState) {
103
+ var _a;
104
+ if (prevState.open !== this.state.open && this.state.open && this.state.style) {
105
+ var thisPopupRect = (_a = this.ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
106
+ if (thisPopupRect) {
107
+ var style = void 0;
108
+ if (thisPopupRect.right > document.body.offsetWidth) {
109
+ style = __assign(__assign({}, this.state.style), { right: '0.4rem' });
110
+ delete style.left;
111
+ }
112
+ if (thisPopupRect.bottom > document.body.offsetHeight) {
113
+ style = style ? __assign(__assign({}, style), { bottom: '0.4rem' }) : __assign(__assign({}, this.state.style), { bottom: '0.4rem' });
114
+ delete style.top;
115
+ }
116
+ if (style)
117
+ this.setState(__assign(__assign({}, this.state), { style: style }));
118
+ }
119
+ }
120
+ };
121
+ Popup.prototype.render = function () {
122
+ var _this = this;
123
+ var _a;
124
+ return (react_1.default.createElement(react_1.default.Fragment, null, this.state.open &&
125
+ 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) {
126
+ if (ev.target.classList.contains('popup-overlay'))
127
+ _this.onClose();
128
+ } : undefined }, (_a = this.state.content) !== null && _a !== void 0 ? _a : react_1.default.createElement("div", { ref: this.ref, className: 'popup-container col', onClick: function (e) { return e.stopPropagation(); }, style: this.state.style },
129
+ this.state.heading,
130
+ this.state.body,
131
+ this.state.footer,
132
+ this.state.hideButtonClose ? null : react_1.default.createElement("button", { type: 'button', onClick: function () { return _this.onClose(); }, className: 'popup-close-btn row' },
133
+ 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' } },
134
+ 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)));
135
+ };
136
+ return Popup;
137
+ }(react_1.default.Component));
138
+ exports.Popup = Popup;
@@ -1,16 +1,16 @@
1
- import { CSSProperties, ReactNode } from 'react';
2
- import React from 'react';
3
- import { ComponentStatus } from '../../index';
4
- export declare function ProgressBar({ id, status, percent, titleText, title, hideTitle, progressBarOnly, fullColor, percentColor, style, progressBarStyle }: {
5
- id?: string;
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;
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import React from 'react';
3
+ import { ComponentStatus } from '../../index';
4
+ export declare function ProgressBar({ id, status, percent, titleText, title, hideTitle, progressBarOnly, fullColor, percentColor, style, progressBarStyle }: {
5
+ id?: string;
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;
@@ -1,36 +1,35 @@
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
- var progress_bar_module_css_1 = __importDefault(require("./progress-bar.module.css"));
20
- var react_2 = __importDefault(require("react"));
21
- var index_1 = require("../../index");
22
- function ProgressBar(_a) {
23
- 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-main-background-color)' : _f, _g = _a.percentColor, percentColor = _g === void 0 ? 'var(--primary-main-color)' : _g, style = _a.style, progressBarStyle = _a.progressBarStyle;
24
- var _h = (0, react_1.useState)(true), openDetails = _h[0], setOpenDetails = _h[1];
25
- return react_2.default.createElement("div", { id: id, className: "col ".concat(progress_bar_module_css_1.default["progress-bar-container"]), style: style ? __assign({ padding: progressBarOnly ? '0' : '1.6rem 2.4rem' }, style) : { padding: progressBarOnly ? '0' : '1.6rem 2.4rem' } },
26
- (hideTitle || progressBarOnly) ? null : (title !== null && title !== void 0 ? title : react_2.default.createElement("div", { className: "row ".concat(progress_bar_module_css_1.default["progress-bar-title"]) },
27
- react_2.default.createElement("div", { className: "heading-8" }, titleText),
28
- react_2.default.createElement(index_1.Winicon, { src: openDetails ? "fill/arrows/down-arrow" : "fill/arrows/up-arrow", onClick: function () { setOpenDetails(!openDetails); } }))),
29
- openDetails ? react_2.default.createElement("div", { className: "row ".concat(progress_bar_module_css_1.default["progress-bar-tile"]) },
30
- react_2.default.createElement("div", { className: progress_bar_module_css_1.default["progress-bar-value"], style: __assign({ '--percent-color': percentColor, '--full-color': fullColor, '--percent': "".concat(percent, "%") }, (progressBarStyle !== null && progressBarStyle !== void 0 ? progressBarStyle : {})) }),
31
- progressBarOnly || status === index_1.ComponentStatus.INFOR ? null : react_2.default.createElement("div", { className: "".concat(progress_bar_module_css_1.default["status-icon"]) }, (0, index_1.getStatusIcon)(status)),
32
- progressBarOnly ? null : react_2.default.createElement("div", { className: 'label-4' },
33
- percent,
34
- "/100")) : null);
35
- }
36
- exports.ProgressBar = ProgressBar;
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 = ProgressBar;
18
+ var react_1 = require("react");
19
+ var progress_bar_module_css_1 = __importDefault(require("./progress-bar.module.css"));
20
+ var react_2 = __importDefault(require("react"));
21
+ var index_1 = require("../../index");
22
+ function ProgressBar(_a) {
23
+ 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-main-background-color)' : _f, _g = _a.percentColor, percentColor = _g === void 0 ? 'var(--primary-main-color)' : _g, style = _a.style, progressBarStyle = _a.progressBarStyle;
24
+ var _h = (0, react_1.useState)(true), openDetails = _h[0], setOpenDetails = _h[1];
25
+ return react_2.default.createElement("div", { id: id, className: "col ".concat(progress_bar_module_css_1.default["progress-bar-container"]), style: style ? __assign({ padding: progressBarOnly ? '0' : '1.6rem 2.4rem' }, style) : { padding: progressBarOnly ? '0' : '1.6rem 2.4rem' } },
26
+ (hideTitle || progressBarOnly) ? null : (title !== null && title !== void 0 ? title : react_2.default.createElement("div", { className: "row ".concat(progress_bar_module_css_1.default["progress-bar-title"]) },
27
+ react_2.default.createElement("div", { className: "heading-8" }, titleText),
28
+ react_2.default.createElement(index_1.Winicon, { src: openDetails ? "fill/arrows/down-arrow" : "fill/arrows/up-arrow", onClick: function () { setOpenDetails(!openDetails); } }))),
29
+ openDetails ? react_2.default.createElement("div", { className: "row ".concat(progress_bar_module_css_1.default["progress-bar-tile"]) },
30
+ react_2.default.createElement("div", { className: progress_bar_module_css_1.default["progress-bar-value"], style: __assign({ '--percent-color': percentColor, '--full-color': fullColor, '--percent': "".concat(percent, "%") }, (progressBarStyle !== null && progressBarStyle !== void 0 ? progressBarStyle : {})) }),
31
+ progressBarOnly || status === index_1.ComponentStatus.INFOR ? null : react_2.default.createElement("div", { className: "".concat(progress_bar_module_css_1.default["status-icon"]) }, (0, index_1.getStatusIcon)(status)),
32
+ progressBarOnly ? null : react_2.default.createElement("div", { className: 'label-4' },
33
+ percent,
34
+ "/100")) : null);
35
+ }