@iroco/ui 0.15.3 → 0.17.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/lib/button.scss +60 -0
- package/lib/index.js +441 -118
- package/lib/index.min.js +55 -55
- package/lib/index.mjs +440 -119
- package/lib/index.mjs.css +744 -0
- package/package.json +4 -3
- package/scss/button.scss +60 -0
- package/src/Button.svelte +1 -61
- package/src/IrocoLogo.svelte +45 -0
- package/src/NavBar.svelte +6 -2
- package/src/Navigation.svelte +15 -5
- package/src/definition.ts +10 -2
- package/src/index.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iroco/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "Iroco design system based on Svelte",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"husky": "^7.0.2",
|
|
63
63
|
"jest": "^26.6.3",
|
|
64
64
|
"lint-staged": "^11.1.2",
|
|
65
|
+
"node-sass": "^7.0.1",
|
|
65
66
|
"npm-watch": "^0.10.0",
|
|
66
67
|
"prettier": "^2.3.1",
|
|
67
68
|
"prettier-plugin-svelte": "^2.3.0",
|
|
@@ -75,7 +76,6 @@
|
|
|
75
76
|
"svelte-jester": "^1.7.0",
|
|
76
77
|
"svelte-preprocess": "^4.7.3",
|
|
77
78
|
"ts-jest": "^26.5.5",
|
|
78
|
-
"node-sass": "^7.0.1",
|
|
79
79
|
"typescript": "^4.3.3"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
@@ -95,7 +95,8 @@
|
|
|
95
95
|
"preprocess": true
|
|
96
96
|
}
|
|
97
97
|
],
|
|
98
|
-
"^.+\\.js$": "babel-jest"
|
|
98
|
+
"^.+\\.js$": "babel-jest",
|
|
99
|
+
"^.+\\.ts$": "ts-jest"
|
|
99
100
|
},
|
|
100
101
|
"testEnvironment": "jsdom",
|
|
101
102
|
"moduleFileExtensions": [
|
package/scss/button.scss
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
@use '../scss/colors';
|
|
2
|
+
@use '../scss/fonts';
|
|
3
|
+
@use '../scss/containers';
|
|
4
|
+
@use '../scss/constants';
|
|
5
|
+
|
|
6
|
+
.iroco-ui-button {
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
-webkit-touch-callout: none;
|
|
9
|
+
-webkit-user-select: none;
|
|
10
|
+
-khtml-user-select: none;
|
|
11
|
+
-moz-user-select: none;
|
|
12
|
+
-ms-user-select: none;
|
|
13
|
+
user-select: none;
|
|
14
|
+
border: none;
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
margin: 1em 0em;
|
|
17
|
+
position: relative;
|
|
18
|
+
text-transform: uppercase;
|
|
19
|
+
border-radius: constants.$border-radius;
|
|
20
|
+
|
|
21
|
+
&--basic {
|
|
22
|
+
background: colors.$beige;
|
|
23
|
+
border: 1px solid colors.$nightBlue;
|
|
24
|
+
}
|
|
25
|
+
&--dark {
|
|
26
|
+
background: colors.$nightBlue;
|
|
27
|
+
color: colors.$beige;
|
|
28
|
+
}
|
|
29
|
+
&--success {
|
|
30
|
+
background: colors.$green;
|
|
31
|
+
}
|
|
32
|
+
&--danger {
|
|
33
|
+
background: colors.$red;
|
|
34
|
+
}
|
|
35
|
+
&--regular {
|
|
36
|
+
padding: 1em 2em;
|
|
37
|
+
}
|
|
38
|
+
&--small {
|
|
39
|
+
padding: 0.5em 1em;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--basic:hover, &--success:hover, &--danger:hover {
|
|
43
|
+
box-shadow: inset 0 0 0 10em rgba(0, 0, 0, 0.2);
|
|
44
|
+
}
|
|
45
|
+
&--dark:hover {
|
|
46
|
+
box-shadow: inset 0 0 0 10em rgba(255, 255, 255, 0.2);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:active {
|
|
50
|
+
box-shadow: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.disabled {
|
|
54
|
+
background-color: colors.$lightGrey;
|
|
55
|
+
cursor: default;
|
|
56
|
+
&:hover {
|
|
57
|
+
box-shadow: none;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
package/src/Button.svelte
CHANGED
|
@@ -20,65 +20,5 @@
|
|
|
20
20
|
</button>
|
|
21
21
|
|
|
22
22
|
<style lang="scss">
|
|
23
|
-
@use '../scss/
|
|
24
|
-
@use '../scss/fonts';
|
|
25
|
-
@use '../scss/containers';
|
|
26
|
-
@use '../scss/constants';
|
|
27
|
-
|
|
28
|
-
.iroco-ui-button {
|
|
29
|
-
cursor: pointer;
|
|
30
|
-
-webkit-touch-callout: none;
|
|
31
|
-
-webkit-user-select: none;
|
|
32
|
-
-khtml-user-select: none;
|
|
33
|
-
-moz-user-select: none;
|
|
34
|
-
-ms-user-select: none;
|
|
35
|
-
user-select: none;
|
|
36
|
-
border: none;
|
|
37
|
-
flex-shrink: 0;
|
|
38
|
-
margin: 1em 0em;
|
|
39
|
-
position: relative;
|
|
40
|
-
text-transform: uppercase;
|
|
41
|
-
border-radius: constants.$border-radius;
|
|
42
|
-
|
|
43
|
-
&--basic {
|
|
44
|
-
background: colors.$beige;
|
|
45
|
-
border: 1px solid colors.$nightBlue;
|
|
46
|
-
}
|
|
47
|
-
&--dark {
|
|
48
|
-
background: colors.$nightBlue;
|
|
49
|
-
color: colors.$beige;
|
|
50
|
-
}
|
|
51
|
-
&--success {
|
|
52
|
-
background: colors.$green;
|
|
53
|
-
}
|
|
54
|
-
&--danger {
|
|
55
|
-
background: colors.$red;
|
|
56
|
-
}
|
|
57
|
-
&--regular {
|
|
58
|
-
padding: 1em 2em;
|
|
59
|
-
}
|
|
60
|
-
&--small {
|
|
61
|
-
padding: 0.5em 1em;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&--basic:hover, &--success:hover, &--danger:hover {
|
|
65
|
-
box-shadow: inset 0 0 0 10em rgba(0, 0, 0, 0.2);
|
|
66
|
-
}
|
|
67
|
-
&--dark:hover {
|
|
68
|
-
box-shadow: inset 0 0 0 10em rgba(255, 255, 255, 0.2);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&:active {
|
|
72
|
-
box-shadow: none;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&.disabled {
|
|
76
|
-
background-color: colors.$lightGrey;
|
|
77
|
-
cursor: default;
|
|
78
|
-
&:hover {
|
|
79
|
-
box-shadow: none;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
23
|
+
@use '../scss/button';
|
|
84
24
|
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let width = '10rem';
|
|
3
|
+
export let height = '10rem';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<a class='iroco-logo' href="/">
|
|
7
|
+
<svg viewBox="0 0 832.33 249.52" width={width} height={height}>
|
|
8
|
+
<title>Iroco</title>
|
|
9
|
+
<path
|
|
10
|
+
fill="white"
|
|
11
|
+
d="M412,81.41c-7.34,0-12.07-5.19-12.07-12.37S404.77,56.66,412,56.66,424.17,61.85,424.17,69,419.13,81.41,412,81.41Zm10.7,118.4H401V103.54h21.7Z"
|
|
12
|
+
transform="translate(-0.44 -0.49)"
|
|
13
|
+
/>
|
|
14
|
+
<path
|
|
15
|
+
fill="white"
|
|
16
|
+
d="M505.77,123.71h-6.72c-18,0-27.2,8.26-27.2,28.43v47.67h-21.7V103.54h21.7v14.21h.3c5.5-9.32,15.44-15.28,28.43-15.28h5.19Z"
|
|
17
|
+
transform="translate(-0.44 -0.49)"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
fill="white"
|
|
21
|
+
d="M566.44,201.34c-33,0-49.21-21.54-49.21-49.66S533.43,102,566.44,102s49.35,21.39,49.35,49.66C615.79,179.64,599.29,201.34,566.44,201.34Zm0-80.22c-19.26,0-27.51,12.68-27.51,30.56,0,17.72,8.4,30.56,27.66,30.56s27.5-12.68,27.5-30.56S585.69,121.12,566.44,121.12Z"
|
|
22
|
+
transform="translate(-0.44 -0.49)"
|
|
23
|
+
/>
|
|
24
|
+
<path
|
|
25
|
+
fill="white"
|
|
26
|
+
d="M721.23,186.52c-11.77,10.7-24.45,14.82-39.12,14.82-33.62,0-49.51-21.54-49.51-48.9,0-28.11,17.88-50.42,49.81-50.42,15.9,0,28,4.27,38.51,14.21L706.1,131.05c-6.88-6.72-14.21-9.93-23.53-9.93-18.8.15-28.27,13.9-28.27,31.32,0,16.66,8.1,29.8,28,29.8,9.17,0,16.35-2.9,24.3-10.54Z"
|
|
27
|
+
transform="translate(-0.44 -0.49)"
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
fill="white"
|
|
31
|
+
d="M783.42,201.34c-33,0-49.21-21.54-49.21-49.66S750.41,102,783.42,102s49.35,21.39,49.35,49.66C832.77,179.64,816.27,201.34,783.42,201.34Zm0-80.22c-19.26,0-27.51,12.68-27.51,30.56,0,17.72,8.41,30.56,27.66,30.56s27.5-12.68,27.5-30.56S802.67,121.12,783.42,121.12Z"
|
|
32
|
+
transform="translate(-0.44 -0.49)"
|
|
33
|
+
/>
|
|
34
|
+
<path
|
|
35
|
+
fill="white"
|
|
36
|
+
d="M122.8,144.26a30.6,30.6,0,0,0-8.07,1.23,5.53,5.53,0,0,0-3.46,3.53,28,28,0,0,0-.92,8.46v76.24a28,28,0,0,0,.92,8.46,5.53,5.53,0,0,0,3.46,3.53,30.18,30.18,0,0,0,8.07,1.23V250q-7.06-.45-19.52-.46-13.22,0-19.67.46v-3.07a30.33,30.33,0,0,0,8.07-1.23,5.49,5.49,0,0,0,3.45-3.53,27.59,27.59,0,0,0,.93-8.46V157.48a27.59,27.59,0,0,0-.93-8.46,5.49,5.49,0,0,0-3.45-3.53,30.75,30.75,0,0,0-8.07-1.23v-3.08q6.45.47,19.67.47,12.3,0,19.52-.47Z"
|
|
37
|
+
transform="translate(-0.44 -0.49)"
|
|
38
|
+
/>
|
|
39
|
+
<path
|
|
40
|
+
fill="#00D692"
|
|
41
|
+
d="M64.64,198.52a102.78,102.78,0,1,1,77.13,0l-7.41-18.29a83,83,0,1,0-62.31,0Z"
|
|
42
|
+
transform="translate(-0.44 -0.49)"
|
|
43
|
+
/>
|
|
44
|
+
</svg>
|
|
45
|
+
</a>
|
package/src/NavBar.svelte
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
active = menuItem.name;
|
|
14
14
|
if (typeof menuItem.hrefOrCallback === 'function') {
|
|
15
15
|
menuItem.hrefOrCallback();
|
|
16
|
-
|
|
16
|
+
return false; // to avoid calling href
|
|
17
17
|
}
|
|
18
18
|
dispatch('click_link');
|
|
19
19
|
};
|
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
|
|
27
27
|
<ul class="nav__{type}__item-container">
|
|
28
28
|
{#each navigationItems as item}
|
|
29
|
-
<li class="nav__{type}__item" class:active={active === item.name}>
|
|
29
|
+
<li class="nav__{type}__item" class:active={active === item.name} >
|
|
30
30
|
<a
|
|
31
31
|
on:click={() => handleClickLink(item)}
|
|
32
32
|
href={typeof item.hrefOrCallback === 'string' ? item.hrefOrCallback : '#'}
|
|
33
|
+
class:iroco-ui-button= { item.isButton() }
|
|
33
34
|
>
|
|
34
35
|
{item.name}</a
|
|
35
36
|
>
|
|
@@ -40,7 +41,9 @@
|
|
|
40
41
|
|
|
41
42
|
<style lang="scss">
|
|
42
43
|
@use '../scss/colors';
|
|
44
|
+
@use '../scss/constants';
|
|
43
45
|
@import '../scss/containers';
|
|
46
|
+
@import '../scss/button';
|
|
44
47
|
|
|
45
48
|
.nav {
|
|
46
49
|
&__sidebar,
|
|
@@ -53,6 +56,7 @@
|
|
|
53
56
|
&__item a {
|
|
54
57
|
color: colors.$beige;
|
|
55
58
|
font-size: 2em;
|
|
59
|
+
|
|
56
60
|
}
|
|
57
61
|
&__close {
|
|
58
62
|
display: none;
|
package/src/Navigation.svelte
CHANGED
|
@@ -2,19 +2,25 @@
|
|
|
2
2
|
import type { NavigationItem } from './definition';
|
|
3
3
|
import IconBurger from './IconBurger.svelte';
|
|
4
4
|
import IconIrocoLogo from './IconIrocoLogo.svelte';
|
|
5
|
+
import IrocoLogo from './IrocoLogo.svelte';
|
|
5
6
|
import NavBar from './NavBar.svelte';
|
|
6
7
|
|
|
7
8
|
export let navigationItems: Array<NavigationItem>;
|
|
8
9
|
export let type: 'sidebar' | 'topbar' = "topbar";
|
|
9
|
-
export let title: string;
|
|
10
|
+
export let title: string | null = null;
|
|
10
11
|
|
|
11
12
|
let showMenu = false;
|
|
13
|
+
|
|
12
14
|
</script>
|
|
13
15
|
|
|
14
16
|
<div class="navigation--mobile">
|
|
15
17
|
<div class="navigation--mobile__title-container">
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
{#if title == null}
|
|
19
|
+
<IrocoLogo width="10em" height="10em"/>
|
|
20
|
+
{:else}
|
|
21
|
+
<IconIrocoLogo width="3em" height="3em" />
|
|
22
|
+
<h1>{title}</h1>
|
|
23
|
+
{/if}
|
|
18
24
|
</div>
|
|
19
25
|
|
|
20
26
|
<button on:click={() => (showMenu = true)} class="navigation--mobile__button">
|
|
@@ -33,8 +39,12 @@
|
|
|
33
39
|
|
|
34
40
|
<div class="navigation">
|
|
35
41
|
<div class="navigation__title-container">
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
{#if title == null}
|
|
43
|
+
<IrocoLogo width="10em" height="10em"/>
|
|
44
|
+
{:else}
|
|
45
|
+
<IconIrocoLogo width="3em" height="3em" />
|
|
46
|
+
<h1>{title}</h1>
|
|
47
|
+
{/if}
|
|
38
48
|
</div>
|
|
39
49
|
<NavBar {navigationItems} { type } />
|
|
40
50
|
</div>
|
package/src/definition.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class NavigationItem {
|
|
2
2
|
hrefOrCallback: string|(() => void);
|
|
3
3
|
name: string;
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
constructor (name: string, hrefOrCallback: string|(() => void)) {
|
|
6
|
+
this.hrefOrCallback = hrefOrCallback;
|
|
7
|
+
this.name = name;
|
|
8
|
+
}
|
|
5
9
|
|
|
10
|
+
isButton(): boolean {
|
|
11
|
+
return typeof this.hrefOrCallback === 'function'
|
|
12
|
+
}
|
|
13
|
+
};
|
|
6
14
|
|
|
7
15
|
export enum ButtonKind {
|
|
8
16
|
REGULAR = "regular",
|
package/src/index.ts
CHANGED
|
@@ -15,4 +15,7 @@ export { default as IconFloppyDisk } from './IconFloppyDisk.svelte'
|
|
|
15
15
|
export { default as IconTrashCan } from './IconTrashCan.svelte'
|
|
16
16
|
export { default as Alert } from './Alert.svelte'
|
|
17
17
|
export { default as IconIrocoLogo } from './IconIrocoLogo.svelte'
|
|
18
|
+
export { default as IrocoLogo } from './IrocoLogo.svelte'
|
|
19
|
+
export * from './definition'
|
|
20
|
+
|
|
18
21
|
|