@nethserver/ns8-ui-lib 0.0.38 → 0.0.42
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 +832 -440
- package/dist/ns8-ui-lib.min.js +1 -1
- package/dist/ns8-ui-lib.ssr.js +702 -439
- package/package.json +1 -1
- package/src/lib-components/NsDangerDeleteModal.vue +1 -2
- package/src/lib-components/NsDropdownAction.vue +98 -0
- package/src/lib-components/NsIconMenu.vue +0 -2
- package/src/lib-components/NsTextInput.vue +179 -0
package/package.json
CHANGED
|
@@ -32,14 +32,13 @@
|
|
|
32
32
|
|
|
33
33
|
<script>
|
|
34
34
|
import UtilService from "../lib-mixins/util.js";
|
|
35
|
-
import IconService from "../lib-mixins/util.js";
|
|
36
35
|
import NsInlineNotification from "./NsInlineNotification.vue";
|
|
37
36
|
|
|
38
37
|
export default {
|
|
39
38
|
name: "NsDangerDeleteModal",
|
|
40
39
|
//component added for storybook to work
|
|
41
40
|
components: { NsInlineNotification },
|
|
42
|
-
mixins: [UtilService
|
|
41
|
+
mixins: [UtilService],
|
|
43
42
|
props: {
|
|
44
43
|
isShown: {
|
|
45
44
|
type: Boolean,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div data-overflow-menu :class="[`cv-overflow-menu`]" :id="uid">
|
|
3
|
+
<button
|
|
4
|
+
:class="[
|
|
5
|
+
`bx--btn--${lowerCaseKind}`,
|
|
6
|
+
'bx--btn',
|
|
7
|
+
'bx--btn--field',
|
|
8
|
+
{
|
|
9
|
+
[`${carbonPrefix}--overflow-menu--open`]: open,
|
|
10
|
+
},
|
|
11
|
+
]"
|
|
12
|
+
aria-haspopup
|
|
13
|
+
type="button"
|
|
14
|
+
:aria-expanded="open ? 'true' : 'false'"
|
|
15
|
+
:aria-controls="`${uid}-menu`"
|
|
16
|
+
:id="`${uid}-trigger`"
|
|
17
|
+
ref="trigger"
|
|
18
|
+
@click="doToggle"
|
|
19
|
+
@keydown.space.prevent
|
|
20
|
+
@keyup.space.prevent="doToggle"
|
|
21
|
+
@keydown.enter.prevent="doToggle"
|
|
22
|
+
@keydown.tab="onOverflowMenuTab"
|
|
23
|
+
>
|
|
24
|
+
<slot name="trigger"> </slot>
|
|
25
|
+
<NsSvg :svg="ChevronDown20" :class="`${carbonPrefix}--btn__icon`" />
|
|
26
|
+
</button>
|
|
27
|
+
<div
|
|
28
|
+
:class="[
|
|
29
|
+
`${carbonPrefix}--overflow-menu-options`,
|
|
30
|
+
{
|
|
31
|
+
[`${carbonPrefix}--overflow-menu-options--open`]: open,
|
|
32
|
+
},
|
|
33
|
+
]"
|
|
34
|
+
tabindex="-1"
|
|
35
|
+
ref="popup"
|
|
36
|
+
:aria-labelledby="`${uid}-trigger`"
|
|
37
|
+
:id="`${uid}-menu`"
|
|
38
|
+
:style="{ left: left + 'px', top: top + 'px' }"
|
|
39
|
+
@focusout="checkFocusOut"
|
|
40
|
+
@mousedown.prevent="preventFocusOut"
|
|
41
|
+
>
|
|
42
|
+
<ul :class="`${carbonPrefix}--overflow-menu-options__content`">
|
|
43
|
+
<slot></slot>
|
|
44
|
+
</ul>
|
|
45
|
+
<div
|
|
46
|
+
class="cv-overflow-menu__after-content"
|
|
47
|
+
ref="afterContent"
|
|
48
|
+
tabindex="0"
|
|
49
|
+
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
50
|
+
@focus="focusAfterContent"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script>
|
|
57
|
+
import { CvOverflowMenu } from "@carbon/vue";
|
|
58
|
+
import NsSvg from "./NsSvg.vue";
|
|
59
|
+
import IconService from "../lib-mixins/icon.js";
|
|
60
|
+
|
|
61
|
+
export default {
|
|
62
|
+
name: "NsDropdownAction",
|
|
63
|
+
extends: CvOverflowMenu,
|
|
64
|
+
components: { NsSvg },
|
|
65
|
+
mixins: [IconService],
|
|
66
|
+
props: {
|
|
67
|
+
kind: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "secondary",
|
|
70
|
+
validator: (val) =>
|
|
71
|
+
[
|
|
72
|
+
"default",
|
|
73
|
+
"primary",
|
|
74
|
+
"secondary",
|
|
75
|
+
"tertiary",
|
|
76
|
+
"ghost",
|
|
77
|
+
"danger",
|
|
78
|
+
"danger--ghost",
|
|
79
|
+
"danger--tertiary",
|
|
80
|
+
].includes(val),
|
|
81
|
+
},
|
|
82
|
+
up: Boolean,
|
|
83
|
+
offset: {
|
|
84
|
+
type: Object,
|
|
85
|
+
validator(value) {
|
|
86
|
+
return value && value.left !== undefined && value.top !== undefined;
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
computed: {
|
|
91
|
+
lowerCaseKind() {
|
|
92
|
+
return this.kind.toLowerCase();
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
`cv-text-input`,
|
|
5
|
+
`ns-text-input`,
|
|
6
|
+
`${carbonPrefix}--form-item`,
|
|
7
|
+
`${carbonPrefix}--text-input-wrapper`,
|
|
8
|
+
{ [`${carbonPrefix}--password-input-wrapper`]: isPassword },
|
|
9
|
+
]"
|
|
10
|
+
>
|
|
11
|
+
<div v-if="hasTooltipSlot">
|
|
12
|
+
<label
|
|
13
|
+
:for="uid"
|
|
14
|
+
:class="[
|
|
15
|
+
`${carbonPrefix}--label`,
|
|
16
|
+
{
|
|
17
|
+
[`${carbonPrefix}--label--disabled`]:
|
|
18
|
+
$attrs.disabled !== undefined && $attrs.disabled,
|
|
19
|
+
},
|
|
20
|
+
]"
|
|
21
|
+
>{{ label }}</label
|
|
22
|
+
>
|
|
23
|
+
<!-- tooltip -->
|
|
24
|
+
<cv-interactive-tooltip
|
|
25
|
+
:alignment="tooltipAlignment"
|
|
26
|
+
:direction="tooltipDirection"
|
|
27
|
+
class="tooltip"
|
|
28
|
+
>
|
|
29
|
+
<template slot="content">
|
|
30
|
+
<slot name="tooltip"></slot>
|
|
31
|
+
</template>
|
|
32
|
+
</cv-interactive-tooltip>
|
|
33
|
+
</div>
|
|
34
|
+
<label
|
|
35
|
+
v-else
|
|
36
|
+
:for="uid"
|
|
37
|
+
:class="[
|
|
38
|
+
`${carbonPrefix}--label`,
|
|
39
|
+
{
|
|
40
|
+
[`${carbonPrefix}--label--disabled`]:
|
|
41
|
+
$attrs.disabled !== undefined && $attrs.disabled,
|
|
42
|
+
},
|
|
43
|
+
]"
|
|
44
|
+
>{{ label }}</label
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
:class="[
|
|
48
|
+
`${carbonPrefix}--text-input__field-wrapper`,
|
|
49
|
+
{
|
|
50
|
+
[`${carbonPrefix}--text-input__field-wrapper--warning`]:
|
|
51
|
+
!isInvalid && isWarn,
|
|
52
|
+
},
|
|
53
|
+
]"
|
|
54
|
+
:data-invalid="isInvalid"
|
|
55
|
+
>
|
|
56
|
+
<WarningFilled16
|
|
57
|
+
v-if="isInvalid"
|
|
58
|
+
:class="`${carbonPrefix}--text-input__invalid-icon`"
|
|
59
|
+
/>
|
|
60
|
+
<WarningAltFilled16
|
|
61
|
+
v-if="isWarn"
|
|
62
|
+
:class="`${carbonPrefix}--text-input__invalid-icon ${carbonPrefix}--text-input__invalid-icon--warning`"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<input
|
|
66
|
+
:id="uid"
|
|
67
|
+
:class="[
|
|
68
|
+
`${carbonPrefix}--text-input`,
|
|
69
|
+
{
|
|
70
|
+
[`${carbonPrefix}--text-input--light`]: isLight,
|
|
71
|
+
[`${carbonPrefix}--text-input--invalid`]: isInvalid,
|
|
72
|
+
[`${carbonPrefix}--text-input--warning`]: isWarn,
|
|
73
|
+
[`${carbonPrefix}--password-input`]: isPassword,
|
|
74
|
+
},
|
|
75
|
+
]"
|
|
76
|
+
v-bind="$attrs"
|
|
77
|
+
:value="value"
|
|
78
|
+
v-on="inputListeners"
|
|
79
|
+
:data-toggle-password-visibility="isPassword"
|
|
80
|
+
:type="dataType"
|
|
81
|
+
ref="input"
|
|
82
|
+
/>
|
|
83
|
+
<button
|
|
84
|
+
v-if="isPassword"
|
|
85
|
+
:class="[
|
|
86
|
+
`${carbonPrefix}--btn`,
|
|
87
|
+
`${carbonPrefix}--text-input--password__visibility__toggle`,
|
|
88
|
+
`${carbonPrefix}--tooltip__trigger`,
|
|
89
|
+
`${carbonPrefix}--tooltip--a11y`,
|
|
90
|
+
`${carbonPrefix}--tooltip--bottom`,
|
|
91
|
+
`${carbonPrefix}--tooltip--align-center`,
|
|
92
|
+
]"
|
|
93
|
+
@click="togglePasswordVisibility"
|
|
94
|
+
type="button"
|
|
95
|
+
>
|
|
96
|
+
<span :class="`${carbonPrefix}--assistive-text`">{{
|
|
97
|
+
passwordHideShowLabel
|
|
98
|
+
}}</span>
|
|
99
|
+
<ViewOff16
|
|
100
|
+
v-if="isPasswordVisible"
|
|
101
|
+
:class="`${carbonPrefix}--icon-visibility-off`"
|
|
102
|
+
/>
|
|
103
|
+
<View16 v-else :class="`${carbonPrefix}--icon-visibility-off`" />
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
<div :class="`${carbonPrefix}--form-requirement`" v-if="isInvalid">
|
|
107
|
+
<slot name="invalid-message">{{ invalidMessage }}</slot>
|
|
108
|
+
</div>
|
|
109
|
+
<div v-if="isWarn" :class="`${carbonPrefix}--form__requirement`">
|
|
110
|
+
<slot name="warn-text">{{ warnText }}</slot>
|
|
111
|
+
</div>
|
|
112
|
+
<div
|
|
113
|
+
v-if="isHelper"
|
|
114
|
+
:class="[
|
|
115
|
+
`${carbonPrefix}--form__helper-text`,
|
|
116
|
+
{ [`${carbonPrefix}--form__helper-text--disabled`]: $attrs.disabled },
|
|
117
|
+
]"
|
|
118
|
+
>
|
|
119
|
+
<slot name="helper-text">{{ helperText }}</slot>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</template>
|
|
123
|
+
|
|
124
|
+
<script>
|
|
125
|
+
import { CvTextInput } from "@carbon/vue";
|
|
126
|
+
import {
|
|
127
|
+
WarningFilled16,
|
|
128
|
+
WarningAltFilled16,
|
|
129
|
+
View16,
|
|
130
|
+
ViewOff16,
|
|
131
|
+
} from "@carbon/icons-vue";
|
|
132
|
+
|
|
133
|
+
export default {
|
|
134
|
+
name: "NsTextInput",
|
|
135
|
+
extends: CvTextInput,
|
|
136
|
+
components: { WarningFilled16, WarningAltFilled16, View16, ViewOff16 },
|
|
137
|
+
props: {
|
|
138
|
+
helperText: { type: String, default: undefined },
|
|
139
|
+
invalidMessage: { type: String, default: undefined },
|
|
140
|
+
label: String,
|
|
141
|
+
passwordHideLabel: { type: String, default: "Hide password" },
|
|
142
|
+
passwordShowLabel: { type: String, default: "Show password" },
|
|
143
|
+
passwordVisible: Boolean,
|
|
144
|
+
type: String,
|
|
145
|
+
value: String,
|
|
146
|
+
warnText: { type: String, default: undefined },
|
|
147
|
+
tooltipAlignment: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: "center",
|
|
150
|
+
validator: (val) => ["start", "center", "end"].includes(val),
|
|
151
|
+
},
|
|
152
|
+
tooltipDirection: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: "bottom",
|
|
155
|
+
validator: (val) => ["top", "left", "bottom", "right".includes(val)],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
computed: {
|
|
159
|
+
hasTooltipSlot() {
|
|
160
|
+
return !!this.$slots.tooltip;
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
<style scoped lang="scss">
|
|
167
|
+
.tooltip {
|
|
168
|
+
display: inline-block;
|
|
169
|
+
position: absolute;
|
|
170
|
+
}
|
|
171
|
+
</style>
|
|
172
|
+
|
|
173
|
+
<style lang="scss">
|
|
174
|
+
// global styles
|
|
175
|
+
|
|
176
|
+
.ns-text-input .bx--tooltip__label .bx--tooltip__trigger {
|
|
177
|
+
margin-left: 0.25rem;
|
|
178
|
+
}
|
|
179
|
+
</style>
|