@iroco/ui 0.50.1 → 0.51.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/Button.svelte CHANGED
@@ -266,6 +266,13 @@ export let node;
266
266
  .iroco-ui-button:active {
267
267
  box-shadow: none;
268
268
  }
269
+ .iroco-ui-button .iroco-ui-link {
270
+ background: none;
271
+ border: none;
272
+ font-family: "Arial";
273
+ color: #f2ebe3;
274
+ cursor: pointer;
275
+ }
269
276
  .iroco-ui-button.disabled {
270
277
  background-color: #f5f5f5;
271
278
  cursor: default;
package/NavBar.svelte CHANGED
@@ -1,6 +1,7 @@
1
1
  <script>import IconClose from "./IconClose.svelte";
2
2
  import { createEventDispatcher } from "svelte";
3
3
  import { navigating } from "$app/stores";
4
+ import { NavigationItemType } from "./definition.js";
4
5
  export let navigationItems;
5
6
  export let type;
6
7
  let active;
@@ -31,15 +32,21 @@ $:
31
32
  <ul class="nav__{type}__item-container">
32
33
  {#each navigationItems as item}
33
34
  <li class="nav__{type}__item" class:active={isActive(active, item)}>
34
- <a
35
- on:click={() => handleClickLink(item)}
36
- href={typeof item.hrefOrCallback === 'string' ? item.hrefOrCallback : '#'}
37
- class:iroco-ui-button={item.button}
38
- class:iroco-ui-button--small={item.button}
39
- class:iroco-ui-button--success={item.button}
40
- >
41
- {item.name}
42
- </a>
35
+ {#if item.type === NavigationItemType.FORM}
36
+ <form method="POST" action={item.hrefOrCallback}>
37
+ <button class="iroco-ui-link" type="submit">{item.name}</button>
38
+ </form>
39
+ {:else}
40
+ <a
41
+ on:click={() => handleClickLink(item)}
42
+ href={typeof item.hrefOrCallback === 'string' ? item.hrefOrCallback : '#'}
43
+ class:iroco-ui-button={item.type === NavigationItemType.BUTTON}
44
+ class:iroco-ui-button--small={item.type === NavigationItemType.BUTTON}
45
+ class:iroco-ui-button--success={item.type === NavigationItemType.BUTTON}
46
+ >
47
+ {item.name}
48
+ </a>
49
+ {/if}
43
50
  </li>
44
51
  {/each}
45
52
  </ul>
@@ -552,6 +559,14 @@ $:
552
559
  box-shadow: none;
553
560
  }
554
561
 
562
+ .iroco-ui-button .iroco-ui-link {
563
+ background: none;
564
+ border: none;
565
+ font-family: "Arial";
566
+ color: #f2ebe3;
567
+ cursor: pointer;
568
+ }
569
+
555
570
  .iroco-ui-button.disabled {
556
571
  background-color: #f5f5f5;
557
572
  cursor: default;
package/README.md CHANGED
@@ -1,38 +1,55 @@
1
- # create-svelte
1
+ # iroco-ui
2
2
 
3
- Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
3
+ [![Circle CI](https://circleci.com/gh/iroco-co/iroco-ui.png?circle-token=218e3654fb138427bb709b068ed847b58f8d4ac7&style=svg)](https://app.circleci.com/pipelines/github/iroco-co/iroco-ui)
4
4
 
5
- ## Creating a project
5
+ Design system for Iroco [based on SvelteKit](https://kit.svelte.dev/docs/packaging).
6
6
 
7
- If you're seeing this, you've probably already done this step. Congrats!
7
+ See the [Documentation](https://iroco-co.github.io/iroco-ui/) (not in sync anymore : to be restored with storybook)
8
8
 
9
- ```bash
10
- # create a new project in the current directory
11
- npm create svelte@latest
9
+ # develop
12
10
 
13
- # create a new project in my-app
14
- npm create svelte@latest my-app
11
+ To install dependencies :
12
+
13
+ ```shell
14
+ ~/src/iroco-ui$ npm ci
15
15
  ```
16
16
 
17
- ## Developing
17
+ Building :
18
+
19
+ ```shell
20
+ ~/src/iroco-ui$ npm run build
21
+ ```
22
+
23
+ Releasing :
24
+
25
+ ```shell
26
+ ~/iroco-ui$ cd package ; npm publish
27
+ ```
18
28
 
19
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
29
+ # documentation (to be done with storybook)
20
30
 
21
- ```bash
22
- npm run dev
31
+ The docs directory contains the documentation app deployed on github pages. To install dependencies :
23
32
 
24
- # or start the server and open the app in a new browser tab
25
- npm run dev -- --open
33
+ ```shell
34
+ ~/src/iroco-ui/docs$ npm ci
26
35
  ```
27
36
 
28
- ## Building
37
+ You can add/update components documentation into `docs/src/pages/components` and update the left menu in `docs/src/includes/sidebar.md`.
29
38
 
30
- To create a production version of your app:
39
+ When you have to work on the CSS for components, you can have hot reloading. To do so you have to make the iroco-ui build watched with :
31
40
 
32
- ```bash
33
- npm run build
41
+ ```shell
42
+ ~/src/iroco-ui$ npx npm-watch build
34
43
  ```
35
44
 
36
- You can preview the production build with `npm run preview`.
45
+ And in the same time launch the dev server for docs :
46
+
47
+ ```shell
48
+ ~/src/iroco-ui/docs$ npm run dev
49
+ ```
37
50
 
38
- > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
51
+ To build the documentation (in docs) :
52
+
53
+ ```shell
54
+ ~/src/iroco-ui/docs$ npm run build
55
+ ```
package/definition.d.ts CHANGED
@@ -1,8 +1,13 @@
1
1
  export declare class NavigationItem {
2
2
  hrefOrCallback: string | (() => void);
3
3
  name: string;
4
- button: boolean;
5
- constructor(name: string, hrefOrCallback: string | (() => void), button?: boolean);
4
+ type: NavigationItemType;
5
+ constructor(name: string, hrefOrCallback: string | (() => void), type?: NavigationItemType);
6
+ }
7
+ export declare enum NavigationItemType {
8
+ BUTTON = 0,
9
+ ANCHOR = 1,
10
+ FORM = 2
6
11
  }
7
12
  export declare enum TextInputType {
8
13
  text = "text",
package/definition.js CHANGED
@@ -1,13 +1,19 @@
1
1
  export class NavigationItem {
2
2
  hrefOrCallback;
3
3
  name;
4
- button;
5
- constructor(name, hrefOrCallback, button = false) {
4
+ type;
5
+ constructor(name, hrefOrCallback, type = NavigationItemType.ANCHOR) {
6
6
  this.hrefOrCallback = hrefOrCallback;
7
7
  this.name = name;
8
- this.button = button;
8
+ this.type = type;
9
9
  }
10
10
  }
11
+ export var NavigationItemType;
12
+ (function (NavigationItemType) {
13
+ NavigationItemType[NavigationItemType["BUTTON"] = 0] = "BUTTON";
14
+ NavigationItemType[NavigationItemType["ANCHOR"] = 1] = "ANCHOR";
15
+ NavigationItemType[NavigationItemType["FORM"] = 2] = "FORM";
16
+ })(NavigationItemType || (NavigationItemType = {}));
11
17
  export var TextInputType;
12
18
  (function (TextInputType) {
13
19
  TextInputType["text"] = "text";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iroco/ui",
3
- "version": "0.50.1",
3
+ "version": "0.51.1",
4
4
  "description": "Iroco design system based on Svelte",
5
5
  "main": "lib/index.ts",
6
6
  "svelte": "index.js",
package/scss/button.scss CHANGED
@@ -53,6 +53,14 @@
53
53
  box-shadow: none;
54
54
  }
55
55
 
56
+ .iroco-ui-link {
57
+ background: none;
58
+ border: none;
59
+ font-family: fonts.$arial;
60
+ color: colors.$beige;
61
+ cursor: pointer;
62
+ }
63
+
56
64
  &.disabled {
57
65
  background-color: colors.$lightGrey;
58
66
  cursor: default;