@citizenplane/pimp 11.0.1 → 11.0.3
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/pimp.es.js +2829 -2818
- package/dist/pimp.umd.js +44 -44
- package/dist/style.css +1 -1
- package/package.json +7 -14
- package/src/components/CpDialog.vue +23 -8
- package/src/stories/CpDialog.stories.ts +24 -2
- package/commitlint.config.js +0 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citizenplane/pimp",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "storybook dev -p 8080",
|
|
6
6
|
"build-storybook": "storybook build --output-dir ./docs",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"format": "prettier . --write",
|
|
13
13
|
"test": "jest tests",
|
|
14
14
|
"commitlint": "commitlint --edit",
|
|
15
|
-
"commit": "cz",
|
|
16
15
|
"prepare": "husky"
|
|
17
16
|
},
|
|
18
17
|
"type": "module",
|
|
@@ -46,8 +45,7 @@
|
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
47
|
"@babel/core": "^7.28.6",
|
|
49
|
-
"@commitlint/cli": "
|
|
50
|
-
"@commitlint/config-conventional": "^20.3.1",
|
|
48
|
+
"@commitlint/cli": "20.4.2",
|
|
51
49
|
"@eslint/eslintrc": "^3.3.3",
|
|
52
50
|
"@eslint/js": "^9.39.2",
|
|
53
51
|
"@storybook/addon-onboarding": "^9.1.17",
|
|
@@ -67,8 +65,7 @@
|
|
|
67
65
|
"@vue/test-utils": "^2.4.6",
|
|
68
66
|
"@vue/vue3-jest": "^29.2.6",
|
|
69
67
|
"babel-core": "^7.0.0-bridge.0",
|
|
70
|
-
"
|
|
71
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
68
|
+
"commitlint-config-gitmoji": "2.3.1",
|
|
72
69
|
"eslint": "^9.39.2",
|
|
73
70
|
"eslint-config-prettier": "^10.1.8",
|
|
74
71
|
"eslint-plugin-perfectionist": "^5.4.0",
|
|
@@ -79,7 +76,7 @@
|
|
|
79
76
|
"husky": "^9.1.7",
|
|
80
77
|
"jest": "~29.7.0",
|
|
81
78
|
"jest-environment-jsdom": "^30.2.0",
|
|
82
|
-
"lint-staged": "^16.
|
|
79
|
+
"lint-staged": "^16.3.1",
|
|
83
80
|
"playwright": "^1.58.0",
|
|
84
81
|
"prettier": "^3.6.2",
|
|
85
82
|
"sass": "~1.97.3",
|
|
@@ -95,12 +92,8 @@
|
|
|
95
92
|
"plugin:storybook/recommended"
|
|
96
93
|
]
|
|
97
94
|
},
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
"disableScopeLowerCase": true,
|
|
102
|
-
"disableSubjectLowerCase": true,
|
|
103
|
-
"defaultScope": "pimp"
|
|
104
|
-
}
|
|
95
|
+
"engines": {
|
|
96
|
+
"npm": "11",
|
|
97
|
+
"node": "24"
|
|
105
98
|
}
|
|
106
99
|
}
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<div aria-hidden="true" class="cpDialog__overlay" />
|
|
12
12
|
<main ref="dialogContainer" class="cpDialog__container" :style="dynamicStyle" @keydown.tab="trapFocus">
|
|
13
13
|
<header class="cpDialog__header">
|
|
14
|
-
<div class="
|
|
15
|
-
<div class="cpDialog__title">
|
|
14
|
+
<div v-if="hasTitleOrSubtitle" class="cpDialog__headerTexts">
|
|
15
|
+
<div v-if="hasTitle" class="cpDialog__title">
|
|
16
16
|
<slot name="title">
|
|
17
17
|
<h2 :id="titleId">{{ title }}</h2>
|
|
18
18
|
</slot>
|
|
@@ -46,7 +46,7 @@ import { getKeyboardFocusableElements, handleTrapFocus } from '@/helpers/dom'
|
|
|
46
46
|
interface Props {
|
|
47
47
|
maxWidth?: number
|
|
48
48
|
subtitle?: string
|
|
49
|
-
title
|
|
49
|
+
title?: string
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
interface Emits {
|
|
@@ -55,6 +55,7 @@ interface Emits {
|
|
|
55
55
|
|
|
56
56
|
const props = withDefaults(defineProps<Props>(), {
|
|
57
57
|
maxWidth: 600,
|
|
58
|
+
title: '',
|
|
58
59
|
subtitle: '',
|
|
59
60
|
})
|
|
60
61
|
|
|
@@ -73,8 +74,12 @@ const dialogContainer = ref<HTMLElement | null>(null)
|
|
|
73
74
|
|
|
74
75
|
const dynamicStyle = computed(() => ({ maxWidth: `${props.maxWidth}px` }))
|
|
75
76
|
|
|
77
|
+
const hasTitleSlot = computed(() => !!slots.title)
|
|
78
|
+
const hasTitle = computed(() => !!props.title || hasTitleSlot.value)
|
|
76
79
|
const hasSubtitleSlot = computed(() => !!slots.subtitle)
|
|
77
80
|
const hasSubtitle = computed(() => !!props.subtitle || hasSubtitleSlot.value)
|
|
81
|
+
const hasTitleOrSubtitle = computed(() => hasTitle.value || hasSubtitle.value)
|
|
82
|
+
|
|
78
83
|
const hasFooterSlot = computed(() => !!slots.footer)
|
|
79
84
|
|
|
80
85
|
const handleClose = () => emit('close')
|
|
@@ -96,9 +101,7 @@ onMounted(() => {
|
|
|
96
101
|
nextTick(() => focusOnFirstFocusableElement())
|
|
97
102
|
})
|
|
98
103
|
|
|
99
|
-
onBeforeUnmount(() =>
|
|
100
|
-
closeDialog()
|
|
101
|
-
})
|
|
104
|
+
onBeforeUnmount(() => closeDialog())
|
|
102
105
|
</script>
|
|
103
106
|
|
|
104
107
|
<style lang="scss">
|
|
@@ -184,10 +187,17 @@ $dialog-breakpoint: 550px;
|
|
|
184
187
|
align-items: flex-start;
|
|
185
188
|
justify-content: space-between;
|
|
186
189
|
gap: var(--cp-spacing-md);
|
|
187
|
-
|
|
190
|
+
|
|
191
|
+
&:not(:has(.cpDialog__headerTexts)) {
|
|
192
|
+
padding-bottom: 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&:has(.cpDialog__headerTexts) {
|
|
196
|
+
border-bottom: 1px solid var(--cp-border-soft);
|
|
197
|
+
}
|
|
188
198
|
}
|
|
189
199
|
|
|
190
|
-
&
|
|
200
|
+
&__headerText {
|
|
191
201
|
display: flex;
|
|
192
202
|
flex-direction: column;
|
|
193
203
|
min-width: 0;
|
|
@@ -214,6 +224,7 @@ $dialog-breakpoint: 550px;
|
|
|
214
224
|
|
|
215
225
|
&__close {
|
|
216
226
|
display: flex;
|
|
227
|
+
margin-left: auto;
|
|
217
228
|
align-items: center;
|
|
218
229
|
justify-content: center;
|
|
219
230
|
padding: var(--cp-spacing-sm);
|
|
@@ -245,6 +256,10 @@ $dialog-breakpoint: 550px;
|
|
|
245
256
|
align-items: center;
|
|
246
257
|
justify-content: space-between;
|
|
247
258
|
|
|
259
|
+
&:empty {
|
|
260
|
+
display: none;
|
|
261
|
+
}
|
|
262
|
+
|
|
248
263
|
&:not(:empty) {
|
|
249
264
|
border-top: 1px solid var(--cp-border-soft);
|
|
250
265
|
}
|
|
@@ -51,6 +51,7 @@ export const TitleSubtitleWithProps: Story = {
|
|
|
51
51
|
args: {
|
|
52
52
|
maxWidth: 600,
|
|
53
53
|
title: 'Dialog title',
|
|
54
|
+
subtitle: 'Dialog subtitle',
|
|
54
55
|
},
|
|
55
56
|
render: (args) => ({
|
|
56
57
|
setup() {
|
|
@@ -72,11 +73,32 @@ export const TitleSubtitleWithProps: Story = {
|
|
|
72
73
|
}),
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
export const ContentOnly: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
maxWidth: 600,
|
|
79
|
+
},
|
|
80
|
+
render: (args) => ({
|
|
81
|
+
setup() {
|
|
82
|
+
const isOpen = ref(false)
|
|
83
|
+
return { args, isOpen }
|
|
84
|
+
},
|
|
85
|
+
template: `
|
|
86
|
+
<CpButton @click="isOpen = true">Open Dialog (content only)</CpButton>
|
|
87
|
+
<CpTransitionDialog>
|
|
88
|
+
<CpDialog v-bind="args" v-if="isOpen" @close="isOpen = false">
|
|
89
|
+
<p>This is the default slot content with no title or subtitle.</p>
|
|
90
|
+
<template #footer>
|
|
91
|
+
<CpButton @click="isOpen = false">Close</CpButton>
|
|
92
|
+
</template>
|
|
93
|
+
</CpDialog>
|
|
94
|
+
</CpTransitionDialog>
|
|
95
|
+
`,
|
|
96
|
+
}),
|
|
97
|
+
}
|
|
98
|
+
|
|
75
99
|
export const TitleSubtitleWithSlots: Story = {
|
|
76
100
|
args: {
|
|
77
101
|
maxWidth: 560,
|
|
78
|
-
titleTag: 'div',
|
|
79
|
-
subtitleTag: 'div',
|
|
80
102
|
},
|
|
81
103
|
render: (args) => ({
|
|
82
104
|
setup() {
|
package/commitlint.config.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
extends: ['@commitlint/config-conventional'],
|
|
3
|
-
rules: {
|
|
4
|
-
// Limit subject length to 84 characters as requested
|
|
5
|
-
'subject-max-length': [1, 'always', 84],
|
|
6
|
-
// Ensure subject is in lowercase
|
|
7
|
-
'subject-case': [0, 'always', 'lower-case'],
|
|
8
|
-
// Allowed types according to conventional commits
|
|
9
|
-
'type-enum': [
|
|
10
|
-
2,
|
|
11
|
-
'always',
|
|
12
|
-
[
|
|
13
|
-
'feat', // new feature
|
|
14
|
-
'fix', // bug fix
|
|
15
|
-
'docs', // documentation
|
|
16
|
-
'style', // formatting, missing semicolons, etc.
|
|
17
|
-
'refactor', // code refactoring
|
|
18
|
-
'perf', // performance improvements
|
|
19
|
-
'test', // adding tests
|
|
20
|
-
'chore', // maintenance tasks
|
|
21
|
-
'ci', // continuous integration
|
|
22
|
-
'build', // build system
|
|
23
|
-
'revert', // revert commit
|
|
24
|
-
],
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
}
|