@redseed/redseed-ui-vue3 7.6.0 → 7.6.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": "7.6.0",
3
+ "version": "7.6.2",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/redseedtraining/redseed-ui",
@@ -30,6 +30,10 @@ const props = defineProps({
30
30
  type: Boolean,
31
31
  default: false,
32
32
  },
33
+ info: {
34
+ type: Boolean,
35
+ default: false,
36
+ },
33
37
  ai: {
34
38
  type: Boolean,
35
39
  default: false,
@@ -47,6 +51,7 @@ const badgeClass = computed(() => [
47
51
  'rsui-badge--success': props.success,
48
52
  'rsui-badge--warning': props.warning,
49
53
  'rsui-badge--error': props.error,
54
+ 'rsui-badge--info': props.info,
50
55
  'rsui-badge--ai': props.ai,
51
56
  },
52
57
  ])
@@ -15,6 +15,10 @@ const props = defineProps({
15
15
  type: Boolean,
16
16
  default: false,
17
17
  },
18
+ showLabel: {
19
+ type: Boolean,
20
+ default: true,
21
+ },
18
22
  sm: {
19
23
  type: Boolean,
20
24
  default: false,
@@ -27,10 +31,18 @@ const props = defineProps({
27
31
  type: Boolean,
28
32
  default: false,
29
33
  },
34
+ // when the number of steps reaches threshold, use small indicator
35
+ threshold: {
36
+ type: Number,
37
+ default: 10,
38
+ validator: value => value >= 10,
39
+ }
30
40
  })
31
41
 
32
42
  const internalSteps = ref(props.steps)
33
43
 
44
+ const thresholdReached = computed(() => internalSteps.value.length >= props.threshold)
45
+
34
46
  const activeStep = ref(props.steps.find(step => !!step.active) || props.steps[0])
35
47
 
36
48
  const activeStepIndex = computed(() => internalSteps.value.findIndex(step => step === activeStep.value))
@@ -58,12 +70,18 @@ function handleStepClick(clickedStep) {
58
70
 
59
71
  const defaultSize = computed(() => !props.sm && !props.md && !props.lg)
60
72
 
73
+ const isSmall = computed(() => props.sm || thresholdReached.value)
74
+
75
+ const isMedium = computed(() => props.md && !thresholdReached.value)
76
+
77
+ const isLarge = computed(() => (props.lg || defaultSize.value) && !thresholdReached.value)
78
+
61
79
  const componentClass = computed(() => [
62
80
  'rsui-progress-tracker',
63
81
  {
64
- 'rsui-progress-tracker--sm': props.sm,
65
- 'rsui-progress-tracker--md': props.md,
66
- 'rsui-progress-tracker--lg': props.lg || defaultSize.value,
82
+ 'rsui-progress-tracker--sm': isSmall.value,
83
+ 'rsui-progress-tracker--md': isMedium.value,
84
+ 'rsui-progress-tracker--lg': isLarge.value,
67
85
  }
68
86
  ])
69
87
  </script>
@@ -77,16 +95,18 @@ const componentClass = computed(() => [
77
95
  :active="index === activeStepIndex"
78
96
  :clickable="clickable"
79
97
  :skippable="skippable || index === activeStepIndex + 1"
80
- :sm="sm"
81
- :md="md"
82
- :lg="lg"
98
+ :sm="isSmall"
99
+ :md="isMedium"
100
+ :lg="isLarge"
83
101
  @click="handleStepClick(step)"
84
102
  >
85
103
  <template #indicator>
86
104
  {{ index + 1 }}
87
105
  </template>
88
106
 
89
- {{ step.label }}
107
+ <div v-if="showLabel">
108
+ {{ step.label }}
109
+ </div>
90
110
  </ProgressTrackerStep>
91
111
  </slot>
92
112
  </div>
@@ -89,6 +89,7 @@ function handleClick() {
89
89
  <div :class="indicatorClass">
90
90
  <slot name="indicator"></slot>
91
91
  </div>
92
- <slot>Step</slot>
92
+
93
+ <slot></slot>
93
94
  </div>
94
95
  </template>