@tamagui/radio-group 2.7.7 → 3.0.0-beta.643.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.
- package/dist/cjs/RadioGroup.cjs +127 -116
- package/dist/cjs/RadioGroup.native.cjs +146 -0
- package/dist/cjs/RadioGroup.native.js +127 -117
- package/dist/cjs/RadioGroup.native.js.map +1 -1
- package/dist/cjs/index.cjs +9 -28
- package/dist/cjs/index.native.cjs +21 -0
- package/dist/cjs/index.native.js +10 -28
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/RadioGroup.mjs +105 -100
- package/dist/esm/RadioGroup.mjs.map +1 -1
- package/dist/esm/RadioGroup.native.js +105 -102
- package/dist/esm/RadioGroup.native.js.map +1 -1
- package/dist/esm/index.js +1 -12
- package/dist/esm/index.mjs +1 -12
- package/dist/esm/index.native.js +1 -12
- package/dist/jsx/RadioGroup.mjs +105 -100
- package/dist/jsx/RadioGroup.mjs.map +1 -1
- package/dist/jsx/RadioGroup.native.cjs +146 -0
- package/dist/jsx/RadioGroup.native.js +127 -117
- package/dist/jsx/RadioGroup.native.js.map +1 -1
- package/dist/jsx/index.js +1 -12
- package/dist/jsx/index.mjs +1 -12
- package/dist/jsx/index.native.cjs +21 -0
- package/dist/jsx/index.native.js +10 -28
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +5 -15
- package/src/RadioGroup.tsx +160 -89
- package/src/index.ts +0 -15
- package/types/RadioGroup.d.ts +145 -16
- package/types/RadioGroup.d.ts.map +1 -1
- package/types/index.d.ts +0 -251
- package/types/index.d.ts.map +1 -1
- package/dist/cjs/RadioGroupStyledContext.cjs +0 -32
- package/dist/cjs/RadioGroupStyledContext.native.js +0 -35
- package/dist/cjs/RadioGroupStyledContext.native.js.map +0 -1
- package/dist/cjs/createRadioGroup.cjs +0 -175
- package/dist/cjs/createRadioGroup.native.js +0 -178
- package/dist/cjs/createRadioGroup.native.js.map +0 -1
- package/dist/esm/RadioGroupStyledContext.mjs +0 -7
- package/dist/esm/RadioGroupStyledContext.mjs.map +0 -1
- package/dist/esm/RadioGroupStyledContext.native.js +0 -7
- package/dist/esm/RadioGroupStyledContext.native.js.map +0 -1
- package/dist/esm/createRadioGroup.mjs +0 -139
- package/dist/esm/createRadioGroup.mjs.map +0 -1
- package/dist/esm/createRadioGroup.native.js +0 -139
- package/dist/esm/createRadioGroup.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/RadioGroupStyledContext.mjs +0 -7
- package/dist/jsx/RadioGroupStyledContext.mjs.map +0 -1
- package/dist/jsx/RadioGroupStyledContext.native.js +0 -35
- package/dist/jsx/RadioGroupStyledContext.native.js.map +0 -1
- package/dist/jsx/createRadioGroup.mjs +0 -139
- package/dist/jsx/createRadioGroup.mjs.map +0 -1
- package/dist/jsx/createRadioGroup.native.js +0 -178
- package/dist/jsx/createRadioGroup.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/src/RadioGroupStyledContext.tsx +0 -10
- package/src/createRadioGroup.tsx +0 -191
- package/types/RadioGroupStyledContext.d.ts +0 -6
- package/types/RadioGroupStyledContext.d.ts.map +0 -1
- package/types/createRadioGroup.d.ts +0 -282
- package/types/createRadioGroup.d.ts.map +0 -1
package/dist/cjs/RadioGroup.cjs
CHANGED
|
@@ -1,133 +1,144 @@
|
|
|
1
|
+
|
|
2
|
+
var __create = Object.create;
|
|
1
3
|
var __defProp = Object.defineProperty;
|
|
2
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
8
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
10
13
|
};
|
|
11
14
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
28
|
var RadioGroup_exports = {};
|
|
24
29
|
__export(RadioGroup_exports, {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
RadioGroup: () => RadioGroup,
|
|
31
|
+
RadioGroupContext: () => RadioGroupContext,
|
|
32
|
+
RadioGroupFrame: () => RadioGroupFrame,
|
|
33
|
+
RadioGroupIndicatorFrame: () => RadioGroupIndicatorFrame,
|
|
34
|
+
RadioGroupItemContext: () => RadioGroupItemContext,
|
|
35
|
+
RadioGroupItemFrame: () => RadioGroupItemFrame
|
|
28
36
|
});
|
|
29
37
|
module.exports = __toCommonJS(RadioGroup_exports);
|
|
30
38
|
var import_core = require("@tamagui/core");
|
|
31
|
-
var
|
|
32
|
-
var
|
|
39
|
+
var import_radio_headless = require("@tamagui/radio-headless");
|
|
40
|
+
var import_roving_focus = require("@tamagui/roving-focus");
|
|
41
|
+
var import_react = __toESM(require("react"), 1);
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
43
|
const RADIO_GROUP_ITEM_NAME = "RadioGroupItem";
|
|
34
|
-
const RadioGroupItemFrame = (0, import_core.styled)(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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": (value, {
|
|
87
|
-
props
|
|
88
|
-
}) => {
|
|
89
|
-
const size = Math.floor((0, import_core.getVariableValue)((0, import_get_token.getSize)(value)) * (props["scaleSize"] ?? 0.5));
|
|
90
|
-
return {
|
|
91
|
-
width: size,
|
|
92
|
-
height: size
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
defaultVariants: {
|
|
98
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
99
|
-
}
|
|
44
|
+
const RadioGroupItemFrame = (0, import_core.styled)(import_core.View, {
|
|
45
|
+
displayName: RADIO_GROUP_ITEM_NAME,
|
|
46
|
+
render: "button",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
variants: { disabled: { true: {
|
|
50
|
+
pointerEvents: "none",
|
|
51
|
+
userSelect: "none"
|
|
52
|
+
} } }
|
|
100
53
|
});
|
|
101
54
|
const RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator";
|
|
102
|
-
const RadioGroupIndicatorFrame = (0, import_core.styled)(
|
|
103
|
-
name: RADIO_GROUP_INDICATOR_NAME,
|
|
104
|
-
variants: {
|
|
105
|
-
unstyled: {
|
|
106
|
-
false: {
|
|
107
|
-
width: "33%",
|
|
108
|
-
height: "33%",
|
|
109
|
-
borderRadius: 1e3,
|
|
110
|
-
backgroundColor: "$color"
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
defaultVariants: {
|
|
115
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
116
|
-
}
|
|
117
|
-
});
|
|
55
|
+
const RadioGroupIndicatorFrame = (0, import_core.styled)(import_core.View, { displayName: RADIO_GROUP_INDICATOR_NAME });
|
|
118
56
|
const RADIO_GROUP_NAME = "RadioGroup";
|
|
119
|
-
const RadioGroupFrame = (0, import_core.styled)(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
57
|
+
const RadioGroupFrame = (0, import_core.styled)(import_core.View, {
|
|
58
|
+
displayName: RADIO_GROUP_NAME,
|
|
59
|
+
variants: { orientation: {
|
|
60
|
+
horizontal: {
|
|
61
|
+
flexDirection: "row",
|
|
62
|
+
spaceDirection: "horizontal"
|
|
63
|
+
},
|
|
64
|
+
vertical: {
|
|
65
|
+
flexDirection: "column",
|
|
66
|
+
spaceDirection: "vertical"
|
|
67
|
+
}
|
|
68
|
+
} }
|
|
69
|
+
});
|
|
70
|
+
const RadioGroupContext = import_react.default.createContext({});
|
|
71
|
+
const RadioGroupItemContext = import_react.default.createContext({
|
|
72
|
+
checked: false,
|
|
73
|
+
disabled: false
|
|
74
|
+
});
|
|
75
|
+
const RadioGroupComponent = (0, import_core.createStyledHOC)(RadioGroupFrame, (props, ref) => {
|
|
76
|
+
const { value, defaultValue, onValueChange, required = false, disabled = false, name, native, accentColor, orientation = "vertical", ...rest } = props;
|
|
77
|
+
const { providerValue, frameAttrs, rovingFocusGroupAttrs } = (0, import_radio_headless.useRadioGroup)({
|
|
78
|
+
orientation,
|
|
79
|
+
name,
|
|
80
|
+
defaultValue,
|
|
81
|
+
value,
|
|
82
|
+
onValueChange,
|
|
83
|
+
required,
|
|
84
|
+
disabled,
|
|
85
|
+
native,
|
|
86
|
+
accentColor
|
|
87
|
+
});
|
|
88
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupContext.Provider, {
|
|
89
|
+
value: providerValue,
|
|
90
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
|
|
91
|
+
...rovingFocusGroupAttrs,
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupFrame, {
|
|
93
|
+
...frameAttrs,
|
|
94
|
+
ref,
|
|
95
|
+
...rest
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
const RadioGroupItem = (0, import_core.createStyledHOC)(RadioGroupItemFrame, (props, ref) => {
|
|
101
|
+
const { value, labelledBy, onPress, onKeyDown, disabled, id, ...rest } = props;
|
|
102
|
+
const { providerValue, bubbleInput, rovingFocusGroupAttrs, frameAttrs, isFormControl, native } = (0, import_radio_headless.useRadioGroupItem)({
|
|
103
|
+
radioGroupContext: RadioGroupContext,
|
|
104
|
+
value,
|
|
105
|
+
id,
|
|
106
|
+
labelledBy,
|
|
107
|
+
disabled,
|
|
108
|
+
onPress,
|
|
109
|
+
onKeyDown
|
|
110
|
+
});
|
|
111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, {
|
|
112
|
+
value: providerValue,
|
|
113
|
+
children: import_core.isWeb && native ? bubbleInput : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
|
|
114
|
+
...rovingFocusGroupAttrs,
|
|
115
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemFrame, {
|
|
116
|
+
...frameAttrs,
|
|
117
|
+
ref,
|
|
118
|
+
...rest
|
|
119
|
+
})
|
|
120
|
+
}), isFormControl && bubbleInput] })
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
124
|
+
const RadioGroupIndicator = (0, import_core.createStyledHOC)(RadioGroupIndicatorFrame, (props, forwardedRef) => {
|
|
125
|
+
const { forceMount, disabled, ...indicatorProps } = props;
|
|
126
|
+
const { checked, ...useIndicatorRest } = (0, import_radio_headless.useRadioGroupItemIndicator)({
|
|
127
|
+
radioGroupItemContext: RadioGroupItemContext,
|
|
128
|
+
disabled
|
|
129
|
+
});
|
|
130
|
+
if (forceMount || checked) {
|
|
131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupIndicatorFrame, {
|
|
132
|
+
...useIndicatorRest,
|
|
133
|
+
ref: forwardedRef,
|
|
134
|
+
...indicatorProps
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
});
|
|
139
|
+
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
140
|
+
const RadioGroup = (0, import_core.withStaticProperties)(RadioGroupComponent, {
|
|
141
|
+
Item: RadioGroupItem,
|
|
142
|
+
Indicator: RadioGroupIndicator
|
|
143
|
+
});
|
|
144
|
+
RadioGroup.displayName = "RadioGroup";
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
28
|
+
}) : target, mod));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var RadioGroup_exports = {};
|
|
31
|
+
__export(RadioGroup_exports, {
|
|
32
|
+
RadioGroup: () => RadioGroup,
|
|
33
|
+
RadioGroupContext: () => RadioGroupContext,
|
|
34
|
+
RadioGroupFrame: () => RadioGroupFrame,
|
|
35
|
+
RadioGroupIndicatorFrame: () => RadioGroupIndicatorFrame,
|
|
36
|
+
RadioGroupItemContext: () => RadioGroupItemContext,
|
|
37
|
+
RadioGroupItemFrame: () => RadioGroupItemFrame
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(RadioGroup_exports);
|
|
40
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
+
var import_core = require("@tamagui/core");
|
|
42
|
+
var import_radio_headless = require("@tamagui/radio-headless");
|
|
43
|
+
var import_roving_focus = require("@tamagui/roving-focus");
|
|
44
|
+
var import_react = __toESM(require("react"), 1);
|
|
45
|
+
var RADIO_GROUP_ITEM_NAME = "RadioGroupItem";
|
|
46
|
+
var RadioGroupItemFrame = (0, import_core.styled)(import_core.View, {
|
|
47
|
+
displayName: RADIO_GROUP_ITEM_NAME,
|
|
48
|
+
render: "button",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
justifyContent: "center",
|
|
51
|
+
variants: { disabled: { true: {
|
|
52
|
+
pointerEvents: "none",
|
|
53
|
+
userSelect: "none"
|
|
54
|
+
} } }
|
|
55
|
+
});
|
|
56
|
+
var RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator";
|
|
57
|
+
var RadioGroupIndicatorFrame = (0, import_core.styled)(import_core.View, { displayName: RADIO_GROUP_INDICATOR_NAME });
|
|
58
|
+
var RADIO_GROUP_NAME = "RadioGroup";
|
|
59
|
+
var RadioGroupFrame = (0, import_core.styled)(import_core.View, {
|
|
60
|
+
displayName: RADIO_GROUP_NAME,
|
|
61
|
+
variants: { orientation: {
|
|
62
|
+
horizontal: {
|
|
63
|
+
flexDirection: "row",
|
|
64
|
+
spaceDirection: "horizontal"
|
|
65
|
+
},
|
|
66
|
+
vertical: {
|
|
67
|
+
flexDirection: "column",
|
|
68
|
+
spaceDirection: "vertical"
|
|
69
|
+
}
|
|
70
|
+
} }
|
|
71
|
+
});
|
|
72
|
+
var RadioGroupContext = /* @__PURE__ */ import_react.default.createContext({});
|
|
73
|
+
var RadioGroupItemContext = /* @__PURE__ */ import_react.default.createContext({
|
|
74
|
+
checked: false,
|
|
75
|
+
disabled: false
|
|
76
|
+
});
|
|
77
|
+
var RadioGroupComponent = (0, import_core.createStyledHOC)(RadioGroupFrame, function(props, ref) {
|
|
78
|
+
var { value, defaultValue, onValueChange, required = false, disabled = false, name, native, accentColor, orientation = "vertical", ...rest } = props;
|
|
79
|
+
var { providerValue, frameAttrs, rovingFocusGroupAttrs } = (0, import_radio_headless.useRadioGroup)({
|
|
80
|
+
orientation,
|
|
81
|
+
name,
|
|
82
|
+
defaultValue,
|
|
83
|
+
value,
|
|
84
|
+
onValueChange,
|
|
85
|
+
required,
|
|
86
|
+
disabled,
|
|
87
|
+
native,
|
|
88
|
+
accentColor
|
|
89
|
+
});
|
|
90
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupContext.Provider, {
|
|
91
|
+
value: providerValue,
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
|
|
93
|
+
...rovingFocusGroupAttrs,
|
|
94
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupFrame, {
|
|
95
|
+
...frameAttrs,
|
|
96
|
+
ref,
|
|
97
|
+
...rest
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
var RadioGroupItem = (0, import_core.createStyledHOC)(RadioGroupItemFrame, function(props, ref) {
|
|
103
|
+
var { value, labelledBy, onPress, onKeyDown, disabled, id, ...rest } = props;
|
|
104
|
+
var { providerValue, bubbleInput, rovingFocusGroupAttrs, frameAttrs, isFormControl, native } = (0, import_radio_headless.useRadioGroupItem)({
|
|
105
|
+
radioGroupContext: RadioGroupContext,
|
|
106
|
+
value,
|
|
107
|
+
id,
|
|
108
|
+
labelledBy,
|
|
109
|
+
disabled,
|
|
110
|
+
onPress,
|
|
111
|
+
onKeyDown
|
|
112
|
+
});
|
|
113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, {
|
|
114
|
+
value: providerValue,
|
|
115
|
+
children: import_core.isWeb && native ? bubbleInput : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
|
|
116
|
+
...rovingFocusGroupAttrs,
|
|
117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemFrame, {
|
|
118
|
+
...frameAttrs,
|
|
119
|
+
ref,
|
|
120
|
+
...rest
|
|
121
|
+
})
|
|
122
|
+
}), isFormControl && bubbleInput] })
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
126
|
+
var RadioGroupIndicator = (0, import_core.createStyledHOC)(RadioGroupIndicatorFrame, function(props, forwardedRef) {
|
|
127
|
+
var { forceMount, disabled, ...indicatorProps } = props;
|
|
128
|
+
var { checked, ...useIndicatorRest } = (0, import_radio_headless.useRadioGroupItemIndicator)({
|
|
129
|
+
radioGroupItemContext: RadioGroupItemContext,
|
|
130
|
+
disabled
|
|
131
|
+
});
|
|
132
|
+
if (forceMount || checked) {
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupIndicatorFrame, {
|
|
134
|
+
...useIndicatorRest,
|
|
135
|
+
ref: forwardedRef,
|
|
136
|
+
...indicatorProps
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
});
|
|
141
|
+
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
142
|
+
var RadioGroup = (0, import_core.withStaticProperties)(RadioGroupComponent, {
|
|
143
|
+
Item: RadioGroupItem,
|
|
144
|
+
Indicator: RadioGroupIndicator
|
|
145
|
+
});
|
|
146
|
+
RadioGroup.displayName = "RadioGroup";
|
|
@@ -1,138 +1,148 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
4
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
10
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
12
15
|
};
|
|
13
16
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
21
24
|
};
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
28
|
+
}) : target, mod));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
30
|
var RadioGroup_exports = {};
|
|
26
31
|
__export(RadioGroup_exports, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
RadioGroup: () => RadioGroup,
|
|
33
|
+
RadioGroupContext: () => RadioGroupContext,
|
|
34
|
+
RadioGroupFrame: () => RadioGroupFrame,
|
|
35
|
+
RadioGroupIndicatorFrame: () => RadioGroupIndicatorFrame,
|
|
36
|
+
RadioGroupItemContext: () => RadioGroupItemContext,
|
|
37
|
+
RadioGroupItemFrame: () => RadioGroupItemFrame
|
|
30
38
|
});
|
|
31
39
|
module.exports = __toCommonJS(RadioGroup_exports);
|
|
40
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
41
|
var import_core = require("@tamagui/core");
|
|
33
|
-
var
|
|
34
|
-
var
|
|
42
|
+
var import_radio_headless = require("@tamagui/radio-headless");
|
|
43
|
+
var import_roving_focus = require("@tamagui/roving-focus");
|
|
44
|
+
var import_react = __toESM(require("react"), 1);
|
|
35
45
|
var RADIO_GROUP_ITEM_NAME = "RadioGroupItem";
|
|
36
|
-
var RadioGroupItemFrame = (0, import_core.styled)(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
alignItems: "center",
|
|
46
|
-
justifyContent: "center",
|
|
47
|
-
borderWidth: 1,
|
|
48
|
-
borderColor: "$borderColor",
|
|
49
|
-
padding: 0,
|
|
50
|
-
hoverStyle: {
|
|
51
|
-
borderColor: "$borderColorHover",
|
|
52
|
-
backgroundColor: "$backgroundHover"
|
|
53
|
-
},
|
|
54
|
-
focusStyle: {
|
|
55
|
-
borderColor: "$borderColorHover",
|
|
56
|
-
backgroundColor: "$backgroundHover"
|
|
57
|
-
},
|
|
58
|
-
focusVisibleStyle: {
|
|
59
|
-
outlineStyle: "solid",
|
|
60
|
-
outlineWidth: 2,
|
|
61
|
-
outlineColor: "$outlineColor"
|
|
62
|
-
},
|
|
63
|
-
pressStyle: {
|
|
64
|
-
borderColor: "$borderColorFocus",
|
|
65
|
-
backgroundColor: "$backgroundFocus"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
disabled: {
|
|
70
|
-
true: {
|
|
71
|
-
pointerEvents: "none",
|
|
72
|
-
userSelect: "none",
|
|
73
|
-
cursor: "not-allowed",
|
|
74
|
-
hoverStyle: {
|
|
75
|
-
borderColor: "$borderColor",
|
|
76
|
-
backgroundColor: "$background"
|
|
77
|
-
},
|
|
78
|
-
pressStyle: {
|
|
79
|
-
borderColor: "$borderColor",
|
|
80
|
-
backgroundColor: "$background"
|
|
81
|
-
},
|
|
82
|
-
focusVisibleStyle: {
|
|
83
|
-
outlineWidth: 0
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
size: {
|
|
88
|
-
"...size": function (value, param) {
|
|
89
|
-
var {
|
|
90
|
-
props
|
|
91
|
-
} = param;
|
|
92
|
-
var _props_scaleSize;
|
|
93
|
-
var size = Math.floor((0, import_core.getVariableValue)((0, import_get_token.getSize)(value)) * ((_props_scaleSize = props["scaleSize"]) !== null && _props_scaleSize !== void 0 ? _props_scaleSize : 0.5));
|
|
94
|
-
return {
|
|
95
|
-
width: size,
|
|
96
|
-
height: size
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
defaultVariants: {
|
|
102
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
103
|
-
}
|
|
46
|
+
var RadioGroupItemFrame = (0, import_core.styled)(import_core.View, {
|
|
47
|
+
displayName: RADIO_GROUP_ITEM_NAME,
|
|
48
|
+
render: "button",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
justifyContent: "center",
|
|
51
|
+
variants: { disabled: { true: {
|
|
52
|
+
pointerEvents: "none",
|
|
53
|
+
userSelect: "none"
|
|
54
|
+
} } }
|
|
104
55
|
});
|
|
105
56
|
var RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator";
|
|
106
|
-
var RadioGroupIndicatorFrame = (0, import_core.styled)(
|
|
107
|
-
name: RADIO_GROUP_INDICATOR_NAME,
|
|
108
|
-
variants: {
|
|
109
|
-
unstyled: {
|
|
110
|
-
false: {
|
|
111
|
-
width: "33%",
|
|
112
|
-
height: "33%",
|
|
113
|
-
borderRadius: 1e3,
|
|
114
|
-
backgroundColor: "$color"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
defaultVariants: {
|
|
119
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
120
|
-
}
|
|
121
|
-
});
|
|
57
|
+
var RadioGroupIndicatorFrame = (0, import_core.styled)(import_core.View, { displayName: RADIO_GROUP_INDICATOR_NAME });
|
|
122
58
|
var RADIO_GROUP_NAME = "RadioGroup";
|
|
123
|
-
var RadioGroupFrame = (0, import_core.styled)(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
59
|
+
var RadioGroupFrame = (0, import_core.styled)(import_core.View, {
|
|
60
|
+
displayName: RADIO_GROUP_NAME,
|
|
61
|
+
variants: { orientation: {
|
|
62
|
+
horizontal: {
|
|
63
|
+
flexDirection: "row",
|
|
64
|
+
spaceDirection: "horizontal"
|
|
65
|
+
},
|
|
66
|
+
vertical: {
|
|
67
|
+
flexDirection: "column",
|
|
68
|
+
spaceDirection: "vertical"
|
|
69
|
+
}
|
|
70
|
+
} }
|
|
71
|
+
});
|
|
72
|
+
var RadioGroupContext = /* @__PURE__ */ import_react.default.createContext({});
|
|
73
|
+
var RadioGroupItemContext = /* @__PURE__ */ import_react.default.createContext({
|
|
74
|
+
checked: false,
|
|
75
|
+
disabled: false
|
|
76
|
+
});
|
|
77
|
+
var RadioGroupComponent = (0, import_core.createStyledHOC)(RadioGroupFrame, function(props, ref) {
|
|
78
|
+
var { value, defaultValue, onValueChange, required = false, disabled = false, name, native, accentColor, orientation = "vertical", ...rest } = props;
|
|
79
|
+
var { providerValue, frameAttrs, rovingFocusGroupAttrs } = (0, import_radio_headless.useRadioGroup)({
|
|
80
|
+
orientation,
|
|
81
|
+
name,
|
|
82
|
+
defaultValue,
|
|
83
|
+
value,
|
|
84
|
+
onValueChange,
|
|
85
|
+
required,
|
|
86
|
+
disabled,
|
|
87
|
+
native,
|
|
88
|
+
accentColor
|
|
89
|
+
});
|
|
90
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupContext.Provider, {
|
|
91
|
+
value: providerValue,
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {
|
|
93
|
+
...rovingFocusGroupAttrs,
|
|
94
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupFrame, {
|
|
95
|
+
...frameAttrs,
|
|
96
|
+
ref,
|
|
97
|
+
...rest
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
});
|
|
137
101
|
});
|
|
102
|
+
var RadioGroupItem = (0, import_core.createStyledHOC)(RadioGroupItemFrame, function(props, ref) {
|
|
103
|
+
var { value, labelledBy, onPress, onKeyDown, disabled, id, ...rest } = props;
|
|
104
|
+
var { providerValue, bubbleInput, rovingFocusGroupAttrs, frameAttrs, isFormControl, native } = (0, import_radio_headless.useRadioGroupItem)({
|
|
105
|
+
radioGroupContext: RadioGroupContext,
|
|
106
|
+
value,
|
|
107
|
+
id,
|
|
108
|
+
labelledBy,
|
|
109
|
+
disabled,
|
|
110
|
+
onPress,
|
|
111
|
+
onKeyDown
|
|
112
|
+
});
|
|
113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, {
|
|
114
|
+
value: providerValue,
|
|
115
|
+
children: import_core.isWeb && native ? bubbleInput : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {
|
|
116
|
+
...rovingFocusGroupAttrs,
|
|
117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemFrame, {
|
|
118
|
+
...frameAttrs,
|
|
119
|
+
ref,
|
|
120
|
+
...rest
|
|
121
|
+
})
|
|
122
|
+
}), isFormControl && bubbleInput] })
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
126
|
+
var RadioGroupIndicator = (0, import_core.createStyledHOC)(RadioGroupIndicatorFrame, function(props, forwardedRef) {
|
|
127
|
+
var { forceMount, disabled, ...indicatorProps } = props;
|
|
128
|
+
var { checked, ...useIndicatorRest } = (0, import_radio_headless.useRadioGroupItemIndicator)({
|
|
129
|
+
radioGroupItemContext: RadioGroupItemContext,
|
|
130
|
+
disabled
|
|
131
|
+
});
|
|
132
|
+
if (forceMount || checked) {
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupIndicatorFrame, {
|
|
134
|
+
...useIndicatorRest,
|
|
135
|
+
ref: forwardedRef,
|
|
136
|
+
...indicatorProps
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
});
|
|
141
|
+
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
142
|
+
var RadioGroup = (0, import_core.withStaticProperties)(RadioGroupComponent, {
|
|
143
|
+
Item: RadioGroupItem,
|
|
144
|
+
Indicator: RadioGroupIndicator
|
|
145
|
+
});
|
|
146
|
+
RadioGroup.displayName = "RadioGroup";
|
|
147
|
+
|
|
138
148
|
//# sourceMappingURL=RadioGroup.native.js.map
|