@citizenplane/pimp 13.0.0 → 14.0.0
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 +4804 -4585
- package/dist/pimp.umd.js +44 -44
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpAccordion.vue +163 -0
- package/src/components/CpAccordionGroup.vue +51 -0
- package/src/components/CpBadge.vue +2 -2
- package/src/components/CpButton.vue +4 -3
- package/src/components/CpButtonGroup.vue +30 -2
- package/src/components/CpDate.vue +5 -4
- package/src/components/CpInput.vue +4 -4
- package/src/components/CpItemActions.vue +11 -9
- package/src/components/CpMultiselect.vue +3 -3
- package/src/components/CpPartnerBadge.vue +3 -2
- package/src/components/CpSelect.vue +5 -5
- package/src/components/CpTable.vue +2 -2
- package/src/components/CpTelInput.vue +4 -4
- package/src/components/CpTextarea.vue +3 -3
- package/src/components/CpTransitionCounter.vue +77 -0
- package/src/components/CpTransitionListItems.vue +41 -0
- package/src/components/CpTransitionSize.vue +88 -0
- package/src/components/CpTransitionSlide.vue +44 -0
- package/src/components/CpTransitionTabContent.vue +70 -0
- package/src/components/index.ts +16 -2
- package/src/constants/Sizes.ts +1 -11
- package/src/constants/index.ts +1 -1
- package/src/stories/BaseInputLabel.stories.ts +1 -1
- package/src/stories/CpAccordion.stories.ts +282 -0
- package/src/stories/CpAccordionGroup.stories.ts +223 -0
- package/src/stories/CpAirlineLogo.stories.ts +1 -1
- package/src/stories/CpAlert.stories.ts +1 -1
- package/src/stories/CpBadge.stories.ts +2 -4
- package/src/stories/CpButton.stories.ts +147 -146
- package/src/stories/CpCheckbox.stories.ts +1 -1
- package/src/stories/CpContextualMenu.stories.ts +1 -1
- package/src/stories/CpDate.stories.ts +1 -1
- package/src/stories/CpDatepicker.stories.ts +1 -1
- package/src/stories/CpDialog.stories.ts +1 -1
- package/src/stories/CpHeading.stories.ts +1 -1
- package/src/stories/CpIcon.stories.ts +1 -1
- package/src/stories/CpInput.stories.ts +2 -4
- package/src/stories/CpItemActions.stories.ts +1 -1
- package/src/stories/CpLoader.stories.ts +1 -1
- package/src/stories/CpMenuItem.stories.ts +1 -1
- package/src/stories/CpMultiselect.stories.ts +1 -1
- package/src/stories/CpPartnerBadge.stories.ts +3 -3
- package/src/stories/CpRadio.stories.ts +1 -1
- package/src/stories/CpSelect.stories.ts +4 -6
- package/src/stories/CpSelectMenu.stories.ts +1 -1
- package/src/stories/CpSelectableButton.stories.ts +4 -6
- package/src/stories/CpSwitch.stories.ts +1 -1
- package/src/stories/CpTable.stories.ts +1 -1
- package/src/stories/CpTableEmptyState.stories.ts +1 -1
- package/src/stories/CpTabs.stories.ts +1 -1
- package/src/stories/CpTelInput.stories.ts +1 -1
- package/src/stories/CpTextarea.stories.ts +1 -1
- package/src/stories/CpToast.stories.ts +1 -1
- package/src/stories/CpTooltip.stories.ts +1 -1
- package/src/stories/CpTransitionCounter.stories.ts +66 -0
- package/src/stories/{TransitionExpand.stories.ts → CpTransitionExpand.stories.ts} +11 -11
- package/src/stories/CpTransitionListItems.stories.ts +147 -0
- package/src/stories/CpTransitionSize.stories.ts +147 -0
- package/src/stories/CpTransitionSlide.stories.ts +65 -0
- package/src/stories/CpTransitionTabContent.stories.ts +78 -0
- package/src/stories/documentationStyles.ts +16 -0
- /package/src/components/{TransitionExpand.vue → CpTransitionExpand.vue} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition-group :name="dynamicTransitionName">
|
|
3
|
+
<slot />
|
|
4
|
+
</transition-group>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed, onMounted, ref } from 'vue'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
disableOnLoad?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), { disableOnLoad: false })
|
|
15
|
+
|
|
16
|
+
const isDisabled = ref<boolean>(props.disableOnLoad)
|
|
17
|
+
|
|
18
|
+
const dynamicTransitionName = computed<string>(() => (isDisabled.value ? '' : 'list-items'))
|
|
19
|
+
|
|
20
|
+
onMounted(() => (isDisabled.value = false))
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style lang="scss">
|
|
24
|
+
.list-items-move,
|
|
25
|
+
.list-items-enter-active,
|
|
26
|
+
.list-items-leave-active {
|
|
27
|
+
transition:
|
|
28
|
+
transform 400ms ease,
|
|
29
|
+
opacity 200ms ease;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.list-items-enter-from,
|
|
33
|
+
.list-items-leave-to {
|
|
34
|
+
opacity: 0;
|
|
35
|
+
transform: translate3d(fn.px-to-rem(30), 0, 0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.list-items-leave-active {
|
|
39
|
+
position: absolute;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="transitionId" ref="slotWrapper" class="cpTransitionSize" :class="componentDynamicClass">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed, ref, onMounted, onBeforeUnmount, useId, nextTick } from 'vue'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
type?: 'width' | 'height'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), { type: 'width' })
|
|
15
|
+
|
|
16
|
+
const slotWrapper = ref()
|
|
17
|
+
const slotContent = computed<HTMLElement | null>(() => slotWrapper.value?.children[0])
|
|
18
|
+
|
|
19
|
+
const isHeight = computed<boolean>(() => props.type === 'height')
|
|
20
|
+
|
|
21
|
+
const componentDynamicClass = computed(() => {
|
|
22
|
+
return { 'cpTransitionSize--isHeight': isHeight.value }
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const transitionId = useId()
|
|
26
|
+
|
|
27
|
+
const updateWrapperSize = async () => {
|
|
28
|
+
if (!slotContent.value) return
|
|
29
|
+
|
|
30
|
+
const size = slotContent.value[isHeight.value ? 'clientHeight' : 'clientWidth']
|
|
31
|
+
const property = isHeight.value ? 'min-height' : 'width'
|
|
32
|
+
|
|
33
|
+
slotWrapper.value.style[property] = `${size}px`
|
|
34
|
+
|
|
35
|
+
const transitionItem = document.getElementById(transitionId)
|
|
36
|
+
if (!transitionItem || !isHeight.value) return
|
|
37
|
+
|
|
38
|
+
slotWrapper.value.style.height = 0
|
|
39
|
+
|
|
40
|
+
await nextTick()
|
|
41
|
+
|
|
42
|
+
transitionItem.addEventListener(
|
|
43
|
+
'transitionend',
|
|
44
|
+
() => {
|
|
45
|
+
if (slotWrapper.value) {
|
|
46
|
+
slotWrapper.value.style.height = 'auto'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{ once: true },
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const observer = ref<MutationObserver>()
|
|
54
|
+
|
|
55
|
+
const initObserver = () => {
|
|
56
|
+
observer.value = new MutationObserver(updateWrapperSize)
|
|
57
|
+
observer.value.observe(slotContent.value as HTMLElement, { childList: true, subtree: false })
|
|
58
|
+
|
|
59
|
+
updateWrapperSize()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
if (slotContent.value) {
|
|
64
|
+
initObserver()
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
onBeforeUnmount(() => {
|
|
69
|
+
if (observer.value) observer.value.disconnect()
|
|
70
|
+
})
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<style lang="scss">
|
|
74
|
+
.cpTransitionSize {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
transition-duration: 350ms;
|
|
78
|
+
transition-property: width;
|
|
79
|
+
transition-timing-function: var(--cp-easing-elastic);
|
|
80
|
+
white-space: nowrap;
|
|
81
|
+
|
|
82
|
+
&--isHeight {
|
|
83
|
+
display: block;
|
|
84
|
+
transition-property: min-height;
|
|
85
|
+
transition-timing-function: ease;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition :mode="mode" :name="formattedTransitionName">
|
|
3
|
+
<slot />
|
|
4
|
+
</transition>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
mode?: 'in-out' | 'out-in' | 'default'
|
|
12
|
+
slideTo?: 'top' | 'left'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
16
|
+
slideTo: 'top',
|
|
17
|
+
mode: 'out-in',
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const formattedTransitionName = computed(() => `slide-${props.slideTo}`)
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style lang="scss">
|
|
24
|
+
.slide-top-enter-active,
|
|
25
|
+
.slide-top-leave-active,
|
|
26
|
+
.slide-left-enter-active,
|
|
27
|
+
.slide-left-leave-active {
|
|
28
|
+
transition:
|
|
29
|
+
transform 300ms ease,
|
|
30
|
+
opacity 300ms ease;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.slide-top-enter-from,
|
|
34
|
+
.slide-top-leave-to {
|
|
35
|
+
opacity: 0;
|
|
36
|
+
transform: scale3d(0.8, 0.8, 1) translate3d(0, fn.px-to-rem(10), 0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.slide-left-enter-from,
|
|
40
|
+
.slide-left-leave-to {
|
|
41
|
+
opacity: 0;
|
|
42
|
+
transform: scale3d(0.8, 0.8, 1) translate3d(fn.px-to-rem(10), 0, 0);
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition :duration="duration" mode="out-in" :name="formattedTransitionName" @after-enter="emit('onAfterEnter')">
|
|
3
|
+
<slot />
|
|
4
|
+
</transition>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
|
|
10
|
+
type Direction = 'forward' | 'backward'
|
|
11
|
+
|
|
12
|
+
type EmitType = {
|
|
13
|
+
(event: 'onAfterEnter'): void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
direction?: Direction
|
|
18
|
+
duration?: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
22
|
+
direction: 'forward',
|
|
23
|
+
duration: 300,
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits<EmitType>()
|
|
27
|
+
|
|
28
|
+
const formattedTransitionName = computed(() => `tab-content-${props.direction}`)
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style lang="scss">
|
|
32
|
+
.tab-content-backward,
|
|
33
|
+
.tab-content-forward {
|
|
34
|
+
&-enter-active,
|
|
35
|
+
&-leave-active {
|
|
36
|
+
transition:
|
|
37
|
+
transform 300ms ease,
|
|
38
|
+
opacity 300ms ease;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-enter-from,
|
|
42
|
+
&-leave-to {
|
|
43
|
+
opacity: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&-enter-to {
|
|
47
|
+
transform: translate3d(0, 0, 0);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.tab-content-forward {
|
|
52
|
+
&-enter-from {
|
|
53
|
+
transform: translate3d(10vw, 0, 0);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&-leave-to {
|
|
57
|
+
transform: translate3d(-10vw, 0, 0);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.tab-content-backward {
|
|
62
|
+
&-enter-from {
|
|
63
|
+
transform: translate3d(-10vw, 0, 0);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&-leave-to {
|
|
67
|
+
transform: translate3d(10vw, 0, 0);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
</style>
|
package/src/components/index.ts
CHANGED
|
@@ -14,6 +14,8 @@ import VueTelInput from 'vue-tel-input'
|
|
|
14
14
|
|
|
15
15
|
import ClickOutside from '../directives/ClickOutside'
|
|
16
16
|
import CpCoreDatepicker from '../libs/CoreDatepicker.vue'
|
|
17
|
+
import CpAccordion from './CpAccordion.vue'
|
|
18
|
+
import CpAccordionGroup from './CpAccordionGroup.vue'
|
|
17
19
|
import CpAirlineLogo from './CpAirlineLogo.vue'
|
|
18
20
|
import CpAlert from './CpAlert.vue'
|
|
19
21
|
import CpBadge from './CpBadge.vue'
|
|
@@ -45,7 +47,13 @@ import CpTelInput from './CpTelInput.vue'
|
|
|
45
47
|
import CpTextarea from './CpTextarea.vue'
|
|
46
48
|
import CpToast from './CpToast.vue'
|
|
47
49
|
import CpTooltip from './CpTooltip.vue'
|
|
50
|
+
import CpTransitionCounter from './CpTransitionCounter.vue'
|
|
48
51
|
import CpTransitionDialog from './CpTransitionDialog.vue'
|
|
52
|
+
import CpTransitionExpand from './CpTransitionExpand.vue'
|
|
53
|
+
import CpTransitionListItems from './CpTransitionListItems.vue'
|
|
54
|
+
import CpTransitionSize from './CpTransitionSize.vue'
|
|
55
|
+
import CpTransitionSlide from './CpTransitionSlide.vue'
|
|
56
|
+
import CpTransitionTabContent from './CpTransitionTabContent.vue'
|
|
49
57
|
import IconAirline from './icons/IconAirline.vue'
|
|
50
58
|
import IconCheckList from './icons/IconCheckList.vue'
|
|
51
59
|
import IconCollapse from './icons/IconCollapse.vue'
|
|
@@ -55,9 +63,10 @@ import IconOta from './icons/IconOta.vue'
|
|
|
55
63
|
import IconSupplier from './icons/IconSupplier.vue'
|
|
56
64
|
import IconThirdParty from './icons/IconThirdParty.vue'
|
|
57
65
|
import IconTooltip from './icons/IconTooltip.vue'
|
|
58
|
-
import TransitionExpand from './TransitionExpand.vue'
|
|
59
66
|
|
|
60
67
|
const Components = {
|
|
68
|
+
CpAccordion,
|
|
69
|
+
CpAccordionGroup,
|
|
61
70
|
CpToast,
|
|
62
71
|
CpBadge,
|
|
63
72
|
CpTabs,
|
|
@@ -100,7 +109,12 @@ const Components = {
|
|
|
100
109
|
IconExpand,
|
|
101
110
|
IconCheckList,
|
|
102
111
|
CpTransitionDialog,
|
|
103
|
-
|
|
112
|
+
CpTransitionExpand,
|
|
113
|
+
CpTransitionSize,
|
|
114
|
+
CpTransitionCounter,
|
|
115
|
+
CpTransitionListItems,
|
|
116
|
+
CpTransitionSlide,
|
|
117
|
+
CpTransitionTabContent,
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
const Pimp = {
|
package/src/constants/Sizes.ts
CHANGED
package/src/constants/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { Position } from './Position'
|
|
|
3
3
|
export type { ToggleColors } from './colors/ToggleColors'
|
|
4
4
|
export { HeadingLevels } from './Heading'
|
|
5
5
|
export { PAGINATION_FORMATS, RESERVED_KEYS, VISIBLE_ROWS_MAX } from './CpTableConfig'
|
|
6
|
-
export { Sizes } from './Sizes'
|
|
6
|
+
export type { Sizes } from './Sizes'
|
|
7
7
|
export { PartnerTypes } from './PartnerTypes'
|
|
8
8
|
|
|
9
9
|
export { CustomCpIcons } from './CpCustomIcons'
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
import type { Args, Meta, StoryObj } from '@storybook/vue3'
|
|
4
|
+
import type { MenuItem } from 'primevue/menuitem'
|
|
5
|
+
|
|
6
|
+
import type { CpAccordionBaseProps } from '@/components/CpAccordion.vue'
|
|
7
|
+
import CpAccordion from '@/components/CpAccordion.vue'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
docCellStyle,
|
|
11
|
+
docLabelStyle,
|
|
12
|
+
docPageStyle,
|
|
13
|
+
docRowColumnStyle,
|
|
14
|
+
docSectionStyle,
|
|
15
|
+
docTitleStyle,
|
|
16
|
+
} from '@/stories/documentationStyles'
|
|
17
|
+
|
|
18
|
+
/** Storybook controls: component props remain a discriminated union in `CpAccordion.vue`. */
|
|
19
|
+
type CpAccordionStoryArgs = CpAccordionBaseProps & {
|
|
20
|
+
actions?: MenuItem[]
|
|
21
|
+
hideActionTrigger?: boolean
|
|
22
|
+
iconPosition?: 'leading' | 'trailing'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const defaultStoryActions: MenuItem[] = [
|
|
26
|
+
{
|
|
27
|
+
icon: 'copy',
|
|
28
|
+
label: 'Duplicate',
|
|
29
|
+
command: () => {},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
icon: 'trash-2',
|
|
33
|
+
label: 'Delete',
|
|
34
|
+
command: () => {},
|
|
35
|
+
isCritical: true,
|
|
36
|
+
},
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
const meta = {
|
|
40
|
+
title: 'Navigation/CpAccordion',
|
|
41
|
+
component: CpAccordion,
|
|
42
|
+
argTypes: {
|
|
43
|
+
title: {
|
|
44
|
+
control: 'text',
|
|
45
|
+
description: 'Accordion header title',
|
|
46
|
+
},
|
|
47
|
+
defaultOpenState: {
|
|
48
|
+
control: 'boolean',
|
|
49
|
+
description: 'Initial open state when the accordion is rendered',
|
|
50
|
+
},
|
|
51
|
+
hideActionTrigger: {
|
|
52
|
+
control: 'boolean',
|
|
53
|
+
description: 'Whether to hide the action trigger',
|
|
54
|
+
},
|
|
55
|
+
iconPosition: {
|
|
56
|
+
control: 'select',
|
|
57
|
+
options: ['leading', 'trailing'],
|
|
58
|
+
description: 'Chevron icon position',
|
|
59
|
+
},
|
|
60
|
+
quickOptionsLimit: {
|
|
61
|
+
control: 'number',
|
|
62
|
+
description: 'Number of quick options to display',
|
|
63
|
+
},
|
|
64
|
+
actions: {
|
|
65
|
+
control: 'object',
|
|
66
|
+
description:
|
|
67
|
+
'MenuItem[] (leading only). Editing as JSON drops `command` functions; use Reset to restore working actions.',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
} as Meta<CpAccordionStoryArgs>
|
|
71
|
+
|
|
72
|
+
export default meta
|
|
73
|
+
type Story = StoryObj<typeof meta>
|
|
74
|
+
|
|
75
|
+
const sampleContentStyle =
|
|
76
|
+
'padding: 16px; font-size: 13px; color: #374151; background: repeating-linear-gradient(45deg, #fff9c4, #fff9c4 4px, #fffde7 4px, #fffde7 8px);'
|
|
77
|
+
const highlightedSlotStyle = 'background: #fff9c4;'
|
|
78
|
+
|
|
79
|
+
const defaultRender = (args: Args) => ({
|
|
80
|
+
components: { CpAccordion },
|
|
81
|
+
setup() {
|
|
82
|
+
const accordionArgs = computed(() => {
|
|
83
|
+
if (args.iconPosition === 'trailing') {
|
|
84
|
+
const a = args as CpAccordionStoryArgs & Args
|
|
85
|
+
return {
|
|
86
|
+
defaultOpenState: a.defaultOpenState,
|
|
87
|
+
iconPosition: 'trailing' as const,
|
|
88
|
+
quickOptionsLimit: a.quickOptionsLimit,
|
|
89
|
+
title: a.title,
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return args
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
return { accordionArgs, sampleContentStyle }
|
|
97
|
+
},
|
|
98
|
+
template: `
|
|
99
|
+
<div style="box-sizing: border-box; width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px; width: 500px;">
|
|
100
|
+
<CpAccordion v-bind="accordionArgs">
|
|
101
|
+
<div :style="sampleContentStyle" />
|
|
102
|
+
</CpAccordion>
|
|
103
|
+
</div>
|
|
104
|
+
`,
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
export const Documentation: Story = {
|
|
108
|
+
args: {
|
|
109
|
+
title: 'I have title.',
|
|
110
|
+
},
|
|
111
|
+
render: () => ({
|
|
112
|
+
components: { CpAccordion },
|
|
113
|
+
setup: () => ({
|
|
114
|
+
docPageStyle,
|
|
115
|
+
docSectionStyle,
|
|
116
|
+
docTitleStyle,
|
|
117
|
+
docRowColumnStyle,
|
|
118
|
+
docCellStyle,
|
|
119
|
+
docLabelStyle,
|
|
120
|
+
sampleContentStyle,
|
|
121
|
+
highlightedSlotStyle,
|
|
122
|
+
actions: defaultStoryActions,
|
|
123
|
+
}),
|
|
124
|
+
template: `
|
|
125
|
+
<div :style="docPageStyle">
|
|
126
|
+
<h1 style="margin: 0 0 24px 0; font-size: 28px; font-weight: 700; color: #111827;">CpAccordion</h1>
|
|
127
|
+
|
|
128
|
+
<section :style="docSectionStyle">
|
|
129
|
+
<h2 :style="docTitleStyle">Is Open</h2>
|
|
130
|
+
<div :style="docRowColumnStyle">
|
|
131
|
+
<div :style="docCellStyle">
|
|
132
|
+
<span :style="docLabelStyle">false</span>
|
|
133
|
+
<CpAccordion title="I have title." :default-open-state="false" icon-position="trailing">
|
|
134
|
+
<div :style="sampleContentStyle" />
|
|
135
|
+
</CpAccordion>
|
|
136
|
+
</div>
|
|
137
|
+
<div :style="docCellStyle">
|
|
138
|
+
<span :style="docLabelStyle">true</span>
|
|
139
|
+
<CpAccordion title="I have title." :default-open-state="true" icon-position="trailing">
|
|
140
|
+
<div :style="sampleContentStyle" />
|
|
141
|
+
</CpAccordion>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</section>
|
|
145
|
+
|
|
146
|
+
<h2 style="margin: 0 0 16px 0; font-size: 16px; font-weight: 600; color: #111827;">
|
|
147
|
+
Unpublished Base: <span style="font-weight: 700;">Accordion Header</span>
|
|
148
|
+
</h2>
|
|
149
|
+
|
|
150
|
+
<section :style="docSectionStyle">
|
|
151
|
+
<h2 :style="docTitleStyle">Style</h2>
|
|
152
|
+
<div :style="docRowColumnStyle">
|
|
153
|
+
<div :style="docCellStyle">
|
|
154
|
+
<span :style="docLabelStyle">Leading Chevron</span>
|
|
155
|
+
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="leading">
|
|
156
|
+
<div :style="sampleContentStyle" />
|
|
157
|
+
</CpAccordion>
|
|
158
|
+
</div>
|
|
159
|
+
<div :style="docCellStyle">
|
|
160
|
+
<span :style="docLabelStyle">Trailing Chevron</span>
|
|
161
|
+
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="trailing">
|
|
162
|
+
<div :style="sampleContentStyle" />
|
|
163
|
+
</CpAccordion>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</section>
|
|
167
|
+
|
|
168
|
+
<section :style="docSectionStyle">
|
|
169
|
+
<h2 :style="docTitleStyle">Actions</h2>
|
|
170
|
+
<div :style="docRowColumnStyle">
|
|
171
|
+
<div :style="docCellStyle">
|
|
172
|
+
<span :style="docLabelStyle">Default</span>
|
|
173
|
+
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="leading" :actions="actions" :quick-options-limit="3">
|
|
174
|
+
<template #trailing-slot>
|
|
175
|
+
This is a trailing slot
|
|
176
|
+
</template>
|
|
177
|
+
<div :style="sampleContentStyle" />
|
|
178
|
+
</CpAccordion>
|
|
179
|
+
</div>
|
|
180
|
+
<div :style="docCellStyle">
|
|
181
|
+
<span :style="docLabelStyle">Hover</span>
|
|
182
|
+
<CpAccordion
|
|
183
|
+
title="DIDA TRAVEL"
|
|
184
|
+
:default-open-state="false"
|
|
185
|
+
icon-position="leading"
|
|
186
|
+
style="background: var(--cp-background-primary-hover);"
|
|
187
|
+
:actions="actions"
|
|
188
|
+
:quick-options-limit="3"
|
|
189
|
+
>
|
|
190
|
+
<template #trailing-slot>
|
|
191
|
+
This is a trailing slot
|
|
192
|
+
</template>
|
|
193
|
+
<div :style="sampleContentStyle" />
|
|
194
|
+
</CpAccordion>
|
|
195
|
+
</div>
|
|
196
|
+
<div :style="docCellStyle">
|
|
197
|
+
<span :style="docLabelStyle">Hide Action Trigger</span>
|
|
198
|
+
<CpAccordion
|
|
199
|
+
title="DIDA TRAVEL"
|
|
200
|
+
:default-open-state="false"
|
|
201
|
+
icon-position="leading"
|
|
202
|
+
style="background: var(--cp-background-primary-hover);"
|
|
203
|
+
:actions="actions"
|
|
204
|
+
:quick-options-limit="3"
|
|
205
|
+
hide-action-trigger
|
|
206
|
+
>
|
|
207
|
+
<template #trailing-slot>
|
|
208
|
+
This is a trailing slot
|
|
209
|
+
</template>
|
|
210
|
+
<div :style="sampleContentStyle" />
|
|
211
|
+
</CpAccordion>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</section>
|
|
215
|
+
|
|
216
|
+
<section :style="docSectionStyle">
|
|
217
|
+
<h2 :style="docTitleStyle">Has Leading Slot</h2>
|
|
218
|
+
<div :style="docRowColumnStyle">
|
|
219
|
+
<div :style="docCellStyle">
|
|
220
|
+
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="leading" :actions="actions" :quick-options-limit="3">
|
|
221
|
+
<template #leading-slot>
|
|
222
|
+
<span :style="highlightedSlotStyle">I have text.</span>
|
|
223
|
+
</template>
|
|
224
|
+
<div :style="sampleContentStyle" />
|
|
225
|
+
</CpAccordion>
|
|
226
|
+
</div>
|
|
227
|
+
<div :style="docCellStyle">
|
|
228
|
+
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="trailing">
|
|
229
|
+
<template #leading-slot>
|
|
230
|
+
<span :style="highlightedSlotStyle">I have text.</span>
|
|
231
|
+
</template>
|
|
232
|
+
<div :style="sampleContentStyle" />
|
|
233
|
+
</CpAccordion>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
</section>
|
|
237
|
+
|
|
238
|
+
<section :style="docSectionStyle">
|
|
239
|
+
<h2 :style="docTitleStyle">Has Trailing Slot</h2>
|
|
240
|
+
<div :style="docRowColumnStyle">
|
|
241
|
+
<div :style="docCellStyle">
|
|
242
|
+
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="leading">
|
|
243
|
+
<template #trailing-slot>
|
|
244
|
+
<span :style="highlightedSlotStyle">I have text.</span>
|
|
245
|
+
</template>
|
|
246
|
+
<div :style="sampleContentStyle" />
|
|
247
|
+
</CpAccordion>
|
|
248
|
+
</div>
|
|
249
|
+
<div :style="docCellStyle">
|
|
250
|
+
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="trailing">
|
|
251
|
+
<template #trailing-slot>
|
|
252
|
+
<span :style="highlightedSlotStyle">I have text.</span>
|
|
253
|
+
</template>
|
|
254
|
+
<div :style="sampleContentStyle" />
|
|
255
|
+
</CpAccordion>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</section>
|
|
259
|
+
</div>
|
|
260
|
+
`,
|
|
261
|
+
}),
|
|
262
|
+
parameters: {
|
|
263
|
+
controls: { disable: true },
|
|
264
|
+
docs: {
|
|
265
|
+
source: {
|
|
266
|
+
code: null,
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export const Default: Story = {
|
|
273
|
+
args: {
|
|
274
|
+
title: 'I have title.',
|
|
275
|
+
defaultOpenState: true,
|
|
276
|
+
iconPosition: 'leading',
|
|
277
|
+
quickOptionsLimit: 2,
|
|
278
|
+
hideActionTrigger: false,
|
|
279
|
+
actions: defaultStoryActions,
|
|
280
|
+
},
|
|
281
|
+
render: defaultRender,
|
|
282
|
+
}
|