@likable-hair/svelte 0.0.76 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/forms/Textfield.svelte +15 -12
- package/forms/Textfield.svelte.d.ts +1 -0
- package/package.json +1 -1
package/forms/Textfield.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
|
-
<script>export let label = "", placeholder = "", color = null, value = "", disabled = false, variant = 'outlined', width = "100%", height = "50px", maxWidth = undefined, minWidth = undefined, textColor = "black", borderWeight = "2px", borderRadius = "5px", borderColor = null, focusBorderColor = null, focusedBoxShadow = undefined, backgroundColor = null, padding = undefined, paddingLeft = undefined, paddingRight = undefined, paddingBottom = undefined, paddingTop = undefined, fontSize = undefined, type = 'text', readonly = false, inputElement = undefined;
|
|
3
|
+
<script>export let label = "", placeholder = "", color = null, value = "", disabled = false, variant = 'outlined', width = "100%", height = "50px", maxWidth = undefined, minWidth = undefined, textColor = "black", borderWeight = "2px", borderRadius = "5px", borderColor = null, focusBorderColor = null, focusedBoxShadow = undefined, backgroundColor = null, padding = undefined, paddingLeft = undefined, paddingRight = undefined, paddingBottom = undefined, paddingTop = undefined, fontSize = undefined, type = 'text', readonly = false, inputElement = undefined, autocomplete = true;
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
5
|
import { onMount } from 'svelte';
|
|
6
6
|
let inputId = uuidv4(), focused = false, legendWidth = 0, labelElement = undefined;
|
|
@@ -110,7 +110,7 @@ $: if (!!labelElement) {
|
|
|
110
110
|
</style>
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
<div
|
|
113
|
+
<div
|
|
114
114
|
style:width={width}
|
|
115
115
|
style:min-width={minWidth}
|
|
116
116
|
style:max-width={maxWidth}
|
|
@@ -121,12 +121,12 @@ $: if (!!labelElement) {
|
|
|
121
121
|
style:--textfield-focus-border-color={focusBorderColor}
|
|
122
122
|
style:--textfield-legend-width={legendWidth + 'px'}
|
|
123
123
|
style:--textfield-focused-box-shadow={focusedBoxShadow}
|
|
124
|
-
class="input-container"
|
|
124
|
+
class="input-container"
|
|
125
125
|
class:focused={focused}
|
|
126
126
|
class:not-focused={!focused}
|
|
127
127
|
class:texted={focused || !!value}
|
|
128
128
|
>
|
|
129
|
-
<fieldset
|
|
129
|
+
<fieldset
|
|
130
130
|
aria-hidden="true"
|
|
131
131
|
style:border-radius={borderRadius}
|
|
132
132
|
style:background-color={backgroundColor}
|
|
@@ -141,12 +141,12 @@ $: if (!!labelElement) {
|
|
|
141
141
|
>
|
|
142
142
|
{#if variant == 'outlined'}
|
|
143
143
|
<legend class="legend-outlined"></legend>
|
|
144
|
-
<label
|
|
144
|
+
<label
|
|
145
145
|
for={inputId}
|
|
146
146
|
class="label-outlined"
|
|
147
147
|
bind:this={labelElement}
|
|
148
148
|
>{label}</label>
|
|
149
|
-
<div
|
|
149
|
+
<div
|
|
150
150
|
style:display="flex"
|
|
151
151
|
style:position="relative"
|
|
152
152
|
style:bottom="8px"
|
|
@@ -157,11 +157,12 @@ $: if (!!labelElement) {
|
|
|
157
157
|
<slot name="prepend-inner"></slot>
|
|
158
158
|
</div>
|
|
159
159
|
{#if type == 'password'}
|
|
160
|
-
<input
|
|
160
|
+
<input
|
|
161
|
+
autocomplete={autocomplete ? 'on' : 'new-password'}
|
|
161
162
|
style:background-color={backgroundColor}
|
|
162
163
|
style:color={textColor}
|
|
163
164
|
style:font-size={fontSize}
|
|
164
|
-
id={inputId}
|
|
165
|
+
id={inputId}
|
|
165
166
|
class="input-outlined"
|
|
166
167
|
type="password"
|
|
167
168
|
placeholder={placeholder}
|
|
@@ -180,11 +181,12 @@ $: if (!!labelElement) {
|
|
|
180
181
|
bind:this={inputElement}
|
|
181
182
|
/>
|
|
182
183
|
{:else if type == 'text'}
|
|
183
|
-
<input
|
|
184
|
+
<input
|
|
185
|
+
autocomplete={autocomplete ? 'on' : 'off'}
|
|
184
186
|
style:background-color={backgroundColor}
|
|
185
187
|
style:color={textColor}
|
|
186
188
|
style:font-size={fontSize}
|
|
187
|
-
id={inputId}
|
|
189
|
+
id={inputId}
|
|
188
190
|
class="input-outlined"
|
|
189
191
|
type="text"
|
|
190
192
|
placeholder={placeholder}
|
|
@@ -231,7 +233,7 @@ $: if (!!labelElement) {
|
|
|
231
233
|
</div>
|
|
232
234
|
</div>
|
|
233
235
|
{:else if variant == 'boxed'}
|
|
234
|
-
<div
|
|
236
|
+
<div
|
|
235
237
|
style:display="flex"
|
|
236
238
|
>
|
|
237
239
|
<div>
|
|
@@ -239,6 +241,7 @@ $: if (!!labelElement) {
|
|
|
239
241
|
</div>
|
|
240
242
|
{#if type == 'password'}
|
|
241
243
|
<input
|
|
244
|
+
autocomplete={autocomplete ? 'on' : 'new-password'}
|
|
242
245
|
style:background-color={backgroundColor}
|
|
243
246
|
style:color={textColor}
|
|
244
247
|
style:font-size={fontSize}
|
|
@@ -258,10 +261,10 @@ $: if (!!labelElement) {
|
|
|
258
261
|
on:keydown
|
|
259
262
|
on:keypress
|
|
260
263
|
on:keyup
|
|
261
|
-
bind:this={inputElement}
|
|
262
264
|
/>
|
|
263
265
|
{:else if type == 'text'}
|
|
264
266
|
<input
|
|
267
|
+
autocomplete={autocomplete ? 'on' : 'off'}
|
|
265
268
|
style:background-color={backgroundColor}
|
|
266
269
|
style:color={textColor}
|
|
267
270
|
style:font-size={fontSize}
|