wini-web-components 2.7.0 → 2.7.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.
Files changed (87) hide show
  1. package/dist/types/index.d.ts +1 -0
  2. package/dist/vite.svg +1 -0
  3. package/dist/wini-web-components.css +4 -0
  4. package/dist/wini-web-components.js +32 -0
  5. package/dist/wini-web-components.mjs +6753 -0
  6. package/package.json +48 -82
  7. package/README.md +0 -21
  8. package/dist/component/button/button.d.ts +0 -21
  9. package/dist/component/button/button.js +0 -73
  10. package/dist/component/calendar/calendar.d.ts +0 -30
  11. package/dist/component/calendar/calendar.js +0 -357
  12. package/dist/component/card/card-info.d.ts +0 -15
  13. package/dist/component/card/card-info.js +0 -51
  14. package/dist/component/card/card.d.ts +0 -13
  15. package/dist/component/card/card.js +0 -33
  16. package/dist/component/checkbox/checkbox.d.ts +0 -24
  17. package/dist/component/checkbox/checkbox.js +0 -90
  18. package/dist/component/ck-editor/ckeditor.d.ts +0 -36
  19. package/dist/component/ck-editor/ckeditor.js +0 -392
  20. package/dist/component/component-status.d.ts +0 -8
  21. package/dist/component/component-status.js +0 -39
  22. package/dist/component/date-picker/date-picker.d.ts +0 -25
  23. package/dist/component/date-picker/date-picker.js +0 -329
  24. package/dist/component/date-time-picker/date-time-picker.d.ts +0 -36
  25. package/dist/component/date-time-picker/date-time-picker.js +0 -528
  26. package/dist/component/dialog/dialog.d.ts +0 -18
  27. package/dist/component/dialog/dialog.js +0 -113
  28. package/dist/component/import-file/import-file.d.ts +0 -33
  29. package/dist/component/import-file/import-file.js +0 -151
  30. package/dist/component/infinite-scroll/infinite-scroll.d.ts +0 -17
  31. package/dist/component/infinite-scroll/infinite-scroll.js +0 -37
  32. package/dist/component/input-multi-select/input-multi-select.d.ts +0 -21
  33. package/dist/component/input-multi-select/input-multi-select.js +0 -260
  34. package/dist/component/input-opt/input-opt.d.ts +0 -21
  35. package/dist/component/input-opt/input-opt.js +0 -157
  36. package/dist/component/input-otp/input-otp.d.ts +0 -22
  37. package/dist/component/input-otp/input-otp.js +0 -131
  38. package/dist/component/number-picker/number-picker.d.ts +0 -23
  39. package/dist/component/number-picker/number-picker.js +0 -125
  40. package/dist/component/pagination/pagination.d.ts +0 -13
  41. package/dist/component/pagination/pagination.js +0 -90
  42. package/dist/component/popup/popup.d.ts +0 -40
  43. package/dist/component/popup/popup.js +0 -125
  44. package/dist/component/progress-bar/progress-bar.d.ts +0 -16
  45. package/dist/component/progress-bar/progress-bar.js +0 -23
  46. package/dist/component/progress-circle/progress-circle.d.ts +0 -14
  47. package/dist/component/progress-circle/progress-circle.js +0 -19
  48. package/dist/component/radio-button/radio-button.d.ts +0 -20
  49. package/dist/component/radio-button/radio-button.js +0 -33
  50. package/dist/component/rating/rating.d.ts +0 -23
  51. package/dist/component/rating/rating.js +0 -54
  52. package/dist/component/select1/select1.d.ts +0 -31
  53. package/dist/component/select1/select1.js +0 -249
  54. package/dist/component/slider/slider.d.ts +0 -31
  55. package/dist/component/slider/slider.js +0 -64
  56. package/dist/component/switch/switch.d.ts +0 -23
  57. package/dist/component/switch/switch.js +0 -50
  58. package/dist/component/table/table.d.ts +0 -51
  59. package/dist/component/table/table.js +0 -66
  60. package/dist/component/tag/tag.d.ts +0 -22
  61. package/dist/component/tag/tag.js +0 -19
  62. package/dist/component/text/text.d.ts +0 -16
  63. package/dist/component/text/text.js +0 -20
  64. package/dist/component/text-area/text-area.d.ts +0 -27
  65. package/dist/component/text-area/text-area.js +0 -57
  66. package/dist/component/text-field/text-field.d.ts +0 -36
  67. package/dist/component/text-field/text-field.js +0 -80
  68. package/dist/component/toast-noti/toast-noti.d.ts +0 -5
  69. package/dist/component/toast-noti/toast-noti.js +0 -25
  70. package/dist/component/wini-icon/winicon.d.ts +0 -20
  71. package/dist/component/wini-icon/winicon.js +0 -176
  72. package/dist/form/login/view.d.ts +0 -40
  73. package/dist/form/login/view.js +0 -66
  74. package/dist/i18n.d.ts +0 -2
  75. package/dist/i18n.js +0 -125
  76. package/dist/index.d.ts +0 -33
  77. package/dist/index.js +0 -2
  78. package/dist/index.js.LICENSE.txt +0 -18
  79. package/dist/language/i18n.d.ts +0 -2
  80. package/dist/language/i18n.js +0 -146
  81. package/global.d.ts +0 -4
  82. /package/{public → dist}/favicon.ico +0 -0
  83. /package/{public → dist}/index.html +0 -0
  84. /package/{public → dist}/logo192.png +0 -0
  85. /package/{public → dist}/logo512.png +0 -0
  86. /package/{public → dist}/manifest.json +0 -0
  87. /package/{public → dist}/robots.txt +0 -0
@@ -1,249 +0,0 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.Select1 = void 0;
49
- const select1_module_css_1 = __importDefault(require("./select1.module.css"));
50
- const react_1 = __importStar(require("react"));
51
- const winicon_1 = require("../wini-icon/winicon");
52
- const text_1 = require("../text/text");
53
- const react_i18next_1 = require("react-i18next");
54
- const popup_1 = require("../popup/popup");
55
- ;
56
- class TSelect1 extends react_1.default.Component {
57
- constructor(props) {
58
- var _a, _b;
59
- super(props);
60
- this.containerRef = (0, react_1.createRef)();
61
- this.inputRef = (0, react_1.createRef)();
62
- this.onKeyDown = (ev) => {
63
- var _a, _b, _c, _d, _e, _f, _g;
64
- if ((((_a = this.state.options) === null || _a === void 0 ? void 0 : _a.length) || ((_b = this.state.search) === null || _b === void 0 ? void 0 : _b.length)) && this.state.isOpen) {
65
- switch (ev.key.toLowerCase()) {
66
- case "enter":
67
- ev.preventDefault();
68
- const _selectItem = ((_c = this.state.search) !== null && _c !== void 0 ? _c : this.state.options).find(e => e.id === this.state.selected);
69
- if (_selectItem)
70
- this.onSelect(_selectItem);
71
- break;
72
- case "arrowup":
73
- ev.preventDefault();
74
- if (this.state.selected) {
75
- let _index = ((_d = this.state.search) !== null && _d !== void 0 ? _d : this.state.options).findIndex((e) => e.id === this.state.selected);
76
- _index = ((_index === 0) ? this.props.options.length : _index) - 1;
77
- this.setState(Object.assign(Object.assign({}, this.state), { selected: (_e = this.props.options[_index]) === null || _e === void 0 ? void 0 : _e.id }));
78
- }
79
- break;
80
- case "arrowdown":
81
- ev.preventDefault();
82
- if (this.state.selected) {
83
- let _index = ((_f = this.state.search) !== null && _f !== void 0 ? _f : this.state.options).findIndex((e) => e.id === this.state.selected);
84
- _index = ((_index + 1 === this.props.options.length) ? -1 : _index) + 1;
85
- this.setState(Object.assign(Object.assign({}, this.state), { selected: (_g = this.props.options[_index]) === null || _g === void 0 ? void 0 : _g.id }));
86
- }
87
- break;
88
- default:
89
- break;
90
- }
91
- }
92
- };
93
- this.state = {
94
- value: props.value,
95
- options: props.options,
96
- offset: {
97
- x: 0,
98
- y: 0,
99
- height: 0,
100
- width: 0,
101
- bottom: 0,
102
- left: 0,
103
- right: 0,
104
- top: 0,
105
- toJSON: function () {
106
- throw new Error('Function not implemented.');
107
- }
108
- },
109
- isOpen: false,
110
- onSelect: null,
111
- };
112
- this.search = this.search.bind(this);
113
- this.onSelect = this.onSelect.bind(this);
114
- this.onKeyDown = this.onKeyDown.bind(this);
115
- if (this.inputRef.current)
116
- this.inputRef.current.value = `${(_b = (_a = this.state.options.find(e => e.id === this.state.value)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : ""}`;
117
- }
118
- search(ev) {
119
- return __awaiter(this, void 0, void 0, function* () {
120
- var _a;
121
- if (ev.target.value.trim().length) {
122
- if ((_a = this.props) === null || _a === void 0 ? void 0 : _a.handleSearch) {
123
- const res = yield this.props.handleSearch(ev.target.value.trim());
124
- this.setState(Object.assign(Object.assign({}, this.state), { search: res }));
125
- }
126
- else {
127
- this.setState(Object.assign(Object.assign({}, this.state), { search: this.props.options.filter(e => typeof e.name === "string" && e.name.toLowerCase().includes(ev.target.value.trim().toLowerCase())) }));
128
- }
129
- }
130
- else {
131
- this.setState(Object.assign(Object.assign({}, this.state), { search: undefined }));
132
- }
133
- });
134
- }
135
- onSelect(item) {
136
- var _a, _b;
137
- if (item.disabled) {
138
- this.setState(Object.assign(Object.assign({}, this.state), { isOpen: false, onSelect: undefined, selected: undefined }));
139
- (_a = this.inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
140
- }
141
- else {
142
- let newState = Object.assign(Object.assign({}, this.state), { isOpen: false, value: item.id, onSelect: undefined, selected: undefined });
143
- if (!newState.options.some(e => e.id === item.id))
144
- newState.options.push(item);
145
- this.setState(newState);
146
- (_b = this.inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
147
- }
148
- if (this.props.onChange)
149
- this.props.onChange(item);
150
- }
151
- componentDidUpdate(prevProps, prevState) {
152
- var _a, _b, _c, _d, _e, _f, _g, _h;
153
- if (prevProps.options !== this.props.options) {
154
- this.setState(Object.assign(Object.assign({}, this.state), { options: this.props.options }));
155
- if (this.inputRef.current)
156
- this.inputRef.current.value = `${(_b = (_a = this.props.options.find(e => e.id === this.state.value)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : ""}`;
157
- }
158
- if (prevProps.value !== this.props.value)
159
- this.setState(Object.assign(Object.assign({}, this.state), { value: this.props.value }));
160
- if (prevState.value !== this.state.value && this.inputRef.current)
161
- this.inputRef.current.value = `${(_d = (_c = this.state.options.find(e => e.id === this.state.value)) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : ""}`;
162
- //
163
- if (this.state.isOpen && prevState.isOpen !== this.state.isOpen) {
164
- const thisPopupRect = (_e = this.containerRef.current.querySelector(`.select1-popup`)) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect();
165
- if (thisPopupRect) {
166
- let style;
167
- if (thisPopupRect.right > document.body.offsetWidth) {
168
- style = {
169
- top: this.state.offset.y + this.state.offset.height + 2 + 'px',
170
- right: document.body.offsetWidth - this.state.offset.right + 'px'
171
- };
172
- }
173
- let _bottom = thisPopupRect.bottom - 8;
174
- const thisContainerRect = (_f = this.containerRef.current) === null || _f === void 0 ? void 0 : _f.getBoundingClientRect();
175
- if (thisContainerRect) {
176
- if (_bottom > document.body.offsetHeight) {
177
- style = Object.assign(Object.assign({}, (style !== null && style !== void 0 ? style : {})), { top: `${thisContainerRect.y - 2 - thisPopupRect.height}px` });
178
- }
179
- }
180
- if (style) {
181
- (_g = style.left) !== null && _g !== void 0 ? _g : (style.left = style.right ? undefined : `${this.state.offset.x}px`);
182
- (_h = style.width) !== null && _h !== void 0 ? _h : (style.width = `${this.state.offset.width}px`);
183
- this.setState(Object.assign(Object.assign({}, this.state), { style: style }));
184
- }
185
- }
186
- }
187
- }
188
- componentDidMount() {
189
- var _a, _b;
190
- if (this.inputRef.current)
191
- this.inputRef.current.value = `${(_b = (_a = this.state.options.find(e => e.id === this.state.value)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : ""}`;
192
- }
193
- render() {
194
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
195
- const { t } = this.props;
196
- const _value = this.state.options.find(e => e.id === this.state.value);
197
- return react_1.default.createElement("div", { id: this.props.id, ref: this.containerRef, className: `${select1_module_css_1.default['select1-container']} row ${this.props.disabled ? select1_module_css_1.default['disabled'] : ''} ${((_a = this.props.helperText) === null || _a === void 0 ? void 0 : _a.length) && select1_module_css_1.default['helper-text']} ${(_b = this.props.className) !== null && _b !== void 0 ? _b : 'body-3'}`, "helper-text": this.props.helperText, style: this.props.style ? Object.assign(Object.assign({}, { '--helper-text-color': (_c = this.props.helperTextColor) !== null && _c !== void 0 ? _c : '#e14337' }), this.props.style) : { '--helper-text-color': (_d = this.props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' }, onClick: () => {
198
- var _a, _b, _c;
199
- if (!this.state.isOpen) {
200
- this.setState(Object.assign(Object.assign({}, this.state), { isOpen: true, style: undefined, offset: (_b = (_a = this.containerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect() }));
201
- (_c = this.inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
202
- }
203
- } },
204
- this.props.prefix,
205
- (!_value || typeof _value.name === "string" || typeof _value.name === "number") ? react_1.default.createElement("input", { ref: this.inputRef, readOnly: this.props.readOnly, onChange: this.search, placeholder: this.props.placeholder, onBlur: ev => {
206
- if (this.state.onSelect && !this.props.readOnly)
207
- ev.target.focus();
208
- } }) : _value.name, (_e = this.props.suffix) !== null && _e !== void 0 ? _e : react_1.default.createElement("div", { ref: iconRef => {
209
- if ((iconRef === null || iconRef === void 0 ? void 0 : iconRef.parentElement) && iconRef.parentElement.getBoundingClientRect().width < 88)
210
- iconRef.style.display = "none";
211
- }, className: 'row' },
212
- react_1.default.createElement(winicon_1.Winicon, { src: this.state.isOpen ? "fill/arrows/up-arrow" : "fill/arrows/down-arrow", size: "1.2rem" })),
213
- this.state.isOpen && react_1.default.createElement(popup_1.PopupOverlay, { onOpen: this.props.onOpenOptions, className: `hidden-overlay`, onClose: (ev) => {
214
- if (ev.target !== this.inputRef.current)
215
- this.setState(Object.assign(Object.assign({}, this.state), { isOpen: false }));
216
- } },
217
- react_1.default.createElement("div", { className: `${select1_module_css_1.default['select1-popup']} select1-popup col ${(_f = this.props.popupClassName) !== null && _f !== void 0 ? _f : ""}`, style: (_g = this.state.style) !== null && _g !== void 0 ? _g : {
218
- top: this.state.offset.y + this.state.offset.height + 2 + 'px',
219
- left: this.state.offset.x + 'px',
220
- width: this.state.offset.width,
221
- } },
222
- react_1.default.createElement("div", { className: `col ${select1_module_css_1.default['select-body']}`, onScroll: this.props.handleLoadmore ? (ev) => {
223
- if (this.props.handleLoadmore) {
224
- let scrollElement = ev.target;
225
- this.props.handleLoadmore(Math.round(scrollElement.offsetHeight + scrollElement.scrollTop) >= (scrollElement.scrollHeight - 1), ev);
226
- }
227
- } : undefined },
228
- ((_h = this.state.search) !== null && _h !== void 0 ? _h : this.state.options).filter(e => !e.parentId).map(item => {
229
- var _a, _b;
230
- return react_1.default.createElement(OptionsItemTile, { key: item.id, item: item, children: ((_a = this.state.search) !== null && _a !== void 0 ? _a : this.state.options).filter(e => e.parentId === item.id), selected: this.state.selected === item.id, onClick: this.onSelect, treeData: ((_b = this.state.search) !== null && _b !== void 0 ? _b : this.state.options).some(e => e.parentId) });
231
- }),
232
- (!((_j = this.state.search) === null || _j === void 0 ? void 0 : _j.length) && !((_k = this.props.options) === null || _k === void 0 ? void 0 : _k.length)) && (react_1.default.createElement("div", { className: select1_module_css_1.default['no-results-found'] }, t("noResultFound")))))));
233
- }
234
- }
235
- function OptionsItemTile({ item, children, selected, onClick, treeData }) {
236
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
237
- return item.title && typeof item.title !== "string" ? react_1.default.createElement(react_1.default.Fragment, null, item.title(onClick)) : react_1.default.createElement("div", { className: 'col', style: { width: '100%' } },
238
- react_1.default.createElement("div", { className: `${select1_module_css_1.default['select-tile']} row ${item.disabled ? select1_module_css_1.default["disabled"] : ""}`, style: { paddingLeft: item.parentId ? '4.4rem' : undefined, backgroundColor: selected ? "var(--neutral-selected-background-color)" : undefined }, onClick: () => {
239
- if (children === null || children === void 0 ? void 0 : children.length) {
240
- setIsOpen(!isOpen);
241
- }
242
- else
243
- onClick(item);
244
- } },
245
- treeData ? react_1.default.createElement("div", { className: 'row', style: { width: '1.4rem', height: '1.4rem' } }, (children === null || children === void 0 ? void 0 : children.length) ? react_1.default.createElement(winicon_1.Winicon, { src: isOpen ? "fill/arrows/triangle-down" : "fill/arrows/triangle-right", size: "1.2rem" }) : null) : undefined,
246
- ((item.title && typeof item.title === "string") || typeof item.name === "string") ? react_1.default.createElement(text_1.Text, { className: 'body-3' }, item.title && typeof item.title === "string" ? item.title : item.name) : item.name),
247
- (children === null || children === void 0 ? void 0 : children.length) ? react_1.default.createElement("div", { className: 'col', style: { display: isOpen ? "flex" : "none", width: '100%' } }, children.map(e => react_1.default.createElement(OptionsItemTile, { key: e.id, item: e, onClick: onClick }))) : undefined);
248
- }
249
- exports.Select1 = (0, react_i18next_1.withTranslation)()(TSelect1);
@@ -1,31 +0,0 @@
1
- import React, { CSSProperties, ReactNode } from 'react';
2
- import './slider.css';
3
- interface SliderProps {
4
- id?: string;
5
- children?: Array<ReactNode>;
6
- autoPlay?: boolean;
7
- /** default: 2000ms */
8
- duration?: number;
9
- className?: string;
10
- iconSize?: number | string;
11
- iconColor?: string;
12
- prevButton?: ReactNode;
13
- nextButton?: ReactNode;
14
- style?: CSSProperties;
15
- buttons?: boolean;
16
- onChage?: (i: number) => void;
17
- }
18
- interface SliderState {
19
- page: number;
20
- }
21
- export declare class CustomSlider extends React.Component<SliderProps, SliderState> {
22
- private intervalPlay;
23
- constructor(props: SliderProps);
24
- nextPage: () => void;
25
- previousPage: () => void;
26
- private autoPlay;
27
- componentDidMount(): void;
28
- componentDidUpdate(prevProps: Readonly<SliderProps>, prevState: Readonly<SliderState>): void;
29
- render(): React.JSX.Element;
30
- }
31
- export {};
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CustomSlider = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const react_awesome_slider_1 = __importDefault(require("react-awesome-slider"));
9
- require("./slider.css");
10
- const winicon_1 = require("../wini-icon/winicon");
11
- class CustomSlider extends react_1.default.Component {
12
- constructor(props) {
13
- var _a;
14
- super(props);
15
- this.nextPage = () => {
16
- var _a, _b, _c;
17
- let index = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 0;
18
- if (((_c = this.props) === null || _c === void 0 ? void 0 : _c.children) && (index + 1) < this.props.children.length) {
19
- this.setState({ page: index + 1 });
20
- if (this.props.onChage)
21
- this.props.onChage(index + 1);
22
- }
23
- };
24
- this.previousPage = () => {
25
- var _a, _b, _c;
26
- let index = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 0;
27
- if (((_c = this.props) === null || _c === void 0 ? void 0 : _c.children) && index > 0) {
28
- this.setState({ page: index - 1 });
29
- if (this.props.onChage)
30
- this.props.onChage(index - 1);
31
- }
32
- };
33
- this.autoPlay = () => {
34
- var _a, _b, _c;
35
- let index = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 0;
36
- if (((_c = this.props) === null || _c === void 0 ? void 0 : _c.children) && (index + 1) === this.props.children.length)
37
- index = -1;
38
- this.setState({ page: index + 1 });
39
- if (this.props.onChage)
40
- this.props.onChage(index + 1);
41
- };
42
- (_a = props.buttons) !== null && _a !== void 0 ? _a : (props.buttons = true);
43
- this.state = {
44
- page: 0
45
- };
46
- this.autoPlay = this.autoPlay.bind(this);
47
- this.nextPage = this.nextPage.bind(this);
48
- this.previousPage = this.previousPage.bind(this);
49
- }
50
- componentDidMount() {
51
- var _a;
52
- if (this.props.autoPlay)
53
- this.intervalPlay = setInterval(this.autoPlay, (_a = this.props.duration) !== null && _a !== void 0 ? _a : 2000);
54
- }
55
- componentDidUpdate(prevProps, prevState) {
56
- if (this.props.autoPlay !== prevProps.autoPlay && !this.props.autoPlay)
57
- clearInterval(this.intervalPlay);
58
- }
59
- render() {
60
- var _a, _b, _c, _d, _e, _f;
61
- return react_1.default.createElement(react_awesome_slider_1.default, { style: this.props.style, className: `custom-slider-container ${(_a = this.props.className) !== null && _a !== void 0 ? _a : ''}`, selected: this.state.page, bullets: false, buttons: this.props.buttons ? (this.props.children && ((_b = this.props.children) === null || _b === void 0 ? void 0 : _b.length) > 1) : false, organicArrows: false, buttonContentLeft: (_c = this.props.prevButton) !== null && _c !== void 0 ? _c : react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/circle-ctrl-left", size: "2.4rem", color: (_d = this.props.iconColor) !== null && _d !== void 0 ? _d : "var(--neutral-absolute-background-color)" }), buttonContentRight: (_e = this.props.nextButton) !== null && _e !== void 0 ? _e : react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/circle-ctrl-right", size: "2.4rem", color: (_f = this.props.iconColor) !== null && _f !== void 0 ? _f : "var(--neutral-absolute-background-color)" }) }, this.props.children);
62
- }
63
- }
64
- exports.CustomSlider = CustomSlider;
@@ -1,23 +0,0 @@
1
- import React, { CSSProperties } from 'react';
2
- interface SwitchProps {
3
- id?: string;
4
- onChange?: (value: boolean) => void;
5
- value?: boolean;
6
- disabled?: boolean;
7
- className?: string;
8
- style?: CSSProperties;
9
- size?: number | string;
10
- dotColor?: string;
11
- onBackground?: string;
12
- offBackground?: string;
13
- name?: string;
14
- }
15
- interface SwitchState {
16
- value?: boolean;
17
- }
18
- export declare class Switch extends React.Component<SwitchProps, SwitchState> {
19
- state: Readonly<SwitchState>;
20
- componentDidUpdate(prevProps: Readonly<SwitchProps>): void;
21
- render(): React.JSX.Element;
22
- }
23
- export {};
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Switch = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const switch_module_css_1 = __importDefault(require("./switch.module.css"));
9
- class Switch extends react_1.default.Component {
10
- constructor() {
11
- var _a;
12
- super(...arguments);
13
- this.state = {
14
- value: (_a = this.props.value) !== null && _a !== void 0 ? _a : false
15
- };
16
- }
17
- componentDidUpdate(prevProps) {
18
- if (prevProps.value !== this.props.value) {
19
- this.setState({ value: this.props.value });
20
- }
21
- }
22
- render() {
23
- var _a, _b, _c, _d, _e;
24
- const propStyle = {
25
- '--off-bg': (_a = this.props.offBackground) !== null && _a !== void 0 ? _a : 'var(--neutral-main-background-color)',
26
- '--on-bg': (_b = this.props.onBackground) !== null && _b !== void 0 ? _b : 'var(--primary-main-color)',
27
- '--dot-color': (_c = this.props.dotColor) !== null && _c !== void 0 ? _c : '#ffffff',
28
- '--size': this.props.size ? (typeof this.props.size === 'number') ? `${this.props.size}px` : this.props.size : '2rem'
29
- };
30
- let convertStyle = Object.assign({ height: (_d = this.props.size) !== null && _d !== void 0 ? _d : '2rem', width: `calc(${this.props.size ? (typeof this.props.size === 'number') ? `${this.props.size}px` : this.props.size : '2rem'} * 9 / 5)` }, propStyle);
31
- if (this.props.style) {
32
- delete this.props.style.width;
33
- delete this.props.style.minWidth;
34
- delete this.props.style.maxWidth;
35
- delete this.props.style.height;
36
- delete this.props.style.minHeight;
37
- delete this.props.style.maxHeight;
38
- convertStyle = Object.assign(Object.assign({}, this.props.style), convertStyle);
39
- }
40
- return react_1.default.createElement("label", { id: this.props.id, className: `${switch_module_css_1.default['switch-container']} row ${(_e = this.props.className) !== null && _e !== void 0 ? _e : ''}`, style: convertStyle },
41
- react_1.default.createElement("input", { type: "checkbox", checked: this.state.value, name: this.props.name, disabled: this.props.disabled, onChange: () => {
42
- const newValue = !this.state.value;
43
- this.setState({ value: newValue });
44
- if (this.props.onChange)
45
- this.props.onChange(newValue);
46
- } }),
47
- react_1.default.createElement("span", { className: switch_module_css_1.default['slider'] }));
48
- }
49
- }
50
- exports.Switch = Switch;
@@ -1,51 +0,0 @@
1
- import React, { CSSProperties, MouseEventHandler, ReactNode } from 'react';
2
- import './table.css';
3
- export declare enum CellAlignItems {
4
- start = "start",
5
- center = "center",
6
- end = "end"
7
- }
8
- type TbCellProps = {
9
- id?: string;
10
- fixed?: boolean;
11
- children?: ReactNode;
12
- className?: string;
13
- style?: CSSProperties;
14
- align?: CellAlignItems | string;
15
- onClick?: React.MouseEventHandler<HTMLTableDataCellElement>;
16
- };
17
- export declare class TbCell extends React.Component<TbCellProps> {
18
- render(): React.ReactNode;
19
- }
20
- interface TbRowProps {
21
- id?: string;
22
- children?: Array<TbCell>;
23
- className?: string;
24
- style?: CSSProperties;
25
- onClick?: MouseEventHandler<HTMLTableRowElement>;
26
- }
27
- export declare class TbRow extends React.Component<TbRowProps> {
28
- render(): React.ReactNode;
29
- }
30
- export declare class TbHeader extends React.Component<TbRowProps> {
31
- render(): React.JSX.Element;
32
- }
33
- interface TbBodyProps {
34
- id?: string;
35
- children?: Array<TbRow>;
36
- className?: string;
37
- style?: CSSProperties;
38
- }
39
- export declare class TbBody extends React.Component<TbBodyProps> {
40
- render(): React.ReactNode;
41
- }
42
- interface TableProps {
43
- id?: string;
44
- children?: Array<TbBody | TbHeader>;
45
- className?: string;
46
- style?: CSSProperties;
47
- }
48
- export declare class Table extends React.Component<TableProps> {
49
- render(): React.ReactNode;
50
- }
51
- export {};
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Table = exports.TbBody = exports.TbHeader = exports.TbRow = exports.TbCell = exports.CellAlignItems = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- require("./table.css");
9
- var CellAlignItems;
10
- (function (CellAlignItems) {
11
- CellAlignItems["start"] = "start";
12
- CellAlignItems["center"] = "center";
13
- CellAlignItems["end"] = "end";
14
- })(CellAlignItems || (exports.CellAlignItems = CellAlignItems = {}));
15
- class TbCell extends react_1.default.Component {
16
- render() {
17
- var _a, _b;
18
- return react_1.default.createElement("td", { id: this.props.id, onClick: this.props.onClick, style: this.props.style, "align-cell": (_a = this.props.align) !== null && _a !== void 0 ? _a : CellAlignItems.start, className: `tb-cell ${(_b = this.props.className) !== null && _b !== void 0 ? _b : ''} ${this.props.fixed ? 'tb-cell-fixed' : ''}` }, this.props.children);
19
- }
20
- }
21
- exports.TbCell = TbCell;
22
- class TbRow extends react_1.default.Component {
23
- render() {
24
- var _a, _b;
25
- return react_1.default.createElement("tr", { id: this.props.id, style: this.props.style, className: `tb-row ${(_a = this.props.className) !== null && _a !== void 0 ? _a : ""}`, onClick: this.props.onClick }, ((_b = this.props.children) !== null && _b !== void 0 ? _b : []).map((e, i) => {
26
- var _a, _b;
27
- let ox = 0;
28
- if (this.props.children && i > 0 && i < (this.props.children.length - 1)) {
29
- ox = `calc(${this.props.children.slice(0, i).map(tb => {
30
- var _a, _b, _c;
31
- const wValue = (_b = (_a = tb.props.style) === null || _a === void 0 ? void 0 : _a.minWidth) !== null && _b !== void 0 ? _b : (_c = tb.props.style) === null || _c === void 0 ? void 0 : _c.width;
32
- return wValue ? typeof wValue === 'number' ? `${wValue}px` : wValue : '60px';
33
- }).join(" + ")})`;
34
- }
35
- return react_1.default.createElement(TbCell, { id: e.props.id, key: `tb-cell-${i}`, align: e.props.align, children: e.props.children, fixed: e.props.fixed, onClick: e.props.onClick, style: e.props.fixed ? (this.props.children && i === this.props.children.length - 1) ? Object.assign({ right: 0 }, ((_a = e.props.style) !== null && _a !== void 0 ? _a : {})) : Object.assign({ left: ox }, ((_b = e.props.style) !== null && _b !== void 0 ? _b : {})) : e.props.style, className: e.props.className });
36
- }));
37
- }
38
- }
39
- exports.TbRow = TbRow;
40
- class TbHeader extends react_1.default.Component {
41
- render() {
42
- var _a, _b;
43
- return react_1.default.createElement("thead", { style: this.props.style, className: `tb-header ${(_a = this.props.className) !== null && _a !== void 0 ? _a : ""}` },
44
- react_1.default.createElement("tr", null, ((_b = this.props.children) !== null && _b !== void 0 ? _b : []).map((e, i) => {
45
- var _a, _b;
46
- let ox = 0;
47
- if (this.props.children && i > 0 && i < (this.props.children.length - 1)) {
48
- ox = `calc(${this.props.children.slice(0, i).map(tb => { var _a; return ((_a = tb.props.style) === null || _a === void 0 ? void 0 : _a.width) ? typeof tb.props.style.width === 'number' ? `${tb.props.style.width}px` : tb.props.style.width : '60px'; }).join(" + ")})`;
49
- }
50
- return react_1.default.createElement(TbCell, { id: e.props.id, key: `tb-cell-${i}`, align: e.props.align, children: e.props.children, onClick: e.props.onClick, fixed: e.props.fixed, style: e.props.fixed ? (this.props.children && i === this.props.children.length - 1) ? Object.assign({ right: 0 }, ((_a = e.props.style) !== null && _a !== void 0 ? _a : {})) : Object.assign({ left: ox }, ((_b = e.props.style) !== null && _b !== void 0 ? _b : {})) : e.props.style, className: e.props.className });
51
- })));
52
- }
53
- }
54
- exports.TbHeader = TbHeader;
55
- class TbBody extends react_1.default.Component {
56
- render() {
57
- return react_1.default.createElement("tbody", { id: this.props.id }, this.props.children);
58
- }
59
- }
60
- exports.TbBody = TbBody;
61
- class Table extends react_1.default.Component {
62
- render() {
63
- return react_1.default.createElement("table", { id: this.props.id, className: `custom-table ${this.props.className}`, style: this.props.style }, this.props.children);
64
- }
65
- }
66
- exports.Table = Table;
@@ -1,22 +0,0 @@
1
- import React, { CSSProperties, ReactNode } from 'react';
2
- import { ComponentStatus } from '../component-status';
3
- interface TagProps {
4
- id?: string;
5
- title: string;
6
- prefix?: ReactNode;
7
- suffix?: ReactNode;
8
- disabled?: boolean;
9
- style?: CSSProperties;
10
- /**
11
- * default: size24: button-text-6 \
12
- * recommend: size24: button-text-6 | size32: button-text-4 \
13
- * status tag: tag-primary | tag-infor | tag-warning | tag-error | tag-success | tag-grey | tag-neutral | tag-infor-main | tag-warning-main | tag-error-main | tag-success-main
14
- * */
15
- className?: string;
16
- status?: ComponentStatus;
17
- onClick?: React.MouseEventHandler<HTMLDivElement>;
18
- }
19
- export declare class Tag extends React.Component<TagProps> {
20
- render(): React.JSX.Element;
21
- }
22
- export {};
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Tag = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const text_1 = require("../text/text");
9
- const tag_module_css_1 = __importDefault(require("./tag.module.css"));
10
- class Tag extends react_1.default.Component {
11
- render() {
12
- var _a, _b;
13
- return react_1.default.createElement("div", { id: this.props.id, "tag-type": (_a = this.props.status) !== null && _a !== void 0 ? _a : 'default', className: `${tag_module_css_1.default['tag-container']} row ${this.props.onClick ? tag_module_css_1.default['type-button'] : ''} ${this.props.disabled ? tag_module_css_1.default['disabled'] : ""} ${(_b = this.props.className) !== null && _b !== void 0 ? _b : "button-text-6"} `, style: this.props.style, onClick: this.props.onClick },
14
- this.props.prefix,
15
- react_1.default.createElement(text_1.Text, { maxLine: 1, className: tag_module_css_1.default['tag-label'] }, this.props.title),
16
- this.props.suffix);
17
- }
18
- }
19
- exports.Tag = Tag;
@@ -1,16 +0,0 @@
1
- import React, { CSSProperties, ReactNode } from 'react';
2
- import './text.css';
3
- interface TextProps {
4
- id?: string;
5
- children?: ReactNode;
6
- style?: CSSProperties;
7
- className?: string;
8
- maxLine?: number;
9
- onClick?: React.MouseEventHandler<HTMLDivElement>;
10
- onHover?: React.MouseEventHandler<HTMLDivElement>;
11
- html?: string;
12
- }
13
- export declare class Text extends React.Component<TextProps> {
14
- render(): React.ReactNode;
15
- }
16
- export {};
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Text = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- require("./text.css");
9
- class Text extends react_1.default.Component {
10
- render() {
11
- var _a, _b, _c;
12
- let convertStyle = (_a = this.props.style) !== null && _a !== void 0 ? _a : {};
13
- if (this.props.maxLine) {
14
- convertStyle = Object.assign(Object.assign({}, convertStyle), { '--max-line': this.props.maxLine });
15
- }
16
- return this.props.html ? react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: this.props.html }, id: this.props.id, onMouseOver: this.props.onHover, onClick: this.props.onClick, className: `comp-text innerhtml ${this.props.onClick ? 'type-button' : ''} ${(_b = this.props.className) !== null && _b !== void 0 ? _b : ''}`, style: convertStyle }) :
17
- react_1.default.createElement("div", { id: this.props.id, onMouseOver: this.props.onHover, onClick: this.props.onClick, className: `comp-text ${this.props.onClick ? 'type-button' : ''} ${(_c = this.props.className) !== null && _c !== void 0 ? _c : ''}`, style: convertStyle }, this.props.children);
18
- }
19
- }
20
- exports.Text = Text;
@@ -1,27 +0,0 @@
1
- import React, { CSSProperties } from "react";
2
- import { UseFormRegister } from "react-hook-form";
3
- interface TextAreaProps {
4
- id?: string;
5
- value?: string;
6
- maxLength?: number;
7
- defaultValue?: string;
8
- onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
9
- onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
10
- onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;
11
- placeholder?: string;
12
- disabled?: boolean;
13
- readOnly?: boolean;
14
- autoFocus?: boolean;
15
- className?: string;
16
- helperText?: string;
17
- name?: string;
18
- helperTextColor?: string;
19
- style?: CSSProperties;
20
- register?: UseFormRegister<{}>;
21
- }
22
- export declare class TextArea extends React.Component<TextAreaProps> {
23
- private containerRef;
24
- getTextarea: () => HTMLTextAreaElement | null | undefined;
25
- render(): React.ReactNode;
26
- }
27
- export {};