@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.
- package/dist/index.d.mts +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +16 -38
- package/dist/index.mjs +2 -7
- package/dist/slider.anatomy.d.mts +2 -6
- package/dist/slider.anatomy.d.ts +2 -6
- package/dist/slider.anatomy.js +8 -44
- package/dist/slider.anatomy.mjs +4 -18
- package/dist/slider.connect.d.mts +3 -7
- package/dist/slider.connect.d.ts +3 -7
- package/dist/slider.connect.js +403 -372
- package/dist/slider.connect.mjs +399 -352
- package/dist/slider.dom.d.mts +15 -30
- package/dist/slider.dom.d.ts +15 -30
- package/dist/slider.dom.js +56 -141
- package/dist/slider.dom.mjs +40 -97
- package/dist/slider.machine.d.mts +2 -7
- package/dist/slider.machine.d.ts +2 -7
- package/dist/slider.machine.js +372 -368
- package/dist/slider.machine.mjs +368 -352
- package/dist/slider.props.d.mts +7 -12
- package/dist/slider.props.d.ts +7 -12
- package/dist/slider.props.js +49 -73
- package/dist/slider.props.mjs +40 -43
- package/dist/slider.style.d.mts +15 -17
- package/dist/slider.style.d.ts +15 -17
- package/dist/slider.style.js +103 -157
- package/dist/slider.style.mjs +91 -124
- package/dist/slider.types.d.mts +402 -377
- package/dist/slider.types.d.ts +402 -377
- package/dist/slider.types.js +4 -18
- package/dist/slider.types.mjs +1 -0
- package/dist/slider.utils.d.mts +23 -27
- package/dist/slider.utils.d.ts +23 -27
- package/dist/slider.utils.js +196 -205
- package/dist/slider.utils.mjs +180 -176
- package/package.json +7 -7
package/dist/slider.props.d.mts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
7
|
-
declare const
|
|
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">];
|
package/dist/slider.props.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
7
|
-
declare const
|
|
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">];
|
package/dist/slider.props.js
CHANGED
|
@@ -1,75 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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;
|
package/dist/slider.props.mjs
CHANGED
|
@@ -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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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 };
|
package/dist/slider.style.d.mts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
-
|
|
8
|
-
|
|
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, "
|
|
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 {};
|
package/dist/slider.style.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Style } from
|
|
3
|
-
import {
|
|
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
|
-
|
|
8
|
-
|
|
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, "
|
|
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 {};
|
package/dist/slider.style.js
CHANGED
|
@@ -1,177 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
70
|
-
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
65
|
+
return {
|
|
66
|
+
touchAction: "none",
|
|
67
|
+
userSelect: "none",
|
|
68
|
+
WebkitUserSelect: "none",
|
|
69
|
+
position: "relative"
|
|
70
|
+
};
|
|
124
71
|
}
|
|
125
72
|
function getRootStyle(params) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
108
|
+
return {
|
|
109
|
+
userSelect: "none",
|
|
110
|
+
WebkitUserSelect: "none",
|
|
111
|
+
pointerEvents: "none",
|
|
112
|
+
position: "relative"
|
|
113
|
+
};
|
|
165
114
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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;
|