@zag-js/slider 0.0.0-dev-20221208135830 → 0.0.0-dev-20221208142334
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.ts +14 -14
- package/dist/index.js +10 -10
- package/dist/index.mjs +10 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -796,57 +796,57 @@ declare const anatomy: Omit<{
|
|
|
796
796
|
}>;
|
|
797
797
|
}, "parts">;
|
|
798
798
|
extend: <V_20 extends string>(...parts: V_20[]) => Omit<any, "parts">;
|
|
799
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
799
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17 | V_18 | V_19, {
|
|
800
800
|
selector: string;
|
|
801
801
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
802
802
|
}>;
|
|
803
803
|
}, "parts">;
|
|
804
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
804
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17 | V_18, {
|
|
805
805
|
selector: string;
|
|
806
806
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
807
807
|
}>;
|
|
808
808
|
}, "parts">;
|
|
809
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
809
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17, {
|
|
810
810
|
selector: string;
|
|
811
811
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
812
812
|
}>;
|
|
813
813
|
}, "parts">;
|
|
814
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
814
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16, {
|
|
815
815
|
selector: string;
|
|
816
816
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
817
817
|
}>;
|
|
818
818
|
}, "parts">;
|
|
819
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
819
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15, {
|
|
820
820
|
selector: string;
|
|
821
821
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
822
822
|
}>;
|
|
823
823
|
}, "parts">;
|
|
824
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
824
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10 | V_11 | V_12 | V_13 | V_14, {
|
|
825
825
|
selector: string;
|
|
826
826
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
827
827
|
}>;
|
|
828
828
|
}, "parts">;
|
|
829
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
829
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10 | V_11 | V_12 | V_13, {
|
|
830
830
|
selector: string;
|
|
831
831
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
832
832
|
}>;
|
|
833
833
|
}, "parts">;
|
|
834
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
834
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10 | V_11 | V_12, {
|
|
835
835
|
selector: string;
|
|
836
836
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
837
837
|
}>;
|
|
838
838
|
}, "parts">;
|
|
839
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
839
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10 | V_11, {
|
|
840
840
|
selector: string;
|
|
841
841
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
842
842
|
}>;
|
|
843
843
|
}, "parts">;
|
|
844
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
844
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker" | V_10, {
|
|
845
845
|
selector: string;
|
|
846
846
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
847
847
|
}>;
|
|
848
848
|
}, "parts">;
|
|
849
|
-
build: () => Record<"root" | "label" | "thumb" | "
|
|
849
|
+
build: () => Record<"root" | "label" | "thumb" | "hiddenInput" | "output" | "track" | "range" | "control" | "markerGroup" | "marker", {
|
|
850
850
|
selector: string;
|
|
851
851
|
attrs: Record<"data-scope" | "data-part", string>;
|
|
852
852
|
}>;
|
|
@@ -1022,7 +1022,7 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
|
|
|
1022
1022
|
rootProps: T["element"];
|
|
1023
1023
|
labelProps: T["label"];
|
|
1024
1024
|
thumbProps: T["element"];
|
|
1025
|
-
|
|
1025
|
+
hiddenInputProps: T["input"];
|
|
1026
1026
|
outputProps: T["output"];
|
|
1027
1027
|
trackProps: T["element"];
|
|
1028
1028
|
rangeProps: T["element"];
|
|
@@ -1057,7 +1057,7 @@ declare const dom: {
|
|
|
1057
1057
|
getRootId: (ctx: MachineContext) => string;
|
|
1058
1058
|
getThumbId: (ctx: MachineContext) => string;
|
|
1059
1059
|
getControlId: (ctx: MachineContext) => string;
|
|
1060
|
-
|
|
1060
|
+
getHiddenInputId: (ctx: MachineContext) => string;
|
|
1061
1061
|
getOutputId: (ctx: MachineContext) => string;
|
|
1062
1062
|
getTrackId: (ctx: MachineContext) => string;
|
|
1063
1063
|
getRangeId: (ctx: MachineContext) => string;
|
|
@@ -1066,7 +1066,7 @@ declare const dom: {
|
|
|
1066
1066
|
getRootEl: (ctx: MachineContext) => HTMLElement | null;
|
|
1067
1067
|
getThumbEl: (ctx: MachineContext) => HTMLElement | null;
|
|
1068
1068
|
getControlEl: (ctx: MachineContext) => HTMLElement | null;
|
|
1069
|
-
|
|
1069
|
+
getHiddenInputEl: (ctx: MachineContext) => HTMLInputElement | null;
|
|
1070
1070
|
getValueFromPoint(ctx: MachineContext, point: Point): number | undefined;
|
|
1071
1071
|
dispatchChangeEvent(ctx: MachineContext): void;
|
|
1072
1072
|
getThumbOffset: (ctx: SharedContext) => string;
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var anatomy = (0, import_anatomy.createAnatomy)("slider").parts(
|
|
|
33
33
|
"root",
|
|
34
34
|
"label",
|
|
35
35
|
"thumb",
|
|
36
|
-
"
|
|
36
|
+
"hiddenInput",
|
|
37
37
|
"output",
|
|
38
38
|
"track",
|
|
39
39
|
"range",
|
|
@@ -640,7 +640,7 @@ var dom = defineDomHelpers({
|
|
|
640
640
|
var _a, _b;
|
|
641
641
|
return (_b = (_a = ctx.ids) == null ? void 0 : _a.control) != null ? _b : `slider:${ctx.id}:control`;
|
|
642
642
|
},
|
|
643
|
-
|
|
643
|
+
getHiddenInputId: (ctx) => `slider:${ctx.id}:input`,
|
|
644
644
|
getOutputId: (ctx) => {
|
|
645
645
|
var _a, _b;
|
|
646
646
|
return (_b = (_a = ctx.ids) == null ? void 0 : _a.output) != null ? _b : `slider:${ctx.id}:output`;
|
|
@@ -661,7 +661,7 @@ var dom = defineDomHelpers({
|
|
|
661
661
|
getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
|
|
662
662
|
getThumbEl: (ctx) => dom.getById(ctx, dom.getThumbId(ctx)),
|
|
663
663
|
getControlEl: (ctx) => dom.getById(ctx, dom.getControlId(ctx)),
|
|
664
|
-
|
|
664
|
+
getHiddenInputEl: (ctx) => dom.getById(ctx, dom.getHiddenInputId(ctx)),
|
|
665
665
|
getValueFromPoint(ctx, point) {
|
|
666
666
|
const el = dom.getControlEl(ctx);
|
|
667
667
|
if (!el)
|
|
@@ -678,7 +678,7 @@ var dom = defineDomHelpers({
|
|
|
678
678
|
return utils.fromPercent(ctx, percent);
|
|
679
679
|
},
|
|
680
680
|
dispatchChangeEvent(ctx) {
|
|
681
|
-
const input = dom.
|
|
681
|
+
const input = dom.getHiddenInputEl(ctx);
|
|
682
682
|
if (!input)
|
|
683
683
|
return;
|
|
684
684
|
dispatchInputValueEvent(input, ctx.value);
|
|
@@ -733,7 +733,7 @@ function connect(state2, send, normalize) {
|
|
|
733
733
|
"data-invalid": dataAttr(isInvalid),
|
|
734
734
|
"data-focus": dataAttr(isFocused),
|
|
735
735
|
id: dom.getLabelId(state2.context),
|
|
736
|
-
htmlFor: dom.
|
|
736
|
+
htmlFor: dom.getHiddenInputId(state2.context),
|
|
737
737
|
onClick(event) {
|
|
738
738
|
var _a2;
|
|
739
739
|
if (!isInteractive)
|
|
@@ -818,13 +818,13 @@ function connect(state2, send, normalize) {
|
|
|
818
818
|
},
|
|
819
819
|
style: dom.getThumbStyle(state2.context)
|
|
820
820
|
}),
|
|
821
|
-
|
|
822
|
-
...parts.
|
|
821
|
+
hiddenInputProps: normalize.input({
|
|
822
|
+
...parts.hiddenInput.attrs,
|
|
823
823
|
type: "text",
|
|
824
824
|
defaultValue: state2.context.value,
|
|
825
825
|
name: state2.context.name,
|
|
826
826
|
form: state2.context.form,
|
|
827
|
-
id: dom.
|
|
827
|
+
id: dom.getHiddenInputId(state2.context),
|
|
828
828
|
hidden: true
|
|
829
829
|
}),
|
|
830
830
|
outputProps: normalize.output({
|
|
@@ -832,7 +832,7 @@ function connect(state2, send, normalize) {
|
|
|
832
832
|
"data-disabled": dataAttr(isDisabled),
|
|
833
833
|
"data-invalid": dataAttr(isInvalid),
|
|
834
834
|
id: dom.getOutputId(state2.context),
|
|
835
|
-
htmlFor: dom.
|
|
835
|
+
htmlFor: dom.getHiddenInputId(state2.context),
|
|
836
836
|
"aria-live": "off"
|
|
837
837
|
}),
|
|
838
838
|
trackProps: normalize.element({
|
|
@@ -1035,7 +1035,7 @@ function machine(userContext) {
|
|
|
1035
1035
|
},
|
|
1036
1036
|
activities: {
|
|
1037
1037
|
trackFormControlState(ctx2) {
|
|
1038
|
-
return trackFormControl(dom.
|
|
1038
|
+
return trackFormControl(dom.getHiddenInputEl(ctx2), {
|
|
1039
1039
|
onFieldsetDisabled() {
|
|
1040
1040
|
ctx2.disabled = true;
|
|
1041
1041
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ var anatomy = createAnatomy("slider").parts(
|
|
|
4
4
|
"root",
|
|
5
5
|
"label",
|
|
6
6
|
"thumb",
|
|
7
|
-
"
|
|
7
|
+
"hiddenInput",
|
|
8
8
|
"output",
|
|
9
9
|
"track",
|
|
10
10
|
"range",
|
|
@@ -611,7 +611,7 @@ var dom = defineDomHelpers({
|
|
|
611
611
|
var _a, _b;
|
|
612
612
|
return (_b = (_a = ctx.ids) == null ? void 0 : _a.control) != null ? _b : `slider:${ctx.id}:control`;
|
|
613
613
|
},
|
|
614
|
-
|
|
614
|
+
getHiddenInputId: (ctx) => `slider:${ctx.id}:input`,
|
|
615
615
|
getOutputId: (ctx) => {
|
|
616
616
|
var _a, _b;
|
|
617
617
|
return (_b = (_a = ctx.ids) == null ? void 0 : _a.output) != null ? _b : `slider:${ctx.id}:output`;
|
|
@@ -632,7 +632,7 @@ var dom = defineDomHelpers({
|
|
|
632
632
|
getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
|
|
633
633
|
getThumbEl: (ctx) => dom.getById(ctx, dom.getThumbId(ctx)),
|
|
634
634
|
getControlEl: (ctx) => dom.getById(ctx, dom.getControlId(ctx)),
|
|
635
|
-
|
|
635
|
+
getHiddenInputEl: (ctx) => dom.getById(ctx, dom.getHiddenInputId(ctx)),
|
|
636
636
|
getValueFromPoint(ctx, point) {
|
|
637
637
|
const el = dom.getControlEl(ctx);
|
|
638
638
|
if (!el)
|
|
@@ -649,7 +649,7 @@ var dom = defineDomHelpers({
|
|
|
649
649
|
return utils.fromPercent(ctx, percent);
|
|
650
650
|
},
|
|
651
651
|
dispatchChangeEvent(ctx) {
|
|
652
|
-
const input = dom.
|
|
652
|
+
const input = dom.getHiddenInputEl(ctx);
|
|
653
653
|
if (!input)
|
|
654
654
|
return;
|
|
655
655
|
dispatchInputValueEvent(input, ctx.value);
|
|
@@ -704,7 +704,7 @@ function connect(state2, send, normalize) {
|
|
|
704
704
|
"data-invalid": dataAttr(isInvalid),
|
|
705
705
|
"data-focus": dataAttr(isFocused),
|
|
706
706
|
id: dom.getLabelId(state2.context),
|
|
707
|
-
htmlFor: dom.
|
|
707
|
+
htmlFor: dom.getHiddenInputId(state2.context),
|
|
708
708
|
onClick(event) {
|
|
709
709
|
var _a2;
|
|
710
710
|
if (!isInteractive)
|
|
@@ -789,13 +789,13 @@ function connect(state2, send, normalize) {
|
|
|
789
789
|
},
|
|
790
790
|
style: dom.getThumbStyle(state2.context)
|
|
791
791
|
}),
|
|
792
|
-
|
|
793
|
-
...parts.
|
|
792
|
+
hiddenInputProps: normalize.input({
|
|
793
|
+
...parts.hiddenInput.attrs,
|
|
794
794
|
type: "text",
|
|
795
795
|
defaultValue: state2.context.value,
|
|
796
796
|
name: state2.context.name,
|
|
797
797
|
form: state2.context.form,
|
|
798
|
-
id: dom.
|
|
798
|
+
id: dom.getHiddenInputId(state2.context),
|
|
799
799
|
hidden: true
|
|
800
800
|
}),
|
|
801
801
|
outputProps: normalize.output({
|
|
@@ -803,7 +803,7 @@ function connect(state2, send, normalize) {
|
|
|
803
803
|
"data-disabled": dataAttr(isDisabled),
|
|
804
804
|
"data-invalid": dataAttr(isInvalid),
|
|
805
805
|
id: dom.getOutputId(state2.context),
|
|
806
|
-
htmlFor: dom.
|
|
806
|
+
htmlFor: dom.getHiddenInputId(state2.context),
|
|
807
807
|
"aria-live": "off"
|
|
808
808
|
}),
|
|
809
809
|
trackProps: normalize.element({
|
|
@@ -1006,7 +1006,7 @@ function machine(userContext) {
|
|
|
1006
1006
|
},
|
|
1007
1007
|
activities: {
|
|
1008
1008
|
trackFormControlState(ctx2) {
|
|
1009
|
-
return trackFormControl(dom.
|
|
1009
|
+
return trackFormControl(dom.getHiddenInputEl(ctx2), {
|
|
1010
1010
|
onFieldsetDisabled() {
|
|
1011
1011
|
ctx2.disabled = true;
|
|
1012
1012
|
},
|
package/package.json
CHANGED