@@ -43,7 +43,7 @@ $: hasExceededMaxLength = maxlength && value.length > maxlength
4343$: error = hasExceededMaxLength || (hasFocused && hasBlurred && required && ! value)
4444$: warn = showWarn
4545$: showCounter = maxlength && value .length / maxlength > 0.85
46- $: value && addOrRemoveInvalidClass (error, element)
46+ $: value, addOrRemoveInvalidClass (error, element)
4747$: addOrRemoveInvalidClass (showError || showWarn, element)
4848
4949onMount (() => {
@@ -58,30 +58,31 @@ afterUpdate(() => {
5858const focus = (node) => autofocus && node.focus()
5959</script>
6060
61- <style>
62- .material-icons {
63- color: rgb(133, 140, 148);
64- position: relative;
65- top: 0.4rem;
66- right: 0.6rem;
67- }
68- .label-margin {
69- margin-left: 1.1rem;
70- }
71- .mdc-text-field--label-floating .mdc-floating-label {
72- margin-left: 0;
73- }
74- </style>
75-
7661<label
7762 class="mdc-text-field mdc-text-field--outlined {$$props.class || ''} textfield-radius"
7863 class:mdc-text-field--no-label={!label}
7964 class:mdc-text-field--disabled={disabled}
8065 class:warn
8166 class:showError
67+ class:mdc-text-field--with-leading-icon={icon}
8268 bind:this={element}
8369>
84- <i class="material-icons mdc-text-field__icon--leading" class:error aria-hidden="true"> {icon}</i>
70+ <span class="mdc-notched-outline">
71+ <span class="mdc-notched-outline__leading" />
72+ {#if label}
73+ <span class="mdc-notched-outline__notch">
74+ <span class="mdc-floating-label" class:error id={labelID}>
75+ {label}
76+ </span>
77+ </span>
78+ {/if}
79+ <span class="mdc-notched-outline__trailing" />
80+ </span>
81+ {#if icon}
82+ <i class="material-icons mdc-text-field__icon mdc-text-field__icon--leading" class:error aria-hidden="true">
83+ {icon}</i
84+ >
85+ {/if}
8586 <input
8687 type="text"
8788 class="mdc-text-field__input"
@@ -104,22 +105,8 @@ const focus = (node) => autofocus && node.focus()
104105 {placeholder}
105106 />
106107 {#if hasExceededMaxLength}
107- <span class="mdc-text-field__affix mdc-text-field__affix--suffix"
108- ><i class="material-icons mdc-text-field__icon--trailing error" aria-hidden="true">error</i></span
109- >
108+ <i class="material-icons mdc-text-field__icon mdc-text-field__icon--trailing error" aria-hidden="true">error</i>
110109 {/if}
111-
112- <span class="mdc-notched-outline">
113- <span class="mdc-notched-outline__leading" />
114- {#if label}
115- <span class="mdc-notched-outline__notch">
116- <span class="mdc-floating-label" class:label-margin={icon} class:error id={labelID}>
117- {label}
118- </span>
119- </span>
120- {/if}
121- <span class="mdc-notched-outline__trailing" />
122- </span>
123110</label>
124111<div class="mdc-text-field-helper-line" style="width: {width};">
125112 <div
0 commit comments