@energie360/ui-library 0.1.17 → 0.1.18

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 (85) hide show
  1. package/components/badge/badge.scss +56 -0
  2. package/components/badge/u-badge.vue +47 -0
  3. package/components/card-contact/card-contact.scss +39 -0
  4. package/components/card-contact/u-card-contact.vue +44 -0
  5. package/components/card-cta-bar/card-cta-bar.scss +4 -0
  6. package/components/card-cta-bar/u-card-cta-bar.vue +24 -0
  7. package/components/card-cta-header/u-card-cta-header.vue +10 -7
  8. package/components/card-footer/u-card-footer.vue +5 -3
  9. package/components/card-group/u-card-group.vue +1 -1
  10. package/components/card-header/card-header.scss +29 -4
  11. package/components/card-header/u-card-header.vue +22 -3
  12. package/components/card-highlight/card-highlight.scss +70 -0
  13. package/components/card-highlight/u-card-highlight.vue +41 -0
  14. package/components/card-price-list/card-price-list.scss +39 -0
  15. package/components/card-price-list/u-card-price-list.vue +37 -0
  16. package/components/card-section/card-section.scss +21 -1
  17. package/components/card-section/u-card-section.vue +9 -1
  18. package/components/data-card/data-card.scss +34 -0
  19. package/components/data-card/u-data-card.vue +49 -0
  20. package/components/data-card-group/data-card-group.scss +12 -0
  21. package/components/data-card-group/u-data-card-group.vue +7 -0
  22. package/components/download-list/download-list.scss +58 -0
  23. package/components/download-list/u-download-list.vue +44 -0
  24. package/components/download-list-item/download-list-item.scss +267 -0
  25. package/components/download-list-item/u-download-list-item.vue +65 -0
  26. package/components/file-upload/file-list.scss +68 -0
  27. package/components/file-upload/file-upload.scss +119 -0
  28. package/components/file-upload/u-file-list.vue +55 -0
  29. package/components/file-upload/u-file-upload.vue +220 -0
  30. package/components/hint/hint.scss +67 -6
  31. package/components/hint/u-hint.vue +11 -1
  32. package/components/index.js +12 -0
  33. package/components/progress-avatar/u-progress-avatar.vue +27 -3
  34. package/components/search-group/search-group.scss +59 -0
  35. package/components/search-group/u-search-group.vue +32 -0
  36. package/components/skeleton-loader/skeleton-loader.scss +39 -0
  37. package/components/skeleton-loader/u-skeleton-loader.vue +28 -0
  38. package/components/table/cell-ctas.scss +1 -7
  39. package/components/table/cell-icon-text.scss +15 -4
  40. package/components/table/table-cell.mixins.scss +3 -2
  41. package/components/table/table-cell.scss +5 -0
  42. package/components/table/table-heading.scss +7 -0
  43. package/components/table/u-cell-ctas.vue +15 -6
  44. package/components/table/u-cell-icon-text.vue +13 -5
  45. package/components/table/u-table-cell.vue +3 -1
  46. package/components/table/u-table-heading.vue +2 -1
  47. package/components/tabs/tabs.scss +10 -1
  48. package/components/tabs/u-tabs.vue +64 -25
  49. package/dist/layout/split.css.map +1 -1
  50. package/elements/button/_button-plain-small-spaceless.scss +10 -0
  51. package/elements/button/button.scss +32 -0
  52. package/elements/button/u-button.vue +47 -4
  53. package/elements/form-field/form-field-base.scss +4 -0
  54. package/elements/select/u-select.vue +6 -6
  55. package/elements/text-field/text-field.scss +15 -0
  56. package/elements/text-field/text-field.types.ts +1 -0
  57. package/elements/text-field/u-text-field.vue +27 -6
  58. package/elements/toggle-switch/toggle-switch-small.scss +10 -0
  59. package/elements/toggle-switch/toggle-switch.scss +25 -21
  60. package/elements/toggle-switch/u-toggle-switch.vue +22 -12
  61. package/i18n/i18n.ts +32 -0
  62. package/layout/container/container.scss +18 -0
  63. package/layout/index.js +2 -0
  64. package/layout/portal/portal.scss +35 -7
  65. package/layout/portal/u-portal.vue +33 -4
  66. package/layout/settings/settings.scss +2 -2
  67. package/layout/tile-grid/tile-grid.scss +13 -0
  68. package/layout/tile-grid/tile-item.scss +31 -0
  69. package/layout/tile-grid/u-tile-grid.vue +7 -0
  70. package/layout/tile-grid/u-tile-item.vue +15 -0
  71. package/modules/content-title/content-title.scss +43 -0
  72. package/modules/content-title/u-content-title.vue +19 -0
  73. package/modules/dialog/dialog.scss +7 -3
  74. package/modules/dialog/u-dialog.vue +6 -1
  75. package/modules/footer/footer.scss +8 -1
  76. package/modules/footer/u-footer.vue +1 -1
  77. package/modules/index.js +2 -0
  78. package/modules/search-filter/search-filter.scss +106 -0
  79. package/modules/search-filter/u-search-filter.vue +54 -0
  80. package/package.json +2 -1
  81. package/utils/array/intersect.js +7 -0
  82. package/utils/functions/breakpoint.js +4 -9
  83. package/utils/functions/format-bytes.js +17 -0
  84. package/utils/global/mime-types.js +8 -0
  85. package/utils/translations/translate.js +10 -2
@@ -0,0 +1,106 @@
1
+ @use '../../base/abstracts' as a;
2
+
3
+ @mixin collapsed-desktop {
4
+ grid-template-columns: 100%;
5
+
6
+ .search-filter__search {
7
+ display: flex;
8
+ column-gap: var(--e-space-4);
9
+ flex-direction: row-reverse;
10
+ grid-area: auto;
11
+ }
12
+
13
+ .search-filter__filter-toggle {
14
+ display: block;
15
+ }
16
+
17
+ .search-filter__filter {
18
+ display: none;
19
+ grid-area: auto;
20
+ }
21
+
22
+ &.show-filters {
23
+ .search-filter__filter {
24
+ display: grid;
25
+ grid-template-columns: repeat(calc(var(--field-count) - 1), 1fr);
26
+ }
27
+ }
28
+ }
29
+
30
+ @mixin mobile-filters {
31
+ @include a.bp(m) {
32
+ grid-template-columns: 100%;
33
+
34
+ .search-filter__search {
35
+ display: grid;
36
+ column-gap: var(--e-space-4);
37
+ grid-template-columns: auto min-content;
38
+ grid-area: auto;
39
+ }
40
+
41
+ .search-filter__filter {
42
+ display: none;
43
+ grid-area: auto;
44
+ grid-template-columns: 1fr;
45
+ }
46
+
47
+ .search-filter__filter-toggle {
48
+ flex: 0 0 auto;
49
+ display: block;
50
+ }
51
+
52
+ &.show-filters {
53
+ .search-filter__filter {
54
+ display: grid;
55
+ grid-template-columns: 1fr;
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+ .search-filter {
62
+ --field-count: 1;
63
+
64
+ display: grid;
65
+ grid-template-columns: repeat(var(--field-count), minmax(0, 240px));
66
+ gap: var(--e-space-6) var(--e-space-4);
67
+
68
+ @include a.bp(xl) {
69
+ grid-template-columns: repeat(var(--field-count), 1fr);
70
+ }
71
+
72
+ .search-filter__search {
73
+ grid-area: 1 / var(--field-count) / 1 / calc(var(--field-count) + 1);
74
+ }
75
+
76
+ .search-filter__filter {
77
+ display: grid;
78
+ grid-template-columns: repeat(calc(var(--field-count) - 1), minmax(0, #{a.rem(240)}));
79
+ gap: var(--e-space-6) var(--e-space-4);
80
+ grid-area: 1 / 1 / 1 / var(--field-count);
81
+
82
+ @include a.bp(xl) {
83
+ grid-template-columns: repeat(calc(var(--field-count) - 1), 1fr);
84
+ }
85
+ }
86
+
87
+ .search-filter__filter-toggle {
88
+ display: none;
89
+ }
90
+
91
+ &.show-filters {
92
+ .search-filter__filter-toggle .icon-button {
93
+ &::before {
94
+ background-color: var(--e-c-primary-01-100);
95
+ border-color: var(--e-c-primary-01-100);
96
+ }
97
+ }
98
+ }
99
+
100
+ @include mobile-filters;
101
+ }
102
+
103
+ .search-filter.collapsed-desktop {
104
+ @include collapsed-desktop;
105
+ @include mobile-filters;
106
+ }
@@ -0,0 +1,54 @@
1
+ <script setup lang="ts">
2
+ import { ref, useTemplateRef, onMounted } from 'vue'
3
+ import { UIconButton } from '../../elements'
4
+ import { UBadge } from '../../components'
5
+
6
+ interface Props {
7
+ activeFilter?: boolean
8
+ }
9
+
10
+ defineProps<Props>()
11
+
12
+ const showFilters = ref(false)
13
+ const filtersEl = useTemplateRef('filters')
14
+ const filterCount = ref(0)
15
+
16
+ onMounted(() => {
17
+ filterCount.value = filtersEl.value.children.length
18
+ })
19
+ </script>
20
+
21
+ <template>
22
+ <div
23
+ :class="[
24
+ 'search-filter',
25
+ { 'show-filters': showFilters, 'collapsed-desktop': filterCount + 1 >= 4 },
26
+ ]"
27
+ :style="{
28
+ '--field-count': filterCount + 1,
29
+ }"
30
+ >
31
+ <div class="search-filter__search">
32
+ <slot name="search" />
33
+
34
+ <div class="search-filter__filter-toggle">
35
+ <UBadge
36
+ dot
37
+ border
38
+ :show="activeFilter && !showFilters"
39
+ color="var(--e-c-secondary-05-500)"
40
+ :top="11"
41
+ :right="11"
42
+ >
43
+ <UIconButton icon="filter" variant="plain" @click="showFilters = !showFilters" />
44
+ </UBadge>
45
+ </div>
46
+ </div>
47
+
48
+ <div ref="filters" class="search-filter__filter">
49
+ <slot name="filters" />
50
+ </div>
51
+ </div>
52
+ </template>
53
+
54
+ <style scoped lang="scss" src="./search-filter.scss"></style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energie360/ui-library",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,6 +15,7 @@
15
15
  "./wizard": "./wizard/index.js",
16
16
  "./utility/elements/*": "./dist/elements/*",
17
17
  "./utility/layout/*": "./dist/layout/*",
18
+ "./utils/*": "./utils/*",
18
19
  "./base/abstracts": "./base/abstracts/index.scss",
19
20
  "./styles/form": "./elements/form/form.scss",
20
21
  "./styles/form-grid": "./layout/form-grid/form-grid.scss"
@@ -0,0 +1,7 @@
1
+ /**
2
+ *
3
+ * @param {Array} a
4
+ * @param {Array} b
5
+ * @returns {Array}
6
+ */
7
+ export const intersect = (a, b) => a.filter((x) => b.includes(x))
@@ -1,11 +1,6 @@
1
1
  import { mediaquery } from '@energie360/design-tokens/design-tokens.json'
2
2
 
3
- // TODO: return .matches value
4
-
5
- export const isSmall = () => window.matchMedia(`(max-width: ${mediaquery.breakpoint.s})`)
6
-
7
- export const isMedium = () => window.matchMedia(`(max-width: ${mediaquery.breakpoint.m})`)
8
-
9
- export const isLarge = () => window.matchMedia(`(max-width: ${mediaquery.breakpoint.lg})`)
10
-
11
- export const isXLarge = () => window.matchMedia(`(max-width: ${mediaquery.breakpoint.xl})`)
3
+ export const isSmall = () => window.matchMedia(`(max-width: ${mediaquery.breakpoint.s})`).matches
4
+ export const isMedium = () => window.matchMedia(`(max-width: ${mediaquery.breakpoint.m})`).matches
5
+ export const isLarge = () => window.matchMedia(`(max-width: ${mediaquery.breakpoint.lg})`).matches
6
+ export const isXLarge = () => window.matchMedia(`(max-width: ${mediaquery.breakpoint.xl})`).matches
@@ -0,0 +1,17 @@
1
+ /**
2
+ *
3
+ * @param {number} bytes
4
+ * @param decimals
5
+ * @returns {string}
6
+ */
7
+ export const formatBytes = (bytes, decimals = 2) => {
8
+ if (!+bytes) return '0 Bytes'
9
+
10
+ const k = 1024
11
+ const dm = decimals < 0 ? 0 : decimals
12
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
13
+
14
+ const i = Math.floor(Math.log(bytes) / Math.log(k))
15
+
16
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`
17
+ }
@@ -0,0 +1,8 @@
1
+ // TODO: Add more possible types.
2
+ export const mimeTypes = {
3
+ 'image/png': ['png'],
4
+ 'application/pdf': ['pdf'],
5
+ 'image/jpeg': ['jpeg', 'jpg'],
6
+ 'image/svg+xml': ['svg'],
7
+ 'image/gif': ['gif'],
8
+ }
@@ -8,6 +8,14 @@ const getLanguage = () => {
8
8
  return langAttr === '' ? DEFAULT_LANGUAGE : langAttr
9
9
  }
10
10
 
11
- export const getTranslation = (key) => {
12
- return translations[getLanguage()][key]
11
+ export const getTranslation = (key, replace) => {
12
+ let translation = translations[getLanguage()][key]
13
+
14
+ if (replace) {
15
+ for (key in replace) {
16
+ translation = translation.replace(key, replace[key])
17
+ }
18
+ }
19
+
20
+ return translation
13
21
  }