@redseed/redseed-ui-vue3 1.0.5 → 1.0.7

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
@@ -1,9 +1,27 @@
1
+ // import ButtonPrimary from './src/components/Button/ButtonPrimary.vue'
2
+ // import ButtonPrimaryLight from './src/components/Button/ButtonPrimaryLight.vue'
3
+ // import ButtonPrimaryLightRounded from './src/components/Button/ButtonPrimaryLightRounded.vue'
4
+ // import ButtonPrimaryRounded from './src/components/Button/ButtonPrimaryRounded.vue'
5
+ // import ButtonSecondary from './src/components/Button/ButtonSecondary.vue'
6
+ // import ButtonSecondaryLight from './src/components/Button/ButtonSecondaryLight.vue'
7
+ // import ButtonSecondaryLightRounded from './src/components/Button/ButtonSecondaryLightRounded.vue'
8
+ // import ButtonSecondaryRounded from './src/components/Button/ButtonSecondaryRounded.vue'
9
+ // import ButtonSlot from './src/components/Button/ButtonSlot.vue'
1
10
  import Card from './src/components/Card/Card.vue'
2
11
  import Image from './src/components/Image/Image.vue'
3
12
  import MessageBox from './src/components/MessageBox/MessageBox.vue'
4
13
  import TwoColumnLayout from './src/components/TwoColumnLayout/TwoColumnLayout.vue'
5
14
 
6
15
  export {
16
+ // ButtonPrimary,
17
+ // ButtonPrimaryLight,
18
+ // ButtonPrimaryLightRounded,
19
+ // ButtonPrimaryRounded,
20
+ // ButtonSecondary,
21
+ // ButtonSecondaryLight,
22
+ // ButtonSecondaryLightRounded,
23
+ // ButtonSecondaryRounded,
24
+ // ButtonSlot,
7
25
  Card,
8
26
  Image,
9
27
  MessageBox,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,57 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import ButtonSlot from './ButtonSlot.vue'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+
9
+ const props = defineProps({
10
+ light: {
11
+ type: Boolean,
12
+ default: false,
13
+ },
14
+ })
15
+
16
+ const buttonPrimaryClass = computed(() => [
17
+ 'button-primary',
18
+ {
19
+ 'button-primary--light': props.light,
20
+ },
21
+ ])
22
+ </script>
23
+ <template>
24
+ <ButtonSlot
25
+ :class="buttonPrimaryClass"
26
+ v-bind="$attrs"
27
+ >
28
+ <template #icon v-if="$slots.icon">
29
+ <slot name="icon"></slot>
30
+ </template>
31
+ <template #label v-if="$slots.label">
32
+ <slot name="label"></slot>
33
+ </template>
34
+ </ButtonSlot>
35
+ </template>
36
+ <style lang="scss" scoped>
37
+ .button-primary {
38
+ // default colors
39
+ @apply bg-primary text-white ring-primary/20 border-primary;
40
+ // default hover state
41
+ @apply hover:bg-primary-dark;
42
+ // default active state
43
+ @apply active:ring-0 active:bg-primary;
44
+ // default disabled state
45
+ @apply disabled:bg-primary/20 disabled:border-transparent;
46
+ @apply disabled:active:ring-0 disabled:focus:ring-0;
47
+
48
+ &--light {
49
+ @apply bg-white text-primary;
50
+ @apply hover:bg-white hover:text-primary-dark;
51
+ @apply focus-visible:border-transparent;
52
+ @apply active:ring-0 active:text-primary;
53
+ @apply disabled:text-primary/30 disabled:border-primary/30 disabled:bg-white;
54
+ @apply disabled:active:ring-0 disabled:focus:ring-0;
55
+ }
56
+ }
57
+ </style>
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import ButtonPrimary from './ButtonPrimary.vue'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+ </script>
9
+ <template>
10
+ <ButtonPrimary
11
+ light
12
+ v-bind="$attrs"
13
+ >
14
+ <template #icon v-if="$slots.icon">
15
+ <slot name="icon"></slot>
16
+ </template>
17
+ <template #label v-if="$slots.label">
18
+ <slot name="label"></slot>
19
+ </template>
20
+ </ButtonPrimary>
21
+ </template>
22
+ <style lang="scss" scoped>
23
+ </style>
@@ -0,0 +1,24 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import ButtonPrimary from './ButtonPrimary.vue'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+ </script>
9
+ <template>
10
+ <ButtonPrimary
11
+ light
12
+ rounded
13
+ v-bind="$attrs"
14
+ >
15
+ <template #icon v-if="$slots.icon">
16
+ <slot name="icon"></slot>
17
+ </template>
18
+ <template #label v-if="$slots.label">
19
+ <slot name="label"></slot>
20
+ </template>
21
+ </ButtonPrimary>
22
+ </template>
23
+ <style lang="scss" scoped>
24
+ </style>
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import ButtonPrimary from './ButtonPrimary.vue'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+ </script>
9
+ <template>
10
+ <ButtonPrimary
11
+ rounded
12
+ v-bind="$attrs"
13
+ >
14
+ <template #icon v-if="$slots.icon">
15
+ <slot name="icon"></slot>
16
+ </template>
17
+ <template #label v-if="$slots.label">
18
+ <slot name="label"></slot>
19
+ </template>
20
+ </ButtonPrimary>
21
+ </template>
22
+ <style lang="scss" scoped>
23
+ </style>
@@ -0,0 +1,57 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import ButtonSlot from './ButtonSlot.vue'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+
9
+ const props = defineProps({
10
+ light: {
11
+ type: Boolean,
12
+ default: false,
13
+ },
14
+ })
15
+
16
+ const buttonSecondaryClass = computed(() => [
17
+ 'button-secondary',
18
+ {
19
+ 'button-secondary--light': props.light,
20
+ },
21
+ ])
22
+ </script>
23
+ <template>
24
+ <ButtonSlot
25
+ :class="buttonSecondaryClass"
26
+ v-bind="$attrs"
27
+ >
28
+ <template #icon v-if="$slots.icon">
29
+ <slot name="icon"></slot>
30
+ </template>
31
+ <template #label v-if="$slots.label">
32
+ <slot name="label"></slot>
33
+ </template>
34
+ </ButtonSlot>
35
+ </template>
36
+ <style lang="scss" scoped>
37
+ .button-secondary {
38
+ // default colors
39
+ @apply bg-secondary text-white ring-secondary/20 border-secondary;
40
+ // default hover state
41
+ @apply hover:bg-secondary-dark;
42
+ // default active state
43
+ @apply active:ring-0 active:bg-secondary;
44
+ // default disabled state
45
+ @apply disabled:bg-secondary/20 disabled:border-transparent;
46
+ @apply disabled:active:ring-0 disabled:focus:ring-0;
47
+
48
+ &--light {
49
+ @apply bg-white text-secondary;
50
+ @apply hover:bg-white hover:text-secondary-dark;
51
+ @apply focus-visible:border-transparent;
52
+ @apply active:ring-0 active:text-secondary;
53
+ @apply disabled:text-secondary/30 disabled:border-secondary/30 disabled:bg-white;
54
+ @apply disabled:active:ring-0 disabled:focus:ring-0;
55
+ }
56
+ }
57
+ </style>
@@ -0,0 +1,24 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import ButtonSecondary from './ButtonSecondary.vue'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+ </script>
9
+ <template>
10
+ <ButtonSecondary
11
+ light
12
+ rounded
13
+ v-bind="$attrs"
14
+ >
15
+ <template #icon v-if="$slots.icon">
16
+ <slot name="icon"></slot>
17
+ </template>
18
+ <template #label v-if="$slots.label">
19
+ <slot name="label"></slot>
20
+ </template>
21
+ </ButtonSecondary>
22
+ </template>
23
+ <style lang="scss" scoped>
24
+ </style>
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import ButtonSecondary from './ButtonSecondary.vue'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+ </script>
9
+ <template>
10
+ <ButtonSecondary
11
+ light
12
+ v-bind="$attrs"
13
+ >
14
+ <template #icon v-if="$slots.icon">
15
+ <slot name="icon"></slot>
16
+ </template>
17
+ <template #label v-if="$slots.label">
18
+ <slot name="label"></slot>
19
+ </template>
20
+ </ButtonSecondary>
21
+ </template>
22
+ <style lang="scss" scoped>
23
+ </style>
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import ButtonSecondary from './ButtonSecondary.vue'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+ </script>
9
+ <template>
10
+ <ButtonSecondary
11
+ rounded
12
+ v-bind="$attrs"
13
+ >
14
+ <template #icon v-if="$slots.icon">
15
+ <slot name="icon"></slot>
16
+ </template>
17
+ <template #label v-if="$slots.label">
18
+ <slot name="label"></slot>
19
+ </template>
20
+ </ButtonSecondary>
21
+ </template>
22
+ <style lang="scss" scoped>
23
+ </style>
@@ -0,0 +1,189 @@
1
+ <script setup>
2
+ import { computed, useSlots } from 'vue'
3
+
4
+ defineOptions({
5
+ inheritAttrs: false,
6
+ })
7
+
8
+ const slots = useSlots()
9
+
10
+ const props = defineProps({
11
+ xs: {
12
+ type: Boolean,
13
+ default: false,
14
+ },
15
+ sm: {
16
+ type: Boolean,
17
+ default: false,
18
+ },
19
+ md: {
20
+ type: Boolean,
21
+ default: false,
22
+ },
23
+ lg: {
24
+ type: Boolean,
25
+ default: false,
26
+ },
27
+ full: {
28
+ type: Boolean,
29
+ default: false,
30
+ },
31
+ rounded: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ light: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+ iconEnd: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
43
+ })
44
+
45
+ const defaultSize = computed(() => !props.xs && !props.sm && !props.md && !props.lg)
46
+
47
+ const buttonSlotClass = computed(() => [
48
+ 'button-slot',
49
+ {
50
+ // button sizes
51
+ 'button-slot--xs': props.xs,
52
+ 'button-slot--sm': props.sm,
53
+ 'button-slot--md': props.md || defaultSize.value,
54
+ 'button-slot--lg': props.lg,
55
+
56
+ // button sizes with icon
57
+ 'button-slot--xs--icon': props.xs && !slots.label && slots.icon,
58
+ 'button-slot--sm--icon': props.sm && !slots.label && slots.icon,
59
+ 'button-slot--md--icon': (props.md || defaultSize.value) && !slots.label && slots.icon,
60
+ 'button-slot--lg--icon': props.lg && !slots.label && slots.icon,
61
+
62
+ // button full width
63
+ 'button-slot--full': props.full,
64
+
65
+ // button fully rounded
66
+ 'button-slot--rounded': props.rounded,
67
+
68
+ // button light variant
69
+ 'button-slot--light': props.light,
70
+
71
+ // display icon at the end
72
+ 'button-slot--icon-end': props.iconEnd && slots.icon,
73
+ },
74
+ ])
75
+
76
+ const buttonSlotIconClass = computed(() => [
77
+ 'button-slot__icon',
78
+ {
79
+ // modifier for button icon to be displayed at the end
80
+ 'button-slot__icon--end': props.iconEnd && slots.icon,
81
+
82
+ // modifier for button icon to be displayed without label
83
+ 'button-slot__icon--only': !slots.label && slots.icon,
84
+ }
85
+ ])
86
+ </script>
87
+ <template>
88
+ <button
89
+ :class="buttonSlotClass"
90
+ type="button"
91
+ v-bind="$attrs"
92
+ >
93
+ <span v-if="$slots.icon"
94
+ :class="buttonSlotIconClass"
95
+ >
96
+ <slot name="icon"></slot>
97
+ </span>
98
+ <span v-if="$slots.label">
99
+ <slot name="label"></slot>
100
+ </span>
101
+ </button>
102
+ </template>
103
+ <style lang="scss" scoped>
104
+ .button-slot {
105
+ // default shape and control
106
+ @apply w-fit h-fit inline-flex items-center justify-center select-none outline-none rounded border transition;
107
+ // default colors
108
+ @apply bg-black/80 text-white ring-black/20 border-black/80;
109
+ // default hover state
110
+ @apply hover:bg-black;
111
+ // default focus state
112
+ @apply focus-visible:ring-4;
113
+ // default active state
114
+ @apply active:ring-0 active:bg-black/80;
115
+ // default disabled state
116
+ @apply disabled:bg-black/30 disabled:border-transparent;
117
+ @apply disabled:active:ring-0 disabled:focus-visible:ring-0;
118
+
119
+ // modifier light variant
120
+ &--light {
121
+ @apply bg-white text-black/80;
122
+ @apply hover:bg-white hover:text-black;
123
+ @apply focus-visible:border-transparent;
124
+ @apply active:ring-0 active:text-black/80;
125
+ @apply disabled:text-black/30 disabled:border-black/30 disabled:bg-white;
126
+ @apply disabled:active:ring-0 disabled:focus-visible:ring-0;
127
+ }
128
+ // modifier full width
129
+ &--full {
130
+ @apply w-full;
131
+ }
132
+ // modifier fully rounded
133
+ &--rounded {
134
+ @apply rounded-full;
135
+ }
136
+ // modifier xs size
137
+ &--xs {
138
+ @apply text-xs;
139
+ @apply px-2.5 py-1.5;
140
+ &--icon {
141
+ @apply px-1.5;
142
+ }
143
+ .button-slot__icon {
144
+ @apply w-3 h-3;
145
+ }
146
+ }
147
+ // modifier sm size
148
+ &--sm {
149
+ @apply text-sm;
150
+ @apply px-3 py-1.5;
151
+ &--icon {
152
+ @apply px-1.5;
153
+ }
154
+ }
155
+ // modifier md size
156
+ &--md {
157
+ @apply text-base;
158
+ @apply px-4 py-2;
159
+ &--icon {
160
+ @apply px-2;
161
+ }
162
+ }
163
+ // modifier lg size
164
+ &--lg {
165
+ @apply text-lg;
166
+ @apply px-4 py-2;
167
+ &--icon {
168
+ @apply px-2;
169
+ }
170
+ .button-slot__icon {
171
+ @apply w-5 h-5;
172
+ }
173
+ }
174
+ // modifier icon at the end
175
+ &--icon-end {
176
+ @apply flex-row-reverse;
177
+ }
178
+ // button icon
179
+ &__icon {
180
+ @apply block w-4 h-4 mr-2;
181
+ &--end {
182
+ @apply ml-2 mr-0;
183
+ }
184
+ &--only {
185
+ @apply mr-0 ml-0;
186
+ }
187
+ }
188
+ }
189
+ </style>