@citizenplane/pimp 8.11.3 → 8.13.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 +0 -2
- package/dist/assets/BaseInputLabel-B6HBeOYW.css +1 -0
- package/dist/assets/BaseInputLabel-BKfOnmKd.js +1 -0
- package/dist/assets/BaseInputLabel.stories-B3jMVrza.js +28 -0
- package/dist/assets/Color-YHDXOIA2-CfioBzZb.js +1 -0
- package/dist/assets/Colors-mWZwWrlN.js +1 -0
- package/dist/assets/CpAlert-6hd7PZeZ.js +1 -0
- package/dist/assets/CpAlert-BW1Zf1Km.css +1 -0
- package/dist/assets/CpAlert.stories-CcK6sLCO.js +58 -0
- package/dist/assets/CpBadge-BRRUYYEk.js +1 -0
- package/dist/assets/CpBadge-CE420vX2.css +1 -0
- package/dist/assets/CpBadge.stories-Btggeh1U.js +170 -0
- package/dist/assets/CpButton-DQb7zTje.js +1 -0
- package/dist/assets/CpButton-gbl9KLuG.css +1 -0
- package/dist/assets/CpButton.stories-Chy_2ILm.js +86 -0
- package/dist/assets/CpCheckbox-Dalwqglu.js +1 -0
- package/dist/assets/CpCheckbox-DdQW6Gbc.css +1 -0
- package/dist/assets/CpCheckbox.stories-BEtAkjE-.js +167 -0
- package/dist/assets/CpDate-BdnXxnGQ.css +1 -0
- package/dist/assets/CpDate-DdtWXX2Q.js +3 -0
- package/dist/assets/CpDate.stories-C2Jg2QqC.js +59 -0
- package/dist/assets/CpDatepicker-DlzMF4b8.js +5 -0
- package/dist/assets/CpDatepicker-DqugfF5T.css +1 -0
- package/dist/assets/CpDatepicker.stories-CvOQvZYr.js +83 -0
- package/dist/assets/CpDialog-BTJusbSJ.js +1 -0
- package/dist/assets/CpDialog-BeuM9Ffk.css +1 -0
- package/dist/assets/CpDialog.stories-jA8uhNJR.js +43 -0
- package/dist/assets/CpHeading-BfoX1SIY.js +1 -0
- package/dist/assets/CpHeading-DgViCnDE.css +1 -0
- package/dist/assets/CpHeading.stories-DYb8vPG0.js +85 -0
- package/dist/assets/CpIcon-CdMV7BxY.css +1 -0
- package/dist/assets/CpIcon-DjtGpusx.js +5 -0
- package/dist/assets/CpIcon.stories-Cavk2BnC.js +47 -0
- package/dist/assets/CpInput-BT29xZan.js +1 -0
- package/dist/assets/CpInput-CAegPnB6.css +1 -0
- package/dist/assets/CpInput.stories-BbBe4bFT.js +98 -0
- package/dist/assets/CpLoader-B--Vqrhj.js +1 -0
- package/dist/assets/CpLoader.stories-CZ0hlfa2.js +10 -0
- package/dist/assets/CpRadio-C7OtLwPR.js +1 -0
- package/dist/assets/CpRadio-DiUdGJPg.css +1 -0
- package/dist/assets/CpRadio.stories-DPcn2bvJ.js +132 -0
- package/dist/assets/CpSelect-DlLk_-bg.js +1 -0
- package/dist/assets/CpSelect-HpT9AKcz.css +1 -0
- package/dist/assets/CpSelect.stories-C90Kd5cu.js +85 -0
- package/dist/assets/CpSelectMenu-Bpz33Tbp.js +1 -0
- package/dist/assets/CpSelectMenu-Dw4sbiEj.css +1 -0
- package/dist/assets/CpSelectMenu.stories-Bw2sNo0F.js +104 -0
- package/dist/assets/CpSwitch-CIWoB1sY.css +1 -0
- package/dist/assets/CpSwitch-CeGY7EL9.js +1 -0
- package/dist/assets/CpSwitch.stories-DbepH0R0.js +132 -0
- package/dist/assets/CpTable-BN6Amfsc.css +1 -0
- package/dist/assets/CpTable-RA2YDd8h.js +1 -0
- package/dist/assets/CpTable.stories-Dgc6tAkl.js +151 -0
- package/dist/assets/CpTableEmptyState-DLgi2hhT.css +1 -0
- package/dist/assets/CpTableEmptyState-TCjommO_.js +1 -0
- package/dist/assets/CpTableEmptyState.stories-C2oOfeda.js +20 -0
- package/dist/assets/CpTextarea-CzC-Bjsy.css +1 -0
- package/dist/assets/CpTextarea-HUf2FbPC.js +1 -0
- package/dist/assets/CpTextarea.stories-_17UyFSg.js +64 -0
- package/dist/assets/CpToaster-BXpKEwda.css +1 -0
- package/dist/assets/CpToaster-D9ITJUky.js +1 -0
- package/dist/assets/CpToaster.stories-BhEsau9e.js +124 -0
- package/dist/assets/CpTooltip-BIIOHaoi.css +1 -0
- package/dist/assets/CpTooltip-CD0Q4ym2.js +1 -0
- package/dist/assets/CpTooltip.stories-acOxur2H.js +121 -0
- package/dist/assets/DocsRenderer-CFRXHY34-Do1gGJEp.js +623 -0
- package/dist/assets/Intent-UfUixXOL.js +1 -0
- package/dist/assets/ToggleColors-CSr2zujL.js +1 -0
- package/dist/assets/TransitionExpand-BHMSqajW.css +1 -0
- package/dist/assets/TransitionExpand-BLDnMZa8.js +1 -0
- package/dist/assets/TransitionExpand.stories-5x0MQdG_.js +121 -0
- package/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/dist/assets/_plugin-vue_export-helper-DlAUqK2U.js +1 -0
- package/dist/assets/anime.esm-RriTVqCw.js +8 -0
- package/dist/assets/entry-preview-CE4fSG5C.js +1 -0
- package/dist/assets/entry-preview-docs-DMfJ0ifx.js +16 -0
- package/dist/assets/iframe-DLKLJnYS.js +211 -0
- package/dist/assets/index-Bx-go_-4.js +8 -0
- package/dist/assets/index-CtrtR6PF.js +1 -0
- package/dist/assets/index-DCv8Njl6.js +1 -0
- package/dist/assets/index-DrFu-skq.js +6 -0
- package/dist/assets/preview-B8lJiyuQ.js +34 -0
- package/dist/assets/preview-BBWR9nbA.js +1 -0
- package/dist/assets/preview-BWzBA1C2.js +396 -0
- package/dist/assets/preview-CHl-kSbv.js +2 -0
- package/dist/assets/preview-CIuMKJn5.js +240 -0
- package/dist/assets/preview-CvbIS5ZJ.js +1 -0
- package/dist/assets/preview-D2UkcbT2.js +3 -0
- package/dist/assets/preview-DD_OYowb.js +1 -0
- package/dist/assets/preview-DGUiP6tS.js +7 -0
- package/dist/assets/preview-OgCpecWL.css +1 -0
- package/dist/assets/vue.esm-bundler-DmHyoj4Y.js +36 -0
- package/dist/favicon.svg +1 -0
- package/dist/iframe.html +666 -0
- package/dist/index.html +177 -0
- package/dist/index.json +1 -0
- package/dist/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/nunito-sans-bold.woff2 +0 -0
- package/dist/nunito-sans-italic.woff2 +0 -0
- package/dist/nunito-sans-regular.woff2 +0 -0
- package/dist/project.json +1 -0
- package/dist/sb-addons/chromatic-com-storybook-9/manager-bundle.js +331 -0
- package/dist/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +51 -0
- package/dist/sb-addons/essentials-actions-2/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js +12 -0
- package/dist/sb-addons/essentials-controls-1/manager-bundle.js +402 -0
- package/dist/sb-addons/essentials-docs-3/manager-bundle.js +242 -0
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js +3 -0
- package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
- package/dist/sb-addons/storybook-experimental-addon-test-10/manager-bundle.js +223 -0
- package/dist/sb-common-assets/favicon.svg +1 -0
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/globals-module-info.js +1052 -0
- package/dist/sb-manager/globals-runtime.js +42127 -0
- package/dist/sb-manager/globals.js +48 -0
- package/dist/sb-manager/runtime.js +12048 -0
- package/package.json +24 -5
- package/src/README.md +0 -25
- package/src/assets/styles/base/_base.scss +1 -5
- package/src/assets/styles/utilities/_index.scss +19 -0
- package/src/components/core/BaseInputLabel.vue +0 -1
- package/src/components/date-pickers/CpDate.vue +8 -5
- package/src/components/inputs/CpInput.vue +5 -16
- package/src/components/inputs/CpTextarea.vue +4 -6
- package/src/components/selects/CpSelect.vue +5 -5
- package/src/stories/BaseInputLabel.stories.ts +35 -0
- package/src/stories/CpAlert.stories.ts +90 -0
- package/src/stories/CpBadge.stories.ts +158 -0
- package/src/stories/CpButton.stories.ts +134 -0
- package/src/stories/CpCheckbox.stories.ts +184 -0
- package/src/stories/CpDate.stories.ts +110 -0
- package/src/stories/CpDatepicker.stories.ts +162 -0
- package/src/stories/CpDialog.stories.ts +53 -0
- package/src/stories/CpHeading.stories.ts +77 -0
- package/src/stories/CpIcon.stories.ts +79 -0
- package/src/stories/CpInput.stories.ts +155 -0
- package/src/stories/CpLoader.stories.ts +29 -0
- package/src/stories/CpRadio.stories.ts +139 -0
- package/src/stories/CpSelect.stories.ts +147 -0
- package/src/stories/CpSelectMenu.stories.ts +132 -0
- package/src/stories/CpSwitch.stories.ts +137 -0
- package/src/stories/CpTable.stories.ts +192 -0
- package/src/stories/CpTableEmptyState.stories.ts +34 -0
- package/src/stories/CpTextarea.stories.ts +112 -0
- package/src/stories/CpToaster.stories.ts +147 -0
- package/src/stories/CpTooltip.stories.ts +101 -0
- package/src/stories/TransitionExpand.stories.ts +85 -0
- package/vitest.workspace.js +31 -0
- package/dist/pimp.es.js +0 -14987
- package/dist/pimp.umd.js +0 -12
- package/dist/style.css +0 -1
- package/src/App.vue +0 -110
- package/src/components/core/playground-sections/SectionAtomicElements.vue +0 -83
- package/src/components/core/playground-sections/SectionButtons.vue +0 -142
- package/src/components/core/playground-sections/SectionContainer.vue +0 -50
- package/src/components/core/playground-sections/SectionDatePickers.vue +0 -160
- package/src/components/core/playground-sections/SectionDialog.vue +0 -47
- package/src/components/core/playground-sections/SectionFeedbackIndicators.vue +0 -47
- package/src/components/core/playground-sections/SectionInputs.vue +0 -46
- package/src/components/core/playground-sections/SectionListsAndTables.vue +0 -268
- package/src/components/core/playground-sections/SectionSelectMenus.vue +0 -98
- package/src/components/core/playground-sections/SectionSelects.vue +0 -120
- package/src/components/core/playground-sections/SectionSimpleInputs.vue +0 -305
- package/src/components/core/playground-sections/SectionToasters.vue +0 -68
- package/src/components/core/playground-sections/SectionToggles.vue +0 -158
- package/src/components/core/playground-sections/SectionTypography.vue +0 -40
- package/src/main.js +0 -15
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
|
|
3
|
+
import CpButton from '@/components/buttons/CpButton.vue'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'CpButton',
|
|
7
|
+
component: CpButton,
|
|
8
|
+
argTypes: {
|
|
9
|
+
appearance: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: ['default', 'primary', 'minimal'],
|
|
12
|
+
description: 'The visual style of the button',
|
|
13
|
+
},
|
|
14
|
+
color: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: ['Blue', 'Purple', 'Green', 'Orange', 'Red'],
|
|
17
|
+
description: 'The color variant of the button',
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
control: 'boolean',
|
|
21
|
+
description: 'Whether the button is disabled',
|
|
22
|
+
},
|
|
23
|
+
tag: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['button', 'a'],
|
|
26
|
+
description: 'The HTML element to render',
|
|
27
|
+
},
|
|
28
|
+
type: {
|
|
29
|
+
control: 'select',
|
|
30
|
+
options: ['button', 'submit', 'reset'],
|
|
31
|
+
description: 'The type of button',
|
|
32
|
+
},
|
|
33
|
+
isLoading: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Whether the button is in loading state',
|
|
36
|
+
},
|
|
37
|
+
isSquare: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Whether the button has square corners',
|
|
40
|
+
},
|
|
41
|
+
isLarge: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
description: 'Whether the button is large size',
|
|
44
|
+
},
|
|
45
|
+
onClick: { action: 'clicked' },
|
|
46
|
+
},
|
|
47
|
+
} satisfies Meta<typeof CpButton>
|
|
48
|
+
|
|
49
|
+
export default meta
|
|
50
|
+
type Story = StoryObj<typeof meta>
|
|
51
|
+
|
|
52
|
+
const defaultTemplate = '<CpButton v-bind="args">Button</CpButton>'
|
|
53
|
+
const defaultRender = (args) => ({
|
|
54
|
+
components: { CpButton },
|
|
55
|
+
setup() {
|
|
56
|
+
return { args }
|
|
57
|
+
},
|
|
58
|
+
template: defaultTemplate,
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
export const Default: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
appearance: 'default',
|
|
64
|
+
color: 'purple',
|
|
65
|
+
disabled: false,
|
|
66
|
+
tag: 'button',
|
|
67
|
+
type: 'button',
|
|
68
|
+
isLoading: false,
|
|
69
|
+
isSquare: false,
|
|
70
|
+
isLarge: false,
|
|
71
|
+
},
|
|
72
|
+
render: defaultRender,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const Primary: Story = {
|
|
76
|
+
args: {
|
|
77
|
+
...Default.args,
|
|
78
|
+
appearance: 'primary',
|
|
79
|
+
color: 'Purple',
|
|
80
|
+
},
|
|
81
|
+
render: defaultRender,
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const Minimal: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
...Default.args,
|
|
87
|
+
appearance: 'minimal',
|
|
88
|
+
color: 'Blue',
|
|
89
|
+
},
|
|
90
|
+
render: defaultRender,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const WithIcons: Story = {
|
|
94
|
+
args: {
|
|
95
|
+
...Default.args,
|
|
96
|
+
appearance: 'primary',
|
|
97
|
+
color: 'Purple',
|
|
98
|
+
},
|
|
99
|
+
render: (args) => ({
|
|
100
|
+
components: { CpButton },
|
|
101
|
+
setup: () => ({ args }),
|
|
102
|
+
template: `
|
|
103
|
+
<CpButton v-bind="args">
|
|
104
|
+
<template #icon-before>
|
|
105
|
+
<CpIcon type="arrow-left" />
|
|
106
|
+
</template>
|
|
107
|
+
Button with Icon
|
|
108
|
+
<template #icon-after>
|
|
109
|
+
<CpIcon type="arrow-right" />
|
|
110
|
+
</template>
|
|
111
|
+
</CpButton>
|
|
112
|
+
`,
|
|
113
|
+
}),
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const Loading: Story = {
|
|
117
|
+
args: { ...Default.args, isLoading: true },
|
|
118
|
+
render: defaultRender,
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const Disabled: Story = {
|
|
122
|
+
args: { ...Default.args, disabled: true },
|
|
123
|
+
render: defaultRender,
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const Large: Story = {
|
|
127
|
+
args: { ...Default.args, isLarge: true },
|
|
128
|
+
render: defaultRender,
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const Square: Story = {
|
|
132
|
+
args: { ...Default.args, isSquare: true },
|
|
133
|
+
render: defaultRender,
|
|
134
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import CpCheckbox from '@/components/toggles/CpCheckbox.vue'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'CpCheckbox',
|
|
7
|
+
component: CpCheckbox,
|
|
8
|
+
argTypes: {
|
|
9
|
+
modelValue: {
|
|
10
|
+
control: 'boolean',
|
|
11
|
+
description: 'The checkbox value',
|
|
12
|
+
},
|
|
13
|
+
checkboxValue: {
|
|
14
|
+
control: 'text',
|
|
15
|
+
description: 'Value when used in a group',
|
|
16
|
+
},
|
|
17
|
+
checkboxLabel: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Label text for the checkbox',
|
|
20
|
+
},
|
|
21
|
+
isDisabled: {
|
|
22
|
+
control: 'boolean',
|
|
23
|
+
description: 'Whether the checkbox is disabled',
|
|
24
|
+
},
|
|
25
|
+
groupName: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Name attribute for checkbox group',
|
|
28
|
+
},
|
|
29
|
+
capitalizeLabel: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
description: 'Whether to capitalize the first letter of the label',
|
|
32
|
+
},
|
|
33
|
+
color: {
|
|
34
|
+
control: 'select',
|
|
35
|
+
options: ['blue', 'purple'],
|
|
36
|
+
description: 'Color variant of the checkbox',
|
|
37
|
+
},
|
|
38
|
+
reverseLabel: {
|
|
39
|
+
control: 'boolean',
|
|
40
|
+
description: 'Whether to show label before the checkbox',
|
|
41
|
+
},
|
|
42
|
+
autofocus: {
|
|
43
|
+
control: 'boolean',
|
|
44
|
+
description: 'Whether to autofocus the checkbox',
|
|
45
|
+
},
|
|
46
|
+
helper: {
|
|
47
|
+
control: 'text',
|
|
48
|
+
description: 'Helper text to display below the label',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
} satisfies Meta<typeof CpCheckbox>
|
|
52
|
+
|
|
53
|
+
export default meta
|
|
54
|
+
type Story = StoryObj<typeof meta>
|
|
55
|
+
|
|
56
|
+
export const Default: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
checkboxLabel: 'Checkbox Label',
|
|
59
|
+
modelValue: false,
|
|
60
|
+
isDisabled: false,
|
|
61
|
+
capitalizeLabel: true,
|
|
62
|
+
color: 'blue',
|
|
63
|
+
reverseLabel: false,
|
|
64
|
+
autofocus: false,
|
|
65
|
+
helper: '',
|
|
66
|
+
},
|
|
67
|
+
render: (args) => ({
|
|
68
|
+
components: { CpCheckbox },
|
|
69
|
+
setup() {
|
|
70
|
+
const value = ref(args.modelValue)
|
|
71
|
+
return { args, value }
|
|
72
|
+
},
|
|
73
|
+
template: `
|
|
74
|
+
<div style="padding: 20px;">
|
|
75
|
+
<CpCheckbox
|
|
76
|
+
v-model="value"
|
|
77
|
+
v-bind="args"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
`,
|
|
81
|
+
}),
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const Checked: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
...Default.args,
|
|
87
|
+
modelValue: true,
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const Disabled: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
...Default.args,
|
|
94
|
+
isDisabled: true,
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const WithHelper: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
...Default.args,
|
|
101
|
+
helper: 'This is a helper text that provides additional information',
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const Purple: Story = {
|
|
106
|
+
args: {
|
|
107
|
+
...Default.args,
|
|
108
|
+
color: 'purple',
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const Reversed: Story = {
|
|
113
|
+
args: {
|
|
114
|
+
...Default.args,
|
|
115
|
+
reverseLabel: true,
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const WithoutCapitalization: Story = {
|
|
120
|
+
args: {
|
|
121
|
+
...Default.args,
|
|
122
|
+
capitalizeLabel: false,
|
|
123
|
+
checkboxLabel: 'checkbox label',
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export const CheckboxGroup: Story = {
|
|
128
|
+
render: () => ({
|
|
129
|
+
components: { CpCheckbox },
|
|
130
|
+
setup() {
|
|
131
|
+
const selectedValues = ref(['option1'])
|
|
132
|
+
return { selectedValues }
|
|
133
|
+
},
|
|
134
|
+
template: `
|
|
135
|
+
<div style="padding: 20px; display: flex; flex-direction: column; gap: 12px;">
|
|
136
|
+
<CpCheckbox
|
|
137
|
+
v-model="selectedValues"
|
|
138
|
+
checkbox-value="option1"
|
|
139
|
+
checkbox-label="Option 1"
|
|
140
|
+
group-name="group1"
|
|
141
|
+
/>
|
|
142
|
+
<CpCheckbox
|
|
143
|
+
v-model="selectedValues"
|
|
144
|
+
checkbox-value="option2"
|
|
145
|
+
checkbox-label="Option 2"
|
|
146
|
+
group-name="group1"
|
|
147
|
+
/>
|
|
148
|
+
<CpCheckbox
|
|
149
|
+
v-model="selectedValues"
|
|
150
|
+
checkbox-value="option3"
|
|
151
|
+
checkbox-label="Option 3"
|
|
152
|
+
group-name="group1"
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
`,
|
|
156
|
+
}),
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export const CustomContent: Story = {
|
|
160
|
+
args: {
|
|
161
|
+
...Default.args,
|
|
162
|
+
checkboxLabel: '',
|
|
163
|
+
},
|
|
164
|
+
render: (args) => ({
|
|
165
|
+
components: { CpCheckbox },
|
|
166
|
+
setup() {
|
|
167
|
+
const value = ref(args.modelValue)
|
|
168
|
+
return { args, value }
|
|
169
|
+
},
|
|
170
|
+
template: `
|
|
171
|
+
<div style="padding: 20px;">
|
|
172
|
+
<CpCheckbox
|
|
173
|
+
v-model="value"
|
|
174
|
+
v-bind="args"
|
|
175
|
+
>
|
|
176
|
+
<div style="display: flex; flex-direction: column; gap: 4px;">
|
|
177
|
+
<span style="font-weight: 500;">Custom Content</span>
|
|
178
|
+
<span style="font-size: 14px; color: #666;">With multiple lines and styling</span>
|
|
179
|
+
</div>
|
|
180
|
+
</CpCheckbox>
|
|
181
|
+
</div>
|
|
182
|
+
`,
|
|
183
|
+
}),
|
|
184
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import CpDate from '@/components/date-pickers/CpDate.vue'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'CpDate',
|
|
7
|
+
component: CpDate,
|
|
8
|
+
argTypes: {
|
|
9
|
+
modelValue: {
|
|
10
|
+
control: 'text',
|
|
11
|
+
description: 'The date value (ISO format)',
|
|
12
|
+
},
|
|
13
|
+
label: {
|
|
14
|
+
control: 'text',
|
|
15
|
+
description: 'Label text for the date input',
|
|
16
|
+
},
|
|
17
|
+
required: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
description: 'Whether the field is required',
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
control: 'boolean',
|
|
23
|
+
description: 'Whether the field is disabled',
|
|
24
|
+
},
|
|
25
|
+
isInvalid: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Whether the field is in an invalid state',
|
|
28
|
+
},
|
|
29
|
+
errorMessage: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Custom error message to display',
|
|
32
|
+
},
|
|
33
|
+
displayErrorMessage: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Whether to display error messages',
|
|
36
|
+
},
|
|
37
|
+
autocompleteBirthday: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Whether to enable birthday autocomplete',
|
|
40
|
+
},
|
|
41
|
+
locale: {
|
|
42
|
+
control: 'text',
|
|
43
|
+
description: 'Locale for date formatting',
|
|
44
|
+
},
|
|
45
|
+
minDate: {
|
|
46
|
+
control: 'text',
|
|
47
|
+
description: 'Minimum allowed date',
|
|
48
|
+
},
|
|
49
|
+
maxDate: {
|
|
50
|
+
control: 'text',
|
|
51
|
+
description: 'Maximum allowed date',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
} satisfies Meta<typeof CpDate>
|
|
55
|
+
|
|
56
|
+
export default meta
|
|
57
|
+
type Story = StoryObj<typeof meta>
|
|
58
|
+
|
|
59
|
+
export const Default: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
label: 'Date',
|
|
62
|
+
required: false,
|
|
63
|
+
disabled: false,
|
|
64
|
+
isInvalid: false,
|
|
65
|
+
displayErrorMessage: true,
|
|
66
|
+
},
|
|
67
|
+
render: (args) => ({
|
|
68
|
+
components: { CpDate },
|
|
69
|
+
setup() {
|
|
70
|
+
const date = ref('')
|
|
71
|
+
return { args, date }
|
|
72
|
+
},
|
|
73
|
+
template: `
|
|
74
|
+
<div style="max-width: 400px; padding: 20px;">
|
|
75
|
+
<CpDate
|
|
76
|
+
v-model="date"
|
|
77
|
+
v-bind="args"
|
|
78
|
+
@on-validation="(isValid) => console.log('Validation:', isValid)"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
`,
|
|
82
|
+
}),
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const Required: Story = {
|
|
86
|
+
args: {
|
|
87
|
+
...Default.args,
|
|
88
|
+
label: 'Required Date',
|
|
89
|
+
required: true,
|
|
90
|
+
displayErrorMessage: false,
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const WithError: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
...Default.args,
|
|
97
|
+
label: 'Date with Error',
|
|
98
|
+
isInvalid: true,
|
|
99
|
+
required: true,
|
|
100
|
+
errorMessage: 'Please enter a valid date',
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const Disabled: Story = {
|
|
105
|
+
args: {
|
|
106
|
+
...Default.args,
|
|
107
|
+
label: 'Disabled Date',
|
|
108
|
+
disabled: true,
|
|
109
|
+
},
|
|
110
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import CpDatepicker from '@/components/date-pickers/CpDatepicker.vue'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'CpDatepicker',
|
|
7
|
+
component: CpDatepicker,
|
|
8
|
+
|
|
9
|
+
argTypes: {
|
|
10
|
+
mode: {
|
|
11
|
+
control: 'select',
|
|
12
|
+
options: ['single', 'range'],
|
|
13
|
+
description: 'Selection mode: single date or date range',
|
|
14
|
+
},
|
|
15
|
+
closeAfterSelect: {
|
|
16
|
+
control: 'boolean',
|
|
17
|
+
description: 'Whether to close the picker after selection',
|
|
18
|
+
},
|
|
19
|
+
label: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
description: 'Label text for the datepicker',
|
|
22
|
+
},
|
|
23
|
+
placeholder: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Placeholder text for the input',
|
|
26
|
+
},
|
|
27
|
+
isError: {
|
|
28
|
+
control: 'boolean',
|
|
29
|
+
description: 'Whether the field is in an invalid state',
|
|
30
|
+
},
|
|
31
|
+
errorMessage: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
description: 'Custom error message to display',
|
|
34
|
+
},
|
|
35
|
+
initDateOne: {
|
|
36
|
+
control: 'text',
|
|
37
|
+
description: 'Initial first date (YYYY-MM-DD)',
|
|
38
|
+
},
|
|
39
|
+
initDateTwo: {
|
|
40
|
+
control: 'text',
|
|
41
|
+
description: 'Initial second date for range mode (YYYY-MM-DD)',
|
|
42
|
+
},
|
|
43
|
+
minDate: {
|
|
44
|
+
control: 'text',
|
|
45
|
+
description: 'Minimum allowed date',
|
|
46
|
+
},
|
|
47
|
+
maxDate: {
|
|
48
|
+
control: 'text',
|
|
49
|
+
description: 'Maximum allowed date',
|
|
50
|
+
},
|
|
51
|
+
allowPastDates: {
|
|
52
|
+
control: 'boolean',
|
|
53
|
+
description: 'Whether to allow selecting past dates',
|
|
54
|
+
},
|
|
55
|
+
isInline: {
|
|
56
|
+
control: 'boolean',
|
|
57
|
+
description: 'Whether to display the picker inline',
|
|
58
|
+
},
|
|
59
|
+
singleMonth: {
|
|
60
|
+
control: 'boolean',
|
|
61
|
+
description: 'Whether to show only one month',
|
|
62
|
+
},
|
|
63
|
+
locale: {
|
|
64
|
+
control: 'text',
|
|
65
|
+
description: 'Locale for date formatting',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
} satisfies Meta<typeof CpDatepicker>
|
|
69
|
+
|
|
70
|
+
export default meta
|
|
71
|
+
type Story = StoryObj<typeof meta>
|
|
72
|
+
|
|
73
|
+
const defaultTemplate = `
|
|
74
|
+
<div style="height: 35vh; max-width: 600px; padding: 20px;">
|
|
75
|
+
<CpDatepicker
|
|
76
|
+
v-bind="args"
|
|
77
|
+
@dates="(selectedDates) => dates = selectedDates"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
`
|
|
81
|
+
|
|
82
|
+
export const Default: Story = {
|
|
83
|
+
args: {
|
|
84
|
+
mode: 'single',
|
|
85
|
+
label: 'Select Date',
|
|
86
|
+
placeholder: 'Choose a date',
|
|
87
|
+
closeAfterSelect: true,
|
|
88
|
+
allowPastDates: false,
|
|
89
|
+
isInline: false,
|
|
90
|
+
singleMonth: false,
|
|
91
|
+
},
|
|
92
|
+
render: (args) => ({
|
|
93
|
+
components: { CpDatepicker },
|
|
94
|
+
setup() {
|
|
95
|
+
const dates = ref([])
|
|
96
|
+
return { args, dates }
|
|
97
|
+
},
|
|
98
|
+
template: defaultTemplate,
|
|
99
|
+
}),
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const DateRange: Story = {
|
|
103
|
+
args: {
|
|
104
|
+
...Default.args,
|
|
105
|
+
mode: 'range',
|
|
106
|
+
label: 'Select Date Range',
|
|
107
|
+
placeholder: 'Choose date range',
|
|
108
|
+
},
|
|
109
|
+
render: (args) => ({
|
|
110
|
+
...Default.render(args),
|
|
111
|
+
template: defaultTemplate,
|
|
112
|
+
}),
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const WithError: Story = {
|
|
116
|
+
args: {
|
|
117
|
+
...Default.args,
|
|
118
|
+
label: 'Datepicker with Error',
|
|
119
|
+
isError: true,
|
|
120
|
+
errorMessage: 'Please select a valid date',
|
|
121
|
+
},
|
|
122
|
+
render: (args) => ({
|
|
123
|
+
...Default.render(args),
|
|
124
|
+
template: defaultTemplate,
|
|
125
|
+
}),
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const WithInitialDates: Story = {
|
|
129
|
+
args: {
|
|
130
|
+
...Default.args,
|
|
131
|
+
initDateOne: '2024-03-15',
|
|
132
|
+
label: 'Datepicker with Initial Date',
|
|
133
|
+
},
|
|
134
|
+
render: (args) => ({
|
|
135
|
+
...Default.render(args),
|
|
136
|
+
template: defaultTemplate,
|
|
137
|
+
}),
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const SingleMonth: Story = {
|
|
141
|
+
args: {
|
|
142
|
+
...Default.args,
|
|
143
|
+
singleMonth: true,
|
|
144
|
+
label: 'Single Month View',
|
|
145
|
+
},
|
|
146
|
+
render: (args) => ({
|
|
147
|
+
...Default.render(args),
|
|
148
|
+
template: defaultTemplate,
|
|
149
|
+
}),
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export const AllowPastDates: Story = {
|
|
153
|
+
args: {
|
|
154
|
+
...Default.args,
|
|
155
|
+
allowPastDates: true,
|
|
156
|
+
label: 'Allow Past Dates',
|
|
157
|
+
},
|
|
158
|
+
render: (args) => ({
|
|
159
|
+
...Default.render(args),
|
|
160
|
+
template: defaultTemplate,
|
|
161
|
+
}),
|
|
162
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import CpDialog from '@/components/atomic-elements/CpDialog.vue'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'CpDialog',
|
|
8
|
+
component: CpDialog,
|
|
9
|
+
argTypes: {
|
|
10
|
+
maxWidth: {
|
|
11
|
+
control: 'number',
|
|
12
|
+
description: 'The maximum width of the dialog',
|
|
13
|
+
},
|
|
14
|
+
onClose: { action: 'closed' },
|
|
15
|
+
},
|
|
16
|
+
parameters: {
|
|
17
|
+
styles: {
|
|
18
|
+
'.header': {
|
|
19
|
+
color: 'red',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} satisfies Meta<typeof CpDialog>
|
|
24
|
+
|
|
25
|
+
export default meta
|
|
26
|
+
type Story = StoryObj<typeof meta>
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
maxWidth: 600,
|
|
31
|
+
},
|
|
32
|
+
render: (args) => ({
|
|
33
|
+
setup() {
|
|
34
|
+
const isOpen = ref(false)
|
|
35
|
+
return { args, isOpen }
|
|
36
|
+
},
|
|
37
|
+
template: `
|
|
38
|
+
<CpButton @click="isOpen = true">Open Dialog</CpButton>
|
|
39
|
+
<CpDialogWrapper>
|
|
40
|
+
<CpDialog v-bind="args" v-if="isOpen" @close="isOpen = false">
|
|
41
|
+
<template #header>
|
|
42
|
+
<h1 style="padding: 16px 24px">Header slot</h1>
|
|
43
|
+
</template>
|
|
44
|
+
<p style="padding: 16px 24px">This is the default slot content. You can put any content here.</p>
|
|
45
|
+
<template #footer>
|
|
46
|
+
<CpButton @click="isOpen = false">Cancel</CpButton>
|
|
47
|
+
This is the footer slot
|
|
48
|
+
</template>
|
|
49
|
+
</CpDialog>
|
|
50
|
+
</CpDialogWrapper>
|
|
51
|
+
`,
|
|
52
|
+
}),
|
|
53
|
+
}
|