@zag-js/slider 2.0.0-next.2 → 2.0.0-next.4

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.
@@ -1,12 +1,7 @@
1
- import { SliderProps, MarkerProps, ThumbProps } from './slider.types.mjs';
2
- import '@zag-js/core';
3
- import '@zag-js/types';
4
-
5
- declare const props: (keyof SliderProps)[];
6
- declare const splitProps: <Props extends Partial<SliderProps>>(props: Props) => [Partial<SliderProps>, Omit<Props, keyof SliderProps>];
7
- declare const thumbProps: (keyof ThumbProps)[];
8
- declare const splitThumbProps: <Props extends ThumbProps>(props: Props) => [ThumbProps, Omit<Props, keyof ThumbProps>];
9
- declare const markerProps: "value"[];
10
- declare const splitMarkerProps: <Props extends MarkerProps>(props: Props) => [MarkerProps, Omit<Props, "value">];
11
-
12
- export { markerProps, props, splitMarkerProps, splitProps, splitThumbProps, thumbProps };
1
+ import { MarkerProps, SliderProps, ThumbProps } from "./slider.types.mjs";
2
+ export declare const props: (keyof SliderProps)[];
3
+ export declare const splitProps: <Props extends Partial<SliderProps>>(props: Props) => [Partial<SliderProps>, Omit<Props, keyof SliderProps>];
4
+ export declare const thumbProps: (keyof ThumbProps)[];
5
+ export declare const splitThumbProps: <Props extends ThumbProps>(props: Props) => [ThumbProps, Omit<Props, keyof ThumbProps>];
6
+ export declare const markerProps: "value"[];
7
+ export declare const splitMarkerProps: <Props extends MarkerProps>(props: Props) => [MarkerProps, Omit<Props, "value">];
@@ -1,12 +1,7 @@
1
- import { SliderProps, MarkerProps, ThumbProps } from './slider.types.js';
2
- import '@zag-js/core';
3
- import '@zag-js/types';
4
-
5
- declare const props: (keyof SliderProps)[];
6
- declare const splitProps: <Props extends Partial<SliderProps>>(props: Props) => [Partial<SliderProps>, Omit<Props, keyof SliderProps>];
7
- declare const thumbProps: (keyof ThumbProps)[];
8
- declare const splitThumbProps: <Props extends ThumbProps>(props: Props) => [ThumbProps, Omit<Props, keyof ThumbProps>];
9
- declare const markerProps: "value"[];
10
- declare const splitMarkerProps: <Props extends MarkerProps>(props: Props) => [MarkerProps, Omit<Props, "value">];
11
-
12
- export { markerProps, props, splitMarkerProps, splitProps, splitThumbProps, thumbProps };
1
+ import { MarkerProps, SliderProps, ThumbProps } from "./slider.types.js";
2
+ export declare const props: (keyof SliderProps)[];
3
+ export declare const splitProps: <Props extends Partial<SliderProps>>(props: Props) => [Partial<SliderProps>, Omit<Props, keyof SliderProps>];
4
+ export declare const thumbProps: (keyof ThumbProps)[];
5
+ export declare const splitThumbProps: <Props extends ThumbProps>(props: Props) => [ThumbProps, Omit<Props, keyof ThumbProps>];
6
+ export declare const markerProps: "value"[];
7
+ export declare const splitMarkerProps: <Props extends MarkerProps>(props: Props) => [MarkerProps, Omit<Props, "value">];
@@ -1,75 +1,51 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/slider.props.ts
21
- var slider_props_exports = {};
22
- __export(slider_props_exports, {
23
- markerProps: () => markerProps,
24
- props: () => props,
25
- splitMarkerProps: () => splitMarkerProps,
26
- splitProps: () => splitProps,
27
- splitThumbProps: () => splitThumbProps,
28
- thumbProps: () => thumbProps
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
29
4
  });
30
- module.exports = __toCommonJS(slider_props_exports);
31
- var import_types = require("@zag-js/types");
32
- var import_utils = require("@zag-js/utils");
33
- var props = (0, import_types.createProps)()([
34
- "aria-label",
35
- "aria-labelledby",
36
- "dir",
37
- "disabled",
38
- "form",
39
- "getAriaValueText",
40
- "getRootNode",
41
- "id",
42
- "ids",
43
- "invalid",
44
- "largeStep",
45
- "max",
46
- "min",
47
- "minStepsBetweenThumbs",
48
- "name",
49
- "onFocusChange",
50
- "onValueChange",
51
- "onValueChangeEnd",
52
- "orientation",
53
- "origin",
54
- "readOnly",
55
- "step",
56
- "thumbAlignment",
57
- "thumbCollisionBehavior",
58
- "thumbSize",
59
- "value",
60
- "defaultValue"
5
+ let _zag_js_utils = require("@zag-js/utils");
6
+ let _zag_js_types = require("@zag-js/types");
7
+ // src/slider.props.ts
8
+ const props = (0, _zag_js_types.createProps)()([
9
+ "dir",
10
+ "disabled",
11
+ "form",
12
+ "getAriaLabel",
13
+ "getAriaLabelledBy",
14
+ "getAriaValueText",
15
+ "getRootNode",
16
+ "id",
17
+ "ids",
18
+ "invalid",
19
+ "largeStep",
20
+ "max",
21
+ "min",
22
+ "minStepsBetweenThumbs",
23
+ "name",
24
+ "onFocusChange",
25
+ "onValueChange",
26
+ "onValueChangeEnd",
27
+ "orientation",
28
+ "origin",
29
+ "readOnly",
30
+ "step",
31
+ "thumbAlignment",
32
+ "thumbCollisionBehavior",
33
+ "thumbSize",
34
+ "value",
35
+ "defaultValue"
61
36
  ]);
62
- var splitProps = (0, import_utils.createSplitProps)(props);
63
- var thumbProps = (0, import_types.createProps)()(["index", "name"]);
64
- var splitThumbProps = (0, import_utils.createSplitProps)(thumbProps);
65
- var markerProps = (0, import_types.createProps)()(["value"]);
66
- var splitMarkerProps = (0, import_utils.createSplitProps)(markerProps);
67
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
69
- markerProps,
70
- props,
71
- splitMarkerProps,
72
- splitProps,
73
- splitThumbProps,
74
- thumbProps
75
- });
37
+ const splitProps = (0, _zag_js_utils.createSplitProps)(props);
38
+ const thumbProps = (0, _zag_js_types.createProps)()([
39
+ "disabled",
40
+ "index",
41
+ "name"
42
+ ]);
43
+ const splitThumbProps = (0, _zag_js_utils.createSplitProps)(thumbProps);
44
+ const markerProps = (0, _zag_js_types.createProps)()(["value"]);
45
+ const splitMarkerProps = (0, _zag_js_utils.createSplitProps)(markerProps);
46
+ exports.markerProps = markerProps;
47
+ exports.props = props;
48
+ exports.splitMarkerProps = splitMarkerProps;
49
+ exports.splitProps = splitProps;
50
+ exports.splitThumbProps = splitThumbProps;
51
+ exports.thumbProps = thumbProps;
@@ -1,45 +1,42 @@
1
- // src/slider.props.ts
2
- import { createProps } from "@zag-js/types";
3
1
  import { createSplitProps } from "@zag-js/utils";
4
- var props = createProps()([
5
- "aria-label",
6
- "aria-labelledby",
7
- "dir",
8
- "disabled",
9
- "form",
10
- "getAriaValueText",
11
- "getRootNode",
12
- "id",
13
- "ids",
14
- "invalid",
15
- "largeStep",
16
- "max",
17
- "min",
18
- "minStepsBetweenThumbs",
19
- "name",
20
- "onFocusChange",
21
- "onValueChange",
22
- "onValueChangeEnd",
23
- "orientation",
24
- "origin",
25
- "readOnly",
26
- "step",
27
- "thumbAlignment",
28
- "thumbCollisionBehavior",
29
- "thumbSize",
30
- "value",
31
- "defaultValue"
2
+ import { createProps } from "@zag-js/types";
3
+ // src/slider.props.ts
4
+ const props = createProps()([
5
+ "dir",
6
+ "disabled",
7
+ "form",
8
+ "getAriaLabel",
9
+ "getAriaLabelledBy",
10
+ "getAriaValueText",
11
+ "getRootNode",
12
+ "id",
13
+ "ids",
14
+ "invalid",
15
+ "largeStep",
16
+ "max",
17
+ "min",
18
+ "minStepsBetweenThumbs",
19
+ "name",
20
+ "onFocusChange",
21
+ "onValueChange",
22
+ "onValueChangeEnd",
23
+ "orientation",
24
+ "origin",
25
+ "readOnly",
26
+ "step",
27
+ "thumbAlignment",
28
+ "thumbCollisionBehavior",
29
+ "thumbSize",
30
+ "value",
31
+ "defaultValue"
32
+ ]);
33
+ const splitProps = createSplitProps(props);
34
+ const thumbProps = createProps()([
35
+ "disabled",
36
+ "index",
37
+ "name"
32
38
  ]);
33
- var splitProps = createSplitProps(props);
34
- var thumbProps = createProps()(["index", "name"]);
35
- var splitThumbProps = createSplitProps(thumbProps);
36
- var markerProps = createProps()(["value"]);
37
- var splitMarkerProps = createSplitProps(markerProps);
38
- export {
39
- markerProps,
40
- props,
41
- splitMarkerProps,
42
- splitProps,
43
- splitThumbProps,
44
- thumbProps
45
- };
39
+ const splitThumbProps = createSplitProps(thumbProps);
40
+ const markerProps = createProps()(["value"]);
41
+ const splitMarkerProps = createSplitProps(markerProps);
42
+ export { markerProps, props, splitMarkerProps, splitProps, splitThumbProps, thumbProps };
@@ -1,19 +1,17 @@
1
- import { Params } from '@zag-js/core';
2
- import { Style } from '@zag-js/types';
3
- import { SliderSchema } from './slider.types.mjs';
4
-
1
+ import { SliderSchema } from "./slider.types.mjs";
2
+ import { Params } from "@zag-js/core";
3
+ import { Style } from "@zag-js/types";
5
4
  type Ctx = Params<SliderSchema>;
6
- declare function getRangeOffsets(params: Pick<Ctx, "prop" | "computed">): {
7
- start: string;
8
- end: string;
5
+ export declare function getRangeOffsets(params: Pick<Ctx, "prop" | "computed" | "context">): {
6
+ start: string;
7
+ end: string;
9
8
  };
10
- declare function getRangeStyle(params: Pick<Ctx, "computed">): Style;
11
- declare function getThumbOffset(params: Pick<Ctx, "computed" | "context" | "prop">, value: number): string;
12
- declare function getVisibility(params: Pick<Ctx, "computed" | "prop">): "hidden" | "visible";
13
- declare function getThumbStyle(params: Pick<Ctx, "computed" | "context" | "prop">, index: number): Style;
14
- declare function getControlStyle(): Style;
15
- declare function getRootStyle(params: Pick<Ctx, "context" | "computed" | "prop">): Style;
16
- declare function getMarkerStyle(params: Pick<Ctx, "computed" | "context" | "prop">, value: number): Style;
17
- declare function getMarkerGroupStyle(): Style;
18
-
19
- export { getControlStyle, getMarkerGroupStyle, getMarkerStyle, getRangeOffsets, getRangeStyle, getRootStyle, getThumbOffset, getThumbStyle, getVisibility };
9
+ export declare function getRangeStyle(params: Pick<Ctx, "computed">): Style;
10
+ export declare function getThumbOffset(params: Pick<Ctx, "context" | "prop">, value: number): string;
11
+ export declare function getVisibility(params: Pick<Ctx, "computed" | "prop">): "hidden" | "visible";
12
+ export declare function getThumbStyle(params: Pick<Ctx, "computed" | "context" | "prop">, index: number): Style;
13
+ export declare function getControlStyle(): Style;
14
+ export declare function getRootStyle(params: Pick<Ctx, "context" | "computed" | "prop">): Style;
15
+ export declare function getMarkerStyle(params: Pick<Ctx, "computed" | "context" | "prop">, value: number): Style;
16
+ export declare function getMarkerGroupStyle(): Style;
17
+ export {};
@@ -1,19 +1,17 @@
1
- import { Params } from '@zag-js/core';
2
- import { Style } from '@zag-js/types';
3
- import { SliderSchema } from './slider.types.js';
4
-
1
+ import { SliderSchema } from "./slider.types.js";
2
+ import { Style } from "@zag-js/types";
3
+ import { Params } from "@zag-js/core";
5
4
  type Ctx = Params<SliderSchema>;
6
- declare function getRangeOffsets(params: Pick<Ctx, "prop" | "computed">): {
7
- start: string;
8
- end: string;
5
+ export declare function getRangeOffsets(params: Pick<Ctx, "prop" | "computed" | "context">): {
6
+ start: string;
7
+ end: string;
9
8
  };
10
- declare function getRangeStyle(params: Pick<Ctx, "computed">): Style;
11
- declare function getThumbOffset(params: Pick<Ctx, "computed" | "context" | "prop">, value: number): string;
12
- declare function getVisibility(params: Pick<Ctx, "computed" | "prop">): "hidden" | "visible";
13
- declare function getThumbStyle(params: Pick<Ctx, "computed" | "context" | "prop">, index: number): Style;
14
- declare function getControlStyle(): Style;
15
- declare function getRootStyle(params: Pick<Ctx, "context" | "computed" | "prop">): Style;
16
- declare function getMarkerStyle(params: Pick<Ctx, "computed" | "context" | "prop">, value: number): Style;
17
- declare function getMarkerGroupStyle(): Style;
18
-
19
- export { getControlStyle, getMarkerGroupStyle, getMarkerStyle, getRangeOffsets, getRangeStyle, getRootStyle, getThumbOffset, getThumbStyle, getVisibility };
9
+ export declare function getRangeStyle(params: Pick<Ctx, "computed">): Style;
10
+ export declare function getThumbOffset(params: Pick<Ctx, "context" | "prop">, value: number): string;
11
+ export declare function getVisibility(params: Pick<Ctx, "computed" | "prop">): "hidden" | "visible";
12
+ export declare function getThumbStyle(params: Pick<Ctx, "computed" | "context" | "prop">, index: number): Style;
13
+ export declare function getControlStyle(): Style;
14
+ export declare function getRootStyle(params: Pick<Ctx, "context" | "computed" | "prop">): Style;
15
+ export declare function getMarkerStyle(params: Pick<Ctx, "computed" | "context" | "prop">, value: number): Style;
16
+ export declare function getMarkerGroupStyle(): Style;
17
+ export {};
@@ -1,177 +1,123 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/slider.style.ts
21
- var slider_style_exports = {};
22
- __export(slider_style_exports, {
23
- getControlStyle: () => getControlStyle,
24
- getMarkerGroupStyle: () => getMarkerGroupStyle,
25
- getMarkerStyle: () => getMarkerStyle,
26
- getRangeOffsets: () => getRangeOffsets,
27
- getRangeStyle: () => getRangeStyle,
28
- getRootStyle: () => getRootStyle,
29
- getThumbOffset: () => getThumbOffset,
30
- getThumbStyle: () => getThumbStyle,
31
- getVisibility: () => getVisibility
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
32
4
  });
33
- module.exports = __toCommonJS(slider_style_exports);
34
- var import_utils = require("@zag-js/utils");
35
- var import_slider = require("./slider.utils.js");
36
- function getBounds(value) {
37
- const firstValue = value[0];
38
- const lastThumb = value[value.length - 1];
39
- return [firstValue, lastThumb];
40
- }
5
+ const require_slider_utils = require("./slider.utils.js");
6
+ let _zag_js_utils = require("@zag-js/utils");
7
+ // src/slider.style.ts
41
8
  function getRangeOffsets(params) {
42
- const { prop, computed } = params;
43
- const valuePercent = computed("valuePercent");
44
- const [firstPercent, lastPercent] = getBounds(valuePercent);
45
- if (valuePercent.length === 1) {
46
- const originPercent = (0, import_slider.getOriginPercent)(prop("origin"), prop("min"), prop("max"));
47
- const { start, end } = (0, import_slider.getFillRange)(valuePercent[0], originPercent);
48
- return { start: `${start}%`, end: `${end}%` };
49
- }
50
- return { start: `${firstPercent}%`, end: `${100 - lastPercent}%` };
9
+ const [from, to] = require_slider_utils.getFillSpan(params);
10
+ const extent = require_slider_utils.getThumbExtent(params);
11
+ const toEdge = (percent, flip = false) => {
12
+ const inset = percent === 0 || percent === 100 ? 0 : toInset(percent, extent);
13
+ const edge = flip ? 100 - percent : percent;
14
+ if (!inset) return `${edge}%`;
15
+ return flip ? `calc(${edge}% + ${inset}px)` : `calc(${edge}% - ${inset}px)`;
16
+ };
17
+ return {
18
+ start: toEdge(from),
19
+ end: toEdge(to, true)
20
+ };
51
21
  }
52
22
  function getRangeStyle(params) {
53
- const { computed } = params;
54
- const isVertical = computed("isVertical");
55
- const isRtl = computed("isRtl");
56
- if (isVertical) {
57
- return {
58
- position: "absolute",
59
- bottom: "var(--slider-range-start)",
60
- top: "var(--slider-range-end)"
61
- };
62
- }
63
- return {
64
- position: "absolute",
65
- [isRtl ? "right" : "left"]: "var(--slider-range-start)",
66
- [isRtl ? "left" : "right"]: "var(--slider-range-end)"
67
- };
23
+ const { computed } = params;
24
+ const isVertical = computed("isVertical");
25
+ const isRtl = computed("isRtl");
26
+ if (isVertical) return {
27
+ position: "absolute",
28
+ bottom: "var(--slider-range-start)",
29
+ top: "var(--slider-range-end)"
30
+ };
31
+ return {
32
+ position: "absolute",
33
+ [isRtl ? "right" : "left"]: "var(--slider-range-start)",
34
+ [isRtl ? "left" : "right"]: "var(--slider-range-end)"
35
+ };
68
36
  }
69
- function getVerticalThumbOffset(params, value) {
70
- const { context, prop } = params;
71
- const { height = 0 } = context.get("thumbSize") ?? {};
72
- const getValue = (0, import_utils.getValueTransformer)([prop("min"), prop("max")], [-height / 2, height / 2]);
73
- return parseFloat(getValue(value).toFixed(2));
74
- }
75
- function getHorizontalThumbOffset(params, value) {
76
- const { computed, context, prop } = params;
77
- const { width = 0 } = context.get("thumbSize") ?? {};
78
- const isRtl = computed("isRtl");
79
- if (isRtl) {
80
- const getValue2 = (0, import_utils.getValueTransformer)([prop("max"), prop("min")], [-width / 2, width / 2]);
81
- return -1 * parseFloat(getValue2(value).toFixed(2));
82
- }
83
- const getValue = (0, import_utils.getValueTransformer)([prop("min"), prop("max")], [-width / 2, width / 2]);
84
- return parseFloat(getValue(value).toFixed(2));
85
- }
86
- function getOffset(params, percent, value) {
87
- const { computed, prop } = params;
88
- if (prop("thumbAlignment") === "center") return `${percent}%`;
89
- const offset = computed("isVertical") ? getVerticalThumbOffset(params, value) : getHorizontalThumbOffset(params, value);
90
- return `calc(${percent}% - ${offset}px)`;
37
+ function toInset(percent, extent) {
38
+ return +(extent * (percent / 100 - .5)).toFixed(2);
91
39
  }
92
40
  function getThumbOffset(params, value) {
93
- const { prop } = params;
94
- const percent = (0, import_utils.getValuePercent)(value, prop("min"), prop("max")) * 100;
95
- return getOffset(params, percent, value);
41
+ const { prop } = params;
42
+ const percent = (0, _zag_js_utils.getValuePercent)(value, prop("min"), prop("max")) * 100;
43
+ const inset = toInset(percent, require_slider_utils.getThumbExtent(params));
44
+ return inset ? `calc(${percent}% - ${inset}px)` : `${percent}%`;
96
45
  }
97
46
  function getVisibility(params) {
98
- const { computed, prop } = params;
99
- let visibility = "visible";
100
- if (prop("thumbAlignment") === "contain" && !computed("hasMeasuredThumbSize")) {
101
- visibility = "hidden";
102
- }
103
- return visibility;
47
+ const { computed, prop } = params;
48
+ let visibility = "visible";
49
+ if (prop("thumbAlignment") === "contain" && !computed("hasMeasuredThumbSize")) visibility = "hidden";
50
+ return visibility;
104
51
  }
105
52
  function getThumbStyle(params, index) {
106
- const { computed, context } = params;
107
- const placementProp = computed("isVertical") ? "bottom" : "insetInlineStart";
108
- const focusedIndex = context.get("focusedIndex");
109
- return {
110
- visibility: getVisibility(params),
111
- position: "absolute",
112
- transform: "var(--slider-thumb-transform)",
113
- [placementProp]: `var(--slider-thumb-offset-${index})`,
114
- zIndex: focusedIndex === index ? 1 : void 0
115
- };
53
+ const { computed, context } = params;
54
+ const placementProp = computed("isVertical") ? "bottom" : "insetInlineStart";
55
+ const focusedIndex = context.get("focusedIndex");
56
+ return {
57
+ visibility: getVisibility(params),
58
+ position: "absolute",
59
+ transform: "var(--slider-thumb-transform)",
60
+ [placementProp]: `var(--slider-thumb-offset-${index})`,
61
+ zIndex: focusedIndex === index ? 1 : void 0
62
+ };
116
63
  }
117
64
  function getControlStyle() {
118
- return {
119
- touchAction: "none",
120
- userSelect: "none",
121
- WebkitUserSelect: "none",
122
- position: "relative"
123
- };
65
+ return {
66
+ touchAction: "none",
67
+ userSelect: "none",
68
+ WebkitUserSelect: "none",
69
+ position: "relative"
70
+ };
124
71
  }
125
72
  function getRootStyle(params) {
126
- const { context, computed } = params;
127
- const isVertical = computed("isVertical");
128
- const isRtl = computed("isRtl");
129
- const range = getRangeOffsets(params);
130
- const thumbSize = context.get("thumbSize");
131
- const offsetStyles = context.get("value").reduce((styles, value, index) => {
132
- const offset = getThumbOffset(params, value);
133
- return { ...styles, [`--slider-thumb-offset-${index}`]: offset };
134
- }, {});
135
- return {
136
- ...offsetStyles,
137
- "--slider-thumb-width": (0, import_utils.toPx)(thumbSize?.width),
138
- "--slider-thumb-height": (0, import_utils.toPx)(thumbSize?.height),
139
- "--slider-thumb-transform": isVertical ? "translateY(50%)" : isRtl ? "translateX(50%)" : "translateX(-50%)",
140
- "--slider-range-start": range.start,
141
- "--slider-range-end": range.end
142
- };
73
+ const { context, computed } = params;
74
+ const isVertical = computed("isVertical");
75
+ const isRtl = computed("isRtl");
76
+ const range = getRangeOffsets(params);
77
+ const thumbSize = context.get("thumbSize");
78
+ return {
79
+ ...context.get("value").reduce((styles, value, index) => {
80
+ const offset = getThumbOffset(params, value);
81
+ return {
82
+ ...styles,
83
+ [`--slider-thumb-offset-${index}`]: offset
84
+ };
85
+ }, {}),
86
+ "--slider-thumb-width": (0, _zag_js_utils.toPx)(thumbSize?.width),
87
+ "--slider-thumb-height": (0, _zag_js_utils.toPx)(thumbSize?.height),
88
+ "--slider-thumb-transform": isVertical ? "translateY(50%)" : isRtl ? "translateX(50%)" : "translateX(-50%)",
89
+ "--slider-range-start": range.start,
90
+ "--slider-range-end": range.end
91
+ };
143
92
  }
144
93
  function getMarkerStyle(params, value) {
145
- const { computed } = params;
146
- const isHorizontal = computed("isHorizontal");
147
- const isRtl = computed("isRtl");
148
- return {
149
- visibility: getVisibility(params),
150
- position: "absolute",
151
- pointerEvents: "none",
152
- [isHorizontal ? "insetInlineStart" : "bottom"]: getThumbOffset(params, value),
153
- translate: "var(--translate-x) var(--translate-y)",
154
- "--translate-x": isHorizontal ? isRtl ? "50%" : "-50%" : "0%",
155
- "--translate-y": !isHorizontal ? "50%" : "0%"
156
- };
94
+ const { computed } = params;
95
+ const isHorizontal = computed("isHorizontal");
96
+ const isRtl = computed("isRtl");
97
+ return {
98
+ visibility: getVisibility(params),
99
+ position: "absolute",
100
+ pointerEvents: "none",
101
+ [isHorizontal ? "insetInlineStart" : "bottom"]: getThumbOffset(params, value),
102
+ translate: "var(--translate-x) var(--translate-y)",
103
+ "--translate-x": isHorizontal ? isRtl ? "50%" : "-50%" : "0%",
104
+ "--translate-y": !isHorizontal ? "50%" : "0%"
105
+ };
157
106
  }
158
107
  function getMarkerGroupStyle() {
159
- return {
160
- userSelect: "none",
161
- WebkitUserSelect: "none",
162
- pointerEvents: "none",
163
- position: "relative"
164
- };
108
+ return {
109
+ userSelect: "none",
110
+ WebkitUserSelect: "none",
111
+ pointerEvents: "none",
112
+ position: "relative"
113
+ };
165
114
  }
166
- // Annotate the CommonJS export names for ESM import in node:
167
- 0 && (module.exports = {
168
- getControlStyle,
169
- getMarkerGroupStyle,
170
- getMarkerStyle,
171
- getRangeOffsets,
172
- getRangeStyle,
173
- getRootStyle,
174
- getThumbOffset,
175
- getThumbStyle,
176
- getVisibility
177
- });
115
+ exports.getControlStyle = getControlStyle;
116
+ exports.getMarkerGroupStyle = getMarkerGroupStyle;
117
+ exports.getMarkerStyle = getMarkerStyle;
118
+ exports.getRangeOffsets = getRangeOffsets;
119
+ exports.getRangeStyle = getRangeStyle;
120
+ exports.getRootStyle = getRootStyle;
121
+ exports.getThumbOffset = getThumbOffset;
122
+ exports.getThumbStyle = getThumbStyle;
123
+ exports.getVisibility = getVisibility;