Skip to content

Commit b9d4b7d

Browse files
committed
feat(MoneyInput): description in helper text like TextField
1 parent 19d09d0 commit b9d4b7d

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

components/mdc/TextInput/MoneyInput.svelte

+14-10
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,24 @@ const focus = (node) => autofocus && node.focus()
112112
</span>
113113
</label>
114114
<div class="mdc-text-field-helper-line" style="width: {width};">
115-
<div class="mdc-text-field-helper-text" class:opacity1={required} id="{labelID}-helper-id" aria-hidden="true">
116-
{#if required && !internalValue}
117-
<span class="required" class:error={hasFocused}>*Required</span>
115+
<div
116+
class="mdc-text-field-helper-text
117+
mdc-text-field-helper-text--{error ? 'validation-msg' : 'persistent'}"
118+
id="{labelID}-helper-id"
119+
aria-hidden="true"
120+
>
121+
{#if !error && description}
122+
{description}
123+
{:else if required && !internalValue}
124+
✴Required
118125
{:else if hasExceededMaxValue}
119-
<span class="error">Maximum value allowed is {maxValue}</span>
126+
Maximum value allowed is {maxValue}
120127
{:else if isLowerThanMinValue}
121-
<span class="error">Minimun value allowed is ({minValue})</span>
128+
Minimun value allowed is ({minValue})
122129
{:else if valueNotDivisibleByStep}
123-
<span class="error">{internalValue} is not divisible by {step}</span>
130+
{internalValue} is not divisible by {step}
124131
{:else if hasExceededMaxLength}
125-
<span class="error">Maximum {maxlength} characters</span>
132+
Maximum {maxlength} characters
126133
{/if}
127134
</div>
128135
{#if showCounter}
@@ -131,6 +138,3 @@ const focus = (node) => autofocus && node.focus()
131138
</div>
132139
{/if}
133140
</div>
134-
{#if description}
135-
<span class="d-block mdc-theme--neutral">{description}</span>
136-
{/if}

0 commit comments

Comments
 (0)