@drumee/ui-toolkit 0.0.8 → 0.0.9
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/package.json +1 -1
- package/skeleton/index.js +2 -0
- package/skeleton/menu/index.js +2 -0
- package/skeleton/menu/slide-menu.js +72 -0
- package/style/acknowledgement.scss +68 -0
- package/style/dropdown.scss +143 -0
- package/style/form.scss +283 -0
- package/style/index.scss +241 -0
- package/style/overlay-wrapper.scss +26 -0
- package/style/terms-and-conditions.scss +151 -0
- package/ui-toolkit/LICENSE +21 -0
- package/ui-toolkit/README.md +1 -0
- package/ui-toolkit/index.js +19 -0
- package/ui-toolkit/skeletons/index.js +244 -0
- package/ui-toolkit/skin/index.scss +178 -0
- package/ui-toolkit/skin/skin.scss +167 -0
- package/ui-toolkit/widgets/dialog/index.js +41 -0
- package/ui-toolkit/widgets/dialog/skeleton/index.js +27 -0
- package/ui-toolkit/widgets/dialog/skin/index.scss +22 -0
- package/ui-toolkit/widgets/index.js +30 -0
- package/ui-toolkit/widgets/otp/index.js +148 -0
- package/ui-toolkit/widgets/otp/skeleton/index.js +85 -0
- package/ui-toolkit/widgets/otp/skin/index.scss +88 -0
- package/ui-toolkit/widgets/pwsetter/index.js +118 -0
- package/ui-toolkit/widgets/pwsetter/skeleton/index.js +98 -0
- package/ui-toolkit/widgets/pwsetter/skin/index.scss +142 -0
- package/widgets/otp/index.js +4 -3
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@use '../../../skin' as *;
|
|
2
|
+
|
|
3
|
+
.dtk-otp {
|
|
4
|
+
@include dtk-butler-main;
|
|
5
|
+
|
|
6
|
+
&__digits {
|
|
7
|
+
width: 100%;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
height: 78px;
|
|
10
|
+
gap: var(--spacer-6);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&__digit {
|
|
14
|
+
width: 52px;
|
|
15
|
+
height: 72px;
|
|
16
|
+
opacity: 1;
|
|
17
|
+
gap: 16px;
|
|
18
|
+
border-radius: var(--corner-radius-max);
|
|
19
|
+
padding-top: 8px;
|
|
20
|
+
padding-right: 16px;
|
|
21
|
+
padding-bottom: 8px;
|
|
22
|
+
padding-left: 16px;
|
|
23
|
+
border: 1px var(--neutral-200) solid;
|
|
24
|
+
|
|
25
|
+
input {
|
|
26
|
+
width: 100%;
|
|
27
|
+
width: 100%;
|
|
28
|
+
font-weight: 400;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-size: 32px;
|
|
31
|
+
line-height: 40px;
|
|
32
|
+
text-align: center;
|
|
33
|
+
vertical-align: middle;
|
|
34
|
+
|
|
35
|
+
&:focus {
|
|
36
|
+
background: var(--primary-100);
|
|
37
|
+
color: var(--primary-500);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:focus-within {
|
|
42
|
+
border: 1px solid var(--primary-500);
|
|
43
|
+
background: var(--primary-100);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&__tips {
|
|
48
|
+
width: 100%;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
flex-wrap: wrap;
|
|
51
|
+
|
|
52
|
+
&-text {
|
|
53
|
+
font-weight: 400;
|
|
54
|
+
font-style: normal;
|
|
55
|
+
font-size: 16px;
|
|
56
|
+
line-height: 26px;
|
|
57
|
+
letter-spacing: 1px;
|
|
58
|
+
width: 100%;
|
|
59
|
+
|
|
60
|
+
&[data-error="1"] {
|
|
61
|
+
color: var(--red-500);
|
|
62
|
+
font-weight: bold;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&__resend {
|
|
69
|
+
width: 100%;
|
|
70
|
+
justify-content: start;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
|
|
73
|
+
&-text {
|
|
74
|
+
font-weight: 400;
|
|
75
|
+
font-style: normal;
|
|
76
|
+
font-size: 16px;
|
|
77
|
+
line-height: 26px;
|
|
78
|
+
letter-spacing: 1px;
|
|
79
|
+
width: 100%;
|
|
80
|
+
|
|
81
|
+
&.resend {
|
|
82
|
+
color: var(--primary-500);
|
|
83
|
+
font-weight: bold;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
require('./skin');
|
|
4
|
+
|
|
5
|
+
export default class dtk_pwsetter extends LetcBox {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
** @param {object} opt
|
|
9
|
+
*/
|
|
10
|
+
initialize(opt = {}) {
|
|
11
|
+
super.initialize(opt);
|
|
12
|
+
this.declareHandlers();
|
|
13
|
+
this.mset({ flow: _a.y })
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
onDomRefresh() {
|
|
20
|
+
this.feed(require('./skeleton').default(this));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
check() {
|
|
27
|
+
let { password, password2 } = this.getData()
|
|
28
|
+
let rate = 100 * (password.length / 20) + 5;
|
|
29
|
+
if (rate > 100) rate = 100;
|
|
30
|
+
this.__strengthGrade.el.style.width = `${rate}%`;
|
|
31
|
+
let min = 6;
|
|
32
|
+
this._isValid = 0;
|
|
33
|
+
if (password.length < min) {
|
|
34
|
+
this.__strengthState.set({ content: LOCALE.WEAK })
|
|
35
|
+
this.__strengthGrade.el.dataset.strenght = "0";
|
|
36
|
+
this.__messageText.set({ content: LOCALE.PASSWORD_AT_LEAST.format(min) });
|
|
37
|
+
this.__messageText.el.dataset.status = "error";
|
|
38
|
+
} else if (password.length <= 10) {
|
|
39
|
+
this.__strengthState.set({ content: LOCALE.STRONG })
|
|
40
|
+
this.__strengthGrade.el.dataset.strenght = "1";
|
|
41
|
+
this.__messageText.set({ content: "" })
|
|
42
|
+
this._isValid = 1;
|
|
43
|
+
this.__messageText.el.dataset.status = "normal";
|
|
44
|
+
} else {
|
|
45
|
+
this.__strengthGrade.el.dataset.strenght = "2";
|
|
46
|
+
this.__strengthState.set({ content: LOCALE.VERY_STRONG })
|
|
47
|
+
this.__messageText.set({ content: "" });
|
|
48
|
+
this._isValid = 1;
|
|
49
|
+
this.__messageText.el.dataset.status = "normal";
|
|
50
|
+
}
|
|
51
|
+
if (!password2 || password != password2) {
|
|
52
|
+
this._isValid = 0;
|
|
53
|
+
}
|
|
54
|
+
this.__topic.set({ content: LOCALE.PASSWORD_STRENGTH })
|
|
55
|
+
if (this._isValid) {
|
|
56
|
+
this.__messageIcon.el.dataset.state = "1";
|
|
57
|
+
this.__messageText.set({ content: LOCALE.PASSWORD_MATCH })
|
|
58
|
+
if (this.__commitButton) this.__commitButton.el.dataset.state = "1";
|
|
59
|
+
} else {
|
|
60
|
+
this.__messageIcon.el.dataset.state = "0";
|
|
61
|
+
if (this.__commitButton) this.__commitButton.el.dataset.state = "0";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
isValid() {
|
|
70
|
+
return this._isValid
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param {*} pw
|
|
76
|
+
*/
|
|
77
|
+
message(content, status = "normal") {
|
|
78
|
+
this.__messageText.set({ content })
|
|
79
|
+
this.__messageText.el.dataset.status = status;
|
|
80
|
+
if (status !== "normal") {
|
|
81
|
+
this.__messageIcon.el.dataset.state = "0";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {LetcBox} cmd
|
|
87
|
+
* @param {any} args
|
|
88
|
+
*/
|
|
89
|
+
onUiEvent(cmd, args = {}) {
|
|
90
|
+
const service = args.service || cmd.mget(_a.service);
|
|
91
|
+
switch (service) {
|
|
92
|
+
case 'password-input':
|
|
93
|
+
this.check()
|
|
94
|
+
if (cmd.status == _e.commit) {
|
|
95
|
+
let service = this.mget(_a.service) || _e.commit;
|
|
96
|
+
this.triggerHandlers({ service })
|
|
97
|
+
} else {
|
|
98
|
+
this.triggerHandlers({ service })
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
case _e.commit:
|
|
102
|
+
let { api, payload } = this.model.toJSON();
|
|
103
|
+
if (api) {
|
|
104
|
+
payload = { ...payload, ...this.getData() };
|
|
105
|
+
this.postService(api, { ...payload }).then((data) => {
|
|
106
|
+
this.triggerHandlers({ data })
|
|
107
|
+
}).catch((error) => {
|
|
108
|
+
this.triggerHandlers({ error })
|
|
109
|
+
})
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
default:
|
|
114
|
+
this.triggerHandlers({ service })
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const { password, button } = require("../../../skeletons");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {*} ui
|
|
6
|
+
* @param {*} opt
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
function passmeter(ui, opt) {
|
|
10
|
+
let fig = `${ui.fig.family}`
|
|
11
|
+
let { label, haptic = 2000 } = ui.model.toJSON();
|
|
12
|
+
const form = Skeletons.Box.Y({
|
|
13
|
+
className: `${fig}__form`,
|
|
14
|
+
kids: [
|
|
15
|
+
password(ui, {
|
|
16
|
+
placeholder: LOCALE.PASSWORD,
|
|
17
|
+
name: _a.password,
|
|
18
|
+
sys_pn: _a.password,
|
|
19
|
+
interactive: 1,
|
|
20
|
+
service: 'password-input'
|
|
21
|
+
}),
|
|
22
|
+
password(ui, {
|
|
23
|
+
placeholder: LOCALE.PASSWORD_CONFIRM,
|
|
24
|
+
name: "password2",
|
|
25
|
+
sys_pn: "password2",
|
|
26
|
+
interactive: 1,
|
|
27
|
+
service: 'password-input'
|
|
28
|
+
}),
|
|
29
|
+
]
|
|
30
|
+
})
|
|
31
|
+
let commit;
|
|
32
|
+
if (ui.mget(_a.api) && ui.mget(_a.label)) {
|
|
33
|
+
commit = button(ui, {
|
|
34
|
+
label,
|
|
35
|
+
className: `${fig}__button`,
|
|
36
|
+
priority: 'secondary full-width',
|
|
37
|
+
service: _e.commit,
|
|
38
|
+
type: _a.email,
|
|
39
|
+
sys_pn: "commit-button",
|
|
40
|
+
haptic
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
return Skeletons.Box.Y({
|
|
44
|
+
className: `${fig}__main`,
|
|
45
|
+
kids: [
|
|
46
|
+
form,
|
|
47
|
+
Skeletons.Box.Y({
|
|
48
|
+
className: `${fig}__divider`,
|
|
49
|
+
kids: [Skeletons.Box.X({
|
|
50
|
+
className: `${fig}__dashboard`,
|
|
51
|
+
kids: [
|
|
52
|
+
Skeletons.Note({
|
|
53
|
+
className: `${fig}__topic`,
|
|
54
|
+
sys_pn: "topic"
|
|
55
|
+
}),
|
|
56
|
+
Skeletons.Note({
|
|
57
|
+
className: `${fig}__strength-state`,
|
|
58
|
+
content: "",
|
|
59
|
+
sys_pn: "strength-state"
|
|
60
|
+
}),
|
|
61
|
+
Skeletons.Box.X({
|
|
62
|
+
className: `${fig}__strength-container`,
|
|
63
|
+
kids: [
|
|
64
|
+
Skeletons.Element({
|
|
65
|
+
className: `${fig}__strength-content`,
|
|
66
|
+
sys_pn: "strength-grade"
|
|
67
|
+
}),
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
}),
|
|
72
|
+
Skeletons.Box.X({
|
|
73
|
+
className: `${fig}__dashboard`,
|
|
74
|
+
kids: [
|
|
75
|
+
Skeletons.Button.Svg({
|
|
76
|
+
ico: "checked-circle",
|
|
77
|
+
className: `${fig}__message-icon`,
|
|
78
|
+
content: "",
|
|
79
|
+
sys_pn: "message-icon",
|
|
80
|
+
state: 0
|
|
81
|
+
}),
|
|
82
|
+
Skeletons.Note({
|
|
83
|
+
className: `${fig}__message-text`,
|
|
84
|
+
content: "",
|
|
85
|
+
sys_pn: "message-text"
|
|
86
|
+
}),
|
|
87
|
+
]
|
|
88
|
+
})]
|
|
89
|
+
}),
|
|
90
|
+
commit
|
|
91
|
+
]
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
export default passmeter
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
@use '@drumee/ui-styles/src/mixins';
|
|
2
|
+
@use '../../../skin' as *;
|
|
3
|
+
|
|
4
|
+
.dtk-pwsetter {
|
|
5
|
+
@include dtk-butler-button;
|
|
6
|
+
|
|
7
|
+
&__ui {
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&__main {
|
|
12
|
+
font-weight: 400;
|
|
13
|
+
width: 100%;
|
|
14
|
+
font-style: normal;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
line-height: 22px;
|
|
17
|
+
text-align: center;
|
|
18
|
+
letter-spacing: 1px;
|
|
19
|
+
color: var(--neutral-600);
|
|
20
|
+
gap: var(--spacer-4);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__topic {
|
|
24
|
+
margin-right: auto;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__strength-state {
|
|
28
|
+
min-width: 40px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&__dashboard {
|
|
32
|
+
padding-left: 16px;
|
|
33
|
+
padding-left: 16px;
|
|
34
|
+
align-content: center;
|
|
35
|
+
flex-wrap: wrap;
|
|
36
|
+
gap: 8px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__strength-container {
|
|
40
|
+
width: 48px;
|
|
41
|
+
align-content: center;
|
|
42
|
+
flex-wrap: wrap;
|
|
43
|
+
gap: 10px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__strength-content {
|
|
47
|
+
height: 4px;
|
|
48
|
+
width: 0;
|
|
49
|
+
border-radius: var(--corner-radius-max);
|
|
50
|
+
|
|
51
|
+
&[data-strenght="0"] {
|
|
52
|
+
background-color: var(--red-500);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&[data-strenght="1"] {
|
|
56
|
+
background-color: var(--green-200);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-strenght="2"] {
|
|
60
|
+
background-color: var(--green-400);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__message-icon {
|
|
65
|
+
color: var(--green-400);
|
|
66
|
+
width: 16px;
|
|
67
|
+
height: 22px;
|
|
68
|
+
|
|
69
|
+
&[data-state="0"] {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&__message-text {
|
|
75
|
+
align-content: center;
|
|
76
|
+
flex-wrap: wrap;
|
|
77
|
+
line-height: 22px;
|
|
78
|
+
|
|
79
|
+
&[data-status="error"] {
|
|
80
|
+
color: var(--red-500);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__buttons,
|
|
85
|
+
&__form {
|
|
86
|
+
gap: var(--spacer-4);
|
|
87
|
+
width: 100%;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&__button-main {
|
|
91
|
+
&[data-state="0"] {
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&[data-state="1"] {
|
|
96
|
+
background-color: var(--primary-500);
|
|
97
|
+
color: var(--white);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__entry-main {
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 48px;
|
|
104
|
+
border-radius: 12px;
|
|
105
|
+
padding-right: 16px;
|
|
106
|
+
padding-left: 16px;
|
|
107
|
+
border-width: 1px;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
align-content: center;
|
|
110
|
+
flex-wrap: wrap;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&__entry-input {
|
|
114
|
+
&[data-status="error"] {
|
|
115
|
+
input {
|
|
116
|
+
border: 1px var(--red-600) solid;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&__entry-input {
|
|
122
|
+
input {
|
|
123
|
+
width: 100%;
|
|
124
|
+
gap: var(--spacer-4);
|
|
125
|
+
width: 100%;
|
|
126
|
+
border-radius: var(--spacer-4);
|
|
127
|
+
padding-top: 12px;
|
|
128
|
+
padding-right: 16px;
|
|
129
|
+
padding-bottom: 12px;
|
|
130
|
+
padding-left: 16px;
|
|
131
|
+
border: 1px var(--neutral-200) solid;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.entry-reminder__icon {
|
|
135
|
+
right: 5px;
|
|
136
|
+
position: absolute;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
width: 100%;
|
|
140
|
+
height: 100%;
|
|
141
|
+
}
|
|
142
|
+
}
|
package/widgets/otp/index.js
CHANGED
|
@@ -72,7 +72,7 @@ export default class dtk_otp extends dtk_common {
|
|
|
72
72
|
if (res.length >= 6) {
|
|
73
73
|
if (api) {
|
|
74
74
|
return this.postService(api, { ...payload, code: res.join('') }, { async: 1 }).then((data) => {
|
|
75
|
-
if(data.error){
|
|
75
|
+
if (data.error) {
|
|
76
76
|
return this.displayMessage(LOCALE.INVALID_CODE, 1)
|
|
77
77
|
}
|
|
78
78
|
let service = this.mget(_a.service) || 'otp-verified';
|
|
@@ -102,6 +102,7 @@ export default class dtk_otp extends dtk_common {
|
|
|
102
102
|
onUiEvent(cmd, args = {}) {
|
|
103
103
|
const service = args.service || cmd.get(_a.service);
|
|
104
104
|
let status = cmd.status;
|
|
105
|
+
let { email, method } = this.mget('payload') || {}
|
|
105
106
|
switch (service) {
|
|
106
107
|
case _a.input:
|
|
107
108
|
cmd.focus();
|
|
@@ -130,10 +131,10 @@ export default class dtk_otp extends dtk_common {
|
|
|
130
131
|
})
|
|
131
132
|
break;
|
|
132
133
|
case "resend-code":
|
|
133
|
-
|
|
134
|
-
this.postService(SERVICE.otp.send, { email }).then((data) => {
|
|
134
|
+
this.postService(SERVICE.otp.send, { email, method }).then((data) => {
|
|
135
135
|
this.mset({ payload: data })
|
|
136
136
|
this.displayMessage(LOCALE.NEW_CODE_RESENT)
|
|
137
|
+
this.triggerHandlers({ service: "new-code", data })
|
|
137
138
|
}).catch((e) => {
|
|
138
139
|
this.displayMessage(LOCALE.UNKNOWN_ERROR, 1)
|
|
139
140
|
this.warn("AAA:104 Error sending OTP", e)
|