@redseed/redseed-ui-vue3 2.12.1 → 2.13.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
@@ -1,5 +1,6 @@
1
1
  export * from './src/components/Badge'
2
2
  export * from './src/components/BodyText'
3
+ export * from './src/components/Breadcrumbs'
3
4
  export * from './src/components/Button'
4
5
  export * from './src/components/ButtonGroup'
5
6
  export * from './src/components/Card'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "2.12.1",
3
+ "version": "2.13.0",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,49 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ items: {
4
+ type: Array,
5
+ required: true,
6
+ validator(value) {
7
+ // item object structure
8
+ // { label: string, action: function|undefined }
9
+ return value.every(item => {
10
+ return typeof item.label === 'string'
11
+ && (typeof item.action === 'function' || item.action === undefined)
12
+ })
13
+ }
14
+ }
15
+ })
16
+
17
+ function clickItem(item) {
18
+ if (typeof item.action === 'function') item.action()
19
+ }
20
+ </script>
21
+ <template>
22
+ <div class="rsui-breadcrumbs">
23
+ <div v-for="(item, index) in items"
24
+ :key="index"
25
+ :class="[
26
+ 'rsui-breadcrumbs__item',
27
+ { 'rsui-breadcrumbs__item--action': typeof item.action === 'function' }
28
+ ]"
29
+ >
30
+ <span @click="clickItem(item)">
31
+ {{ item.label }}
32
+ </span>
33
+ </div>
34
+ </div>
35
+ </template>
36
+ <style lang="scss" scoped>
37
+ .rsui-breadcrumbs {
38
+ @apply flex flex-wrap items-center gap-x-2 gap-y-2;
39
+ &__item {
40
+ @apply relative select-none pr-4 last:pr-0 last:after:hidden;
41
+ @apply font-semibold text-sm text-rsui-default leading-6;
42
+ @apply after:absolute after:right-0.5 after:content-['\007C'];
43
+ @apply after:after:w-0.5 after:h-full after:text-rsui-light;
44
+ &--action {
45
+ @apply cursor-pointer;
46
+ }
47
+ }
48
+ }
49
+ </style>
@@ -0,0 +1,5 @@
1
+ import Breadcrumbs from './Breadcrumbs.vue'
2
+
3
+ export {
4
+ Breadcrumbs,
5
+ }
@@ -30,16 +30,16 @@ function setValue(value) {
30
30
  <slot name="label"></slot>
31
31
  </template>
32
32
  <div class="rsui-form-field-radio-group__items">
33
- <div v-for="option in options" :key="option" class="rsui-form-field-radio-group__item"
34
- @click="setValue(option.value)">
33
+ <div v-for="option in options" :key="option" :class="['rsui-form-field-radio-group__item', {'rsui-form-field-radio-group__item--disabled': option.disabled}]"
34
+ @click="!option.disabled && setValue(option.value)">
35
35
  <div class="rsui-form-field-radio-group__control" v-if="model !== option.value"></div>
36
36
  <div class="rsui-form-field-radio-group__control rsui-form-field-radio-group__control--active"
37
37
  v-if="model == option.value">
38
38
  <div></div>
39
39
  </div>
40
- <input class="rsui-form-field-radio-group__item-native-control" type="radio" :value="option.value"
40
+ <input :disabled="option.disabled" class="rsui-form-field-radio-group__item-native-control" type="radio" :value="option.value"
41
41
  v-model="model" :id="$attrs.id" :name="$attrs.name">
42
- <label class="rsui-form-field-radio-group__item-label">{{ option.label }}</label>
42
+ <label :class="['rsui-form-field-radio-group__item-label', {'rsui-form-field-radio-group__item-label--disabled': option.disabled}]">{{ option.label }}</label>
43
43
  </div>
44
44
  </div>
45
45
  <template #help v-if="$slots.help">
@@ -59,6 +59,9 @@ function setValue(value) {
59
59
  }
60
60
  &__item {
61
61
  @apply flex items-center gap-2 cursor-pointer;
62
+ &--disabled {
63
+ @apply opacity-40 cursor-not-allowed;
64
+ }
62
65
  }
63
66
  &__item-native-control {
64
67
  @apply appearance-none;
@@ -74,6 +77,9 @@ function setValue(value) {
74
77
  }
75
78
  &__item-label {
76
79
  @apply font-normal cursor-pointer mb-0;
80
+ &--disabled {
81
+ @apply cursor-not-allowed;
82
+ }
77
83
  }
78
84
  }
79
85