@tamagui/radio-group 1.116.0 → 1.116.2
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.js +120 -0
- package/dist/cjs/RadioGroupStyledContext.js +25 -0
- package/dist/cjs/createRadioGroup.js +115 -0
- package/dist/cjs/index.js +29 -0
- package/package.json +15 -15
- /package/dist/cjs/{RadioGroup.cjs.map → RadioGroup.js.map} +0 -0
- /package/dist/cjs/{RadioGroupStyledContext.cjs.map → RadioGroupStyledContext.js.map} +0 -0
- /package/dist/cjs/{createRadioGroup.cjs.map → createRadioGroup.js.map} +0 -0
- /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
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
|
|
@@ -0,0 +1,25 @@
|
|
|
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 RadioGroupStyledContext_exports = {};
|
|
16
|
+
__export(RadioGroupStyledContext_exports, {
|
|
17
|
+
RadioGroupStyledContext: () => RadioGroupStyledContext
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(RadioGroupStyledContext_exports);
|
|
20
|
+
var import_core = require("@tamagui/core");
|
|
21
|
+
const RadioGroupStyledContext = (0, import_core.createStyledContext)({
|
|
22
|
+
size: "$true",
|
|
23
|
+
scaleIcon: 1
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=RadioGroupStyledContext.js.map
|
|
@@ -0,0 +1,115 @@
|
|
|
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
|
|
@@ -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 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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/radio-group",
|
|
3
|
-
"version": "1.116.
|
|
3
|
+
"version": "1.116.2",
|
|
4
4
|
"removeSideEffects": true,
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css"
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/compose-refs": "1.116.
|
|
39
|
-
"@tamagui/constants": "1.116.
|
|
40
|
-
"@tamagui/core": "1.116.
|
|
41
|
-
"@tamagui/create-context": "1.116.
|
|
42
|
-
"@tamagui/focusable": "1.116.
|
|
43
|
-
"@tamagui/get-token": "1.116.
|
|
44
|
-
"@tamagui/helpers": "1.116.
|
|
45
|
-
"@tamagui/label": "1.116.
|
|
46
|
-
"@tamagui/radio-headless": "1.116.
|
|
47
|
-
"@tamagui/roving-focus": "1.116.
|
|
48
|
-
"@tamagui/stacks": "1.116.
|
|
49
|
-
"@tamagui/use-controllable-state": "1.116.
|
|
50
|
-
"@tamagui/use-previous": "1.116.
|
|
38
|
+
"@tamagui/compose-refs": "1.116.2",
|
|
39
|
+
"@tamagui/constants": "1.116.2",
|
|
40
|
+
"@tamagui/core": "1.116.2",
|
|
41
|
+
"@tamagui/create-context": "1.116.2",
|
|
42
|
+
"@tamagui/focusable": "1.116.2",
|
|
43
|
+
"@tamagui/get-token": "1.116.2",
|
|
44
|
+
"@tamagui/helpers": "1.116.2",
|
|
45
|
+
"@tamagui/label": "1.116.2",
|
|
46
|
+
"@tamagui/radio-headless": "1.116.2",
|
|
47
|
+
"@tamagui/roving-focus": "1.116.2",
|
|
48
|
+
"@tamagui/stacks": "1.116.2",
|
|
49
|
+
"@tamagui/use-controllable-state": "1.116.2",
|
|
50
|
+
"@tamagui/use-previous": "1.116.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@tamagui/build": "1.116.
|
|
53
|
+
"@tamagui/build": "1.116.2",
|
|
54
54
|
"react": "^18.2.0 || ^19.0.0"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|