From 297a966e631294d45157a032945a8aba52112d79 Mon Sep 17 00:00:00 2001 From: anubra266 Date: Sun, 24 Nov 2024 18:10:29 -0800 Subject: [PATCH 1/2] fix: angle-slider max value --- .changeset/clever-oranges-deny.md | 5 +++++ packages/machines/angle-slider/src/angle-slider.machine.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/clever-oranges-deny.md diff --git a/.changeset/clever-oranges-deny.md b/.changeset/clever-oranges-deny.md new file mode 100644 index 0000000000..d711e75d24 --- /dev/null +++ b/.changeset/clever-oranges-deny.md @@ -0,0 +1,5 @@ +--- +"@zag-js/angle-slider": patch +--- + +Fix angle slider max value diff --git a/packages/machines/angle-slider/src/angle-slider.machine.ts b/packages/machines/angle-slider/src/angle-slider.machine.ts index bd6fb37674..4b778eb9b8 100644 --- a/packages/machines/angle-slider/src/angle-slider.machine.ts +++ b/packages/machines/angle-slider/src/angle-slider.machine.ts @@ -8,7 +8,7 @@ import { dom } from "./angle-slider.dom" import type { MachineContext, MachineState, UserDefinedContext } from "./angle-slider.types" const MIN_VALUE = 0 -const MAX_VALUE = 360 +const MAX_VALUE = 359 export function machine(userContext: UserDefinedContext) { const ctx = compact(userContext) From 4529e9c2afba2db20d2f1925e72234e08fc4aa75 Mon Sep 17 00:00:00 2001 From: anubra266 Date: Sun, 24 Nov 2024 18:15:34 -0800 Subject: [PATCH 2/2] chore: add clamps --- packages/machines/angle-slider/src/angle-slider.machine.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/machines/angle-slider/src/angle-slider.machine.ts b/packages/machines/angle-slider/src/angle-slider.machine.ts index 4b778eb9b8..add222f40c 100644 --- a/packages/machines/angle-slider/src/angle-slider.machine.ts +++ b/packages/machines/angle-slider/src/angle-slider.machine.ts @@ -176,6 +176,8 @@ const invoke = { const set = { value: (ctx: MachineContext, value: number) => { if (ctx.value === value) return + if (value < MIN_VALUE || value > MAX_VALUE) return + ctx.value = value invoke.valueChange(ctx) },