wini-web-components 2.2.8 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/button/button.d.ts +16 -16
- package/dist/component/button/button.js +39 -39
- package/dist/component/calendar/calendar.d.ts +30 -46
- package/dist/component/calendar/calendar.js +437 -432
- package/dist/component/checkbox/checkbox.d.ts +24 -22
- package/dist/component/checkbox/checkbox.js +120 -81
- package/dist/component/component-status.d.ts +8 -8
- package/dist/component/component-status.js +39 -39
- package/dist/component/date-picker/date-picker.d.ts +25 -36
- package/dist/component/date-picker/date-picker.js +362 -359
- package/dist/component/dialog/dialog.d.ts +36 -34
- package/dist/component/dialog/dialog.js +99 -97
- package/dist/component/import-file/import-file.d.ts +24 -36
- package/dist/component/import-file/import-file.js +154 -119
- package/dist/component/infinite-scroll/infinite-scroll.d.ts +17 -17
- package/dist/component/infinite-scroll/infinite-scroll.js +103 -103
- package/dist/component/input-multi-select/input-multi-select.d.ts +21 -38
- package/dist/component/input-multi-select/input-multi-select.js +334 -323
- package/dist/component/input-opt/input-opt.d.ts +21 -21
- package/dist/component/input-opt/input-opt.js +157 -147
- package/dist/component/number-picker/number-picker.d.ts +19 -19
- package/dist/component/number-picker/number-picker.js +137 -127
- package/dist/component/pagination/pagination.d.ts +13 -13
- package/dist/component/pagination/pagination.js +93 -82
- package/dist/component/popup/popup.d.ts +33 -33
- package/dist/component/popup/popup.js +138 -105
- package/dist/component/progress-bar/progress-bar.d.ts +16 -16
- package/dist/component/progress-bar/progress-bar.js +35 -36
- package/dist/component/progress-circle/progress-circle.d.ts +14 -14
- package/dist/component/progress-circle/progress-circle.js +30 -31
- package/dist/component/radio-button/radio-button.d.ts +20 -20
- package/dist/component/radio-button/radio-button.js +64 -64
- package/dist/component/rating/rating.d.ts +23 -23
- package/dist/component/rating/rating.js +73 -74
- package/dist/component/select1/select1.d.ts +31 -50
- package/dist/component/select1/select1.js +320 -309
- package/dist/component/slider/slider.d.ts +31 -31
- package/dist/component/slider/slider.js +80 -81
- package/dist/component/switch/switch.d.ts +23 -23
- package/dist/component/switch/switch.js +80 -81
- package/dist/component/table/table.d.ts +51 -51
- package/dist/component/table/table.js +119 -119
- package/dist/component/tag/tag.d.ts +17 -17
- package/dist/component/tag/tag.js +39 -39
- package/dist/component/text/text.d.ts +16 -16
- package/dist/component/text/text.js +51 -51
- package/dist/component/text-area/text-area.d.ts +28 -28
- package/dist/component/text-area/text-area.js +83 -73
- package/dist/component/text-field/text-field.d.ts +33 -33
- package/dist/component/text-field/text-field.js +107 -97
- package/dist/component/toast-noti/toast-noti.d.ts +5 -5
- package/dist/component/toast-noti/toast-noti.js +28 -28
- package/dist/component/wini-icon/winicon.d.ts +16 -16
- package/dist/component/wini-icon/winicon.js +121 -112
- package/dist/form/login/view.d.ts +40 -40
- package/dist/form/login/view.js +66 -65
- package/dist/i18n.d.ts +2 -0
- package/dist/i18n.js +125 -0
- package/dist/index.d.ts +32 -31
- package/dist/index.js +1 -1
- package/dist/language/i18n.d.ts +2 -0
- package/dist/language/i18n.js +125 -0
- package/package.json +5 -3
|
@@ -1,112 +1,121 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
47
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
48
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
49
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
50
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
51
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
52
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
56
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
57
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
58
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
59
|
+
function step(op) {
|
|
60
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
61
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
62
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
63
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
64
|
+
switch (op[0]) {
|
|
65
|
+
case 0: case 1: t = op; break;
|
|
66
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
67
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
68
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
69
|
+
default:
|
|
70
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
71
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
72
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
73
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
74
|
+
if (t[2]) _.ops.pop();
|
|
75
|
+
_.trys.pop(); continue;
|
|
76
|
+
}
|
|
77
|
+
op = body.call(thisArg, _);
|
|
78
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
79
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
83
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
84
|
+
};
|
|
85
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
86
|
+
exports.Winicon = Winicon;
|
|
87
|
+
var react_1 = __importStar(require("react"));
|
|
88
|
+
var winicon_module_css_1 = __importDefault(require("./winicon.module.css"));
|
|
89
|
+
function Winicon(_a) {
|
|
90
|
+
var _this = this;
|
|
91
|
+
var id = _a.id, src = _a.src, link = _a.link, className = _a.className, style = _a.style, size = _a.size, color = _a.color, alt = _a.alt, onClick = _a.onClick;
|
|
92
|
+
var _b = (0, react_1.useState)(), svgData = _b[0], setSvgData = _b[1];
|
|
93
|
+
var cdnSrc = "https://cdn.jsdelivr.net/gh/WiniGit/icon-library@latest/";
|
|
94
|
+
(0, react_1.useEffect)(function () {
|
|
95
|
+
if (src) {
|
|
96
|
+
fetch(cdnSrc + src + ".svg").then(function (res) { return __awaiter(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
97
|
+
switch (_b.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
_a = setSvgData;
|
|
100
|
+
return [4 /*yield*/, res.text()];
|
|
101
|
+
case 1:
|
|
102
|
+
_a.apply(void 0, [_b.sent()]);
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
}
|
|
105
|
+
}); }); }).catch(function () { setSvgData(alt !== null && alt !== void 0 ? alt : "error"); });
|
|
106
|
+
}
|
|
107
|
+
else if (link) {
|
|
108
|
+
fetch(link).then(function (res) { return __awaiter(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
109
|
+
switch (_b.label) {
|
|
110
|
+
case 0:
|
|
111
|
+
_a = setSvgData;
|
|
112
|
+
return [4 /*yield*/, res.text()];
|
|
113
|
+
case 1:
|
|
114
|
+
_a.apply(void 0, [_b.sent()]);
|
|
115
|
+
return [2 /*return*/];
|
|
116
|
+
}
|
|
117
|
+
}); }); });
|
|
118
|
+
}
|
|
119
|
+
}, [src, link]);
|
|
120
|
+
return react_1.default.createElement("div", { id: id, onClick: onClick, className: "".concat(winicon_module_css_1.default['wini-icon'], " ").concat(svgData ? "" : "skeleton-loading", " ").concat(onClick ? winicon_module_css_1.default['clickable'] : '', " ").concat(className !== null && className !== void 0 ? className : '', " ").concat(src ? src.split("/").map(function (e, i) { return i === 0 ? "".concat(e, "-icon") : e.replace(" ", "-"); }).join(" ") : '').concat(link ? ' link-icon' : ""), style: (style ? __assign(__assign({}, style), { '--size': size, '--color': color }) : { '--size': size, '--color': color }), dangerouslySetInnerHTML: { __html: svgData !== null && svgData !== void 0 ? svgData : '' } });
|
|
121
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
|
-
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
3
|
-
interface Props {
|
|
4
|
-
logo: React.ReactNode | string;
|
|
5
|
-
formData: {
|
|
6
|
-
"username": {
|
|
7
|
-
label: string;
|
|
8
|
-
name: string;
|
|
9
|
-
prefix?: React.ReactNode;
|
|
10
|
-
onValidate?: React.FocusEventHandler<HTMLInputElement>;
|
|
11
|
-
maxLength?: number;
|
|
12
|
-
};
|
|
13
|
-
"password": {
|
|
14
|
-
label: string;
|
|
15
|
-
name: string;
|
|
16
|
-
prefix?: React.ReactNode;
|
|
17
|
-
onValidate?: React.FocusEventHandler<HTMLInputElement>;
|
|
18
|
-
maxLength?: number;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
onSubmit?: (data: FieldValues, methods?: UseFormReturn<any>) => void;
|
|
22
|
-
title?: string;
|
|
23
|
-
orText?: string;
|
|
24
|
-
methods?: UseFormReturn<any>;
|
|
25
|
-
buttonLoginLabel?: string;
|
|
26
|
-
loginWithGoogle?: React.MouseEventHandler<HTMLButtonElement>;
|
|
27
|
-
loginWithFacebook?: React.MouseEventHandler<HTMLButtonElement>;
|
|
28
|
-
loginWithApple?: React.MouseEventHandler<HTMLButtonElement>;
|
|
29
|
-
loginWithMicrosoft?: React.MouseEventHandler<HTMLButtonElement>;
|
|
30
|
-
onRegister?: React.MouseEventHandler<HTMLDivElement>;
|
|
31
|
-
registerPrefixText?: string;
|
|
32
|
-
registerText?: string;
|
|
33
|
-
forgotPasswordText?: string;
|
|
34
|
-
onForgotPassword?: React.MouseEventHandler<HTMLDivElement>;
|
|
35
|
-
style?: CSSProperties;
|
|
36
|
-
className?: string;
|
|
37
|
-
id?: string;
|
|
38
|
-
}
|
|
39
|
-
export declare function WLoginView(props: Props): React.JSX.Element;
|
|
40
|
-
export {};
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
3
|
+
interface Props {
|
|
4
|
+
logo: React.ReactNode | string;
|
|
5
|
+
formData: {
|
|
6
|
+
"username": {
|
|
7
|
+
label: string;
|
|
8
|
+
name: string;
|
|
9
|
+
prefix?: React.ReactNode;
|
|
10
|
+
onValidate?: React.FocusEventHandler<HTMLInputElement>;
|
|
11
|
+
maxLength?: number;
|
|
12
|
+
};
|
|
13
|
+
"password": {
|
|
14
|
+
label: string;
|
|
15
|
+
name: string;
|
|
16
|
+
prefix?: React.ReactNode;
|
|
17
|
+
onValidate?: React.FocusEventHandler<HTMLInputElement>;
|
|
18
|
+
maxLength?: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
onSubmit?: (data: FieldValues, methods?: UseFormReturn<any>) => void;
|
|
22
|
+
title?: string;
|
|
23
|
+
orText?: string;
|
|
24
|
+
methods?: UseFormReturn<any>;
|
|
25
|
+
buttonLoginLabel?: string;
|
|
26
|
+
loginWithGoogle?: React.MouseEventHandler<HTMLButtonElement>;
|
|
27
|
+
loginWithFacebook?: React.MouseEventHandler<HTMLButtonElement>;
|
|
28
|
+
loginWithApple?: React.MouseEventHandler<HTMLButtonElement>;
|
|
29
|
+
loginWithMicrosoft?: React.MouseEventHandler<HTMLButtonElement>;
|
|
30
|
+
onRegister?: React.MouseEventHandler<HTMLDivElement>;
|
|
31
|
+
registerPrefixText?: string;
|
|
32
|
+
registerText?: string;
|
|
33
|
+
forgotPasswordText?: string;
|
|
34
|
+
onForgotPassword?: React.MouseEventHandler<HTMLDivElement>;
|
|
35
|
+
style?: CSSProperties;
|
|
36
|
+
className?: string;
|
|
37
|
+
id?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function WLoginView(props: Props): React.JSX.Element;
|
|
40
|
+
export {};
|
package/dist/form/login/view.js
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
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.WLoginView =
|
|
7
|
-
var react_1 = __importDefault(require("react"));
|
|
8
|
-
var index_1 = require("../../index");
|
|
9
|
-
var view_module_css_1 = __importDefault(require("./view.module.css"));
|
|
10
|
-
var react_hook_form_1 = require("react-hook-form");
|
|
11
|
-
var react_2 = require("react");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
react_1.default.createElement("div", null)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
props.
|
|
63
|
-
props.
|
|
64
|
-
}
|
|
65
|
-
|
|
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.WLoginView = WLoginView;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var index_1 = require("../../index");
|
|
9
|
+
var view_module_css_1 = __importDefault(require("./view.module.css"));
|
|
10
|
+
var react_hook_form_1 = require("react-hook-form");
|
|
11
|
+
var react_2 = require("react");
|
|
12
|
+
var react_i18next_1 = require("react-i18next");
|
|
13
|
+
function WLoginView(props) {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
15
|
+
var methods = (0, react_hook_form_1.useForm)({ shouldFocusError: false });
|
|
16
|
+
var _y = (0, react_2.useState)(false), isShowPass = _y[0], setShowPass = _y[1];
|
|
17
|
+
var t = (0, react_i18next_1.useTranslation)().t;
|
|
18
|
+
var _onSubmit = function (ev) {
|
|
19
|
+
if (props.onSubmit)
|
|
20
|
+
props.onSubmit(ev, methods);
|
|
21
|
+
};
|
|
22
|
+
return react_1.default.createElement("form", { id: props.id, className: "col login-view-container ".concat(view_module_css_1.default['login-view-container'], " ").concat((_a = props.className) !== null && _a !== void 0 ? _a : ''), style: props.style },
|
|
23
|
+
typeof props.logo === "string" ? react_1.default.createElement("img", { alt: 'logo', src: props.logo, height: "36rem" }) : props.logo,
|
|
24
|
+
react_1.default.createElement("div", { className: "col login-view-form-container ".concat(view_module_css_1.default['login-view-form-container']) },
|
|
25
|
+
react_1.default.createElement(index_1.Text, { className: 'heading-4' }, (_b = props.title) !== null && _b !== void 0 ? _b : "".concat(t("loginTo"), " Wini")),
|
|
26
|
+
react_1.default.createElement("div", { className: 'col' },
|
|
27
|
+
react_1.default.createElement("div", { className: 'col', style: { gap: "0.8rem", overflow: "visible" } },
|
|
28
|
+
react_1.default.createElement(index_1.Text, { className: 'label-3' }, (_c = props.formData.username.label) !== null && _c !== void 0 ? _c : t("username")),
|
|
29
|
+
react_1.default.createElement(index_1.TextField, { autoComplete: 'username', className: "placeholder-2", placeholder: props.formData.username.label, style: { height: "4.8rem" }, prefix: props.formData.username.prefix, name: props.formData.username.name, register: ((_d = props.methods) !== null && _d !== void 0 ? _d : methods).register(props.formData.username.name, {
|
|
30
|
+
onChange: function (ev) { ev.target.value = ev.target.value.trim(); },
|
|
31
|
+
onBlur: props.formData.username.onValidate
|
|
32
|
+
}), onComplete: function (ev) { ev.target.blur(); }, helperText: (_g = (_f = ((_e = props.methods) !== null && _e !== void 0 ? _e : methods).formState.errors) === null || _f === void 0 ? void 0 : _f[props.formData.username.name]) === null || _g === void 0 ? void 0 : _g.message })),
|
|
33
|
+
react_1.default.createElement("div", { className: 'col', style: { gap: "0.8rem", overflow: "visible" } },
|
|
34
|
+
react_1.default.createElement(index_1.Text, { className: 'label-3' }, (_h = props.formData.password.label) !== null && _h !== void 0 ? _h : t("password")),
|
|
35
|
+
react_1.default.createElement(index_1.TextField, { autoComplete: 'current-password', className: "placeholder-2", placeholder: props.formData.password.label, style: { height: "4.8rem" }, prefix: props.formData.password.prefix, suffix: react_1.default.createElement("button", { type: 'button', onClick: function () { setShowPass(!isShowPass); } },
|
|
36
|
+
react_1.default.createElement(index_1.Winicon, { src: "outline/user interface/".concat(isShowPass ? "view" : "hide"), size: "1.6rem" })), name: props.formData.password.name, type: isShowPass ? "text" : "password", register: ((_j = props.methods) !== null && _j !== void 0 ? _j : methods).register(props.formData.password.name, {
|
|
37
|
+
onChange: function (ev) { ev.target.value = ev.target.value.trim(); },
|
|
38
|
+
onBlur: props.formData.password.onValidate
|
|
39
|
+
}), onComplete: function (ev) {
|
|
40
|
+
var _a, _b, _c;
|
|
41
|
+
if ((_b = ((_a = props.methods) !== null && _a !== void 0 ? _a : methods).watch(props.formData.password.name)) === null || _b === void 0 ? void 0 : _b.length) {
|
|
42
|
+
ev.target.blur();
|
|
43
|
+
if (!props.formData.password.onValidate && props.onSubmit)
|
|
44
|
+
_onSubmit(((_c = props.methods) !== null && _c !== void 0 ? _c : methods).getValues());
|
|
45
|
+
}
|
|
46
|
+
else
|
|
47
|
+
ev.target.blur();
|
|
48
|
+
}, helperText: (_m = (_l = ((_k = props.methods) !== null && _k !== void 0 ? _k : methods).formState.errors) === null || _l === void 0 ? void 0 : _l[props.formData.password.name]) === null || _m === void 0 ? void 0 : _m.message })),
|
|
49
|
+
react_1.default.createElement(index_1.Text, { className: "button-text-3 ".concat(view_module_css_1.default['forgot-password-btn']), onClick: props.onForgotPassword }, (_o = props.forgotPasswordText) !== null && _o !== void 0 ? _o : t("forgotPassword")),
|
|
50
|
+
react_1.default.createElement("div", { className: 'col', style: { gap: "1.6rem" } },
|
|
51
|
+
react_1.default.createElement(index_1.Button, { disabled: ((_q = ((_p = props.methods) !== null && _p !== void 0 ? _p : methods).watch(props.formData.username.name)) === null || _q === void 0 ? void 0 : _q.length) && ((_s = ((_r = props.methods) !== null && _r !== void 0 ? _r : methods).watch(props.formData.password.name)) === null || _s === void 0 ? void 0 : _s.length) ? false : true, className: "button-text-1 ".concat(view_module_css_1.default['login-btn']), onClick: props.onSubmit && ((_t = props.methods) !== null && _t !== void 0 ? _t : methods).handleSubmit(_onSubmit), label: (_u = props.buttonLoginLabel) !== null && _u !== void 0 ? _u : t("login") }),
|
|
52
|
+
react_1.default.createElement("div", { className: 'row', style: { justifyContent: "center", gap: "0.4rem" } },
|
|
53
|
+
react_1.default.createElement(index_1.Text, { className: 'label-4' }, (_v = props.registerPrefixText) !== null && _v !== void 0 ? _v : t("dontHaveAccount")),
|
|
54
|
+
react_1.default.createElement(index_1.Text, { className: "button-text-3 ".concat(view_module_css_1.default['register-btn']), onClick: props.onRegister }, (_w = props.registerText) !== null && _w !== void 0 ? _w : "".concat(t("signupFor"), " Wini")))),
|
|
55
|
+
(props.loginWithGoogle || props.loginWithFacebook || props.loginWithApple || props.loginWithMicrosoft) ?
|
|
56
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
57
|
+
react_1.default.createElement("div", { className: "row ".concat(view_module_css_1.default['or-spacing']) },
|
|
58
|
+
react_1.default.createElement("div", null),
|
|
59
|
+
react_1.default.createElement(index_1.Text, { className: "label-4" }, (_x = props.orText) !== null && _x !== void 0 ? _x : t("or")),
|
|
60
|
+
react_1.default.createElement("div", null)),
|
|
61
|
+
react_1.default.createElement("div", { className: "row ".concat(view_module_css_1.default['login-social-media']) },
|
|
62
|
+
props.loginWithGoogle && react_1.default.createElement(index_1.Button, { className: "label-1", onClick: props.loginWithGoogle, prefix: react_1.default.createElement(index_1.Winicon, { src: 'color/social media/google', size: "2rem" }), label: "Google" }),
|
|
63
|
+
props.loginWithFacebook && react_1.default.createElement(index_1.Button, { className: "label-1", onClick: props.loginWithFacebook, prefix: react_1.default.createElement(index_1.Winicon, { src: 'color/social media/logo-facebook', size: "2rem" }), label: "Facebook" }),
|
|
64
|
+
props.loginWithApple && react_1.default.createElement(index_1.Button, { className: "label-1", onClick: props.loginWithApple, prefix: react_1.default.createElement(index_1.Winicon, { src: 'color/development/apple', size: "2rem" }), label: "Apple" }),
|
|
65
|
+
props.loginWithMicrosoft && react_1.default.createElement(index_1.Button, { className: "label-1", onClick: props.loginWithMicrosoft, prefix: react_1.default.createElement(index_1.Winicon, { src: 'color/development/microsoft', size: "2rem" }), label: "Microsoft" }))) : null)));
|
|
66
|
+
}
|
package/dist/i18n.d.ts
ADDED
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
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.i18n = void 0;
|
|
7
|
+
var i18next_1 = __importDefault(require("i18next"));
|
|
8
|
+
exports.i18n = i18next_1.default;
|
|
9
|
+
var react_i18next_1 = require("react-i18next");
|
|
10
|
+
// Translation resources
|
|
11
|
+
var resources = {
|
|
12
|
+
en: {
|
|
13
|
+
translation: {
|
|
14
|
+
su: 'Su',
|
|
15
|
+
mo: "Mo",
|
|
16
|
+
tu: "Tu",
|
|
17
|
+
we: "We",
|
|
18
|
+
th: "Th",
|
|
19
|
+
fr: "Fr",
|
|
20
|
+
sa: "Sa",
|
|
21
|
+
yesterday: "Yesterday",
|
|
22
|
+
lastWeek: "Last week",
|
|
23
|
+
lastMonth: "Last month",
|
|
24
|
+
lastYear: "Last year",
|
|
25
|
+
january: "January",
|
|
26
|
+
february: "February",
|
|
27
|
+
march: "March",
|
|
28
|
+
april: "April",
|
|
29
|
+
may: "May",
|
|
30
|
+
june: "June",
|
|
31
|
+
july: "July",
|
|
32
|
+
august: "August",
|
|
33
|
+
september: "September",
|
|
34
|
+
october: "October",
|
|
35
|
+
november: "November",
|
|
36
|
+
december: "December",
|
|
37
|
+
today: "Today",
|
|
38
|
+
apply: "Apply",
|
|
39
|
+
cancel: "Cancel",
|
|
40
|
+
submit: "Submit",
|
|
41
|
+
limitFileError: "File {{file.name}} exceeds the maximum size of {{sizeTitle}}",
|
|
42
|
+
limitFileWarning: "File size should not exceed {{sizeTitle}}.",
|
|
43
|
+
uploadFileAction: 'Click or drag and drop to upload file',
|
|
44
|
+
file: "File",
|
|
45
|
+
remove: "Remove",
|
|
46
|
+
choose: "Choose",
|
|
47
|
+
select: "Select",
|
|
48
|
+
all: "All",
|
|
49
|
+
noResultFound: "No result found",
|
|
50
|
+
ofItems: "of {{totalItem}} items",
|
|
51
|
+
page: "Page",
|
|
52
|
+
go: "Go to",
|
|
53
|
+
or: "Or",
|
|
54
|
+
username: "Username",
|
|
55
|
+
password: "Password",
|
|
56
|
+
dontHaveAccount: "Don't have an account?",
|
|
57
|
+
forgotPassword: "Forgot your password?",
|
|
58
|
+
login: "Log in",
|
|
59
|
+
loginTo: "Log in to",
|
|
60
|
+
signup: "Sign up",
|
|
61
|
+
signupFor: "Sign up for",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
vi: {
|
|
65
|
+
translation: {
|
|
66
|
+
su: 'CN',
|
|
67
|
+
mo: "T2",
|
|
68
|
+
tu: "T3",
|
|
69
|
+
we: "T4",
|
|
70
|
+
th: "T5",
|
|
71
|
+
fr: "T6",
|
|
72
|
+
sa: "T7",
|
|
73
|
+
yesterday: "Hôm qua",
|
|
74
|
+
lastWeek: "Tuần trước",
|
|
75
|
+
lastMonth: "Tháng trước",
|
|
76
|
+
lastYear: "Năm trước",
|
|
77
|
+
january: "Tháng 1",
|
|
78
|
+
february: "Tháng 2",
|
|
79
|
+
march: "Tháng 3",
|
|
80
|
+
april: "Tháng 4",
|
|
81
|
+
may: "Tháng 5",
|
|
82
|
+
june: "Tháng 6",
|
|
83
|
+
july: "Tháng 7",
|
|
84
|
+
august: "Tháng 8",
|
|
85
|
+
september: "Tháng 9",
|
|
86
|
+
october: "Tháng 10",
|
|
87
|
+
november: "Tháng 11",
|
|
88
|
+
december: "Tháng 12",
|
|
89
|
+
today: "Hôm nay",
|
|
90
|
+
apply: "Áp dụng",
|
|
91
|
+
cancel: "Hủy",
|
|
92
|
+
submit: "Xác nhận",
|
|
93
|
+
limitFileError: "Tệp {{name}} vượt quá dung lượng tối đa {{sizeTitle}}",
|
|
94
|
+
limitFileWarning: "Tệp không được vượt quá {{sizeTitle}}.",
|
|
95
|
+
uploadFileAction: 'Nhấn hoặc kéo vào để tải tệp lên',
|
|
96
|
+
file: "Tệp",
|
|
97
|
+
remove: "Xóa",
|
|
98
|
+
choose: "Chọn",
|
|
99
|
+
select: "Chọn",
|
|
100
|
+
all: "Tất cả",
|
|
101
|
+
noResultFound: "Không tìm thấy kết quả",
|
|
102
|
+
ofItems: "trên {{totalItem}} kết quả",
|
|
103
|
+
page: "Trang",
|
|
104
|
+
go: "Đi tới",
|
|
105
|
+
or: "Hoặc",
|
|
106
|
+
username: "Tên đăng nhập",
|
|
107
|
+
password: "Mật khẩu",
|
|
108
|
+
dontHaveAccount: "Chưa có tài khoản?",
|
|
109
|
+
forgotPassword: "Quên mật khẩu?",
|
|
110
|
+
login: "Đăng nhập",
|
|
111
|
+
loginTo: "Đăng nhập vào",
|
|
112
|
+
signup: "Đăng ký",
|
|
113
|
+
signupFor: "Đăng ký"
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
// Initialize i18n
|
|
118
|
+
i18next_1.default.use(react_i18next_1.initReactI18next).init({
|
|
119
|
+
resources: resources,
|
|
120
|
+
lng: 'en',
|
|
121
|
+
fallbackLng: 'en',
|
|
122
|
+
interpolation: {
|
|
123
|
+
escapeValue: false, // React already escapes values
|
|
124
|
+
},
|
|
125
|
+
});
|