@zag-js/slider 1.41.1 → 1.42.0

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.
@@ -211,7 +211,7 @@ function connect(service, normalize) {
211
211
  onKeyDown(event) {
212
212
  if (event.defaultPrevented) return;
213
213
  if (!interactive) return;
214
- const step = (0, import_dom_query.getEventStep)(event) * prop("step");
214
+ const step = (0, import_dom_query.getEventStepValue)(event, { step: prop("step"), largeStep: prop("largeStep") });
215
215
  const keyMap = {
216
216
  ArrowUp() {
217
217
  if (isHorizontal) return;
@@ -4,7 +4,7 @@ import {
4
4
  dataAttr,
5
5
  getEventKey,
6
6
  getEventPoint,
7
- getEventStep,
7
+ getEventStepValue,
8
8
  isLeftClick,
9
9
  isModifierKey
10
10
  } from "@zag-js/dom-query";
@@ -192,7 +192,7 @@ function connect(service, normalize) {
192
192
  onKeyDown(event) {
193
193
  if (event.defaultPrevented) return;
194
194
  if (!interactive) return;
195
- const step = getEventStep(event) * prop("step");
195
+ const step = getEventStepValue(event, { step: prop("step"), largeStep: prop("largeStep") });
196
196
  const keyMap = {
197
197
  ArrowUp() {
198
198
  if (isHorizontal) return;
@@ -69,6 +69,7 @@ var machine = (0, import_core.createMachine)({
69
69
  thumbCollisionBehavior: "none",
70
70
  minStepsBetweenThumbs,
71
71
  ...props,
72
+ largeStep: props.largeStep ?? 10 * step,
72
73
  defaultValue: normalize(defaultValue, min, max, step, minStepsBetweenThumbs),
73
74
  value: props.value ? normalize(props.value, min, max, step, minStepsBetweenThumbs) : void 0,
74
75
  max,
@@ -54,6 +54,7 @@ var machine = createMachine({
54
54
  thumbCollisionBehavior: "none",
55
55
  minStepsBetweenThumbs,
56
56
  ...props,
57
+ largeStep: props.largeStep ?? 10 * step,
57
58
  defaultValue: normalize(defaultValue, min, max, step, minStepsBetweenThumbs),
58
59
  value: props.value ? normalize(props.value, min, max, step, minStepsBetweenThumbs) : void 0,
59
60
  max,
@@ -41,6 +41,7 @@ var props = (0, import_types.createProps)()([
41
41
  "id",
42
42
  "ids",
43
43
  "invalid",
44
+ "largeStep",
44
45
  "max",
45
46
  "min",
46
47
  "minStepsBetweenThumbs",
@@ -12,6 +12,7 @@ var props = createProps()([
12
12
  "id",
13
13
  "ids",
14
14
  "invalid",
15
+ "largeStep",
15
16
  "max",
16
17
  "min",
17
18
  "minStepsBetweenThumbs",
@@ -98,6 +98,12 @@ interface SliderProps extends DirectionProperty, CommonProperties {
98
98
  * @default 1
99
99
  */
100
100
  step?: number | undefined;
101
+ /**
102
+ * The step value of the slider when the `Shift` key is held, or the
103
+ * `PageUp`/`PageDown` keys are used.
104
+ * @default 10 * step
105
+ */
106
+ largeStep?: number | undefined;
101
107
  /**
102
108
  * The minimum permitted steps between multiple thumbs.
103
109
  *
@@ -149,7 +155,7 @@ interface SliderProps extends DirectionProperty, CommonProperties {
149
155
  */
150
156
  thumbCollisionBehavior?: "none" | "push" | "swap" | undefined;
151
157
  }
152
- type PropsWithDefault = "dir" | "min" | "max" | "step" | "orientation" | "defaultValue" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs" | "thumbCollisionBehavior";
158
+ type PropsWithDefault = "dir" | "min" | "max" | "step" | "largeStep" | "orientation" | "defaultValue" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs" | "thumbCollisionBehavior";
153
159
  type Computed = Readonly<{
154
160
  /**
155
161
  * @computed
@@ -98,6 +98,12 @@ interface SliderProps extends DirectionProperty, CommonProperties {
98
98
  * @default 1
99
99
  */
100
100
  step?: number | undefined;
101
+ /**
102
+ * The step value of the slider when the `Shift` key is held, or the
103
+ * `PageUp`/`PageDown` keys are used.
104
+ * @default 10 * step
105
+ */
106
+ largeStep?: number | undefined;
101
107
  /**
102
108
  * The minimum permitted steps between multiple thumbs.
103
109
  *
@@ -149,7 +155,7 @@ interface SliderProps extends DirectionProperty, CommonProperties {
149
155
  */
150
156
  thumbCollisionBehavior?: "none" | "push" | "swap" | undefined;
151
157
  }
152
- type PropsWithDefault = "dir" | "min" | "max" | "step" | "orientation" | "defaultValue" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs" | "thumbCollisionBehavior";
158
+ type PropsWithDefault = "dir" | "min" | "max" | "step" | "largeStep" | "orientation" | "defaultValue" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs" | "thumbCollisionBehavior";
153
159
  type Computed = Readonly<{
154
160
  /**
155
161
  * @computed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/slider",
3
- "version": "1.41.1",
3
+ "version": "1.42.0",
4
4
  "description": "Core logic for the slider widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -15,7 +15,10 @@
15
15
  "author": "Segun Adebayo <sage@adebayosegun.com>",
16
16
  "homepage": "https://github.com/chakra-ui/zag#readme",
17
17
  "license": "MIT",
18
- "repository": "https://github.com/chakra-ui/zag/tree/main/packages/slider",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/chakra-ui/zag/tree/main/packages/slider"
21
+ },
19
22
  "sideEffects": false,
20
23
  "files": [
21
24
  "dist"
@@ -27,11 +30,11 @@
27
30
  "url": "https://github.com/chakra-ui/zag/issues"
28
31
  },
29
32
  "dependencies": {
30
- "@zag-js/anatomy": "1.41.1",
31
- "@zag-js/core": "1.41.1",
32
- "@zag-js/dom-query": "1.41.1",
33
- "@zag-js/utils": "1.41.1",
34
- "@zag-js/types": "1.41.1"
33
+ "@zag-js/anatomy": "1.42.0",
34
+ "@zag-js/core": "1.42.0",
35
+ "@zag-js/dom-query": "1.42.0",
36
+ "@zag-js/utils": "1.42.0",
37
+ "@zag-js/types": "1.42.0"
35
38
  },
36
39
  "devDependencies": {
37
40
  "clean-package": "2.2.0"