@nethserver/ns8-ui-lib 0.0.31 → 0.0.35
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/ns8-ui-lib.esm.js +425 -7529
- package/dist/ns8-ui-lib.min.js +1 -1
- package/dist/ns8-ui-lib.ssr.js +399 -7501
- package/package.json +1 -2
- package/src/lib-components/NsCircleTimer.vue +109 -0
- package/src/lib-components/NsEmptyState.vue +1 -5
- package/src/lib-components/NsInlineNotification.vue +14 -1
- package/src/lib-components/NsPasswordInput.vue +7 -10
- package/src/lib-components/NsProgressBar.vue +1 -2
- package/src/lib-components/NsDangerDeleteModal.vue +0 -113
- package/src/lib-components/pictograms/Group.vue +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nethserver/ns8-ui-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "Vue.js library for NethServer 8 UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nethserver",
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"node": ">=12"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
62
61
|
"core-js": "^3.15.2",
|
|
63
62
|
"date-fns": "^2.23.0",
|
|
64
63
|
"date-fns-tz": "^1.1.6"
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="base-timer" :style="{ height: size + 'px', width: size + 'px' }">
|
|
3
|
+
<svg
|
|
4
|
+
class="base-timer__svg"
|
|
5
|
+
viewBox="0 0 100 100"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<g class="base-timer__circle">
|
|
9
|
+
<path
|
|
10
|
+
id="base-timer-path-remaining"
|
|
11
|
+
stroke-dasharray="251"
|
|
12
|
+
class="base-timer__path-remaining green"
|
|
13
|
+
d="
|
|
14
|
+
M 50, 50
|
|
15
|
+
m -40, 0
|
|
16
|
+
a 40,40 0 1,0 80,0
|
|
17
|
+
a 40,40 0 1,0 -80,0
|
|
18
|
+
"
|
|
19
|
+
:style="{
|
|
20
|
+
'stroke-width': strokeWidth + 'px',
|
|
21
|
+
'stroke-dasharray': circleDasharray,
|
|
22
|
+
color: color,
|
|
23
|
+
}"
|
|
24
|
+
></path>
|
|
25
|
+
</g>
|
|
26
|
+
</svg>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
export default {
|
|
32
|
+
name: "NsCircleTimer",
|
|
33
|
+
props: {
|
|
34
|
+
timeLimit: {
|
|
35
|
+
type: Number, // milliseconds
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 16,
|
|
41
|
+
},
|
|
42
|
+
strokeWidth: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 20,
|
|
45
|
+
},
|
|
46
|
+
color: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "#00a2de",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
data() {
|
|
52
|
+
return {
|
|
53
|
+
timerInterval: null,
|
|
54
|
+
timePassed: 0,
|
|
55
|
+
timeLeft: -1,
|
|
56
|
+
// length = 2πr = 2 * π * 40 = 251
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
computed: {
|
|
60
|
+
circleDasharray() {
|
|
61
|
+
return `${(this.calculateTimeFraction() * 251).toFixed(0)} 251`;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
created() {
|
|
65
|
+
this.timeLimitSeconds = (this.timeLimit - 1000) / 1000;
|
|
66
|
+
this.timeLeft = this.timeLimitSeconds;
|
|
67
|
+
|
|
68
|
+
this.timerInterval = setInterval(() => {
|
|
69
|
+
this.timePassed += 1;
|
|
70
|
+
this.timeLeft = this.timeLimitSeconds - this.timePassed;
|
|
71
|
+
}, 1000);
|
|
72
|
+
},
|
|
73
|
+
beforeDestroy() {
|
|
74
|
+
clearInterval(this.timerInterval);
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
calculateTimeFraction() {
|
|
78
|
+
return this.timeLeft / this.timeLimitSeconds;
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style scoped lang="scss">
|
|
85
|
+
.base-timer {
|
|
86
|
+
position: relative;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.base-timer__circle {
|
|
90
|
+
fill: none;
|
|
91
|
+
stroke: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.base-timer__path-remaining {
|
|
95
|
+
stroke: currentColor;
|
|
96
|
+
|
|
97
|
+
/* animation starts at the top of the circle */
|
|
98
|
+
transform: rotate(90deg);
|
|
99
|
+
transform-origin: center;
|
|
100
|
+
|
|
101
|
+
/* one second aligns with the speed of the countdown timer */
|
|
102
|
+
transition: 1s linear all;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.base-timer__svg {
|
|
106
|
+
/* flips the svg and makes the animation to move left-to-right */
|
|
107
|
+
transform: scaleX(-1);
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:animationData="animationData"
|
|
6
6
|
:refName="animationTitle"
|
|
7
7
|
:animateOnHover="true"
|
|
8
|
-
:loop="
|
|
8
|
+
:loop="1"
|
|
9
9
|
:autoPlay="true"
|
|
10
10
|
class="animation image"
|
|
11
11
|
/>
|
|
@@ -42,10 +42,6 @@ export default {
|
|
|
42
42
|
},
|
|
43
43
|
animationData: Object,
|
|
44
44
|
animationTitle: String,
|
|
45
|
-
loop: {
|
|
46
|
-
type: [Boolean, Number],
|
|
47
|
-
default: 1,
|
|
48
|
-
},
|
|
49
45
|
},
|
|
50
46
|
computed: {
|
|
51
47
|
hasPictogramSlot() {
|
|
@@ -27,11 +27,19 @@
|
|
|
27
27
|
v-if="description"
|
|
28
28
|
:class="[
|
|
29
29
|
`${carbonPrefix}--inline-notification__subtitle`,
|
|
30
|
-
{ 'mg-right': loading },
|
|
30
|
+
{ 'mg-right': loading || timer },
|
|
31
31
|
]"
|
|
32
32
|
v-html="description"
|
|
33
33
|
></p>
|
|
34
34
|
<p v-if="loading" class="loader"></p>
|
|
35
|
+
<p v-if="timer">
|
|
36
|
+
<NsCircleTimer
|
|
37
|
+
:timeLimit="timer"
|
|
38
|
+
:size="16"
|
|
39
|
+
:strokeWidth="20"
|
|
40
|
+
color="white"
|
|
41
|
+
/>
|
|
42
|
+
</p>
|
|
35
43
|
</div>
|
|
36
44
|
</div>
|
|
37
45
|
<button
|
|
@@ -62,10 +70,12 @@
|
|
|
62
70
|
|
|
63
71
|
<script>
|
|
64
72
|
import { CvInlineNotification } from "@carbon/vue";
|
|
73
|
+
import NsCircleTimer from "./NsCircleTimer.vue";
|
|
65
74
|
|
|
66
75
|
export default {
|
|
67
76
|
name: "NsInlineNotification",
|
|
68
77
|
extends: CvInlineNotification,
|
|
78
|
+
components: { NsCircleTimer },
|
|
69
79
|
props: {
|
|
70
80
|
showCloseButton: {
|
|
71
81
|
type: Boolean,
|
|
@@ -84,6 +94,9 @@ export default {
|
|
|
84
94
|
type: Boolean,
|
|
85
95
|
default: false,
|
|
86
96
|
},
|
|
97
|
+
timer: {
|
|
98
|
+
type: Number,
|
|
99
|
+
},
|
|
87
100
|
},
|
|
88
101
|
};
|
|
89
102
|
</script>
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
:passwordShowLabel="passwordShowLabel"
|
|
13
13
|
:passwordVisible="newPasswordVisible"
|
|
14
14
|
:light="light"
|
|
15
|
-
:disabled="disabled"
|
|
16
15
|
class="new-password"
|
|
17
16
|
ref="newPassword"
|
|
18
17
|
>
|
|
@@ -66,7 +65,6 @@
|
|
|
66
65
|
:passwordShowLabel="passwordShowLabel"
|
|
67
66
|
:passwordVisible="confirmPasswordVisible"
|
|
68
67
|
:light="light"
|
|
69
|
-
:disabled="disabled"
|
|
70
68
|
class="confirm-password"
|
|
71
69
|
ref="confirmPassword"
|
|
72
70
|
>
|
|
@@ -138,7 +136,6 @@ export default {
|
|
|
138
136
|
type: String,
|
|
139
137
|
default: "Equal",
|
|
140
138
|
},
|
|
141
|
-
disabled: Boolean,
|
|
142
139
|
},
|
|
143
140
|
data() {
|
|
144
141
|
return {
|
|
@@ -166,25 +163,25 @@ export default {
|
|
|
166
163
|
},
|
|
167
164
|
},
|
|
168
165
|
watch: {
|
|
169
|
-
isLengthOk: function
|
|
166
|
+
isLengthOk: function() {
|
|
170
167
|
this.emitPasswordValidity();
|
|
171
168
|
},
|
|
172
|
-
isLowercaseOk: function
|
|
169
|
+
isLowercaseOk: function() {
|
|
173
170
|
this.emitPasswordValidity();
|
|
174
171
|
},
|
|
175
|
-
isUppercaseOk: function
|
|
172
|
+
isUppercaseOk: function() {
|
|
176
173
|
this.emitPasswordValidity();
|
|
177
174
|
},
|
|
178
|
-
isNumberOk: function
|
|
175
|
+
isNumberOk: function() {
|
|
179
176
|
this.emitPasswordValidity();
|
|
180
177
|
},
|
|
181
|
-
isSymbolOk: function
|
|
178
|
+
isSymbolOk: function() {
|
|
182
179
|
this.emitPasswordValidity();
|
|
183
180
|
},
|
|
184
|
-
isEqualOk: function
|
|
181
|
+
isEqualOk: function() {
|
|
185
182
|
this.emitPasswordValidity();
|
|
186
183
|
},
|
|
187
|
-
focus: function
|
|
184
|
+
focus: function() {
|
|
188
185
|
if (this.focus && this.focus.element) {
|
|
189
186
|
this.focusElement(this.focus.element);
|
|
190
187
|
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<cv-modal
|
|
3
|
-
kind="danger"
|
|
4
|
-
size="default"
|
|
5
|
-
:visible="isShown"
|
|
6
|
-
@modal-hidden="onModalHidden"
|
|
7
|
-
@primary-click="confirmDelete"
|
|
8
|
-
:primary-button-disabled="name !== userInput"
|
|
9
|
-
>
|
|
10
|
-
<template slot="title">{{ title }}</template>
|
|
11
|
-
<template slot="content">
|
|
12
|
-
<NsInlineNotification
|
|
13
|
-
kind="warning"
|
|
14
|
-
:title="warning"
|
|
15
|
-
:showCloseButton="false"
|
|
16
|
-
/>
|
|
17
|
-
<div class="mg-bottom-md" v-html="description"></div>
|
|
18
|
-
<div v-html="typeToConfirmMessage"></div>
|
|
19
|
-
<cv-form @submit.prevent="confirmDelete">
|
|
20
|
-
<cv-text-input
|
|
21
|
-
v-model="userInput"
|
|
22
|
-
class="mg-bottom-md"
|
|
23
|
-
ref="userInput"
|
|
24
|
-
></cv-text-input>
|
|
25
|
-
</cv-form>
|
|
26
|
-
</template>
|
|
27
|
-
<template slot="secondary-button">{{ cancelLabel }}</template>
|
|
28
|
-
<template slot="primary-button">{{ deleteLabel }}</template>
|
|
29
|
-
</cv-modal>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
<script>
|
|
33
|
-
import UtilService from "../lib-mixins/util.js";
|
|
34
|
-
import IconService from "../lib-mixins/util.js";
|
|
35
|
-
import NsInlineNotification from "./NsInlineNotification.vue";
|
|
36
|
-
|
|
37
|
-
export default {
|
|
38
|
-
name: "NsDangerDeleteModal",
|
|
39
|
-
//component added for storybook to work
|
|
40
|
-
components: { NsInlineNotification },
|
|
41
|
-
mixins: [UtilService, IconService],
|
|
42
|
-
props: {
|
|
43
|
-
isShown: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: true,
|
|
46
|
-
},
|
|
47
|
-
name: {
|
|
48
|
-
type: String,
|
|
49
|
-
required: true,
|
|
50
|
-
},
|
|
51
|
-
title: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: "Confirm deletion",
|
|
54
|
-
},
|
|
55
|
-
warning: {
|
|
56
|
-
type: String,
|
|
57
|
-
default: "Please read carefully",
|
|
58
|
-
},
|
|
59
|
-
description: {
|
|
60
|
-
type: String,
|
|
61
|
-
default:
|
|
62
|
-
"Do you really want to delete this object? This action is irreversible",
|
|
63
|
-
},
|
|
64
|
-
typeToConfirm: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: "",
|
|
67
|
-
},
|
|
68
|
-
cancelLabel: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: "Cancel",
|
|
71
|
-
},
|
|
72
|
-
deleteLabel: {
|
|
73
|
-
type: String,
|
|
74
|
-
default: "I understand, delete",
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
data() {
|
|
78
|
-
return {
|
|
79
|
-
userInput: "",
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
computed: {
|
|
83
|
-
typeToConfirmMessage() {
|
|
84
|
-
if (this.typeToConfirm) {
|
|
85
|
-
return this.typeToConfirm;
|
|
86
|
-
} else {
|
|
87
|
-
return `Type <strong>${this.name}</strong> to confirm deletion`;
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
watch: {
|
|
92
|
-
isShown: function () {
|
|
93
|
-
if (this.isShown) {
|
|
94
|
-
setTimeout(() => {
|
|
95
|
-
this.focusElement("userInput");
|
|
96
|
-
}, 300);
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
methods: {
|
|
101
|
-
onModalHidden() {
|
|
102
|
-
this.$emit("hide");
|
|
103
|
-
},
|
|
104
|
-
confirmDelete() {
|
|
105
|
-
if (this.name == this.userInput) {
|
|
106
|
-
this.$emit("confirmDelete");
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
</script>
|
|
112
|
-
|
|
113
|
-
<style scoped lang="scss"></style>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<path
|
|
3
|
-
id="group"
|
|
4
|
-
d="M24.36,31h-0.72v-7.5c0-3.552-2.414-6.604-5.872-7.424c-0.15-0.036-0.261-0.163-0.275-0.316
|
|
5
|
-
c-0.015-0.154,0.071-0.3,0.212-0.363c1.517-0.675,2.496-2.181,2.496-3.836c0-2.316-1.884-4.201-4.2-4.201S11.8,9.244,11.8,11.561
|
|
6
|
-
c0,1.655,0.98,3.162,2.496,3.836c0.141,0.063,0.227,0.209,0.212,0.363c-0.014,0.153-0.125,0.281-0.275,0.316
|
|
7
|
-
c-3.458,0.82-5.872,3.872-5.872,7.424V31H7.64v-7.5c0-3.592,2.257-6.718,5.585-7.879c-1.326-0.907-2.146-2.421-2.146-4.061
|
|
8
|
-
c0-1.964,1.157-3.664,2.826-4.452C14.101,6.617,14.2,6.097,14.2,5.561c0-2.316-1.884-4.201-4.2-4.201S5.799,3.244,5.799,5.561
|
|
9
|
-
c0,1.656,0.98,3.162,2.496,3.836C8.437,9.46,8.521,9.606,8.507,9.76c-0.014,0.153-0.125,0.281-0.275,0.316
|
|
10
|
-
C4.774,10.896,2.36,13.948,2.36,17.5V25H1.64v-7.5c0-3.592,2.257-6.718,5.585-7.879C5.899,8.714,5.08,7.2,5.08,5.561
|
|
11
|
-
c0-2.713,2.207-4.92,4.92-4.92s4.92,2.207,4.92,4.92c0,0.422-0.052,0.836-0.157,1.237c0.791-0.205,1.683-0.205,2.473,0
|
|
12
|
-
c-0.104-0.401-0.157-0.815-0.157-1.237c0-2.713,2.208-4.92,4.921-4.92s4.921,2.207,4.921,4.92c0,1.64-0.82,3.154-2.146,4.061
|
|
13
|
-
c3.329,1.161,5.586,4.287,5.586,7.879V25H29.64v-7.5c0-3.552-2.414-6.604-5.872-7.424c-0.15-0.036-0.261-0.163-0.275-0.316
|
|
14
|
-
c-0.015-0.154,0.071-0.3,0.212-0.363C25.221,8.722,26.2,7.216,26.2,5.561c0-2.316-1.884-4.201-4.2-4.201s-4.2,1.884-4.2,4.201
|
|
15
|
-
c0,0.536,0.099,1.056,0.295,1.548c1.669,0.789,2.826,2.488,2.826,4.452c0,1.64-0.82,3.154-2.146,4.061
|
|
16
|
-
c3.329,1.161,5.586,4.287,5.586,7.879L24.36,31L24.36,31z"
|
|
17
|
-
/>
|
|
18
|
-
</template>
|