mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
Make the 'helper text' feature more generic
This commit is contained in:
parent
06d81ddbff
commit
4b805bad42
19 changed files with 181 additions and 76 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Component Index
|
# Component Index
|
||||||
|
|
||||||
> 165 components exported from carbon-components-svelte@0.80.0.
|
> 166 components exported from carbon-components-svelte@0.80.0.
|
||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@
|
||||||
- [`HeaderPanelLinks`](#headerpanellinks)
|
- [`HeaderPanelLinks`](#headerpanellinks)
|
||||||
- [`HeaderSearch`](#headersearch)
|
- [`HeaderSearch`](#headersearch)
|
||||||
- [`HeaderUtilities`](#headerutilities)
|
- [`HeaderUtilities`](#headerutilities)
|
||||||
|
- [`HelperText`](#helpertext)
|
||||||
- [`ImageLoader`](#imageloader)
|
- [`ImageLoader`](#imageloader)
|
||||||
- [`InlineLoading`](#inlineloading)
|
- [`InlineLoading`](#inlineloading)
|
||||||
- [`InlineNotification`](#inlinenotification)
|
- [`InlineNotification`](#inlinenotification)
|
||||||
|
@ -1580,7 +1581,7 @@ None.
|
||||||
| expandedByDefault | No | <code>let</code> | No | <code>boolean</code> | <code>true</code> | Set to `false` to hide the side nav by default |
|
| expandedByDefault | No | <code>let</code> | No | <code>boolean</code> | <code>true</code> | Set to `false` to hide the side nav by default |
|
||||||
| uiShellAriaLabel | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the ARIA label for the header |
|
| uiShellAriaLabel | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the ARIA label for the header |
|
||||||
| href | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the `href` attribute |
|
| href | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the `href` attribute |
|
||||||
| company | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the company name.<br /><br />Alternatively, use the named slot "company" (e.g., `<span slot="company">...</span>`) |
|
| company | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the company name.<br />Alternatively, use the named slot "company" (e.g., `<span slot="company">...</span>`) |
|
||||||
| platformName | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the platform name.<br />Alternatively, use the named slot "platform" (e.g., `<span slot="platform">...</span>`) |
|
| platformName | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the platform name.<br />Alternatively, use the named slot "platform" (e.g., `<span slot="platform">...</span>`) |
|
||||||
| persistentHamburgerMenu | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to persist the hamburger menu |
|
| persistentHamburgerMenu | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to persist the hamburger menu |
|
||||||
| expansionBreakpoint | No | <code>let</code> | No | <code>number</code> | <code>1056</code> | The window width (px) at which the SideNav is expanded and the hamburger menu is hidden.<br />1056 represents the "large" breakpoint in pixels from the Carbon Design System:<br />- small: 320<br />- medium: 672<br />- large: 1056<br />- x-large: 1312<br />- max: 1584 |
|
| expansionBreakpoint | No | <code>let</code> | No | <code>number</code> | <code>1056</code> | The window width (px) at which the SideNav is expanded and the hamburger menu is hidden.<br />1056 represents the "large" breakpoint in pixels from the Carbon Design System:<br />- small: 320<br />- medium: 672<br />- large: 1056<br />- x-large: 1312<br />- max: 1584 |
|
||||||
|
@ -1866,6 +1867,26 @@ None.
|
||||||
|
|
||||||
None.
|
None.
|
||||||
|
|
||||||
|
## `HelperText`
|
||||||
|
|
||||||
|
### Props
|
||||||
|
|
||||||
|
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
|
||||||
|
| :--------- | :------- | :--------------- | :------- | -------------------- | ------------------ | -------------------------------------- |
|
||||||
|
| helperText | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the helper text as parameter |
|
||||||
|
| disabled | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` for the disabled variant |
|
||||||
|
| inline | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to use inline variant |
|
||||||
|
|
||||||
|
### Slots
|
||||||
|
|
||||||
|
| Slot name | Default | Props | Fallback |
|
||||||
|
| :-------- | :------ | :---- | :------------------------ |
|
||||||
|
| -- | Yes | -- | <code>{helperText}</code> |
|
||||||
|
|
||||||
|
### Events
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
## `ImageLoader`
|
## `ImageLoader`
|
||||||
|
|
||||||
### Props
|
### Props
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"total": 165,
|
"total": 166,
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"moduleName": "Accordion",
|
"moduleName": "Accordion",
|
||||||
|
@ -4788,7 +4788,7 @@
|
||||||
{
|
{
|
||||||
"name": "company",
|
"name": "company",
|
||||||
"kind": "let",
|
"kind": "let",
|
||||||
"description": "Specify the company name.\n\nAlternatively, use the named slot \"company\" (e.g., `<span slot=\"company\">...</span>`)",
|
"description": "Specify the company name.\nAlternatively, use the named slot \"company\" (e.g., `<span slot=\"company\">...</span>`)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"isFunction": false,
|
"isFunction": false,
|
||||||
"isFunctionDeclaration": false,
|
"isFunctionDeclaration": false,
|
||||||
|
@ -5431,6 +5431,60 @@
|
||||||
"events": [],
|
"events": [],
|
||||||
"typedefs": []
|
"typedefs": []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"moduleName": "HelperText",
|
||||||
|
"filePath": "src/HelperText/HelperText.svelte",
|
||||||
|
"props": [
|
||||||
|
{
|
||||||
|
"name": "helperText",
|
||||||
|
"kind": "let",
|
||||||
|
"description": "Specify the helper text as parameter",
|
||||||
|
"type": "string",
|
||||||
|
"value": "\"\"",
|
||||||
|
"isFunction": false,
|
||||||
|
"isFunctionDeclaration": false,
|
||||||
|
"isRequired": false,
|
||||||
|
"constant": false,
|
||||||
|
"reactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "disabled",
|
||||||
|
"kind": "let",
|
||||||
|
"description": "Set to `true` for the disabled variant",
|
||||||
|
"type": "boolean",
|
||||||
|
"value": "false",
|
||||||
|
"isFunction": false,
|
||||||
|
"isFunctionDeclaration": false,
|
||||||
|
"isRequired": false,
|
||||||
|
"constant": false,
|
||||||
|
"reactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inline",
|
||||||
|
"kind": "let",
|
||||||
|
"description": "Set to `true` to use inline variant",
|
||||||
|
"type": "boolean",
|
||||||
|
"value": "false",
|
||||||
|
"isFunction": false,
|
||||||
|
"isFunctionDeclaration": false,
|
||||||
|
"isRequired": false,
|
||||||
|
"constant": false,
|
||||||
|
"reactive": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"moduleExports": [],
|
||||||
|
"slots": [
|
||||||
|
{
|
||||||
|
"name": "__default__",
|
||||||
|
"default": true,
|
||||||
|
"fallback": "{helperText}",
|
||||||
|
"slot_props": "{}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"events": [],
|
||||||
|
"typedefs": [],
|
||||||
|
"rest_props": { "type": "Element", "name": "div" }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "ImageLoader",
|
"moduleName": "ImageLoader",
|
||||||
"filePath": "src/ImageLoader/ImageLoader.svelte",
|
"filePath": "src/ImageLoader/ImageLoader.svelte",
|
||||||
|
|
|
@ -117,6 +117,7 @@
|
||||||
import ListBoxMenuIcon from "../ListBox/ListBoxMenuIcon.svelte";
|
import ListBoxMenuIcon from "../ListBox/ListBoxMenuIcon.svelte";
|
||||||
import ListBoxMenuItem from "../ListBox/ListBoxMenuItem.svelte";
|
import ListBoxMenuItem from "../ListBox/ListBoxMenuItem.svelte";
|
||||||
import ListBoxSelection from "../ListBox/ListBoxSelection.svelte";
|
import ListBoxSelection from "../ListBox/ListBoxSelection.svelte";
|
||||||
|
import HelperText from "../HelperText/HelperText.svelte";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
@ -415,11 +416,8 @@
|
||||||
{/if}
|
{/if}
|
||||||
</ListBox>
|
</ListBox>
|
||||||
{#if !invalid && helperText && !warn}
|
{#if !invalid && helperText && !warn}
|
||||||
<div
|
<HelperText disabled="{disabled}">
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
>
|
|
||||||
{helperText}
|
{helperText}
|
||||||
</div>
|
</HelperText>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
import Calendar from "../icons/Calendar.svelte";
|
import Calendar from "../icons/Calendar.svelte";
|
||||||
import WarningFilled from "../icons/WarningFilled.svelte";
|
import WarningFilled from "../icons/WarningFilled.svelte";
|
||||||
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
||||||
|
import HelperText from "../HelperText/HelperText.svelte";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
range,
|
range,
|
||||||
|
@ -163,11 +164,8 @@
|
||||||
<div class:bx--form-requirement="{true}">{warnText}</div>
|
<div class:bx--form-requirement="{true}">{warnText}</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !invalid && !warn && helperText}
|
{#if !invalid && !warn && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}">
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
>
|
|
||||||
{helperText}
|
{helperText}
|
||||||
</div>
|
</HelperText>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -107,6 +107,7 @@
|
||||||
ListBoxMenuIcon,
|
ListBoxMenuIcon,
|
||||||
ListBoxMenuItem,
|
ListBoxMenuItem,
|
||||||
} from "../ListBox";
|
} from "../ListBox";
|
||||||
|
import HelperText from "../HelperText/HelperText.svelte";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
@ -327,11 +328,8 @@
|
||||||
{/if}
|
{/if}
|
||||||
</ListBox>
|
</ListBox>
|
||||||
{#if !inline && !invalid && !warn && helperText}
|
{#if !inline && !invalid && !warn && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}">
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
>
|
|
||||||
{helperText}
|
{helperText}
|
||||||
</div>
|
</HelperText>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
19
src/HelperText/HelperText.svelte
Normal file
19
src/HelperText/HelperText.svelte
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<script>
|
||||||
|
/** Specify the helper text as parameter */
|
||||||
|
export let helperText = "";
|
||||||
|
|
||||||
|
/** Set to `true` for the disabled variant */
|
||||||
|
export let disabled = false;
|
||||||
|
|
||||||
|
/** Set to `true` to use inline variant */
|
||||||
|
export let inline = false;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class:bx--form__helper-text="{true}"
|
||||||
|
class:bx--form__helper-text--disabled="{disabled}"
|
||||||
|
class:bx--form__helper-text--inline="{inline}"
|
||||||
|
{...$$restProps}
|
||||||
|
>
|
||||||
|
<slot>{helperText}</slot>
|
||||||
|
</div>
|
1
src/HelperText/index.js
Normal file
1
src/HelperText/index.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export { default as HelperText } from "./HelperText.svelte";
|
|
@ -180,6 +180,7 @@
|
||||||
ListBoxMenuItem,
|
ListBoxMenuItem,
|
||||||
ListBoxSelection,
|
ListBoxSelection,
|
||||||
} from "../ListBox";
|
} from "../ListBox";
|
||||||
|
import HelperText from "../HelperText/HelperText.svelte";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
@ -535,11 +536,8 @@
|
||||||
{/if}
|
{/if}
|
||||||
</ListBox>
|
</ListBox>
|
||||||
{#if !inline && !invalid && !warn && helperText}
|
{#if !inline && !invalid && !warn && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}">
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
>
|
|
||||||
{helperText}
|
{helperText}
|
||||||
</div>
|
</HelperText>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
import WarningFilled from "../icons/WarningFilled.svelte";
|
import WarningFilled from "../icons/WarningFilled.svelte";
|
||||||
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
||||||
import EditOff from "../icons/EditOff.svelte";
|
import EditOff from "../icons/EditOff.svelte";
|
||||||
|
import HelperText from "../HelperText/HelperText.svelte";
|
||||||
|
|
||||||
const defaultTranslations = {
|
const defaultTranslations = {
|
||||||
[translationIds.increment]: "Increment number",
|
[translationIds.increment]: "Increment number",
|
||||||
|
@ -260,12 +261,9 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if !error && !warn && helperText}
|
{#if !error && !warn && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}">
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
>
|
|
||||||
{helperText}
|
{helperText}
|
||||||
</div>
|
</HelperText>
|
||||||
{/if}
|
{/if}
|
||||||
{#if error}
|
{#if error}
|
||||||
<div id="{errorId}" class:bx--form-requirement="{true}">
|
<div id="{errorId}" class:bx--form-requirement="{true}">
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
import ChevronDown from "../icons/ChevronDown.svelte";
|
import ChevronDown from "../icons/ChevronDown.svelte";
|
||||||
import WarningFilled from "../icons/WarningFilled.svelte";
|
import WarningFilled from "../icons/WarningFilled.svelte";
|
||||||
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
||||||
|
import HelperText from "../HelperText/HelperText.svelte";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
const selectedValue = writable(selected);
|
const selectedValue = writable(selected);
|
||||||
|
@ -182,12 +183,9 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if !invalid && !warn && helperText}
|
{#if !invalid && !warn && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}">
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
>
|
|
||||||
{helperText}
|
{helperText}
|
||||||
</div>
|
</HelperText>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{#if !inline}
|
{#if !inline}
|
||||||
|
@ -225,12 +223,9 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if !invalid && helperText}
|
{#if !invalid && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}">
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
>
|
|
||||||
{helperText}
|
{helperText}
|
||||||
</div>
|
</HelperText>
|
||||||
{/if}
|
{/if}
|
||||||
{#if invalid}
|
{#if invalid}
|
||||||
<div id="{errorId}" class:bx--form-requirement="{true}">
|
<div id="{errorId}" class:bx--form-requirement="{true}">
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
export let ref = null;
|
export let ref = null;
|
||||||
|
|
||||||
import WarningFilled from "../icons/WarningFilled.svelte";
|
import WarningFilled from "../icons/WarningFilled.svelte";
|
||||||
|
import HelperText from "../HelperText/HelperText.svelte";
|
||||||
|
|
||||||
$: errorId = `error-${id}`;
|
$: errorId = `error-${id}`;
|
||||||
</script>
|
</script>
|
||||||
|
@ -120,12 +121,9 @@
|
||||||
on:paste></textarea>
|
on:paste></textarea>
|
||||||
</div>
|
</div>
|
||||||
{#if !invalid && helperText}
|
{#if !invalid && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}">
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
>
|
|
||||||
{helperText}
|
{helperText}
|
||||||
</div>
|
</HelperText>
|
||||||
{/if}
|
{/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>
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
||||||
import View from "../icons/View.svelte";
|
import View from "../icons/View.svelte";
|
||||||
import ViewOff from "../icons/ViewOff.svelte";
|
import ViewOff from "../icons/ViewOff.svelte";
|
||||||
|
import HelperText from "../HelperText/HelperText.svelte";
|
||||||
|
|
||||||
const ctx = getContext("Form");
|
const ctx = getContext("Form");
|
||||||
|
|
||||||
|
@ -123,14 +124,9 @@
|
||||||
</slot>
|
</slot>
|
||||||
</label>
|
</label>
|
||||||
{#if !isFluid && helperText}
|
{#if !isFluid && helperText}
|
||||||
<div
|
<HelperText id="{helperId}" disabled="{disabled}" inline="{inline}"
|
||||||
id="{helperId}"
|
>{helperText}</HelperText
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
class:bx--form__helper-text--inline="{inline}"
|
|
||||||
>
|
>
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{#if !inline && (labelText || $$slots.labelText)}
|
{#if !inline && (labelText || $$slots.labelText)}
|
||||||
|
@ -250,13 +246,9 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !invalid && !warn && !isFluid && !inline && helperText}
|
{#if !invalid && !warn && !isFluid && !inline && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}" inline="{inline}">
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
class:bx--form__helper-text--inline="{inline}"
|
|
||||||
>
|
|
||||||
{helperText}
|
{helperText}
|
||||||
</div>
|
</HelperText>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !isFluid && !invalid && warn}
|
{#if !isFluid && !invalid && warn}
|
||||||
<div class:bx--form-requirement="{true}" id="{warnId}">{warnText}</div>
|
<div class:bx--form-requirement="{true}" id="{warnId}">{warnText}</div>
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
import WarningFilled from "../icons/WarningFilled.svelte";
|
import WarningFilled from "../icons/WarningFilled.svelte";
|
||||||
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
||||||
import EditOff from "../icons/EditOff.svelte";
|
import EditOff from "../icons/EditOff.svelte";
|
||||||
|
import HelperText from "../HelperText/HelperText.svelte";
|
||||||
|
|
||||||
const ctx = getContext("Form");
|
const ctx = getContext("Form");
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
@ -133,13 +134,9 @@
|
||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !isFluid && helperText}
|
{#if !isFluid && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}" inline="{inline}"
|
||||||
class:bx--form__helper-text="{true}"
|
>{helperText}</HelperText
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
class:bx--form__helper-text--inline="{inline}"
|
|
||||||
>
|
>
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -228,14 +225,9 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if !invalid && !warn && !isFluid && !inline && helperText}
|
{#if !invalid && !warn && !isFluid && !inline && helperText}
|
||||||
<div
|
<HelperText disabled="{disabled}" inline="{inline}"
|
||||||
id="{helperId}"
|
>{helperText}</HelperText
|
||||||
class:bx--form__helper-text="{true}"
|
|
||||||
class:bx--form__helper-text--disabled="{disabled}"
|
|
||||||
class:bx--form__helper-text--inline="{inline}"
|
|
||||||
>
|
>
|
||||||
{helperText}
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if !isFluid && invalid}
|
{#if !isFluid && invalid}
|
||||||
<div class:bx--form-requirement="{true}" id="{errorId}">
|
<div class:bx--form-requirement="{true}" id="{errorId}">
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the company name.
|
* Specify the company name.
|
||||||
*
|
|
||||||
* Alternatively, use the named slot "company" (e.g., `<span slot="company">...</span>`)
|
* Alternatively, use the named slot "company" (e.g., `<span slot="company">...</span>`)
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -56,6 +56,7 @@ export { FormGroup } from "./FormGroup";
|
||||||
export { FormItem } from "./FormItem";
|
export { FormItem } from "./FormItem";
|
||||||
export { FormLabel } from "./FormLabel";
|
export { FormLabel } from "./FormLabel";
|
||||||
export { Grid, Row, Column } from "./Grid";
|
export { Grid, Row, Column } from "./Grid";
|
||||||
|
export { HelperText } from "./HelperText";
|
||||||
export { ImageLoader } from "./ImageLoader";
|
export { ImageLoader } from "./ImageLoader";
|
||||||
export { InlineLoading } from "./InlineLoading";
|
export { InlineLoading } from "./InlineLoading";
|
||||||
export { Link, OutboundLink } from "./Link";
|
export { Link, OutboundLink } from "./Link";
|
||||||
|
|
11
tests/HelperText.test.svelte
Normal file
11
tests/HelperText.test.svelte
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { HelperText } from "../types";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<HelperText>Base helper</HelperText>
|
||||||
|
|
||||||
|
<HelperText helperText="Helper text as parameter" />
|
||||||
|
|
||||||
|
<HelperText disabled="{true}">Helper with disabled variant</HelperText>
|
||||||
|
|
||||||
|
<HelperText inline="{true}">Helper with inline variant</HelperText>
|
32
types/HelperText/HelperText.svelte.d.ts
vendored
Normal file
32
types/HelperText/HelperText.svelte.d.ts
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import type { SvelteComponentTyped } from "svelte";
|
||||||
|
import type { SvelteHTMLElements } from "svelte/elements";
|
||||||
|
|
||||||
|
type RestProps = SvelteHTMLElements["div"];
|
||||||
|
|
||||||
|
export interface HelperTextProps extends RestProps {
|
||||||
|
/**
|
||||||
|
* Specify the helper text as parameter
|
||||||
|
* @default ""
|
||||||
|
*/
|
||||||
|
helperText?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to `true` for the disabled variant
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
disabled?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to `true` to use inline variant
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
inline?: boolean;
|
||||||
|
|
||||||
|
[key: `data-${string}`]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class HelperText extends SvelteComponentTyped<
|
||||||
|
HelperTextProps,
|
||||||
|
Record<string, any>,
|
||||||
|
{ default: {} }
|
||||||
|
> {}
|
1
types/UIShell/Header.svelte.d.ts
vendored
1
types/UIShell/Header.svelte.d.ts
vendored
|
@ -30,7 +30,6 @@ export interface HeaderProps extends RestProps {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the company name.
|
* Specify the company name.
|
||||||
*
|
|
||||||
* Alternatively, use the named slot "company" (e.g., `<span slot="company">...</span>`)
|
* Alternatively, use the named slot "company" (e.g., `<span slot="company">...</span>`)
|
||||||
* @default undefined
|
* @default undefined
|
||||||
*/
|
*/
|
||||||
|
|
1
types/index.d.ts
vendored
1
types/index.d.ts
vendored
|
@ -62,6 +62,7 @@ export { default as FormLabel } from "./FormLabel/FormLabel.svelte";
|
||||||
export { default as Grid } from "./Grid/Grid.svelte";
|
export { default as Grid } from "./Grid/Grid.svelte";
|
||||||
export { default as Row } from "./Grid/Row.svelte";
|
export { default as Row } from "./Grid/Row.svelte";
|
||||||
export { default as Column } from "./Grid/Column.svelte";
|
export { default as Column } from "./Grid/Column.svelte";
|
||||||
|
export { default as HelperText } from "./HelperText/HelperText.svelte";
|
||||||
export { default as ImageLoader } from "./ImageLoader/ImageLoader.svelte";
|
export { default as ImageLoader } from "./ImageLoader/ImageLoader.svelte";
|
||||||
export { default as InlineLoading } from "./InlineLoading/InlineLoading.svelte";
|
export { default as InlineLoading } from "./InlineLoading/InlineLoading.svelte";
|
||||||
export { default as Link } from "./Link/Link.svelte";
|
export { default as Link } from "./Link/Link.svelte";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue