Skip to content

fix(FieldNote): adjust layout for icon and text lockup #1961

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 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/FieldNote/FieldNote-v2.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* Fieldnote
*/
.field-note {
display: flex;
align-items: center;

font: var(--eds-theme-typography-body-sm);

color: var(--eds-theme-color-text-utility-default-secondary);
Expand Down
41 changes: 41 additions & 0 deletions src/components/InputField/InputField-v2.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,29 @@ export const Default: Story = {
},
};

/**
* Fields, when containing text, have a theme matching the rest of the interface.
*/
export const WithText: Story = {
args: {
label: 'Default input field',
fieldNote: 'This is a fieldnote.',
defaultValue: 'Text value',
},
};

/**
* Fields do not required a `fieldNote`.
*/
export const NoFieldnote: Story = {
args: {
label: 'Default input field',
},
};

/**
* Fields can have an error state.
*/
export const Error: Story = {
args: {
label: 'Error input field',
Expand All @@ -42,6 +59,9 @@ export const Error: Story = {
},
};

/**
* Fields can have a warning state.
*/
export const Warning: Story = {
args: {
label: 'Warning input field',
Expand All @@ -51,6 +71,9 @@ export const Warning: Story = {
},
};

/**
* Read-only fields can have a value and are not editable, but are different from disabled fields.
*/
export const ReadOnly: Story = {
args: {
label: 'Read-only field',
Expand All @@ -60,6 +83,9 @@ export const ReadOnly: Story = {
},
};

/**
* Fields can be marked as disabled (and contain a value in such cases).
*/
export const Disabled: Story = {
args: {
label: 'Disabled input field',
Expand All @@ -75,6 +101,9 @@ export const Disabled: Story = {
},
};

/**
* Fields can have a leading icon, indicating what kind of content can go into the field.
*/
export const LeadingIcon: Story = {
args: {
leadingIcon: 'search',
Expand All @@ -83,6 +112,9 @@ export const LeadingIcon: Story = {
},
};

/**
* Fields can be marked as required.
*/
export const Required: Story = {
args: {
label: 'Input field with fieldNote',
Expand All @@ -92,6 +124,9 @@ export const Required: Story = {
},
};

/**
* When not using a visible label with `InputField`, you must apply some time of ARIA label to the component, like `aria-label`.
*/
export const NoVisibleLabel: Story = {
args: {
'aria-label': 'Input for no visible label',
Expand All @@ -100,13 +135,19 @@ export const NoVisibleLabel: Story = {
},
};

/**
* Password fields show dots instead of characters, to help with security.
*/
export const Password: Story = {
args: {
label: 'Password',
type: 'password',
},
};

/**
* Fields can have an optional field hint added, for extra clarity.
*/
export const ShowHint: Story = {
args: {
label: 'Field with Optional Hint',
Expand Down
Loading
Loading