@energie360/ui-library 0.1.21 → 0.1.22

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.
@@ -4,83 +4,77 @@
4
4
  container: card-highlight / inline-size;
5
5
  height: 100%;
6
6
 
7
- @container card-highlight (width >= 900px) {
7
+ @container (width <= 650px) {
8
+ .card-highlight {
9
+ display: flex;
10
+ flex-direction: column;
11
+ }
12
+
8
13
  .card-highlight__image-col {
9
- padding-right: var(--e-space-20);
14
+ justify-content: center;
15
+ }
16
+
17
+ .card-highlight__chip {
18
+ // Forces child element (<UChip>) to be full-width.
19
+ display: grid;
20
+ width: 100%;
10
21
  }
11
22
  }
12
23
  }
13
24
 
14
25
  .card-highlight {
15
26
  position: relative;
16
- display: flex;
27
+ display: grid;
28
+ grid-template-columns: 1fr auto;
29
+ grid-template-rows: 1fr auto;
30
+ grid-column-gap: var(--e-space-4);
31
+ grid-row-gap: var(--e-space-4);
32
+ padding: var(--e-space-6);
17
33
  border: 1px solid var(--e-c-primary-01-100);
18
34
  border-radius: var(--e-brd-radius-2);
19
35
  background-color: var(--e-c-primary-01-50);
20
- padding: var(--e-space-6);
21
- gap: var(--e-space-4);
22
36
  height: 100%;
23
- justify-content: space-between;
37
+ }
24
38
 
25
- @include a.bp(m) {
26
- padding: var(--e-space-5);
27
- }
39
+ .card-highlight__title {
40
+ @include a.type(300, strong);
28
41
 
29
- @include a.bp(s) {
30
- padding: var(--e-space-4);
31
- }
42
+ grid-area: 1 / 1 / 2 / 2;
43
+ color: var(--e-c-secondary-01-950);
44
+ }
45
+
46
+ .card-highlight__image-col {
47
+ grid-area: 1 / 2 / 3 / 3;
48
+ display: flex;
49
+ align-items: center;
32
50
 
33
- @include a.bp(m) {
34
- flex-direction: column;
35
- align-items: flex-start;
51
+ img {
52
+ max-height: a.rem(225);
36
53
  }
37
54
  }
38
55
 
56
+ .card-highlight__content-col {
57
+ grid-area: 2 / 1 / 3 / 2;
58
+ }
59
+
39
60
  .card-highlight__content-col {
40
61
  display: flex;
41
62
  flex-direction: column;
42
63
  align-items: flex-start;
43
64
  row-gap: var(--e-space-4);
44
-
45
- @include a.bp(m) {
46
- width: calc(100% - 40px);
47
- }
48
- }
49
-
50
- .card-highlight__title {
51
- @include a.type(300, strong);
52
-
53
- color: var(--e-c-secondary-01-950);
54
65
  }
55
66
 
56
67
  .card-highlight__text {
57
68
  @include a.type(200);
58
69
 
59
- margin-top: auto;
60
70
  color: var(--e-c-secondary-01-900);
61
71
  }
62
72
 
63
- .card-highlight__image-col {
64
- flex: 1 1 auto;
65
- max-width: 60%;
66
- align-self: center;
67
- display: flex;
68
- justify-content: flex-end;
69
-
70
- img {
71
- max-height: a.rem(225);
72
- }
73
-
74
- @include a.bp(m) {
75
- max-width: none;
76
- }
77
- }
78
-
79
73
  .card-highlight__badge-icon {
80
74
  position: absolute;
81
75
  padding: 5px;
82
- top: var(--e-space-4);
83
- right: var(--e-space-4);
76
+ top: var(--e-space-5);
77
+ right: var(--e-space-5);
84
78
  background-color: var(--e-c-mono-00);
85
79
  color: var(--e-c-secondary-01-950);
86
80
  border-radius: 100%;
@@ -1,12 +1,15 @@
1
1
  <script setup lang="ts">
2
+ import { Chip } from '../chip/u-chip.vue'
2
3
  import { Image } from '../../elements/types'
3
4
  import { UIcon } from '../../elements'
5
+ import { UChip } from '../'
4
6
 
5
7
  interface Props {
6
8
  title?: string
7
9
  text?: string
8
10
  image?: Image
9
11
  badgeIcon?: string
12
+ chip?: Chip
10
13
  }
11
14
 
12
15
  defineProps<Props>()
@@ -15,22 +18,26 @@ defineProps<Props>()
15
18
  <template>
16
19
  <div class="card-highlight-container">
17
20
  <div class="card-highlight">
18
- <div class="card-highlight__content-col">
19
- <h3 v-if="$slots.title || title" class="card-highlight__title">
20
- <slot name="title">{{ title }}</slot>
21
- </h3>
21
+ <h3 v-if="$slots.title || title" class="card-highlight__title">
22
+ <slot name="title">{{ title }}</slot>
23
+ </h3>
24
+
25
+ <div v-if="$slots.image || image" class="card-highlight__image-col" aria-hidden="true">
26
+ <slot name="image">
27
+ <img v-bind="image" />
28
+ </slot>
29
+ </div>
22
30
 
31
+ <div class="card-highlight__content-col">
23
32
  <div v-if="$slots.text || text" class="card-highlight__text">
24
33
  <slot name="text">
25
34
  <div v-html="text"></div>
26
35
  </slot>
27
36
  </div>
28
- </div>
29
37
 
30
- <div v-if="$slots.image || image" class="card-highlight__image-col">
31
- <div>
32
- <slot name="image">
33
- <img v-bind="image" />
38
+ <div v-if="$slots.info || chip" class="card-highlight__chip">
39
+ <slot name="info">
40
+ <UChip v-bind="chip"></UChip>
34
41
  </slot>
35
42
  </div>
36
43
  </div>
@@ -4,8 +4,8 @@
4
4
  background-color: var(--e-c-mono-50);
5
5
  border: 1px solid var(--e-c-mono-200);
6
6
  border-radius: var(--e-brd-radius-2);
7
- padding: var(--e-space-1_5) var(--e-space-2);
8
- display: flex;
7
+ padding: var(--e-space-1_5) var(--e-space-3);
8
+ display: inline-flex;
9
9
  align-items: center;
10
10
  column-gap: var(--e-space-1);
11
11
  }
@@ -1,13 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  import { UIcon } from '../../elements'
3
3
 
4
- interface Props {
4
+ export interface Chip {
5
5
  caption?: string
6
6
  label?: string
7
7
  icon?: string
8
8
  }
9
9
 
10
- defineProps<Props>()
10
+ defineProps<Chip>()
11
11
  </script>
12
12
 
13
13
  <template>
@@ -6,9 +6,9 @@
6
6
  border-radius: var(--e-brd-radius-2);
7
7
  }
8
8
 
9
- .data-card__main {
10
- display: flex;
11
- column-gap: var(--e-space-2);
9
+ .data-card__aside-column {
10
+ float: right;
11
+ margin-left: var(--e-space-2);
12
12
  }
13
13
 
14
14
  .data-card__list {
@@ -15,6 +15,10 @@ defineProps<Props>()
15
15
  <template>
16
16
  <div class="data-card">
17
17
  <div class="data-card__main">
18
+ <div v-if="$slots.aside" class="data-card__aside-column">
19
+ <slot name="aside" />
20
+ </div>
21
+
18
22
  <dl class="data-card__list">
19
23
  <slot>
20
24
  <div v-for="(item, idx) in data" :key="idx">
@@ -23,10 +27,6 @@ defineProps<Props>()
23
27
  </div>
24
28
  </slot>
25
29
  </dl>
26
-
27
- <div v-if="$slots.aside" class="data-card__aside-column">
28
- <slot name="aside" />
29
- </div>
30
30
  </div>
31
31
 
32
32
  <div v-if="$slots.ctas" class="data-card__ctas">
@@ -1,4 +1,4 @@
1
- @use '../../base/abstracts/' as a;
1
+ @use '../../base/abstracts' as a;
2
2
 
3
3
  @keyframes fade-in-label {
4
4
  0% {
@@ -83,6 +83,10 @@
83
83
 
84
84
  @include a.type(200, strong);
85
85
 
86
+ @include a.bp(lg) {
87
+ width: 100%;
88
+ }
89
+
86
90
  > * {
87
91
  flex: 0 0 auto;
88
92
  }
@@ -154,6 +158,10 @@
154
158
  width: var(--label-width);
155
159
  text-overflow: ellipsis;
156
160
  overflow: hidden;
161
+
162
+ @include a.bp(lg) {
163
+ width: calc(100% - 24px - 8px);
164
+ }
157
165
  }
158
166
 
159
167
  // Animation
@@ -14,13 +14,21 @@ interface Props {
14
14
  }
15
15
 
16
16
  defineProps<Props>()
17
+
18
+ const isColorKeyword = (str) => Object.values(TableCellIconColor).includes(str)
17
19
  </script>
18
20
 
19
21
  <template>
20
22
  <div class="cell-icon-group">
21
23
  <template v-for="(item, idx) in icons" :key="idx">
22
24
  <UTooltip :title="item.title">
23
- <UIcon :name="item.icon" :class="[`icon-color-${item.color}`]"></UIcon>
25
+ <UIcon
26
+ :name="item.icon"
27
+ :class="{ [`icon-color-${item.color}`]: isColorKeyword(item.color) }"
28
+ :style="{
29
+ color: !isColorKeyword(item.color) ? item.color : false,
30
+ }"
31
+ ></UIcon>
24
32
  </UTooltip>
25
33
  </template>
26
34
  </div>
@@ -1,25 +1,36 @@
1
1
  <script setup lang="ts">
2
- // import { Image } from '../../elements/types'
2
+ import { Image } from '../../elements/types'
3
3
 
4
4
  interface Props {
5
5
  text?: string
6
- // image: Image
6
+ image?: Image
7
7
  }
8
8
  defineProps<Props>()
9
9
  </script>
10
10
 
11
11
  <template>
12
- <div class="welcome-container">
13
- <div class="welcome-content">
14
- <slot>
15
- <h2 v-if="text">{{ text }}</h2>
12
+ <div class="welcome">
13
+ <div class="welcome__content">
14
+ <h2>
15
+ <slot>{{ text }}</slot>
16
+ </h2>
17
+ </div>
18
+
19
+ <div v-if="$slots.image || image" class="welcome__image" aria-hidden="true">
20
+ <slot name="image">
21
+ <img :src="image.src" :alt="image.alt" />
16
22
  </slot>
17
23
  </div>
18
- <!-- TODO: Add image whenever is ready -->
19
- <!-- <div class="welcome-image">
20
- <img src="path/to/image.jpg" alt="Welcome Image" />
21
- </div> -->
22
24
  </div>
23
25
  </template>
24
26
 
25
27
  <style scoped lang="scss" src="./welcome.scss"></style>
28
+ <style scoped lang="scss">
29
+ .welcome__image {
30
+ :slotted(img) {
31
+ height: 100%;
32
+ width: 100%;
33
+ object-fit: cover;
34
+ }
35
+ }
36
+ </style>
@@ -1,25 +1,48 @@
1
- @use '../../base/abstracts/' as a;
1
+ @use '../../base/abstracts' as a;
2
2
 
3
- .welcome-container {
3
+ .welcome {
4
4
  @include a.type(500, strong);
5
5
 
6
- background-color: var(--e-c-primary-01-100);
7
- border-radius: var(--e-brd-radius-2);
8
- color: var(--e-c-primary-01-950);
6
+ position: relative;
7
+ height: a.rem(94);
9
8
  display: flex;
10
- justify-content: space-between;
11
- padding: var(--e-space-8) var(--e-space-6);
9
+ align-items: center;
10
+ padding: 0 var(--e-space-6);
11
+ background-color: var(--e-c-primary-01-50);
12
+ border: 1px solid var(--e-c-primary-01-100);
13
+ border-radius: var(--e-brd-radius-2);
14
+ color: var(--e-c-secondary-01-950);
15
+ overflow: hidden;
12
16
 
13
- @include a.bp(m) {
17
+ @include a.bp(lg) {
18
+ min-height: a.rem(86);
19
+ height: auto;
14
20
  padding: var(--e-space-3) var(--e-space-4);
15
21
  }
16
22
  }
17
23
 
18
- // .welcome-content {
24
+ .welcome__content {
25
+ max-width: calc(100% - #{a.rem(340)});
26
+
27
+ @include a.bp(lg) {
28
+ max-width: calc(100% - #{a.rem(80)});
29
+ }
30
+ }
19
31
 
20
- // }
32
+ .welcome__image {
33
+ position: absolute;
34
+ top: 0;
35
+ right: 0;
36
+ height: 100%;
37
+ aspect-ratio: 10/3;
21
38
 
22
- // TODO: Add styles for the welcome image whenever is ready
23
- // .welcome-image {
39
+ img {
40
+ height: 100%;
41
+ width: 100%;
42
+ object-fit: cover;
43
+ }
24
44
 
25
- // }
45
+ @include a.bp(lg) {
46
+ display: none;
47
+ }
48
+ }
@@ -6,16 +6,14 @@
6
6
  text-decoration: none;
7
7
  grid-gap: var(--e-space-1);
8
8
 
9
- .icon,
10
- e-icon {
9
+ .icon {
11
10
  --icon-fill-color: var(--e-c-primary-01-700);
12
11
  }
13
12
 
14
13
  &:hover {
15
14
  color: var(--e-c-secondary-01-900);
16
15
 
17
- .icon,
18
- e-icon {
16
+ .icon {
19
17
  --icon-fill-color: var(--e-c-secondary-01-900);
20
18
  }
21
19
  }
@@ -23,8 +21,7 @@
23
21
  &:active {
24
22
  color: var(--e-c-secondary-01-700);
25
23
 
26
- .icon,
27
- e-icon {
24
+ .icon {
28
25
  --icon-fill-color: var(--e-c-secondary-01-700);
29
26
  }
30
27
  }
@@ -34,15 +31,15 @@
34
31
  background: none;
35
32
  color: var(--e-c-mono-500);
36
33
 
37
- .icon,
38
- e-icon {
34
+ .icon {
39
35
  --icon-fill-color: var(--e-c-mono-500);
40
36
  }
41
37
  }
42
38
 
43
39
  &.loading {
44
- .loader,
45
- e-loader {
40
+ pointer-events: none;
41
+
42
+ .loader {
46
43
  --dot-color: var(--e-c-secondary-01-700);
47
44
  }
48
45
  }
@@ -93,6 +93,4 @@ const buttonTag = computed(() => (asSpan ? 'span' : 'button'))
93
93
  </template>
94
94
  </template>
95
95
 
96
- <style lang="scss" scoped>
97
- @use './button.scss';
98
- </style>
96
+ <style lang="scss" scoped src="./button.scss"></style>
@@ -29,16 +29,17 @@ const {
29
29
  const slots = useSlots()
30
30
  const model = defineModel<string>()
31
31
  const emits = defineEmits<{
32
- input: [value: string | null]
32
+ input: [value: string | null] // TODO: Could be obsolete because we get value via model.
33
33
  focus: [target: FocusEvent['target']]
34
34
  focusout: [target: FocusEvent['target']]
35
35
  }>()
36
36
 
37
+ // TODO: Do we need a ref to input? Value is currently written/read via model.
37
38
  const input = useTemplateRef('input')
38
39
 
39
40
  const isFocused = ref(false)
40
41
  const isHovering = ref(false)
41
- const hasValue = ref(false) // only needed for input type 'search'
42
+ const hasValue = ref(!!model.value)
42
43
  const forceFloatLabel = ref(type === TextFieldTypes.date) // input-type 'date' doesn't support placeholder.
43
44
 
44
45
  const spacer = '.&nbsp;'
@@ -60,7 +61,6 @@ const onBlur = () => {
60
61
  }
61
62
 
62
63
  const onInput = () => {
63
- hasValue.value = !!input.value && input.value.value !== ''
64
64
  emits('input', input.value?.value ?? null)
65
65
  }
66
66
 
@@ -111,6 +111,10 @@ watch(
111
111
  }
112
112
  },
113
113
  )
114
+
115
+ watch(model, () => {
116
+ hasValue.value = !!model.value
117
+ })
114
118
  </script>
115
119
 
116
120
  <template>
@@ -12,10 +12,12 @@ interface Props {
12
12
  contentImage?: Image
13
13
  closeBtnLabel?: string
14
14
  autoHeight?: boolean
15
+ modal?: boolean
15
16
  mobileDialogStyle?: 'modal' | 'slideout'
16
17
  }
17
18
 
18
19
  const {
20
+ modal = false,
19
21
  title = '',
20
22
  text = '',
21
23
  headerImage = undefined,
@@ -59,10 +61,12 @@ watch(visible, (newV) => {
59
61
  allowArrowLeftRight: true,
60
62
  })
61
63
 
62
- requestAnimationFrame(() => {
63
- window.addEventListener('keydown', onKeydown)
64
- document.addEventListener('click', onDocumentClick)
65
- })
64
+ if (!modal) {
65
+ requestAnimationFrame(() => {
66
+ window.addEventListener('keydown', onKeydown)
67
+ document.addEventListener('click', onDocumentClick)
68
+ })
69
+ }
66
70
  } else {
67
71
  focusTrapInstance.release()
68
72
 
package/modules/index.js CHANGED
@@ -5,8 +5,7 @@ export { default as UNavigationToolbarTop } from './navigation-toolbar-top/u-nav
5
5
  export { default as UNavigationToolbarSide } from './navigation-toolbar-side/u-navigation-toolbar-side.vue'
6
6
  export { default as UNavigationPanel } from './navigation-panel/u-navigation-panel.vue'
7
7
  export { default as UProgressIndicator } from './progress-indicator/u-progress-indicator.vue'
8
- export { default as UToast } from './toast/u-toast.vue'
9
- export { toast } from './toast/useToast.ts'
8
+ export { default as UToast, toast } from './toast/u-toast.vue'
10
9
  export { default as UDialog } from './dialog/u-dialog.vue'
11
10
  export { default as USearchFilter } from './search-filter/u-search-filter.vue'
12
11
  export { default as UContentTitle } from './content-title/u-content-title.vue'
@@ -61,5 +61,16 @@
61
61
  @include a.type(200, strong);
62
62
 
63
63
  margin-bottom: var(--e-space-4);
64
+ white-space: nowrap;
65
+ overflow: hidden;
66
+ width: 100%;
67
+ text-overflow: ellipsis;
68
+
69
+ // This is a bit experimental.
70
+ // Because we accept here an HTML string, which can contain <div> or <p>, we'll 'ignore' these tags.
71
+ // This way the text-overflow: ellipsis works as intended.
72
+ * {
73
+ display: contents;
74
+ }
64
75
  }
65
76
  }
@@ -1,3 +1,9 @@
1
+ <script lang="ts">
2
+ import { toast } from './useToast'
3
+
4
+ export { toast }
5
+ </script>
6
+
1
7
  <script setup lang="ts">
2
8
  import UToastMessage from './u-toast-message.vue'
3
9
  import { toasts } from './useToast'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energie360/ui-library",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",