@nexxtmove/ui 0.1.64 → 0.1.66

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/dist/index.d.ts CHANGED
@@ -1184,6 +1184,7 @@ declare interface NexxtCustomerJourneyTileProps {
1184
1184
  delay?: number;
1185
1185
  percentage?: number;
1186
1186
  percentageExplanaition?: string;
1187
+ invertPercentageColor?: boolean;
1187
1188
  variant?: 'information' | 'display';
1188
1189
  selected?: boolean;
1189
1190
  }
package/dist/index.js CHANGED
@@ -5116,6 +5116,7 @@ const no = /* @__PURE__ */ vZ($Z, [["render", ms]]), Ms = {
5116
5116
  delay: {},
5117
5117
  percentage: {},
5118
5118
  percentageExplanaition: {},
5119
+ invertPercentageColor: { type: Boolean, default: !1 },
5119
5120
  variant: { default: "information" },
5120
5121
  selected: { type: Boolean, default: !1 }
5121
5122
  },
@@ -5182,7 +5183,7 @@ const no = /* @__PURE__ */ vZ($Z, [["render", ms]]), Ms = {
5182
5183
  I("span", {
5183
5184
  class: F([
5184
5185
  "extra-small-semibold",
5185
- i.percentage > 0 ? "text-green-500" : i.percentage === 0 ? "text-orange-500" : "text-brick-500"
5186
+ i.percentage === 0 ? "text-orange-500" : i.percentage > 0 !== i.invertPercentageColor ? "text-green-500" : "text-brick-500"
5186
5187
  ])
5187
5188
  }, [
5188
5189
  i.percentage > 0 ? (o(), y(V, { key: 0 }, [
@@ -5852,7 +5853,7 @@ const no = /* @__PURE__ */ vZ($Z, [["render", ms]]), Ms = {
5852
5853
  },
5853
5854
  emits: ["update:currentStep"],
5854
5855
  setup(i) {
5855
- const x = u(() => i.variant === "percentage"), m = u(() => Math.min(Math.max(0, i.currentStep), Math.max(0, i.steps - 1))), M = u(() => i.steps > 0 ? m.value + 1 : 0), c = u(() => i.steps <= 1 ? i.steps === 1 ? 100 : 0 : m.value / (i.steps - 1) * 100), l = u(() => !x.value && !!i.stepTitles?.length);
5856
+ const x = u(() => i.variant === "percentage"), m = u(() => x.value ? Math.max(0, i.currentStep) : Math.min(Math.max(0, i.currentStep), Math.max(0, i.steps - 1))), M = u(() => i.steps > 0 ? m.value + 1 : 0), c = u(() => x.value ? i.steps <= 0 ? 0 : Math.min(Math.round(m.value / i.steps * 100), 100) : i.steps <= 1 ? i.steps === 1 ? 100 : 0 : m.value / (i.steps - 1) * 100), l = u(() => !x.value && !!i.stepTitles?.length);
5856
5857
  return Tm(() => {
5857
5858
  i.stepTitles && i.stepTitles.length !== i.steps && console.warn(
5858
5859
  `[NexxtProgressBar] The "stepTitles" array length (${i.stepTitles.length}) must match the "steps" prop (${i.steps}).`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexxtmove/ui",
3
3
  "type": "module",
4
- "version": "0.1.64",
4
+ "version": "0.1.66",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -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 > 0
122
- ? 'text-green-500'
123
- : percentage === 0
124
- ? 'text-orange-500'
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
@@ -26,10 +26,19 @@ const {
26
26
 
27
27
  const isPercentage = computed(() => variant === 'percentage')
28
28
 
29
- const clampedStep = computed(() => Math.min(Math.max(0, currentStep), Math.max(0, steps - 1)))
29
+ const clampedStep = computed(() => {
30
+ if (isPercentage.value) return Math.max(0, currentStep)
31
+ return Math.min(Math.max(0, currentStep), Math.max(0, steps - 1))
32
+ })
33
+
30
34
  const displayStep = computed(() => (steps > 0 ? clampedStep.value + 1 : 0))
31
35
 
32
36
  const percentage = computed(() => {
37
+ if (isPercentage.value) {
38
+ if (steps <= 0) return 0
39
+ return Math.min(Math.round((clampedStep.value / steps) * 100), 100)
40
+ }
41
+
33
42
  if (steps <= 1) return steps === 1 ? 100 : 0
34
43
  return (clampedStep.value / (steps - 1)) * 100
35
44
  })