@iroco/ui 1.1.5 → 1.1.6
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/README.md +64 -32
- package/dist/Alert.stories.svelte +9 -8
- package/dist/Button.stories.svelte +0 -2
- package/dist/Button.svelte +1 -2
- package/dist/DataTable.stories.svelte +2 -5
- package/dist/DataTable.svelte +22 -25
- package/dist/IconBurger.stories.svelte +3 -6
- package/dist/IconInfo.stories.svelte +3 -6
- package/dist/IconIrocoLogo.stories.svelte +3 -3
- package/dist/IconMoreSign.stories.svelte +1 -1
- package/dist/IconTrashCan.stories.svelte +3 -4
- package/dist/ImageArticle.stories.svelte +16 -11
- package/dist/ImageArticle.svelte +2 -4
- package/dist/IrocoLogo.stories.svelte +3 -6
- package/dist/IrocoLogo.svelte +0 -1
- package/dist/Loader.stories.svelte +1 -2
- package/dist/Loader.svelte +17 -17
- package/dist/NavBar.stories.svelte +12 -9
- package/dist/NavBar.svelte +2 -5
- package/dist/Navigation.stories.svelte +13 -13
- package/dist/Navigation.svelte +1 -7
- package/dist/NumberInput.stories.svelte +0 -3
- package/dist/NumberInput.svelte +2 -2
- package/dist/RadioButton.stories.svelte +12 -12
- package/dist/RadioButton.svelte +2 -9
- package/dist/TextInput.stories.svelte +1 -5
- package/dist/TextInput.svelte +0 -2
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Design system for Iroco [based on SvelteKit](https://kit.svelte.dev/docs/packaging).
|
|
6
6
|
|
|
7
|
-
See the [Documentation](https://iroco-co.github.io/iroco-ui/)
|
|
7
|
+
See the [Documentation](https://iroco-co.github.io/iroco-ui/).
|
|
8
8
|
|
|
9
9
|
# Install in your svelte application
|
|
10
10
|
|
|
@@ -20,16 +20,7 @@ npm install @iroco/ui
|
|
|
20
20
|
npm install @iroco/ui@next
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
##
|
|
24
|
-
|
|
25
|
-
`src/app.scss`
|
|
26
|
-
|
|
27
|
-
```scss
|
|
28
|
-
@use 'node_modules/@iroco/ui/dist/scss/fonts';
|
|
29
|
-
@use 'node_modules/@iroco/ui/dist/scss/style';
|
|
30
|
-
@use 'node_modules/@iroco/ui/dist/scss/constants';
|
|
31
|
-
@use 'node_modules/@iroco/ui/dist/scss/containers';
|
|
32
|
-
```
|
|
23
|
+
## Usage
|
|
33
24
|
|
|
34
25
|
Example of layout with navigation
|
|
35
26
|
|
|
@@ -39,67 +30,108 @@ Example of layout with navigation
|
|
|
39
30
|
<script>
|
|
40
31
|
import '../app.scss';
|
|
41
32
|
import { Navigation, NavigationItem } from '@iroco/ui';
|
|
33
|
+
import { base } from '$app/paths';
|
|
34
|
+
import { page } from '$app/state';
|
|
35
|
+
|
|
36
|
+
let currentRoute = $derived(page?.route?.id ?? '');
|
|
37
|
+
|
|
38
|
+
/** snip **/
|
|
42
39
|
</script>
|
|
43
40
|
|
|
44
|
-
<Navigation
|
|
41
|
+
<Navigation
|
|
42
|
+
{navigationItems}
|
|
43
|
+
{currentRoute}
|
|
44
|
+
baseUrl={base}
|
|
45
|
+
type={'sidebar'}
|
|
46
|
+
title={$_('account.title')}
|
|
47
|
+
version={data?.version}
|
|
48
|
+
/>
|
|
49
|
+
|
|
45
50
|
<main class="main">
|
|
46
51
|
<slot />
|
|
47
52
|
</main>
|
|
48
53
|
|
|
49
54
|
<style lang="scss">
|
|
50
|
-
@use '
|
|
51
|
-
@use '
|
|
52
|
-
@use '
|
|
53
|
-
@use 'node_modules/@iroco/ui/dist/scss/button.scss';
|
|
55
|
+
@use '@iroco/ui/scss/constants.scss';
|
|
56
|
+
@use '@iroco/ui/scss/containers.scss';
|
|
57
|
+
@use '@iroco/ui/scss/button.scss';
|
|
54
58
|
</style>
|
|
55
59
|
```
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
## Customize colors
|
|
62
|
+
|
|
63
|
+
You can override CSS vars that mainly located in `@iroco/ui/scss/colors.scss'` in a custom scss file such as `src/app.scss`.
|
|
64
|
+
|
|
65
|
+
Ex. in a custom `src/my-colors.css` file
|
|
66
|
+
|
|
67
|
+
```scss
|
|
68
|
+
:root {
|
|
69
|
+
--color-primary-light: pink;
|
|
70
|
+
--color-primary: red;
|
|
71
|
+
}
|
|
72
|
+
```
|
|
58
73
|
|
|
59
|
-
|
|
74
|
+
Then in your `src/app.scss` style you can both `@iroco-ui` default scss style and the override.
|
|
75
|
+
|
|
76
|
+
```scss
|
|
77
|
+
@use '@iroco/ui/scss/colors.scss';
|
|
78
|
+
@use 'my-colors.scss';
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Develop
|
|
60
82
|
|
|
61
83
|
To install dependencies :
|
|
62
84
|
|
|
63
85
|
```shell
|
|
64
|
-
|
|
86
|
+
npm ci
|
|
65
87
|
```
|
|
66
88
|
|
|
67
89
|
Building :
|
|
68
90
|
|
|
69
91
|
```shell
|
|
70
|
-
|
|
92
|
+
npm run build
|
|
71
93
|
```
|
|
72
94
|
|
|
73
|
-
Releasing :
|
|
95
|
+
Releasing (tags and releases to npm):
|
|
74
96
|
|
|
75
97
|
```shell
|
|
76
|
-
|
|
98
|
+
npm publish
|
|
77
99
|
```
|
|
78
100
|
|
|
79
|
-
|
|
101
|
+
## Documentation (Storybook)
|
|
80
102
|
|
|
81
103
|
The docs directory contains the documentation app deployed on github pages. To install dependencies :
|
|
82
104
|
|
|
83
105
|
```shell
|
|
84
|
-
|
|
106
|
+
npm ci
|
|
85
107
|
```
|
|
86
108
|
|
|
87
109
|
You can add/update components documentation into `docs/src/pages/components` and update the left menu in `docs/src/includes/sidebar.md`.
|
|
88
110
|
|
|
89
|
-
When you have to work on the CSS for components, you can have hot reloading.
|
|
111
|
+
When you have to work on the CSS for components, you can have hot reloading.
|
|
112
|
+
Launch the dev server for docs :
|
|
90
113
|
|
|
91
114
|
```shell
|
|
92
|
-
|
|
115
|
+
npm run dev
|
|
93
116
|
```
|
|
94
117
|
|
|
95
|
-
|
|
118
|
+
To build the documentation (in `/docs`) :
|
|
96
119
|
|
|
97
120
|
```shell
|
|
98
|
-
|
|
121
|
+
npm run build-storybook
|
|
99
122
|
```
|
|
100
123
|
|
|
101
|
-
|
|
124
|
+
## CSS Custom properties in Storybook
|
|
102
125
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
126
|
+
CSS Custom properties allows to try out variations of the design system.
|
|
127
|
+
It relies on parts of the design system style that have been ported to CSS vars in this very purpose.
|
|
128
|
+
|
|
129
|
+
Those variable relate mainly to colors.
|
|
130
|
+
|
|
131
|
+
Add missing variables to Storybook
|
|
132
|
+
|
|
133
|
+
[.storybook/preview.ts](.storybook/preview.ts)
|
|
134
|
+
|
|
135
|
+
It should reflect variables declared here :
|
|
136
|
+
|
|
137
|
+
[src/lib/scss/colors.scss](src/lib/scss/colors.scss)
|
|
@@ -14,13 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
{#snippet template({ ...args })}
|
|
16
16
|
<Alert {...args}>
|
|
17
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eros lacus, commodo eu tristique
|
|
18
|
-
tellus. Nulla facilisi. Integer a tincidunt purus. Proin vulputate tristique
|
|
19
|
-
malesuada interdum. Phasellus tristique ac leo at fringilla. Cras
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eros lacus, commodo eu tristique
|
|
18
|
+
non, ultricies eu tellus. Nulla facilisi. Integer a tincidunt purus. Proin vulputate tristique
|
|
19
|
+
magna. Aliquam id eros id ante malesuada interdum. Phasellus tristique ac leo at fringilla. Cras
|
|
20
|
+
a viverra nibh, vitae rutrum ante. Sed pharetra nibh ac velit dignissim ornare sed accumsan
|
|
21
|
+
lacus. Vestibulum tincidunt purus sapien, ac dapibus sem semper a. Nullam venenatis vestibulum
|
|
22
|
+
risus id molestie. Aliquam facilisis nunc at nunc aliquam hendrerit. Etiam sodales sodales
|
|
23
|
+
lectus, ut suscipit lacus vehicula nec. Proin vel magna sed orci condimentum ornare in a odio.
|
|
24
|
+
In varius eu augue eget tincidunt. Ut quis porttitor nulla. Nulla leo nunc, efficitur non ipsum
|
|
25
|
+
vel, tincidunt auctor lectus.
|
|
24
26
|
</Alert>
|
|
25
27
|
{/snippet}
|
|
26
28
|
|
|
@@ -28,4 +30,3 @@
|
|
|
28
30
|
<Story name="Danger" args={{ type: 'danger' }} />
|
|
29
31
|
<Story name="Flash" args={{ type: 'flash' }} />
|
|
30
32
|
<Story name="Success" args={{ type: 'success' }} />
|
|
31
|
-
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
5
5
|
|
|
6
6
|
const { Story } = defineMeta({
|
|
7
|
-
|
|
8
7
|
title: 'Iroco-UI/Atoms/Button',
|
|
9
8
|
component: Button,
|
|
10
9
|
argTypes: {
|
|
@@ -26,7 +25,6 @@
|
|
|
26
25
|
}
|
|
27
26
|
</script>
|
|
28
27
|
|
|
29
|
-
|
|
30
28
|
<script lang="ts">
|
|
31
29
|
setTemplate(template);
|
|
32
30
|
</script>
|
package/dist/Button.svelte
CHANGED
|
@@ -22,12 +22,11 @@
|
|
|
22
22
|
children,
|
|
23
23
|
onclick
|
|
24
24
|
}: Props = $props();
|
|
25
|
-
|
|
26
25
|
</script>
|
|
27
26
|
|
|
28
27
|
<button
|
|
29
28
|
{id}
|
|
30
|
-
class={`iroco-ui-button iroco-ui-button--${size} iroco-ui-button--${kind} ${fullWidth?'iroco-ui-button--full-width':''}`}
|
|
29
|
+
class={`iroco-ui-button iroco-ui-button--${size} iroco-ui-button--${kind} ${fullWidth ? 'iroco-ui-button--full-width' : ''}`}
|
|
31
30
|
class:disabled
|
|
32
31
|
{type}
|
|
33
32
|
{disabled}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
5
5
|
|
|
6
6
|
const { Story } = defineMeta({
|
|
7
|
-
|
|
8
7
|
title: 'Iroco-UI/Components/DataTable',
|
|
9
8
|
component: DataTable,
|
|
10
9
|
argTypes: {},
|
|
@@ -22,15 +21,13 @@
|
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
23
|
</script>
|
|
24
|
+
|
|
25
25
|
<script lang="ts">
|
|
26
26
|
setTemplate(template);
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
{#snippet template({ ...args })}
|
|
30
|
-
<DataTable
|
|
31
|
-
{...args}
|
|
32
|
-
|
|
33
|
-
/>
|
|
30
|
+
<DataTable {...args} />
|
|
34
31
|
{/snippet}
|
|
35
32
|
|
|
36
33
|
<Story name="Default" />
|
package/dist/DataTable.svelte
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
|
-
rows: Array<TableRow
|
|
6
|
-
columns: Array<TableColumn
|
|
5
|
+
rows: Array<TableRow>;
|
|
6
|
+
columns: Array<TableColumn>;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
type TableColumn = {
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
title: string;
|
|
12
12
|
renderComponent?: {
|
|
13
13
|
component: Component;
|
|
14
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
14
|
props?: any;
|
|
16
15
|
};
|
|
17
16
|
};
|
|
@@ -25,31 +24,29 @@
|
|
|
25
24
|
|
|
26
25
|
<table class="data-table">
|
|
27
26
|
<thead class="data-table__header">
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
<tr>
|
|
28
|
+
{#each columns as column}
|
|
29
|
+
<th class="data-table__header__cell">
|
|
30
|
+
{column.title}
|
|
31
|
+
</th>
|
|
32
|
+
{/each}
|
|
33
|
+
</tr>
|
|
35
34
|
</thead>
|
|
36
35
|
|
|
37
36
|
<tbody class="data-table__body">
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</tr>
|
|
52
|
-
{/each}
|
|
37
|
+
{#each rows as row}
|
|
38
|
+
<tr class="data-table__body__row">
|
|
39
|
+
{#each columns as { key, renderComponent }}
|
|
40
|
+
<td class="data-table__body__cell">
|
|
41
|
+
{#if renderComponent}
|
|
42
|
+
<renderComponent.component on:click={() => renderComponent.props.onclick(row)} />
|
|
43
|
+
{:else}
|
|
44
|
+
{row[key]}
|
|
45
|
+
{/if}
|
|
46
|
+
</td>
|
|
47
|
+
{/each}
|
|
48
|
+
</tr>
|
|
49
|
+
{/each}
|
|
53
50
|
</tbody>
|
|
54
51
|
</table>
|
|
55
52
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { IconBurger } from './index';
|
|
3
|
-
import {defineMeta} from '@storybook/addon-svelte-csf'
|
|
4
|
-
|
|
5
|
-
const {Story} = defineMeta({
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
8
4
|
|
|
5
|
+
const { Story } = defineMeta({
|
|
9
6
|
title: 'Iroco-UI/Icons/IconBurger',
|
|
10
7
|
component: IconBurger,
|
|
11
8
|
argTypes: {
|
|
@@ -20,7 +17,7 @@
|
|
|
20
17
|
max: 512
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
|
-
})
|
|
20
|
+
});
|
|
24
21
|
</script>
|
|
25
22
|
|
|
26
23
|
<Story name="Default" />
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { IconInfo } from './index';
|
|
3
3
|
|
|
4
|
-
import {defineMeta} from '@storybook/addon-svelte-csf'
|
|
5
|
-
|
|
6
|
-
const {Story} = defineMeta({
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
9
5
|
|
|
6
|
+
const { Story } = defineMeta({
|
|
10
7
|
title: 'Iroco-UI/Icons/IconInfo',
|
|
11
8
|
type: 'Icons',
|
|
12
9
|
component: IconInfo,
|
|
@@ -22,7 +19,7 @@
|
|
|
22
19
|
max: 512
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
})
|
|
22
|
+
});
|
|
26
23
|
</script>
|
|
27
24
|
|
|
28
25
|
<Story name="Default" />
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { IconIrocoLogo } from './index';
|
|
3
|
-
import {defineMeta,setTemplate} from '@storybook/addon-svelte-csf'
|
|
3
|
+
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
4
4
|
|
|
5
|
-
const {Story} = defineMeta({
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
6
|
title: 'Iroco-UI/Iroco/IconIrocoLogo',
|
|
7
7
|
component: IconIrocoLogo,
|
|
8
8
|
argTypes: {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
control: { type: 'color' }
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
})
|
|
23
|
+
});
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<script lang="ts">
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { IconTrashCan } from './index';
|
|
3
3
|
|
|
4
|
-
import {defineMeta} from '@storybook/addon-svelte-csf'
|
|
5
|
-
|
|
6
|
-
const {Story} = defineMeta({
|
|
4
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
7
5
|
|
|
6
|
+
const { Story } = defineMeta({
|
|
8
7
|
title: 'Iroco-UI/Icons/IconTrashCan',
|
|
9
8
|
component: IconTrashCan,
|
|
10
9
|
argTypes: {
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
max: 512
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
|
-
})
|
|
21
|
+
});
|
|
23
22
|
</script>
|
|
24
23
|
|
|
25
24
|
<Story name="Default" />
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
9
9
|
|
|
10
10
|
const { Story } = defineMeta({
|
|
11
|
-
|
|
12
11
|
title: 'Iroco-UI/Components/ImageArticle',
|
|
13
12
|
component: ImageArticle,
|
|
14
13
|
argTypes: {
|
|
@@ -25,7 +24,8 @@
|
|
|
25
24
|
discordImageFile,
|
|
26
25
|
youtubeImageFile,
|
|
27
26
|
tutorialsImageFile,
|
|
28
|
-
tutorialsImageFile
|
|
27
|
+
tutorialsImageFile
|
|
28
|
+
]
|
|
29
29
|
},
|
|
30
30
|
buttonList: {}
|
|
31
31
|
},
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
imgSrc: accessibilityImageFile,
|
|
35
35
|
figureCaption: undefined,
|
|
36
36
|
articleTitle: 'Accessibility',
|
|
37
|
-
articleContent:
|
|
37
|
+
articleContent:
|
|
38
|
+
'Accessibility is incredibly important, yet often overlooked in traditional digital design and development education. Because of this, The A11Y Project strives to be a living example of how to create beautiful, accessible, and inclusive digital experiences.',
|
|
38
39
|
buttonList: [
|
|
39
40
|
{ href: '/foo', label: 'Foo' },
|
|
40
41
|
{ href: '/bar', label: 'Bar' }
|
|
@@ -54,11 +55,15 @@
|
|
|
54
55
|
|
|
55
56
|
<Story name="Default" />
|
|
56
57
|
<Story name="Reversed" args={{ reversed: true }} />
|
|
57
|
-
<Story
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
<Story
|
|
59
|
+
name="Figure caption"
|
|
60
|
+
args={{
|
|
61
|
+
figureCaption: 'An optional caption for the figure',
|
|
62
|
+
buttonList: [
|
|
63
|
+
{
|
|
64
|
+
href: 'https://developer.mozilla.org/en-US/docs/Glossary/Accessible_description',
|
|
65
|
+
label: 'Learn about accessible description'
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}}
|
|
69
|
+
/>
|
package/dist/ImageArticle.svelte
CHANGED
|
@@ -26,11 +26,9 @@
|
|
|
26
26
|
|
|
27
27
|
<div class="imagearticle" class:reversed>
|
|
28
28
|
<figure class="imagearticle__figure">
|
|
29
|
-
<img class="imagearticle__figure__image"
|
|
30
|
-
src={imgSrc}
|
|
31
|
-
{alt} />
|
|
29
|
+
<img class="imagearticle__figure__image" src={imgSrc} {alt} />
|
|
32
30
|
{#if figureCaption}
|
|
33
|
-
<figcaption>{
|
|
31
|
+
<figcaption>{figureCaption}</figcaption>
|
|
34
32
|
{/if}
|
|
35
33
|
</figure>
|
|
36
34
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { IrocoLogo } from './index';
|
|
3
3
|
|
|
4
|
-
import {defineMeta,setTemplate} from '@storybook/addon-svelte-csf'
|
|
5
|
-
|
|
6
|
-
const {Story} = defineMeta({
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
9
5
|
|
|
6
|
+
const { Story } = defineMeta({
|
|
10
7
|
title: 'Iroco-UI/Iroco/IrocoLogo',
|
|
11
8
|
type: 'Icons',
|
|
12
9
|
component: IrocoLogo,
|
|
@@ -22,7 +19,7 @@
|
|
|
22
19
|
max: 512
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
})
|
|
22
|
+
});
|
|
26
23
|
</script>
|
|
27
24
|
|
|
28
25
|
<script lang="ts">
|
package/dist/IrocoLogo.svelte
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
5
5
|
|
|
6
6
|
const { Story } = defineMeta({
|
|
7
|
-
|
|
8
|
-
|
|
9
7
|
title: 'Iroco-UI/Atoms/Loader',
|
|
10
8
|
component: Loader,
|
|
11
9
|
argTypes: {}
|
|
12
10
|
});
|
|
13
11
|
</script>
|
|
12
|
+
|
|
14
13
|
<script lang="ts">
|
|
15
14
|
setTemplate(template);
|
|
16
15
|
</script>
|
package/dist/Loader.svelte
CHANGED
|
@@ -7,24 +7,24 @@
|
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
9
|
<style>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
.rotate {
|
|
11
|
+
animation: rotation 2s;
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
.linear {
|
|
15
|
+
animation-timing-function: linear;
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
.infinite {
|
|
19
|
+
animation-iteration-count: infinite;
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
@keyframes rotation {
|
|
23
|
+
from {
|
|
24
|
+
transform: rotate(0deg);
|
|
25
|
+
}
|
|
26
|
+
to {
|
|
27
|
+
transform: rotate(359deg);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
30
|
</style>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
args: {
|
|
16
|
-
type:
|
|
16
|
+
type: 'topbar',
|
|
17
17
|
navigationItems: [
|
|
18
18
|
new NavigationItem('About', `/about`),
|
|
19
19
|
new NavigationItem('Foo', `/foo`),
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
new NavigationItem('Form', `/form`, NavigationItemType.FORM)
|
|
24
24
|
]
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
});
|
|
28
27
|
</script>
|
|
28
|
+
|
|
29
29
|
<script lang="ts">
|
|
30
30
|
setTemplate(template);
|
|
31
31
|
</script>
|
|
@@ -37,11 +37,14 @@
|
|
|
37
37
|
<Story name="Default" />
|
|
38
38
|
<Story name="Sidebar" args={{ type: 'sidebar' }} />
|
|
39
39
|
<Story name="Topbar" args={{ type: 'topbar' }} />
|
|
40
|
-
<Story
|
|
41
|
-
|
|
40
|
+
<Story
|
|
41
|
+
name="Active"
|
|
42
|
+
args={{
|
|
43
|
+
currentRoute: '/bar',
|
|
42
44
|
navigationItems: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}}
|
|
45
|
+
new NavigationItem('About', `/about`),
|
|
46
|
+
new NavigationItem('Foo', `/foo`),
|
|
47
|
+
new NavigationItem('Bar', `/bar`)
|
|
48
|
+
]
|
|
49
|
+
}}
|
|
50
|
+
/>
|
package/dist/NavBar.svelte
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
navigationItems: Array<NavigationItem>;
|
|
9
9
|
type: 'sidebar' | 'topbar';
|
|
10
10
|
version?: string | null;
|
|
11
|
-
currentRoute?: string| null;
|
|
11
|
+
currentRoute?: string | null;
|
|
12
12
|
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
let { navigationItems, type, version = null,currentRoute, onclick }: Props = $props();
|
|
15
|
+
let { navigationItems, type, version = null, currentRoute, onclick }: Props = $props();
|
|
16
16
|
|
|
17
17
|
const dispatch = createEventDispatcher();
|
|
18
18
|
|
|
@@ -26,14 +26,11 @@
|
|
|
26
26
|
|
|
27
27
|
function isActive(item: NavigationItem): boolean {
|
|
28
28
|
if (typeof item.hrefOrCallback === 'string') {
|
|
29
|
-
console.log("is string url",currentRoute);
|
|
30
29
|
const b = item.hrefOrCallback === currentRoute;
|
|
31
|
-
console.log("is active : ",b);
|
|
32
30
|
return b;
|
|
33
31
|
}
|
|
34
32
|
return false;
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
</script>
|
|
38
35
|
|
|
39
36
|
<nav data-testid={type} class="nav__{type}">
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
5
5
|
|
|
6
6
|
const { Story } = defineMeta({
|
|
7
|
-
|
|
8
|
-
|
|
9
7
|
title: 'Iroco-UI/Components/Navigation',
|
|
10
8
|
component: Navigation,
|
|
11
9
|
argTypes: {
|
|
@@ -15,7 +13,7 @@
|
|
|
15
13
|
},
|
|
16
14
|
args: {
|
|
17
15
|
type: 'topbar',
|
|
18
|
-
currentRoute:
|
|
16
|
+
currentRoute: '/foo',
|
|
19
17
|
navigationItems: [
|
|
20
18
|
new NavigationItem('About', `/about`),
|
|
21
19
|
new NavigationItem('Foo', `/foo`),
|
|
@@ -27,25 +25,27 @@
|
|
|
27
25
|
}
|
|
28
26
|
});
|
|
29
27
|
</script>
|
|
28
|
+
|
|
30
29
|
<script lang="ts">
|
|
31
30
|
setTemplate(template);
|
|
32
31
|
</script>
|
|
33
32
|
|
|
34
33
|
{#snippet template({ ...args })}
|
|
35
|
-
<Navigation
|
|
36
|
-
{...args}
|
|
37
|
-
/>
|
|
34
|
+
<Navigation {...args} />
|
|
38
35
|
{/snippet}
|
|
39
36
|
|
|
40
37
|
<Story name="Default" />
|
|
41
38
|
<Story name="Sidebar" args={{ type: 'sidebar' }} />
|
|
42
39
|
<Story name="Title" args={{ title: 'Alternative title' }} />
|
|
43
40
|
<Story name="Color" args={{ color: '#ABCDEF' }} />
|
|
44
|
-
<Story
|
|
45
|
-
|
|
41
|
+
<Story
|
|
42
|
+
name="Active"
|
|
43
|
+
args={{
|
|
44
|
+
currentRoute: '/bar',
|
|
46
45
|
navigationItems: [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}}
|
|
46
|
+
new NavigationItem('About', `/about`),
|
|
47
|
+
new NavigationItem('Foo', `/foo`),
|
|
48
|
+
new NavigationItem('Bar', `/bar`)
|
|
49
|
+
]
|
|
50
|
+
}}
|
|
51
|
+
/>
|
package/dist/Navigation.svelte
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
currentRoute?: string | null;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
let {
|
|
18
17
|
baseUrl = '',
|
|
19
18
|
navigationItems,
|
|
@@ -63,12 +62,7 @@
|
|
|
63
62
|
<h1><a class="navigation__title-link" {href}>{title}</a></h1>
|
|
64
63
|
{/if}
|
|
65
64
|
</div>
|
|
66
|
-
<NavBar
|
|
67
|
-
{navigationItems}
|
|
68
|
-
{currentRoute}
|
|
69
|
-
{type}
|
|
70
|
-
{version}
|
|
71
|
-
/>
|
|
65
|
+
<NavBar {navigationItems} {currentRoute} {type} {version} />
|
|
72
66
|
</div>
|
|
73
67
|
|
|
74
68
|
<style>.container-wide {
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
5
5
|
|
|
6
6
|
const { Story } = defineMeta({
|
|
7
|
-
|
|
8
|
-
|
|
9
7
|
title: 'Iroco-UI/Form/NumberInput',
|
|
10
8
|
component: NumberInput,
|
|
11
9
|
argTypes: {
|
|
@@ -34,7 +32,6 @@
|
|
|
34
32
|
});
|
|
35
33
|
</script>
|
|
36
34
|
|
|
37
|
-
|
|
38
35
|
<script lang="ts">
|
|
39
36
|
setTemplate(template);
|
|
40
37
|
</script>
|
package/dist/NumberInput.svelte
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ChangeEventHandler, HTMLInputAttributes } from 'svelte/elements';
|
|
3
3
|
|
|
4
|
-
interface Props extends HTMLInputAttributes{
|
|
4
|
+
interface Props extends HTMLInputAttributes {
|
|
5
5
|
id: string;
|
|
6
6
|
label: string | '' | undefined;
|
|
7
7
|
placeholder?: string | '' | undefined;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
value?: number | undefined;
|
|
10
10
|
min: number | undefined;
|
|
11
11
|
max: number | undefined;
|
|
12
|
-
onchange: ChangeEventHandler<HTMLInputElement> | null | undefined
|
|
12
|
+
onchange: ChangeEventHandler<HTMLInputElement> | null | undefined;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
let {
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { RadioButton } from './index';
|
|
3
3
|
|
|
4
|
-
import {defineMeta,setTemplate} from '@storybook/addon-svelte-csf'
|
|
5
|
-
|
|
6
|
-
const {Story} = defineMeta({
|
|
4
|
+
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
7
5
|
|
|
6
|
+
const { Story } = defineMeta({
|
|
8
7
|
title: 'Iroco-UI/Form/RadioButton',
|
|
9
|
-
component: RadioButton
|
|
10
|
-
})
|
|
8
|
+
component: RadioButton
|
|
9
|
+
});
|
|
11
10
|
let group = $state('bar');
|
|
12
11
|
</script>
|
|
12
|
+
|
|
13
13
|
<script lang="ts">
|
|
14
14
|
setTemplate(template);
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
{#snippet template({ ...args })}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
<form class="iroco-ui-form">
|
|
19
|
+
<RadioButton bind:group name="name-hello" value="hello" {...args}>Hello</RadioButton>
|
|
20
|
+
<RadioButton bind:group name="name-foo" value="foo">Foo</RadioButton>
|
|
21
|
+
<RadioButton bind:group name="name-bar" value="bar">Bar</RadioButton>
|
|
22
|
+
</form>
|
|
23
|
+
Selected group : {group}
|
|
24
|
+
{/snippet}
|
|
25
25
|
|
|
26
26
|
<Story name="Default" />
|
package/dist/RadioButton.svelte
CHANGED
|
@@ -9,22 +9,15 @@
|
|
|
9
9
|
children?: import('svelte').Snippet;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
let {
|
|
13
|
-
value = null,
|
|
14
|
-
group = $bindable(null),
|
|
15
|
-
name = null,
|
|
16
|
-
checked,
|
|
17
|
-
children
|
|
18
|
-
}: Props = $props();
|
|
12
|
+
let { value = null, group = $bindable(null), name = null, checked, children }: Props = $props();
|
|
19
13
|
|
|
20
14
|
function onchange(event: Event) {
|
|
21
15
|
group = event.currentTarget.value;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
</script>
|
|
25
18
|
|
|
26
19
|
<label class="iroco-ui-radio">
|
|
27
|
-
<input type="radio" bind:group
|
|
20
|
+
<input type="radio" bind:group {value} {name} {checked} {onchange} />
|
|
28
21
|
<span class="radio-button-color"></span>
|
|
29
22
|
{@render children?.()}
|
|
30
23
|
</label>
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
5
5
|
|
|
6
6
|
const { Story } = defineMeta({
|
|
7
|
-
|
|
8
|
-
|
|
9
7
|
title: 'Iroco-UI/Form/TextInput',
|
|
10
8
|
component: TextInput,
|
|
11
9
|
argTypes: {
|
|
@@ -16,13 +14,11 @@
|
|
|
16
14
|
|
|
17
15
|
let oninputFoo = $state<string | null>('');
|
|
18
16
|
|
|
19
|
-
function handleOnInput(event: Event & { currentTarget: EventTarget & HTMLInputElement
|
|
17
|
+
function handleOnInput(event: Event & { currentTarget: EventTarget & HTMLInputElement }) {
|
|
20
18
|
oninputFoo = '' + event.data + ' ' + event.timeStamp;
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
</script>
|
|
24
21
|
|
|
25
|
-
|
|
26
22
|
<script lang="ts">
|
|
27
23
|
setTemplate(template);
|
|
28
24
|
</script>
|
package/dist/TextInput.svelte
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
/* eslint-disable svelte/no-at-html-tags */
|
|
3
2
|
import type { FormEventHandler, FullAutoFill, HTMLInputAttributes } from 'svelte/elements';
|
|
4
3
|
|
|
5
4
|
interface Props extends HTMLInputAttributes {
|
|
@@ -35,7 +34,6 @@
|
|
|
35
34
|
autocomplete = 'on',
|
|
36
35
|
oninput
|
|
37
36
|
}: Props = $props();
|
|
38
|
-
|
|
39
37
|
</script>
|
|
40
38
|
|
|
41
39
|
<div class="iroco-ui-input">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iroco/ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Iroco design system based on Svelte",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"build": "svelte-package",
|
|
13
13
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
14
14
|
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
|
15
|
-
"lint": "prettier
|
|
16
|
-
"format": "prettier
|
|
15
|
+
"lint": "prettier . --check . && eslint .",
|
|
16
|
+
"format": "prettier . --write .",
|
|
17
17
|
"clean": "rm -rf dist && npm cache clean --force",
|
|
18
18
|
"release": "npm run format && npm run build && release-it --only-version",
|
|
19
19
|
"build-storybook": "storybook build --output-dir docs"
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"eslint-config-prettier": "^9.1.0",
|
|
46
46
|
"eslint-plugin-storybook": "^0.11.2",
|
|
47
47
|
"eslint-plugin-svelte": "^2.46.1",
|
|
48
|
+
"espree": "^10.3.0",
|
|
48
49
|
"happy-dom": "^16.5.3",
|
|
49
50
|
"lint-staged": "^15.3.0",
|
|
50
51
|
"prettier": "^3.4.2",
|