@tamagui/radio-group 1.114.4 → 1.115.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.
@@ -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_core = require("@tamagui/core"),
29
+ import_get_token = require("@tamagui/get-token"),
30
+ import_stacks = require("@tamagui/stacks");
31
+ const RADIO_GROUP_ITEM_NAME = "RadioGroupItem",
32
+ RadioGroupItemFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
33
+ name: RADIO_GROUP_ITEM_NAME,
34
+ tag: "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: "$backgroundColor"
77
+ },
78
+ focusVisibleStyle: {
79
+ outlineWidth: 0
80
+ }
81
+ }
82
+ },
83
+ size: {
84
+ "...size": (value, {
85
+ props
86
+ }) => {
87
+ const size = Math.floor((0, import_core.getVariableValue)((0, import_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.TAMAGUI_HEADLESS === "1"
97
+ }
98
+ }),
99
+ RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator",
100
+ RadioGroupIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
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.TAMAGUI_HEADLESS === "1"
115
+ }
116
+ }),
117
+ RADIO_GROUP_NAME = "RadioGroup",
118
+ RadioGroupFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
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
+ });
@@ -3,15 +3,21 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
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
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
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);
15
21
  var RadioGroupStyledContext_exports = {};
16
22
  __export(RadioGroupStyledContext_exports, {
17
23
  RadioGroupStyledContext: () => RadioGroupStyledContext
@@ -21,5 +27,4 @@ var import_core = require("@tamagui/core");
21
27
  const RadioGroupStyledContext = (0, import_core.createStyledContext)({
22
28
  size: "$true",
23
29
  scaleIcon: 1
24
- });
25
- //# sourceMappingURL=RadioGroupStyledContext.js.map
30
+ });
@@ -0,0 +1,166 @@
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_react = __toESM(require("react")),
38
+ import_core = require("@tamagui/core"),
39
+ import_RadioGroup = require("./RadioGroup.cjs"),
40
+ import_radio_headless = require("@tamagui/radio-headless"),
41
+ import_roving_focus = require("@tamagui/roving-focus"),
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
+ //@ts-expect-error
105
+ onKeyDown,
106
+ disabled,
107
+ id,
108
+ ...rest
109
+ } = props,
110
+ {
111
+ providerValue,
112
+ bubbleInput,
113
+ rovingFocusGroupAttrs,
114
+ frameAttrs,
115
+ isFormControl,
116
+ native
117
+ } = (0, import_radio_headless.useRadioGroupItem)({
118
+ radioGroupContext: RadioGroupContext,
119
+ value,
120
+ id,
121
+ labelledBy,
122
+ disabled,
123
+ onPress,
124
+ onKeyDown
125
+ });
126
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, {
127
+ value: providerValue,
128
+ children: import_core.isWeb && native ? bubbleInput : /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
129
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
130
+ ...rovingFocusGroupAttrs,
131
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RadioGroup.RadioGroupItemFrame, {
132
+ ...frameAttrs,
133
+ ref,
134
+ ...rest
135
+ })
136
+ }), isFormControl && bubbleInput]
137
+ })
138
+ });
139
+ });
140
+ RadioGroupItemImp.displayName = "RadioGroupItem";
141
+ const RadioIndicator = Indicator.styleable((props, forwardedRef) => {
142
+ const {
143
+ forceMount,
144
+ disabled,
145
+ ...indicatorProps
146
+ } = props,
147
+ {
148
+ checked,
149
+ ...useIndicatorRest
150
+ } = (0, import_radio_headless.useRadioGroupItemIndicator)({
151
+ radioGroupItemContext: RadioGroupItemContext,
152
+ disabled
153
+ });
154
+ return forceMount || checked ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(Indicator, {
155
+ ...useIndicatorRest,
156
+ ref: forwardedRef,
157
+ ...indicatorProps
158
+ }) : null;
159
+ });
160
+ RadioIndicator.displayName = "RadioIndicator";
161
+ const RadioGroup = (0, import_core.withStaticProperties)(RadioGroupImp, {
162
+ Item: RadioGroupItemImp,
163
+ Indicator: RadioIndicator
164
+ });
165
+ return RadioGroup.displayName = "RadioGroup", RadioGroup;
166
+ }
@@ -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 src_exports = {};
23
+ __export(src_exports, {
24
+ RadioGroup: () => RadioGroup
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+ var import_RadioGroup = require("./RadioGroup.cjs"),
28
+ import_createRadioGroup = require("./createRadioGroup.cjs");
29
+ __reExport(src_exports, require("./createRadioGroup.cjs"), module.exports);
30
+ __reExport(src_exports, require("./RadioGroup.cjs"), module.exports);
31
+ __reExport(src_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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/radio-group",
3
- "version": "1.114.4",
3
+ "version": "1.115.0",
4
4
  "removeSideEffects": true,
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -30,26 +30,27 @@
30
30
  "react-native": "./dist/cjs/index.native.js",
31
31
  "types": "./types/index.d.ts",
32
32
  "import": "./dist/esm/index.mjs",
33
- "require": "./dist/cjs/index.js"
33
+ "require": "./dist/cjs/index.cjs",
34
+ "default": "./dist/cjs/index.native.js"
34
35
  }
35
36
  },
36
37
  "dependencies": {
37
- "@tamagui/compose-refs": "1.114.4",
38
- "@tamagui/constants": "1.114.4",
39
- "@tamagui/core": "1.114.4",
40
- "@tamagui/create-context": "1.114.4",
41
- "@tamagui/focusable": "1.114.4",
42
- "@tamagui/get-token": "1.114.4",
43
- "@tamagui/helpers": "1.114.4",
44
- "@tamagui/label": "1.114.4",
45
- "@tamagui/radio-headless": "1.114.4",
46
- "@tamagui/roving-focus": "1.114.4",
47
- "@tamagui/stacks": "1.114.4",
48
- "@tamagui/use-controllable-state": "1.114.4",
49
- "@tamagui/use-previous": "1.114.4"
38
+ "@tamagui/compose-refs": "1.115.0",
39
+ "@tamagui/constants": "1.115.0",
40
+ "@tamagui/core": "1.115.0",
41
+ "@tamagui/create-context": "1.115.0",
42
+ "@tamagui/focusable": "1.115.0",
43
+ "@tamagui/get-token": "1.115.0",
44
+ "@tamagui/helpers": "1.115.0",
45
+ "@tamagui/label": "1.115.0",
46
+ "@tamagui/radio-headless": "1.115.0",
47
+ "@tamagui/roving-focus": "1.115.0",
48
+ "@tamagui/stacks": "1.115.0",
49
+ "@tamagui/use-controllable-state": "1.115.0",
50
+ "@tamagui/use-previous": "1.115.0"
50
51
  },
51
52
  "devDependencies": {
52
- "@tamagui/build": "1.114.4",
53
+ "@tamagui/build": "1.115.0",
53
54
  "react": "^18.2.0 || ^19.0.0"
54
55
  },
55
56
  "publishConfig": {
@@ -1,120 +0,0 @@
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
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var RadioGroup_exports = {};
16
- __export(RadioGroup_exports, {
17
- RadioGroupFrame: () => RadioGroupFrame,
18
- RadioGroupIndicatorFrame: () => RadioGroupIndicatorFrame,
19
- RadioGroupItemFrame: () => RadioGroupItemFrame
20
- });
21
- module.exports = __toCommonJS(RadioGroup_exports);
22
- var import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_stacks = require("@tamagui/stacks");
23
- const RADIO_GROUP_ITEM_NAME = "RadioGroupItem", RadioGroupItemFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
24
- name: RADIO_GROUP_ITEM_NAME,
25
- tag: "button",
26
- variants: {
27
- unstyled: {
28
- false: {
29
- size: "$true",
30
- borderRadius: 1e3,
31
- backgroundColor: "$background",
32
- alignItems: "center",
33
- justifyContent: "center",
34
- borderWidth: 1,
35
- borderColor: "$borderColor",
36
- padding: 0,
37
- hoverStyle: {
38
- borderColor: "$borderColorHover",
39
- backgroundColor: "$backgroundHover"
40
- },
41
- focusStyle: {
42
- borderColor: "$borderColorHover",
43
- backgroundColor: "$backgroundHover"
44
- },
45
- focusVisibleStyle: {
46
- outlineStyle: "solid",
47
- outlineWidth: 2,
48
- outlineColor: "$outlineColor"
49
- },
50
- pressStyle: {
51
- borderColor: "$borderColorFocus",
52
- backgroundColor: "$backgroundFocus"
53
- }
54
- }
55
- },
56
- disabled: {
57
- true: {
58
- pointerEvents: "none",
59
- userSelect: "none",
60
- cursor: "not-allowed",
61
- hoverStyle: {
62
- borderColor: "$borderColor",
63
- backgroundColor: "$background"
64
- },
65
- pressStyle: {
66
- borderColor: "$borderColor",
67
- backgroundColor: "$backgroundColor"
68
- },
69
- focusVisibleStyle: {
70
- outlineWidth: 0
71
- }
72
- }
73
- },
74
- size: {
75
- "...size": (value, { props }) => {
76
- const size = Math.floor(
77
- (0, import_core.getVariableValue)((0, import_get_token.getSize)(value)) * (props.scaleSize ?? 0.5)
78
- );
79
- return {
80
- width: size,
81
- height: size
82
- };
83
- }
84
- }
85
- },
86
- defaultVariants: {
87
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
88
- }
89
- }), RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator", RadioGroupIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
90
- name: RADIO_GROUP_INDICATOR_NAME,
91
- variants: {
92
- unstyled: {
93
- false: {
94
- width: "33%",
95
- height: "33%",
96
- borderRadius: 1e3,
97
- backgroundColor: "$color",
98
- pressTheme: !0
99
- }
100
- }
101
- },
102
- defaultVariants: {
103
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
104
- }
105
- }), RADIO_GROUP_NAME = "RadioGroup", RadioGroupFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
106
- name: RADIO_GROUP_NAME,
107
- variants: {
108
- orientation: {
109
- horizontal: {
110
- flexDirection: "row",
111
- spaceDirection: "horizontal"
112
- },
113
- vertical: {
114
- flexDirection: "column",
115
- spaceDirection: "vertical"
116
- }
117
- }
118
- }
119
- });
120
- //# sourceMappingURL=RadioGroup.js.map
@@ -1,115 +0,0 @@
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_react = __toESM(require("react")), import_core = require("@tamagui/core"), import_RadioGroup = require("./RadioGroup"), import_radio_headless = require("@tamagui/radio-headless"), import_roving_focus = require("@tamagui/roving-focus"), 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 {
69
- value,
70
- labelledBy,
71
- onPress,
72
- //@ts-expect-error
73
- onKeyDown,
74
- disabled,
75
- id,
76
- ...rest
77
- } = props, {
78
- providerValue,
79
- bubbleInput,
80
- rovingFocusGroupAttrs,
81
- frameAttrs,
82
- isFormControl,
83
- native
84
- } = (0, import_radio_headless.useRadioGroupItem)({
85
- radioGroupContext: RadioGroupContext,
86
- value,
87
- id,
88
- labelledBy,
89
- disabled,
90
- onPress,
91
- onKeyDown
92
- });
93
- 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: [
94
- /* @__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 }) }),
95
- isFormControl && bubbleInput
96
- ] }) });
97
- });
98
- RadioGroupItemImp.displayName = "RadioGroupItem";
99
- const RadioIndicator = Indicator.styleable(
100
- (props, forwardedRef) => {
101
- const { forceMount, disabled, ...indicatorProps } = props, { checked, ...useIndicatorRest } = (0, import_radio_headless.useRadioGroupItemIndicator)({
102
- radioGroupItemContext: RadioGroupItemContext,
103
- disabled
104
- });
105
- return forceMount || checked ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { ...useIndicatorRest, ref: forwardedRef, ...indicatorProps }) : null;
106
- }
107
- );
108
- RadioIndicator.displayName = "RadioIndicator";
109
- const RadioGroup = (0, import_core.withStaticProperties)(RadioGroupImp, {
110
- Item: RadioGroupItemImp,
111
- Indicator: RadioIndicator
112
- });
113
- return RadioGroup.displayName = "RadioGroup", RadioGroup;
114
- }
115
- //# sourceMappingURL=createRadioGroup.js.map
package/dist/cjs/index.js DELETED
@@ -1,29 +0,0 @@
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 src_exports = {};
16
- __export(src_exports, {
17
- RadioGroup: () => RadioGroup
18
- });
19
- module.exports = __toCommonJS(src_exports);
20
- var import_RadioGroup = require("./RadioGroup"), import_createRadioGroup = require("./createRadioGroup");
21
- __reExport(src_exports, require("./createRadioGroup"), module.exports);
22
- __reExport(src_exports, require("./RadioGroup"), module.exports);
23
- __reExport(src_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
File without changes