mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
Merge pull request #256 from josefaidt/master
feat(helper-text): move helper text below form inputs
This commit is contained in:
commit
767e113e27
15 changed files with 65 additions and 63 deletions
|
@ -15,6 +15,7 @@ export const Default = () => ({
|
||||||
size: select("Field size (size)", sizes, ""),
|
size: select("Field size (size)", sizes, ""),
|
||||||
placeholder: text("Placeholder text (placeholder)", "Filter..."),
|
placeholder: text("Placeholder text (placeholder)", "Filter..."),
|
||||||
titleText: text("Title (titleText)", "Combobox title"),
|
titleText: text("Title (titleText)", "Combobox title"),
|
||||||
|
helperText: text("Helper text (helperText)", "Optional helper text here"),
|
||||||
light: boolean("Light (light)", false),
|
light: boolean("Light (light)", false),
|
||||||
disabled: boolean("Disabled (disabled)", false),
|
disabled: boolean("Disabled (disabled)", false),
|
||||||
invalid: boolean("Invalid (invalid)", false),
|
invalid: boolean("Invalid (invalid)", false),
|
||||||
|
|
|
@ -187,13 +187,6 @@
|
||||||
{titleText}
|
{titleText}
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if helperText}
|
|
||||||
<div
|
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}">
|
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<ListBox
|
<ListBox
|
||||||
class="bx--combo-box"
|
class="bx--combo-box"
|
||||||
id="{comboId}"
|
id="{comboId}"
|
||||||
|
@ -304,4 +297,11 @@
|
||||||
</ListBoxMenu>
|
</ListBoxMenu>
|
||||||
{/if}
|
{/if}
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
{#if !invalid && helperText}
|
||||||
|
<div
|
||||||
|
class:bx--form__helper-text="{true}"
|
||||||
|
class:bx--form__helper-text--disabled="{disabled}">
|
||||||
|
{helperText}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,6 +26,7 @@ export const Default = () => ({
|
||||||
disabled: boolean("Disabled (disabled)", false),
|
disabled: boolean("Disabled (disabled)", false),
|
||||||
light: boolean("Light variant (light)", false),
|
light: boolean("Light variant (light)", false),
|
||||||
titleText: text("Title (titleText)", "This is not a dropdown title."),
|
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),
|
invalid: boolean("Show form validation UI (invalid)", false),
|
||||||
invalidText: text(
|
invalidText: text(
|
||||||
"Form validation UI content (invalidText)",
|
"Form validation UI content (invalidText)",
|
||||||
|
|
|
@ -166,13 +166,6 @@
|
||||||
{titleText}
|
{titleText}
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !inline && helperText}
|
|
||||||
<div
|
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}">
|
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<ListBox
|
<ListBox
|
||||||
type="{type}"
|
type="{type}"
|
||||||
size="{size}"
|
size="{size}"
|
||||||
|
@ -250,4 +243,11 @@
|
||||||
</ListBoxMenu>
|
</ListBoxMenu>
|
||||||
{/if}
|
{/if}
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
{#if !inline && !invalid && helperText}
|
||||||
|
<div
|
||||||
|
class:bx--form__helper-text="{true}"
|
||||||
|
class:bx--form__helper-text--disabled="{disabled}">
|
||||||
|
{helperText}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,6 +20,7 @@ export const Default = () => ({
|
||||||
id: text("MultiSelect id", "multi-select-id"),
|
id: text("MultiSelect id", "multi-select-id"),
|
||||||
name: text("MultiSelect name", "multi-select-name"),
|
name: text("MultiSelect name", "multi-select-name"),
|
||||||
titleText: text("Title (titleText)", "Multiselect Title"),
|
titleText: text("Title (titleText)", "Multiselect Title"),
|
||||||
|
helperText: text("Helper text (helperText)", "Optional helper text here"),
|
||||||
filterable: boolean("Filterable (filterable)", false),
|
filterable: boolean("Filterable (filterable)", false),
|
||||||
selectionFeedback: select(
|
selectionFeedback: select(
|
||||||
"Selection feedback (selectionFeedback)",
|
"Selection feedback (selectionFeedback)",
|
||||||
|
|
|
@ -268,13 +268,6 @@
|
||||||
{titleText}
|
{titleText}
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !inline && helperText}
|
|
||||||
<div
|
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}">
|
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<ListBox
|
<ListBox
|
||||||
aria-label="{ariaLabel}"
|
aria-label="{ariaLabel}"
|
||||||
id="{id}"
|
id="{id}"
|
||||||
|
@ -447,4 +440,11 @@
|
||||||
</ListBoxMenu>
|
</ListBoxMenu>
|
||||||
{/if}
|
{/if}
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
{#if !inline && !invalid && helperText}
|
||||||
|
<div
|
||||||
|
class:bx--form__helper-text="{true}"
|
||||||
|
class:bx--form__helper-text--disabled="{disabled}">
|
||||||
|
{helperText}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,6 +30,7 @@ export const Default = () => ({
|
||||||
disabled: boolean("Disabled (disabled)", false),
|
disabled: boolean("Disabled (disabled)", false),
|
||||||
readonly: boolean("Read only (readonly)", false),
|
readonly: boolean("Read only (readonly)", false),
|
||||||
invalid: boolean("Show form validation UI (invalid)", false),
|
invalid: boolean("Show form validation UI (invalid)", false),
|
||||||
|
helperText: text("Helper text (helperText)", "Optional helper text here"),
|
||||||
mobile: boolean("Mobile variant (mobile)", false),
|
mobile: boolean("Mobile variant (mobile)", false),
|
||||||
invalidText: text(
|
invalidText: text(
|
||||||
"Form validation UI content (invalidText)",
|
"Form validation UI content (invalidText)",
|
||||||
|
|
|
@ -198,13 +198,6 @@
|
||||||
<slot name="label">{label}</slot>
|
<slot name="label">{label}</slot>
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if helperText}
|
|
||||||
<div
|
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}">
|
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div class:bx--number__input-wrapper="{true}">
|
<div class:bx--number__input-wrapper="{true}">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -262,13 +255,6 @@
|
||||||
<slot name="label">{label}</slot>
|
<slot name="label">{label}</slot>
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if helperText}
|
|
||||||
<div
|
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}">
|
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div class:bx--number__input-wrapper="{true}">
|
<div class:bx--number__input-wrapper="{true}">
|
||||||
<input
|
<input
|
||||||
bind:this="{ref}"
|
bind:this="{ref}"
|
||||||
|
@ -324,6 +310,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if !error && helperText}
|
||||||
|
<div
|
||||||
|
class:bx--form__helper-text="{true}"
|
||||||
|
class:bx--form__helper-text--disabled="{disabled}">
|
||||||
|
{helperText}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{#if error}
|
{#if error}
|
||||||
<div id="{errorId}" class:bx--form-requirement="{true}">
|
<div id="{errorId}" class:bx--form-requirement="{true}">
|
||||||
{invalidText}
|
{invalidText}
|
||||||
|
|
|
@ -27,6 +27,7 @@ export const Default = () => ({
|
||||||
"A valid value is required"
|
"A valid value is required"
|
||||||
),
|
),
|
||||||
labelText: text("Label text (helperText)", "Select"),
|
labelText: text("Label text (helperText)", "Select"),
|
||||||
|
helperText: text("Helper text (helperText)", "Optional helper text here"),
|
||||||
id: text("Select id", "select-id"),
|
id: text("Select id", "select-id"),
|
||||||
name: text("Select name", "select-name"),
|
name: text("Select name", "select-name"),
|
||||||
},
|
},
|
||||||
|
|
|
@ -118,13 +118,6 @@
|
||||||
{labelText}
|
{labelText}
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !inline && helperText}
|
|
||||||
<div
|
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}">
|
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{#if inline}
|
{#if inline}
|
||||||
<div class:bx--select-input--inline__wrapper="{true}">
|
<div class:bx--select-input--inline__wrapper="{true}">
|
||||||
<div
|
<div
|
||||||
|
@ -188,6 +181,13 @@
|
||||||
<WarningFilled16 class="bx--select__invalid-icon" />
|
<WarningFilled16 class="bx--select__invalid-icon" />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
{#if !invalid && helperText}
|
||||||
|
<div
|
||||||
|
class:bx--form__helper-text="{true}"
|
||||||
|
class:bx--form__helper-text--disabled="{disabled}">
|
||||||
|
{helperText}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{#if invalid}
|
{#if invalid}
|
||||||
<div id="{errorId}" class:bx--form-requirement="{true}">
|
<div id="{errorId}" class:bx--form-requirement="{true}">
|
||||||
{invalidText}
|
{invalidText}
|
||||||
|
|
|
@ -13,6 +13,7 @@ export const Default = () => ({
|
||||||
hideLabel: boolean("No label (hideLabel)", false),
|
hideLabel: boolean("No label (hideLabel)", false),
|
||||||
labelText: text("Label text (labelText)", "Text Area label"),
|
labelText: text("Label text (labelText)", "Text Area label"),
|
||||||
invalid: boolean("Show form validation UI (invalid)", false),
|
invalid: boolean("Show form validation UI (invalid)", false),
|
||||||
|
helperText: text("Helper text (helperText)", "Optional helper text here"),
|
||||||
invalidText: text(
|
invalidText: text(
|
||||||
"Content of form validation UI (invalidText)",
|
"Content of form validation UI (invalidText)",
|
||||||
"A valid value is required"
|
"A valid value is required"
|
||||||
|
|
|
@ -103,13 +103,6 @@
|
||||||
{labelText}
|
{labelText}
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if helperText}
|
|
||||||
<div
|
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}">
|
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div
|
<div
|
||||||
class:bx--text-area__wrapper="{true}"
|
class:bx--text-area__wrapper="{true}"
|
||||||
data-invalid="{invalid || undefined}">
|
data-invalid="{invalid || undefined}">
|
||||||
|
@ -139,6 +132,13 @@
|
||||||
on:focus
|
on:focus
|
||||||
on:blur></textarea>
|
on:blur></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
{#if !invalid && helperText}
|
||||||
|
<div
|
||||||
|
class:bx--form__helper-text="{true}"
|
||||||
|
class:bx--form__helper-text--disabled="{disabled}">
|
||||||
|
{helperText}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{#if invalid}
|
{#if invalid}
|
||||||
<div id="{errorId}" class:bx--form-requirement="{true}">{invalidText}</div>
|
<div id="{errorId}" class:bx--form-requirement="{true}">{invalidText}</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -132,13 +132,6 @@
|
||||||
{labelText}
|
{labelText}
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if helperText}
|
|
||||||
<div
|
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}">
|
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div
|
<div
|
||||||
class:bx--text-input__field-wrapper="{true}"
|
class:bx--text-input__field-wrapper="{true}"
|
||||||
data-invalid="{invalid || undefined}">
|
data-invalid="{invalid || undefined}">
|
||||||
|
@ -190,6 +183,13 @@
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
{#if !invalid && helperText}
|
||||||
|
<div
|
||||||
|
class:bx--form__helper-text="{true}"
|
||||||
|
class:bx--form__helper-text--disabled="{disabled}">
|
||||||
|
{helperText}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{#if invalid}
|
{#if invalid}
|
||||||
<div class:bx--form-requirement="{true}" id="{errorId}">{invalidText}</div>
|
<div class:bx--form-requirement="{true}" id="{errorId}">{invalidText}</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -17,6 +17,7 @@ export const Default = () => ({
|
||||||
light: boolean("Light variant (light)", false),
|
light: boolean("Light variant (light)", false),
|
||||||
hideLabel: boolean("No label (hideLabel)", false),
|
hideLabel: boolean("No label (hideLabel)", false),
|
||||||
labelText: text("Label text (labelText)", "Text Input label"),
|
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),
|
invalid: boolean("Show form validation UI (invalid)", false),
|
||||||
invalidText: text(
|
invalidText: text(
|
||||||
"Content of form validation UI (invalidText)",
|
"Content of form validation UI (invalidText)",
|
||||||
|
@ -37,6 +38,7 @@ export const TogglePasswordVisibility = () => ({
|
||||||
light: boolean("Light variant (light)", false),
|
light: boolean("Light variant (light)", false),
|
||||||
hideLabel: boolean("No label (hideLabel)", false),
|
hideLabel: boolean("No label (hideLabel)", false),
|
||||||
labelText: text("Label text (labelText)", "Text Input label"),
|
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),
|
invalid: boolean("Show form validation UI (invalid)", false),
|
||||||
invalidText: text(
|
invalidText: text(
|
||||||
"Content of form validation UI (invalidText)",
|
"Content of form validation UI (invalidText)",
|
||||||
|
@ -75,6 +77,7 @@ export const ControlledTogglePasswordVisibility = () => ({
|
||||||
light: boolean("Light variant (light)", false),
|
light: boolean("Light variant (light)", false),
|
||||||
hideLabel: boolean("No label (hideLabel)", false),
|
hideLabel: boolean("No label (hideLabel)", false),
|
||||||
labelText: text("Label text (labelText)", "Text Input label"),
|
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),
|
invalid: boolean("Show form validation UI (invalid)", false),
|
||||||
invalidText: text(
|
invalidText: text(
|
||||||
"Content of form validation UI (invalidText)",
|
"Content of form validation UI (invalidText)",
|
||||||
|
|
|
@ -111,13 +111,6 @@
|
||||||
{labelText}
|
{labelText}
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if helperText}
|
|
||||||
<div
|
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}">
|
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div
|
<div
|
||||||
data-invalid="{invalid || undefined}"
|
data-invalid="{invalid || undefined}"
|
||||||
class:bx--text-input__field-wrapper="{true}">
|
class:bx--text-input__field-wrapper="{true}">
|
||||||
|
@ -149,6 +142,13 @@
|
||||||
on:focus
|
on:focus
|
||||||
on:blur />
|
on:blur />
|
||||||
</div>
|
</div>
|
||||||
|
{#if !invalid && helperText}
|
||||||
|
<div
|
||||||
|
class:bx--form__helper-text="{true}"
|
||||||
|
class:bx--form__helper-text--disabled="{disabled}">
|
||||||
|
{helperText}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{#if invalid}
|
{#if invalid}
|
||||||
<div class:bx--form-requirement="{true}" id="{errorId}">{invalidText}</div>
|
<div class:bx--form-requirement="{true}" id="{errorId}">{invalidText}</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue