@zag-js/radio-group 0.10.3 → 0.10.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/radio-group.anatomy.d.ts +3 -3
- package/dist/radio-group.dom.d.ts +7 -7
- package/dist/radio-group.machine.d.ts +1 -1
- package/dist/radio-group.machine.js +1 -5
- package/dist/radio-group.machine.mjs +1 -5
- package/package.json +9 -9
- package/src/radio-group.machine.ts +1 -5
- package/src/radio-group.types.ts +0 -5
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const anatomy: AnatomyInstance<"
|
|
3
|
-
export declare const parts: Record<"
|
|
1
|
+
import { AnatomyInstance, AnatomyPart } from '@zag-js/anatomy';
|
|
2
|
+
export declare const anatomy: AnatomyInstance<"root" | "label" | "radio" | "radioLabel" | "radioControl" | "radioInput" | "indicator">;
|
|
3
|
+
export declare const parts: Record<"root" | "label" | "radio" | "radioLabel" | "radioControl" | "radioInput" | "indicator", AnatomyPart>;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { MachineContext as Ctx } from "./radio-group.types";
|
|
2
2
|
export declare const dom: {
|
|
3
3
|
getRootNode: (ctx: {
|
|
4
|
-
getRootNode?: (() => Node |
|
|
5
|
-
}) =>
|
|
4
|
+
getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
|
|
5
|
+
}) => Document | ShadowRoot;
|
|
6
6
|
getDoc: (ctx: {
|
|
7
|
-
getRootNode?: (() => Node |
|
|
7
|
+
getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
|
|
8
8
|
}) => Document;
|
|
9
9
|
getWin: (ctx: {
|
|
10
|
-
getRootNode?: (() => Node |
|
|
10
|
+
getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
|
|
11
11
|
}) => Window & typeof globalThis;
|
|
12
12
|
getActiveElement: (ctx: {
|
|
13
|
-
getRootNode?: (() => Node |
|
|
13
|
+
getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
|
|
14
14
|
}) => HTMLElement | null;
|
|
15
15
|
getById: <T extends HTMLElement = HTMLElement>(ctx: {
|
|
16
|
-
getRootNode?: (() => Node |
|
|
16
|
+
getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
|
|
17
17
|
}, id: string) => T | null;
|
|
18
18
|
queryById: <T_1 extends HTMLElement = HTMLElement>(ctx: {
|
|
19
|
-
getRootNode?: (() => Node |
|
|
19
|
+
getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
|
|
20
20
|
}, id: string) => T_1;
|
|
21
21
|
} & {
|
|
22
22
|
getRootId: (ctx: Ctx) => string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Machine, StateMachine } from '@zag-js/core';
|
|
2
2
|
import type { MachineContext, MachineState, UserDefinedContext } from "./radio-group.types";
|
|
3
3
|
export declare function machine(userContext: UserDefinedContext): Machine<MachineContext, MachineState, StateMachine.AnyEventObject>;
|
|
@@ -16,7 +16,6 @@ function machine(userContext) {
|
|
|
16
16
|
id: "radio",
|
|
17
17
|
initial: "idle",
|
|
18
18
|
context: {
|
|
19
|
-
previousValue: null,
|
|
20
19
|
value: null,
|
|
21
20
|
activeId: null,
|
|
22
21
|
focusedId: null,
|
|
@@ -91,11 +90,8 @@ function machine(userContext) {
|
|
|
91
90
|
input.checked = input.value === ctx2.value;
|
|
92
91
|
});
|
|
93
92
|
},
|
|
94
|
-
setPreviousValue(ctx2) {
|
|
95
|
-
ctx2.previousValue = ctx2.value;
|
|
96
|
-
},
|
|
97
93
|
setIndicatorTransition(ctx2) {
|
|
98
|
-
ctx2.canIndicatorTransition = utils.isString(ctx2.
|
|
94
|
+
ctx2.canIndicatorTransition = utils.isString(ctx2.value);
|
|
99
95
|
},
|
|
100
96
|
cleanupObserver(ctx2) {
|
|
101
97
|
ctx2.indicatorCleanup?.();
|
|
@@ -12,7 +12,6 @@ function machine(userContext) {
|
|
|
12
12
|
id: "radio",
|
|
13
13
|
initial: "idle",
|
|
14
14
|
context: {
|
|
15
|
-
previousValue: null,
|
|
16
15
|
value: null,
|
|
17
16
|
activeId: null,
|
|
18
17
|
focusedId: null,
|
|
@@ -87,11 +86,8 @@ function machine(userContext) {
|
|
|
87
86
|
input.checked = input.value === ctx2.value;
|
|
88
87
|
});
|
|
89
88
|
},
|
|
90
|
-
setPreviousValue(ctx2) {
|
|
91
|
-
ctx2.previousValue = ctx2.value;
|
|
92
|
-
},
|
|
93
89
|
setIndicatorTransition(ctx2) {
|
|
94
|
-
ctx2.canIndicatorTransition = isString(ctx2.
|
|
90
|
+
ctx2.canIndicatorTransition = isString(ctx2.value);
|
|
95
91
|
},
|
|
96
92
|
cleanupObserver(ctx2) {
|
|
97
93
|
ctx2.indicatorCleanup?.();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/radio-group",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "Core logic for the radio group widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@zag-js/anatomy": "0.10.
|
|
32
|
-
"@zag-js/dom-query": "0.10.
|
|
33
|
-
"@zag-js/element-rect": "0.10.
|
|
34
|
-
"@zag-js/form-utils": "0.10.
|
|
35
|
-
"@zag-js/visually-hidden": "0.10.
|
|
36
|
-
"@zag-js/utils": "0.10.
|
|
37
|
-
"@zag-js/core": "0.10.
|
|
38
|
-
"@zag-js/types": "0.10.
|
|
31
|
+
"@zag-js/anatomy": "0.10.4",
|
|
32
|
+
"@zag-js/dom-query": "0.10.4",
|
|
33
|
+
"@zag-js/element-rect": "0.10.4",
|
|
34
|
+
"@zag-js/form-utils": "0.10.4",
|
|
35
|
+
"@zag-js/visually-hidden": "0.10.4",
|
|
36
|
+
"@zag-js/utils": "0.10.4",
|
|
37
|
+
"@zag-js/core": "0.10.4",
|
|
38
|
+
"@zag-js/types": "0.10.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"clean-package": "2.2.0"
|
|
@@ -13,7 +13,6 @@ export function machine(userContext: UserDefinedContext) {
|
|
|
13
13
|
id: "radio",
|
|
14
14
|
initial: "idle",
|
|
15
15
|
context: {
|
|
16
|
-
previousValue: null,
|
|
17
16
|
value: null,
|
|
18
17
|
activeId: null,
|
|
19
18
|
focusedId: null,
|
|
@@ -96,11 +95,8 @@ export function machine(userContext: UserDefinedContext) {
|
|
|
96
95
|
input.checked = input.value === ctx.value
|
|
97
96
|
})
|
|
98
97
|
},
|
|
99
|
-
setPreviousValue(ctx) {
|
|
100
|
-
ctx.previousValue = ctx.value
|
|
101
|
-
},
|
|
102
98
|
setIndicatorTransition(ctx) {
|
|
103
|
-
ctx.canIndicatorTransition = isString(ctx.
|
|
99
|
+
ctx.canIndicatorTransition = isString(ctx.value)
|
|
104
100
|
},
|
|
105
101
|
cleanupObserver(ctx) {
|
|
106
102
|
ctx.indicatorCleanup?.()
|
package/src/radio-group.types.ts
CHANGED
|
@@ -81,11 +81,6 @@ type PrivateContext = Context<{
|
|
|
81
81
|
* Function to clean up the observer for the active tab's rect
|
|
82
82
|
*/
|
|
83
83
|
indicatorCleanup?: VoidFunction | null
|
|
84
|
-
/**
|
|
85
|
-
* @internal
|
|
86
|
-
* The previous value of the radio group
|
|
87
|
-
*/
|
|
88
|
-
previousValue: string | null
|
|
89
84
|
}>
|
|
90
85
|
|
|
91
86
|
export type UserDefinedContext = RequiredBy<PublicContext, "id">
|