@hanzogui/radio-group 2.0.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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/RadioGroup.cjs +132 -0
  3. package/dist/cjs/RadioGroup.native.js +137 -0
  4. package/dist/cjs/RadioGroup.native.js.map +1 -0
  5. package/dist/cjs/RadioGroupStyledContext.cjs +30 -0
  6. package/dist/cjs/RadioGroupStyledContext.native.js +33 -0
  7. package/dist/cjs/RadioGroupStyledContext.native.js.map +1 -0
  8. package/dist/cjs/createRadioGroup.cjs +165 -0
  9. package/dist/cjs/createRadioGroup.native.js +168 -0
  10. package/dist/cjs/createRadioGroup.native.js.map +1 -0
  11. package/dist/cjs/index.cjs +36 -0
  12. package/dist/cjs/index.native.js +39 -0
  13. package/dist/cjs/index.native.js.map +1 -0
  14. package/dist/esm/RadioGroup.mjs +107 -0
  15. package/dist/esm/RadioGroup.mjs.map +1 -0
  16. package/dist/esm/RadioGroup.native.js +109 -0
  17. package/dist/esm/RadioGroup.native.js.map +1 -0
  18. package/dist/esm/RadioGroupStyledContext.mjs +7 -0
  19. package/dist/esm/RadioGroupStyledContext.mjs.map +1 -0
  20. package/dist/esm/RadioGroupStyledContext.native.js +7 -0
  21. package/dist/esm/RadioGroupStyledContext.native.js.map +1 -0
  22. package/dist/esm/createRadioGroup.mjs +131 -0
  23. package/dist/esm/createRadioGroup.mjs.map +1 -0
  24. package/dist/esm/createRadioGroup.native.js +131 -0
  25. package/dist/esm/createRadioGroup.native.js.map +1 -0
  26. package/dist/esm/index.js +12 -0
  27. package/dist/esm/index.js.map +1 -0
  28. package/dist/esm/index.mjs +12 -0
  29. package/dist/esm/index.mjs.map +1 -0
  30. package/dist/esm/index.native.js +12 -0
  31. package/dist/esm/index.native.js.map +1 -0
  32. package/dist/jsx/RadioGroup.mjs +107 -0
  33. package/dist/jsx/RadioGroup.mjs.map +1 -0
  34. package/dist/jsx/RadioGroup.native.js +137 -0
  35. package/dist/jsx/RadioGroup.native.js.map +1 -0
  36. package/dist/jsx/RadioGroupStyledContext.mjs +7 -0
  37. package/dist/jsx/RadioGroupStyledContext.mjs.map +1 -0
  38. package/dist/jsx/RadioGroupStyledContext.native.js +33 -0
  39. package/dist/jsx/RadioGroupStyledContext.native.js.map +1 -0
  40. package/dist/jsx/createRadioGroup.mjs +131 -0
  41. package/dist/jsx/createRadioGroup.mjs.map +1 -0
  42. package/dist/jsx/createRadioGroup.native.js +168 -0
  43. package/dist/jsx/createRadioGroup.native.js.map +1 -0
  44. package/dist/jsx/index.js +12 -0
  45. package/dist/jsx/index.js.map +1 -0
  46. package/dist/jsx/index.mjs +12 -0
  47. package/dist/jsx/index.mjs.map +1 -0
  48. package/dist/jsx/index.native.js +39 -0
  49. package/dist/jsx/index.native.js.map +1 -0
  50. package/package.json +62 -0
  51. package/src/RadioGroup.tsx +125 -0
  52. package/src/RadioGroupStyledContext.tsx +10 -0
  53. package/src/createRadioGroup.tsx +191 -0
  54. package/src/index.ts +16 -0
  55. package/types/RadioGroup.d.ts +18 -0
  56. package/types/RadioGroupStyledContext.d.ts +6 -0
  57. package/types/createRadioGroup.d.ts +282 -0
  58. package/types/index.d.ts +253 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,132 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var RadioGroup_exports = {};
22
+ __export(RadioGroup_exports, {
23
+ RadioGroupFrame: () => RadioGroupFrame,
24
+ RadioGroupIndicatorFrame: () => RadioGroupIndicatorFrame,
25
+ RadioGroupItemFrame: () => RadioGroupItemFrame
26
+ });
27
+ module.exports = __toCommonJS(RadioGroup_exports);
28
+ var import_gui_core = require("@hanzo/gui-core"),
29
+ import_gui_get_token = require("@hanzo/gui-get-token"),
30
+ import_gui_stacks = require("@hanzo/gui-stacks");
31
+ const RADIO_GROUP_ITEM_NAME = "RadioGroupItem",
32
+ RadioGroupItemFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
33
+ name: RADIO_GROUP_ITEM_NAME,
34
+ render: "button",
35
+ variants: {
36
+ unstyled: {
37
+ false: {
38
+ size: "$true",
39
+ borderRadius: 1e3,
40
+ backgroundColor: "$background",
41
+ alignItems: "center",
42
+ justifyContent: "center",
43
+ borderWidth: 1,
44
+ borderColor: "$borderColor",
45
+ padding: 0,
46
+ hoverStyle: {
47
+ borderColor: "$borderColorHover",
48
+ backgroundColor: "$backgroundHover"
49
+ },
50
+ focusStyle: {
51
+ borderColor: "$borderColorHover",
52
+ backgroundColor: "$backgroundHover"
53
+ },
54
+ focusVisibleStyle: {
55
+ outlineStyle: "solid",
56
+ outlineWidth: 2,
57
+ outlineColor: "$outlineColor"
58
+ },
59
+ pressStyle: {
60
+ borderColor: "$borderColorFocus",
61
+ backgroundColor: "$backgroundFocus"
62
+ }
63
+ }
64
+ },
65
+ disabled: {
66
+ true: {
67
+ pointerEvents: "none",
68
+ userSelect: "none",
69
+ cursor: "not-allowed",
70
+ hoverStyle: {
71
+ borderColor: "$borderColor",
72
+ backgroundColor: "$background"
73
+ },
74
+ pressStyle: {
75
+ borderColor: "$borderColor",
76
+ backgroundColor: "$background"
77
+ },
78
+ focusVisibleStyle: {
79
+ outlineWidth: 0
80
+ }
81
+ }
82
+ },
83
+ size: {
84
+ "...size": (value, {
85
+ props
86
+ }) => {
87
+ const size = Math.floor((0, import_gui_core.getVariableValue)((0, import_gui_get_token.getSize)(value)) * (props.scaleSize ?? 0.5));
88
+ return {
89
+ width: size,
90
+ height: size
91
+ };
92
+ }
93
+ }
94
+ },
95
+ defaultVariants: {
96
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1"
97
+ }
98
+ }),
99
+ RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator",
100
+ RadioGroupIndicatorFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
101
+ name: RADIO_GROUP_INDICATOR_NAME,
102
+ variants: {
103
+ unstyled: {
104
+ false: {
105
+ width: "33%",
106
+ height: "33%",
107
+ borderRadius: 1e3,
108
+ backgroundColor: "$color",
109
+ pressTheme: !0
110
+ }
111
+ }
112
+ },
113
+ defaultVariants: {
114
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1"
115
+ }
116
+ }),
117
+ RADIO_GROUP_NAME = "RadioGroup",
118
+ RadioGroupFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
119
+ name: RADIO_GROUP_NAME,
120
+ variants: {
121
+ orientation: {
122
+ horizontal: {
123
+ flexDirection: "row",
124
+ spaceDirection: "horizontal"
125
+ },
126
+ vertical: {
127
+ flexDirection: "column",
128
+ spaceDirection: "vertical"
129
+ }
130
+ }
131
+ }
132
+ });
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: !0
22
+ }), mod);
23
+ var RadioGroup_exports = {};
24
+ __export(RadioGroup_exports, {
25
+ RadioGroupFrame: () => RadioGroupFrame,
26
+ RadioGroupIndicatorFrame: () => RadioGroupIndicatorFrame,
27
+ RadioGroupItemFrame: () => RadioGroupItemFrame
28
+ });
29
+ module.exports = __toCommonJS(RadioGroup_exports);
30
+ var import_gui_core = require("@hanzo/gui-core"),
31
+ import_gui_get_token = require("@hanzo/gui-get-token"),
32
+ import_gui_stacks = require("@hanzo/gui-stacks"),
33
+ RADIO_GROUP_ITEM_NAME = "RadioGroupItem",
34
+ RadioGroupItemFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
35
+ name: RADIO_GROUP_ITEM_NAME,
36
+ render: "button",
37
+ variants: {
38
+ unstyled: {
39
+ false: {
40
+ size: "$true",
41
+ borderRadius: 1e3,
42
+ backgroundColor: "$background",
43
+ alignItems: "center",
44
+ justifyContent: "center",
45
+ borderWidth: 1,
46
+ borderColor: "$borderColor",
47
+ padding: 0,
48
+ hoverStyle: {
49
+ borderColor: "$borderColorHover",
50
+ backgroundColor: "$backgroundHover"
51
+ },
52
+ focusStyle: {
53
+ borderColor: "$borderColorHover",
54
+ backgroundColor: "$backgroundHover"
55
+ },
56
+ focusVisibleStyle: {
57
+ outlineStyle: "solid",
58
+ outlineWidth: 2,
59
+ outlineColor: "$outlineColor"
60
+ },
61
+ pressStyle: {
62
+ borderColor: "$borderColorFocus",
63
+ backgroundColor: "$backgroundFocus"
64
+ }
65
+ }
66
+ },
67
+ disabled: {
68
+ true: {
69
+ pointerEvents: "none",
70
+ userSelect: "none",
71
+ cursor: "not-allowed",
72
+ hoverStyle: {
73
+ borderColor: "$borderColor",
74
+ backgroundColor: "$background"
75
+ },
76
+ pressStyle: {
77
+ borderColor: "$borderColor",
78
+ backgroundColor: "$background"
79
+ },
80
+ focusVisibleStyle: {
81
+ outlineWidth: 0
82
+ }
83
+ }
84
+ },
85
+ size: {
86
+ "...size": function (value, param) {
87
+ var {
88
+ props
89
+ } = param,
90
+ _props_scaleSize,
91
+ size = Math.floor((0, import_gui_core.getVariableValue)((0, import_gui_get_token.getSize)(value)) * ((_props_scaleSize = props.scaleSize) !== null && _props_scaleSize !== void 0 ? _props_scaleSize : 0.5));
92
+ return {
93
+ width: size,
94
+ height: size
95
+ };
96
+ }
97
+ }
98
+ },
99
+ defaultVariants: {
100
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1"
101
+ }
102
+ }),
103
+ RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator",
104
+ RadioGroupIndicatorFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
105
+ name: RADIO_GROUP_INDICATOR_NAME,
106
+ variants: {
107
+ unstyled: {
108
+ false: {
109
+ width: "33%",
110
+ height: "33%",
111
+ borderRadius: 1e3,
112
+ backgroundColor: "$color",
113
+ pressTheme: !0
114
+ }
115
+ }
116
+ },
117
+ defaultVariants: {
118
+ unstyled: process.env.HANZO_GUI_HEADLESS === "1"
119
+ }
120
+ }),
121
+ RADIO_GROUP_NAME = "RadioGroup",
122
+ RadioGroupFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
123
+ name: RADIO_GROUP_NAME,
124
+ variants: {
125
+ orientation: {
126
+ horizontal: {
127
+ flexDirection: "row",
128
+ spaceDirection: "horizontal"
129
+ },
130
+ vertical: {
131
+ flexDirection: "column",
132
+ spaceDirection: "vertical"
133
+ }
134
+ }
135
+ }
136
+ });
137
+ //# sourceMappingURL=RadioGroup.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","RadioGroup_exports","__export","RadioGroupFrame","RadioGroupIndicatorFrame","RadioGroupItemFrame","module","exports","import_gui_core","require","import_gui_get_token","import_gui_stacks","RADIO_GROUP_ITEM_NAME","styled","YStack","name","render","variants","unstyled","false","size","borderRadius","backgroundColor","alignItems","justifyContent","borderWidth","borderColor","padding","hoverStyle","focusStyle","focusVisibleStyle","outlineStyle","outlineWidth","outlineColor","pressStyle","disabled","true","pointerEvents","userSelect","cursor","...size","param","props","_props_scaleSize","Math","floor","getVariableValue","getSize","scaleSize","width","height","defaultVariants","process","env","HANZO_GUI_HEADLESS","RADIO_GROUP_INDICATOR_NAME","pressTheme","RADIO_GROUP_NAME","orientation","horizontal","flexDirection","spaceDirection","vertical"],"sources":["../../src/RadioGroup.tsx"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var RadioGroupStyledContext_exports = {};
22
+ __export(RadioGroupStyledContext_exports, {
23
+ RadioGroupStyledContext: () => RadioGroupStyledContext
24
+ });
25
+ module.exports = __toCommonJS(RadioGroupStyledContext_exports);
26
+ var import_gui_core = require("@hanzo/gui-core");
27
+ const RadioGroupStyledContext = (0, import_gui_core.createStyledContext)({
28
+ size: "$true",
29
+ scaleIcon: 1
30
+ }, "RadioGroup");
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: !0
22
+ }), mod);
23
+ var RadioGroupStyledContext_exports = {};
24
+ __export(RadioGroupStyledContext_exports, {
25
+ RadioGroupStyledContext: () => RadioGroupStyledContext
26
+ });
27
+ module.exports = __toCommonJS(RadioGroupStyledContext_exports);
28
+ var import_gui_core = require("@hanzo/gui-core"),
29
+ RadioGroupStyledContext = (0, import_gui_core.createStyledContext)({
30
+ size: "$true",
31
+ scaleIcon: 1
32
+ }, "RadioGroup");
33
+ //# sourceMappingURL=RadioGroupStyledContext.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","RadioGroupStyledContext_exports","__export","RadioGroupStyledContext","module","exports","import_gui_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,eAAM,GAAAC,OAAA,kBAA0B;EAAAJ,uBAAA,OAAAG,eAAA,CAAAE,mBAAA;IACrCC,IAAA;IAAAC,SACQ;EAAA,eACK","ignoreList":[]}
@@ -0,0 +1,165 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var createRadioGroup_exports = {};
33
+ __export(createRadioGroup_exports, {
34
+ createRadioGroup: () => createRadioGroup
35
+ });
36
+ module.exports = __toCommonJS(createRadioGroup_exports);
37
+ var import_gui_core = require("@hanzo/gui-core"),
38
+ import_gui_radio_headless = require("@hanzo/gui-radio-headless"),
39
+ import_gui_roving_focus = require("@hanzo/gui-roving-focus"),
40
+ import_react = __toESM(require("react"), 1),
41
+ import_RadioGroup = require("./RadioGroup.cjs"),
42
+ import_jsx_runtime = require("react/jsx-runtime");
43
+ const ensureContext = x => {
44
+ x.context || (x.context = RadioGroupContext);
45
+ },
46
+ RadioGroupContext = import_react.default.createContext({}),
47
+ RadioGroupItemContext = import_react.default.createContext({
48
+ checked: !1,
49
+ disabled: !1
50
+ });
51
+ function createRadioGroup(createProps) {
52
+ const {
53
+ disableActiveTheme,
54
+ Frame = import_RadioGroup.RadioGroupFrame,
55
+ Indicator = import_RadioGroup.RadioGroupIndicatorFrame,
56
+ Item = import_RadioGroup.RadioGroupItemFrame
57
+ } = createProps;
58
+ ensureContext(Frame), ensureContext(Indicator), ensureContext(Item);
59
+ const RadioGroupImp = Frame.styleable((props, ref) => {
60
+ const {
61
+ value,
62
+ defaultValue,
63
+ onValueChange,
64
+ required = !1,
65
+ disabled = !1,
66
+ name,
67
+ native,
68
+ accentColor,
69
+ orientation = "vertical",
70
+ ...rest
71
+ } = props,
72
+ {
73
+ providerValue,
74
+ frameAttrs,
75
+ rovingFocusGroupAttrs
76
+ } = (0, import_gui_radio_headless.useRadioGroup)({
77
+ orientation,
78
+ name,
79
+ defaultValue,
80
+ value,
81
+ onValueChange,
82
+ required,
83
+ disabled,
84
+ native,
85
+ accentColor
86
+ });
87
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RadioGroupContext.Provider, {
88
+ value: providerValue,
89
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_roving_focus.RovingFocusGroup, {
90
+ ...rovingFocusGroupAttrs,
91
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupFrame, {
92
+ ...frameAttrs,
93
+ ref,
94
+ ...rest
95
+ })
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
+ });
138
+ });
139
+ RadioGroupItemImp.displayName = "RadioGroupItem";
140
+ const RadioIndicator = Indicator.styleable((props, forwardedRef) => {
141
+ const {
142
+ forceMount,
143
+ disabled,
144
+ ...indicatorProps
145
+ } = props,
146
+ {
147
+ checked,
148
+ ...useIndicatorRest
149
+ } = (0, import_gui_radio_headless.useRadioGroupItemIndicator)({
150
+ radioGroupItemContext: RadioGroupItemContext,
151
+ disabled
152
+ });
153
+ return forceMount || checked ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(Indicator, {
154
+ ...useIndicatorRest,
155
+ ref: forwardedRef,
156
+ ...indicatorProps
157
+ }) : null;
158
+ });
159
+ RadioIndicator.displayName = "RadioIndicator";
160
+ const RadioGroup = (0, import_gui_core.withStaticProperties)(RadioGroupImp, {
161
+ Item: RadioGroupItemImp,
162
+ Indicator: RadioIndicator
163
+ });
164
+ return RadioGroup.displayName = "RadioGroup", RadioGroup;
165
+ }