@nethserver/ns8-ui-lib 0.0.84 → 0.0.85
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 +260 -98
- package/dist/ns8-ui-lib.min.js +1 -1
- package/dist/ns8-ui-lib.ssr.js +209 -100
- package/package.json +1 -1
- package/src/lib-components/NsModal.vue +131 -0
package/package.json
CHANGED
|
@@ -1,14 +1,145 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
data-modal
|
|
4
|
+
:id="uid"
|
|
5
|
+
:class="[
|
|
6
|
+
`cv-modal ${carbonPrefix}--modal`,
|
|
7
|
+
{
|
|
8
|
+
'is-visible': dataVisible,
|
|
9
|
+
[`${carbonPrefix}--modal--danger`]: kind === 'danger',
|
|
10
|
+
},
|
|
11
|
+
]"
|
|
12
|
+
tabindex="-1"
|
|
13
|
+
@keydown.esc.prevent="onEsc"
|
|
14
|
+
@click.self="onExternalClick"
|
|
15
|
+
>
|
|
16
|
+
<div
|
|
17
|
+
:class="[
|
|
18
|
+
`${carbonPrefix}--modal-container`,
|
|
19
|
+
{ [`${carbonPrefix}--modal-container--${internalSize}`]: internalSize },
|
|
20
|
+
]"
|
|
21
|
+
v-bind="dialogAttrs"
|
|
22
|
+
ref="modalDialog"
|
|
23
|
+
>
|
|
24
|
+
<div
|
|
25
|
+
class="cv-modal__before-content"
|
|
26
|
+
ref="beforeContent"
|
|
27
|
+
tabindex="0"
|
|
28
|
+
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
29
|
+
@focus="focusBeforeContent"
|
|
30
|
+
/>
|
|
31
|
+
<div :class="`${carbonPrefix}--modal-header`">
|
|
32
|
+
<p :class="`${carbonPrefix}--modal-header__label`">
|
|
33
|
+
<slot name="label"></slot>
|
|
34
|
+
</p>
|
|
35
|
+
<p :class="`${carbonPrefix}--modal-header__heading`">
|
|
36
|
+
<slot name="title">Modal Title</slot>
|
|
37
|
+
</p>
|
|
38
|
+
<button
|
|
39
|
+
:class="`${carbonPrefix}--modal-close`"
|
|
40
|
+
type="button"
|
|
41
|
+
@click="onClose"
|
|
42
|
+
ref="close"
|
|
43
|
+
:aria-label="closeAriaLabel"
|
|
44
|
+
>
|
|
45
|
+
<Close16 :class="`${carbonPrefix}--modal-close__icon`" />
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div
|
|
50
|
+
:class="[
|
|
51
|
+
`${carbonPrefix}--modal-content`,
|
|
52
|
+
{ [`${carbonPrefix}--modal-content--with-form`]: hasFormContent },
|
|
53
|
+
]"
|
|
54
|
+
ref="content"
|
|
55
|
+
:tabindex="scrollable ? 0 : undefined"
|
|
56
|
+
>
|
|
57
|
+
<slot name="content"></slot>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<cv-button-set
|
|
61
|
+
:class="[
|
|
62
|
+
`${carbonPrefix}--modal-footer`,
|
|
63
|
+
{
|
|
64
|
+
[`${carbonPrefix}--modal-footer--three-button`]:
|
|
65
|
+
hasPrimary && hasSecondary && hasOtherBtn,
|
|
66
|
+
},
|
|
67
|
+
]"
|
|
68
|
+
v-if="hasFooter"
|
|
69
|
+
>
|
|
70
|
+
<cv-button
|
|
71
|
+
type="button"
|
|
72
|
+
kind="secondary"
|
|
73
|
+
@click="onOtherBtnClick"
|
|
74
|
+
v-if="hasOtherBtn"
|
|
75
|
+
ref="otherBtn"
|
|
76
|
+
>
|
|
77
|
+
<slot name="other-button">Other button</slot>
|
|
78
|
+
</cv-button>
|
|
79
|
+
<cv-button
|
|
80
|
+
type="button"
|
|
81
|
+
kind="secondary"
|
|
82
|
+
@click="onSecondaryClick"
|
|
83
|
+
v-if="hasSecondary"
|
|
84
|
+
ref="secondary"
|
|
85
|
+
>
|
|
86
|
+
<slot name="secondary-button">Secondary button</slot>
|
|
87
|
+
</cv-button>
|
|
88
|
+
<NsButton
|
|
89
|
+
:disabled="primaryButtonDisabled"
|
|
90
|
+
type="button"
|
|
91
|
+
:kind="primaryKind"
|
|
92
|
+
@click="onPrimaryClick"
|
|
93
|
+
v-if="hasPrimary"
|
|
94
|
+
ref="primary"
|
|
95
|
+
:loading="isLoading"
|
|
96
|
+
>
|
|
97
|
+
<slot name="primary-button">Primary button</slot>
|
|
98
|
+
</NsButton>
|
|
99
|
+
</cv-button-set>
|
|
100
|
+
<div
|
|
101
|
+
class="cv-modal__after-content"
|
|
102
|
+
ref="afterContent"
|
|
103
|
+
tabindex="0"
|
|
104
|
+
style="position: absolute; height: 1px; width: 1px; left: -9999px"
|
|
105
|
+
@focus="focusAfterContent"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
|
|
1
111
|
<script>
|
|
2
112
|
import { CvModal } from "@carbon/vue";
|
|
113
|
+
import NsButton from "./NsButton";
|
|
3
114
|
|
|
4
115
|
export default {
|
|
5
116
|
name: "NsModal",
|
|
6
117
|
extends: CvModal,
|
|
118
|
+
components: {
|
|
119
|
+
CvModal,
|
|
120
|
+
NsButton,
|
|
121
|
+
},
|
|
7
122
|
props: {
|
|
8
123
|
hideOnClickOutside: {
|
|
9
124
|
type: Boolean,
|
|
10
125
|
default: false,
|
|
11
126
|
},
|
|
127
|
+
isLoading: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false,
|
|
130
|
+
},
|
|
131
|
+
alert: Boolean,
|
|
132
|
+
closeAriaLabel: { type: String, default: "Close modal" },
|
|
133
|
+
kind: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: "",
|
|
136
|
+
validator: (val) => ["", "danger"].includes(val),
|
|
137
|
+
},
|
|
138
|
+
autoHideOff: Boolean,
|
|
139
|
+
visible: Boolean,
|
|
140
|
+
primaryButtonDisabled: Boolean,
|
|
141
|
+
size: String,
|
|
142
|
+
hasFormContent: Boolean,
|
|
12
143
|
},
|
|
13
144
|
methods: {
|
|
14
145
|
onExternalClick(ev) {
|