@iroco/ui 0.6.5 → 0.8.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/index.js +1050 -157
- package/lib/index.min.js +8 -8
- package/lib/index.mjs +1045 -158
- package/lib/index.mjs.css +301 -72
- package/package.json +1 -1
- package/src/Alert.svelte +33 -0
- package/src/Button.svelte +63 -34
- package/src/DataTable.svelte +72 -0
- package/src/IconFloppyDisk.svelte +12 -0
- package/src/IconMoreSign.svelte +15 -0
- package/src/IconTrashCan.svelte +20 -0
- package/src/Loader.svelte +30 -0
- package/src/Navigation.svelte +10 -5
- package/src/SideBar.svelte +26 -24
- package/src/TextInput.svelte +101 -23
- package/src/definition.ts +10 -0
- package/src/index.ts +14 -10
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let width = '5rem';
|
|
3
|
+
export let height = '5rem';
|
|
4
|
+
export let stroke = 'currentColor';
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<svg
|
|
8
|
+
{width}
|
|
9
|
+
{height}
|
|
10
|
+
fill="none"
|
|
11
|
+
{stroke}
|
|
12
|
+
viewBox="0 0 24 24"
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
><path
|
|
15
|
+
stroke-linecap="round"
|
|
16
|
+
stroke-linejoin="round"
|
|
17
|
+
stroke-width="2"
|
|
18
|
+
d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
|
19
|
+
/></svg
|
|
20
|
+
>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import IconIrocoLogo from './IconIrocoLogo.svelte';
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="rotate linear infinite">
|
|
6
|
+
<IconIrocoLogo width="4em" height="4em" />
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<style>
|
|
10
|
+
.rotate {
|
|
11
|
+
animation: rotation 2s;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.linear {
|
|
15
|
+
animation-timing-function: linear;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.infinite {
|
|
19
|
+
animation-iteration-count: infinite;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@keyframes rotation {
|
|
23
|
+
from {
|
|
24
|
+
transform: rotate(0deg);
|
|
25
|
+
}
|
|
26
|
+
to {
|
|
27
|
+
transform: rotate(359deg);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</style>
|
package/src/Navigation.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { NavigationItem } from '
|
|
2
|
+
import type { NavigationItem } from './definition';
|
|
3
3
|
import IconBurger from './IconBurger.svelte';
|
|
4
4
|
import IconIrocoLogo from './IconIrocoLogo.svelte';
|
|
5
5
|
import SideBar from './SideBar.svelte';
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
</button>
|
|
22
22
|
|
|
23
23
|
{#if showMenu}
|
|
24
|
-
<SideBar
|
|
24
|
+
<SideBar
|
|
25
|
+
on:click_link={() => (showMenu = false)}
|
|
26
|
+
on:click={() => (showMenu = false)}
|
|
27
|
+
{navigationItems}
|
|
28
|
+
/>
|
|
25
29
|
{/if}
|
|
26
30
|
</div>
|
|
27
31
|
|
|
@@ -39,7 +43,7 @@
|
|
|
39
43
|
.account__navigation {
|
|
40
44
|
display: block;
|
|
41
45
|
width: 100%;
|
|
42
|
-
border-bottom: 1px solid colors.$
|
|
46
|
+
border-bottom: 1px solid colors.$mediumGrey;
|
|
43
47
|
&--mobile {
|
|
44
48
|
display: none;
|
|
45
49
|
}
|
|
@@ -64,8 +68,9 @@
|
|
|
64
68
|
justify-content: space-between;
|
|
65
69
|
position: fixed;
|
|
66
70
|
top: 0;
|
|
71
|
+
z-index: 1;
|
|
67
72
|
width: 100%;
|
|
68
|
-
border-bottom: 1px solid colors.$
|
|
73
|
+
border-bottom: 1px solid colors.$mediumGrey;
|
|
69
74
|
|
|
70
75
|
h1 {
|
|
71
76
|
font: bold;
|
|
@@ -74,7 +79,7 @@
|
|
|
74
79
|
&__button {
|
|
75
80
|
background-color: transparent;
|
|
76
81
|
border: none;
|
|
77
|
-
color: colors.$
|
|
82
|
+
color: colors.$mediumGrey;
|
|
78
83
|
}
|
|
79
84
|
&__title-container {
|
|
80
85
|
display: flex;
|
package/src/SideBar.svelte
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import IconClose from './IconClose.svelte';
|
|
3
3
|
import type { NavigationItem } from 'definition';
|
|
4
|
+
import { createEventDispatcher } from 'svelte';
|
|
4
5
|
|
|
5
6
|
export let navigationItems: Array<NavigationItem>;
|
|
7
|
+
|
|
8
|
+
let active: string;
|
|
9
|
+
const dispatch = createEventDispatcher();
|
|
10
|
+
|
|
11
|
+
const handleClickLink = (menuItem: NavigationItem) => {
|
|
12
|
+
active = menuItem.name;
|
|
13
|
+
if (typeof menuItem.hrefOrCallback === "function") {
|
|
14
|
+
menuItem.hrefOrCallback()
|
|
15
|
+
}
|
|
16
|
+
dispatch('click_link');
|
|
17
|
+
};
|
|
6
18
|
</script>
|
|
7
19
|
|
|
8
20
|
<nav data-testid="sidebar" class="account__sidebar">
|
|
@@ -11,9 +23,9 @@
|
|
|
11
23
|
</button>
|
|
12
24
|
|
|
13
25
|
<ul class="account__sidebar__item_container">
|
|
14
|
-
{#each navigationItems as
|
|
15
|
-
<li class="account__sidebar__item">
|
|
16
|
-
<a href={
|
|
26
|
+
{#each navigationItems as item}
|
|
27
|
+
<li class="account__sidebar__item" class:active={active === item.name}>
|
|
28
|
+
<a on:click={() => handleClickLink(item)} href={typeof item.hrefOrCallback === 'string' ? item.hrefOrCallback: '#'}> {item.name}</a>
|
|
17
29
|
</li>
|
|
18
30
|
{/each}
|
|
19
31
|
</ul>
|
|
@@ -26,40 +38,25 @@
|
|
|
26
38
|
.account__sidebar {
|
|
27
39
|
height: 100%;
|
|
28
40
|
width: 300px;
|
|
29
|
-
position:
|
|
41
|
+
position: absolute;
|
|
30
42
|
top: 70px;
|
|
31
|
-
z-index: 1;
|
|
32
43
|
overflow-x: hidden;
|
|
44
|
+
border-right: 1px solid colors.$mediumGrey;
|
|
33
45
|
&__item_container {
|
|
34
46
|
margin: 0;
|
|
35
47
|
padding: 0;
|
|
36
48
|
width: 100%;
|
|
37
49
|
height: 100%;
|
|
38
50
|
}
|
|
39
|
-
|
|
40
51
|
&__item {
|
|
41
|
-
padding: 2em
|
|
52
|
+
padding: 2em 2em;
|
|
42
53
|
text-decoration: none;
|
|
43
54
|
font-size: 0.75em;
|
|
44
|
-
border-top: 1px solid colors.$darkBeige;
|
|
45
55
|
display: block;
|
|
46
|
-
|
|
56
|
+
border-top: 1px solid colors.$mediumGrey;
|
|
57
|
+
border-bottom: 1px solid colors.$mediumGrey a {
|
|
47
58
|
padding-left: 1em;
|
|
48
59
|
}
|
|
49
|
-
&:hover {
|
|
50
|
-
background-color: colors.$darkBeige;
|
|
51
|
-
}
|
|
52
|
-
&:hover a {
|
|
53
|
-
color: colors.$darkBlue;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&:last-child {
|
|
57
|
-
border-bottom: 1px solid colors.$darkBeige;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&:first-child {
|
|
61
|
-
border: none;
|
|
62
|
-
}
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
&__item a {
|
|
@@ -70,6 +67,11 @@
|
|
|
70
67
|
&__close {
|
|
71
68
|
display: none;
|
|
72
69
|
}
|
|
70
|
+
|
|
71
|
+
.active {
|
|
72
|
+
border-top: 1px solid colors.$green;
|
|
73
|
+
border-bottom: 1px solid colors.$green;
|
|
74
|
+
}
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
@include screen-tablet {
|
|
@@ -82,11 +84,11 @@
|
|
|
82
84
|
padding: 0;
|
|
83
85
|
padding-top: 2em;
|
|
84
86
|
margin: 0;
|
|
87
|
+
border-right: none;
|
|
85
88
|
&__item_container {
|
|
86
89
|
padding: 0em;
|
|
87
90
|
margin-top: 2rem;
|
|
88
91
|
}
|
|
89
|
-
|
|
90
92
|
&__close {
|
|
91
93
|
display: block;
|
|
92
94
|
position: absolute;
|
package/src/TextInput.svelte
CHANGED
|
@@ -1,32 +1,110 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export let placeholder: string | null = null;
|
|
8
|
-
export let error: string | null = null;
|
|
9
|
-
export let value: string | null = null;
|
|
10
|
-
export let onFocus: (e) => void
|
|
11
|
-
export let onBlur: (e) => void
|
|
12
|
-
export let readonly = false;
|
|
13
|
-
|
|
14
|
-
function typeAction(node: HTMLInputElement) {
|
|
15
|
-
node.type = type
|
|
16
|
-
}
|
|
2
|
+
export enum TextType {
|
|
3
|
+
text = 'text',
|
|
4
|
+
email = 'email',
|
|
5
|
+
password = 'password'
|
|
6
|
+
}
|
|
17
7
|
|
|
8
|
+
export let id: string;
|
|
9
|
+
export let type: TextType;
|
|
10
|
+
export let label: string | null = null;
|
|
11
|
+
export let placeholder: string | undefined;
|
|
12
|
+
export let error: string | null = null;
|
|
13
|
+
export let value: string | null = null;
|
|
14
|
+
export let onFocus: (e: FocusEvent) => void;
|
|
15
|
+
export let onBlur: (e: Event) => void;
|
|
16
|
+
export let readonly = false;
|
|
17
|
+
export let border = false;
|
|
18
|
+
|
|
19
|
+
function typeAction(node: HTMLInputElement) {
|
|
20
|
+
node.type = type;
|
|
21
|
+
}
|
|
18
22
|
</script>
|
|
19
23
|
|
|
20
24
|
<div class="iroco-ui-input">
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
{#if label}
|
|
26
|
+
<label class="iroco-ui-label" for={id}>{label}</label>
|
|
27
|
+
{/if}
|
|
28
|
+
<input
|
|
29
|
+
on:input
|
|
30
|
+
bind:value
|
|
31
|
+
on:focus={onFocus}
|
|
32
|
+
on:blur={onBlur}
|
|
33
|
+
{id}
|
|
34
|
+
type="text"
|
|
35
|
+
{placeholder}
|
|
36
|
+
class:border
|
|
37
|
+
class:error={error !== null}
|
|
38
|
+
class:readonlyInput={readonly == true}
|
|
39
|
+
use:typeAction
|
|
40
|
+
{readonly}
|
|
41
|
+
/>
|
|
42
|
+
{#if error != null}
|
|
43
|
+
<p data-testid="error" class="error">{error !== null ? error : ''}</p>
|
|
44
|
+
{/if}
|
|
28
45
|
</div>
|
|
29
46
|
|
|
30
47
|
<style lang="scss">
|
|
31
|
-
|
|
48
|
+
@use "../scss/colors";
|
|
49
|
+
input,
|
|
50
|
+
textarea {
|
|
51
|
+
outline: none;
|
|
52
|
+
text-decoration: none;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
|
|
55
|
+
&:focus {
|
|
56
|
+
outline: none;
|
|
57
|
+
text-decoration: none;
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.iroco-ui-input {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
|
|
66
|
+
> input {
|
|
67
|
+
color: colors.$beige;
|
|
68
|
+
background: colors.$darkBlue;
|
|
69
|
+
border: 1px solid colors.$darkBlue;
|
|
70
|
+
padding: 1em 1.5em;
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
border-radius: 0.5em;
|
|
75
|
+
|
|
76
|
+
&.border {
|
|
77
|
+
border: 1px solid colors.$beige;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&::placeholder {
|
|
81
|
+
color: rgba(colors.$beige, 0.5);
|
|
82
|
+
}
|
|
83
|
+
&.error {
|
|
84
|
+
border-color: colors.$red;
|
|
85
|
+
}
|
|
86
|
+
&.readonlyInput {
|
|
87
|
+
cursor: not-allowed;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.error {
|
|
92
|
+
color: colors.$red;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.iroco-ui-label {
|
|
97
|
+
color: rgba(colors.$beige, 0.6);
|
|
98
|
+
font-weight: bold;
|
|
99
|
+
padding-bottom: 10px;
|
|
100
|
+
display: inline-block;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.field {
|
|
104
|
+
margin-top: 20px;
|
|
105
|
+
|
|
106
|
+
&:first-child {
|
|
107
|
+
margin: 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
32
110
|
</style>
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import '../scss/style.scss';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export {
|
|
2
|
+
export { default as Button } from './Button.svelte';
|
|
3
|
+
export { default as TextInput } from './TextInput.svelte'
|
|
4
|
+
export { default as RadioButton } from './RadioButton.svelte';
|
|
5
|
+
export { default as NumberInput } from './NumberInput.svelte'
|
|
6
|
+
export { default as Icon } from './Icon.svelte'
|
|
7
|
+
export { default as Loader } from './Loader.svelte'
|
|
8
|
+
export { default as IconInfo } from './IconInfo.svelte'
|
|
9
|
+
export { default as SideBar } from './SideBar.svelte'
|
|
10
|
+
export { default as Navigation } from './Navigation.svelte'
|
|
11
|
+
export { default as DataTable } from './DataTable.svelte'
|
|
12
|
+
export { default as IconMore } from './IconMoreSign.svelte'
|
|
13
|
+
export { default as IconFloppyDisk } from './IconFloppyDisk.svelte'
|
|
14
|
+
export { default as IconTrashCan } from './IconTrashCan.svelte'
|
|
15
|
+
export { default as Alert } from './Alert.svelte'
|