@zag-js/radio-group 0.0.0-dev-20230222120620 → 0.0.0-dev-20230223072304
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.
|
@@ -47,14 +47,29 @@ function connect(state, send, normalize) {
|
|
|
47
47
|
firstEnabledInput?.focus();
|
|
48
48
|
};
|
|
49
49
|
return {
|
|
50
|
+
/**
|
|
51
|
+
* The current value of the radio group
|
|
52
|
+
*/
|
|
50
53
|
value: state.context.value,
|
|
54
|
+
/**
|
|
55
|
+
* Function to set the value of the radio group
|
|
56
|
+
*/
|
|
51
57
|
setValue(value) {
|
|
52
58
|
send({ type: "SET_VALUE", value, manual: true });
|
|
53
59
|
},
|
|
60
|
+
/**
|
|
61
|
+
* Function to clear the value of the radio group
|
|
62
|
+
*/
|
|
54
63
|
clearValue() {
|
|
55
64
|
send({ type: "SET_VALUE", value: null, manual: true });
|
|
56
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* Function to focus the radio group
|
|
68
|
+
*/
|
|
57
69
|
focus,
|
|
70
|
+
/**
|
|
71
|
+
* Function to blur the currently focused radio input in the radio group
|
|
72
|
+
*/
|
|
58
73
|
blur() {
|
|
59
74
|
const focusedElement = dom.getActiveElement(state.context);
|
|
60
75
|
const inputEls = dom.getInputEls(state.context);
|
|
@@ -62,6 +77,10 @@ function connect(state, send, normalize) {
|
|
|
62
77
|
if (radioInputIsFocused)
|
|
63
78
|
focusedElement?.blur();
|
|
64
79
|
},
|
|
80
|
+
/**
|
|
81
|
+
* Returns the state details of a radio input
|
|
82
|
+
*/
|
|
83
|
+
getRadioState,
|
|
65
84
|
rootProps: normalize.element({
|
|
66
85
|
...parts.root.attrs,
|
|
67
86
|
role: "radiogroup",
|
package/dist/index.js
CHANGED
|
@@ -102,14 +102,29 @@ function connect(state, send, normalize) {
|
|
|
102
102
|
firstEnabledInput?.focus();
|
|
103
103
|
};
|
|
104
104
|
return {
|
|
105
|
+
/**
|
|
106
|
+
* The current value of the radio group
|
|
107
|
+
*/
|
|
105
108
|
value: state.context.value,
|
|
109
|
+
/**
|
|
110
|
+
* Function to set the value of the radio group
|
|
111
|
+
*/
|
|
106
112
|
setValue(value) {
|
|
107
113
|
send({ type: "SET_VALUE", value, manual: true });
|
|
108
114
|
},
|
|
115
|
+
/**
|
|
116
|
+
* Function to clear the value of the radio group
|
|
117
|
+
*/
|
|
109
118
|
clearValue() {
|
|
110
119
|
send({ type: "SET_VALUE", value: null, manual: true });
|
|
111
120
|
},
|
|
121
|
+
/**
|
|
122
|
+
* Function to focus the radio group
|
|
123
|
+
*/
|
|
112
124
|
focus,
|
|
125
|
+
/**
|
|
126
|
+
* Function to blur the currently focused radio input in the radio group
|
|
127
|
+
*/
|
|
113
128
|
blur() {
|
|
114
129
|
const focusedElement = dom.getActiveElement(state.context);
|
|
115
130
|
const inputEls = dom.getInputEls(state.context);
|
|
@@ -117,6 +132,10 @@ function connect(state, send, normalize) {
|
|
|
117
132
|
if (radioInputIsFocused)
|
|
118
133
|
focusedElement?.blur();
|
|
119
134
|
},
|
|
135
|
+
/**
|
|
136
|
+
* Returns the state details of a radio input
|
|
137
|
+
*/
|
|
138
|
+
getRadioState,
|
|
120
139
|
rootProps: normalize.element({
|
|
121
140
|
...parts.root.attrs,
|
|
122
141
|
role: "radiogroup",
|
package/dist/index.mjs
CHANGED
|
@@ -3,11 +3,39 @@ import { State, Send, RadioProps, InputProps } from './radio-group.types.js';
|
|
|
3
3
|
import '@zag-js/core';
|
|
4
4
|
|
|
5
5
|
declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
|
|
6
|
+
/**
|
|
7
|
+
* The current value of the radio group
|
|
8
|
+
*/
|
|
6
9
|
value: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Function to set the value of the radio group
|
|
12
|
+
*/
|
|
7
13
|
setValue(value: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Function to clear the value of the radio group
|
|
16
|
+
*/
|
|
8
17
|
clearValue(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Function to focus the radio group
|
|
20
|
+
*/
|
|
9
21
|
focus: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Function to blur the currently focused radio input in the radio group
|
|
24
|
+
*/
|
|
10
25
|
blur(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the state details of a radio input
|
|
28
|
+
*/
|
|
29
|
+
getRadioState: <T_1 extends RadioProps>(props: T_1) => {
|
|
30
|
+
isInteractive: boolean;
|
|
31
|
+
isReadOnly: boolean | undefined;
|
|
32
|
+
isInvalid: boolean | undefined;
|
|
33
|
+
isDisabled: boolean | undefined;
|
|
34
|
+
isChecked: boolean;
|
|
35
|
+
isFocused: boolean;
|
|
36
|
+
isHovered: boolean;
|
|
37
|
+
isActive: boolean;
|
|
38
|
+
};
|
|
11
39
|
rootProps: T["element"];
|
|
12
40
|
labelProps: T["element"];
|
|
13
41
|
getRadioProps(props: RadioProps): T["label"];
|
|
@@ -98,14 +98,29 @@ function connect(state, send, normalize) {
|
|
|
98
98
|
firstEnabledInput?.focus();
|
|
99
99
|
};
|
|
100
100
|
return {
|
|
101
|
+
/**
|
|
102
|
+
* The current value of the radio group
|
|
103
|
+
*/
|
|
101
104
|
value: state.context.value,
|
|
105
|
+
/**
|
|
106
|
+
* Function to set the value of the radio group
|
|
107
|
+
*/
|
|
102
108
|
setValue(value) {
|
|
103
109
|
send({ type: "SET_VALUE", value, manual: true });
|
|
104
110
|
},
|
|
111
|
+
/**
|
|
112
|
+
* Function to clear the value of the radio group
|
|
113
|
+
*/
|
|
105
114
|
clearValue() {
|
|
106
115
|
send({ type: "SET_VALUE", value: null, manual: true });
|
|
107
116
|
},
|
|
117
|
+
/**
|
|
118
|
+
* Function to focus the radio group
|
|
119
|
+
*/
|
|
108
120
|
focus,
|
|
121
|
+
/**
|
|
122
|
+
* Function to blur the currently focused radio input in the radio group
|
|
123
|
+
*/
|
|
109
124
|
blur() {
|
|
110
125
|
const focusedElement = dom.getActiveElement(state.context);
|
|
111
126
|
const inputEls = dom.getInputEls(state.context);
|
|
@@ -113,6 +128,10 @@ function connect(state, send, normalize) {
|
|
|
113
128
|
if (radioInputIsFocused)
|
|
114
129
|
focusedElement?.blur();
|
|
115
130
|
},
|
|
131
|
+
/**
|
|
132
|
+
* Returns the state details of a radio input
|
|
133
|
+
*/
|
|
134
|
+
getRadioState,
|
|
116
135
|
rootProps: normalize.element({
|
|
117
136
|
...parts.root.attrs,
|
|
118
137
|
role: "radiogroup",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/radio-group",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230223072304",
|
|
4
4
|
"description": "Core logic for the radio group widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@zag-js/anatomy": "0.1.4",
|
|
31
|
-
"@zag-js/dom-query": "0.0.0-dev-
|
|
32
|
-
"@zag-js/form-utils": "0.0.0-dev-
|
|
33
|
-
"@zag-js/visually-hidden": "0.0.0-dev-
|
|
31
|
+
"@zag-js/dom-query": "0.0.0-dev-20230223072304",
|
|
32
|
+
"@zag-js/form-utils": "0.0.0-dev-20230223072304",
|
|
33
|
+
"@zag-js/visually-hidden": "0.0.0-dev-20230223072304",
|
|
34
34
|
"@zag-js/utils": "0.3.3",
|
|
35
|
-
"@zag-js/core": "0.0.0-dev-
|
|
35
|
+
"@zag-js/core": "0.0.0-dev-20230223072304",
|
|
36
36
|
"@zag-js/types": "0.3.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|