@nexxtmove/ui 0.1.65 → 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.js CHANGED
@@ -5853,7 +5853,7 @@ const no = /* @__PURE__ */ vZ($Z, [["render", ms]]), Ms = {
5853
5853
  },
5854
5854
  emits: ["update:currentStep"],
5855
5855
  setup(i) {
5856
- 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);
5857
5857
  return Tm(() => {
5858
5858
  i.stepTitles && i.stepTitles.length !== i.steps && console.warn(
5859
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.65",
4
+ "version": "0.1.66",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -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
  })