-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
85 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,61 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { fn } from '@storybook/test'; | ||
import {PasswordInput} from "../module/PasswordInput.tsx"; | ||
|
||
import { PasswordInput } from '../module/PasswordInput.tsx'; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export | ||
const meta = { | ||
title: 'Example/PasswordInput', | ||
component: PasswordInput, | ||
parameters: { | ||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout | ||
name: 'input_name', | ||
}, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ['autodocs'], | ||
// More on argTypes: https://storybook.js.org/docs/api/argtypes | ||
argTypes: { | ||
}, | ||
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args | ||
args: { register: fn() }, | ||
title: 'Example/PasswordInput', | ||
component: PasswordInput, | ||
parameters: { | ||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout | ||
name: 'input_name', | ||
}, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ['autodocs'], | ||
// More on argTypes: https://storybook.js.org/docs/api/argtypes | ||
argTypes: {}, | ||
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args | ||
args: { register: fn() }, | ||
} satisfies Meta<typeof PasswordInput>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args | ||
export const Primary: Story = { | ||
args: { | ||
name: 'input_name', | ||
}, | ||
args: { | ||
name: 'input_name', | ||
}, | ||
}; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args | ||
export const Localization: Story = { | ||
args: { | ||
name: 'input_name', | ||
passwordText: 'Contraseña', | ||
confirmText: 'Confirmar Contraseña', | ||
export const Errors: Story = { | ||
args: { | ||
name: 'input_name', | ||
passwordValue: ' ', | ||
confirmValue: ' z', | ||
auto: true, | ||
}, | ||
}; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args | ||
export const Localization: Story = { | ||
args: { | ||
name: 'input_name', | ||
passwordValue: ' ', | ||
confirmValue: ' z', | ||
labels: { | ||
passwordText: 'Contraseña', | ||
confirmText: 'Confirmar Contraseña', | ||
errors: { | ||
REQUIRED_UPPERCASE: 'La contraseña requiere al menos 1 carácter en mayúscula', | ||
REQUIRED_LOWERCASE: 'La contraseña requiere al menos 1 carácter en minúscula', | ||
REQUIRED_LENGTH: 'La contraseña requiere al menos 6 caracteres', | ||
REQUIRED_NUMBER: 'La contraseña requiere al menos 1 número', | ||
REQUIRED_SPECIAL: 'La contraseña requiere al menos 1 carácter especial (!@#$%^&*()_-+={[}]|:;"\'<,>.)', | ||
REQUIRED_MATCH: 'La contraseña debe coincidir', | ||
}, | ||
}, | ||
auto: true, | ||
}, | ||
}; |