@redseed/redseed-ui-vue3 2.10.0 → 2.10.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,87 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+
4
+ const props = defineProps({
5
+ sm: {
6
+ type: Boolean,
7
+ default: false,
8
+ },
9
+ md: {
10
+ type: Boolean,
11
+ default: false,
12
+ },
13
+ neutral: {
14
+ type: Boolean,
15
+ default: false,
16
+ },
17
+ info: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ success: {
22
+ type: Boolean,
23
+ default: false,
24
+ },
25
+ warning: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ danger: {
30
+ type: Boolean,
31
+ default: false,
32
+ },
33
+ })
34
+
35
+ const defaultSize = computed(() => !props.sm && !props.md)
36
+
37
+ const badgeClass = computed(() => [
38
+ 'rsui-badge',
39
+ {
40
+ 'rsui-badge--sm': props.sm || defaultSize.value,
41
+ 'rsui-badge--md': props.md,
42
+ 'rsui-badge--neutral': props.neutral,
43
+ 'rsui-badge--info': props.info,
44
+ 'rsui-badge--success': props.success,
45
+ 'rsui-badge--warning': props.warning,
46
+ 'rsui-badge--danger': props.danger,
47
+ },
48
+ ])
49
+
50
+ </script>
51
+ <template>
52
+ <div :class="badgeClass">
53
+ <slot></slot>
54
+ </div>
55
+ </template>
56
+ <style lang="scss" scoped>
57
+ .rsui-badge {
58
+ @apply inline-flex items-center justify-center gap-x-1;
59
+ @apply w-fit h-fit rounded-full;
60
+ @apply text-xs font-semibold leading-3;
61
+ &--sm {
62
+ @apply px-2 py-1;
63
+ }
64
+ &--md {
65
+ @apply px-2 py-2;
66
+ }
67
+ &--neutral {
68
+ @apply text-rsui-default bg-rsui-grey-200;
69
+ }
70
+ &--info {
71
+ @apply text-info-content bg-info;
72
+ }
73
+ &--success {
74
+ @apply text-success-content bg-success;
75
+ }
76
+ &--warning {
77
+ @apply text-warning-content bg-warning;
78
+ }
79
+ &--danger {
80
+ @apply text-danger-content bg-danger;
81
+ }
82
+
83
+ :deep(svg) {
84
+ @apply size-3;
85
+ }
86
+ }
87
+ </style>
@@ -0,0 +1,10 @@
1
+ <script setup>
2
+ import Badge from './Badge.vue'
3
+ </script>
4
+ <template>
5
+ <Badge danger>
6
+ <slot></slot>
7
+ </Badge>
8
+ </template>
9
+ <style lang="scss" scoped>
10
+ </style>
@@ -0,0 +1,10 @@
1
+ <script setup>
2
+ import Badge from './Badge.vue'
3
+ </script>
4
+ <template>
5
+ <Badge info>
6
+ <slot></slot>
7
+ </Badge>
8
+ </template>
9
+ <style lang="scss" scoped>
10
+ </style>
@@ -0,0 +1,10 @@
1
+ <script setup>
2
+ import Badge from './Badge.vue'
3
+ </script>
4
+ <template>
5
+ <Badge neutral>
6
+ <slot></slot>
7
+ </Badge>
8
+ </template>
9
+ <style lang="scss" scoped>
10
+ </style>
@@ -1,13 +1,10 @@
1
1
  <script setup>
2
- import BadgeSlot from './BadgeSlot.vue'
2
+ import Badge from './Badge.vue'
3
3
  </script>
4
4
  <template>
5
- <BadgeSlot class="rsui-badge-success">
5
+ <Badge success>
6
6
  <slot></slot>
7
- </BadgeSlot>
7
+ </Badge>
8
8
  </template>
9
9
  <style lang="scss" scoped>
10
- .rsui-badge-success {
11
- @apply text-white bg-success;
12
- }
13
10
  </style>
@@ -0,0 +1,10 @@
1
+ <script setup>
2
+ import Badge from './Badge.vue'
3
+ </script>
4
+ <template>
5
+ <Badge warning>
6
+ <slot></slot>
7
+ </Badge>
8
+ </template>
9
+ <style lang="scss" scoped>
10
+ </style>
@@ -1,7 +1,15 @@
1
- import BadgeSlot from './BadgeSlot.vue'
1
+ import Badge from './Badge.vue'
2
+ import BadgeDanger from './BadgeDanger.vue'
3
+ import BadgeInfo from './BadgeInfo.vue'
4
+ import BadgeNeutral from './BadgeNeutral.vue'
2
5
  import BadgeSuccess from './BadgeSuccess.vue'
6
+ import BadgeWarning from './BadgeWarning.vue'
3
7
 
4
8
  export {
5
- BadgeSlot,
9
+ Badge,
10
+ BadgeDanger,
11
+ BadgeInfo,
12
+ BadgeNeutral,
6
13
  BadgeSuccess,
14
+ BadgeWarning,
7
15
  }
@@ -35,7 +35,10 @@ function check(event) {
35
35
  >
36
36
  </div>
37
37
  <div v-if="$slots.label"
38
- class="rsui-form-field-checkbox__label"
38
+ :class="[
39
+ 'rsui-form-field-checkbox__label',
40
+ { 'rsui-form-field-checkbox__label--required': $attrs.required !== undefined },
41
+ ]"
39
42
  >
40
43
  <slot name="label"></slot>
41
44
  </div>
@@ -53,6 +56,9 @@ function check(event) {
53
56
  }
54
57
  &__label {
55
58
  @apply ml-2 font-normal;
59
+ &--required {
60
+ @apply after:content-['*'] after:text-danger;
61
+ }
56
62
  }
57
63
  &__check {
58
64
  @apply size-6 shrink-0 relative bg-white rounded-md cursor-pointer;
@@ -69,5 +75,9 @@ function check(event) {
69
75
  @apply size-full relative z-1;
70
76
  }
71
77
  }
78
+
79
+ :deep(.rsui-form-field-slot__label) {
80
+ @apply after:hidden;
81
+ }
72
82
  }
73
83
  </style>
@@ -42,8 +42,9 @@ function choose(option) {
42
42
  <template>
43
43
  <FormFieldSlot
44
44
  ref="formFieldSelectElement"
45
- class="rsui-form-field-select"
46
45
  :id="$attrs.id"
46
+ :class="[$attrs.class, 'rsui-form-field-select']"
47
+ :required="$attrs.required"
47
48
  :compact="$attrs.compact"
48
49
  >
49
50
  <template #label v-if="$slots.label">
@@ -21,11 +21,18 @@ const formFieldSlotClass = computed(() => [
21
21
  'rsui-form-field-slot--compact': props.compact,
22
22
  },
23
23
  ])
24
+
25
+ const formFieldSlotLabelClass = computed(() => [
26
+ 'rsui-form-field-slot__label',
27
+ {
28
+ 'rsui-form-field-slot__label--required': attrs.required !== undefined,
29
+ },
30
+ ])
24
31
  </script>
25
32
  <template>
26
33
  <div :class="formFieldSlotClass">
27
34
  <div v-if="$slots.label"
28
- class="rsui-form-field-slot__label"
35
+ :class="formFieldSlotLabelClass"
29
36
  >
30
37
  <label
31
38
  :for="$attrs.id"
@@ -57,12 +64,15 @@ const formFieldSlotClass = computed(() => [
57
64
  @apply flex-row justify-between gap-x-2;
58
65
  .rsui-form-field-slot {
59
66
  &__label {
60
- @apply pt-3 truncate;
67
+ @apply pt-3 whitespace-nowrap;
61
68
  }
62
69
  }
63
70
  }
64
71
 
65
72
  &__label {
73
+ &--required {
74
+ @apply after:content-['*'] after:text-danger after:ml-1;
75
+ }
66
76
  label {
67
77
  @apply font-semibold text-base text-rsui-default;
68
78
  }
@@ -16,6 +16,7 @@ const inputElement = ref(null)
16
16
  <FormFieldSlot
17
17
  :id="$attrs.id"
18
18
  :class="[$attrs.class, 'rsui-form-field-text']"
19
+ :required="$attrs.required"
19
20
  :compact="$attrs.compact"
20
21
  >
21
22
  <template #label v-if="$slots.label">
@@ -1,51 +0,0 @@
1
- <script setup>
2
- import { computed } from 'vue'
3
-
4
- const props = defineProps({
5
- sm: {
6
- type: Boolean,
7
- default: false,
8
- },
9
- md: {
10
- type: Boolean,
11
- default: false,
12
- },
13
- })
14
-
15
- const defaultSize = computed(() => !props.sm && !props.md)
16
-
17
- const badgeClass = computed(() => [
18
- 'rsui-badge',
19
- {
20
- 'rsui-badge--sm': props.sm || defaultSize.value,
21
- 'rsui-badge--md': props.md,
22
- },
23
- ])
24
-
25
- </script>
26
- <template>
27
- <div :class="badgeClass">
28
- <slot></slot>
29
- </div>
30
- </template>
31
- <style lang="scss" scoped>
32
- .rsui-badge {
33
- @apply inline-flex items-center justify-center gap-x-1;
34
- @apply w-fit h-fit rounded-full;
35
- @apply text-xs font-semibold leading-3;
36
- @apply text-white bg-black;
37
- &--sm {
38
- @apply px-2 py-1;
39
- }
40
- &--md {
41
- @apply px-2 py-2;
42
- }
43
- }
44
- </style>
45
- <style lang="scss">
46
- .rsui-badge {
47
- svg {
48
- @apply w-3 h-3;
49
- }
50
- }
51
- </style>