@energie360/ui-library 0.1.14 → 0.1.16

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.
Files changed (64) hide show
  1. package/base/abstracts/_layers.scss +1 -0
  2. package/base/abstracts/_resets.scss +1 -0
  3. package/components/card-header/card-header.scss +32 -32
  4. package/components/context-menu/context-menu.scss +1 -0
  5. package/components/hint/hint.scss +126 -0
  6. package/components/hint/u-hint.vue +54 -0
  7. package/components/index.js +2 -0
  8. package/components/inline-edit/u-inline-edit.vue +3 -1
  9. package/components/navigation-panel-tile/navigation-panel-tile.scss +105 -0
  10. package/components/navigation-panel-tile/u-navigation-panel-tile.vue +82 -0
  11. package/components/navigation-toolbar-link/navigation-toolbar-link.scss +23 -11
  12. package/components/navigation-toolbar-link/u-navigation-toolbar-link.vue +1 -1
  13. package/components/richtext/_wizard.scss +26 -0
  14. package/components/richtext/richtext.scss +26 -4
  15. package/components/richtext/u-richtext.vue +1 -3
  16. package/components/welcome/welcome.scss +1 -0
  17. package/dist/base-style.css +1 -0
  18. package/dist/base-style.css.map +1 -1
  19. package/elements/checkbox/checkbox.scss +150 -0
  20. package/elements/checkbox/u-checkbox.vue +42 -0
  21. package/elements/form/form.scss +3 -2
  22. package/elements/form-field/form-field-prefix-suffix.scss +1 -2
  23. package/elements/icon/u-icon.vue +34 -24
  24. package/elements/index.js +3 -0
  25. package/elements/radio/radio.scss +91 -2
  26. package/elements/radio/u-radio.vue +6 -3
  27. package/elements/radio-group/radio-group.scss +28 -0
  28. package/elements/radio-group/u-radio-group.vue +23 -3
  29. package/elements/select-chip/select-chip.scss +1 -0
  30. package/elements/select-chip/u-select-chip.vue +2 -2
  31. package/elements/select-chips/select-chips.scss +18 -0
  32. package/elements/select-chips/u-select-chips.vue +16 -3
  33. package/elements/select-tile/select-tile.scss +205 -0
  34. package/elements/select-tile/u-select-tile.vue +53 -0
  35. package/elements/select-tiles/select-tiles.scss +32 -0
  36. package/elements/select-tiles/u-select-tiles.vue +31 -0
  37. package/elements/text-field/text-field.types.ts +1 -0
  38. package/elements/text-field/u-text-field.vue +22 -14
  39. package/elements/toggle-switch/toggle-switch.scss +14 -4
  40. package/elements/toggle-switch/u-toggle-switch.vue +23 -20
  41. package/modules/index.js +4 -0
  42. package/modules/navigation-panel/navigation-panel.scss +65 -0
  43. package/modules/navigation-panel/u-navigation-panel.vue +22 -0
  44. package/modules/navigation-toolbar-side/navigation-toolbar-side.scss +1 -1
  45. package/modules/navigation-toolbar-top/navigation-toolbar-top.scss +1 -0
  46. package/modules/progress-indicator/progress-indicator.scss +84 -0
  47. package/modules/progress-indicator/u-progress-indicator.vue +34 -0
  48. package/modules/toast/toast-message.scss +67 -0
  49. package/modules/toast/toast.scss +14 -0
  50. package/modules/toast/u-toast-message.vue +46 -0
  51. package/modules/toast/u-toast.vue +26 -0
  52. package/modules/toast/useToast.ts +40 -0
  53. package/package.json +1 -1
  54. package/utils/translations/translate.js +0 -10
  55. package/wizard/index.js +1 -0
  56. package/wizard/wizard-outro/u-wizard-outro.vue +49 -0
  57. package/wizard/wizard-outro/wizard-outro.scss +56 -0
  58. package/elements/button/button.js +0 -12
  59. package/elements/elements.js +0 -35
  60. package/elements/icon/icon.js +0 -13
  61. package/elements/icon-button/icon-button.js +0 -12
  62. package/elements/loader/loader.js +0 -13
  63. package/modules/feedback/index.js +0 -1
  64. package/modules/inline-edit-group/index.js +0 -1
@@ -0,0 +1,84 @@
1
+ @use '../../base/abstracts/' as a;
2
+
3
+ .progress-indicator {
4
+ progress[value]::-webkit-progress-bar {
5
+ width: 100%;
6
+ height: 6px;
7
+ background-color: var(--e-c-mono-100);
8
+ transition: width 300ms ease;
9
+ }
10
+
11
+ progress[value]::-webkit-progress-value {
12
+ width: 0;
13
+ background-color: var(--e-c-primary-01-500);
14
+ transition: width a.$trs-default;
15
+ }
16
+
17
+ &.rounded {
18
+ border-radius: 3px;
19
+ overflow: hidden;
20
+
21
+ .progress-indicator__segment {
22
+ position: relative;
23
+ border: none;
24
+
25
+ &::before {
26
+ content: '';
27
+ position: absolute;
28
+ width: 10px;
29
+ height: 6px;
30
+ left: 3px;
31
+ box-shadow: -6px 0 0 0 var(--e-c-mono-00);
32
+ border-radius: 3px;
33
+ }
34
+
35
+ &::after {
36
+ content: '';
37
+ position: absolute;
38
+ width: 10px;
39
+ height: 6px;
40
+ right: 3px;
41
+ box-shadow: 6px 0 0 0 var(--e-c-mono-00);
42
+ border-radius: 3px;
43
+ }
44
+
45
+ &:first-of-type::before {
46
+ content: none;
47
+ }
48
+
49
+ &:last-of-type {
50
+ content: none;
51
+ }
52
+ }
53
+ }
54
+ }
55
+
56
+ .progress-indicator__main-track {
57
+ position: relative;
58
+ display: flex;
59
+ height: 6px;
60
+ width: 100%;
61
+ }
62
+
63
+ .progress-indicator__progress {
64
+ position: absolute;
65
+ top: 0;
66
+ left: 0;
67
+ width: 100%;
68
+ appearance: none;
69
+ }
70
+
71
+ .progress-indicator__segment {
72
+ position: relative;
73
+ flex: 1 0 auto;
74
+ border-right: 4px solid var(--e-c-mono-00);
75
+ border-left: 4px solid var(--e-c-mono-00);
76
+
77
+ &:first-of-type {
78
+ border-left: 0;
79
+ }
80
+
81
+ &:last-of-type {
82
+ border-right: 0;
83
+ }
84
+ }
@@ -0,0 +1,34 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+ interface Props {
5
+ index: number
6
+ steps: number[]
7
+ rounded?: boolean
8
+ }
9
+
10
+ const { steps, rounded = false } = defineProps<Props>()
11
+
12
+ const totalSteps = computed(() => steps.reduce((acc, val) => (acc += val), 0))
13
+
14
+ const getSegmentWidth = (steps: number) => (100 / totalSteps.value) * steps
15
+ </script>
16
+
17
+ <template>
18
+ <div :class="['progress-indicator', { rounded }]">
19
+ <div class="progress-indicator__main-track">
20
+ <progress class="progress-indicator__progress" :max="totalSteps" :value="index"></progress>
21
+
22
+ <div
23
+ v-for="(segment, idx) in steps"
24
+ :key="idx"
25
+ class="progress-indicator__segment"
26
+ :style="{
27
+ width: `${getSegmentWidth(segment)}%`,
28
+ }"
29
+ ></div>
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <style scoped lang="scss" src="./progress-indicator.scss"></style>
@@ -0,0 +1,67 @@
1
+ @use '../../base/abstracts' as a;
2
+
3
+ .toast-message {
4
+ pointer-events: auto;
5
+
6
+ .toast-message__inner {
7
+ @include a.type(100, strong);
8
+
9
+ position: relative;
10
+ max-width: a.rem(405);
11
+ padding: var(--e-space-4) var(--e-space-14);
12
+ border-radius: var(--e-space-2);
13
+ color: var(--e-c-mono-00);
14
+ }
15
+
16
+ .toast-message__icon {
17
+ position: absolute;
18
+ top: 50%;
19
+ left: var(--e-space-4);
20
+ transform: translateY(-50%);
21
+ }
22
+
23
+ .toast-message__close-button {
24
+ position: absolute;
25
+ color: var(--e-c-mono-00);
26
+ right: var(--e-space-4);
27
+ top: 50%;
28
+ transform: translateY(-50%);
29
+ cursor: pointer;
30
+ }
31
+
32
+ // Modifiers
33
+ &.success {
34
+ .toast-message__icon {
35
+ color: var(--e-c-signal-01-500);
36
+ }
37
+
38
+ .toast-message__inner {
39
+ background-color: var(--e-c-signal-01-700);
40
+ }
41
+ }
42
+
43
+ &.error {
44
+ .toast-message__icon {
45
+ color: var(--e-c-signal-03-500);
46
+ }
47
+
48
+ .toast-message__inner {
49
+ background-color: var(--e-c-signal-03-700);
50
+ }
51
+ }
52
+
53
+ // Animations
54
+ &.fade-in {
55
+ animation-name: fade-in-message;
56
+ animation-duration: var(--e-trs-duration-faster);
57
+ animation-timing-function: ease-in;
58
+ animation-fill-mode: forwards;
59
+ }
60
+
61
+ &.toast-message--fade-out {
62
+ animation-name: fade-out-message;
63
+ animation-duration: var(--e-trs-duration-faster);
64
+ animation-timing-function: ease-in;
65
+ animation-fill-mode: forwards;
66
+ }
67
+ }
@@ -0,0 +1,14 @@
1
+ @use '../../base/abstracts' as a;
2
+
3
+ .toast {
4
+ z-index: a.$layer-message;
5
+ position: fixed;
6
+ bottom: var(--e-space-6);
7
+ left: 0;
8
+ display: flex;
9
+ flex-direction: column-reverse;
10
+ align-items: center;
11
+ width: 100%;
12
+ grid-gap: var(--e-space-4);
13
+ pointer-events: none;
14
+ }
@@ -0,0 +1,46 @@
1
+ <script setup lang="ts">
2
+ import { UIcon } from '../../elements'
3
+ import { dismiss } from './useToast'
4
+ import { ref } from 'vue'
5
+
6
+ interface Props {
7
+ id: number
8
+ type: 'success' | 'error'
9
+ message: string
10
+ }
11
+
12
+ const { id } = defineProps<Props>()
13
+
14
+ enum MessageType {
15
+ success = 'check-circle',
16
+ error = 'report',
17
+ }
18
+
19
+ const fadeIn = ref(false)
20
+ const close = () => dismiss(id)
21
+ </script>
22
+
23
+ <template>
24
+ <div :class="['toast-message', type, { 'fade-in': fadeIn }]">
25
+ <div class="container">
26
+ <div class="toast-message__inner">
27
+ <div class="toast-message__icon">
28
+ <UIcon :name="MessageType[type]"></UIcon>
29
+ </div>
30
+ <div ref="message" class="toast-message__message">
31
+ {{ message }}
32
+ </div>
33
+ <button
34
+ class="toast-message__close-button"
35
+ type="button"
36
+ aria-label="Close message"
37
+ @click="close"
38
+ >
39
+ <UIcon name="close"></UIcon>
40
+ </button>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ </template>
45
+
46
+ <style scoped lang="scss" src="./toast-message.scss"></style>
@@ -0,0 +1,26 @@
1
+ <script setup lang="ts">
2
+ import UToastMessage from './u-toast-message.vue'
3
+ import { toasts } from './useToast'
4
+ </script>
5
+
6
+ <template>
7
+ <div class="toast">
8
+ <TransitionGroup name="list">
9
+ <UToastMessage v-for="(item, idx) in toasts" :key="idx" v-bind="item" />
10
+ </TransitionGroup>
11
+ </div>
12
+ </template>
13
+
14
+ <style scoped>
15
+ .list-enter-active,
16
+ .list-leave-active {
17
+ transition: all var(--e-trs-duration-faster) ease-in;
18
+ }
19
+ .list-enter-from,
20
+ .list-leave-to {
21
+ opacity: 0;
22
+ transform: translateY(10px);
23
+ }
24
+ </style>
25
+
26
+ <style scoped lang="scss" src="./toast.scss"></style>
@@ -0,0 +1,40 @@
1
+ import { ref } from 'vue'
2
+
3
+ let messageId = 0
4
+ const defaultTimeout = 3000
5
+
6
+ type ToastMessage = {
7
+ id: number
8
+ type: 'success' | 'error'
9
+ message: string
10
+ timeout?: number
11
+ }
12
+
13
+ const toasts = ref<ToastMessage[]>([])
14
+
15
+ type Toast = Omit<ToastMessage, 'id'>
16
+
17
+ const toast = (args: Toast) => {
18
+ messageId++
19
+
20
+ const toastObj = {
21
+ ...args,
22
+ id: messageId,
23
+ }
24
+
25
+ toasts.value.push(toastObj)
26
+
27
+ if (args.timeout === 0) {
28
+ return
29
+ }
30
+
31
+ setTimeout(() => {
32
+ dismiss(toastObj.id)
33
+ }, args.timeout || defaultTimeout)
34
+ }
35
+
36
+ const dismiss = (messageId: number) => {
37
+ toasts.value = toasts.value.filter((item) => item.id !== messageId)
38
+ }
39
+
40
+ export { toast, toasts, dismiss }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energie360/ui-library",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,17 +1,7 @@
1
- import { deepGetByPath } from '../object/deep-get.js'
2
1
  import translations from '../../i18n/i18n.ts'
3
2
 
4
3
  const DEFAULT_LANGUAGE = 'DE'
5
4
 
6
- /**
7
- *
8
- * @param {string} translationKeyPath
9
- * @param {string} defaultValue
10
- * @returns {string}
11
- */
12
- export const translate = (translationKeyPath, defaultValue = '') =>
13
- deepGetByPath(window._EC.translations, translationKeyPath) || defaultValue
14
-
15
5
  const getLanguage = () => {
16
6
  const langAttr = document.documentElement.lang.split('-')[0].toUpperCase()
17
7
 
package/wizard/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as UWizardIntro } from './wizard-intro/u-wizard-intro.vue'
2
+ export { default as UWizardOutro } from './wizard-outro/u-wizard-outro.vue'
2
3
  export { default as UWizardLayout } from './wizard-layout/u-wizard-layout.vue'
3
4
  export { default as UWizardLayoutBlock } from './wizard-layout/u-wizard-layout-block.vue'
4
5
  export { default as UWizardLayoutElement } from './wizard-layout/u-wizard-layout-element.vue'
@@ -0,0 +1,49 @@
1
+ <script setup lang="ts">
2
+ import { Image, Cta } from '../../elements/types'
3
+ import { UButton } from '../../elements'
4
+ import { computed, useSlots } from 'vue'
5
+
6
+ interface Props {
7
+ title?: string
8
+ text?: string
9
+ image?: Image
10
+ cta?: Cta
11
+ }
12
+
13
+ const { text, cta } = defineProps<Props>()
14
+
15
+ const slots = useSlots()
16
+ const hasCta = computed(() => !!slots.cta || cta)
17
+ const hasText = computed(() => !!slots.text || text)
18
+ </script>
19
+
20
+ <template>
21
+ <div class="wizard-outro">
22
+ <div class="row wizard-outro__row">
23
+ <div class="wizard-outro__image-col">
24
+ <slot name="image">
25
+ <img v-if="image" :src="image.src" :alt="image.alt" />
26
+ </slot>
27
+ </div>
28
+ <div class="wizard-outro__content-col">
29
+ <h1 class="wizard-outro__title">
30
+ <slot name="title">{{ title }}</slot>
31
+ </h1>
32
+
33
+ <div v-if="hasText" class="wizard-outro__text">
34
+ <div class="richtext richtext--wizard">
35
+ <slot name="text"><div v-html="text"></div></slot>
36
+ </div>
37
+ </div>
38
+
39
+ <div v-if="hasCta" class="wizard-outro__cta">
40
+ <slot name="cta">
41
+ <UButton v-bind="cta" />
42
+ </slot>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </template>
48
+
49
+ <style scoped lang="scss" src="./wizard-outro.scss"></style>
@@ -0,0 +1,56 @@
1
+ @use '../../base/abstracts' as a;
2
+ @use '../../layout/grid/grid.mixin' as g;
3
+ @use '../../layout/grid/grid-row';
4
+
5
+ .wizard-outro {
6
+ .wizard-outro__row {
7
+ @include a.bp(lg) {
8
+ row-gap: var(--e-space-10);
9
+ }
10
+
11
+ @include a.bp(m) {
12
+ row-gap: var(--e-space-8);
13
+ }
14
+ }
15
+
16
+ .wizard-outro__image-col {
17
+ @include g.grid-col(4, 10);
18
+
19
+ @include a.bp(lg) {
20
+ @include g.grid-col(10, 10);
21
+ }
22
+
23
+ img {
24
+ display: block;
25
+ width: 100%;
26
+ }
27
+ }
28
+
29
+ .wizard-outro__content-col {
30
+ @include g.grid-col(6, 10);
31
+
32
+ @include a.bp(lg) {
33
+ @include g.grid-col(10, 10);
34
+ }
35
+ }
36
+
37
+ .wizard-outro__title {
38
+ @include a.type(1000, strong);
39
+
40
+ @include a.bp(m) {
41
+ @include a.type(800, strong);
42
+ }
43
+ }
44
+
45
+ .wizard-outro__text {
46
+ margin-top: var(--e-space-6);
47
+ }
48
+
49
+ .wizard-outro__cta {
50
+ margin-top: var(--e-space-16);
51
+
52
+ @include a.bp(lg) {
53
+ margin-top: var(--e-space-12);
54
+ }
55
+ }
56
+ }
@@ -1,12 +0,0 @@
1
- import { defineCustomElement } from 'vue'
2
- import Button from './u-button.vue'
3
- import customElementBaseStyle from '../../base/custom-element-base.scss?inline'
4
- import styles from './button.scss?inline'
5
-
6
- Button.styles = [customElementBaseStyle, styles]
7
-
8
- export const ButtonElement = {
9
- register: () => {
10
- customElements.define('u-button', defineCustomElement(Button))
11
- },
12
- }
@@ -1,35 +0,0 @@
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
- }
@@ -1,13 +0,0 @@
1
- import { defineCustomElement } from 'vue'
2
- import Icon from './u-icon.vue'
3
- import customElementBaseStyle from '../../base/custom-element-base.scss?inline'
4
- import ceStyles from './icon.ce.scss?inline'
5
- import styles from './icon.scss?inline'
6
-
7
- Icon.styles = [customElementBaseStyle, ceStyles, styles]
8
-
9
- export const IconElement = {
10
- register: () => {
11
- customElements.define('u-icon', defineCustomElement(Icon))
12
- },
13
- }
@@ -1,12 +0,0 @@
1
- import { defineCustomElement } from 'vue'
2
- import IconButton from './u-icon-button.vue'
3
- import customElementBaseStyle from '../../base/custom-element-base.scss?inline'
4
- import styles from './icon-button.scss?inline'
5
-
6
- IconButton.styles = [customElementBaseStyle, styles]
7
-
8
- export const IconButtonElement = {
9
- register: () => {
10
- customElements.define('u-icon-button', defineCustomElement(IconButton))
11
- },
12
- }
@@ -1,13 +0,0 @@
1
- import { defineCustomElement } from 'vue'
2
- import Loader from './u-loader.vue'
3
- import customElementBaseStyle from '../../base/custom-element-base.scss?inline'
4
- import ceStyles from './loader.ce.scss?inline'
5
- import styles from './loader.scss?inline'
6
-
7
- Loader.styles = [customElementBaseStyle, ceStyles, styles]
8
-
9
- export const LoaderElement = {
10
- register: () => {
11
- customElements.define('u-loader', defineCustomElement(Loader))
12
- },
13
- }
@@ -1 +0,0 @@
1
- export { default as UFeedback } from './u-feedback.vue'
@@ -1 +0,0 @@
1
- export { default as UInlineEditGroup } from './u-inline-edit-group.vue'