@citizenplane/pimp 18.0.0 → 18.0.1
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
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<primevue-drawer
|
|
15
15
|
v-if="isDrawer"
|
|
16
16
|
v-model:visible="isOpen"
|
|
17
|
+
:auto-z-index="false"
|
|
17
18
|
block-scroll
|
|
18
19
|
close-on-escape
|
|
19
20
|
dismissable
|
|
@@ -30,11 +31,11 @@
|
|
|
30
31
|
aria-label="Close drawer"
|
|
31
32
|
color="neutral"
|
|
32
33
|
is-square
|
|
33
|
-
size="
|
|
34
|
+
size="md"
|
|
34
35
|
@click="hide"
|
|
35
36
|
>
|
|
36
37
|
<template #leading-icon>
|
|
37
|
-
<cp-icon
|
|
38
|
+
<cp-icon type="x" />
|
|
38
39
|
</template>
|
|
39
40
|
</cp-button>
|
|
40
41
|
</div>
|
|
@@ -73,12 +74,14 @@ import { getKeyboardFocusableElements } from '@/helpers/dom'
|
|
|
73
74
|
export interface Props {
|
|
74
75
|
class?: string
|
|
75
76
|
forcePopover?: boolean
|
|
77
|
+
fullHeightDrawer?: boolean
|
|
76
78
|
items?: MenuItem[]
|
|
77
79
|
keepOpenOnClick?: boolean
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
const props = withDefaults(defineProps<Props>(), {
|
|
81
83
|
class: undefined,
|
|
84
|
+
fullHeightDrawer: false,
|
|
82
85
|
items: undefined,
|
|
83
86
|
keepOpenOnClick: false,
|
|
84
87
|
})
|
|
@@ -110,7 +113,7 @@ const popoverPt = {
|
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
const drawerPt = {
|
|
113
|
-
root: { class: 'cpMenu__drawer' },
|
|
116
|
+
root: { class: ['cpMenu__drawer', { 'cpMenu__drawer--fullHeight': props.fullHeightDrawer }] },
|
|
114
117
|
content: { class: 'cpMenu__drawerContent' },
|
|
115
118
|
mask: { class: 'cpMenu__drawerMask' },
|
|
116
119
|
header: { class: 'cpMenu__drawerHeader' },
|
|
@@ -164,7 +167,6 @@ defineExpose({ show, hide, toggle })
|
|
|
164
167
|
|
|
165
168
|
&__overlay {
|
|
166
169
|
position: absolute;
|
|
167
|
-
z-index: 22;
|
|
168
170
|
margin-top: var(--cp-spacing-lg);
|
|
169
171
|
min-width: calc(var(--cp-dimensions-1) * 62.5);
|
|
170
172
|
border-radius: var(--cp-radius-md);
|
|
@@ -181,7 +183,7 @@ defineExpose({ show, hide, toggle })
|
|
|
181
183
|
&__drawerMask {
|
|
182
184
|
position: fixed;
|
|
183
185
|
inset: 0;
|
|
184
|
-
z-index:
|
|
186
|
+
z-index: 2;
|
|
185
187
|
display: flex;
|
|
186
188
|
align-items: flex-end;
|
|
187
189
|
justify-content: center;
|
|
@@ -190,7 +192,6 @@ defineExpose({ show, hide, toggle })
|
|
|
190
192
|
|
|
191
193
|
&__drawer {
|
|
192
194
|
position: relative;
|
|
193
|
-
z-index: 22;
|
|
194
195
|
width: 100%;
|
|
195
196
|
max-height: 85vh;
|
|
196
197
|
display: flex;
|
|
@@ -201,6 +202,12 @@ defineExpose({ show, hide, toggle })
|
|
|
201
202
|
padding-bottom: env(safe-area-inset-bottom);
|
|
202
203
|
}
|
|
203
204
|
|
|
205
|
+
&__drawer--fullHeight {
|
|
206
|
+
height: 100%;
|
|
207
|
+
max-height: 100%;
|
|
208
|
+
border-radius: 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
204
211
|
&__drawerHeader {
|
|
205
212
|
display: none;
|
|
206
213
|
}
|
|
@@ -214,7 +221,7 @@ defineExpose({ show, hide, toggle })
|
|
|
214
221
|
&__drawerToolbar {
|
|
215
222
|
display: flex;
|
|
216
223
|
justify-content: flex-end;
|
|
217
|
-
padding: var(--cp-spacing-
|
|
224
|
+
padding: var(--cp-spacing-md) var(--cp-spacing-xl);
|
|
218
225
|
}
|
|
219
226
|
}
|
|
220
227
|
|
|
@@ -30,6 +30,11 @@ const meta = {
|
|
|
30
30
|
description: 'Disable the bottom-drawer behavior on mobile and keep the popover anchored to the trigger.',
|
|
31
31
|
table: { defaultValue: { summary: 'false' } },
|
|
32
32
|
},
|
|
33
|
+
fullHeightDrawer: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'When enabled, the mobile drawer takes the full available height.',
|
|
36
|
+
table: { defaultValue: { summary: 'false' } },
|
|
37
|
+
},
|
|
33
38
|
keepOpenOnClick: {
|
|
34
39
|
control: 'boolean',
|
|
35
40
|
description: 'Keep the menu open when clicking an item.',
|
|
@@ -122,6 +127,37 @@ export const ForcePopoverOnMobile: Story = {
|
|
|
122
127
|
}),
|
|
123
128
|
}
|
|
124
129
|
|
|
130
|
+
/**
|
|
131
|
+
* In mobile viewports, enable `fullHeightDrawer` to make the bottom drawer
|
|
132
|
+
* fill all available height.
|
|
133
|
+
*/
|
|
134
|
+
export const FullHeightDrawer: Story = {
|
|
135
|
+
args: {
|
|
136
|
+
fullHeightDrawer: true,
|
|
137
|
+
},
|
|
138
|
+
render: (args) => ({
|
|
139
|
+
components: { CpButton, CpMenu },
|
|
140
|
+
setup() {
|
|
141
|
+
const items = [
|
|
142
|
+
{ label: 'Edit', leadingIcon: 'edit', command: () => alert('Edit clicked') },
|
|
143
|
+
{ label: 'Duplicate', leadingIcon: 'copy', command: () => alert('Duplicate clicked') },
|
|
144
|
+
{ label: 'Move', leadingIcon: 'arrow-right-left', command: () => alert('Move clicked') },
|
|
145
|
+
{ label: 'Archive', leadingIcon: 'archive', command: () => alert('Archive clicked') },
|
|
146
|
+
{ separator: true },
|
|
147
|
+
{ label: 'Delete', leadingIcon: 'trash-2', isCritical: true, command: () => alert('Delete clicked') },
|
|
148
|
+
]
|
|
149
|
+
return { args, items }
|
|
150
|
+
},
|
|
151
|
+
template: `
|
|
152
|
+
<CpMenu v-bind="args" :items="items">
|
|
153
|
+
<template #trigger>
|
|
154
|
+
<CpButton>Open full-height drawer</CpButton>
|
|
155
|
+
</template>
|
|
156
|
+
</CpMenu>
|
|
157
|
+
`,
|
|
158
|
+
}),
|
|
159
|
+
}
|
|
160
|
+
|
|
125
161
|
/**
|
|
126
162
|
* Use the default slot to render arbitrary content inside the popover —
|
|
127
163
|
* useful for forms, share panels, filters, etc.
|