@sabrenski/spire-ui 0.0.4 → 0.0.6
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/index.d.ts +6 -0
- package/dist/spire-ui.css +1 -1
- package/dist/spire-ui.es.js +694 -690
- package/dist/spire-ui.umd.js +9 -9
- package/package.json +1 -1
- package/src/components/Drawer/Drawer.vue +17 -6
package/package.json
CHANGED
|
@@ -30,6 +30,10 @@ export interface DrawerProps {
|
|
|
30
30
|
closeOnEscape?: boolean
|
|
31
31
|
/** Show close button in header */
|
|
32
32
|
showClose?: boolean
|
|
33
|
+
/** Force specified placement on mobile (disable bottom sheet behavior) */
|
|
34
|
+
forcePlacement?: boolean
|
|
35
|
+
/** Remove body padding for flush content */
|
|
36
|
+
flush?: boolean
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
const props = withDefaults(defineProps<DrawerProps>(), {
|
|
@@ -39,7 +43,9 @@ const props = withDefaults(defineProps<DrawerProps>(), {
|
|
|
39
43
|
size: 'md',
|
|
40
44
|
maskClosable: true,
|
|
41
45
|
closeOnEscape: true,
|
|
42
|
-
showClose: true
|
|
46
|
+
showClose: true,
|
|
47
|
+
forcePlacement: false,
|
|
48
|
+
flush: false
|
|
43
49
|
})
|
|
44
50
|
|
|
45
51
|
const emit = defineEmits<{
|
|
@@ -73,6 +79,7 @@ onUnmounted(() => {
|
|
|
73
79
|
})
|
|
74
80
|
|
|
75
81
|
const actualPlacement = computed(() => {
|
|
82
|
+
if (props.forcePlacement) return props.placement
|
|
76
83
|
return isMobile.value ? 'bottom' : props.placement
|
|
77
84
|
})
|
|
78
85
|
|
|
@@ -160,7 +167,7 @@ const drawerClasses = computed(() => [
|
|
|
160
167
|
`ui-drawer__panel--${actualPlacement.value}`,
|
|
161
168
|
`ui-drawer__panel--${props.variant}`,
|
|
162
169
|
`ui-drawer__panel--${props.size}`,
|
|
163
|
-
{ 'ui-drawer__panel--mobile': isMobile.value }
|
|
170
|
+
{ 'ui-drawer__panel--mobile': isMobile.value && !props.forcePlacement }
|
|
164
171
|
])
|
|
165
172
|
|
|
166
173
|
const transitionName = computed(() => {
|
|
@@ -177,7 +184,7 @@ defineExpose({
|
|
|
177
184
|
<Transition :name="transitionName">
|
|
178
185
|
<div
|
|
179
186
|
v-if="isOpen"
|
|
180
|
-
class="ui-drawer"
|
|
187
|
+
:class="['ui-drawer', { 'ui-drawer--force-placement': forcePlacement }]"
|
|
181
188
|
@keydown="handleKeydown"
|
|
182
189
|
>
|
|
183
190
|
<div
|
|
@@ -209,7 +216,7 @@ defineExpose({
|
|
|
209
216
|
</button>
|
|
210
217
|
</header>
|
|
211
218
|
|
|
212
|
-
<div class="ui-drawer__body">
|
|
219
|
+
<div :class="['ui-drawer__body', { 'ui-drawer__body--flush': flush }]">
|
|
213
220
|
<slot />
|
|
214
221
|
</div>
|
|
215
222
|
|
|
@@ -373,6 +380,10 @@ defineExpose({
|
|
|
373
380
|
padding: var(--space-6);
|
|
374
381
|
}
|
|
375
382
|
|
|
383
|
+
.ui-drawer__body--flush {
|
|
384
|
+
padding: 0;
|
|
385
|
+
}
|
|
386
|
+
|
|
376
387
|
/* Footer */
|
|
377
388
|
.ui-drawer__footer {
|
|
378
389
|
display: flex;
|
|
@@ -451,12 +462,12 @@ defineExpose({
|
|
|
451
462
|
|
|
452
463
|
/* Mobile adjustments */
|
|
453
464
|
@media (max-width: 639px) {
|
|
454
|
-
.ui-drawer {
|
|
465
|
+
.ui-drawer:not(.ui-drawer--force-placement) {
|
|
455
466
|
align-items: flex-end;
|
|
456
467
|
justify-content: stretch;
|
|
457
468
|
}
|
|
458
469
|
|
|
459
|
-
.ui-drawer__panel {
|
|
470
|
+
.ui-drawer:not(.ui-drawer--force-placement) .ui-drawer__panel {
|
|
460
471
|
width: 100% !important;
|
|
461
472
|
max-height: 90vh;
|
|
462
473
|
margin: 0;
|