@hanzogui/radio-group 3.0.2 → 7.3.0
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/LICENSE +40 -19
- package/dist/cjs/RadioGroup.cjs +108 -106
- package/dist/cjs/RadioGroup.native.js +110 -108
- package/dist/cjs/RadioGroup.native.js.map +1 -1
- package/dist/cjs/RadioGroupStyledContext.cjs +14 -12
- package/dist/cjs/RadioGroupStyledContext.native.js +17 -15
- package/dist/cjs/RadioGroupStyledContext.native.js.map +1 -1
- package/dist/cjs/createRadioGroup.cjs +134 -124
- package/dist/cjs/createRadioGroup.native.js +135 -125
- package/dist/cjs/createRadioGroup.native.js.map +1 -1
- package/dist/cjs/index.cjs +15 -13
- package/dist/cjs/index.native.js +15 -13
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/RadioGroup.mjs +93 -93
- package/dist/esm/RadioGroup.mjs.map +1 -1
- package/dist/esm/RadioGroup.native.js +95 -95
- package/dist/esm/RadioGroup.native.js.map +1 -1
- package/dist/esm/createRadioGroup.mjs +103 -95
- package/dist/esm/createRadioGroup.mjs.map +1 -1
- package/dist/esm/createRadioGroup.native.js +103 -95
- package/dist/esm/createRadioGroup.native.js.map +1 -1
- package/dist/jsx/RadioGroup.mjs +93 -93
- package/dist/jsx/RadioGroup.mjs.map +1 -1
- package/dist/jsx/RadioGroup.native.js +110 -108
- package/dist/jsx/RadioGroup.native.js.map +1 -1
- package/dist/jsx/RadioGroupStyledContext.native.js +17 -15
- package/dist/jsx/RadioGroupStyledContext.native.js.map +1 -1
- package/dist/jsx/createRadioGroup.mjs +103 -95
- package/dist/jsx/createRadioGroup.mjs.map +1 -1
- package/dist/jsx/createRadioGroup.native.js +135 -125
- package/dist/jsx/createRadioGroup.native.js.map +1 -1
- package/dist/jsx/index.native.js +15 -13
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +22 -20
- package/src/RadioGroup.tsx +2 -2
- package/types/RadioGroup.d.ts +10 -10
- package/types/RadioGroup.d.ts.map +1 -0
- package/types/RadioGroupStyledContext.d.ts +2 -2
- package/types/RadioGroupStyledContext.d.ts.map +1 -0
- package/types/createRadioGroup.d.ts +96 -96
- package/types/createRadioGroup.d.ts.map +1 -0
- package/types/index.d.ts +95 -95
- package/types/index.d.ts.map +1 -0
|
@@ -5,29 +5,31 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var RadioGroupStyledContext_exports = {};
|
|
24
26
|
__export(RadioGroupStyledContext_exports, {
|
|
25
27
|
RadioGroupStyledContext: () => RadioGroupStyledContext
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(RadioGroupStyledContext_exports);
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
var import_core = require("@hanzogui/core");
|
|
31
|
+
var RadioGroupStyledContext = (0, import_core.createStyledContext)({
|
|
32
|
+
size: "$true",
|
|
33
|
+
scaleIcon: 1
|
|
34
|
+
}, "RadioGroup");
|
|
33
35
|
//# sourceMappingURL=RadioGroupStyledContext.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","RadioGroupStyledContext_exports","__export","RadioGroupStyledContext","module","exports","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","RadioGroupStyledContext_exports","__export","RadioGroupStyledContext","module","exports","import_core","require","createStyledContext","size","scaleIcon"],"sources":["../../src/RadioGroupStyledContext.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,+BAAA;AAAAC,QAAA,CAAAD,+BAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAAoC,CAAAK,+BAAA;AAE7B,IAAAK,WAAM,GAAAC,OAAA,iBAA0B;AAAA,IACrCJ,uBAAA,OAAAG,WAAA,CAAAE,mBAAA;EAAAC,IACE,SAAM;EAAAC,SACN;AAAW,GACb","ignoreList":[]}
|
|
@@ -2,52 +2,56 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var createRadioGroup_exports = {};
|
|
33
35
|
__export(createRadioGroup_exports, {
|
|
34
36
|
createRadioGroup: () => createRadioGroup
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(createRadioGroup_exports);
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
var import_core = require("@hanzogui/core");
|
|
40
|
+
var import_radio_headless = require("@hanzogui/radio-headless");
|
|
41
|
+
var import_roving_focus = require("@hanzogui/roving-focus");
|
|
42
|
+
var import_react = __toESM(require("react"), 1);
|
|
43
|
+
var import_RadioGroup = require("./RadioGroup.cjs");
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
45
|
const ensureContext = x => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
if (!x.context) {
|
|
47
|
+
x.context = RadioGroupContext;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const RadioGroupContext = import_react.default.createContext({});
|
|
51
|
+
const RadioGroupItemContext = import_react.default.createContext({
|
|
52
|
+
checked: false,
|
|
53
|
+
disabled: false
|
|
54
|
+
});
|
|
51
55
|
function createRadioGroup(createProps) {
|
|
52
56
|
const {
|
|
53
57
|
disableActiveTheme,
|
|
@@ -55,111 +59,117 @@ function createRadioGroup(createProps) {
|
|
|
55
59
|
Indicator = import_RadioGroup.RadioGroupIndicatorFrame,
|
|
56
60
|
Item = import_RadioGroup.RadioGroupItemFrame
|
|
57
61
|
} = createProps;
|
|
58
|
-
ensureContext(Frame)
|
|
62
|
+
ensureContext(Frame);
|
|
63
|
+
ensureContext(Indicator);
|
|
64
|
+
ensureContext(Item);
|
|
59
65
|
const RadioGroupImp = Frame.styleable((props, ref) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const {
|
|
67
|
+
value,
|
|
68
|
+
defaultValue,
|
|
69
|
+
onValueChange,
|
|
70
|
+
required = false,
|
|
71
|
+
disabled = false,
|
|
72
|
+
name,
|
|
73
|
+
native,
|
|
74
|
+
accentColor,
|
|
75
|
+
orientation = "vertical",
|
|
76
|
+
...rest
|
|
77
|
+
} = props;
|
|
78
|
+
const {
|
|
79
|
+
providerValue,
|
|
80
|
+
frameAttrs,
|
|
81
|
+
rovingFocusGroupAttrs
|
|
82
|
+
} = (0, import_radio_headless.useRadioGroup)({
|
|
83
|
+
orientation,
|
|
84
|
+
name,
|
|
85
|
+
defaultValue,
|
|
86
|
+
value,
|
|
87
|
+
onValueChange,
|
|
88
|
+
required,
|
|
89
|
+
disabled,
|
|
90
|
+
native,
|
|
91
|
+
accentColor
|
|
92
|
+
});
|
|
93
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RadioGroupContext.Provider, {
|
|
94
|
+
value: providerValue,
|
|
95
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
|
|
96
|
+
...rovingFocusGroupAttrs,
|
|
97
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupFrame, {
|
|
98
|
+
...frameAttrs,
|
|
99
|
+
ref,
|
|
70
100
|
...rest
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
const RadioGroupItemImp = Item.styleable((props, ref) => {
|
|
106
|
+
const {
|
|
107
|
+
value,
|
|
108
|
+
labelledBy,
|
|
109
|
+
onPress,
|
|
110
|
+
onKeyDown,
|
|
111
|
+
disabled,
|
|
112
|
+
id,
|
|
113
|
+
...rest
|
|
114
|
+
} = props;
|
|
115
|
+
const {
|
|
116
|
+
providerValue,
|
|
117
|
+
bubbleInput,
|
|
118
|
+
rovingFocusGroupAttrs,
|
|
119
|
+
frameAttrs,
|
|
120
|
+
isFormControl,
|
|
121
|
+
native
|
|
122
|
+
} = (0, import_radio_headless.useRadioGroupItem)({
|
|
123
|
+
radioGroupContext: RadioGroupContext,
|
|
124
|
+
value,
|
|
125
|
+
id,
|
|
126
|
+
labelledBy,
|
|
127
|
+
disabled,
|
|
128
|
+
onPress,
|
|
129
|
+
onKeyDown
|
|
130
|
+
});
|
|
131
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, {
|
|
132
|
+
value: providerValue,
|
|
133
|
+
children: import_core.isWeb && native ? bubbleInput : /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
134
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
|
|
90
135
|
...rovingFocusGroupAttrs,
|
|
91
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.
|
|
136
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupItemFrame, {
|
|
92
137
|
...frameAttrs,
|
|
93
138
|
ref,
|
|
94
139
|
...rest
|
|
95
140
|
})
|
|
96
|
-
})
|
|
97
|
-
})
|
|
98
|
-
}),
|
|
99
|
-
RadioGroupItemImp = Item.styleable((props, ref) => {
|
|
100
|
-
const {
|
|
101
|
-
value,
|
|
102
|
-
labelledBy,
|
|
103
|
-
onPress,
|
|
104
|
-
onKeyDown,
|
|
105
|
-
disabled,
|
|
106
|
-
id,
|
|
107
|
-
...rest
|
|
108
|
-
} = props,
|
|
109
|
-
{
|
|
110
|
-
providerValue,
|
|
111
|
-
bubbleInput,
|
|
112
|
-
rovingFocusGroupAttrs,
|
|
113
|
-
frameAttrs,
|
|
114
|
-
isFormControl,
|
|
115
|
-
native
|
|
116
|
-
} = (0, import_gui_radio_headless.useRadioGroupItem)({
|
|
117
|
-
radioGroupContext: RadioGroupContext,
|
|
118
|
-
value,
|
|
119
|
-
id,
|
|
120
|
-
labelledBy,
|
|
121
|
-
disabled,
|
|
122
|
-
onPress,
|
|
123
|
-
onKeyDown
|
|
124
|
-
});
|
|
125
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, {
|
|
126
|
-
value: providerValue,
|
|
127
|
-
children: import_gui_core.isWeb && native ? bubbleInput : /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
128
|
-
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_roving_focus.RovingFocusGroup.Item, {
|
|
129
|
-
...rovingFocusGroupAttrs,
|
|
130
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupItemFrame, {
|
|
131
|
-
...frameAttrs,
|
|
132
|
-
ref,
|
|
133
|
-
...rest
|
|
134
|
-
})
|
|
135
|
-
}), isFormControl && bubbleInput]
|
|
136
|
-
})
|
|
137
|
-
});
|
|
141
|
+
}), isFormControl && bubbleInput]
|
|
142
|
+
})
|
|
138
143
|
});
|
|
144
|
+
});
|
|
139
145
|
RadioGroupItemImp.displayName = "RadioGroupItem";
|
|
140
146
|
const RadioIndicator = Indicator.styleable((props, forwardedRef) => {
|
|
141
147
|
const {
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
forceMount,
|
|
149
|
+
disabled,
|
|
150
|
+
...indicatorProps
|
|
151
|
+
} = props;
|
|
152
|
+
const {
|
|
153
|
+
checked,
|
|
154
|
+
...useIndicatorRest
|
|
155
|
+
} = (0, import_radio_headless.useRadioGroupItemIndicator)({
|
|
156
|
+
radioGroupItemContext: RadioGroupItemContext,
|
|
157
|
+
disabled
|
|
158
|
+
});
|
|
159
|
+
if (forceMount || checked) {
|
|
160
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Indicator, {
|
|
161
|
+
...useIndicatorRest,
|
|
162
|
+
ref: forwardedRef,
|
|
144
163
|
...indicatorProps
|
|
145
|
-
} = props,
|
|
146
|
-
{
|
|
147
|
-
checked,
|
|
148
|
-
...useIndicatorRest
|
|
149
|
-
} = (0, import_gui_radio_headless.useRadioGroupItemIndicator)({
|
|
150
|
-
radioGroupItemContext: RadioGroupItemContext,
|
|
151
|
-
disabled
|
|
152
164
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
ref: forwardedRef,
|
|
156
|
-
...indicatorProps
|
|
157
|
-
}) : null;
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
158
167
|
});
|
|
159
168
|
RadioIndicator.displayName = "RadioIndicator";
|
|
160
|
-
const RadioGroup = (0,
|
|
169
|
+
const RadioGroup = (0, import_core.withStaticProperties)(RadioGroupImp, {
|
|
161
170
|
Item: RadioGroupItemImp,
|
|
162
171
|
Indicator: RadioIndicator
|
|
163
172
|
});
|
|
164
|
-
|
|
173
|
+
RadioGroup.displayName = "RadioGroup";
|
|
174
|
+
return RadioGroup;
|
|
165
175
|
}
|
|
@@ -4,52 +4,56 @@ var __create = Object.create;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
8
|
-
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
18
|
get: () => from[key],
|
|
18
19
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
22
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
34
36
|
var createRadioGroup_exports = {};
|
|
35
37
|
__export(createRadioGroup_exports, {
|
|
36
38
|
createRadioGroup: () => createRadioGroup
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(createRadioGroup_exports);
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var import_core = require("@hanzogui/core");
|
|
43
|
+
var import_radio_headless = require("@hanzogui/radio-headless");
|
|
44
|
+
var import_roving_focus = require("@hanzogui/roving-focus");
|
|
45
|
+
var import_react = __toESM(require("react"), 1);
|
|
46
|
+
var import_RadioGroup = require("./RadioGroup.native.js");
|
|
47
|
+
var ensureContext = function (x) {
|
|
48
|
+
if (!x.context) {
|
|
49
|
+
x.context = RadioGroupContext;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var RadioGroupContext = /* @__PURE__ */import_react.default.createContext({});
|
|
53
|
+
var RadioGroupItemContext = /* @__PURE__ */import_react.default.createContext({
|
|
54
|
+
checked: false,
|
|
55
|
+
disabled: false
|
|
56
|
+
});
|
|
53
57
|
function createRadioGroup(createProps) {
|
|
54
58
|
var {
|
|
55
59
|
disableActiveTheme,
|
|
@@ -57,112 +61,118 @@ function createRadioGroup(createProps) {
|
|
|
57
61
|
Indicator = import_RadioGroup.RadioGroupIndicatorFrame,
|
|
58
62
|
Item = import_RadioGroup.RadioGroupItemFrame
|
|
59
63
|
} = createProps;
|
|
60
|
-
ensureContext(Frame)
|
|
64
|
+
ensureContext(Frame);
|
|
65
|
+
ensureContext(Indicator);
|
|
66
|
+
ensureContext(Item);
|
|
61
67
|
var RadioGroupImp = Frame.styleable(function (props, ref) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
var {
|
|
69
|
+
value,
|
|
70
|
+
defaultValue,
|
|
71
|
+
onValueChange,
|
|
72
|
+
required = false,
|
|
73
|
+
disabled = false,
|
|
74
|
+
name,
|
|
75
|
+
native,
|
|
76
|
+
accentColor,
|
|
77
|
+
orientation = "vertical",
|
|
78
|
+
...rest
|
|
79
|
+
} = props;
|
|
80
|
+
var {
|
|
81
|
+
providerValue,
|
|
82
|
+
frameAttrs,
|
|
83
|
+
rovingFocusGroupAttrs
|
|
84
|
+
} = (0, import_radio_headless.useRadioGroup)({
|
|
85
|
+
orientation,
|
|
86
|
+
name,
|
|
87
|
+
defaultValue,
|
|
88
|
+
value,
|
|
89
|
+
onValueChange,
|
|
90
|
+
required,
|
|
91
|
+
disabled,
|
|
92
|
+
native,
|
|
93
|
+
accentColor
|
|
94
|
+
});
|
|
95
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RadioGroupContext.Provider, {
|
|
96
|
+
value: providerValue,
|
|
97
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
|
|
98
|
+
...rovingFocusGroupAttrs,
|
|
99
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupFrame, {
|
|
100
|
+
...frameAttrs,
|
|
101
|
+
ref,
|
|
72
102
|
...rest
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
var RadioGroupItemImp = Item.styleable(function (props, ref) {
|
|
108
|
+
var {
|
|
109
|
+
value,
|
|
110
|
+
labelledBy,
|
|
111
|
+
onPress,
|
|
112
|
+
onKeyDown,
|
|
113
|
+
disabled,
|
|
114
|
+
id,
|
|
115
|
+
...rest
|
|
116
|
+
} = props;
|
|
117
|
+
var {
|
|
118
|
+
providerValue,
|
|
119
|
+
bubbleInput,
|
|
120
|
+
rovingFocusGroupAttrs,
|
|
121
|
+
frameAttrs,
|
|
122
|
+
isFormControl,
|
|
123
|
+
native
|
|
124
|
+
} = (0, import_radio_headless.useRadioGroupItem)({
|
|
125
|
+
radioGroupContext: RadioGroupContext,
|
|
126
|
+
value,
|
|
127
|
+
id,
|
|
128
|
+
labelledBy,
|
|
129
|
+
disabled,
|
|
130
|
+
onPress,
|
|
131
|
+
onKeyDown
|
|
132
|
+
});
|
|
133
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, {
|
|
134
|
+
value: providerValue,
|
|
135
|
+
children: import_core.isWeb && native ? bubbleInput : /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
136
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
|
|
92
137
|
...rovingFocusGroupAttrs,
|
|
93
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.
|
|
138
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupItemFrame, {
|
|
94
139
|
...frameAttrs,
|
|
95
140
|
ref,
|
|
96
141
|
...rest
|
|
97
142
|
})
|
|
98
|
-
})
|
|
99
|
-
})
|
|
100
|
-
}),
|
|
101
|
-
RadioGroupItemImp = Item.styleable(function (props, ref) {
|
|
102
|
-
var {
|
|
103
|
-
value,
|
|
104
|
-
labelledBy,
|
|
105
|
-
onPress,
|
|
106
|
-
onKeyDown,
|
|
107
|
-
disabled,
|
|
108
|
-
id,
|
|
109
|
-
...rest
|
|
110
|
-
} = props,
|
|
111
|
-
{
|
|
112
|
-
providerValue,
|
|
113
|
-
bubbleInput,
|
|
114
|
-
rovingFocusGroupAttrs,
|
|
115
|
-
frameAttrs,
|
|
116
|
-
isFormControl,
|
|
117
|
-
native
|
|
118
|
-
} = (0, import_gui_radio_headless.useRadioGroupItem)({
|
|
119
|
-
radioGroupContext: RadioGroupContext,
|
|
120
|
-
value,
|
|
121
|
-
id,
|
|
122
|
-
labelledBy,
|
|
123
|
-
disabled,
|
|
124
|
-
onPress,
|
|
125
|
-
onKeyDown
|
|
126
|
-
});
|
|
127
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, {
|
|
128
|
-
value: providerValue,
|
|
129
|
-
children: import_gui_core.isWeb && native ? bubbleInput : /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
130
|
-
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_roving_focus.RovingFocusGroup.Item, {
|
|
131
|
-
...rovingFocusGroupAttrs,
|
|
132
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupItemFrame, {
|
|
133
|
-
...frameAttrs,
|
|
134
|
-
ref,
|
|
135
|
-
...rest
|
|
136
|
-
})
|
|
137
|
-
}), isFormControl && bubbleInput]
|
|
138
|
-
})
|
|
139
|
-
});
|
|
143
|
+
}), isFormControl && bubbleInput]
|
|
144
|
+
})
|
|
140
145
|
});
|
|
146
|
+
});
|
|
141
147
|
RadioGroupItemImp.displayName = "RadioGroupItem";
|
|
142
148
|
var RadioIndicator = Indicator.styleable(function (props, forwardedRef) {
|
|
143
149
|
var {
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
forceMount,
|
|
151
|
+
disabled,
|
|
152
|
+
...indicatorProps
|
|
153
|
+
} = props;
|
|
154
|
+
var {
|
|
155
|
+
checked,
|
|
156
|
+
...useIndicatorRest
|
|
157
|
+
} = (0, import_radio_headless.useRadioGroupItemIndicator)({
|
|
158
|
+
radioGroupItemContext: RadioGroupItemContext,
|
|
159
|
+
disabled
|
|
160
|
+
});
|
|
161
|
+
if (forceMount || checked) {
|
|
162
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Indicator, {
|
|
163
|
+
...useIndicatorRest,
|
|
164
|
+
ref: forwardedRef,
|
|
146
165
|
...indicatorProps
|
|
147
|
-
} = props,
|
|
148
|
-
{
|
|
149
|
-
checked,
|
|
150
|
-
...useIndicatorRest
|
|
151
|
-
} = (0, import_gui_radio_headless.useRadioGroupItemIndicator)({
|
|
152
|
-
radioGroupItemContext: RadioGroupItemContext,
|
|
153
|
-
disabled
|
|
154
166
|
});
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
ref: forwardedRef,
|
|
158
|
-
...indicatorProps
|
|
159
|
-
}) : null;
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
160
169
|
});
|
|
161
170
|
RadioIndicator.displayName = "RadioIndicator";
|
|
162
|
-
var RadioGroup = (0,
|
|
171
|
+
var RadioGroup = (0, import_core.withStaticProperties)(RadioGroupImp, {
|
|
163
172
|
Item: RadioGroupItemImp,
|
|
164
173
|
Indicator: RadioIndicator
|
|
165
174
|
});
|
|
166
|
-
|
|
175
|
+
RadioGroup.displayName = "RadioGroup";
|
|
176
|
+
return RadioGroup;
|
|
167
177
|
}
|
|
168
178
|
//# sourceMappingURL=createRadioGroup.native.js.map
|