@citizenplane/pimp 8.20.4 → 8.22.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/README.md +23 -2
- package/dist/IconAccompaniedMinorEach-DVJcuHj0.js +18 -0
- package/dist/IconAccompaniedMinorNone-BXf4n4ou.js +19 -0
- package/dist/IconAccompaniedMinorOne-CNdC-xeI.js +18 -0
- package/dist/IconAddReceipt-BFz16BpE.js +22 -0
- package/dist/IconAirportTerminal-CVkKwFXB.js +23 -0
- package/dist/IconArrival-C3UZ0X3K.js +23 -0
- package/dist/IconBroadcast-C0PyG0ON.js +20 -0
- package/dist/IconCabinBag-Dbfd3eU9.js +20 -0
- package/dist/IconCheckedBaggage--V-SlEA8.js +18 -0
- package/dist/IconCheckedBaggage20-qxIkw6m1.js +20 -0
- package/dist/IconCheckedBaggage30-BvMLcDVK.js +20 -0
- package/dist/IconChild-DQa4WqLv.js +21 -0
- package/dist/IconContact-CpjzDGE9.js +20 -0
- package/dist/IconDeparture-BgVq_dTQ.js +23 -0
- package/dist/IconDistribution-BbcHTmnJ.js +20 -0
- package/dist/IconDistributionClosed-BKSkMVr_.js +20 -0
- package/dist/IconDistributionExclusivePair-B4sktgJ5.js +18 -0
- package/dist/IconDistributionSided-DYDvAPYA.js +31 -0
- package/dist/IconDistributionSupplySided-Kj6qqifp.js +31 -0
- package/dist/IconDynamicContent-DvIytfat.js +21 -0
- package/dist/IconFares-DV3aFH6m.js +18 -0
- package/dist/IconFaresOutlined-DYEOkY_L.js +23 -0
- package/dist/IconFemale-D2Mfa1QV.js +33 -0
- package/dist/IconFindConversation-8wEIdKQV.js +24 -0
- package/dist/IconFire-pBaXc12G.js +22 -0
- package/dist/IconFlight-C5C7PmQR.js +23 -0
- package/dist/IconFlightReturn-BHKIKmJU.js +18 -0
- package/dist/IconHandHeart-WBIMaQuQ.js +21 -0
- package/dist/IconHistory-yZOWejhP.js +19 -0
- package/dist/IconHourGlass-CqyVtXKn.js +31 -0
- package/dist/IconIdCard-C1LVMNO2.js +22 -0
- package/dist/IconInfant-jlx5bYg6.js +18 -0
- package/dist/IconMale-DBRDgP6y.js +21 -0
- package/dist/IconMultiSegments-BNeLi2v7.js +18 -0
- package/dist/IconNoRefund-CnYqcTPx.js +18 -0
- package/dist/IconNotion-k-88gdS4.js +18 -0
- package/dist/IconOffline-sxl4gIDa.js +20 -0
- package/dist/IconPaid-DerAlBSC.js +23 -0
- package/dist/IconPassport-CrcNh_qG.js +22 -0
- package/dist/IconPayout-CS6i4g1R.js +20 -0
- package/dist/IconReceipt-DW0CutDY.js +25 -0
- package/dist/IconRecurrence-VbfPoDYR.js +24 -0
- package/dist/IconRefund-CXSRbRLD.js +19 -0
- package/dist/IconRoundTrip-Bt9-qnbY.js +20 -0
- package/dist/IconRouteNoStop-DL8Y30wj.js +18 -0
- package/dist/IconRouteOneStop-CTEyyVWa.js +18 -0
- package/dist/IconScheduleChange-Cfbc6YaK.js +19 -0
- package/dist/IconSeatEmpty-DXRMdLkb.js +25 -0
- package/dist/IconSeatSold-BEe-3cEz.js +22 -0
- package/dist/IconSeatTotal-IpvEJlaf.js +22 -0
- package/dist/IconTemplate-DzowVaSP.js +23 -0
- package/dist/IconTicket-o3P0xLEU.js +22 -0
- package/dist/IconTimer-DlMeU4t-.js +23 -0
- package/dist/IconTrafficControl-B1knXbCR.js +24 -0
- package/dist/index-CNDZl4Ol.js +15377 -0
- package/dist/pimp.es.js +2 -15377
- package/dist/pimp.umd.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +12 -5
- package/src/README.md +1 -6
- package/src/assets/styles/base/_base.scss +3 -2
- package/src/assets/styles/helpers/_mixins.scss +1 -1
- package/src/assets/styles/utilities/_index.scss +1 -1
- package/src/assets/styles/variables/_colors.scss +16 -16
- package/src/components/atomic-elements/CpBadge.vue +82 -138
- package/src/components/feedback-indicators/CpToaster.vue +7 -2
- package/src/components/helpers-utilities/TransitionExpand.vue +0 -6
- package/src/components/icons/IconAccompaniedMinorEach.vue +30 -0
- package/src/components/icons/IconAccompaniedMinorNone.vue +10 -0
- package/src/components/icons/IconAccompaniedMinorOne.vue +22 -0
- package/src/components/icons/IconAddReceipt.vue +17 -0
- package/src/components/icons/IconAirportTerminal.vue +10 -0
- package/src/components/icons/IconArrival.vue +18 -0
- package/src/components/icons/IconBroadcast.vue +35 -0
- package/src/components/icons/IconCabinBag.vue +36 -0
- package/src/components/icons/IconCheckedBaggage.vue +11 -0
- package/src/components/icons/IconCheckedBaggage20.vue +36 -0
- package/src/components/icons/IconCheckedBaggage30.vue +39 -0
- package/src/components/icons/IconChild.vue +16 -0
- package/src/components/icons/IconContact.vue +15 -0
- package/src/components/icons/IconDeparture.vue +18 -0
- package/src/components/icons/IconDistribution.vue +19 -0
- package/src/components/icons/IconDistributionClosed.vue +30 -0
- package/src/components/icons/IconDistributionExclusivePair.vue +7 -0
- package/src/components/icons/IconDistributionSided.vue +24 -0
- package/src/components/icons/IconDistributionSupplySided.vue +24 -0
- package/src/components/icons/IconDynamicContent.vue +18 -0
- package/src/components/icons/IconFares.vue +7 -0
- package/src/components/icons/IconFaresOutlined.vue +24 -0
- package/src/components/icons/IconFemale.vue +20 -0
- package/src/components/icons/IconFindConversation.vue +21 -0
- package/src/components/icons/IconFire.vue +9 -0
- package/src/components/icons/IconFlight.vue +16 -0
- package/src/components/icons/IconFlightReturn.vue +7 -0
- package/src/components/icons/IconHandHeart.vue +18 -0
- package/src/components/icons/IconHistory.vue +10 -0
- package/src/components/icons/IconHourGlass.vue +25 -0
- package/src/components/icons/IconIdCard.vue +17 -0
- package/src/components/icons/IconInfant.vue +22 -0
- package/src/components/icons/IconMale.vue +8 -0
- package/src/components/icons/IconMultiSegments.vue +7 -0
- package/src/components/icons/IconNoRefund.vue +19 -0
- package/src/components/icons/IconNotion.vue +7 -0
- package/src/components/icons/IconOffline.vue +25 -0
- package/src/components/icons/IconPaid.vue +18 -0
- package/src/components/icons/IconPassport.vue +21 -0
- package/src/components/icons/IconPayout.vue +15 -0
- package/src/components/icons/IconReceipt.vue +20 -0
- package/src/components/icons/IconRecurrence.vue +15 -0
- package/src/components/icons/IconRefund.vue +10 -0
- package/src/components/icons/IconRoundTrip.vue +15 -0
- package/src/components/icons/IconRouteNoStop.vue +7 -0
- package/src/components/icons/IconRouteOneStop.vue +7 -0
- package/src/components/icons/IconScheduleChange.vue +31 -0
- package/src/components/icons/IconSeatEmpty.vue +22 -0
- package/src/components/icons/IconSeatSold.vue +21 -0
- package/src/components/icons/IconSeatTotal.vue +27 -0
- package/src/components/icons/IconTemplate.vue +18 -0
- package/src/components/icons/IconTicket.vue +23 -0
- package/src/components/icons/IconTimer.vue +12 -0
- package/src/components/icons/IconTrafficControl.vue +11 -0
- package/src/components/{index.js → index.ts} +1 -3
- package/src/components/inputs/CpInput.vue +2 -2
- package/src/components/lists-and-table/CpTable.vue +4 -2
- package/src/components/selects/CpSelectMenu.vue +6 -2
- package/src/components/visual/CpIcon.vue +76 -62
- package/src/constants/{index.js → index.ts} +1 -0
- package/src/constants/src/CpCustomIcons.ts +69 -0
- package/src/constants/src/colors/{ToggleColors.js → ToggleColors.ts} +1 -1
- package/src/libs/CoreDatepicker.vue +4 -1
- package/src/stories/CpBadge.stories.ts +80 -90
- package/src/stories/CpIcon.stories.ts +60 -27
- package/src/stories/CpSelectMenu.stories.ts +1 -1
- package/tsconfig.json +14 -0
- package/src/components/atomic-elements/CpBadgeNew.vue +0 -145
- package/src/stories/CpBadgeNew.stories.ts +0 -148
- /package/src/constants/src/{CpTableConfig.js → CpTableConfig.ts} +0 -0
- /package/src/constants/src/{Position.js → Position.ts} +0 -0
- /package/src/constants/src/colors/{Colors.js → Colors.ts} +0 -0
|
@@ -8,151 +8,141 @@ const meta = {
|
|
|
8
8
|
argTypes: {
|
|
9
9
|
color: {
|
|
10
10
|
control: 'select',
|
|
11
|
-
options: ['
|
|
11
|
+
options: ['gray', 'blue', 'green', 'red', 'orange', 'purple', 'pink', 'yellow'],
|
|
12
12
|
description: 'The color variant of the badge',
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
control: '
|
|
16
|
-
|
|
14
|
+
size: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: ['sm', 'md'],
|
|
17
|
+
description: 'The size of the badge',
|
|
17
18
|
},
|
|
18
|
-
|
|
19
|
+
isStroked: {
|
|
19
20
|
control: 'boolean',
|
|
20
|
-
description: 'Whether the badge has a
|
|
21
|
+
description: 'Whether the badge has a stroked border',
|
|
21
22
|
},
|
|
22
|
-
|
|
23
|
-
control: '
|
|
24
|
-
|
|
23
|
+
leadingIcon: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['check', 'arrow-right', 'arrow-left', 'arrow-up', 'arrow-down'],
|
|
26
|
+
description: 'Type of leading icon (if any)',
|
|
25
27
|
},
|
|
26
|
-
|
|
28
|
+
trailingIcon: {
|
|
27
29
|
control: 'select',
|
|
28
|
-
options: ['
|
|
29
|
-
description: '
|
|
30
|
+
options: ['check', 'arrow-right', 'arrow-left', 'arrow-up', 'arrow-down'],
|
|
31
|
+
description: 'Type of trailing icon (if any)',
|
|
32
|
+
},
|
|
33
|
+
label: {
|
|
34
|
+
control: 'text',
|
|
35
|
+
description: 'The label text',
|
|
30
36
|
},
|
|
31
|
-
onClear: { action: 'cleared' },
|
|
32
37
|
},
|
|
33
38
|
} satisfies Meta<typeof CpBadge>
|
|
34
39
|
|
|
35
40
|
export default meta
|
|
41
|
+
|
|
36
42
|
type Story = StoryObj<typeof meta>
|
|
37
43
|
|
|
38
44
|
export const Default: Story = {
|
|
39
45
|
args: {
|
|
40
|
-
color: '
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
color: 'gray',
|
|
47
|
+
size: 'md',
|
|
48
|
+
isStroked: false,
|
|
49
|
+
leadingIcon: '',
|
|
50
|
+
trailingIcon: '',
|
|
51
|
+
label: 'Badge',
|
|
45
52
|
},
|
|
46
53
|
render: (args) => ({
|
|
47
54
|
components: { CpBadge },
|
|
48
55
|
setup() {
|
|
49
56
|
return { args }
|
|
50
57
|
},
|
|
51
|
-
template: '<CpBadge v-bind="args"
|
|
58
|
+
template: '<CpBadge v-bind="args" />',
|
|
52
59
|
}),
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
export const WithColors: Story = {
|
|
56
|
-
render: (
|
|
63
|
+
render: () => ({
|
|
57
64
|
components: { CpBadge },
|
|
58
|
-
setup() {
|
|
59
|
-
return { args }
|
|
60
|
-
},
|
|
61
65
|
template: `
|
|
62
66
|
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
|
|
63
|
-
<CpBadge color="
|
|
64
|
-
<CpBadge color="blue"
|
|
65
|
-
<CpBadge color="green"
|
|
66
|
-
<CpBadge color="red"
|
|
67
|
-
<CpBadge color="orange"
|
|
68
|
-
<CpBadge color="purple"
|
|
69
|
-
<CpBadge color="
|
|
70
|
-
<CpBadge color="
|
|
71
|
-
<CpBadge color="yellow">Yellow</CpBadge>
|
|
67
|
+
<CpBadge color="gray" label="Gray" />
|
|
68
|
+
<CpBadge color="blue" label="Blue" />
|
|
69
|
+
<CpBadge color="green" label="Green" />
|
|
70
|
+
<CpBadge color="red" label="Red" />
|
|
71
|
+
<CpBadge color="orange" label="Orange" />
|
|
72
|
+
<CpBadge color="purple" label="Purple" />
|
|
73
|
+
<CpBadge color="pink" label="Pink" />
|
|
74
|
+
<CpBadge color="yellow" label="Yellow" />
|
|
72
75
|
</div>
|
|
73
76
|
`,
|
|
74
77
|
}),
|
|
75
78
|
}
|
|
76
79
|
|
|
77
|
-
export const
|
|
78
|
-
render: (
|
|
80
|
+
export const WithSizes: Story = {
|
|
81
|
+
render: () => ({
|
|
79
82
|
components: { CpBadge },
|
|
80
|
-
setup() {
|
|
81
|
-
return { args }
|
|
82
|
-
},
|
|
83
83
|
template: `
|
|
84
|
-
<div style="display: flex; gap: 8px;
|
|
85
|
-
<CpBadge
|
|
86
|
-
<CpBadge
|
|
87
|
-
<CpBadge color="green" is-solid>Green</CpBadge>
|
|
88
|
-
<CpBadge color="red" is-solid>Red</CpBadge>
|
|
89
|
-
<CpBadge color="orange" is-solid>Orange</CpBadge>
|
|
90
|
-
<CpBadge color="purple" is-solid>Purple</CpBadge>
|
|
91
|
-
<CpBadge color="teal" is-solid>Teal</CpBadge>
|
|
92
|
-
<CpBadge color="pink" is-solid>Pink</CpBadge>
|
|
93
|
-
<CpBadge color="yellow" is-solid>Yellow</CpBadge>
|
|
84
|
+
<div style="display: flex; gap: 8px; align-items: center;">
|
|
85
|
+
<CpBadge size="sm" label="Small" />
|
|
86
|
+
<CpBadge size="md" label="Medium" />
|
|
94
87
|
</div>
|
|
95
88
|
`,
|
|
96
89
|
}),
|
|
97
90
|
}
|
|
98
91
|
|
|
99
|
-
export const
|
|
100
|
-
|
|
101
|
-
color: 'blue',
|
|
102
|
-
icon: 'check',
|
|
103
|
-
},
|
|
104
|
-
render: (args) => ({
|
|
92
|
+
export const IsStroked: Story = {
|
|
93
|
+
render: () => ({
|
|
105
94
|
components: { CpBadge },
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
95
|
+
template: `
|
|
96
|
+
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
|
|
97
|
+
<CpBadge color="blue" isStroked label="Stroked" />
|
|
98
|
+
<CpBadge color="green" isStroked label="Stroked" />
|
|
99
|
+
<CpBadge color="red" isStroked label="Stroked" />
|
|
100
|
+
</div>
|
|
101
|
+
`,
|
|
110
102
|
}),
|
|
111
103
|
}
|
|
112
104
|
|
|
113
|
-
export const
|
|
114
|
-
|
|
115
|
-
color: 'blue',
|
|
116
|
-
isClearable: true,
|
|
117
|
-
},
|
|
118
|
-
render: (args) => ({
|
|
105
|
+
export const WithIcons: Story = {
|
|
106
|
+
render: () => ({
|
|
119
107
|
components: { CpBadge },
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
108
|
+
template: `
|
|
109
|
+
<div style="display: flex; gap: 8px; align-items: center;">
|
|
110
|
+
<CpBadge color="blue" leading-icon="check" label="Leading Icon" />
|
|
111
|
+
<CpBadge color="green" trailing-icon="arrow-right" label="Trailing Icon" />
|
|
112
|
+
<CpBadge color="red" leading-icon="check" trailing-icon="arrow-right" label="Both Icons" />
|
|
113
|
+
</div>
|
|
114
|
+
`,
|
|
124
115
|
}),
|
|
125
116
|
}
|
|
126
117
|
|
|
127
|
-
export const
|
|
128
|
-
|
|
129
|
-
color: 'green',
|
|
130
|
-
isPlain: true,
|
|
131
|
-
},
|
|
132
|
-
render: (args) => ({
|
|
118
|
+
export const IsClearable: Story = {
|
|
119
|
+
render: () => ({
|
|
133
120
|
components: { CpBadge },
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
121
|
+
template: `
|
|
122
|
+
<div style="display: flex; gap: 8px; align-items: center;">
|
|
123
|
+
<CpBadge color="blue" isClearable label="Clearable" />
|
|
124
|
+
<CpBadge color="green" isClearable label="Clearable" />
|
|
125
|
+
<CpBadge color="red" isClearable label="Clearable" />
|
|
126
|
+
</div>
|
|
127
|
+
`,
|
|
138
128
|
}),
|
|
139
129
|
}
|
|
140
130
|
|
|
141
|
-
export const
|
|
142
|
-
render: (
|
|
131
|
+
export const WithSlot: Story = {
|
|
132
|
+
render: () => ({
|
|
143
133
|
components: { CpBadge },
|
|
144
|
-
setup() {
|
|
145
|
-
return { args }
|
|
146
|
-
},
|
|
147
134
|
template: `
|
|
148
|
-
<
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
135
|
+
<CpBadge color="purple">
|
|
136
|
+
<template #leading-icon>
|
|
137
|
+
<span style="font-size: 16px; margin-right: 4px;">🌟</span>
|
|
138
|
+
</template>
|
|
139
|
+
<div>
|
|
140
|
+
Custom div inside default slot
|
|
141
|
+
</div>
|
|
142
|
+
<template #trailing-icon>
|
|
143
|
+
<span style="font-size: 16px; margin-left: 4px;">🚀</span>
|
|
144
|
+
</template>
|
|
145
|
+
</CpBadge>
|
|
156
146
|
`,
|
|
157
147
|
}),
|
|
158
148
|
}
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
2
|
import CpIcon from '@/components/visual/CpIcon.vue'
|
|
3
|
+
import { CustomCpIcons } from '@/constants'
|
|
4
|
+
|
|
5
|
+
const iconsOptions = [
|
|
6
|
+
...Object.keys(CustomCpIcons),
|
|
7
|
+
'activity',
|
|
8
|
+
'alert-circle',
|
|
9
|
+
'arrow-down',
|
|
10
|
+
'arrow-left',
|
|
11
|
+
'arrow-right',
|
|
12
|
+
'arrow-up',
|
|
13
|
+
'bell',
|
|
14
|
+
'calendar',
|
|
15
|
+
'check',
|
|
16
|
+
'check-circle',
|
|
17
|
+
'chevron-down',
|
|
18
|
+
'chevron-left',
|
|
19
|
+
'chevron-right',
|
|
20
|
+
'chevron-up',
|
|
21
|
+
'edit',
|
|
22
|
+
'home',
|
|
23
|
+
'search',
|
|
24
|
+
'settings',
|
|
25
|
+
'user',
|
|
26
|
+
'x',
|
|
27
|
+
].sort()
|
|
3
28
|
|
|
4
29
|
const meta = {
|
|
5
30
|
title: 'CpIcon',
|
|
@@ -7,28 +32,7 @@ const meta = {
|
|
|
7
32
|
argTypes: {
|
|
8
33
|
type: {
|
|
9
34
|
control: 'select',
|
|
10
|
-
options:
|
|
11
|
-
'activity',
|
|
12
|
-
'alert-circle',
|
|
13
|
-
'arrow-down',
|
|
14
|
-
'arrow-left',
|
|
15
|
-
'arrow-right',
|
|
16
|
-
'arrow-up',
|
|
17
|
-
'bell',
|
|
18
|
-
'calendar',
|
|
19
|
-
'check',
|
|
20
|
-
'check-circle',
|
|
21
|
-
'chevron-down',
|
|
22
|
-
'chevron-left',
|
|
23
|
-
'chevron-right',
|
|
24
|
-
'chevron-up',
|
|
25
|
-
'edit',
|
|
26
|
-
'home',
|
|
27
|
-
'search',
|
|
28
|
-
'settings',
|
|
29
|
-
'user',
|
|
30
|
-
'x',
|
|
31
|
-
],
|
|
35
|
+
options: iconsOptions,
|
|
32
36
|
description: 'Type of icon to display',
|
|
33
37
|
},
|
|
34
38
|
size: {
|
|
@@ -39,6 +43,13 @@ const meta = {
|
|
|
39
43
|
control: 'text',
|
|
40
44
|
description: 'HTML tag to use for the icon wrapper',
|
|
41
45
|
},
|
|
46
|
+
weight: {
|
|
47
|
+
control: 'number',
|
|
48
|
+
description: 'Weight for specific icons like checked-baggage',
|
|
49
|
+
table: {
|
|
50
|
+
defaultValue: { summary: 0 },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
42
53
|
},
|
|
43
54
|
} satisfies Meta<typeof CpIcon>
|
|
44
55
|
|
|
@@ -65,14 +76,36 @@ export const Default: Story = {
|
|
|
65
76
|
}
|
|
66
77
|
|
|
67
78
|
export const DifferentSizes: Story = {
|
|
68
|
-
|
|
79
|
+
args: {
|
|
80
|
+
type: 'check',
|
|
81
|
+
},
|
|
82
|
+
render: (args) => ({
|
|
69
83
|
components: { CpIcon },
|
|
84
|
+
setup() {
|
|
85
|
+
return { args }
|
|
86
|
+
},
|
|
70
87
|
template: `
|
|
71
88
|
<div style="padding: 20px; display: flex; align-items: center; gap: 16px;">
|
|
72
|
-
<CpIcon
|
|
73
|
-
<CpIcon
|
|
74
|
-
<CpIcon
|
|
75
|
-
<CpIcon
|
|
89
|
+
<CpIcon v-bind="{ ...args, size: 16 }" />
|
|
90
|
+
<CpIcon v-bind="{ ...args, size: 24 }" />
|
|
91
|
+
<CpIcon v-bind="{ ...args, size: 32 }" />
|
|
92
|
+
<CpIcon v-bind="{ ...args, size: 48 }" />
|
|
93
|
+
</div>
|
|
94
|
+
`,
|
|
95
|
+
}),
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const AllIcons: Story = {
|
|
99
|
+
render: () => ({
|
|
100
|
+
components: { CpIcon },
|
|
101
|
+
setup() {
|
|
102
|
+
return { icons: iconsOptions }
|
|
103
|
+
},
|
|
104
|
+
template: `
|
|
105
|
+
<div style="padding: 20px; display: grid; grid-template-columns: repeat(4, minmax(100px, 3fr)); gap: 16px;">
|
|
106
|
+
<div v-for="icon in icons" style="display: flex;align-items: center;justify-content: center;border: 1px solid #eee;border-radius: 4px;padding: 2px 0;">
|
|
107
|
+
<CpIcon :key="icon" :type="icon" />
|
|
108
|
+
</div>
|
|
76
109
|
</div>
|
|
77
110
|
`,
|
|
78
111
|
}),
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"isolatedModules": true,
|
|
4
|
+
"strict": true,
|
|
5
|
+
"jsx": "preserve",
|
|
6
|
+
"jsxImportSource": "vue",
|
|
7
|
+
"baseUrl": ".",
|
|
8
|
+
"paths": {
|
|
9
|
+
"@/*": ["./src/*"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
13
|
+
"exclude": ["node_modules", "storybook-static", "dist", "build"]
|
|
14
|
+
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="cpBadgeNew" :class="componentDynamicClasses">
|
|
3
|
-
<slot name="leading-icon">
|
|
4
|
-
<cp-icon v-if="leadingIcon" :type="leadingIcon" class="cpBadgeNew__icon" />
|
|
5
|
-
</slot>
|
|
6
|
-
|
|
7
|
-
<span class="cpBadgeNew__label">
|
|
8
|
-
<slot>{{ label }}</slot>
|
|
9
|
-
</span>
|
|
10
|
-
|
|
11
|
-
<slot v-if="!isClearable" name="trailing-icon">
|
|
12
|
-
<cp-icon v-if="trailingIcon" :type="trailingIcon" class="cpBadgeNew__icon" />
|
|
13
|
-
</slot>
|
|
14
|
-
|
|
15
|
-
<button v-if="isClearable" class="cpBadgeNew__clear" @click="onClear">
|
|
16
|
-
<cp-icon type="x" class="cpBadgeNew__icon" />
|
|
17
|
-
</button>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup>
|
|
22
|
-
import { computed } from 'vue'
|
|
23
|
-
|
|
24
|
-
import { Colors } from '@/constants'
|
|
25
|
-
|
|
26
|
-
import { Sizes } from '@/utils/constants'
|
|
27
|
-
|
|
28
|
-
import { capitalizeFirstLetter } from '@/helpers'
|
|
29
|
-
|
|
30
|
-
const props = defineProps({
|
|
31
|
-
color: {
|
|
32
|
-
type: String,
|
|
33
|
-
default: Colors.GRAY,
|
|
34
|
-
validator: (value) => Object.values(Colors).includes(value),
|
|
35
|
-
},
|
|
36
|
-
size: {
|
|
37
|
-
type: String,
|
|
38
|
-
required: false,
|
|
39
|
-
default: Sizes.MD,
|
|
40
|
-
validator(value) {
|
|
41
|
-
return Object.values(Sizes).includes(value)
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
label: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: '',
|
|
47
|
-
},
|
|
48
|
-
leadingIcon: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: '',
|
|
51
|
-
},
|
|
52
|
-
trailingIcon: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: '',
|
|
55
|
-
},
|
|
56
|
-
isStroked: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: false,
|
|
59
|
-
},
|
|
60
|
-
isClearable: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: false,
|
|
63
|
-
},
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
const componentDynamicClasses = computed(() => {
|
|
67
|
-
return [
|
|
68
|
-
`cpBadgeNew--${props.size}`,
|
|
69
|
-
`cpBadgeNew--is${capitalizeFirstLetter(props.color)}`,
|
|
70
|
-
{ 'cpBadgeNew--isStroked': props.isStroked },
|
|
71
|
-
{ 'cpBadgeNew--isClearable': props.isClearable },
|
|
72
|
-
]
|
|
73
|
-
})
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<style lang="scss">
|
|
77
|
-
@mixin cp-badge-new-themed($className, $color, $bg-color, $outline-color) {
|
|
78
|
-
&--is#{$className} {
|
|
79
|
-
color: $color;
|
|
80
|
-
background-color: $bg-color;
|
|
81
|
-
outline-color: $outline-color;
|
|
82
|
-
|
|
83
|
-
.cpBadgeNew__clear:hover,
|
|
84
|
-
.cpBadgeNew__clear:focus-visible {
|
|
85
|
-
background-color: $color;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.cpBadgeNew {
|
|
91
|
-
display: inline-flex;
|
|
92
|
-
padding: sp.$space-sm sp.$space;
|
|
93
|
-
align-items: center;
|
|
94
|
-
border-radius: fn.px-to-rem(8);
|
|
95
|
-
background-color: colors.$neutral-dark-5;
|
|
96
|
-
font-size: fn.px-to-em(14);
|
|
97
|
-
color: colors.$neutral-dark;
|
|
98
|
-
gap: sp.$space-sm;
|
|
99
|
-
|
|
100
|
-
&--isStroked {
|
|
101
|
-
outline: 1px solid currentColor;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@include cp-badge-new-themed('Blue', colors.$blue, colors.$blue-100, colors.$blue-200);
|
|
105
|
-
@include cp-badge-new-themed('Gray', colors.$astronaut, colors.$gray-5, colors.$gray-4);
|
|
106
|
-
@include cp-badge-new-themed('Green', colors.$green, colors.$green-100, colors.$green-200);
|
|
107
|
-
@include cp-badge-new-themed('Orange', colors.$orange, colors.$orange-100, colors.$orange-200);
|
|
108
|
-
@include cp-badge-new-themed('Pink', colors.$pink, colors.$pink-100, colors.$pink-200);
|
|
109
|
-
@include cp-badge-new-themed('Purple', colors.$purple, colors.$purple-100, colors.$purple-200);
|
|
110
|
-
@include cp-badge-new-themed('Red', colors.$red, colors.$red-100, colors.$red-200);
|
|
111
|
-
@include cp-badge-new-themed('Yellow', colors.$yellow-500, colors.$yellow-100, colors.$yellow-200);
|
|
112
|
-
|
|
113
|
-
&--sm {
|
|
114
|
-
font-size: fn.px-to-em(12);
|
|
115
|
-
|
|
116
|
-
.cpBadgeNew__label {
|
|
117
|
-
line-height: fn.px-to-rem(16);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
&__icon {
|
|
122
|
-
width: fn.px-to-rem(16);
|
|
123
|
-
height: fn.px-to-rem(16);
|
|
124
|
-
aspect-ratio: 1/1;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&__label {
|
|
128
|
-
line-height: fn.px-to-rem(20);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
&__clear {
|
|
132
|
-
display: flex;
|
|
133
|
-
align-items: center;
|
|
134
|
-
justify-content: center;
|
|
135
|
-
padding: sp.$space-xs;
|
|
136
|
-
border-radius: 50%;
|
|
137
|
-
color: inherit;
|
|
138
|
-
|
|
139
|
-
&:hover,
|
|
140
|
-
&:focus-visible {
|
|
141
|
-
color: colors.$neutral-light;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
</style>
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
-
|
|
3
|
-
import CpBadgeNew from '@/components/atomic-elements/CpBadgeNew.vue'
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'CpBadgeNew',
|
|
7
|
-
component: CpBadgeNew,
|
|
8
|
-
argTypes: {
|
|
9
|
-
color: {
|
|
10
|
-
control: 'select',
|
|
11
|
-
options: ['gray', 'blue', 'green', 'red', 'orange', 'purple', 'pink', 'yellow'],
|
|
12
|
-
description: 'The color variant of the badge',
|
|
13
|
-
},
|
|
14
|
-
size: {
|
|
15
|
-
control: 'select',
|
|
16
|
-
options: ['sm', 'md'],
|
|
17
|
-
description: 'The size of the badge',
|
|
18
|
-
},
|
|
19
|
-
isStroked: {
|
|
20
|
-
control: 'boolean',
|
|
21
|
-
description: 'Whether the badge has a stroked border',
|
|
22
|
-
},
|
|
23
|
-
leadingIcon: {
|
|
24
|
-
control: 'select',
|
|
25
|
-
options: ['check', 'arrow-right', 'arrow-left', 'arrow-up', 'arrow-down'],
|
|
26
|
-
description: 'Type of leading icon (if any)',
|
|
27
|
-
},
|
|
28
|
-
trailingIcon: {
|
|
29
|
-
control: 'select',
|
|
30
|
-
options: ['check', 'arrow-right', 'arrow-left', 'arrow-up', 'arrow-down'],
|
|
31
|
-
description: 'Type of trailing icon (if any)',
|
|
32
|
-
},
|
|
33
|
-
label: {
|
|
34
|
-
control: 'text',
|
|
35
|
-
description: 'The label text',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
} satisfies Meta<typeof CpBadgeNew>
|
|
39
|
-
|
|
40
|
-
export default meta
|
|
41
|
-
|
|
42
|
-
type Story = StoryObj<typeof meta>
|
|
43
|
-
|
|
44
|
-
export const Default: Story = {
|
|
45
|
-
args: {
|
|
46
|
-
color: 'gray',
|
|
47
|
-
size: 'md',
|
|
48
|
-
isStroked: false,
|
|
49
|
-
leadingIcon: '',
|
|
50
|
-
trailingIcon: '',
|
|
51
|
-
label: 'Badge',
|
|
52
|
-
},
|
|
53
|
-
render: (args) => ({
|
|
54
|
-
components: { CpBadgeNew },
|
|
55
|
-
setup() {
|
|
56
|
-
return { args }
|
|
57
|
-
},
|
|
58
|
-
template: '<CpBadgeNew v-bind="args" />',
|
|
59
|
-
}),
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const WithColors: Story = {
|
|
63
|
-
render: () => ({
|
|
64
|
-
components: { CpBadgeNew },
|
|
65
|
-
template: `
|
|
66
|
-
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
|
|
67
|
-
<CpBadgeNew color="gray" label="Gray" />
|
|
68
|
-
<CpBadgeNew color="blue" label="Blue" />
|
|
69
|
-
<CpBadgeNew color="green" label="Green" />
|
|
70
|
-
<CpBadgeNew color="red" label="Red" />
|
|
71
|
-
<CpBadgeNew color="orange" label="Orange" />
|
|
72
|
-
<CpBadgeNew color="purple" label="Purple" />
|
|
73
|
-
<CpBadgeNew color="pink" label="Pink" />
|
|
74
|
-
<CpBadgeNew color="yellow" label="Yellow" />
|
|
75
|
-
</div>
|
|
76
|
-
`,
|
|
77
|
-
}),
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const WithSizes: Story = {
|
|
81
|
-
render: () => ({
|
|
82
|
-
components: { CpBadgeNew },
|
|
83
|
-
template: `
|
|
84
|
-
<div style="display: flex; gap: 8px; align-items: center;">
|
|
85
|
-
<CpBadgeNew size="sm" label="Small" />
|
|
86
|
-
<CpBadgeNew size="md" label="Medium" />
|
|
87
|
-
</div>
|
|
88
|
-
`,
|
|
89
|
-
}),
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export const IsStroked: Story = {
|
|
93
|
-
render: () => ({
|
|
94
|
-
components: { CpBadgeNew },
|
|
95
|
-
template: `
|
|
96
|
-
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
|
|
97
|
-
<CpBadgeNew color="blue" isStroked label="Stroked" />
|
|
98
|
-
<CpBadgeNew color="green" isStroked label="Stroked" />
|
|
99
|
-
<CpBadgeNew color="red" isStroked label="Stroked" />
|
|
100
|
-
</div>
|
|
101
|
-
`,
|
|
102
|
-
}),
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export const WithIcons: Story = {
|
|
106
|
-
render: () => ({
|
|
107
|
-
components: { CpBadgeNew },
|
|
108
|
-
template: `
|
|
109
|
-
<div style="display: flex; gap: 8px; align-items: center;">
|
|
110
|
-
<CpBadgeNew color="blue" leading-icon="check" label="Leading Icon" />
|
|
111
|
-
<CpBadgeNew color="green" trailing-icon="arrow-right" label="Trailing Icon" />
|
|
112
|
-
<CpBadgeNew color="red" leading-icon="check" trailing-icon="arrow-right" label="Both Icons" />
|
|
113
|
-
</div>
|
|
114
|
-
`,
|
|
115
|
-
}),
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export const IsClearable: Story = {
|
|
119
|
-
render: () => ({
|
|
120
|
-
components: { CpBadgeNew },
|
|
121
|
-
template: `
|
|
122
|
-
<div style="display: flex; gap: 8px; align-items: center;">
|
|
123
|
-
<CpBadgeNew color="blue" isClearable label="Clearable" />
|
|
124
|
-
<CpBadgeNew color="green" isClearable label="Clearable" />
|
|
125
|
-
<CpBadgeNew color="red" isClearable label="Clearable" />
|
|
126
|
-
</div>
|
|
127
|
-
`,
|
|
128
|
-
}),
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export const WithSlot: Story = {
|
|
132
|
-
render: () => ({
|
|
133
|
-
components: { CpBadgeNew },
|
|
134
|
-
template: `
|
|
135
|
-
<CpBadgeNew color="purple">
|
|
136
|
-
<template #leading-icon>
|
|
137
|
-
<span style="font-size: 16px; margin-right: 4px;">🌟</span>
|
|
138
|
-
</template>
|
|
139
|
-
<div>
|
|
140
|
-
Custom div inside default slot
|
|
141
|
-
</div>
|
|
142
|
-
<template #trailing-icon>
|
|
143
|
-
<span style="font-size: 16px; margin-left: 4px;">🚀</span>
|
|
144
|
-
</template>
|
|
145
|
-
</CpBadgeNew>
|
|
146
|
-
`,
|
|
147
|
-
}),
|
|
148
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|