@redseed/redseed-ui-vue3 2.5.1 → 2.7.0

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.5.1",
3
+ "version": "2.7.0",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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
+ }
@@ -0,0 +1,30 @@
1
+ <script setup>
2
+ defineOptions({
3
+ inheritAttrs: false,
4
+ })
5
+ </script>
6
+ <template>
7
+ <div class="rsui-fieldset">
8
+ <fieldset v-bind="$attrs">
9
+ <legend>
10
+ <slot name="legend"></slot>
11
+ </legend>
12
+ <div class="rsui-fieldset__fields">
13
+ <slot></slot>
14
+ </div>
15
+ </fieldset>
16
+ </div>
17
+ </template>
18
+ <style lang="scss" scoped>
19
+ .rsui-fieldset {
20
+ fieldset {
21
+ }
22
+ legend {
23
+ @apply text-base text-rsui-default font-semibold;
24
+ }
25
+ &__fields {
26
+ @apply mt-3 px-2;
27
+ @apply flex flex-col gap-3;
28
+ }
29
+ }
30
+ </style>
@@ -1,3 +1,4 @@
1
+ import FormFieldset from './FormFieldset.vue'
1
2
  import FormFieldsLogin from './FormFieldsLogin.vue'
2
3
  import FormFieldsRegister from './FormFieldsRegister.vue'
3
4
  import FormSlot from './FormSlot.vue'
@@ -5,6 +6,7 @@ import FormWrapperBuild from './FormWrapperBuild.vue'
5
6
  import FormWrapperLMS from './FormWrapperLMS.vue'
6
7
 
7
8
  export {
9
+ FormFieldset,
8
10
  FormFieldsLogin,
9
11
  FormFieldsRegister,
10
12
  FormSlot,
@@ -52,18 +52,18 @@ function check(event) {
52
52
  @apply flex;
53
53
  }
54
54
  &__label {
55
- @apply ml-2;
55
+ @apply ml-2 font-normal;
56
56
  }
57
57
  &__check {
58
- @apply size-6 shrink-0 relative bg-white rounded-md;
59
- @apply has-[:disabled]:text-rsui-light;
58
+ @apply size-6 shrink-0 relative bg-white rounded-md cursor-pointer;
59
+ @apply has-[:disabled]:text-rsui-light has-[:disabled]:cursor-default;
60
60
 
61
61
  input[type="checkbox"] {
62
- @apply appearance-none absolute inset-0 z-0 rounded-md transition focus:outline-none;
62
+ @apply appearance-none absolute inset-0 z-0 rounded-md transition focus:outline-none cursor-pointer;
63
63
  @apply w-full h-full text-rsui-default border border-rsui-grey-200 text-transparent bg-none;
64
64
  @apply focus:ring focus:ring-highlight focus:border-highlight;
65
65
  @apply invalid:border-danger invalid:ring-0;
66
- @apply disabled:text-rsui-light disabled:bg-rsui-grey-200;
66
+ @apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:cursor-default;
67
67
  }
68
68
  svg {
69
69
  @apply size-full relative z-1;
@@ -158,7 +158,7 @@ function choose(option) {
158
158
 
159
159
  select {
160
160
  @apply pl-5 pr-14 truncate;
161
- @apply appearance-none rounded-full cursor-pointer;
161
+ @apply appearance-none rounded-full;
162
162
  @apply focus:ring focus:ring-highlight focus:border-highlight;
163
163
  option {
164
164
  @apply hidden;
@@ -33,7 +33,9 @@ const formFieldSlotClass = computed(() => [
33
33
  <slot name="label"></slot>
34
34
  </label>
35
35
  </div>
36
- <div class="rsui-form-field-slot__field">
36
+ <div v-if="$slots.default || $slots.help || $slots.error"
37
+ class="rsui-form-field-slot__field"
38
+ >
37
39
  <slot></slot>
38
40
  <div v-if="$slots.help"
39
41
  class="rsui-form-field-slot__help"
@@ -62,7 +64,7 @@ const formFieldSlotClass = computed(() => [
62
64
 
63
65
  &__label {
64
66
  label {
65
- @apply font-medium text-base text-rsui-default;
67
+ @apply font-semibold text-base text-rsui-default;
66
68
  }
67
69
  }
68
70
 
@@ -91,11 +93,11 @@ const formFieldSlotClass = computed(() => [
91
93
  @apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0;
92
94
  }
93
95
  select {
94
- @apply block w-full border ring-0 bg-none;
96
+ @apply block w-full border ring-0 bg-none cursor-pointer;
95
97
  @apply text-base text-rsui-default transition py-3 px-4 rounded-md outline-none focus:outline-none;
96
98
  @apply bg-white placeholder-rsui-light border-rsui-grey-200;
97
99
  @apply invalid:border-danger invalid:ring-0;
98
- @apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0;
100
+ @apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0 disabled:cursor-default;
99
101
  }
100
102
  }
101
103
  </style>