srcdev-nuxt-components 1.0.2 → 1.0.4
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/assets/styles/utils/_page.css +6 -0
- package/assets/styles/variables/components/_display-dialog-core.css +35 -0
- package/assets/styles/variables/components/index.css +1 -0
- package/components/functional/display-dialog/DisplayDialogCore.vue +145 -71
- package/components/functional/display-dialog/variants/DisplayDialogConfirm.vue +15 -11
- package/components/functional/display-dialog/variants/DisplayDialogScrollableContent.vue +49 -0
- package/composables/useDialogControls.ts +23 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.display-dialog-core {
|
|
2
|
+
--dialog-border: 0.1rem solid light-dark(var(--gray-8), var(--gray-0));
|
|
3
|
+
--dialog-outline: 0.1rem solid light-dark(var(--gray-8), var(--gray-0));
|
|
4
|
+
--dialog-border-radius: 0.4rem;
|
|
5
|
+
|
|
6
|
+
--dialog-inner-background: light-dark(var(--gray-0), var(--gray-9));
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Header styles
|
|
10
|
+
*/
|
|
11
|
+
--dialog-header-padding: 0 1.2rem;
|
|
12
|
+
|
|
13
|
+
--dialog-header-button-margin: 0;
|
|
14
|
+
--dialog-header-button-padding: 0.4rem;
|
|
15
|
+
--dialog-header-button-border-radius: 50%;
|
|
16
|
+
|
|
17
|
+
--dialog-header-button-border: 1px solid transparent;
|
|
18
|
+
--dialog-header-button-outline: 1px solid transparent;
|
|
19
|
+
|
|
20
|
+
--dialog-header-button-border-hover: 1px solid light-dark(var(--gray-8), var(--gray-0));
|
|
21
|
+
--dialog-header-button-outline-hover: 1px solid light-dark(var(--gray-8), var(--gray-0));
|
|
22
|
+
|
|
23
|
+
--dialog-header-button-icon-color: light-dark(var(--gray-8), var(--gray-0));
|
|
24
|
+
--dialog-header-button-icon-font-size: 1.4rem;
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* Header styles
|
|
28
|
+
*/
|
|
29
|
+
--dialog-content-padding: 1.2rem;
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
* Footerer styles
|
|
33
|
+
*/
|
|
34
|
+
--dialog-footer-padding: 1.2rem;
|
|
35
|
+
}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<dialog class="display-dialog
|
|
2
|
+
<dialog class="display-dialog-core" :class="[variant, elementClasses]" role="dialog" :align-dialog :open :data-dialog-id="dataDialogId" ref="dialogRef">
|
|
3
3
|
<focus-trap v-model:active="open" :clickOutsideDeactivates="true" @deactivate="closeDialog()">
|
|
4
4
|
<div class="inner">
|
|
5
|
-
<div class="
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
5
|
+
<div class="header">
|
|
6
|
+
<div v-if="hasDialogTitle" class="col-left">
|
|
7
|
+
<slot name="dialogTitle"></slot>
|
|
8
|
+
</div>
|
|
11
9
|
|
|
12
10
|
<div class="col-center">
|
|
13
11
|
<p class="text-normal wght-700">Center col</p>
|
|
14
12
|
</div>
|
|
15
13
|
<div class="col-right">
|
|
16
|
-
<button @click.prevent="closeDialog()">
|
|
14
|
+
<button @click.prevent="closeDialog()" data-test-id="display-dialog-header-close" class="display-prompt-action">
|
|
15
|
+
<Icon name="bitcoin-icons:cross-filled" class="icon" />
|
|
16
|
+
<span class="sr-only">Really Close</span>
|
|
17
|
+
</button>
|
|
17
18
|
</div>
|
|
18
19
|
</div>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</
|
|
20
|
+
<div v-if="hasDialogContent" class="dialog-content" :class="[{ 'allow-content-scroll': allowContentScroll }]">
|
|
21
|
+
<slot name="dialogContent"></slot>
|
|
22
|
+
</div>
|
|
23
|
+
<div v-if="hasActionButtons" class="footer">
|
|
24
|
+
<slot name="actionButtons"></slot>
|
|
25
|
+
</div>
|
|
25
26
|
</div>
|
|
26
27
|
</focus-trap>
|
|
27
28
|
</dialog>
|
|
@@ -37,7 +38,7 @@ const props = defineProps({
|
|
|
37
38
|
variant: {
|
|
38
39
|
type: String,
|
|
39
40
|
default: 'dialog',
|
|
40
|
-
validator: (val) => ['dialog', 'modal'].includes(val as string),
|
|
41
|
+
validator: (val) => ['dialog', 'modal', 'confirm'].includes(val as string),
|
|
41
42
|
},
|
|
42
43
|
positionX: {
|
|
43
44
|
type: String,
|
|
@@ -53,6 +54,14 @@ const props = defineProps({
|
|
|
53
54
|
type: Boolean,
|
|
54
55
|
default: true,
|
|
55
56
|
},
|
|
57
|
+
allowContentScroll: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
},
|
|
61
|
+
dataDialogId: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
56
65
|
});
|
|
57
66
|
|
|
58
67
|
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
@@ -85,8 +94,36 @@ onMounted(() => {
|
|
|
85
94
|
</script>
|
|
86
95
|
|
|
87
96
|
<style lang="css">
|
|
88
|
-
.display-dialog {
|
|
97
|
+
.display-dialog-core {
|
|
98
|
+
--_dialog-inner-height: initial;
|
|
99
|
+
--_dialog-inner-width: 100vw;
|
|
100
|
+
|
|
89
101
|
display: flex;
|
|
102
|
+
position: fixed;
|
|
103
|
+
left: 0;
|
|
104
|
+
top: 0;
|
|
105
|
+
width: 100%;
|
|
106
|
+
height: 100%;
|
|
107
|
+
backdrop-filter: blur(5px);
|
|
108
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
109
|
+
z-index: 13;
|
|
110
|
+
opacity: 0;
|
|
111
|
+
border: none;
|
|
112
|
+
padding: 0;
|
|
113
|
+
|
|
114
|
+
display: none;
|
|
115
|
+
transition: opacity 200ms, display 200ms, overlay 200ms;
|
|
116
|
+
transition-behavior: allow-discrete;
|
|
117
|
+
|
|
118
|
+
&[open] {
|
|
119
|
+
display: flex;
|
|
120
|
+
opacity: 1;
|
|
121
|
+
|
|
122
|
+
@starting-style {
|
|
123
|
+
display: flex;
|
|
124
|
+
opacity: 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
90
127
|
|
|
91
128
|
&[align-dialog$='center'] {
|
|
92
129
|
justify-content: center;
|
|
@@ -95,76 +132,113 @@ onMounted(() => {
|
|
|
95
132
|
align-items: center;
|
|
96
133
|
}
|
|
97
134
|
|
|
98
|
-
&.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
top: 0;
|
|
102
|
-
width: 100%;
|
|
103
|
-
height: 100%;
|
|
104
|
-
backdrop-filter: blur(5px);
|
|
105
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
106
|
-
border: 0.1rem solid var(--color-grey-1);
|
|
107
|
-
z-index: 13;
|
|
108
|
-
opacity: 0;
|
|
109
|
-
|
|
110
|
-
display: none;
|
|
111
|
-
transition: opacity 200ms, display 200ms, overlay 200ms;
|
|
112
|
-
transition-behavior: allow-discrete;
|
|
113
|
-
|
|
114
|
-
&[open] {
|
|
115
|
-
display: flex;
|
|
116
|
-
opacity: 1;
|
|
135
|
+
&.confirm {
|
|
136
|
+
--_dialog-inner-width: initial;
|
|
137
|
+
}
|
|
117
138
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
}
|
|
139
|
+
&.dialog {
|
|
140
|
+
--_dialog-inner-height: 70dvh;
|
|
141
|
+
--_dialog-inner-width: min(75%, 720px);
|
|
123
142
|
}
|
|
124
143
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
margin: 1.2rem;
|
|
129
|
-
padding: 1.2rem;
|
|
144
|
+
&.form {
|
|
145
|
+
--_dialog-inner-width: initial;
|
|
146
|
+
}
|
|
130
147
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
148
|
+
&.fullscreen {
|
|
149
|
+
--_dialog-inner-width: initial;
|
|
150
|
+
}
|
|
134
151
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
width: 100vw;
|
|
138
|
-
} */
|
|
152
|
+
&.modal {
|
|
153
|
+
--_dialog-inner-width: initial;
|
|
139
154
|
}
|
|
140
155
|
|
|
141
|
-
.
|
|
156
|
+
.inner {
|
|
142
157
|
display: grid;
|
|
143
|
-
grid-template-
|
|
144
|
-
|
|
158
|
+
grid-template-rows: auto 1fr auto;
|
|
159
|
+
|
|
160
|
+
border-radius: var(--dialog-border-radius);
|
|
161
|
+
border: var(--dialog-border);
|
|
162
|
+
outline: var(--dialog-outline);
|
|
163
|
+
|
|
164
|
+
background-color: var(--dialog-inner-background);
|
|
165
|
+
height: var(--_dialog-inner-height);
|
|
166
|
+
width: var(--_dialog-inner-width);
|
|
167
|
+
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
|
|
170
|
+
.header {
|
|
171
|
+
display: grid;
|
|
172
|
+
grid-template-columns: auto 1fr auto;
|
|
173
|
+
align-items: center;
|
|
174
|
+
|
|
175
|
+
padding: var(--dialog-header-padding);
|
|
145
176
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
177
|
+
.col-left {
|
|
178
|
+
/* grid-column: 1; */
|
|
179
|
+
/* display: none; */
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.col-center {
|
|
183
|
+
/* grid-column: 2; */
|
|
184
|
+
text-align: center;
|
|
185
|
+
|
|
186
|
+
color: var(--color-red-1);
|
|
187
|
+
display: none;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.col-right {
|
|
191
|
+
grid-column: 3;
|
|
192
|
+
|
|
193
|
+
.display-prompt-action {
|
|
194
|
+
background-color: transparent;
|
|
195
|
+
display: block flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
justify-content: center;
|
|
198
|
+
margin: var(--dialog-header-button-margin);
|
|
199
|
+
padding: var(--dialog-header-button-padding);
|
|
200
|
+
border: var(--dialog-header-button-border);
|
|
201
|
+
border-radius: var(--dialog-header-button-border-radius);
|
|
202
|
+
outline: var(--dialog-header-button-outline);
|
|
203
|
+
|
|
204
|
+
transition: border-color 0.2s, outline-color 0.2s;
|
|
205
|
+
|
|
206
|
+
&:hover,
|
|
207
|
+
&:focus-visible {
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
border: var(--dialog-header-button-border-hover);
|
|
210
|
+
outline: var(--dialog-header-button-outline-hover);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.icon {
|
|
214
|
+
color: var(--dialog-header-button-icon-color);
|
|
215
|
+
display: block;
|
|
216
|
+
font-size: var(--dialog-header-button-icon-font-size);
|
|
217
|
+
border: 1px solid green;
|
|
218
|
+
padding: 1rem;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
149
222
|
}
|
|
150
223
|
|
|
151
|
-
.
|
|
152
|
-
|
|
153
|
-
|
|
224
|
+
.dialog-content {
|
|
225
|
+
overflow: hidden;
|
|
226
|
+
padding: var(--dialog-content-padding);
|
|
154
227
|
|
|
155
|
-
|
|
156
|
-
|
|
228
|
+
&.allow-content-scroll {
|
|
229
|
+
overflow-y: auto;
|
|
230
|
+
&::-webkit-scrollbar {
|
|
231
|
+
display: none;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
157
234
|
}
|
|
158
235
|
|
|
159
|
-
.
|
|
160
|
-
|
|
236
|
+
.footer {
|
|
237
|
+
display: flex;
|
|
238
|
+
gap: 1.2rem;
|
|
239
|
+
justify-content: flex-end;
|
|
240
|
+
padding: var(--dialog-footer-padding);
|
|
161
241
|
}
|
|
162
242
|
}
|
|
163
|
-
|
|
164
|
-
/* .button-row {
|
|
165
|
-
display: flex;
|
|
166
|
-
gap: 1.2rem;
|
|
167
|
-
justify-content: flex-end;
|
|
168
|
-
} */
|
|
169
243
|
}
|
|
170
244
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<DisplayDialogCore :styleClassPassthrough :lockViewport="true">
|
|
2
|
+
<DisplayDialogCore variant="confirm" :styleClassPassthrough :lockViewport="true" :dataDialogId>
|
|
3
3
|
<template #dialogTitle>
|
|
4
4
|
<slot name="dialogTitle">
|
|
5
5
|
<p class="text-normal wght-700">Confirm</p>
|
|
@@ -21,20 +21,24 @@ const props = defineProps({
|
|
|
21
21
|
type: Array as PropType<string[]>,
|
|
22
22
|
default: () => [],
|
|
23
23
|
},
|
|
24
|
+
dataDialogId: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
24
28
|
});
|
|
25
29
|
</script>
|
|
26
30
|
|
|
27
31
|
<style lang="css">
|
|
28
|
-
.display-dialog {
|
|
29
|
-
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
.display-dialog-core {
|
|
33
|
+
.inner {
|
|
34
|
+
.header {
|
|
35
|
+
/* background-color: aquamarine; */
|
|
36
|
+
}
|
|
37
|
+
.dialog-content {
|
|
38
|
+
/* background-color: bisque; */
|
|
39
|
+
}
|
|
40
|
+
.footer {
|
|
41
|
+
/* background-color: blueviolet; */
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DisplayDialogCore variant="dialog" :styleClassPassthrough :lockViewport="true" :allowContentScroll :dataDialogId>
|
|
3
|
+
<template #dialogTitle>
|
|
4
|
+
<slot name="dialogTitle">
|
|
5
|
+
<p class="text-normal wght-700">Confirm</p>
|
|
6
|
+
</slot>
|
|
7
|
+
</template>
|
|
8
|
+
<template #dialogContent>
|
|
9
|
+
<slot name="dialogContent"></slot>
|
|
10
|
+
</template>
|
|
11
|
+
<template #actionButtons>
|
|
12
|
+
<slot name="actionButtonLeft"></slot>
|
|
13
|
+
<slot name="actionButtonRight"></slot>
|
|
14
|
+
</template>
|
|
15
|
+
</DisplayDialogCore>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
styleClassPassthrough: {
|
|
21
|
+
type: Array as PropType<string[]>,
|
|
22
|
+
default: () => [],
|
|
23
|
+
},
|
|
24
|
+
allowContentScroll: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false,
|
|
27
|
+
},
|
|
28
|
+
dataDialogId: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style lang="css">
|
|
36
|
+
.display-dialog-core {
|
|
37
|
+
.inner {
|
|
38
|
+
.header {
|
|
39
|
+
/* background-color: aquamarine; */
|
|
40
|
+
}
|
|
41
|
+
.dialog-content {
|
|
42
|
+
/* background-color: bisque; */
|
|
43
|
+
}
|
|
44
|
+
.footer {
|
|
45
|
+
/* background-color: blueviolet; */
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const useDialogControls = () => {
|
|
2
|
+
interface DialogConfig {
|
|
3
|
+
[key: string]: boolean;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const dialogsConfig = reactive<DialogConfig>({});
|
|
7
|
+
|
|
8
|
+
function initialiseDialogs(dialogIds: string[]) {
|
|
9
|
+
dialogIds.forEach((id) => {
|
|
10
|
+
dialogsConfig[id] = false;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const controlDialogs = (name: string, state: boolean) => {
|
|
15
|
+
dialogsConfig[name] = state;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
dialogsConfig,
|
|
20
|
+
controlDialogs,
|
|
21
|
+
initialiseDialogs,
|
|
22
|
+
};
|
|
23
|
+
};
|
package/package.json
CHANGED