diff --git a/src/ComboBox/ComboBox.stories.js b/src/ComboBox/ComboBox.stories.js index f16ef26b..ec2ae05c 100644 --- a/src/ComboBox/ComboBox.stories.js +++ b/src/ComboBox/ComboBox.stories.js @@ -15,6 +15,7 @@ export const Default = () => ({ size: select("Field size (size)", sizes, ""), placeholder: text("Placeholder text (placeholder)", "Filter..."), titleText: text("Title (titleText)", "Combobox title"), + helperText: text("Helper text (helperText)", "Optional helper text here"), light: boolean("Light (light)", false), disabled: boolean("Disabled (disabled)", false), invalid: boolean("Invalid (invalid)", false), diff --git a/src/ComboBox/ComboBox.svelte b/src/ComboBox/ComboBox.svelte index e131a601..326bbf54 100644 --- a/src/ComboBox/ComboBox.svelte +++ b/src/ComboBox/ComboBox.svelte @@ -187,13 +187,6 @@ {titleText} {/if} - {#if helperText} -
- {helperText} -
- {/if} {/if} + {#if !invalid && helperText} +
+ {helperText} +
+ {/if} diff --git a/src/Dropdown/Dropdown.stories.js b/src/Dropdown/Dropdown.stories.js index 29ae9b30..74467716 100644 --- a/src/Dropdown/Dropdown.stories.js +++ b/src/Dropdown/Dropdown.stories.js @@ -26,6 +26,7 @@ export const Default = () => ({ disabled: boolean("Disabled (disabled)", false), light: boolean("Light variant (light)", false), titleText: text("Title (titleText)", "This is not a dropdown title."), + helperText: text("Helper text (helperText)", "Optional helper text here"), invalid: boolean("Show form validation UI (invalid)", false), invalidText: text( "Form validation UI content (invalidText)", diff --git a/src/Dropdown/Dropdown.svelte b/src/Dropdown/Dropdown.svelte index 7fdb84f7..d7df5479 100644 --- a/src/Dropdown/Dropdown.svelte +++ b/src/Dropdown/Dropdown.svelte @@ -166,13 +166,6 @@ {titleText} {/if} - {#if !inline && helperText} -
- {helperText} -
- {/if} {/if} + {#if !inline && !invalid && helperText} +
+ {helperText} +
+ {/if} diff --git a/src/MultiSelect/MultiSelect.stories.js b/src/MultiSelect/MultiSelect.stories.js index d0d99cd0..7fe179be 100644 --- a/src/MultiSelect/MultiSelect.stories.js +++ b/src/MultiSelect/MultiSelect.stories.js @@ -20,6 +20,7 @@ export const Default = () => ({ id: text("MultiSelect id", "multi-select-id"), name: text("MultiSelect name", "multi-select-name"), titleText: text("Title (titleText)", "Multiselect Title"), + helperText: text("Helper text (helperText)", "Optional helper text here"), filterable: boolean("Filterable (filterable)", false), selectionFeedback: select( "Selection feedback (selectionFeedback)", diff --git a/src/MultiSelect/MultiSelect.svelte b/src/MultiSelect/MultiSelect.svelte index bcb96a35..a22f7e7e 100644 --- a/src/MultiSelect/MultiSelect.svelte +++ b/src/MultiSelect/MultiSelect.svelte @@ -268,13 +268,6 @@ {titleText} {/if} - {#if !inline && helperText} -
- {helperText} -
- {/if} {/if} + {#if !inline && !invalid && helperText} +
+ {helperText} +
+ {/if} diff --git a/src/NumberInput/NumberInput.stories.js b/src/NumberInput/NumberInput.stories.js index 5af385ff..212384c9 100644 --- a/src/NumberInput/NumberInput.stories.js +++ b/src/NumberInput/NumberInput.stories.js @@ -30,6 +30,7 @@ export const Default = () => ({ disabled: boolean("Disabled (disabled)", false), readonly: boolean("Read only (readonly)", false), invalid: boolean("Show form validation UI (invalid)", false), + helperText: text("Helper text (helperText)", "Optional helper text here"), mobile: boolean("Mobile variant (mobile)", false), invalidText: text( "Form validation UI content (invalidText)", diff --git a/src/NumberInput/NumberInput.svelte b/src/NumberInput/NumberInput.svelte index 351f07c7..6454d438 100644 --- a/src/NumberInput/NumberInput.svelte +++ b/src/NumberInput/NumberInput.svelte @@ -198,13 +198,6 @@ {label} {/if} - {#if helperText} -
- {helperText} -
- {/if}
+ {#if !invalid && helperText} +
+ {helperText} +
+ {/if} {#if invalid}
{invalidText}
{/if} diff --git a/src/TextInput/TextInput.stories.js b/src/TextInput/TextInput.stories.js index 7089af2c..c57e47a3 100644 --- a/src/TextInput/TextInput.stories.js +++ b/src/TextInput/TextInput.stories.js @@ -17,6 +17,7 @@ export const Default = () => ({ light: boolean("Light variant (light)", false), hideLabel: boolean("No label (hideLabel)", false), labelText: text("Label text (labelText)", "Text Input label"), + helperText: text("Helper text (helperText)", "Optional helper text here"), invalid: boolean("Show form validation UI (invalid)", false), invalidText: text( "Content of form validation UI (invalidText)", @@ -37,6 +38,7 @@ export const TogglePasswordVisibility = () => ({ light: boolean("Light variant (light)", false), hideLabel: boolean("No label (hideLabel)", false), labelText: text("Label text (labelText)", "Text Input label"), + helperText: text("Helper text (helperText)", "Optional helper text here"), invalid: boolean("Show form validation UI (invalid)", false), invalidText: text( "Content of form validation UI (invalidText)", @@ -75,6 +77,7 @@ export const ControlledTogglePasswordVisibility = () => ({ light: boolean("Light variant (light)", false), hideLabel: boolean("No label (hideLabel)", false), labelText: text("Label text (labelText)", "Text Input label"), + helperText: text("Helper text (helperText)", "Optional helper text here"), invalid: boolean("Show form validation UI (invalid)", false), invalidText: text( "Content of form validation UI (invalidText)", diff --git a/src/TextInput/TextInput.svelte b/src/TextInput/TextInput.svelte index 3880e9f8..9fa4d76b 100644 --- a/src/TextInput/TextInput.svelte +++ b/src/TextInput/TextInput.svelte @@ -111,13 +111,6 @@ {labelText} {/if} - {#if helperText} -
- {helperText} -
- {/if}
@@ -149,6 +142,13 @@ on:focus on:blur />
+ {#if !invalid && helperText} +
+ {helperText} +
+ {/if} {#if invalid}
{invalidText}
{/if}