@iroco/ui 1.5.0 → 1.6.0
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/Alert.svelte +4 -0
- package/dist/Button.stories.svelte +1 -1
- package/dist/Button.svelte +8 -19
- package/dist/Button.svelte.d.ts +2 -9
- package/dist/NavBar.stories.svelte +9 -1
- package/dist/NavBar.svelte +16 -13
- package/dist/NavBar.svelte.d.ts +3 -19
- package/dist/Navigation.svelte +2 -2
- package/dist/NumberInput.svelte +4 -20
- package/dist/NumberInput.svelte.d.ts +3 -9
- package/dist/RadioButton.svelte +2 -9
- package/dist/RadioButton.svelte.d.ts +0 -3
- package/dist/TextInput.svelte +6 -29
- package/dist/TextInput.svelte.d.ts +2 -12
- package/package.json +1 -1
package/dist/Alert.svelte
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
{#snippet template({ ...args })}
|
|
33
|
-
<!--👇 '
|
|
33
|
+
<!--👇 'onclick' allows to forward event to addon-actions -->
|
|
34
34
|
<Button {...args} onclick={handleClick}>
|
|
35
35
|
You clicked: {count}
|
|
36
36
|
</Button>
|
package/dist/Button.svelte
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
HTMLButtonAttributes,
|
|
4
|
+
HTMLInputAttributes,
|
|
5
|
+
MouseEventHandler
|
|
6
|
+
} from 'svelte/elements';
|
|
3
7
|
|
|
4
|
-
interface Props {
|
|
5
|
-
type?: 'button' | 'reset' | 'submit' | null | undefined;
|
|
6
|
-
disabled?: boolean;
|
|
8
|
+
interface Props extends HTMLButtonAttributes {
|
|
7
9
|
kind?: 'danger' | 'success' | 'dark' | 'basic';
|
|
8
10
|
size?: 'small' | 'regular';
|
|
9
11
|
fullWidth?: boolean;
|
|
10
|
-
id?: string | null;
|
|
11
|
-
formaction?: string | null;
|
|
12
|
-
form?: string | null;
|
|
13
|
-
children?: import('svelte').Snippet;
|
|
14
|
-
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
15
12
|
}
|
|
16
13
|
|
|
17
14
|
let {
|
|
@@ -20,23 +17,15 @@
|
|
|
20
17
|
kind = 'basic',
|
|
21
18
|
size = 'regular',
|
|
22
19
|
fullWidth = false,
|
|
23
|
-
id = null,
|
|
24
|
-
formaction = null,
|
|
25
|
-
form = null,
|
|
26
20
|
children,
|
|
27
|
-
|
|
21
|
+
...rest
|
|
28
22
|
}: Props = $props();
|
|
29
23
|
</script>
|
|
30
24
|
|
|
31
25
|
<button
|
|
32
|
-
{id}
|
|
33
26
|
class={`iroco-ui-button iroco-ui-button--${size} iroco-ui-button--${kind} ${fullWidth ? 'iroco-ui-button--full-width' : ''}`}
|
|
34
27
|
class:disabled
|
|
35
|
-
{
|
|
36
|
-
{formaction}
|
|
37
|
-
{disabled}
|
|
38
|
-
{onclick}
|
|
39
|
-
{form}
|
|
28
|
+
{...rest}
|
|
40
29
|
>
|
|
41
30
|
{@render children?.()}
|
|
42
31
|
</button>
|
package/dist/Button.svelte.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
interface Props {
|
|
3
|
-
type?: 'button' | 'reset' | 'submit' | null | undefined;
|
|
4
|
-
disabled?: boolean;
|
|
1
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
2
|
+
interface Props extends HTMLButtonAttributes {
|
|
5
3
|
kind?: 'danger' | 'success' | 'dark' | 'basic';
|
|
6
4
|
size?: 'small' | 'regular';
|
|
7
5
|
fullWidth?: boolean;
|
|
8
|
-
id?: string | null;
|
|
9
|
-
formaction?: string | null;
|
|
10
|
-
form?: string | null;
|
|
11
|
-
children?: import('svelte').Snippet;
|
|
12
|
-
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
13
6
|
}
|
|
14
7
|
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
15
8
|
type Button = ReturnType<typeof Button>;
|
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
]
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
|
|
28
|
+
function handleClose() {
|
|
29
|
+
console.log('onclick');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function handleClickLink(e) {
|
|
33
|
+
console.log('onclick_link : ', e);
|
|
34
|
+
}
|
|
27
35
|
</script>
|
|
28
36
|
|
|
29
37
|
<script lang="ts">
|
|
@@ -31,7 +39,7 @@
|
|
|
31
39
|
</script>
|
|
32
40
|
|
|
33
41
|
{#snippet template({ ...args })}
|
|
34
|
-
<NavBar {...args} />
|
|
42
|
+
<NavBar {...args} onclick={handleClose} onclick_link={handleClickLink} />
|
|
35
43
|
{/snippet}
|
|
36
44
|
|
|
37
45
|
<Story name="Default" />
|
package/dist/NavBar.svelte
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { IconClose } from './index';
|
|
3
|
-
import { createEventDispatcher } from 'svelte';
|
|
4
3
|
import { NavigationItem, NavigationItemType } from './definition.js';
|
|
5
4
|
import type { MouseEventHandler } from 'svelte/elements';
|
|
6
5
|
|
|
@@ -10,19 +9,17 @@
|
|
|
10
9
|
version?: string | null;
|
|
11
10
|
currentRoute?: string | null;
|
|
12
11
|
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
12
|
+
onclick_link?: MouseEventHandler<HTMLButtonElement>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
let {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
dispatch('click_link');
|
|
25
|
-
};
|
|
15
|
+
let {
|
|
16
|
+
navigationItems,
|
|
17
|
+
type,
|
|
18
|
+
version = null,
|
|
19
|
+
currentRoute,
|
|
20
|
+
onclick,
|
|
21
|
+
onclick_link
|
|
22
|
+
}: Props = $props();
|
|
26
23
|
|
|
27
24
|
function isActive(item: NavigationItem): boolean {
|
|
28
25
|
if (typeof item.hrefOrCallback === 'string') {
|
|
@@ -47,7 +44,13 @@
|
|
|
47
44
|
</form>
|
|
48
45
|
{:else}
|
|
49
46
|
<a
|
|
50
|
-
onclick={() =>
|
|
47
|
+
onclick={() => {
|
|
48
|
+
if (typeof item.hrefOrCallback === 'function') {
|
|
49
|
+
item.hrefOrCallback();
|
|
50
|
+
return false; // to avoid calling href
|
|
51
|
+
}
|
|
52
|
+
onclick_link();
|
|
53
|
+
}}
|
|
51
54
|
href={typeof item.hrefOrCallback === 'string' ? item.hrefOrCallback : '#'}
|
|
52
55
|
class:iroco-ui-button={item.type === NavigationItemType.BUTTON}
|
|
53
56
|
class:iroco-ui-button--small={item.type === NavigationItemType.BUTTON}
|
package/dist/NavBar.svelte.d.ts
CHANGED
|
@@ -6,24 +6,8 @@ interface Props {
|
|
|
6
6
|
version?: string | null;
|
|
7
7
|
currentRoute?: string | null;
|
|
8
8
|
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
onclick_link?: MouseEventHandler<HTMLButtonElement>;
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
$$bindings?: Bindings;
|
|
13
|
-
} & Exports;
|
|
14
|
-
(internal: unknown, props: Props & {
|
|
15
|
-
$$events?: Events;
|
|
16
|
-
$$slots?: Slots;
|
|
17
|
-
}): Exports & {
|
|
18
|
-
$set?: any;
|
|
19
|
-
$on?: any;
|
|
20
|
-
};
|
|
21
|
-
z_$$bindings?: Bindings;
|
|
22
|
-
}
|
|
23
|
-
declare const NavBar: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
24
|
-
click_link: CustomEvent<any>;
|
|
25
|
-
} & {
|
|
26
|
-
[evt: string]: CustomEvent<any>;
|
|
27
|
-
}, {}, {}, "">;
|
|
28
|
-
type NavBar = InstanceType<typeof NavBar>;
|
|
11
|
+
declare const NavBar: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type NavBar = ReturnType<typeof NavBar>;
|
|
29
13
|
export default NavBar;
|
package/dist/Navigation.svelte
CHANGED
package/dist/NumberInput.svelte
CHANGED
|
@@ -1,35 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
3
|
|
|
4
4
|
interface Props extends HTMLInputAttributes {
|
|
5
|
-
|
|
6
|
-
label: string | '' | undefined;
|
|
7
|
-
placeholder?: string | '' | undefined;
|
|
5
|
+
label?: string | '' | undefined;
|
|
8
6
|
error?: string | undefined;
|
|
9
|
-
value?: number | undefined;
|
|
10
|
-
min: number | undefined;
|
|
11
|
-
max: number | undefined;
|
|
12
|
-
onchange: ChangeEventHandler<HTMLInputElement> | null | undefined;
|
|
13
7
|
}
|
|
14
8
|
|
|
15
|
-
let {
|
|
16
|
-
id,
|
|
17
|
-
label,
|
|
18
|
-
placeholder = '',
|
|
19
|
-
error = undefined,
|
|
20
|
-
value = $bindable(undefined),
|
|
21
|
-
min,
|
|
22
|
-
max,
|
|
23
|
-
onchange,
|
|
24
|
-
...rest
|
|
25
|
-
}: Props = $props();
|
|
9
|
+
let { id, label, error = undefined, ...rest }: Props = $props();
|
|
26
10
|
</script>
|
|
27
11
|
|
|
28
12
|
<div class="iroco-ui-input">
|
|
29
13
|
{#if label}
|
|
30
14
|
<label class="iroco-ui-label" for={id}>{label}</label>
|
|
31
15
|
{/if}
|
|
32
|
-
<input {
|
|
16
|
+
<input {id} type="number" {...rest} />
|
|
33
17
|
{#if error}
|
|
34
18
|
<p data-testid="error" class="error">{error}</p>
|
|
35
19
|
{/if}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
2
|
interface Props extends HTMLInputAttributes {
|
|
3
|
-
|
|
4
|
-
label: string | '' | undefined;
|
|
5
|
-
placeholder?: string | '' | undefined;
|
|
3
|
+
label?: string | '' | undefined;
|
|
6
4
|
error?: string | undefined;
|
|
7
|
-
value?: number | undefined;
|
|
8
|
-
min: number | undefined;
|
|
9
|
-
max: number | undefined;
|
|
10
|
-
onchange: ChangeEventHandler<HTMLInputElement> | null | undefined;
|
|
11
5
|
}
|
|
12
|
-
declare const NumberInput: import("svelte").Component<Props, {}, "
|
|
6
|
+
declare const NumberInput: import("svelte").Component<Props, {}, "">;
|
|
13
7
|
type NumberInput = ReturnType<typeof NumberInput>;
|
|
14
8
|
export default NumberInput;
|
package/dist/RadioButton.svelte
CHANGED
|
@@ -2,22 +2,15 @@
|
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
3
|
|
|
4
4
|
interface Props extends HTMLInputAttributes {
|
|
5
|
-
value?: string | number | null;
|
|
6
5
|
group?: string | number | null;
|
|
7
|
-
name?: string | null;
|
|
8
|
-
checked?: boolean;
|
|
9
6
|
children?: import('svelte').Snippet;
|
|
10
7
|
}
|
|
11
8
|
|
|
12
|
-
let {
|
|
13
|
-
|
|
14
|
-
function onchange(event: Event) {
|
|
15
|
-
group = event.currentTarget.value;
|
|
16
|
-
}
|
|
9
|
+
let { group = $bindable(null), children, ...others }: Props = $props();
|
|
17
10
|
</script>
|
|
18
11
|
|
|
19
12
|
<label class="iroco-ui-radio">
|
|
20
|
-
<input type="radio" bind:group {
|
|
13
|
+
<input type="radio" bind:group {...others} />
|
|
21
14
|
<span class="radio-button-color"></span>
|
|
22
15
|
{@render children?.()}
|
|
23
16
|
</label>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
2
|
interface Props extends HTMLInputAttributes {
|
|
3
|
-
value?: string | number | null;
|
|
4
3
|
group?: string | number | null;
|
|
5
|
-
name?: string | null;
|
|
6
|
-
checked?: boolean;
|
|
7
4
|
children?: import('svelte').Snippet;
|
|
8
5
|
}
|
|
9
6
|
declare const RadioButton: import("svelte").Component<Props, {}, "group">;
|
package/dist/TextInput.svelte
CHANGED
|
@@ -1,46 +1,30 @@
|
|
|
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
6
|
interface Props extends HTMLInputAttributes {
|
|
7
|
-
id?: string | null;
|
|
8
|
-
type?: 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | null | undefined;
|
|
9
|
-
name?: string | null;
|
|
10
7
|
label?: string | null;
|
|
11
|
-
placeholder?: string | null;
|
|
12
8
|
error?: string | null;
|
|
13
9
|
errors?: Array<ValidationErrorMessage> | null;
|
|
14
10
|
htmlError?: boolean;
|
|
15
|
-
value?: string | null;
|
|
16
|
-
onFocus?: ((e: FocusEvent) => void) | null;
|
|
17
|
-
onBlur?: ((e: Event) => void) | null;
|
|
18
|
-
readonly?: boolean;
|
|
19
11
|
border?: boolean;
|
|
20
|
-
autocomplete?: FullAutoFill | null | undefined;
|
|
21
|
-
oninput?: FormEventHandler<HTMLInputElement> | null | undefined;
|
|
22
12
|
}
|
|
23
13
|
|
|
24
14
|
let {
|
|
25
|
-
id = null,
|
|
26
15
|
type = 'text',
|
|
27
|
-
name = null,
|
|
28
16
|
label = null,
|
|
29
|
-
placeholder = null,
|
|
30
17
|
error = null,
|
|
31
|
-
errors =
|
|
18
|
+
errors = [],
|
|
32
19
|
htmlError = false,
|
|
33
|
-
value = $bindable(null),
|
|
34
|
-
onFocus = null,
|
|
35
|
-
onBlur = null,
|
|
36
|
-
readonly = false,
|
|
37
20
|
border = false,
|
|
38
21
|
autocomplete = 'on',
|
|
39
|
-
|
|
22
|
+
readonly,
|
|
23
|
+
...rest
|
|
40
24
|
}: Props = $props();
|
|
41
25
|
|
|
42
26
|
function hasErrors() {
|
|
43
|
-
return error !== null || errors?.length > 0;
|
|
27
|
+
return error !== null || (errors?.length ?? 0) > 0;
|
|
44
28
|
}
|
|
45
29
|
</script>
|
|
46
30
|
|
|
@@ -49,19 +33,12 @@
|
|
|
49
33
|
<label class="iroco-ui-label" for={id}>{label}</label>
|
|
50
34
|
{/if}
|
|
51
35
|
<input
|
|
52
|
-
{oninput}
|
|
53
|
-
bind:value
|
|
54
|
-
onfocus={onFocus}
|
|
55
|
-
onblur={onBlur}
|
|
56
|
-
{id}
|
|
57
36
|
{type}
|
|
58
|
-
{name}
|
|
59
|
-
{placeholder}
|
|
60
37
|
class:border
|
|
61
38
|
class:error={hasErrors()}
|
|
62
39
|
class:readonlyInput={readonly === true}
|
|
63
|
-
{readonly}
|
|
64
40
|
{autocomplete}
|
|
41
|
+
{...rest}
|
|
65
42
|
/>
|
|
66
43
|
{#if error != null}
|
|
67
44
|
<p data-testid="error" class="error">
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
2
|
export type ValidationErrorMessage = {
|
|
3
3
|
key: string;
|
|
4
4
|
isHtml?: boolean;
|
|
5
5
|
};
|
|
6
6
|
interface Props extends HTMLInputAttributes {
|
|
7
|
-
id?: string | null;
|
|
8
|
-
type?: 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | null | undefined;
|
|
9
|
-
name?: string | null;
|
|
10
7
|
label?: string | null;
|
|
11
|
-
placeholder?: string | null;
|
|
12
8
|
error?: string | null;
|
|
13
9
|
errors?: Array<ValidationErrorMessage> | null;
|
|
14
10
|
htmlError?: boolean;
|
|
15
|
-
value?: string | null;
|
|
16
|
-
onFocus?: ((e: FocusEvent) => void) | null;
|
|
17
|
-
onBlur?: ((e: Event) => void) | null;
|
|
18
|
-
readonly?: boolean;
|
|
19
11
|
border?: boolean;
|
|
20
|
-
autocomplete?: FullAutoFill | null | undefined;
|
|
21
|
-
oninput?: FormEventHandler<HTMLInputElement> | null | undefined;
|
|
22
12
|
}
|
|
23
|
-
declare const TextInput: import("svelte").Component<Props, {}, "
|
|
13
|
+
declare const TextInput: import("svelte").Component<Props, {}, "">;
|
|
24
14
|
type TextInput = ReturnType<typeof TextInput>;
|
|
25
15
|
export default TextInput;
|