@tamagui/radio-group 1.0.1

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 (82) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/RadioGroup.cjs +132 -0
  3. package/dist/cjs/RadioGroup.js +120 -0
  4. package/dist/cjs/RadioGroup.js.map +6 -0
  5. package/dist/cjs/RadioGroup.native.js +137 -0
  6. package/dist/cjs/RadioGroup.native.js.map +1 -0
  7. package/dist/cjs/RadioGroupStyledContext.cjs +30 -0
  8. package/dist/cjs/RadioGroupStyledContext.js +28 -0
  9. package/dist/cjs/RadioGroupStyledContext.js.map +6 -0
  10. package/dist/cjs/RadioGroupStyledContext.native.js +33 -0
  11. package/dist/cjs/RadioGroupStyledContext.native.js.map +1 -0
  12. package/dist/cjs/createRadioGroup.cjs +165 -0
  13. package/dist/cjs/createRadioGroup.js +106 -0
  14. package/dist/cjs/createRadioGroup.js.map +6 -0
  15. package/dist/cjs/createRadioGroup.native.js +168 -0
  16. package/dist/cjs/createRadioGroup.native.js.map +1 -0
  17. package/dist/cjs/index.cjs +36 -0
  18. package/dist/cjs/index.js +29 -0
  19. package/dist/cjs/index.js.map +6 -0
  20. package/dist/cjs/index.native.js +39 -0
  21. package/dist/cjs/index.native.js.map +1 -0
  22. package/dist/esm/RadioGroup.js +106 -0
  23. package/dist/esm/RadioGroup.js.map +6 -0
  24. package/dist/esm/RadioGroup.mjs +107 -0
  25. package/dist/esm/RadioGroup.mjs.map +1 -0
  26. package/dist/esm/RadioGroup.native.js +109 -0
  27. package/dist/esm/RadioGroup.native.js.map +1 -0
  28. package/dist/esm/RadioGroupStyledContext.js +12 -0
  29. package/dist/esm/RadioGroupStyledContext.js.map +6 -0
  30. package/dist/esm/RadioGroupStyledContext.mjs +7 -0
  31. package/dist/esm/RadioGroupStyledContext.mjs.map +1 -0
  32. package/dist/esm/RadioGroupStyledContext.native.js +7 -0
  33. package/dist/esm/RadioGroupStyledContext.native.js.map +1 -0
  34. package/dist/esm/createRadioGroup.js +95 -0
  35. package/dist/esm/createRadioGroup.js.map +6 -0
  36. package/dist/esm/createRadioGroup.mjs +131 -0
  37. package/dist/esm/createRadioGroup.mjs.map +1 -0
  38. package/dist/esm/createRadioGroup.native.js +131 -0
  39. package/dist/esm/createRadioGroup.native.js.map +1 -0
  40. package/dist/esm/index.js +18 -0
  41. package/dist/esm/index.js.map +6 -0
  42. package/dist/esm/index.mjs +12 -0
  43. package/dist/esm/index.mjs.map +1 -0
  44. package/dist/esm/index.native.js +12 -0
  45. package/dist/esm/index.native.js.map +1 -0
  46. package/dist/jsx/RadioGroup.js +106 -0
  47. package/dist/jsx/RadioGroup.js.map +6 -0
  48. package/dist/jsx/RadioGroup.mjs +107 -0
  49. package/dist/jsx/RadioGroup.mjs.map +1 -0
  50. package/dist/jsx/RadioGroup.native.js +137 -0
  51. package/dist/jsx/RadioGroup.native.js.map +1 -0
  52. package/dist/jsx/RadioGroupStyledContext.js +12 -0
  53. package/dist/jsx/RadioGroupStyledContext.js.map +6 -0
  54. package/dist/jsx/RadioGroupStyledContext.mjs +7 -0
  55. package/dist/jsx/RadioGroupStyledContext.mjs.map +1 -0
  56. package/dist/jsx/RadioGroupStyledContext.native.js +33 -0
  57. package/dist/jsx/RadioGroupStyledContext.native.js.map +1 -0
  58. package/dist/jsx/createRadioGroup.js +95 -0
  59. package/dist/jsx/createRadioGroup.js.map +6 -0
  60. package/dist/jsx/createRadioGroup.mjs +131 -0
  61. package/dist/jsx/createRadioGroup.mjs.map +1 -0
  62. package/dist/jsx/createRadioGroup.native.js +168 -0
  63. package/dist/jsx/createRadioGroup.native.js.map +1 -0
  64. package/dist/jsx/index.js +18 -0
  65. package/dist/jsx/index.js.map +6 -0
  66. package/dist/jsx/index.mjs +12 -0
  67. package/dist/jsx/index.mjs.map +1 -0
  68. package/dist/jsx/index.native.js +39 -0
  69. package/dist/jsx/index.native.js.map +1 -0
  70. package/package.json +62 -0
  71. package/src/RadioGroup.tsx +125 -0
  72. package/src/RadioGroupStyledContext.tsx +10 -0
  73. package/src/createRadioGroup.tsx +191 -0
  74. package/src/index.ts +16 -0
  75. package/types/RadioGroup.d.ts +18 -0
  76. package/types/RadioGroup.d.ts.map +1 -0
  77. package/types/RadioGroupStyledContext.d.ts +6 -0
  78. package/types/RadioGroupStyledContext.d.ts.map +1 -0
  79. package/types/createRadioGroup.d.ts +282 -0
  80. package/types/createRadioGroup.d.ts.map +1 -0
  81. package/types/index.d.ts +253 -0
  82. package/types/index.d.ts.map +1 -0
@@ -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_core = require("@tamagui/core"),
38
+ import_radio_headless = require("@tamagui/radio-headless"),
39
+ import_roving_focus = require("@tamagui/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_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_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_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_core.isWeb && native ? bubbleInput : /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
128
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_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_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_core.withStaticProperties)(RadioGroupImp, {
161
+ Item: RadioGroupItemImp,
162
+ Indicator: RadioIndicator
163
+ });
164
+ return RadioGroup.displayName = "RadioGroup", RadioGroup;
165
+ }
@@ -0,0 +1,106 @@
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, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var createRadioGroup_exports = {};
24
+ __export(createRadioGroup_exports, {
25
+ createRadioGroup: () => createRadioGroup
26
+ });
27
+ module.exports = __toCommonJS(createRadioGroup_exports);
28
+ var import_core = require("@tamagui/core"), import_radio_headless = require("@tamagui/radio-headless"), import_roving_focus = require("@tamagui/roving-focus"), import_react = __toESM(require("react"), 1), import_RadioGroup = require("./RadioGroup"), import_jsx_runtime = require("react/jsx-runtime");
29
+ const ensureContext = (x) => {
30
+ x.context || (x.context = RadioGroupContext);
31
+ }, RadioGroupContext = import_react.default.createContext({}), RadioGroupItemContext = import_react.default.createContext({
32
+ checked: !1,
33
+ disabled: !1
34
+ });
35
+ function createRadioGroup(createProps) {
36
+ const {
37
+ disableActiveTheme,
38
+ Frame = import_RadioGroup.RadioGroupFrame,
39
+ Indicator = import_RadioGroup.RadioGroupIndicatorFrame,
40
+ Item = import_RadioGroup.RadioGroupItemFrame
41
+ } = createProps;
42
+ ensureContext(Frame), ensureContext(Indicator), ensureContext(Item);
43
+ const RadioGroupImp = Frame.styleable((props, ref) => {
44
+ const {
45
+ value,
46
+ defaultValue,
47
+ onValueChange,
48
+ required = !1,
49
+ disabled = !1,
50
+ name,
51
+ native,
52
+ accentColor,
53
+ orientation = "vertical",
54
+ ...rest
55
+ } = props, { providerValue, frameAttrs, rovingFocusGroupAttrs } = (0, import_radio_headless.useRadioGroup)({
56
+ orientation,
57
+ name,
58
+ defaultValue,
59
+ value,
60
+ onValueChange,
61
+ required,
62
+ disabled,
63
+ native,
64
+ accentColor
65
+ });
66
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupContext.Provider, { value: providerValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, { ...rovingFocusGroupAttrs, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupFrame, { ...frameAttrs, ref, ...rest }) }) });
67
+ }), RadioGroupItemImp = Item.styleable((props, ref) => {
68
+ const { value, labelledBy, onPress, onKeyDown, disabled, id, ...rest } = props, {
69
+ providerValue,
70
+ bubbleInput,
71
+ rovingFocusGroupAttrs,
72
+ frameAttrs,
73
+ isFormControl,
74
+ native
75
+ } = (0, import_radio_headless.useRadioGroupItem)({
76
+ radioGroupContext: RadioGroupContext,
77
+ value,
78
+ id,
79
+ labelledBy,
80
+ disabled,
81
+ onPress,
82
+ onKeyDown
83
+ });
84
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, { value: providerValue, children: import_core.isWeb && native ? bubbleInput : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
85
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, { ...rovingFocusGroupAttrs, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupItemFrame, { ...frameAttrs, ref, ...rest }) }),
86
+ isFormControl && bubbleInput
87
+ ] }) });
88
+ });
89
+ RadioGroupItemImp.displayName = "RadioGroupItem";
90
+ const RadioIndicator = Indicator.styleable(
91
+ (props, forwardedRef) => {
92
+ const { forceMount, disabled, ...indicatorProps } = props, { checked, ...useIndicatorRest } = (0, import_radio_headless.useRadioGroupItemIndicator)({
93
+ radioGroupItemContext: RadioGroupItemContext,
94
+ disabled
95
+ });
96
+ return forceMount || checked ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { ...useIndicatorRest, ref: forwardedRef, ...indicatorProps }) : null;
97
+ }
98
+ );
99
+ RadioIndicator.displayName = "RadioIndicator";
100
+ const RadioGroup = (0, import_core.withStaticProperties)(RadioGroupImp, {
101
+ Item: RadioGroupItemImp,
102
+ Indicator: RadioIndicator
103
+ });
104
+ return RadioGroup.displayName = "RadioGroup", RadioGroup;
105
+ }
106
+ //# sourceMappingURL=createRadioGroup.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/createRadioGroup.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA4C,0BAK5C,wBAIO,oCACP,sBAAiC,kCACjC,eAAkB,8BAClB,oBAIO,yBAwGG;AAtGV,MAAM,gBAAgB,CAAC,MAAW;AAChC,EAAK,EAAE,YACL,EAAE,UAAU;AAEhB,GAOM,oBAAoB,aAAAA,QAAM,cAAsC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,EAAuB,GAAG,uBACzB,sDAAC,yCAAqB,GAAG,YAAY,KAAW,GAAG,MAAM,GAC3D;AAAA,MACC,iBAAiB;AAAA,OACpB,GAEJ;AAAA,EAEJ,CAAC;AAED,oBAAkB,cAAc;AAEhC,QAAM,iBAAiB,UAAU;AAAA,IAC/B,CAAC,OAA4B,iBAAiB;AAC5C,YAAM,EAAE,YAAY,UAAU,GAAG,eAAe,IAAI,OAC9C,EAAE,SAAS,GAAG,iBAAiB,QAAI,kDAA2B;AAAA,QAClE,uBAAuB;AAAA,QACvB;AAAA,MACF,CAAC;AAED,aAAI,cAAc,UACT,4CAAC,aAAW,GAAG,kBAAkB,KAAK,cAAe,GAAG,gBAAgB,IAG1E;AAAA,IACT;AAAA,EACF;AAEA,iBAAe,cAAc;AAE7B,QAAM,iBAAa,kCAAqB,eAAe;AAAA,IACrD,MAAM;AAAA,IACN,WAAW;AAAA,EACb,CAAC;AACD,oBAAW,cAAc,cAElB;AACT;",
5
+ "names": ["React"]
6
+ }
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
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: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var createRadioGroup_exports = {};
35
+ __export(createRadioGroup_exports, {
36
+ createRadioGroup: () => createRadioGroup
37
+ });
38
+ module.exports = __toCommonJS(createRadioGroup_exports);
39
+ var import_jsx_runtime = require("react/jsx-runtime"),
40
+ import_core = require("@tamagui/core"),
41
+ import_radio_headless = require("@tamagui/radio-headless"),
42
+ import_roving_focus = require("@tamagui/roving-focus"),
43
+ import_react = __toESM(require("react"), 1),
44
+ import_RadioGroup = require("./RadioGroup.native.js"),
45
+ ensureContext = function (x) {
46
+ x.context || (x.context = RadioGroupContext);
47
+ },
48
+ RadioGroupContext = /* @__PURE__ */import_react.default.createContext({}),
49
+ RadioGroupItemContext = /* @__PURE__ */import_react.default.createContext({
50
+ checked: !1,
51
+ disabled: !1
52
+ });
53
+ function createRadioGroup(createProps) {
54
+ var {
55
+ disableActiveTheme,
56
+ Frame = import_RadioGroup.RadioGroupFrame,
57
+ Indicator = import_RadioGroup.RadioGroupIndicatorFrame,
58
+ Item = import_RadioGroup.RadioGroupItemFrame
59
+ } = createProps;
60
+ ensureContext(Frame), ensureContext(Indicator), ensureContext(Item);
61
+ var RadioGroupImp = Frame.styleable(function (props, ref) {
62
+ var {
63
+ value,
64
+ defaultValue,
65
+ onValueChange,
66
+ required = !1,
67
+ disabled = !1,
68
+ name,
69
+ native,
70
+ accentColor,
71
+ orientation = "vertical",
72
+ ...rest
73
+ } = props,
74
+ {
75
+ providerValue,
76
+ frameAttrs,
77
+ rovingFocusGroupAttrs
78
+ } = (0, import_radio_headless.useRadioGroup)({
79
+ orientation,
80
+ name,
81
+ defaultValue,
82
+ value,
83
+ onValueChange,
84
+ required,
85
+ disabled,
86
+ native,
87
+ accentColor
88
+ });
89
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RadioGroupContext.Provider, {
90
+ value: providerValue,
91
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
92
+ ...rovingFocusGroupAttrs,
93
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupFrame, {
94
+ ...frameAttrs,
95
+ ref,
96
+ ...rest
97
+ })
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_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_core.isWeb && native ? bubbleInput : /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
130
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_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
+ });
140
+ });
141
+ RadioGroupItemImp.displayName = "RadioGroupItem";
142
+ var RadioIndicator = Indicator.styleable(function (props, forwardedRef) {
143
+ var {
144
+ forceMount,
145
+ disabled,
146
+ ...indicatorProps
147
+ } = props,
148
+ {
149
+ checked,
150
+ ...useIndicatorRest
151
+ } = (0, import_radio_headless.useRadioGroupItemIndicator)({
152
+ radioGroupItemContext: RadioGroupItemContext,
153
+ disabled
154
+ });
155
+ return forceMount || checked ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(Indicator, {
156
+ ...useIndicatorRest,
157
+ ref: forwardedRef,
158
+ ...indicatorProps
159
+ }) : null;
160
+ });
161
+ RadioIndicator.displayName = "RadioIndicator";
162
+ var RadioGroup = (0, import_core.withStaticProperties)(RadioGroupImp, {
163
+ Item: RadioGroupItemImp,
164
+ Indicator: RadioIndicator
165
+ });
166
+ return RadioGroup.displayName = "RadioGroup", RadioGroup;
167
+ }
168
+ //# sourceMappingURL=createRadioGroup.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createRadioGroup_exports","__export","createRadioGroup","module","exports","import_jsx_runtime","require","import_core","import_radio_headless","import_roving_focus","import_react","__toESM","import_RadioGroup","ensureContext","x","context","RadioGroupContext","default","createContext","RadioGroupItemContext","checked","disabled","createProps","disableActiveTheme","Frame","RadioGroupFrame","Indicator","RadioGroupIndicatorFrame","Item","RadioGroupItemFrame","RadioGroupImp","styleable","props","ref","defaultValue","onValueChange","required","name","native","accentColor","orientation","rest","providerValue","frameAttrs","rovingFocusGroupAttrs","useRadioGroup","jsx","Provider","children","RovingFocusGroup","RadioGroupItemImp","labelledBy","onPress","onKeyDown","id","bubbleInput","isFormControl","useRadioGroupItem","radioGroupContext","isWeb","jsxs","Fragment","displayName","RadioIndicator","forwardedRef","forceMount","indicatorProps","useIndicatorRest","useRadioGroupItemIndicator","radioGroupItemContext","RadioGroup","withStaticProperties"],"sources":["../../src/createRadioGroup.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAA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AAgB,qBAAmB;YACnBI,QAAA,qBAAA3C,kBAAA,CAAAyC,GAAA,EAAAlC,iBAAA,CAAAiB,mBAAA;cACA,GAAAc,UAAA;cACAV,GAAA;cACA,GAAAQ;YACA;UACA,IACDe,aAAA,IAAAD,WAAA;QAQO;MAEA,EACC;IAAiB;EAK5BL,iBAAC,CAAAY,WAAA;EAED,IAAAC,cAAkB,GAAArC,SAAA,CAAAK,SAAc,WAAAC,KAAA,EAAAgC,YAAA;IAEhC,IAAM;QAAAC,UAAA;QAAA5C,QAAiB;QAAA,GAAU6C;MAAA,IAAAlC,KAAA;MAAA;QAAAZ,OAAA;QAAA,GAAA+C;MAAA,QAAA3D,qBAAA,CAAA4D,0BAAA;QAC9BC,qBAA4B,EAAiBlD,qBAAA;QAC5CE;MACoE;IAC3C,OACvB4C,UAAA,IAAA7C,OAAA,sBAAAf,kBAAA,CAAAyC,GAAA,EAAApB,SAAA;MACF,GAACyC,gBAAA;MAEDlC,GAAA,EAAA+B,YAAI;MAKN,GAAAE;IACF;EAEA;EAEAH,cAAM,CAAAD,WAAa;EAAoC,IACrDQ,UAAM,OAAA/D,WAAA,CAAAgE,oBAAA,EAAAzC,aAAA;IACNF,IAAA,EAAAsB,iBAAW;IACZxB,SAAA,EAAAqC;EACD;EAGF,OAAAO,UAAA,CAAAR,WAAA,iBAAAQ,UAAA","ignoreList":[]}
@@ -0,0 +1,36 @@
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
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
20
+ value: !0
21
+ }), mod);
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ RadioGroup: () => RadioGroup
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+ var import_RadioGroup = require("./RadioGroup.cjs"),
28
+ import_createRadioGroup = require("./createRadioGroup.cjs");
29
+ __reExport(index_exports, require("./createRadioGroup.cjs"), module.exports);
30
+ __reExport(index_exports, require("./RadioGroup.cjs"), module.exports);
31
+ __reExport(index_exports, require("./RadioGroupStyledContext.cjs"), module.exports);
32
+ const RadioGroup = (0, import_createRadioGroup.createRadioGroup)({
33
+ Frame: import_RadioGroup.RadioGroupFrame,
34
+ Indicator: import_RadioGroup.RadioGroupIndicatorFrame,
35
+ Item: import_RadioGroup.RadioGroupItemFrame
36
+ });
@@ -0,0 +1,29 @@
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)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var index_exports = {};
16
+ __export(index_exports, {
17
+ RadioGroup: () => RadioGroup
18
+ });
19
+ module.exports = __toCommonJS(index_exports);
20
+ var import_RadioGroup = require("./RadioGroup"), import_createRadioGroup = require("./createRadioGroup");
21
+ __reExport(index_exports, require("./createRadioGroup"), module.exports);
22
+ __reExport(index_exports, require("./RadioGroup"), module.exports);
23
+ __reExport(index_exports, require("./RadioGroupStyledContext"), module.exports);
24
+ const RadioGroup = (0, import_createRadioGroup.createRadioGroup)({
25
+ Frame: import_RadioGroup.RadioGroupFrame,
26
+ Indicator: import_RadioGroup.RadioGroupIndicatorFrame,
27
+ Item: import_RadioGroup.RadioGroupItemFrame
28
+ });
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAIO,yBACP,0BAAiC;AAEjC,0BAAc,+BAPd;AAQA,0BAAc,yBARd;AASA,0BAAc,sCATd;AAWO,MAAM,iBAAa,0CAAiB;AAAA,EACzC,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AACR,CAAC;",
5
+ "names": []
6
+ }
@@ -0,0 +1,39 @@
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
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
22
+ value: !0
23
+ }), mod);
24
+ var index_exports = {};
25
+ __export(index_exports, {
26
+ RadioGroup: () => RadioGroup
27
+ });
28
+ module.exports = __toCommonJS(index_exports);
29
+ var import_RadioGroup = require("./RadioGroup.native.js"),
30
+ import_createRadioGroup = require("./createRadioGroup.native.js");
31
+ __reExport(index_exports, require("./createRadioGroup.native.js"), module.exports);
32
+ __reExport(index_exports, require("./RadioGroup.native.js"), module.exports);
33
+ __reExport(index_exports, require("./RadioGroupStyledContext.native.js"), module.exports);
34
+ var RadioGroup = (0, import_createRadioGroup.createRadioGroup)({
35
+ Frame: import_RadioGroup.RadioGroupFrame,
36
+ Indicator: import_RadioGroup.RadioGroupIndicatorFrame,
37
+ Item: import_RadioGroup.RadioGroupItemFrame
38
+ });
39
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","RadioGroup","module","exports","import_RadioGroup","require","import_createRadioGroup","__reExport","createRadioGroup","Frame","RadioGroupFrame","Indicator","RadioGroupIndicatorFrame","Item","RadioGroupItemFrame"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAIO,CAAAK,aAAA;AAGP,IAAAK,iBAAA,GAAAC,OAAc;EAAAC,uBAPd,GAAAD,OAAA;AAQAE,UAAA,CAAAR,aAAA,EAAcM,OAAA,+BARd,GAAAH,MAAA,CAAAC,OAAA;AASAI,UAAA,CAAAR,aAAA,EAAcM,OAAA,4BAAAH,MAAA,CAAAC,OATd;AAWOI,UAAM,CAAAR,aAAa,EAAAM,OAAA,yCAAAH,MAAiB,CAAAC,OAAA;AAAA,IACzCF,UAAO,OAAAK,uBAAA,CAAAE,gBAAA;EACPC,KAAA,EAAAL,iBAAW,CAAAM,eAAA;EACXC,SAAM,EAAAP,iBAAA,CAAAQ,wBAAA;EACPC,IAAA,EAAAT,iBAAA,CAAAU","ignoreList":[]}