@iroco/ui 1.3.0 → 1.4.1
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/Button.svelte
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
fullWidth?: boolean;
|
|
10
10
|
id?: string | null;
|
|
11
11
|
formaction?: string | null;
|
|
12
|
+
form?: string | null;
|
|
12
13
|
children?: import('svelte').Snippet;
|
|
13
14
|
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
14
15
|
}
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
fullWidth = false,
|
|
22
23
|
id = null,
|
|
23
24
|
formaction = null,
|
|
25
|
+
form = null,
|
|
24
26
|
children,
|
|
25
27
|
onclick
|
|
26
28
|
}: Props = $props();
|
|
@@ -34,6 +36,7 @@
|
|
|
34
36
|
{formaction}
|
|
35
37
|
{disabled}
|
|
36
38
|
{onclick}
|
|
39
|
+
{form}
|
|
37
40
|
>
|
|
38
41
|
{@render children?.()}
|
|
39
42
|
</button>
|
package/dist/Button.svelte.d.ts
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
<Story name="Password" args={{ type: 'password' }} />
|
|
37
37
|
<Story name="Label" args={{ label: 'Label' }} />
|
|
38
38
|
<Story name="Error" args={{ error: 'An error message' }} />
|
|
39
|
+
<Story name="Errors" args={{ errors: [{ key: 'foo', isHtml: false }] }} />
|
|
39
40
|
<Story name="Placeholder" args={{ placeholder: 'A placeholder' }} />
|
|
40
41
|
<Story name="Border" args={{ border: true }} />
|
|
41
42
|
<Story
|
package/dist/TextInput.svelte
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { FormEventHandler, FullAutoFill, HTMLInputAttributes } from 'svelte/elements';
|
|
3
3
|
|
|
4
|
+
export type ValidationErrorMessage = { key: string; isHtml?: boolean };
|
|
5
|
+
|
|
4
6
|
interface Props extends HTMLInputAttributes {
|
|
5
7
|
id?: string | null;
|
|
6
8
|
type?: 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | null | undefined;
|
|
@@ -8,6 +10,7 @@
|
|
|
8
10
|
label?: string | null;
|
|
9
11
|
placeholder?: string | null;
|
|
10
12
|
error?: string | null;
|
|
13
|
+
errors?: Array<ValidationErrorMessage> | null;
|
|
11
14
|
htmlError?: boolean;
|
|
12
15
|
value?: string | null;
|
|
13
16
|
onFocus?: ((e: FocusEvent) => void) | null;
|
|
@@ -25,6 +28,7 @@
|
|
|
25
28
|
label = null,
|
|
26
29
|
placeholder = null,
|
|
27
30
|
error = null,
|
|
31
|
+
errors = null,
|
|
28
32
|
htmlError = false,
|
|
29
33
|
value = $bindable(null),
|
|
30
34
|
onFocus = null,
|
|
@@ -34,6 +38,10 @@
|
|
|
34
38
|
autocomplete = 'on',
|
|
35
39
|
oninput
|
|
36
40
|
}: Props = $props();
|
|
41
|
+
|
|
42
|
+
function hasErrors() {
|
|
43
|
+
return error !== null || errors?.length > 0;
|
|
44
|
+
}
|
|
37
45
|
</script>
|
|
38
46
|
|
|
39
47
|
<div class="iroco-ui-input">
|
|
@@ -50,7 +58,7 @@
|
|
|
50
58
|
{name}
|
|
51
59
|
{placeholder}
|
|
52
60
|
class:border
|
|
53
|
-
class:error={
|
|
61
|
+
class:error={hasErrors()}
|
|
54
62
|
class:readonlyInput={readonly === true}
|
|
55
63
|
{readonly}
|
|
56
64
|
{autocomplete}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { FormEventHandler, FullAutoFill, HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
export type ValidationErrorMessage = {
|
|
3
|
+
key: string;
|
|
4
|
+
isHtml?: boolean;
|
|
5
|
+
};
|
|
2
6
|
interface Props extends HTMLInputAttributes {
|
|
3
7
|
id?: string | null;
|
|
4
8
|
type?: 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | null | undefined;
|
|
@@ -6,6 +10,7 @@ interface Props extends HTMLInputAttributes {
|
|
|
6
10
|
label?: string | null;
|
|
7
11
|
placeholder?: string | null;
|
|
8
12
|
error?: string | null;
|
|
13
|
+
errors?: Array<ValidationErrorMessage> | null;
|
|
9
14
|
htmlError?: boolean;
|
|
10
15
|
value?: string | null;
|
|
11
16
|
onFocus?: ((e: FocusEvent) => void) | null;
|