@citizenplane/pimp 12.0.0 → 12.0.2
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 +3 -5
- package/dist/pimp.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/css/shadows.css +1 -1
- package/src/components/CpTabs.vue +12 -10
- package/src/stories/CpTabs.stories.ts +30 -0
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
--cp-drop-shadow-2xs-spread: -2px;
|
|
13
13
|
--cp-drop-shadow-2xs-inset-spread: -1px;
|
|
14
14
|
--cp-drop-shadow-xs-blur: 11px;
|
|
15
|
-
--cp-drop-shadow-xs-color: var(--cp-colors-grey-shadow-color-
|
|
15
|
+
--cp-drop-shadow-xs-color: var(--cp-colors-grey-shadow-color-7-5);
|
|
16
16
|
--cp-drop-shadow-xs-offset-x: 0;
|
|
17
17
|
--cp-drop-shadow-xs-offset-y: 5px;
|
|
18
18
|
--cp-drop-shadow-xs-spread: -2px;
|
|
@@ -47,7 +47,7 @@ const emit = defineEmits<EmitType>()
|
|
|
47
47
|
|
|
48
48
|
const cpTabsElement = ref<HTMLElement | null>(null)
|
|
49
49
|
const activeUnderline = ref<HTMLElement | null>(null)
|
|
50
|
-
const activeTabIndex = ref<number | null>(
|
|
50
|
+
const activeTabIndex = ref<number | null>(props.defaultActiveIndex)
|
|
51
51
|
|
|
52
52
|
const hasTabCount = (count?: number) => typeof count === 'number'
|
|
53
53
|
|
|
@@ -90,12 +90,8 @@ const setUnderlineStyle = () => {
|
|
|
90
90
|
|
|
91
91
|
if (!activeTabElement || !underlineElement || !containerElement) return
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const left = tabRect.left - containerRect.left + containerElement.scrollLeft
|
|
96
|
-
|
|
97
|
-
underlineElement.style.width = `${tabRect.width}px`
|
|
98
|
-
underlineElement.style.transform = `translate3d(${left}px, 0, 0)`
|
|
93
|
+
underlineElement.style.width = `${activeTabElement.offsetWidth}px`
|
|
94
|
+
underlineElement.style.transform = `translate3d(${activeTabElement.offsetLeft}px, 0, 0)`
|
|
99
95
|
}
|
|
100
96
|
|
|
101
97
|
const scrollToActiveElement = () => {
|
|
@@ -109,9 +105,6 @@ onBeforeUnmount(() => window.removeEventListener('resize', setUnderlineStyle))
|
|
|
109
105
|
|
|
110
106
|
onMounted(() => {
|
|
111
107
|
window.addEventListener('resize', setUnderlineStyle)
|
|
112
|
-
|
|
113
|
-
activeTabIndex.value = props.defaultActiveIndex
|
|
114
|
-
|
|
115
108
|
nextTick(setUnderlineStyle)
|
|
116
109
|
})
|
|
117
110
|
|
|
@@ -196,6 +189,15 @@ watch(
|
|
|
196
189
|
}
|
|
197
190
|
}
|
|
198
191
|
|
|
192
|
+
@include mx.media-query-min(769px) {
|
|
193
|
+
.cpTabs {
|
|
194
|
+
&__tab--isActive {
|
|
195
|
+
border-bottom-right-radius: 0;
|
|
196
|
+
border-bottom-left-radius: 0;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
199
201
|
@include mx.media-query-max(768px) {
|
|
200
202
|
.cpTabs {
|
|
201
203
|
margin-right: var(--cp-spacing-xl);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from 'storybook/actions'
|
|
2
|
+
import { ref } from 'vue'
|
|
2
3
|
|
|
3
4
|
import type { Args, Meta, StoryObj } from '@storybook/vue3'
|
|
4
5
|
|
|
@@ -81,3 +82,32 @@ export const WithIconsAndCounts: Story = {
|
|
|
81
82
|
},
|
|
82
83
|
render: defaultRender,
|
|
83
84
|
}
|
|
85
|
+
|
|
86
|
+
export const InDialog: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
...Default.args,
|
|
89
|
+
defaultActiveIndex: 1,
|
|
90
|
+
tabs: [
|
|
91
|
+
{ title: 'Notifications', icon: 'bell', count: 8 },
|
|
92
|
+
{ title: 'Messages', icon: 'user', count: 3 },
|
|
93
|
+
{ title: 'Tasks', icon: 'check', count: 15 },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
render: (args) => ({
|
|
97
|
+
components: { CpTabs },
|
|
98
|
+
setup() {
|
|
99
|
+
const isVisible = ref(false)
|
|
100
|
+
return { args, isVisible }
|
|
101
|
+
},
|
|
102
|
+
template: `
|
|
103
|
+
<cp-transition-dialog>
|
|
104
|
+
<cp-dialog v-if="isVisible" title="Tabs in dialog" @close="isVisible = false">
|
|
105
|
+
<CpTabs v-bind="args" @on-tab-click="args.onOnTabClick" v-if="isVisible" />
|
|
106
|
+
</cp-dialog>
|
|
107
|
+
</cp-transition-dialog>
|
|
108
|
+
<div style="display: flex; justify-content: center; align-items: center; min-height: 240px; min-width:240px;">
|
|
109
|
+
<cp-button @click="isVisible = !isVisible">Open dialog</cp-button>
|
|
110
|
+
</div>
|
|
111
|
+
`,
|
|
112
|
+
}),
|
|
113
|
+
}
|