@nexxtmove/ui 0.1.63 → 0.1.65
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
|
@@ -12,6 +12,7 @@ interface NexxtCustomerJourneyTileProps {
|
|
|
12
12
|
delay?: number
|
|
13
13
|
percentage?: number
|
|
14
14
|
percentageExplanaition?: string
|
|
15
|
+
invertPercentageColor?: boolean
|
|
15
16
|
variant?: 'information' | 'display'
|
|
16
17
|
selected?: boolean
|
|
17
18
|
}
|
|
@@ -28,6 +29,7 @@ const {
|
|
|
28
29
|
delay,
|
|
29
30
|
percentage,
|
|
30
31
|
percentageExplanaition,
|
|
32
|
+
invertPercentageColor = false,
|
|
31
33
|
variant = 'information',
|
|
32
34
|
selected = false,
|
|
33
35
|
} = defineProps<NexxtCustomerJourneyTileProps>()
|
|
@@ -118,10 +120,10 @@ const iconColors = computed(() => {
|
|
|
118
120
|
<span
|
|
119
121
|
class="extra-small-semibold"
|
|
120
122
|
:class="
|
|
121
|
-
percentage
|
|
122
|
-
? 'text-
|
|
123
|
-
: percentage
|
|
124
|
-
? 'text-
|
|
123
|
+
percentage === 0
|
|
124
|
+
? 'text-orange-500'
|
|
125
|
+
: percentage > 0 !== invertPercentageColor
|
|
126
|
+
? 'text-green-500'
|
|
125
127
|
: 'text-brick-500'
|
|
126
128
|
"
|
|
127
129
|
><template v-if="percentage > 0">+</template>{{ percentage }}%</span
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { computed, getCurrentInstance } from 'vue'
|
|
2
3
|
import Icon from '../Icon/Icon.vue'
|
|
3
4
|
|
|
4
5
|
const generateId = () => 'input-field-' + Math.random().toString(36).slice(2, 10)
|
|
@@ -20,7 +21,22 @@ export interface NexxtInputFieldProps {
|
|
|
20
21
|
|
|
21
22
|
defineProps<NexxtInputFieldProps>()
|
|
22
23
|
|
|
23
|
-
const modelValue = defineModel<string>()
|
|
24
|
+
const modelValue = defineModel<string | number>()
|
|
25
|
+
|
|
26
|
+
const isNumber = computed(() => {
|
|
27
|
+
const instance = getCurrentInstance()
|
|
28
|
+
return instance?.attrs.type === 'number'
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const increment = () => {
|
|
32
|
+
const current = Number(modelValue.value || 0)
|
|
33
|
+
modelValue.value = current + 1
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const decrement = () => {
|
|
37
|
+
const current = Number(modelValue.value || 0)
|
|
38
|
+
modelValue.value = current - 1
|
|
39
|
+
}
|
|
24
40
|
</script>
|
|
25
41
|
|
|
26
42
|
<template>
|
|
@@ -35,7 +51,7 @@ const modelValue = defineModel<string>()
|
|
|
35
51
|
</label>
|
|
36
52
|
|
|
37
53
|
<div
|
|
38
|
-
class="flex items-center gap-2 overflow-hidden rounded-lg ring transition-colors ease-out focus-within:ring-cornflower-blue-500"
|
|
54
|
+
class="group flex items-center gap-2 overflow-hidden rounded-lg ring transition-colors ease-out focus-within:ring-cornflower-blue-500"
|
|
39
55
|
:class="[error ? 'ring-brick-400' : 'ring-gray-200', { 'pl-3': leftIcon, 'pr-3': rightIcon }]"
|
|
40
56
|
>
|
|
41
57
|
<span v-if="leftIcon" class="flex items-center">
|
|
@@ -47,11 +63,29 @@ const modelValue = defineModel<string>()
|
|
|
47
63
|
v-model="modelValue"
|
|
48
64
|
:placeholder="placeholder"
|
|
49
65
|
v-bind="$attrs"
|
|
50
|
-
class="bg-transparant h-10 w-full min-w-60 text-sm text-gray-900 placeholder-gray-400 focus:outline-none"
|
|
66
|
+
class="bg-transparant h-10 w-full min-w-60 text-sm text-gray-900 placeholder-gray-400 focus:outline-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
51
67
|
:class="{ 'pl-3': !leftIcon, 'pr-3': !rightIcon }"
|
|
52
68
|
/>
|
|
53
69
|
<slot name="right">
|
|
54
|
-
<
|
|
70
|
+
<div v-if="isNumber" class="flex flex-col pr-1.5">
|
|
71
|
+
<button
|
|
72
|
+
type="button"
|
|
73
|
+
class="flex h-5 w-8 cursor-pointer items-center justify-center pt-2 text-gray-400 transition-colors group-focus-within:text-gray-950 hover:text-cornflower-blue-600 focus:text-cornflower-blue-600 focus:outline-none"
|
|
74
|
+
aria-label="Verhogen"
|
|
75
|
+
@click="increment"
|
|
76
|
+
>
|
|
77
|
+
<Icon name="chevron-up" class="text-[10px]" aria-hidden="true" />
|
|
78
|
+
</button>
|
|
79
|
+
<button
|
|
80
|
+
type="button"
|
|
81
|
+
class="flex h-5 w-8 cursor-pointer items-center justify-center pb-2 text-gray-400 transition-colors group-focus-within:text-gray-950 hover:text-cornflower-blue-600 focus:text-cornflower-blue-600 focus:outline-none"
|
|
82
|
+
aria-label="Verlagen"
|
|
83
|
+
@click="decrement"
|
|
84
|
+
>
|
|
85
|
+
<Icon name="chevron-down" class="text-[10px]" aria-hidden="true" />
|
|
86
|
+
</button>
|
|
87
|
+
</div>
|
|
88
|
+
<span v-else-if="rightIcon" class="flex items-center">
|
|
55
89
|
<Icon :name="rightIcon" />
|
|
56
90
|
</span>
|
|
57
91
|
</slot>
|
|
@@ -61,7 +61,7 @@ const select = (opt: SelectOption, close: () => void) => {
|
|
|
61
61
|
:aria-expanded="isOpen"
|
|
62
62
|
aria-haspopup="listbox"
|
|
63
63
|
tabindex="0"
|
|
64
|
-
class="flex w-full cursor-pointer items-center gap-2 rounded-lg ring transition-colors ease-out focus:ring-cornflower-blue-500 focus:outline-none"
|
|
64
|
+
class="group flex w-full cursor-pointer items-center gap-2 rounded-lg ring transition-colors ease-out focus:ring-cornflower-blue-500 focus:outline-none"
|
|
65
65
|
:class="[error ? 'ring-brick-400' : 'ring-gray-200', { 'pl-3': leftIcon, 'pr-3': true }]"
|
|
66
66
|
@click="toggle"
|
|
67
67
|
@keydown.enter.prevent="toggle"
|
|
@@ -78,7 +78,7 @@ const select = (opt: SelectOption, close: () => void) => {
|
|
|
78
78
|
</span>
|
|
79
79
|
<NexxtIcon
|
|
80
80
|
name="chevron-down"
|
|
81
|
-
class="shrink-0 text-gray-400 transition-
|
|
81
|
+
class="shrink-0 text-gray-400 transition-all duration-200 group-hover:text-cornflower-blue-600"
|
|
82
82
|
:class="{ 'rotate-180': isOpen }"
|
|
83
83
|
/>
|
|
84
84
|
</div>
|