@iroco/ui 1.6.16 → 1.6.18
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/dist/TextInput.svelte +22 -15
- package/dist/TextInput.svelte.d.ts +8 -0
- package/package.json +1 -1
package/dist/TextInput.svelte
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
3
|
|
|
4
4
|
export type ValidationErrorMessage = { key: string; isHtml?: boolean };
|
|
5
|
+
|
|
5
6
|
//https://svelte.dev/docs/svelte/typescript#Typing-wrapper-components
|
|
6
7
|
interface Props extends HTMLInputAttributes {
|
|
7
|
-
|
|
8
|
+
id?: string | null;
|
|
8
9
|
type?: 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | null | undefined;
|
|
9
|
-
|
|
10
|
+
name?: string | null;
|
|
10
11
|
label?: string | null;
|
|
11
|
-
|
|
12
|
+
placeholder?: string | null;
|
|
12
13
|
error?: string | null;
|
|
13
14
|
errors?: Array<ValidationErrorMessage> | null;
|
|
14
15
|
htmlError?: boolean;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
value?: string | null;
|
|
17
|
+
onfocus?: ((e: FocusEvent) => void) | null;
|
|
18
|
+
onblur?: ((e: Event) => void) | null;
|
|
18
19
|
readonly?: boolean;
|
|
19
20
|
border?: boolean;
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
autocomplete?: FullAutoFill | null | undefined;
|
|
22
|
+
oninput?: FormEventHandler<HTMLInputElement> | null | undefined;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
let {
|
|
25
26
|
id = null,
|
|
26
27
|
type = 'text',
|
|
27
28
|
name = null,
|
|
28
|
-
// placeholder = null,
|
|
29
29
|
label = null,
|
|
30
|
+
placeholder = null,
|
|
30
31
|
error = null,
|
|
31
32
|
errors = [],
|
|
32
33
|
htmlError = false,
|
|
33
34
|
value = $bindable(null),
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
onfocus = null,
|
|
36
|
+
onblur = null,
|
|
36
37
|
readonly = false,
|
|
37
38
|
border = false,
|
|
39
|
+
autocomplete = 'on',
|
|
40
|
+
oninput,
|
|
38
41
|
...rest
|
|
39
|
-
// autocomplete = 'on',
|
|
40
|
-
// oninput,
|
|
41
42
|
}: Props = $props();
|
|
42
43
|
|
|
43
44
|
function hasErrors() {
|
|
@@ -50,9 +51,15 @@
|
|
|
50
51
|
<label class="iroco-ui-label" for={id}>{label}</label>
|
|
51
52
|
{/if}
|
|
52
53
|
<input
|
|
54
|
+
{oninput}
|
|
55
|
+
bind:value
|
|
56
|
+
{onfocus}
|
|
57
|
+
{onblur}
|
|
58
|
+
{id}
|
|
53
59
|
{type}
|
|
54
60
|
{name}
|
|
55
|
-
|
|
61
|
+
{placeholder}
|
|
62
|
+
{autocomplete}
|
|
56
63
|
class:border
|
|
57
64
|
class:error={hasErrors()}
|
|
58
65
|
class:readonlyInput={readonly === true}
|
|
@@ -4,13 +4,21 @@ export type ValidationErrorMessage = {
|
|
|
4
4
|
isHtml?: boolean;
|
|
5
5
|
};
|
|
6
6
|
interface Props extends HTMLInputAttributes {
|
|
7
|
+
id?: string | null;
|
|
7
8
|
type?: 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | null | undefined;
|
|
9
|
+
name?: string | null;
|
|
8
10
|
label?: string | null;
|
|
11
|
+
placeholder?: string | null;
|
|
9
12
|
error?: string | null;
|
|
10
13
|
errors?: Array<ValidationErrorMessage> | null;
|
|
11
14
|
htmlError?: boolean;
|
|
15
|
+
value?: string | null;
|
|
16
|
+
onfocus?: ((e: FocusEvent) => void) | null;
|
|
17
|
+
onblur?: ((e: Event) => void) | null;
|
|
12
18
|
readonly?: boolean;
|
|
13
19
|
border?: boolean;
|
|
20
|
+
autocomplete?: FullAutoFill | null | undefined;
|
|
21
|
+
oninput?: FormEventHandler<HTMLInputElement> | null | undefined;
|
|
14
22
|
}
|
|
15
23
|
declare const TextInput: import("svelte").Component<Props, {}, "value">;
|
|
16
24
|
type TextInput = ReturnType<typeof TextInput>;
|