@fiscozen/dialog 0.1.19 → 0.1.20
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 +3 -3
- package/src/FzDialog.vue +24 -71
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiscozen/dialog",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Design System Dialog component",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"peerDependencies": {
|
|
10
10
|
"tailwindcss": "^3.4.1",
|
|
11
11
|
"vue": "^3.4.13",
|
|
12
|
+
"@fiscozen/style": "^0.1.1",
|
|
12
13
|
"@fiscozen/composables": "^0.1.29",
|
|
13
|
-
"@fiscozen/button": "^0.1.7"
|
|
14
|
-
"@fiscozen/style": "^0.1.1"
|
|
14
|
+
"@fiscozen/button": "^0.1.7"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
package/src/FzDialog.vue
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
v-if="shouldRender || shouldAlwaysRender"
|
|
4
4
|
ref="backdrop"
|
|
5
5
|
v-show="visible"
|
|
6
|
-
class="fz-dialog__backdrop w-screen h-screen fixed flex flex-col items-center justify-start sm:justify-center z-30"
|
|
6
|
+
class="fz-dialog__backdrop w-screen h-screen fixed flex flex-col items-center justify-start sm:justify-center z-30"
|
|
7
|
+
>
|
|
7
8
|
<dialog
|
|
8
9
|
ref="dialog"
|
|
9
10
|
@close="handleModalClose"
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
>
|
|
16
17
|
<slot name="header"></slot>
|
|
17
18
|
</div>
|
|
18
|
-
<div :class="['grow
|
|
19
|
+
<div :class="['grow p-12', bodyClasses]">
|
|
19
20
|
<slot name="body"></slot>
|
|
20
21
|
</div>
|
|
21
22
|
<div
|
|
@@ -34,12 +35,12 @@ import { computed, ref, watch } from "vue";
|
|
|
34
35
|
import { FzDialogProps } from "./types";
|
|
35
36
|
import { useKeyUp } from "@fiscozen/composables";
|
|
36
37
|
import { useClickOutside } from "@fiscozen/composables";
|
|
37
|
-
import dialogPolyfill from
|
|
38
|
-
import
|
|
38
|
+
import dialogPolyfill from "dialog-polyfill";
|
|
39
|
+
import "dialog-polyfill/dist/dialog-polyfill.css";
|
|
39
40
|
|
|
40
41
|
const props = withDefaults(defineProps<FzDialogProps>(), {
|
|
41
42
|
size: "md",
|
|
42
|
-
closeOnBackdrop: true
|
|
43
|
+
closeOnBackdrop: true,
|
|
43
44
|
});
|
|
44
45
|
const emit = defineEmits(["fzmodal:cancel"]);
|
|
45
46
|
|
|
@@ -56,7 +57,7 @@ const showModal = () => {
|
|
|
56
57
|
setTimeout(() => {
|
|
57
58
|
backdropClickTimeout = false;
|
|
58
59
|
}, 100);
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
if (props.shouldAlwaysRender) {
|
|
61
62
|
dialogPolyfill.registerDialog(dialog.value!);
|
|
62
63
|
dialog.value!.show();
|
|
@@ -111,95 +112,43 @@ const handleKeyUp = (e: KeyboardEvent) => {
|
|
|
111
112
|
|
|
112
113
|
useKeyUp(handleKeyUp);
|
|
113
114
|
|
|
114
|
-
const staticClasses = "flex flex-col bg-core-white";
|
|
115
|
+
const staticClasses = "flex flex-col bg-core-white h-dvh max-h-dvh-fallback";
|
|
115
116
|
const dialogStaticClasses = "border-1 rounded border-grey-100 p-0";
|
|
116
117
|
|
|
117
118
|
const dialogClasses = computed(() => {
|
|
118
|
-
let res: string[] = [];
|
|
119
119
|
if (props.isDrawer) {
|
|
120
|
-
|
|
121
|
-
return res;
|
|
120
|
+
return "m-0 fixed top-0 ml-auto max-h-screen";
|
|
122
121
|
}
|
|
122
|
+
|
|
123
123
|
switch (props.size) {
|
|
124
|
-
case "sm":
|
|
125
|
-
res = [];
|
|
126
|
-
break;
|
|
127
124
|
case "md":
|
|
128
|
-
|
|
129
|
-
"xs:max-sm:m-0",
|
|
130
|
-
"xs:max-sm:max-h-screen",
|
|
131
|
-
"xs:max-sm:h-dvh",
|
|
132
|
-
"xs:max-sm:w-dvw",
|
|
133
|
-
"xs:max-sm:max-w-screen-xl",
|
|
134
|
-
];
|
|
135
|
-
break;
|
|
125
|
+
return "xs:max-sm:m-0 xs:max-sm:max-h-screen xs:max-sm:h-dvh xs:max-sm:w-dvw xs:max-sm:max-w-screen-xl";
|
|
136
126
|
case "lg":
|
|
137
|
-
|
|
138
|
-
"xs:max-md:m-0",
|
|
139
|
-
"xs:max-md:max-h-screen",
|
|
140
|
-
"xs:max-md:h-dvh",
|
|
141
|
-
"xs:max-md:w-dvw",
|
|
142
|
-
"xs:max-md:max-w-screen-xl",
|
|
143
|
-
];
|
|
144
|
-
break;
|
|
127
|
+
return "xs:max-md:m-0 xs:max-md:max-h-screen xs:max-md:h-dvh xs:max-md:w-dvw xs:max-md:max-w-screen-xl";
|
|
145
128
|
case "xl":
|
|
146
|
-
|
|
147
|
-
"xs:max-xl:m-0",
|
|
148
|
-
"xs:max-xl:max-h-screen",
|
|
149
|
-
"xs:max-xl:h-dvh",
|
|
150
|
-
"xs:max-xl:w-dvw",
|
|
151
|
-
"xs:max-xl:max-w-screen-xl",
|
|
152
|
-
];
|
|
153
|
-
break;
|
|
154
|
-
default:
|
|
155
|
-
res = [];
|
|
156
|
-
break;
|
|
129
|
+
return "xs:max-xl:m-0 xs:max-xl:max-h-screen xs:max-xl:h-dvh xs:max-xl:w-dvw xs:max-xl:max-w-screen-xl";
|
|
157
130
|
}
|
|
158
|
-
return res;
|
|
159
131
|
});
|
|
160
132
|
|
|
161
133
|
const classes = computed(() => {
|
|
162
|
-
let res: string[] = [];
|
|
163
134
|
if (props.isDrawer) {
|
|
164
|
-
|
|
165
|
-
return res;
|
|
135
|
+
return "w-[480px]";
|
|
166
136
|
}
|
|
137
|
+
|
|
167
138
|
switch (props.size) {
|
|
168
139
|
case "sm":
|
|
169
|
-
|
|
170
|
-
break;
|
|
140
|
+
return "w-[320px] min-h-[200px] max-h-[432px]";
|
|
171
141
|
case "md":
|
|
172
|
-
|
|
173
|
-
"w-dvw sm:w-[480px]",
|
|
174
|
-
"min-h-[300px]",
|
|
175
|
-
"sm:max-h-[600px]",
|
|
176
|
-
"h-dvh sm:h-auto",
|
|
177
|
-
];
|
|
178
|
-
break;
|
|
142
|
+
return "w-dvw sm:w-[480px] min-h-[300px] sm:max-h-[600px] sm:h-auto";
|
|
179
143
|
case "lg":
|
|
180
|
-
|
|
181
|
-
"w-dvw md:w-[640px]",
|
|
182
|
-
"min-h-[300px]",
|
|
183
|
-
"md:max-h-[600px]",
|
|
184
|
-
"h-dvh md:h-auto",
|
|
185
|
-
];
|
|
186
|
-
break;
|
|
144
|
+
return "w-dvw md:w-[640px] min-h-[300px] md:max-h-[600px] md:h-auto";
|
|
187
145
|
case "xl":
|
|
188
|
-
|
|
189
|
-
"w-dvw xl:w-[960px]",
|
|
190
|
-
"min-h-[400px]",
|
|
191
|
-
"xl:max-h-[600px]",
|
|
192
|
-
"h-dvh xl:h-auto",
|
|
193
|
-
];
|
|
194
|
-
break;
|
|
195
|
-
default:
|
|
196
|
-
break;
|
|
146
|
+
return "w-dvw xl:w-[960px] min-h-[400px] xl:max-h-[600px] xl:h-auto";
|
|
197
147
|
}
|
|
198
|
-
return res;
|
|
199
148
|
});
|
|
200
149
|
</script>
|
|
201
150
|
|
|
202
|
-
<style>
|
|
151
|
+
<style scoped>
|
|
203
152
|
dialog::backdrop {
|
|
204
153
|
background: var(--core-black, #2c282f);
|
|
205
154
|
opacity: 0.8;
|
|
@@ -209,4 +158,8 @@ dialog::backdrop {
|
|
|
209
158
|
top: 0;
|
|
210
159
|
left: 0;
|
|
211
160
|
}
|
|
161
|
+
.max-h-dvh-fallback {
|
|
162
|
+
max-height: calc(100vh - 48px); /** If dvh is supported, this gets overridden */
|
|
163
|
+
max-height: 100dvh;
|
|
164
|
+
}
|
|
212
165
|
</style>
|