@redseed/redseed-ui-vue3 2.6.0 → 2.7.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/index.js CHANGED
@@ -3,6 +3,7 @@ export * from './src/components/BodyText'
3
3
  export * from './src/components/Button'
4
4
  export * from './src/components/ButtonGroup'
5
5
  export * from './src/components/Card'
6
+ export * from './src/components/CardGroup'
6
7
  export * from './src/components/DropdownMenu'
7
8
  export * from './src/components/Empty'
8
9
  export * from './src/components/Form'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "2.6.0",
3
+ "version": "2.7.1",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,11 +9,11 @@
9
9
  "keywords": [],
10
10
  "author": "",
11
11
  "license": "ISC",
12
- "devDependencies": {
12
+ "dependencies": {
13
13
  "@heroicons/vue": "^2.1.5",
14
14
  "@vueuse/components": "^10.11.0",
15
15
  "@vueuse/core": "^10.11.0",
16
16
  "lottie-web": "^5.12.2",
17
- "vue": "^3.4.34"
17
+ "vue": "^3.4.36"
18
18
  }
19
19
  }
@@ -0,0 +1,130 @@
1
+ <script setup>
2
+ import { ref, computed } from 'vue'
3
+ import { useElementSize } from '@vueuse/core'
4
+ import Empty from '../Empty/Empty.vue'
5
+ import Pagination from '../Pagination/Pagination.vue'
6
+
7
+
8
+ const props = defineProps({
9
+ controlApplied: {
10
+ type: Boolean,
11
+ default: false
12
+ },
13
+ totalItems: {
14
+ type: Number,
15
+ default: 0
16
+ },
17
+ perPage: {
18
+ type: Number,
19
+ default: 10
20
+ },
21
+ currentPage: {
22
+ type: Number,
23
+ default: 1
24
+ },
25
+ })
26
+
27
+ const cardGroupElement = ref(null);
28
+
29
+ const { width } = useElementSize(cardGroupElement);
30
+
31
+ const cardGroupClasses = computed(() => [
32
+ 'rsui-card-group',
33
+ {
34
+ 'rsui-card-group--2xs': width.value < 375,
35
+ 'rsui-card-group--xs': width.value >= 375 && width.value < 480,
36
+ 'rsui-card-group--sm': width.value >= 480 && width.value < 640,
37
+ 'rsui-card-group--md': width.value >= 640 && width.value < 768,
38
+ 'rsui-card-group--lg': width.value >= 768 && width.value < 1024,
39
+ 'rsui-card-group--xl': width.value >= 1024 && width.value < 1280,
40
+ 'rsui-card-group--2xl': width.value >= 1280 && width.value < 1536,
41
+ 'rsui-card-group--3xl': width.value >= 1536
42
+ }
43
+ ])
44
+
45
+ const pageUpdated = (event) => {
46
+ emit('pageUpdated', event)
47
+ }
48
+
49
+ const emit = defineEmits(['pageUpdated']);
50
+
51
+ const showEmptyMessage = computed(() => !props.totalItems && !props.controlApplied)
52
+
53
+ const showNotFoundMessage = computed(() => !props.totalItems && props.controlApplied)
54
+
55
+ </script>
56
+ <template>
57
+ <div ref="cardGroupElement" :class="cardGroupClasses">
58
+ <div class="rsui-card-group__pagination">
59
+ <Pagination v-if="totalItems > perPage" :totalItems="totalItems" :perPage="perPage" :currentPage="currentPage"
60
+ @change="pageUpdated"></Pagination>
61
+ </div>
62
+
63
+ <div v-if="totalItems" class="rsui-card-group__cards">
64
+
65
+
66
+ <slot></slot>
67
+
68
+ </div>
69
+
70
+ <div v-if="showEmptyMessage" class="rsui-card-group__empty">
71
+ <Empty @clickPrimaryAction="$emit('clickEmptyAction')">
72
+ <template #image>
73
+ <slot name="empty-image"></slot>
74
+ </template>
75
+ <template #title v-if="$slots['empty-title']">
76
+ <slot name="empty-title"></slot>
77
+ </template>
78
+ <template #primary-action-label v-if="$slots['empty-action-label']">
79
+ <slot name="empty-action-label"></slot>
80
+ </template>
81
+
82
+ <slot name="empty-description">It looks like there's nothing here yet.</slot>
83
+ </Empty>
84
+ </div>
85
+ <div v-if="showNotFoundMessage" class="rsui-card-group">
86
+ <Empty>
87
+ <slot name="filter-empty-description">No items meet your filter criteria.</slot>
88
+ </Empty>
89
+ </div>
90
+ </div>
91
+ </template>
92
+ <style scoped lang="scss">
93
+ .rsui-card-group {
94
+ &__cards {
95
+ @apply grid;
96
+ }
97
+
98
+ &--2xs,
99
+ &--xs {
100
+ .rsui-card-group__cards {
101
+ @apply gap-4 grid-cols-1;
102
+ }
103
+ }
104
+
105
+ &--sm,
106
+ &--md {
107
+ .rsui-card-group__cards {
108
+ @apply gap-4 grid-cols-2;
109
+ }
110
+ }
111
+
112
+ &--lg,
113
+ &--xl {
114
+ .rsui-card-group__cards {
115
+ @apply gap-4 grid-cols-3;
116
+ }
117
+ }
118
+
119
+ &--2xl,
120
+ &--3xl {
121
+ .rsui-card-group__cards {
122
+ @apply gap-4 grid-cols-5;
123
+ }
124
+ }
125
+ &__pagination {
126
+ @apply w-full flex items-center justify-center mb-4;
127
+
128
+ }
129
+ }
130
+ </style>
@@ -0,0 +1,5 @@
1
+ import CardGroup from './CardGroup.vue'
2
+
3
+ export {
4
+ CardGroup
5
+ }