import type { Meta, StoryObj } from '@storybook/vue3'
import DiacriticPicker from './DiacriticPicker.vue'
import { VTextField, VTextarea } from 'vuetify/components'
import { ref } from 'vue'
const meta = {
title: 'Composants/Formulaires/DiacriticPicker',
component: DiacriticPicker,
decorators: [
() => ({
template: '
',
}),
],
parameters: {
layout: 'fullscreen',
controls: { exclude: ['modelValue'] },
},
argTypes: {
modelValue: {
control: 'text',
description: 'Valeur du champ',
},
btnTitle: {
control: 'text',
description: 'Texte du bouton d\'ouverture',
},
diacritics: {
control: 'object',
description: 'Liste des caractères diacritiques',
},
vuetifyOptions: {
control: 'object',
description: 'Options de personnalisation Vuetify',
},
},
} satisfies Meta
export default meta
type Story = StoryObj
export const Default: Story = {
parameters: {
sourceCode: [
{
name: 'Template',
code: `
`,
},
{
name: 'Script',
code: ``,
},
],
},
args: {
modelValue: '',
btnTitle: 'éÉ',
diacritics: [
'é', 'è', 'ê', 'ë',
'à', 'â', 'ä', 'æ',
'î', 'ï',
'ô', 'ö', 'œ',
'ù', 'û', 'ü',
'ÿ',
'ç',
],
vuetifyOptions: {
btn: {
color: 'primary',
size: 'small',
variant: 'tonal',
},
dialog: {
maxWidth: 400,
persistent: false,
},
},
},
render: (args) => {
return {
components: { DiacriticPicker, VTextField },
setup() {
const value = ref('')
return { args, value }
},
template: `
Valeur actuelle: {{ value }}
`,
}
},
}
export const WithTextarea: Story = {
parameters: {
sourceCode: [
{
name: 'Template',
code: `
`,
},
{
name: 'Script',
code: ``,
},
],
},
args: {
modelValue: '',
btnTitle: 'éÉ',
diacritics: [
'é', 'è', 'ê', 'ë',
'à', 'â', 'ä', 'æ',
'î', 'ï',
'ô', 'ö', 'œ',
'ù', 'û', 'ü',
'ÿ',
'ç',
],
vuetifyOptions: {
btn: {
color: 'primary',
size: 'small',
variant: 'tonal',
},
dialog: {
maxWidth: 400,
persistent: false,
},
},
},
render: (args) => {
return {
components: { DiacriticPicker, VTextarea },
setup() {
const value = ref('')
return { args, value }
},
template: `
Valeur actuelle: {{ value }}
`,
}
},
}
export const CustomDiacritics: Story = {
parameters: {
sourceCode: [
{
name: 'Template',
code: `
`,
},
{
name: 'Script',
code: ``,
},
],
},
args: {
modelValue: '',
btnTitle: 'éÉ',
diacritics: ['é', 'è', 'ê', 'à', 'ç', 'ù'],
vuetifyOptions: {
btn: {
color: 'primary',
size: 'small',
variant: 'tonal',
},
dialog: {
maxWidth: 400,
persistent: false,
},
},
},
render: (args) => {
return {
components: { DiacriticPicker, VTextField },
setup() {
const value = ref('')
return { args, value }
},
template: `
Valeur actuelle: {{ value }}
`,
}
},
}
export const CustomButtonTitle: Story = {
parameters: {
sourceCode: [
{
name: 'Template',
code: `
`,
},
{
name: 'Script',
code: ``,
},
],
},
args: {
modelValue: '',
btnTitle: 'àéç',
diacritics: [
'é', 'è', 'ê', 'ë',
'à', 'â', 'ä', 'æ',
'î', 'ï',
'ô', 'ö', 'œ',
'ù', 'û', 'ü',
'ÿ',
'ç',
],
vuetifyOptions: {
btn: {
color: 'primary',
size: 'small',
variant: 'tonal',
},
dialog: {
maxWidth: 400,
persistent: false,
},
},
},
render: (args) => {
return {
components: { DiacriticPicker, VTextField },
setup() {
const value = ref('')
return { args, value }
},
template: `
Valeur actuelle: {{ value }}
`,
}
},
}
export const Customization: Story = {
parameters: {
sourceCode: [
{
name: 'Template',
code: `
`,
},
{
name: 'Script',
code: ``,
},
],
},
args: {
modelValue: '',
btnTitle: 'éÉ',
diacritics: [
'é', 'è', 'ê', 'ë',
'à', 'â', 'ä', 'æ',
'î', 'ï',
'ô', 'ö', 'œ',
'ù', 'û', 'ü',
'ÿ',
'ç',
],
vuetifyOptions: {
btn: {
color: 'secondary',
size: 'large',
variant: 'outlined',
},
dialog: {
maxWidth: 500,
},
},
},
render: (args) => {
return {
components: { DiacriticPicker, VTextField },
setup() {
const value = ref('')
return { args, value }
},
template: `
Valeur actuelle: {{ value }}
`,
}
},
}