@energie360/ui-library 0.1.0 → 0.1.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/base/abstracts/_mixins.scss +11 -5
- package/base/main-base.scss +1 -0
- package/components/icon-text-block/{icon-text-block.vue → u-icon-text-block.vue} +10 -6
- package/components/index.js +14 -0
- package/components/panel/panel.scss +70 -0
- package/components/panel/u-panel.vue +37 -0
- package/components/progress-bar/progress-bar.scss +37 -0
- package/components/progress-bar/u-progress-bar.vue +21 -0
- package/components/table/cell-ctas.scss +12 -0
- package/components/table/cell-icon-group.scss +12 -0
- package/components/table/cell-icon-text.scss +22 -0
- package/components/table/cell-progress-bar.scss +23 -0
- package/components/table/table-cell.mixins.scss +60 -0
- package/components/table/table-cell.scss +24 -0
- package/components/table/table-header.scss +5 -0
- package/components/table/table-heading.scss +8 -0
- package/components/table/table-row.scss +20 -0
- package/components/table/table.scss +12 -0
- package/components/table/table.type.ts +31 -0
- package/components/table/u-cell-ctas.vue +33 -0
- package/components/table/u-cell-icon-group.vue +31 -0
- package/components/table/u-cell-icon-text.vue +23 -0
- package/components/table/u-cell-progress-bar.vue +22 -0
- package/components/table/u-table-cell.vue +47 -0
- package/components/table/u-table-header.vue +9 -0
- package/components/table/u-table-heading.vue +24 -0
- package/components/table/u-table-row.vue +17 -0
- package/components/table/u-table.vue +11 -0
- package/components/tooltip/dom.js +167 -0
- package/components/tooltip/popover.js +200 -0
- package/components/tooltip/tooltip.scss +75 -0
- package/components/tooltip/u-tooltip.vue +92 -0
- package/components/tooltip/viewport.js +21 -0
- package/custom-elements.js +1 -0
- package/dist/base-style.css +1 -1
- package/dist/custom-elements.css +1 -0
- package/dist/{index.js → custom-elements.js} +1482 -1491
- package/dist/custom-elements.js.map +1 -0
- package/elements/button/_button-base.scss +1 -1
- package/elements/button/_button-filled-inverted.scss +3 -3
- package/elements/button/_button-filled.scss +3 -3
- package/elements/button/_button-outlined-inverted.scss +3 -3
- package/elements/button/_button-outlined.scss +3 -3
- package/elements/button/_button-plain.scss +3 -3
- package/elements/button/_button-secondary-outlined.scss +3 -3
- package/elements/button/button.js +2 -2
- package/elements/button/button.scss +1 -1
- package/elements/button/u-button.vue +44 -0
- package/elements/elements.js +35 -0
- package/elements/form-field/form-field-base.scss +142 -0
- package/elements/form-field/form-field-error.scss +20 -0
- package/elements/form-field/form-field-prefix-suffix.scss +80 -0
- package/elements/form-field/form-field-states.scss +59 -0
- package/elements/form-field/index.scss +4 -0
- package/elements/icon/icon.js +2 -2
- package/elements/icon/{icon.vue → u-icon.vue} +11 -15
- package/elements/icon-button/icon-button.js +2 -2
- package/elements/icon-button/{icon-button.vue → u-icon-button.vue} +14 -15
- package/elements/image/image.scss +3 -0
- package/elements/image/u-image.vue +17 -0
- package/elements/index.js +6 -31
- package/elements/loader/loader.js +2 -2
- package/elements/loader/{loader.vue → u-loader.vue} +6 -7
- package/elements/spectro/spectro.scss +13 -0
- package/elements/spectro/u-spectro.vue +11 -0
- package/elements/text-field/text-field.scss +30 -0
- package/elements/text-field/text-field.types.ts +6 -0
- package/elements/text-field/u-text-field.vue +164 -0
- package/elements/types.ts +12 -0
- package/env.d.ts +1 -0
- package/layout/grid/grid.scss +6 -7
- package/package.json +17 -7
- package/tsconfig.app.json +12 -0
- package/tsconfig.json +11 -0
- package/tsconfig.node.json +19 -0
- package/{vite.config.js → vite.config.ts} +1 -1
- package/wizard/index.js +4 -0
- package/wizard/wizard-intro/{wizard-intro.vue → u-wizard-intro.vue} +12 -9
- package/wizard/wizard-layout/{wizard-layout-block.vue → u-wizard-layout-block.vue} +6 -4
- package/dist/index.css +0 -1
- package/dist/index.js.map +0 -1
- package/elements/button/button.vue +0 -42
- package/index.js +0 -1
- /package/components/icon-text-block-group/{icon-text-block-group.vue → u-icon-text-block-group.vue} +0 -0
- /package/wizard/wizard-layout/{wizard-layout-element.vue → u-wizard-layout-element.vue} +0 -0
- /package/wizard/wizard-layout/{wizard-layout.vue → u-wizard-layout.vue} +0 -0
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&:active,
|
|
27
|
-
|
|
27
|
+
&.loading {
|
|
28
28
|
background-color: var(--e-c-primary-01-200);
|
|
29
29
|
border-color: var(--e-c-primary-01-200);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
&.disabled:not(
|
|
33
|
-
&:disabled:not(
|
|
32
|
+
&.disabled:not(.loading),
|
|
33
|
+
&:disabled:not(.loading) {
|
|
34
34
|
color: var(--e-c-mono-700);
|
|
35
35
|
|
|
36
36
|
.icon,
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&:active,
|
|
22
|
-
|
|
22
|
+
&.loading {
|
|
23
23
|
background-color: var(--e-c-secondary-01-700);
|
|
24
24
|
border-color: var(--e-c-secondary-01-700);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
&.disabled:not(
|
|
28
|
-
&:disabled:not(
|
|
27
|
+
&.disabled:not(.loading),
|
|
28
|
+
&:disabled:not(.loading) {
|
|
29
29
|
background-color: var(--e-c-mono-500);
|
|
30
30
|
border-color: var(--e-c-mono-500);
|
|
31
31
|
}
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&:active,
|
|
22
|
-
|
|
22
|
+
&.loading {
|
|
23
23
|
background-color: transparent;
|
|
24
24
|
border-color: var(--e-c-primary-01-500);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
&.disabled:not(
|
|
28
|
-
&:disabled:not(
|
|
27
|
+
&.disabled:not(.loading),
|
|
28
|
+
&:disabled:not(.loading) {
|
|
29
29
|
color: var(--e-c-mono-500);
|
|
30
30
|
border: 2px solid var(--e-c-mono-500);
|
|
31
31
|
background-color: transparent;
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&:active,
|
|
22
|
-
|
|
22
|
+
&.loading {
|
|
23
23
|
background-color: transparent;
|
|
24
24
|
border-color: var(--e-c-primary-01-500);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
&.disabled:not(
|
|
28
|
-
&:disabled:not(
|
|
27
|
+
&.disabled:not(.loading),
|
|
28
|
+
&:disabled:not(.loading) {
|
|
29
29
|
border-color: var(--e-c-mono-500);
|
|
30
30
|
background-color: transparent;
|
|
31
31
|
color: var(--e-c-mono-500);
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
&.disabled:not(
|
|
33
|
-
&:disabled:not(
|
|
32
|
+
&.disabled:not(.loading),
|
|
33
|
+
&:disabled:not(.loading) {
|
|
34
34
|
background: none;
|
|
35
35
|
color: var(--e-c-mono-500);
|
|
36
36
|
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
&.loading {
|
|
44
44
|
.loader,
|
|
45
45
|
e-loader {
|
|
46
46
|
--dot-color: var(--e-c-secondary-01-700);
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&:active,
|
|
22
|
-
|
|
22
|
+
&.loading {
|
|
23
23
|
background-color: transparent;
|
|
24
24
|
border-color: var(--e-c-secondary-02-200);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
&.disabled:not(
|
|
28
|
-
&:disabled:not(
|
|
27
|
+
&.disabled:not(.loading),
|
|
28
|
+
&:disabled:not(.loading) {
|
|
29
29
|
border-color: var(--e-c-mono-500);
|
|
30
30
|
background-color: transparent;
|
|
31
31
|
color: var(--e-c-mono-500);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement } from 'vue'
|
|
2
|
-
import Button from './button.vue'
|
|
2
|
+
import Button from './u-button.vue'
|
|
3
3
|
import customElementBaseStyle from '../../base/custom-element-base.scss?inline'
|
|
4
4
|
import styles from './button.scss?inline'
|
|
5
5
|
|
|
@@ -7,6 +7,6 @@ Button.styles = [customElementBaseStyle, styles]
|
|
|
7
7
|
|
|
8
8
|
export const ButtonElement = {
|
|
9
9
|
register: () => {
|
|
10
|
-
customElements.define('
|
|
10
|
+
customElements.define('u-button', defineCustomElement(Button))
|
|
11
11
|
},
|
|
12
12
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import UIcon from '../icon/u-icon.vue'
|
|
3
|
+
import ULoader from '../loader/u-loader.vue'
|
|
4
|
+
|
|
5
|
+
// TODO: use enums for variant prop.
|
|
6
|
+
interface ButtonProps {
|
|
7
|
+
label?: string
|
|
8
|
+
loading?: boolean
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
icon?: string
|
|
11
|
+
href?: string
|
|
12
|
+
target?: string
|
|
13
|
+
variant?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
defineProps<ButtonProps>()
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<template v-if="href">
|
|
21
|
+
<a :class="['button', variant]" :href :target>
|
|
22
|
+
<UIcon v-if="icon" :name="icon"></UIcon>
|
|
23
|
+
<slot>{{ label }}</slot>
|
|
24
|
+
</a>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<template v-else>
|
|
28
|
+
<button
|
|
29
|
+
:class="['button', variant, { loading: loading }]"
|
|
30
|
+
:disabled="disabled || null"
|
|
31
|
+
>
|
|
32
|
+
<UIcon v-if="icon" :name="icon" />
|
|
33
|
+
<slot>{{ label }}</slot>
|
|
34
|
+
|
|
35
|
+
<span class="button__loader" v-if="loading">
|
|
36
|
+
<ULoader />
|
|
37
|
+
</span>
|
|
38
|
+
</button>
|
|
39
|
+
</template>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<style lang="scss" scoped>
|
|
43
|
+
@use './button.scss';
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// All `elements` Custom Elements. Needs some refactoring.
|
|
2
|
+
|
|
3
|
+
import { ButtonElement as Button } from './button/button.js'
|
|
4
|
+
import { IconButtonElement as IconButton } from './icon-button/icon-button.js'
|
|
5
|
+
import { IconElement as Icon } from './icon/icon.js'
|
|
6
|
+
import { LoaderElement as Loader } from './loader/loader.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* These exports allow best tree-shaking behaviour.
|
|
10
|
+
* Obviously you'll have to import 'manually' all the elements you need.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { IconButton } from '@energie360/ui-library'
|
|
14
|
+
* IconButton.register()
|
|
15
|
+
*/
|
|
16
|
+
export { Button, IconButton, Icon, Loader }
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* With this export you get all the elements. Meaning all the elements will be inlcuded in your bundle, even if you register only one element.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { Elements } from '@energie360/ui-library'
|
|
23
|
+
* Elements.Button.register()
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @type {{IconButton: {register: function(): void}, Button: {register: function(): void}, Loader: {register: function(): void}, Icon: {register: function(): void}}}
|
|
29
|
+
*/
|
|
30
|
+
export const Elements = {
|
|
31
|
+
Button,
|
|
32
|
+
IconButton,
|
|
33
|
+
Icon,
|
|
34
|
+
Loader,
|
|
35
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
@use '../../base/abstracts' as a;
|
|
2
|
+
|
|
3
|
+
@mixin form-field-base($el: input) {
|
|
4
|
+
.wrapper {
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.label {
|
|
9
|
+
@include a.type(200);
|
|
10
|
+
|
|
11
|
+
z-index: 1;
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 50%;
|
|
14
|
+
left: var(--e-space-3);
|
|
15
|
+
padding: 0 var(--e-space-1);
|
|
16
|
+
color: var(--e-c-mono-700);
|
|
17
|
+
transform: translateY(-50%);
|
|
18
|
+
background-color: var(--e-c-mono-00);
|
|
19
|
+
border-radius: var(--e-brd-radius-1);
|
|
20
|
+
transition:
|
|
21
|
+
top a.$trs-default,
|
|
22
|
+
left a.$trs-default,
|
|
23
|
+
font-size a.$trs-default,
|
|
24
|
+
color a.$trs-default,
|
|
25
|
+
line-height a.$trs-default;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.control {
|
|
29
|
+
position: relative;
|
|
30
|
+
|
|
31
|
+
#{$el} {
|
|
32
|
+
padding: var(--e-space-3) var(--e-space-4);
|
|
33
|
+
transition: box-shadow a.$trs-default;
|
|
34
|
+
width: 100%;
|
|
35
|
+
color: transparent;
|
|
36
|
+
|
|
37
|
+
// This gives the focus-outline also a rounded border.
|
|
38
|
+
border-radius: var(--e-brd-radius-2);
|
|
39
|
+
|
|
40
|
+
@if $el == 'input' {
|
|
41
|
+
// For some reason `<input type="date">` adds more height.
|
|
42
|
+
// So we fix the height here.
|
|
43
|
+
height: a.rem(48);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@if $el == 'textarea' {
|
|
47
|
+
display: block;
|
|
48
|
+
min-height: a.rem(100);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.control-border {
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 0;
|
|
57
|
+
left: 0;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
border-radius: var(--e-brd-radius-2);
|
|
61
|
+
border: 1px solid var(--e-c-mono-900);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.error-messages-container,
|
|
65
|
+
.help-text {
|
|
66
|
+
margin-top: var(--e-space-1);
|
|
67
|
+
padding-left: var(--e-space-4);
|
|
68
|
+
color: var(--e-c-mono-700);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.error-messages-container {
|
|
72
|
+
display: none;
|
|
73
|
+
color: var(--e-c-signal-03-700);
|
|
74
|
+
|
|
75
|
+
@include a.type(50, strong);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.help-text {
|
|
79
|
+
display: none;
|
|
80
|
+
|
|
81
|
+
@include a.type(50);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// STATES (Same for all input types)
|
|
85
|
+
&.float-label {
|
|
86
|
+
.label {
|
|
87
|
+
@include a.type(50);
|
|
88
|
+
|
|
89
|
+
top: a.rem(1);
|
|
90
|
+
color: var(--e-c-mono-900);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.control {
|
|
94
|
+
#{$el} {
|
|
95
|
+
color: var(--e-c-mono-900);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.show-help-text {
|
|
101
|
+
.help-text {
|
|
102
|
+
display: block;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&.hover,
|
|
107
|
+
&.focus {
|
|
108
|
+
.control-border {
|
|
109
|
+
border: 2px solid var(--e-c-primary-01-900);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&.focus.float-label {
|
|
114
|
+
.label {
|
|
115
|
+
color: var(--e-c-primary-01-900);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Layout Modifiers
|
|
120
|
+
&.layout-compact {
|
|
121
|
+
.label {
|
|
122
|
+
left: var(--e-space-2);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.error-messages-container,
|
|
126
|
+
.help-text {
|
|
127
|
+
padding-left: var(--e-space-3);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.control-border {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.control {
|
|
135
|
+
#{$el} {
|
|
136
|
+
height: a.rem(40);
|
|
137
|
+
padding: var(--e-space-2) var(--e-space-3) var(--e-space-2)
|
|
138
|
+
var(--e-space-3);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@mixin form-field-error {
|
|
2
|
+
&.has-error,
|
|
3
|
+
&.has-error.float-label {
|
|
4
|
+
.label {
|
|
5
|
+
color: var(--e-c-signal-03-700);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.control-border {
|
|
9
|
+
border: 2px solid var(--e-c-signal-03-700);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.help-text {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.error-messages-container {
|
|
17
|
+
display: block;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
@use '../../base/abstracts' as a;
|
|
2
|
+
|
|
3
|
+
@mixin form-field-prefix-icon {
|
|
4
|
+
.prefix-icon {
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 50%;
|
|
7
|
+
left: var(--e-space-4);
|
|
8
|
+
transform: translateY(-50%);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&:has(.prefix-icon) {
|
|
12
|
+
.label {
|
|
13
|
+
left: var(--e-space-12);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.float-label {
|
|
17
|
+
.label {
|
|
18
|
+
left: var(--e-space-3);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.control input {
|
|
23
|
+
padding-left: var(--e-space-12);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// LAYOUT: compact
|
|
28
|
+
&.layout-compact {
|
|
29
|
+
.prefix-icon {
|
|
30
|
+
left: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:has(.prefix-icon) {
|
|
34
|
+
.control input {
|
|
35
|
+
padding-left: var(--e-space-8);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@mixin form-field-suffix-icon {
|
|
42
|
+
.suffix-action,
|
|
43
|
+
.suffix-text,
|
|
44
|
+
.suffix-icon {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 50%;
|
|
47
|
+
right: var(--e-space-4);
|
|
48
|
+
transform: translateY(-50%);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.suffix-text {
|
|
52
|
+
@include a.type(200);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.suffix-icon {
|
|
56
|
+
color: var(--e-c-primary-01-700);
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.focus,
|
|
61
|
+
&.hover {
|
|
62
|
+
.suffix-icon {
|
|
63
|
+
color: var(--e-c-primary-01-900);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.has-error {
|
|
68
|
+
.suffix-icon {
|
|
69
|
+
color: var(--e-c-signal-03-700);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:has(.suffix-text),
|
|
74
|
+
&:has(.suffix-icon) {
|
|
75
|
+
// A suffix only makes sense for an <input>. That's why we select only input here.
|
|
76
|
+
.control input {
|
|
77
|
+
padding-right: var(--e-space-12);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@mixin form-field-required {
|
|
2
|
+
&.required {
|
|
3
|
+
.optional-text {
|
|
4
|
+
display: none;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@mixin form-field-disabled($el: input) {
|
|
10
|
+
&.disabled {
|
|
11
|
+
.control-border {
|
|
12
|
+
border-color: var(--e-c-mono-500);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.label {
|
|
16
|
+
color: var(--e-c-mono-500);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.control {
|
|
20
|
+
#{$el} {
|
|
21
|
+
color: var(--e-c-mono-500);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.error-messages-container,
|
|
26
|
+
.help-text {
|
|
27
|
+
color: var(--e-c-mono-500);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@mixin form-field-readonly($el: input) {
|
|
33
|
+
&.readonly {
|
|
34
|
+
.control-border {
|
|
35
|
+
border-color: var(--e-c-mono-200);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.label {
|
|
39
|
+
color: var(--e-c-mono-700);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.control {
|
|
43
|
+
#{$el} {
|
|
44
|
+
color: var(--e-c-mono-700);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.error-messages-container,
|
|
49
|
+
.help-text {
|
|
50
|
+
color: var(--e-c-mono-700);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@mixin form-field-states-all($el: input) {
|
|
56
|
+
@include form-field-disabled($el);
|
|
57
|
+
@include form-field-readonly($el);
|
|
58
|
+
@include form-field-required;
|
|
59
|
+
}
|
package/elements/icon/icon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement } from 'vue'
|
|
2
|
-
import Icon from './icon.vue'
|
|
2
|
+
import Icon from './u-icon.vue'
|
|
3
3
|
import customElementBaseStyle from '../../base/custom-element-base.scss?inline'
|
|
4
4
|
import ceStyles from './icon.ce.scss?inline'
|
|
5
5
|
import styles from './icon.scss?inline'
|
|
@@ -8,6 +8,6 @@ Icon.styles = [customElementBaseStyle, ceStyles, styles]
|
|
|
8
8
|
|
|
9
9
|
export const IconElement = {
|
|
10
10
|
register: () => {
|
|
11
|
-
customElements.define('
|
|
11
|
+
customElements.define('u-icon', defineCustomElement(Icon))
|
|
12
12
|
},
|
|
13
13
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
<script setup>
|
|
1
|
+
<script setup lang="ts">
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import { assetsPath } from '../../globals.js'
|
|
4
4
|
|
|
5
|
+
interface Props {
|
|
6
|
+
name: string
|
|
7
|
+
inline?: boolean
|
|
8
|
+
width?: number
|
|
9
|
+
height?: number
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
/**
|
|
6
13
|
* Path prefix for icons.
|
|
7
14
|
*/
|
|
@@ -19,18 +26,12 @@ const svgPlaceholder = `
|
|
|
19
26
|
<svg width="24" height="24"></svg>
|
|
20
27
|
`
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
* @typedef { import('vue').Ref } Ref
|
|
24
|
-
*/
|
|
25
|
-
let svgContent = ref(svgPlaceholder)
|
|
29
|
+
const svgContent = ref(svgPlaceholder)
|
|
26
30
|
|
|
27
31
|
/**
|
|
28
32
|
* Fetches an icon from the assets folder. Or if already fecthed gets it from `iconMap`.
|
|
29
|
-
*
|
|
30
|
-
* @param {string} name - Icon name (without extension)
|
|
31
|
-
* @returns {Ref}
|
|
32
33
|
*/
|
|
33
|
-
const getIcon = (name) => {
|
|
34
|
+
const getIcon = (name: string): string => {
|
|
34
35
|
// Check if icon has already been fetched.
|
|
35
36
|
if (iconMap.has(name)) {
|
|
36
37
|
svgContent.value = iconMap.get(name)
|
|
@@ -57,12 +58,7 @@ const getIcon = (name) => {
|
|
|
57
58
|
return svgContent.value
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
defineProps(
|
|
61
|
-
name: String,
|
|
62
|
-
inline: Boolean,
|
|
63
|
-
width: Number,
|
|
64
|
-
height: Number,
|
|
65
|
-
})
|
|
61
|
+
defineProps<Props>()
|
|
66
62
|
</script>
|
|
67
63
|
|
|
68
64
|
<template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCustomElement } from 'vue'
|
|
2
|
-
import IconButton from './icon-button.vue'
|
|
2
|
+
import IconButton from './u-icon-button.vue'
|
|
3
3
|
import customElementBaseStyle from '../../base/custom-element-base.scss?inline'
|
|
4
4
|
import styles from './icon-button.scss?inline'
|
|
5
5
|
|
|
@@ -7,6 +7,6 @@ IconButton.styles = [customElementBaseStyle, styles]
|
|
|
7
7
|
|
|
8
8
|
export const IconButtonElement = {
|
|
9
9
|
register: () => {
|
|
10
|
-
customElements.define('
|
|
10
|
+
customElements.define('u-icon-button', defineCustomElement(IconButton))
|
|
11
11
|
},
|
|
12
12
|
}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import UIcon from '../icon/u-icon.vue'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
label
|
|
6
|
-
icon:
|
|
7
|
-
variant
|
|
8
|
-
disabled
|
|
9
|
-
href
|
|
10
|
-
target
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})
|
|
4
|
+
interface Props {
|
|
5
|
+
label?: string
|
|
6
|
+
icon: string
|
|
7
|
+
variant?: string
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
href?: string
|
|
10
|
+
target?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { target = '_blank', variant = 'filled' } = defineProps<Props>()
|
|
15
14
|
</script>
|
|
16
15
|
|
|
17
16
|
<template>
|
|
18
17
|
<template v-if="href">
|
|
19
18
|
<a :class="['icon-button', variant]" :href="href" :target="target">
|
|
20
|
-
<
|
|
19
|
+
<UIcon v-if="icon" :name="icon" />
|
|
21
20
|
|
|
22
21
|
<span class="visually-hidden">
|
|
23
22
|
<slot>{{ label }}</slot>
|
|
@@ -27,7 +26,7 @@ defineProps({
|
|
|
27
26
|
|
|
28
27
|
<template v-else>
|
|
29
28
|
<button :class="['icon-button', variant]" :disabled="disabled || null">
|
|
30
|
-
<
|
|
29
|
+
<UIcon v-if="icon" :name="icon" />
|
|
31
30
|
|
|
32
31
|
<span class="visually-hidden">
|
|
33
32
|
<slot>{{ label }}</slot>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Image } from '../types'
|
|
3
|
+
|
|
4
|
+
interface Props extends Image {}
|
|
5
|
+
|
|
6
|
+
defineProps<Props>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<picture>
|
|
11
|
+
<img class="image" :src :alt />
|
|
12
|
+
</picture>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<style lang="scss" scoped>
|
|
16
|
+
@use './image.scss';
|
|
17
|
+
</style>
|