@iroco/ui 1.0.0-1 → 1.0.0-2

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 CHANGED
@@ -6,6 +6,59 @@ Design system for Iroco [based on SvelteKit](https://kit.svelte.dev/docs/packagi
6
6
 
7
7
  See the [Documentation](https://iroco-co.github.io/iroco-ui/) (not in sync anymore : to be restored with storybook)
8
8
 
9
+ # Install in your svelte application
10
+
11
+ Prerequisites:
12
+
13
+ - @sveltejs/kit: ^2.5.0
14
+ - svelte: ^4.2.10
15
+
16
+ ```sh
17
+ # latest
18
+ npm install @iroco/ui
19
+ # next
20
+ npm install @iroco/ui@next
21
+ ```
22
+
23
+ ## Minimal scaffolding
24
+
25
+ `src/app.scss`
26
+
27
+ ```scss
28
+ @use 'node_modules/@iroco/ui/dist/scss/colors';
29
+ @use 'node_modules/@iroco/ui/dist/scss/fonts';
30
+ @use 'node_modules/@iroco/ui/dist/scss/style';
31
+ @use 'node_modules/@iroco/ui/dist/scss/constants';
32
+ @import 'node_modules/@iroco/ui/dist/scss/containers';
33
+ ```
34
+
35
+ Example of layout with navigation
36
+
37
+ `src/routes/+layout.svelte`
38
+
39
+ ```svelte
40
+ <script>
41
+ import '../app.scss';
42
+ import { Navigation, NavigationItem } from '@iroco/ui';
43
+ </script>
44
+
45
+ <Navigation
46
+ navigationItems={[new NavigationItem("About", "/about"),]}
47
+ type="topbar"
48
+ />
49
+ <main class="main">
50
+ <slot />
51
+ </main>
52
+
53
+ <style lang="scss">
54
+ @use "node_modules/@iroco/ui/dist/scss/colors.scss";
55
+ @use "node_modules/@iroco/ui/dist/scss/constants.scss";
56
+ @import "node_modules/@iroco/ui/dist/scss/containers.scss";
57
+ @import "node_modules/@iroco/ui/dist/scss/button.scss";
58
+ </style>
59
+
60
+ ```
61
+
9
62
  # develop
10
63
 
11
64
  To install dependencies :
@@ -1,16 +1,20 @@
1
1
  <script>import { Color } from "./definition";
2
+ export let href = "/";
3
+ export let ariaLabel = "go to Iroco home";
2
4
  export let width = "5rem";
3
5
  export let height = "5rem";
4
6
  export let color = Color.green;
5
7
  </script>
6
8
 
7
- <svg {width} {height} viewBox="0 0 54 53" fill="none" xmlns="http://www.w3.org/2000/svg">
8
- <path
9
- d="M30.009 29.9999C29.3241 30.0677 28.7761 30.1355 28.4336 30.2033C28.0912 30.3389 27.8857 30.5423 27.7487 30.8812C27.6117 31.2202 27.5432 31.7626 27.5432 32.5084V47.1524C27.5432 47.8982 27.6117 48.4406 27.7487 48.7795C27.8857 49.1185 28.0912 49.3219 28.4336 49.4575C28.7761 49.5931 29.2556 49.6609 30.009 49.6609V50.2711C29.1186 50.2033 27.8172 50.2033 26.2419 50.2033C24.5295 50.2033 23.2282 50.2033 22.4062 50.2711V49.7965C23.0912 49.7287 23.6391 49.6609 23.9816 49.5931C24.3241 49.4575 24.5295 49.2541 24.6665 48.9151C24.8035 48.5762 24.872 48.0338 24.872 47.288V32.5762C24.872 31.8304 24.8035 31.288 24.6665 30.949C24.5295 30.6101 24.3241 30.4067 23.9816 30.2711C23.6391 30.1355 23.1597 30.0677 22.4062 30.0677V29.4575C23.2282 29.5253 24.5295 29.5253 26.2419 29.5253C27.8172 29.5253 29.1186 29.5253 30.009 29.4575V29.9999Z"
10
- fill="white"
11
- />
12
- <path
13
- d="M18.7079 40.4406C11.1737 37.3897 6.24219 30.2033 6.24219 22.1355C6.24219 11.2202 15.2148 2.33887 26.2422 2.33887C37.2696 2.33887 46.2422 11.2202 46.2422 22.1355C46.2422 30.2033 41.3107 37.4575 33.7764 40.4406L32.2696 36.9151C38.3655 34.4745 42.3381 28.6439 42.3381 22.0677C42.3381 13.2541 35.0778 6.06768 26.1737 6.06768C17.2696 6.06768 10.0093 13.2541 10.0093 22.0677C10.0093 28.5762 13.9819 34.4067 20.0778 36.9151L18.7079 40.4406Z"
14
- fill={color}
15
- />
16
- </svg>
9
+ <a class="iroco-logo" {href} aria-label={ariaLabel}>
10
+ <svg {width} {height} viewBox="0 0 54 53" fill="none" xmlns="http://www.w3.org/2000/svg">
11
+ <path
12
+ d="M30.009 29.9999C29.3241 30.0677 28.7761 30.1355 28.4336 30.2033C28.0912 30.3389 27.8857 30.5423 27.7487 30.8812C27.6117 31.2202 27.5432 31.7626 27.5432 32.5084V47.1524C27.5432 47.8982 27.6117 48.4406 27.7487 48.7795C27.8857 49.1185 28.0912 49.3219 28.4336 49.4575C28.7761 49.5931 29.2556 49.6609 30.009 49.6609V50.2711C29.1186 50.2033 27.8172 50.2033 26.2419 50.2033C24.5295 50.2033 23.2282 50.2033 22.4062 50.2711V49.7965C23.0912 49.7287 23.6391 49.6609 23.9816 49.5931C24.3241 49.4575 24.5295 49.2541 24.6665 48.9151C24.8035 48.5762 24.872 48.0338 24.872 47.288V32.5762C24.872 31.8304 24.8035 31.288 24.6665 30.949C24.5295 30.6101 24.3241 30.4067 23.9816 30.2711C23.6391 30.1355 23.1597 30.0677 22.4062 30.0677V29.4575C23.2282 29.5253 24.5295 29.5253 26.2419 29.5253C27.8172 29.5253 29.1186 29.5253 30.009 29.4575V29.9999Z"
13
+ fill="white"
14
+ />
15
+ <path
16
+ d="M18.7079 40.4406C11.1737 37.3897 6.24219 30.2033 6.24219 22.1355C6.24219 11.2202 15.2148 2.33887 26.2422 2.33887C37.2696 2.33887 46.2422 11.2202 46.2422 22.1355C46.2422 30.2033 41.3107 37.4575 33.7764 40.4406L32.2696 36.9151C38.3655 34.4745 42.3381 28.6439 42.3381 22.0677C42.3381 13.2541 35.0778 6.06768 26.1737 6.06768C17.2696 6.06768 10.0093 13.2541 10.0093 22.0677C10.0093 28.5762 13.9819 34.4067 20.0778 36.9151L18.7079 40.4406Z"
17
+ fill={color}
18
+ />
19
+ </svg>
20
+ </a>
@@ -2,6 +2,8 @@ import { SvelteComponent } from "svelte";
2
2
  import { Color } from './definition';
3
3
  declare const __propDef: {
4
4
  props: {
5
+ href?: string | undefined;
6
+ ariaLabel?: string | undefined;
5
7
  width?: string | undefined;
6
8
  height?: string | undefined;
7
9
  color?: Color | undefined;
@@ -1,14 +1,10 @@
1
- <script>import { createEventDispatcher } from "svelte";
2
- import { base } from "$app/paths";
1
+ <script>export let href = `/`;
2
+ export let ariaLabel = "go to Iroco home";
3
3
  export let width = "10rem";
4
4
  export let height = "10rem";
5
- const dispatch = createEventDispatcher();
6
- function clickOnLogo() {
7
- dispatch("click_logo");
8
- }
9
5
  </script>
10
6
 
11
- <a class="iroco-logo" href="{base}/" aria-label="go to Iroco home" on:click={clickOnLogo}>
7
+ <a class="iroco-logo" {href} aria-label={ariaLabel}>
12
8
  <svg viewBox="0 0 832.33 249.52" role="img" {width} {height}>
13
9
  <title>Iroco Logo</title>
14
10
  <path
@@ -1,12 +1,12 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ href?: string | undefined;
5
+ ariaLabel?: string | undefined;
4
6
  width?: string | undefined;
5
7
  height?: string | undefined;
6
8
  };
7
9
  events: {
8
- click_logo: CustomEvent<any>;
9
- } & {
10
10
  [evt: string]: CustomEvent<any>;
11
11
  };
12
12
  slots: {};
@@ -0,0 +1,51 @@
1
+ <script context="module">
2
+ import Navigation from './Navigation.svelte';
3
+ import { NavigationItem } from './definition';
4
+
5
+ export const meta = {
6
+ title: 'Navigation',
7
+ component: Navigation,
8
+ argTypes: {
9
+ type: {
10
+ control: { type: 'select' },
11
+ options: ['sidebar', 'topbar']
12
+ },
13
+ title: {
14
+ control: { type: 'text' }
15
+ },
16
+ version: {
17
+ control: { type: 'text' }
18
+ },
19
+ color: {
20
+ control: { type: 'color' }
21
+ }
22
+
23
+ },
24
+ args: {
25
+ navigationItems: [
26
+ new NavigationItem('About', `/about`),
27
+ new NavigationItem('Foo', `/foo`),
28
+ new NavigationItem('Bar', `/bar`)]
29
+ }
30
+ };
31
+ </script>
32
+
33
+ <script>
34
+ import { Story, Template } from '@storybook/addon-svelte-csf';
35
+ </script>
36
+
37
+ <Template let:args>
38
+ <Navigation {...args}
39
+ navigationItems={[
40
+ new NavigationItem('About', `/about`),
41
+ new NavigationItem('Foo', `/foo`),
42
+ new NavigationItem('Bar', `/bar`)]}>
43
+
44
+ </Navigation>
45
+ </Template>
46
+
47
+ <Story name="Default" />
48
+ <Story name="Sidebar" args={{ type: 'sidebar' }} />
49
+
50
+ <Story name="Title" args={{ title: 'Alternative title' }}></Story>
51
+ <Story name="Color" args={{ color: '#ABCDEF' }}></Story>
@@ -0,0 +1,63 @@
1
+ export namespace meta {
2
+ export let title: string;
3
+ export { Navigation as component };
4
+ export namespace argTypes {
5
+ export namespace type {
6
+ namespace control {
7
+ let type_1: string;
8
+ export { type_1 as type };
9
+ }
10
+ let options: string[];
11
+ }
12
+ export namespace title_1 {
13
+ export namespace control_1 {
14
+ let type_2: string;
15
+ export { type_2 as type };
16
+ }
17
+ export { control_1 as control };
18
+ }
19
+ export { title_1 as title };
20
+ export namespace version {
21
+ export namespace control_2 {
22
+ let type_3: string;
23
+ export { type_3 as type };
24
+ }
25
+ export { control_2 as control };
26
+ }
27
+ export namespace color {
28
+ export namespace control_3 {
29
+ let type_4: string;
30
+ export { type_4 as type };
31
+ }
32
+ export { control_3 as control };
33
+ }
34
+ }
35
+ export namespace args {
36
+ let navigationItems: NavigationItem[];
37
+ }
38
+ }
39
+ /** @typedef {typeof __propDef.props} NavigationProps */
40
+ /** @typedef {typeof __propDef.events} NavigationEvents */
41
+ /** @typedef {typeof __propDef.slots} NavigationSlots */
42
+ export default class Navigation extends SvelteComponent<{
43
+ [x: string]: never;
44
+ }, {
45
+ [evt: string]: CustomEvent<any>;
46
+ }, {}> {
47
+ }
48
+ export type NavigationProps = typeof __propDef.props;
49
+ export type NavigationEvents = typeof __propDef.events;
50
+ export type NavigationSlots = typeof __propDef.slots;
51
+ import Navigation from './Navigation.svelte';
52
+ import { NavigationItem } from './definition';
53
+ import { SvelteComponent } from "svelte";
54
+ declare const __propDef: {
55
+ props: {
56
+ [x: string]: never;
57
+ };
58
+ events: {
59
+ [evt: string]: CustomEvent<any>;
60
+ };
61
+ slots: {};
62
+ };
63
+ export {};
@@ -3,6 +3,8 @@ import IconIrocoLogo from "./IconIrocoLogo.svelte";
3
3
  import IrocoLogo from "./IrocoLogo.svelte";
4
4
  import NavBar from "./NavBar.svelte";
5
5
  import { Color } from "./definition";
6
+ import { base } from "$app/paths";
7
+ export let href = `${base}/`;
6
8
  export let navigationItems;
7
9
  export let type = "topbar";
8
10
  export let title = null;
@@ -13,12 +15,12 @@ let showMenu = false;
13
15
 
14
16
  <div class="navigation--mobile">
15
17
  <div class="navigation--mobile__title-container">
16
- {#if title == null}
17
- <IrocoLogo width="10em" height="10em" />
18
- {:else}
19
- <IconIrocoLogo width="3em" height="3em" {color} />
20
- <h1>{title}</h1>
21
- {/if}
18
+ {#if title == null}
19
+ <IrocoLogo {href} width="10em" height="10em" />
20
+ {:else}
21
+ <IconIrocoLogo {href} width="3em" height="3em" {color} />
22
+ <h1><a {href} class="navigation-mobile__title-link">{title}</a></h1>
23
+ {/if}
22
24
  </div>
23
25
 
24
26
  <button title="Menu button" on:click={() => (showMenu = true)} class="navigation--mobile__button">
@@ -39,10 +41,10 @@ let showMenu = false;
39
41
  <div class="navigation">
40
42
  <div class="navigation__title-container">
41
43
  {#if title == null}
42
- <IrocoLogo width="10em" height="10em" />
44
+ <IrocoLogo {href} width="10em" height="10em" />
43
45
  {:else}
44
- <IconIrocoLogo width="3em" height="3em" />
45
- <h1>{title}</h1>
46
+ <IconIrocoLogo {href} width="3em" height="3em" />
47
+ <h1><a class="navigation__title-link" {href}>{title}</a></h1>
46
48
  {/if}
47
49
  </div>
48
50
  <NavBar {navigationItems} {type} {version} />
@@ -326,4 +328,8 @@ let showMenu = false;
326
328
  .navigation--mobile__title-container h1 {
327
329
  padding-left: 0.5em;
328
330
  }
331
+ }
332
+
333
+ .navigation__title-link, .navigation-mobile__title-link {
334
+ color: white;
329
335
  }</style>
@@ -3,6 +3,7 @@ import type { NavigationItem } from './definition';
3
3
  import { Color } from './definition';
4
4
  declare const __propDef: {
5
5
  props: {
6
+ href?: string | undefined;
6
7
  navigationItems: Array<NavigationItem>;
7
8
  type?: "sidebar" | "topbar" | undefined;
8
9
  title?: string | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iroco/ui",
3
- "version": "1.0.0-1",
3
+ "version": "1.0.0-2",
4
4
  "description": "Iroco design system based on Svelte",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  "format": "prettier --plugin-search-dir . --write .",
15
15
  "clean": "rm -rf dist && npm cache clean --force",
16
16
  "release": "npm run format && npm run build && release-it --only-version",
17
- "storybook": "storybook dev -p 5173",
17
+ "storybook": "storybook dev -p 5175",
18
18
  "build-storybook": "storybook build"
19
19
  },
20
20
  "devDependencies": {