-
Notifications
You must be signed in to change notification settings - Fork 10
chore: Improve demo content in Text Input examples #2157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2f9a8f2
Allow typing in Text Input examples
VincentSmedinga 66455d6
Improve example values
VincentSmedinga 002cc6f
Set appropriate sizes for all examples
VincentSmedinga 0b9921e
Add type
VincentSmedinga bf14ba2
Allow typing in Field examples as well
VincentSmedinga 07e2c64
WIP Try a decorator approach
VincentSmedinga ef57fdb
Fix decorator
alimpens d0721d5
Merge branch 'develop' into chore/text-input-examples
VincentSmedinga 4fffc87
Merge branch 'develop' into chore/text-input-examples
VincentSmedinga c5c4e10
Prevent changing input values through Controls
VincentSmedinga de935bb
Revert more changes
VincentSmedinga 7a53b6c
Merge branch 'develop' into chore/text-input-examples
VincentSmedinga 6d000cd
Advise against using placeholders and remove example
VincentSmedinga 51033ee
Merge branch 'develop' into chore/text-input-examples
VincentSmedinga 22885ab
Fix Storybook control
VincentSmedinga 8a7ceac
Update and document recommended input sizes
VincentSmedinga e9ab3fe
Merge branch 'develop' into chore/text-input-examples
VincentSmedinga 3aee8fc
Merge branch 'develop' into chore/text-input-examples
alimpens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -4,13 +4,15 @@ | |
*/ | ||
|
||
import { ErrorMessage, Field, Label, Paragraph } from '@amsterdam/design-system-react' | ||
import { textInputTypes } from '@amsterdam/design-system-react/dist/TextInput/TextInput' | ||
import { TextInput } from '@amsterdam/design-system-react/src' | ||
import { Meta, StoryObj } from '@storybook/react-vite' | ||
|
||
const meta = { | ||
title: 'Components/Forms/Text Input', | ||
component: TextInput, | ||
args: { | ||
defaultValue: 'Amsterdam', | ||
disabled: false, | ||
invalid: false, | ||
}, | ||
|
@@ -28,6 +30,13 @@ const meta = { | |
control: { min: 0, type: 'number' }, | ||
description: 'The width, expressed in the average number of characters.', | ||
}, | ||
type: { | ||
control: { | ||
labels: { undefined: 'text (default)' }, | ||
type: 'radio', | ||
}, | ||
options: [undefined, ...textInputTypes.filter((type) => type !== 'text')], | ||
alimpens marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
}, | ||
} satisfies Meta<typeof TextInput> | ||
|
||
|
@@ -40,27 +49,30 @@ export const Default: Story = {} | |
export const EmailAddress: Story = { | ||
args: { | ||
defaultValue: '[email protected]', | ||
size: 30, | ||
type: 'email', | ||
}, | ||
} | ||
|
||
export const WebAddress: Story = { | ||
args: { | ||
defaultValue: 'https://designsystem.amsterdam/', | ||
size: 40, | ||
type: 'url', | ||
}, | ||
} | ||
|
||
export const PhoneNumber: Story = { | ||
args: { | ||
defaultValue: '14020', | ||
size: 15, | ||
type: 'tel', | ||
}, | ||
} | ||
|
||
export const WholeNumber: Story = { | ||
args: { | ||
defaultValue: '1', | ||
defaultValue: '20', | ||
inputMode: 'numeric', | ||
pattern: '[0-9]*', | ||
size: 5, | ||
|
@@ -70,7 +82,7 @@ export const WholeNumber: Story = { | |
|
||
export const DecimalNumber: Story = { | ||
args: { | ||
defaultValue: '1.99', | ||
defaultValue: '12.75', | ||
pattern: '[0-9.,]*', | ||
size: 5, | ||
spellCheck: false, | ||
|
@@ -79,31 +91,29 @@ export const DecimalNumber: Story = { | |
|
||
export const Size: Story = { | ||
args: { | ||
size: 10, | ||
}, | ||
} | ||
|
||
export const Placeholder: Story = { | ||
args: { | ||
placeholder: 'Placeholder text', | ||
defaultValue: '1011 PN', | ||
size: 7, | ||
}, | ||
} | ||
|
||
export const Invalid: Story = { | ||
args: { | ||
defaultValue: 'Invalid value', | ||
defaultValue: 'Deze waarde is ongeldig', | ||
invalid: true, | ||
}, | ||
} | ||
|
||
export const Disabled: Story = { | ||
args: { | ||
defaultValue: 'Disabled input', | ||
defaultValue: 'Deze waarde kan niet veranderd worden', | ||
disabled: true, | ||
}, | ||
} | ||
|
||
export const InAField: Story = { | ||
VincentSmedinga marked this conversation as resolved.
Show resolved
Hide resolved
|
||
args: { | ||
defaultValue: '', | ||
}, | ||
render: (args) => ( | ||
<Field invalid={args.invalid}> | ||
<Label htmlFor="input1">Label</Label> | ||
|
@@ -116,6 +126,7 @@ export const InAField: Story = { | |
|
||
export const InAFieldWithValidation: Story = { | ||
args: { | ||
defaultValue: '', | ||
invalid: true, | ||
}, | ||
render: (args) => ( | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.