@citizenplane/pimp 12.0.3 → 13.1.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 +4509 -4415
- package/dist/pimp.umd.js +44 -44
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpAccordion.vue +174 -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 +3 -2
- package/src/components/CpInput.vue +2 -2
- package/src/components/CpItemActions.vue +11 -9
- package/src/components/CpLoader.vue +42 -19
- package/src/components/CpPartnerBadge.vue +3 -2
- package/src/components/CpSelect.vue +2 -2
- package/src/components/CpTable.vue +2 -2
- package/src/components/CpTelInput.vue +2 -2
- package/src/components/index.ts +4 -0
- package/src/constants/Sizes.ts +1 -11
- package/src/constants/index.ts +1 -1
- package/src/stories/CpAccordion.stories.ts +282 -0
- package/src/stories/CpAccordionGroup.stories.ts +223 -0
- package/src/stories/CpBadge.stories.ts +1 -3
- package/src/stories/CpButton.stories.ts +146 -145
- package/src/stories/CpInput.stories.ts +1 -3
- package/src/stories/CpLoader.stories.ts +7 -2
- package/src/stories/CpPartnerBadge.stories.ts +2 -2
- package/src/stories/CpSelect.stories.ts +3 -5
- package/src/stories/CpSelectableButton.stories.ts +3 -5
- package/src/stories/documentationStyles.ts +16 -0
package/package.json
CHANGED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="cpAccordion">
|
|
3
|
+
<button
|
|
4
|
+
:id="accordionId"
|
|
5
|
+
:aria-controls="accordionContentId"
|
|
6
|
+
:aria-expanded="isToggled"
|
|
7
|
+
class="cpAccordion__header"
|
|
8
|
+
:class="dynamicClasses"
|
|
9
|
+
cp-item-actions-trigger
|
|
10
|
+
type="button"
|
|
11
|
+
@click="handleClick"
|
|
12
|
+
>
|
|
13
|
+
<div class="cpAccordion__title">
|
|
14
|
+
<cp-icon v-if="displayLeadingIcon" class="cpAccordion__icon" size="16" :type="dynamicIcon" />
|
|
15
|
+
<div class="cpAccordion__leading">
|
|
16
|
+
<span>{{ title }}</span>
|
|
17
|
+
<slot name="leading-slot" />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="cpAccordion__trailing">
|
|
21
|
+
<slot name="trailing-slot" />
|
|
22
|
+
<cp-icon v-if="displayActionTrigger" class="cpAccordion__more" size="16" type="more-horizontal" />
|
|
23
|
+
<cp-icon v-if="displayTrailingIcon" class="cpAccordion__icon" size="16" :type="dynamicIcon" />
|
|
24
|
+
</div>
|
|
25
|
+
<cp-item-actions
|
|
26
|
+
v-if="hasActions"
|
|
27
|
+
:actions="resolvedActions"
|
|
28
|
+
class="cpAccordion__actions"
|
|
29
|
+
:quick-options-limit="resolvedQuickOptionsLimit"
|
|
30
|
+
/>
|
|
31
|
+
</button>
|
|
32
|
+
<transition-expand>
|
|
33
|
+
<div v-if="isToggled" :id="accordionContentId" :aria-labelledby="accordionId" class="cpAccordion__content">
|
|
34
|
+
<slot />
|
|
35
|
+
</div>
|
|
36
|
+
</transition-expand>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup lang="ts">
|
|
41
|
+
import { computed, ref, useId } from 'vue'
|
|
42
|
+
|
|
43
|
+
import type { MenuItem } from 'primevue/menuitem'
|
|
44
|
+
|
|
45
|
+
export interface CpAccordionBaseProps {
|
|
46
|
+
defaultOpenState?: boolean
|
|
47
|
+
quickOptionsLimit?: number
|
|
48
|
+
title: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Leading (default): optional `actions` (`MenuItem[]`).
|
|
53
|
+
* Trailing: `actions` must not be passed (use `iconPosition: 'trailing'` only).
|
|
54
|
+
*/
|
|
55
|
+
export type CpAccordionProps =
|
|
56
|
+
| (CpAccordionBaseProps & {
|
|
57
|
+
actions?: MenuItem[]
|
|
58
|
+
hideActionTrigger?: boolean
|
|
59
|
+
iconPosition?: 'leading'
|
|
60
|
+
})
|
|
61
|
+
| (CpAccordionBaseProps & {
|
|
62
|
+
iconPosition: 'trailing'
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const props = defineProps<CpAccordionProps>()
|
|
66
|
+
|
|
67
|
+
const isToggled = ref(props.defaultOpenState)
|
|
68
|
+
|
|
69
|
+
const accordionId = useId()
|
|
70
|
+
|
|
71
|
+
const accordionContentId = computed(() => `${accordionId}-content`)
|
|
72
|
+
|
|
73
|
+
const resolvedIconPosition = computed(() => props.iconPosition || 'leading')
|
|
74
|
+
|
|
75
|
+
const resolvedQuickOptionsLimit = computed(() => props.quickOptionsLimit || 0)
|
|
76
|
+
|
|
77
|
+
const resolvedActions = computed<MenuItem[]>(() => {
|
|
78
|
+
if (props.iconPosition === 'trailing') return []
|
|
79
|
+
return props.actions || []
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const resolvedHideActionTrigger = computed(() => {
|
|
83
|
+
if (props.iconPosition === 'trailing') return true
|
|
84
|
+
return props.hideActionTrigger
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const hasActions = computed(() => resolvedActions.value.length > 0)
|
|
88
|
+
const hasLeadingIcon = computed(() => resolvedIconPosition.value === 'leading')
|
|
89
|
+
const hasTrailingIcon = computed(() => resolvedIconPosition.value === 'trailing')
|
|
90
|
+
|
|
91
|
+
const displayActionTrigger = computed(() => !resolvedHideActionTrigger.value && hasActions.value)
|
|
92
|
+
const displayLeadingIcon = computed(() => hasLeadingIcon.value || hasActions.value)
|
|
93
|
+
const displayTrailingIcon = computed(() => hasTrailingIcon.value && !hasActions.value)
|
|
94
|
+
|
|
95
|
+
const dynamicIcon = computed(() => (isToggled.value ? 'chevron-up' : 'chevron-down'))
|
|
96
|
+
|
|
97
|
+
const dynamicClasses = computed(() => [{ 'cpAccordion--isOpen': isToggled.value }])
|
|
98
|
+
|
|
99
|
+
const handleClick = () => (isToggled.value = !isToggled.value)
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<style lang="scss">
|
|
103
|
+
.cpAccordion {
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
background-color: var(--cp-background-primary);
|
|
107
|
+
width: 100%;
|
|
108
|
+
|
|
109
|
+
&__header {
|
|
110
|
+
@extend %u-focus-outline;
|
|
111
|
+
|
|
112
|
+
border-radius: var(--cp-radius-none);
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: space-between;
|
|
116
|
+
padding: var(--cp-spacing-lg);
|
|
117
|
+
gap: var(--cp-spacing-lg);
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
|
|
120
|
+
&:hover {
|
|
121
|
+
background-color: var(--cp-background-primary-hover);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&__title {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
gap: var(--cp-spacing-lg);
|
|
129
|
+
font-weight: 500;
|
|
130
|
+
font-size: var(--cp-text-size-sm);
|
|
131
|
+
line-height: var(--cp-line-height-sm);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&__icon {
|
|
135
|
+
color: var(--cp-foreground-secondary);
|
|
136
|
+
flex-shrink: 0;
|
|
137
|
+
padding: var(--cp-spacing-xs);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&__leading {
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&__trailing {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: var(--cp-spacing-lg);
|
|
149
|
+
position: relative;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&__actions {
|
|
153
|
+
right: 0;
|
|
154
|
+
top: 0;
|
|
155
|
+
height: 100%;
|
|
156
|
+
background: linear-gradient(270deg, var(--cp-utility-neutral-100) 0%, rgba(242, 246, 250, 0) 100%);
|
|
157
|
+
padding: 0 var(--cp-spacing-md) 0 15%;
|
|
158
|
+
transform: translate3d(calc(var(--cp-dimensions-1) * 1.25), 0%, 0);
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&__more {
|
|
164
|
+
color: var(--cp-foreground-primary);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@media (hover: hover) and (pointer: fine) {
|
|
169
|
+
[cp-item-actions-trigger]:has(.cpItemActions--isDropdownOpen) .cpItemActions,
|
|
170
|
+
[cp-item-actions-trigger]:is(:focus-within, :focus-visible, :hover) .cpItemActions {
|
|
171
|
+
transform: translate3d(0, 0, 0);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="cpAccordionGroup" :class="groupClass">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
|
|
10
|
+
import { capitalizeFirstLetter } from '@/helpers'
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
variant?: 'minimal' | 'default' | 'primary'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
17
|
+
variant: 'minimal',
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const groupClass = computed(() => {
|
|
21
|
+
return { [`cpAccordionGroup--is${capitalizeFirstLetter(props.variant)}`]: true }
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style lang="scss">
|
|
26
|
+
.cpAccordionGroup {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
width: 100%;
|
|
30
|
+
|
|
31
|
+
&--isDefault {
|
|
32
|
+
.cpAccordion {
|
|
33
|
+
border-bottom: fn.px-to-rem(1) solid var(--cp-border-soft);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.cpAccordion:last-child {
|
|
37
|
+
border-bottom: none;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&--isPrimary {
|
|
42
|
+
border: fn.px-to-rem(1) solid var(--cp-border-soft);
|
|
43
|
+
border-radius: var(--cp-radius-md);
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
|
|
46
|
+
.cpAccordion:not(:last-child) {
|
|
47
|
+
border-bottom: fn.px-to-rem(1) solid var(--cp-border-soft);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
19
|
import { computed } from 'vue'
|
|
20
20
|
|
|
21
|
-
import { Colors, Sizes } from '@/constants'
|
|
21
|
+
import type { Colors, Sizes } from '@/constants'
|
|
22
22
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
23
23
|
|
|
24
24
|
interface Emits {
|
|
@@ -41,7 +41,7 @@ interface Props {
|
|
|
41
41
|
|
|
42
42
|
const props = withDefaults(defineProps<Props>(), {
|
|
43
43
|
color: 'gray',
|
|
44
|
-
size:
|
|
44
|
+
size: 'md',
|
|
45
45
|
label: '',
|
|
46
46
|
leadingIcon: '',
|
|
47
47
|
trailingIcon: '',
|
|
@@ -36,10 +36,11 @@ import { Haptics } from '@/constants/Hapitcs'
|
|
|
36
36
|
|
|
37
37
|
import CpLoader from '@/components/CpLoader.vue'
|
|
38
38
|
|
|
39
|
-
import { Colors, Sizes } from '@/constants'
|
|
39
|
+
import type { Colors, Sizes } from '@/constants'
|
|
40
40
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
41
41
|
|
|
42
42
|
type ButtonColor = Extract<Colors, 'neutral' | 'accent' | 'error' | 'warning' | 'success'>
|
|
43
|
+
type ButtonSizes = Extract<Sizes, '2xs' | 'xs' | 'sm' | 'md' | 'lg'>
|
|
43
44
|
|
|
44
45
|
interface Props {
|
|
45
46
|
appearance?: ButtonAppearances
|
|
@@ -48,7 +49,7 @@ interface Props {
|
|
|
48
49
|
enableHaptics?: boolean
|
|
49
50
|
isLoading?: boolean
|
|
50
51
|
isSquare?: boolean
|
|
51
|
-
size?:
|
|
52
|
+
size?: ButtonSizes
|
|
52
53
|
tag?: ButtonTags
|
|
53
54
|
type?: ButtonTypes
|
|
54
55
|
}
|
|
@@ -58,7 +59,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
58
59
|
color: 'neutral',
|
|
59
60
|
tag: 'button',
|
|
60
61
|
type: 'button',
|
|
61
|
-
size:
|
|
62
|
+
size: 'md',
|
|
62
63
|
})
|
|
63
64
|
|
|
64
65
|
const slots = useSlots()
|
|
@@ -1,16 +1,44 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="cpButtonGroup">
|
|
2
|
+
<div class="cpButtonGroup" :class="dynamicClasses">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
size: 'md',
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const dynamicClasses = computed(() => `cpButtonGroup--${props.size}`)
|
|
19
|
+
</script>
|
|
20
|
+
|
|
7
21
|
<style lang="scss">
|
|
8
22
|
.cpButtonGroup {
|
|
9
23
|
display: flex;
|
|
10
24
|
align-items: flex-start;
|
|
11
|
-
border-radius: var(--cp-radius-
|
|
25
|
+
border-radius: var(--cp-radius-md);
|
|
12
26
|
box-shadow: 0 0 0 fn.px-to-rem(1) var(--cp-border-soft);
|
|
13
27
|
|
|
28
|
+
&--2xs {
|
|
29
|
+
border-radius: var(--cp-radius-sm-md);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&--xs,
|
|
33
|
+
&--sm,
|
|
34
|
+
&--md {
|
|
35
|
+
border-radius: var(--cp-radius-md);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&--lg {
|
|
39
|
+
border-radius: var(--cp-radius-md-lg);
|
|
40
|
+
}
|
|
41
|
+
|
|
14
42
|
> * {
|
|
15
43
|
position: relative;
|
|
16
44
|
|
|
@@ -57,7 +57,8 @@ import { ref, computed, watch, useId } from 'vue'
|
|
|
57
57
|
|
|
58
58
|
import BaseInputLabel from '@/components/BaseInputLabel.vue'
|
|
59
59
|
|
|
60
|
-
import { HUMAN_MAX_AGE
|
|
60
|
+
import { HUMAN_MAX_AGE } from '@/constants'
|
|
61
|
+
import type { Sizes } from '@/constants'
|
|
61
62
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
62
63
|
|
|
63
64
|
interface Emits {
|
|
@@ -101,7 +102,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
101
102
|
autocompleteBirthday: false,
|
|
102
103
|
locale: () => navigator.language,
|
|
103
104
|
inputsOptions: () => ({}),
|
|
104
|
-
size:
|
|
105
|
+
size: 'md',
|
|
105
106
|
})
|
|
106
107
|
|
|
107
108
|
const emit = defineEmits<Emits>()
|
|
@@ -55,7 +55,7 @@ import { ref, useAttrs, useSlots, computed, nextTick, onMounted, useId } from 'v
|
|
|
55
55
|
|
|
56
56
|
import BaseInputLabel from '@/components/BaseInputLabel.vue'
|
|
57
57
|
|
|
58
|
-
import { Sizes } from '@/constants'
|
|
58
|
+
import type { Sizes } from '@/constants'
|
|
59
59
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
60
60
|
|
|
61
61
|
interface Emits {
|
|
@@ -83,7 +83,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
83
83
|
inputId: null,
|
|
84
84
|
mask: null,
|
|
85
85
|
modelValue: '',
|
|
86
|
-
size:
|
|
86
|
+
size: 'md',
|
|
87
87
|
tooltip: '',
|
|
88
88
|
})
|
|
89
89
|
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
<cp-contextual-menu
|
|
13
13
|
ref="contextualMenu"
|
|
14
14
|
:items="actions"
|
|
15
|
-
@hide="
|
|
16
|
-
@show="
|
|
15
|
+
@hide="handleDropdownState(false)"
|
|
16
|
+
@show="handleDropdownState(true)"
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
19
19
|
</template>
|
|
@@ -42,7 +42,7 @@ const isDropdownOpen = ref(false)
|
|
|
42
42
|
const showContextualMenu = (event: MouseEvent) => contextualMenu.value?.show(event)
|
|
43
43
|
|
|
44
44
|
const defaultAction = {
|
|
45
|
-
icon: 'more-
|
|
45
|
+
icon: 'more-horizontal',
|
|
46
46
|
command: (event: MouseEvent) => showContextualMenu(event),
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -58,12 +58,14 @@ const slicedActions = computed(() => {
|
|
|
58
58
|
const firstActions = actionsCopy.slice(0, props.quickOptionsLimit)
|
|
59
59
|
return [...firstActions, defaultAction]
|
|
60
60
|
})
|
|
61
|
+
|
|
62
|
+
const handleDropdownState = (state: boolean) => (isDropdownOpen.value = state)
|
|
61
63
|
</script>
|
|
62
64
|
|
|
63
65
|
<style lang="scss">
|
|
64
66
|
.cpItemActions {
|
|
65
67
|
position: absolute;
|
|
66
|
-
right:
|
|
68
|
+
right: 0;
|
|
67
69
|
top: 50%;
|
|
68
70
|
transform: translate3d(calc(var(--cp-dimensions-1) * 1.25), -50%, 0);
|
|
69
71
|
transition:
|
|
@@ -78,18 +80,18 @@ const slicedActions = computed(() => {
|
|
|
78
80
|
padding: 0;
|
|
79
81
|
|
|
80
82
|
&:first-child .cpMenuItem__button {
|
|
81
|
-
border-top-left-radius: var(--cp-radius-
|
|
82
|
-
border-bottom-left-radius: var(--cp-radius-
|
|
83
|
+
border-top-left-radius: var(--cp-radius-md);
|
|
84
|
+
border-bottom-left-radius: var(--cp-radius-md);
|
|
83
85
|
}
|
|
84
86
|
&:last-child .cpMenuItem__button {
|
|
85
|
-
border-top-right-radius: var(--cp-radius-
|
|
86
|
-
border-bottom-right-radius: var(--cp-radius-
|
|
87
|
+
border-top-right-radius: var(--cp-radius-md);
|
|
88
|
+
border-bottom-right-radius: var(--cp-radius-md);
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
.cpMenuItem__button {
|
|
91
93
|
border-radius: 0;
|
|
92
|
-
padding: var(--cp-spacing-
|
|
94
|
+
padding: var(--cp-spacing-sm-md);
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
class="cpLoader"
|
|
5
5
|
:class="dynamicClasses"
|
|
6
6
|
enable-background="new 0 0 40 40"
|
|
7
|
-
:height="
|
|
7
|
+
:height="40"
|
|
8
8
|
version="1.1"
|
|
9
9
|
viewBox="0 0 40 40"
|
|
10
|
-
:width="
|
|
10
|
+
:width="40"
|
|
11
11
|
x="0px"
|
|
12
12
|
xml:space="preserve"
|
|
13
13
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<animateTransform
|
|
26
26
|
attributeName="transform"
|
|
27
27
|
attributeType="xml"
|
|
28
|
-
dur="
|
|
28
|
+
:dur="formatedDuration"
|
|
29
29
|
from="0 20 20"
|
|
30
30
|
repeatCount="indefinite"
|
|
31
31
|
to="360 20 20"
|
|
@@ -41,23 +41,22 @@ import { computed } from 'vue'
|
|
|
41
41
|
import { Colors } from '@/constants'
|
|
42
42
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
43
43
|
|
|
44
|
+
type LoaderColor = Extract<Colors, 'neutral' | 'accent' | 'error' | 'warning' | 'success'>
|
|
45
|
+
type LoaderSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'
|
|
46
|
+
|
|
44
47
|
interface Props {
|
|
45
|
-
color?:
|
|
46
|
-
|
|
48
|
+
color?: LoaderColor
|
|
49
|
+
duration?: number
|
|
50
|
+
size?: LoaderSize
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
const props = withDefaults(defineProps<Props>(), { color: 'accent', size:
|
|
53
|
+
const props = withDefaults(defineProps<Props>(), { color: 'accent', duration: 700, size: 'sm' })
|
|
50
54
|
|
|
51
|
-
const
|
|
55
|
+
const formatedDuration = computed(() => `${props.duration}ms`)
|
|
52
56
|
|
|
53
57
|
const dynamicClasses = computed(() => {
|
|
54
|
-
return [`cpLoader--is${
|
|
58
|
+
return [`cpLoader--is${capitalizeFirstLetter(props.color)}`, `cpLoader--${props.size}`]
|
|
55
59
|
})
|
|
56
|
-
|
|
57
|
-
const sizeAttrs = computed(() => ({
|
|
58
|
-
height: props.size,
|
|
59
|
-
width: props.size,
|
|
60
|
-
}))
|
|
61
60
|
</script>
|
|
62
61
|
|
|
63
62
|
<style lang="scss">
|
|
@@ -74,12 +73,36 @@ const sizeAttrs = computed(() => ({
|
|
|
74
73
|
@include cp-loader-themed('Warning', var(--cp-foreground-warning-secondary));
|
|
75
74
|
@include cp-loader-themed('Success', var(--cp-foreground-success-secondary));
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
&--2xs {
|
|
77
|
+
@include mx.square-sizing(16);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&--xs {
|
|
81
|
+
@include mx.square-sizing(20);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&--sm {
|
|
85
|
+
@include mx.square-sizing(24);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&--md {
|
|
89
|
+
@include mx.square-sizing(32);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&--lg {
|
|
93
|
+
@include mx.square-sizing(40);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&--xl {
|
|
97
|
+
@include mx.square-sizing(48);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&--2xl {
|
|
101
|
+
@include mx.square-sizing(64);
|
|
102
|
+
}
|
|
79
103
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
@include cp-loader-themed('Red', var(--cp-text-error-primary)); // TODO: Should be replace by ERROR
|
|
104
|
+
&--3xl {
|
|
105
|
+
@include mx.square-sizing(96);
|
|
106
|
+
}
|
|
84
107
|
}
|
|
85
108
|
</style>
|
|
@@ -14,7 +14,8 @@ import IconOta from '@/components/icons/IconOta.vue'
|
|
|
14
14
|
import IconSupplier from '@/components/icons/IconSupplier.vue'
|
|
15
15
|
import IconThirdParty from '@/components/icons/IconThirdParty.vue'
|
|
16
16
|
|
|
17
|
-
import { PartnerTypes
|
|
17
|
+
import { PartnerTypes } from '@/constants'
|
|
18
|
+
import type { Sizes } from '@/constants'
|
|
18
19
|
|
|
19
20
|
interface Props {
|
|
20
21
|
size?: Sizes
|
|
@@ -22,7 +23,7 @@ interface Props {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const props = withDefaults(defineProps<Props>(), {
|
|
25
|
-
size:
|
|
26
|
+
size: 'md',
|
|
26
27
|
type: PartnerTypes.THIRDPARTY,
|
|
27
28
|
})
|
|
28
29
|
|
|
@@ -42,7 +42,7 @@ import { computed, useId } from 'vue'
|
|
|
42
42
|
import BaseInputLabel from '@/components/BaseInputLabel.vue'
|
|
43
43
|
import TransitionExpand from '@/components/TransitionExpand.vue'
|
|
44
44
|
|
|
45
|
-
import { Sizes } from '@/constants'
|
|
45
|
+
import type { Sizes } from '@/constants'
|
|
46
46
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
47
47
|
|
|
48
48
|
interface Emits {
|
|
@@ -82,7 +82,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
82
82
|
autocomplete: 'on',
|
|
83
83
|
isInvalid: false,
|
|
84
84
|
errorMessage: '',
|
|
85
|
-
size:
|
|
85
|
+
size: 'md',
|
|
86
86
|
help: '',
|
|
87
87
|
tooltip: '',
|
|
88
88
|
})
|
|
@@ -809,7 +809,7 @@ defineExpose({ hideContextualMenu, resetPagination, currentRowData })
|
|
|
809
809
|
|
|
810
810
|
&--isOptions .cpTable__action {
|
|
811
811
|
display: none;
|
|
812
|
-
padding: var(--cp-
|
|
812
|
+
padding: var(--cp-spacing-sm-md) var(--cp-spacing-md);
|
|
813
813
|
border: none;
|
|
814
814
|
border-radius: 0;
|
|
815
815
|
color: var(--cp-foreground-primary);
|
|
@@ -1021,7 +1021,7 @@ defineExpose({ hideContextualMenu, resetPagination, currentRowData })
|
|
|
1021
1021
|
box-shadow: var(--cp-shadows-3xs);
|
|
1022
1022
|
border-radius: var(--cp-radius-md-lg);
|
|
1023
1023
|
border: var(--cp-dimensions-0_25) solid var(--cp-border-soft);
|
|
1024
|
-
padding: var(--cp-
|
|
1024
|
+
padding: var(--cp-spacing-sm-md) var(--cp-dimensions-2_5);
|
|
1025
1025
|
transition: background-color 0.15s;
|
|
1026
1026
|
background-color: var(--cp-background-primary);
|
|
1027
1027
|
|
|
@@ -44,7 +44,7 @@ import { useAttrs, ref, useId, computed, nextTick } from 'vue'
|
|
|
44
44
|
|
|
45
45
|
import BaseInputLabel from '@/components/BaseInputLabel.vue'
|
|
46
46
|
|
|
47
|
-
import { Sizes } from '@/constants'
|
|
47
|
+
import type { Sizes } from '@/constants'
|
|
48
48
|
import { capitalizeFirstLetter } from '@/helpers'
|
|
49
49
|
|
|
50
50
|
interface Props {
|
|
@@ -74,7 +74,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
74
74
|
tooltip: '',
|
|
75
75
|
name: '',
|
|
76
76
|
hideSearch: false,
|
|
77
|
-
size:
|
|
77
|
+
size: 'md',
|
|
78
78
|
})
|
|
79
79
|
|
|
80
80
|
const emit = defineEmits<Emits>()
|
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'
|
|
@@ -58,6 +60,8 @@ import IconTooltip from './icons/IconTooltip.vue'
|
|
|
58
60
|
import TransitionExpand from './TransitionExpand.vue'
|
|
59
61
|
|
|
60
62
|
const Components = {
|
|
63
|
+
CpAccordion,
|
|
64
|
+
CpAccordionGroup,
|
|
61
65
|
CpToast,
|
|
62
66
|
CpBadge,
|
|
63
67
|
CpTabs,
|
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'
|