@nexxtmove/ui 0.1.59 → 0.1.61
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
|
@@ -36,7 +36,7 @@ const modelValue = defineModel<string>()
|
|
|
36
36
|
|
|
37
37
|
<div
|
|
38
38
|
class="flex items-center gap-2 overflow-hidden rounded-lg ring transition-colors ease-out focus-within:ring-cornflower-blue-500"
|
|
39
|
-
:class="[error ? 'ring-brick-400' : 'ring-gray-200', { '
|
|
39
|
+
:class="[error ? 'ring-brick-400' : 'ring-gray-200', { 'pl-3': leftIcon, 'pr-3': rightIcon }]"
|
|
40
40
|
>
|
|
41
41
|
<span v-if="leftIcon" class="flex items-center">
|
|
42
42
|
<Icon :name="leftIcon" />
|
|
@@ -3,6 +3,7 @@ import { computed, watchEffect } from 'vue'
|
|
|
3
3
|
import AnimatedNumber from '../AnimatedNumber/AnimatedNumber.vue'
|
|
4
4
|
|
|
5
5
|
interface NexxtProgressBarProps {
|
|
6
|
+
variant?: 'stepper' | 'percentage'
|
|
6
7
|
steps: number
|
|
7
8
|
currentStep: number
|
|
8
9
|
progressLabel?: string
|
|
@@ -16,12 +17,15 @@ defineOptions({
|
|
|
16
17
|
defineEmits(['update:currentStep'])
|
|
17
18
|
|
|
18
19
|
const {
|
|
20
|
+
variant = 'stepper',
|
|
19
21
|
progressLabel = 'Voortgang',
|
|
20
22
|
stepTitles,
|
|
21
23
|
steps,
|
|
22
24
|
currentStep,
|
|
23
25
|
} = defineProps<NexxtProgressBarProps>()
|
|
24
26
|
|
|
27
|
+
const isPercentage = computed(() => variant === 'percentage')
|
|
28
|
+
|
|
25
29
|
const clampedStep = computed(() => Math.min(Math.max(0, currentStep), Math.max(0, steps - 1)))
|
|
26
30
|
const displayStep = computed(() => (steps > 0 ? clampedStep.value + 1 : 0))
|
|
27
31
|
|
|
@@ -30,7 +34,7 @@ const percentage = computed(() => {
|
|
|
30
34
|
return (clampedStep.value / (steps - 1)) * 100
|
|
31
35
|
})
|
|
32
36
|
|
|
33
|
-
const hasTitles = computed(() => Boolean(stepTitles?.length))
|
|
37
|
+
const hasTitles = computed(() => !isPercentage.value && Boolean(stepTitles?.length))
|
|
34
38
|
|
|
35
39
|
watchEffect(() => {
|
|
36
40
|
if (stepTitles && stepTitles.length !== steps) {
|
|
@@ -46,7 +50,8 @@ watchEffect(() => {
|
|
|
46
50
|
<div class="flex flex-col @md:gap-2">
|
|
47
51
|
<div class="flex items-center justify-between gap-2">
|
|
48
52
|
<div
|
|
49
|
-
class="progress-bar progress-bar-bar
|
|
53
|
+
class="progress-bar progress-bar-bar w-full overflow-hidden rounded-full"
|
|
54
|
+
:class="isPercentage ? 'relative h-6' : 'h-2'"
|
|
50
55
|
role="progressbar"
|
|
51
56
|
:aria-label="progressLabel"
|
|
52
57
|
aria-valuemin="0"
|
|
@@ -60,9 +65,18 @@ watchEffect(() => {
|
|
|
60
65
|
>
|
|
61
66
|
<div
|
|
62
67
|
class="progress-bar-progress h-full transition-all duration-500 ease-out"
|
|
68
|
+
:class="isPercentage ? 'flex min-w-8 items-center justify-end pr-1.5' : ''"
|
|
63
69
|
:style="{ width: `${percentage}%` }"
|
|
64
70
|
:aria-hidden="true"
|
|
65
|
-
|
|
71
|
+
>
|
|
72
|
+
<span
|
|
73
|
+
v-if="isPercentage"
|
|
74
|
+
class="font-medium text-xs text-white tabular-nums"
|
|
75
|
+
aria-hidden="true"
|
|
76
|
+
>
|
|
77
|
+
{{ Math.round(percentage) }}%
|
|
78
|
+
</span>
|
|
79
|
+
</div>
|
|
66
80
|
</div>
|
|
67
81
|
<div
|
|
68
82
|
v-if="hasTitles"
|