@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"RadioGroup.native.js","names":[],"sources":["cjs/RadioGroup.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar RadioGroup_exports = {};\n__export(RadioGroup_exports, {\n RadioGroup: () => RadioGroup,\n RadioGroupContext: () => RadioGroupContext,\n RadioGroupFrame: () => RadioGroupFrame,\n RadioGroupIndicatorFrame: () => RadioGroupIndicatorFrame,\n RadioGroupItemContext: () => RadioGroupItemContext,\n RadioGroupItemFrame: () => RadioGroupItemFrame\n});\nmodule.exports = __toCommonJS(RadioGroup_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_radio_headless = require(\"@tamagui/radio-headless\");\nvar import_roving_focus = require(\"@tamagui/roving-focus\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar RADIO_GROUP_ITEM_NAME = \"RadioGroupItem\";\nvar RadioGroupItemFrame = (0, import_core.styled)(import_core.View, {\n displayName: RADIO_GROUP_ITEM_NAME,\n render: \"button\",\n alignItems: \"center\",\n justifyContent: \"center\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\",\n userSelect: \"none\"\n }\n }\n }\n});\nvar RADIO_GROUP_INDICATOR_NAME = \"RadioGroupIndicator\";\nvar RadioGroupIndicatorFrame = (0, import_core.styled)(import_core.View, {\n displayName: RADIO_GROUP_INDICATOR_NAME\n});\nvar RADIO_GROUP_NAME = \"RadioGroup\";\nvar RadioGroupFrame = (0, import_core.styled)(import_core.View, {\n displayName: RADIO_GROUP_NAME,\n variants: {\n orientation: {\n horizontal: {\n flexDirection: \"row\",\n spaceDirection: \"horizontal\"\n },\n vertical: {\n flexDirection: \"column\",\n spaceDirection: \"vertical\"\n }\n }\n }\n});\nvar RadioGroupContext = /* @__PURE__ */ import_react.default.createContext({});\nvar RadioGroupItemContext = /* @__PURE__ */ import_react.default.createContext({\n checked: false,\n disabled: false\n});\nvar RadioGroupComponent = (0, import_core.createStyledHOC)(RadioGroupFrame, function(props, ref) {\n var { value, defaultValue, onValueChange, required = false, disabled = false, name, native, accentColor, orientation = \"vertical\", ...rest } = props;\n var { providerValue, frameAttrs, rovingFocusGroupAttrs } = (0, import_radio_headless.useRadioGroup)({\n orientation,\n name,\n defaultValue,\n value,\n onValueChange,\n required,\n disabled,\n native,\n accentColor\n });\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupContext.Provider, {\n value: providerValue,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup, {\n ...rovingFocusGroupAttrs,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupFrame, {\n ...frameAttrs,\n ref,\n ...rest\n })\n })\n });\n});\nvar RadioGroupItem = (0, import_core.createStyledHOC)(RadioGroupItemFrame, function(props, ref) {\n var { value, labelledBy, onPress, onKeyDown, disabled, id, ...rest } = props;\n var { providerValue, bubbleInput, rovingFocusGroupAttrs, frameAttrs, isFormControl, native } = (0, import_radio_headless.useRadioGroupItem)({\n radioGroupContext: RadioGroupContext,\n value,\n id,\n labelledBy,\n disabled,\n onPress,\n onKeyDown\n });\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemContext.Provider, {\n value: providerValue,\n children: import_core.isWeb && native ? bubbleInput : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_roving_focus.RovingFocusGroup.Item, {\n ...rovingFocusGroupAttrs,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemFrame, {\n ...frameAttrs,\n ref,\n ...rest\n })\n }),\n isFormControl && bubbleInput\n ]\n })\n });\n});\nRadioGroupItem.displayName = \"RadioGroupItem\";\nvar RadioGroupIndicator = (0, import_core.createStyledHOC)(RadioGroupIndicatorFrame, function(props, forwardedRef) {\n var { forceMount, disabled, ...indicatorProps } = props;\n var { checked, ...useIndicatorRest } = (0, import_radio_headless.useRadioGroupItemIndicator)({\n radioGroupItemContext: RadioGroupItemContext,\n disabled\n });\n if (forceMount || checked) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupIndicatorFrame, {\n ...useIndicatorRest,\n ref: forwardedRef,\n ...indicatorProps\n });\n }\n return null;\n});\nRadioGroupIndicator.displayName = \"RadioGroupIndicator\";\nvar RadioGroup = (0, import_core.withStaticProperties)(RadioGroupComponent, {\n Item: RadioGroupItem,\n Indicator: RadioGroupIndicator\n});\nRadioGroup.displayName = \"RadioGroup\";\n//# sourceMappingURL=RadioGroup.js.map\n"],"mappings":";;;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,qBAAqB,CAAC;AAC1B,SAAS,oBAAoB;CAC3B,kBAAkB;CAClB,yBAAyB;CACzB,uBAAuB;CACvB,gCAAgC;CAChC,6BAA6B;CAC7B,2BAA2B;AAC7B,CAAC;AACD,OAAO,UAAU,aAAa,kBAAkB;AAChD,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,wBAAwB,QAAQ,yBAAyB;AAC7D,IAAI,sBAAsB,QAAQ,uBAAuB;AACzD,IAAI,eAAe,QAAQ,QAAQ,OAAO,GAAG,CAAC;AAC9C,IAAI,wBAAwB;AAC5B,IAAI,uBAAuB,GAAG,YAAY,QAAQ,YAAY,MAAM;CAClE,aAAa;CACb,QAAQ;CACR,YAAY;CACZ,gBAAgB;CAChB,UAAU,EACR,UAAU,EACR,MAAM;EACJ,eAAe;EACf,YAAY;CACd,EACF,EACF;AACF,CAAC;AACD,IAAI,6BAA6B;AACjC,IAAI,4BAA4B,GAAG,YAAY,QAAQ,YAAY,MAAM,EACvE,aAAa,2BACf,CAAC;AACD,IAAI,mBAAmB;AACvB,IAAI,mBAAmB,GAAG,YAAY,QAAQ,YAAY,MAAM;CAC9D,aAAa;CACb,UAAU,EACR,aAAa;EACX,YAAY;GACV,eAAe;GACf,gBAAgB;EAClB;EACA,UAAU;GACR,eAAe;GACf,gBAAgB;EAClB;CACF,EACF;AACF,CAAC;AACD,IAAI,oBAAoC,6BAAa,QAAQ,cAAc,CAAC,CAAC;AAC7E,IAAI,wBAAwC,6BAAa,QAAQ,cAAc;CAC7E,SAAS;CACT,UAAU;AACZ,CAAC;AACD,IAAI,uBAAuB,GAAG,YAAY,iBAAiB,iBAAiB,SAAS,OAAO,KAAK;CAC/F,IAAI,EAAE,OAAO,cAAc,eAAe,WAAW,OAAO,WAAW,OAAO,MAAM,QAAQ,aAAa,cAAc,YAAY,GAAG,SAAS;CAC/I,IAAI,EAAE,eAAe,YAAY,2BAA2B,GAAG,sBAAsB,eAAe;EAClG;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,kBAAkB,UAAU;EAC7E,OAAO;EACP,UAA0B,iBAAC,GAAG,mBAAmB,KAAK,oBAAoB,kBAAkB;GAC1F,GAAG;GACH,UAA0B,iBAAC,GAAG,mBAAmB,KAAK,iBAAiB;IACrE,GAAG;IACH;IACA,GAAG;GACL,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC;AACD,IAAI,kBAAkB,GAAG,YAAY,iBAAiB,qBAAqB,SAAS,OAAO,KAAK;CAC9F,IAAI,EAAE,OAAO,YAAY,SAAS,WAAW,UAAU,IAAI,GAAG,SAAS;CACvE,IAAI,EAAE,eAAe,aAAa,uBAAuB,YAAY,eAAe,YAAY,GAAG,sBAAsB,mBAAmB;EAC1I,mBAAmB;EACnB;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,sBAAsB,UAAU;EACjF,OAAO;EACP,UAAU,YAAY,SAAS,SAAS,cAA8B,iBAAC,GAAG,mBAAmB,MAAM,mBAAmB,UAAU,EAC9H,UAAU,CACQ,iBAAC,GAAG,mBAAmB,KAAK,oBAAoB,iBAAiB,MAAM;GACrF,GAAG;GACH,UAA0B,iBAAC,GAAG,mBAAmB,KAAK,qBAAqB;IACzE,GAAG;IACH;IACA,GAAG;GACL,CAAC;EACH,CAAC,GACD,iBAAiB,WACnB,EACF,CAAC;CACH,CAAC;AACH,CAAC;AACD,eAAe,cAAc;AAC7B,IAAI,uBAAuB,GAAG,YAAY,iBAAiB,0BAA0B,SAAS,OAAO,cAAc;CACjH,IAAI,EAAE,YAAY,UAAU,GAAG,mBAAmB;CAClD,IAAI,EAAE,SAAS,GAAG,sBAAsB,GAAG,sBAAsB,4BAA4B;EAC3F,uBAAuB;EACvB;CACF,CAAC;CACD,IAAI,cAAc,SAAS;EACzB,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,0BAA0B;GAC3E,GAAG;GACH,KAAK;GACL,GAAG;EACL,CAAC;CACH;CACA,OAAO;AACT,CAAC;AACD,oBAAoB,cAAc;AAClC,IAAI,cAAc,GAAG,YAAY,sBAAsB,qBAAqB;CAC1E,MAAM;CACN,WAAW;AACb,CAAC;AACD,WAAW,cAAc"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,38 +1,19 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
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: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
6
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
19
14
|
};
|
|
20
15
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
22
|
-
value: true
|
|
23
|
-
}), mod);
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
17
|
var index_exports = {};
|
|
25
|
-
__export(index_exports, {
|
|
26
|
-
RadioGroup: () => RadioGroup
|
|
27
|
-
});
|
|
28
18
|
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
var import_RadioGroup = require("./RadioGroup.cjs");
|
|
30
|
-
var import_createRadioGroup = require("./createRadioGroup.cjs");
|
|
31
|
-
__reExport(index_exports, require("./createRadioGroup.cjs"), module.exports);
|
|
32
19
|
__reExport(index_exports, require("./RadioGroup.cjs"), module.exports);
|
|
33
|
-
__reExport(index_exports, require("./RadioGroupStyledContext.cjs"), module.exports);
|
|
34
|
-
const RadioGroup = (0, import_createRadioGroup.createRadioGroup)({
|
|
35
|
-
Frame: import_RadioGroup.RadioGroupFrame,
|
|
36
|
-
Indicator: import_RadioGroup.RadioGroupIndicatorFrame,
|
|
37
|
-
Item: import_RadioGroup.RadioGroupItemFrame
|
|
38
|
-
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
module.exports = __toCommonJS(index_exports);
|
|
21
|
+
__reExport(index_exports, require("./RadioGroup.native.js"), module.exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,41 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
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: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
8
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
21
16
|
};
|
|
22
17
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
24
|
-
value: true
|
|
25
|
-
}), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
19
|
var index_exports = {};
|
|
27
|
-
__export(index_exports, {
|
|
28
|
-
RadioGroup: () => RadioGroup
|
|
29
|
-
});
|
|
30
20
|
module.exports = __toCommonJS(index_exports);
|
|
31
|
-
var import_RadioGroup = require("./RadioGroup.native.js");
|
|
32
|
-
var import_createRadioGroup = require("./createRadioGroup.native.js");
|
|
33
|
-
__reExport(index_exports, require("./createRadioGroup.native.js"), module.exports);
|
|
34
21
|
__reExport(index_exports, require("./RadioGroup.native.js"), module.exports);
|
|
35
|
-
|
|
36
|
-
var RadioGroup = (0, import_createRadioGroup.createRadioGroup)({
|
|
37
|
-
Frame: import_RadioGroup.RadioGroupFrame,
|
|
38
|
-
Indicator: import_RadioGroup.RadioGroupIndicatorFrame,
|
|
39
|
-
Item: import_RadioGroup.RadioGroupItemFrame
|
|
40
|
-
});
|
|
22
|
+
|
|
41
23
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./RadioGroup\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,wBAAc,GAAG,OAAO,OAAO"}
|
package/dist/esm/RadioGroup.mjs
CHANGED
|
@@ -1,106 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { View, createStyledHOC, isWeb, styled, withStaticProperties } from "@tamagui/core";
|
|
2
|
+
import { useRadioGroup, useRadioGroupItem, useRadioGroupItemIndicator } from "@tamagui/radio-headless";
|
|
3
|
+
import { RovingFocusGroup } from "@tamagui/roving-focus";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
4
7
|
const RADIO_GROUP_ITEM_NAME = "RadioGroupItem";
|
|
5
|
-
const RadioGroupItemFrame = styled(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
alignItems: "center",
|
|
15
|
-
justifyContent: "center",
|
|
16
|
-
borderWidth: 1,
|
|
17
|
-
borderColor: "$borderColor",
|
|
18
|
-
padding: 0,
|
|
19
|
-
hoverStyle: {
|
|
20
|
-
borderColor: "$borderColorHover",
|
|
21
|
-
backgroundColor: "$backgroundHover"
|
|
22
|
-
},
|
|
23
|
-
focusStyle: {
|
|
24
|
-
borderColor: "$borderColorHover",
|
|
25
|
-
backgroundColor: "$backgroundHover"
|
|
26
|
-
},
|
|
27
|
-
focusVisibleStyle: {
|
|
28
|
-
outlineStyle: "solid",
|
|
29
|
-
outlineWidth: 2,
|
|
30
|
-
outlineColor: "$outlineColor"
|
|
31
|
-
},
|
|
32
|
-
pressStyle: {
|
|
33
|
-
borderColor: "$borderColorFocus",
|
|
34
|
-
backgroundColor: "$backgroundFocus"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
disabled: {
|
|
39
|
-
true: {
|
|
40
|
-
pointerEvents: "none",
|
|
41
|
-
userSelect: "none",
|
|
42
|
-
cursor: "not-allowed",
|
|
43
|
-
hoverStyle: {
|
|
44
|
-
borderColor: "$borderColor",
|
|
45
|
-
backgroundColor: "$background"
|
|
46
|
-
},
|
|
47
|
-
pressStyle: {
|
|
48
|
-
borderColor: "$borderColor",
|
|
49
|
-
backgroundColor: "$background"
|
|
50
|
-
},
|
|
51
|
-
focusVisibleStyle: {
|
|
52
|
-
outlineWidth: 0
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
size: {
|
|
57
|
-
"...size": (value, {
|
|
58
|
-
props
|
|
59
|
-
}) => {
|
|
60
|
-
const size = Math.floor(getVariableValue(getSize(value)) * (props["scaleSize"] ?? 0.5));
|
|
61
|
-
return {
|
|
62
|
-
width: size,
|
|
63
|
-
height: size
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
defaultVariants: {
|
|
69
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
70
|
-
}
|
|
8
|
+
const RadioGroupItemFrame = styled(View, {
|
|
9
|
+
displayName: RADIO_GROUP_ITEM_NAME,
|
|
10
|
+
render: "button",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
variants: { disabled: { true: {
|
|
14
|
+
pointerEvents: "none",
|
|
15
|
+
userSelect: "none"
|
|
16
|
+
} } }
|
|
71
17
|
});
|
|
72
18
|
const RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator";
|
|
73
|
-
const RadioGroupIndicatorFrame = styled(
|
|
74
|
-
name: RADIO_GROUP_INDICATOR_NAME,
|
|
75
|
-
variants: {
|
|
76
|
-
unstyled: {
|
|
77
|
-
false: {
|
|
78
|
-
width: "33%",
|
|
79
|
-
height: "33%",
|
|
80
|
-
borderRadius: 1e3,
|
|
81
|
-
backgroundColor: "$color"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
defaultVariants: {
|
|
86
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
87
|
-
}
|
|
88
|
-
});
|
|
19
|
+
const RadioGroupIndicatorFrame = styled(View, { displayName: RADIO_GROUP_INDICATOR_NAME });
|
|
89
20
|
const RADIO_GROUP_NAME = "RadioGroup";
|
|
90
|
-
const RadioGroupFrame = styled(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
21
|
+
const RadioGroupFrame = styled(View, {
|
|
22
|
+
displayName: RADIO_GROUP_NAME,
|
|
23
|
+
variants: { orientation: {
|
|
24
|
+
horizontal: {
|
|
25
|
+
flexDirection: "row",
|
|
26
|
+
spaceDirection: "horizontal"
|
|
27
|
+
},
|
|
28
|
+
vertical: {
|
|
29
|
+
flexDirection: "column",
|
|
30
|
+
spaceDirection: "vertical"
|
|
31
|
+
}
|
|
32
|
+
} }
|
|
33
|
+
});
|
|
34
|
+
const RadioGroupContext = React.createContext({});
|
|
35
|
+
const RadioGroupItemContext = React.createContext({
|
|
36
|
+
checked: false,
|
|
37
|
+
disabled: false
|
|
38
|
+
});
|
|
39
|
+
const RadioGroupComponent = createStyledHOC(RadioGroupFrame, (props, ref) => {
|
|
40
|
+
const { value, defaultValue, onValueChange, required = false, disabled = false, name, native, accentColor, orientation = "vertical", ...rest } = props;
|
|
41
|
+
const { providerValue, frameAttrs, rovingFocusGroupAttrs } = useRadioGroup({
|
|
42
|
+
orientation,
|
|
43
|
+
name,
|
|
44
|
+
defaultValue,
|
|
45
|
+
value,
|
|
46
|
+
onValueChange,
|
|
47
|
+
required,
|
|
48
|
+
disabled,
|
|
49
|
+
native,
|
|
50
|
+
accentColor
|
|
51
|
+
});
|
|
52
|
+
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, {
|
|
53
|
+
value: providerValue,
|
|
54
|
+
children: /* @__PURE__ */ jsx(RovingFocusGroup, {
|
|
55
|
+
...rovingFocusGroupAttrs,
|
|
56
|
+
children: /* @__PURE__ */ jsx(RadioGroupFrame, {
|
|
57
|
+
...frameAttrs,
|
|
58
|
+
ref,
|
|
59
|
+
...rest
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
const RadioGroupItem = createStyledHOC(RadioGroupItemFrame, (props, ref) => {
|
|
65
|
+
const { value, labelledBy, onPress, onKeyDown, disabled, id, ...rest } = props;
|
|
66
|
+
const { providerValue, bubbleInput, rovingFocusGroupAttrs, frameAttrs, isFormControl, native } = useRadioGroupItem({
|
|
67
|
+
radioGroupContext: RadioGroupContext,
|
|
68
|
+
value,
|
|
69
|
+
id,
|
|
70
|
+
labelledBy,
|
|
71
|
+
disabled,
|
|
72
|
+
onPress,
|
|
73
|
+
onKeyDown
|
|
74
|
+
});
|
|
75
|
+
return /* @__PURE__ */ jsx(RadioGroupItemContext.Provider, {
|
|
76
|
+
value: providerValue,
|
|
77
|
+
children: isWeb && native ? bubbleInput : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(RovingFocusGroup.Item, {
|
|
78
|
+
...rovingFocusGroupAttrs,
|
|
79
|
+
children: /* @__PURE__ */ jsx(RadioGroupItemFrame, {
|
|
80
|
+
...frameAttrs,
|
|
81
|
+
ref,
|
|
82
|
+
...rest
|
|
83
|
+
})
|
|
84
|
+
}), isFormControl && bubbleInput] })
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
88
|
+
const RadioGroupIndicator = createStyledHOC(RadioGroupIndicatorFrame, (props, forwardedRef) => {
|
|
89
|
+
const { forceMount, disabled, ...indicatorProps } = props;
|
|
90
|
+
const { checked, ...useIndicatorRest } = useRadioGroupItemIndicator({
|
|
91
|
+
radioGroupItemContext: RadioGroupItemContext,
|
|
92
|
+
disabled
|
|
93
|
+
});
|
|
94
|
+
if (forceMount || checked) {
|
|
95
|
+
return /* @__PURE__ */ jsx(RadioGroupIndicatorFrame, {
|
|
96
|
+
...useIndicatorRest,
|
|
97
|
+
ref: forwardedRef,
|
|
98
|
+
...indicatorProps
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
});
|
|
103
|
+
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
104
|
+
const RadioGroup = withStaticProperties(RadioGroupComponent, {
|
|
105
|
+
Item: RadioGroupItem,
|
|
106
|
+
Indicator: RadioGroupIndicator
|
|
104
107
|
});
|
|
105
|
-
|
|
108
|
+
RadioGroup.displayName = "RadioGroup";
|
|
109
|
+
|
|
110
|
+
export { RadioGroup, RadioGroupContext, RadioGroupFrame, RadioGroupIndicatorFrame, RadioGroupItemContext, RadioGroupItemFrame };
|
|
106
111
|
//# sourceMappingURL=RadioGroup.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","names":[],"sources":["esm/RadioGroup.js"],"sourcesContent":["import { createStyledHOC, isWeb, styled, View, withStaticProperties } from \"@tamagui/core\";\nimport {\n useRadioGroup,\n useRadioGroupItem,\n useRadioGroupItemIndicator\n} from \"@tamagui/radio-headless\";\nimport { RovingFocusGroup } from \"@tamagui/roving-focus\";\nimport React from \"react\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nconst RADIO_GROUP_ITEM_NAME = \"RadioGroupItem\";\nconst RadioGroupItemFrame = styled(View, {\n displayName: RADIO_GROUP_ITEM_NAME,\n render: \"button\",\n alignItems: \"center\",\n justifyContent: \"center\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\",\n userSelect: \"none\"\n }\n }\n }\n});\nconst RADIO_GROUP_INDICATOR_NAME = \"RadioGroupIndicator\";\nconst RadioGroupIndicatorFrame = styled(View, {\n displayName: RADIO_GROUP_INDICATOR_NAME\n});\nconst RADIO_GROUP_NAME = \"RadioGroup\";\nconst RadioGroupFrame = styled(View, {\n displayName: RADIO_GROUP_NAME,\n variants: {\n orientation: {\n horizontal: {\n flexDirection: \"row\",\n spaceDirection: \"horizontal\"\n },\n vertical: {\n flexDirection: \"column\",\n spaceDirection: \"vertical\"\n }\n }\n }\n});\nconst RadioGroupContext = React.createContext({});\nconst RadioGroupItemContext = React.createContext({\n checked: false,\n disabled: false\n});\nconst RadioGroupComponent = createStyledHOC(\n RadioGroupFrame,\n (props, ref) => {\n const {\n value,\n defaultValue,\n onValueChange,\n required = false,\n disabled = false,\n name,\n native,\n accentColor,\n orientation = \"vertical\",\n ...rest\n } = props;\n const { providerValue, frameAttrs, rovingFocusGroupAttrs } = useRadioGroup({\n orientation,\n name,\n defaultValue,\n value,\n onValueChange,\n required,\n disabled,\n native,\n accentColor\n });\n return /* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: providerValue, children: /* @__PURE__ */ jsx(RovingFocusGroup, { ...rovingFocusGroupAttrs, children: /* @__PURE__ */ jsx(RadioGroupFrame, { ...frameAttrs, ref, ...rest }) }) });\n }\n);\nconst RadioGroupItem = createStyledHOC(\n RadioGroupItemFrame,\n (props, ref) => {\n const { value, labelledBy, onPress, onKeyDown, disabled, id, ...rest } = props;\n const {\n providerValue,\n bubbleInput,\n rovingFocusGroupAttrs,\n frameAttrs,\n isFormControl,\n native\n } = useRadioGroupItem({\n radioGroupContext: RadioGroupContext,\n value,\n id,\n labelledBy,\n disabled,\n onPress,\n onKeyDown\n });\n return /* @__PURE__ */ jsx(RadioGroupItemContext.Provider, { value: providerValue, children: isWeb && native ? bubbleInput : /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(RovingFocusGroup.Item, { ...rovingFocusGroupAttrs, children: /* @__PURE__ */ jsx(RadioGroupItemFrame, { ...frameAttrs, ref, ...rest }) }),\n isFormControl && bubbleInput\n ] }) });\n }\n);\nRadioGroupItem.displayName = \"RadioGroupItem\";\nconst RadioGroupIndicator = createStyledHOC(\n RadioGroupIndicatorFrame,\n (props, forwardedRef) => {\n const { forceMount, disabled, ...indicatorProps } = props;\n const { checked, ...useIndicatorRest } = useRadioGroupItemIndicator({\n radioGroupItemContext: RadioGroupItemContext,\n disabled\n });\n if (forceMount || checked) {\n return /* @__PURE__ */ jsx(\n RadioGroupIndicatorFrame,\n {\n ...useIndicatorRest,\n ref: forwardedRef,\n ...indicatorProps\n }\n );\n }\n return null;\n }\n);\nRadioGroupIndicator.displayName = \"RadioGroupIndicator\";\nconst RadioGroup = withStaticProperties(RadioGroupComponent, {\n Item: RadioGroupItem,\n Indicator: RadioGroupIndicator\n});\nRadioGroup.displayName = \"RadioGroup\";\nexport {\n RadioGroup,\n RadioGroupContext,\n RadioGroupFrame,\n RadioGroupIndicatorFrame,\n RadioGroupItemContext,\n RadioGroupItemFrame\n};\n//# sourceMappingURL=RadioGroup.js.map\n"],"mappings":";;;;;;;AASA,MAAM,wBAAwB;AAC9B,MAAM,sBAAsB,OAAO,MAAM;CACvC,aAAa;CACb,QAAQ;CACR,YAAY;CACZ,gBAAgB;CAChB,UAAU,EACR,UAAU,EACR,MAAM;EACJ,eAAe;EACf,YAAY;CACd,EACF,EACF;AACF,CAAC;AACD,MAAM,6BAA6B;AACnC,MAAM,2BAA2B,OAAO,MAAM,EAC5C,aAAa,2BACf,CAAC;AACD,MAAM,mBAAmB;AACzB,MAAM,kBAAkB,OAAO,MAAM;CACnC,aAAa;CACb,UAAU,EACR,aAAa;EACX,YAAY;GACV,eAAe;GACf,gBAAgB;EAClB;EACA,UAAU;GACR,eAAe;GACf,gBAAgB;EAClB;CACF,EACF;AACF,CAAC;AACD,MAAM,oBAAoB,MAAM,cAAc,CAAC,CAAC;AAChD,MAAM,wBAAwB,MAAM,cAAc;CAChD,SAAS;CACT,UAAU;AACZ,CAAC;AACD,MAAM,sBAAsB,gBAC1B,kBACC,OAAO,QAAQ;CACd,MAAM,EACJ,OACA,cACA,eACA,WAAW,OACX,WAAW,OACX,MACA,QACA,aACA,cAAc,YACd,GAAG,SACD;CACJ,MAAM,EAAE,eAAe,YAAY,0BAA0B,cAAc;EACzE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,OAAuB,oBAAI,kBAAkB,UAAU;EAAE,OAAO;EAAe,UAA0B,oBAAI,kBAAkB;GAAE,GAAG;GAAuB,UAA0B,oBAAI,iBAAiB;IAAE,GAAG;IAAY;IAAK,GAAG;GAAK,CAAC;EAAE,CAAC;CAAE,CAAC;AACjP,CACF;AACA,MAAM,iBAAiB,gBACrB,sBACC,OAAO,QAAQ;CACd,MAAM,EAAE,OAAO,YAAY,SAAS,WAAW,UAAU,IAAI,GAAG,SAAS;CACzE,MAAM,EACJ,eACA,aACA,uBACA,YACA,eACA,WACE,kBAAkB;EACpB,mBAAmB;EACnB;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,OAAuB,oBAAI,sBAAsB,UAAU;EAAE,OAAO;EAAe,UAAU,SAAS,SAAS,cAA8B,qBAAK,UAAU,EAAE,UAAU,CACtJ,oBAAI,iBAAiB,MAAM;GAAE,GAAG;GAAuB,UAA0B,oBAAI,qBAAqB;IAAE,GAAG;IAAY;IAAK,GAAG;GAAK,CAAC;EAAE,CAAC,GAC5J,iBAAiB,WACnB,EAAE,CAAC;CAAE,CAAC;AACR,CACF;AACA,eAAe,cAAc;AAC7B,MAAM,sBAAsB,gBAC1B,2BACC,OAAO,iBAAiB;CACvB,MAAM,EAAE,YAAY,UAAU,GAAG,mBAAmB;CACpD,MAAM,EAAE,SAAS,GAAG,qBAAqB,2BAA2B;EAClE,uBAAuB;EACvB;CACF,CAAC;CACD,IAAI,cAAc,SAAS;EACzB,OAAuB,oBACrB,0BACA;GACE,GAAG;GACH,KAAK;GACL,GAAG;EACL,CACF;CACF;CACA,OAAO;AACT,CACF;AACA,oBAAoB,cAAc;AAClC,MAAM,aAAa,qBAAqB,qBAAqB;CAC3D,MAAM;CACN,WAAW;AACb,CAAC;AACD,WAAW,cAAc"}
|
|
@@ -1,108 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View, createStyledHOC, isWeb, styled, withStaticProperties } from "@tamagui/core";
|
|
3
|
+
import { useRadioGroup, useRadioGroupItem, useRadioGroupItemIndicator } from "@tamagui/radio-headless";
|
|
4
|
+
import { RovingFocusGroup } from "@tamagui/roving-focus";
|
|
5
|
+
import React from "react";
|
|
6
|
+
|
|
4
7
|
var RADIO_GROUP_ITEM_NAME = "RadioGroupItem";
|
|
5
|
-
var RadioGroupItemFrame = styled(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
alignItems: "center",
|
|
15
|
-
justifyContent: "center",
|
|
16
|
-
borderWidth: 1,
|
|
17
|
-
borderColor: "$borderColor",
|
|
18
|
-
padding: 0,
|
|
19
|
-
hoverStyle: {
|
|
20
|
-
borderColor: "$borderColorHover",
|
|
21
|
-
backgroundColor: "$backgroundHover"
|
|
22
|
-
},
|
|
23
|
-
focusStyle: {
|
|
24
|
-
borderColor: "$borderColorHover",
|
|
25
|
-
backgroundColor: "$backgroundHover"
|
|
26
|
-
},
|
|
27
|
-
focusVisibleStyle: {
|
|
28
|
-
outlineStyle: "solid",
|
|
29
|
-
outlineWidth: 2,
|
|
30
|
-
outlineColor: "$outlineColor"
|
|
31
|
-
},
|
|
32
|
-
pressStyle: {
|
|
33
|
-
borderColor: "$borderColorFocus",
|
|
34
|
-
backgroundColor: "$backgroundFocus"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
disabled: {
|
|
39
|
-
true: {
|
|
40
|
-
pointerEvents: "none",
|
|
41
|
-
userSelect: "none",
|
|
42
|
-
cursor: "not-allowed",
|
|
43
|
-
hoverStyle: {
|
|
44
|
-
borderColor: "$borderColor",
|
|
45
|
-
backgroundColor: "$background"
|
|
46
|
-
},
|
|
47
|
-
pressStyle: {
|
|
48
|
-
borderColor: "$borderColor",
|
|
49
|
-
backgroundColor: "$background"
|
|
50
|
-
},
|
|
51
|
-
focusVisibleStyle: {
|
|
52
|
-
outlineWidth: 0
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
size: {
|
|
57
|
-
"...size": function (value, param) {
|
|
58
|
-
var {
|
|
59
|
-
props
|
|
60
|
-
} = param;
|
|
61
|
-
var _props_scaleSize;
|
|
62
|
-
var size = Math.floor(getVariableValue(getSize(value)) * ((_props_scaleSize = props["scaleSize"]) !== null && _props_scaleSize !== void 0 ? _props_scaleSize : 0.5));
|
|
63
|
-
return {
|
|
64
|
-
width: size,
|
|
65
|
-
height: size
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
defaultVariants: {
|
|
71
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
72
|
-
}
|
|
8
|
+
var RadioGroupItemFrame = styled(View, {
|
|
9
|
+
displayName: RADIO_GROUP_ITEM_NAME,
|
|
10
|
+
render: "button",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
variants: { disabled: { true: {
|
|
14
|
+
pointerEvents: "none",
|
|
15
|
+
userSelect: "none"
|
|
16
|
+
} } }
|
|
73
17
|
});
|
|
74
18
|
var RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator";
|
|
75
|
-
var RadioGroupIndicatorFrame = styled(
|
|
76
|
-
name: RADIO_GROUP_INDICATOR_NAME,
|
|
77
|
-
variants: {
|
|
78
|
-
unstyled: {
|
|
79
|
-
false: {
|
|
80
|
-
width: "33%",
|
|
81
|
-
height: "33%",
|
|
82
|
-
borderRadius: 1e3,
|
|
83
|
-
backgroundColor: "$color"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
defaultVariants: {
|
|
88
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
89
|
-
}
|
|
90
|
-
});
|
|
19
|
+
var RadioGroupIndicatorFrame = styled(View, { displayName: RADIO_GROUP_INDICATOR_NAME });
|
|
91
20
|
var RADIO_GROUP_NAME = "RadioGroup";
|
|
92
|
-
var RadioGroupFrame = styled(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
21
|
+
var RadioGroupFrame = styled(View, {
|
|
22
|
+
displayName: RADIO_GROUP_NAME,
|
|
23
|
+
variants: { orientation: {
|
|
24
|
+
horizontal: {
|
|
25
|
+
flexDirection: "row",
|
|
26
|
+
spaceDirection: "horizontal"
|
|
27
|
+
},
|
|
28
|
+
vertical: {
|
|
29
|
+
flexDirection: "column",
|
|
30
|
+
spaceDirection: "vertical"
|
|
31
|
+
}
|
|
32
|
+
} }
|
|
33
|
+
});
|
|
34
|
+
var RadioGroupContext = /* @__PURE__ */ React.createContext({});
|
|
35
|
+
var RadioGroupItemContext = /* @__PURE__ */ React.createContext({
|
|
36
|
+
checked: false,
|
|
37
|
+
disabled: false
|
|
38
|
+
});
|
|
39
|
+
var RadioGroupComponent = createStyledHOC(RadioGroupFrame, function(props, ref) {
|
|
40
|
+
var { value, defaultValue, onValueChange, required = false, disabled = false, name, native, accentColor, orientation = "vertical", ...rest } = props;
|
|
41
|
+
var { providerValue, frameAttrs, rovingFocusGroupAttrs } = useRadioGroup({
|
|
42
|
+
orientation,
|
|
43
|
+
name,
|
|
44
|
+
defaultValue,
|
|
45
|
+
value,
|
|
46
|
+
onValueChange,
|
|
47
|
+
required,
|
|
48
|
+
disabled,
|
|
49
|
+
native,
|
|
50
|
+
accentColor
|
|
51
|
+
});
|
|
52
|
+
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, {
|
|
53
|
+
value: providerValue,
|
|
54
|
+
children: /* @__PURE__ */ jsx(RovingFocusGroup, {
|
|
55
|
+
...rovingFocusGroupAttrs,
|
|
56
|
+
children: /* @__PURE__ */ jsx(RadioGroupFrame, {
|
|
57
|
+
...frameAttrs,
|
|
58
|
+
ref,
|
|
59
|
+
...rest
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
var RadioGroupItem = createStyledHOC(RadioGroupItemFrame, function(props, ref) {
|
|
65
|
+
var { value, labelledBy, onPress, onKeyDown, disabled, id, ...rest } = props;
|
|
66
|
+
var { providerValue, bubbleInput, rovingFocusGroupAttrs, frameAttrs, isFormControl, native } = useRadioGroupItem({
|
|
67
|
+
radioGroupContext: RadioGroupContext,
|
|
68
|
+
value,
|
|
69
|
+
id,
|
|
70
|
+
labelledBy,
|
|
71
|
+
disabled,
|
|
72
|
+
onPress,
|
|
73
|
+
onKeyDown
|
|
74
|
+
});
|
|
75
|
+
return /* @__PURE__ */ jsx(RadioGroupItemContext.Provider, {
|
|
76
|
+
value: providerValue,
|
|
77
|
+
children: isWeb && native ? bubbleInput : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(RovingFocusGroup.Item, {
|
|
78
|
+
...rovingFocusGroupAttrs,
|
|
79
|
+
children: /* @__PURE__ */ jsx(RadioGroupItemFrame, {
|
|
80
|
+
...frameAttrs,
|
|
81
|
+
ref,
|
|
82
|
+
...rest
|
|
83
|
+
})
|
|
84
|
+
}), isFormControl && bubbleInput] })
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
88
|
+
var RadioGroupIndicator = createStyledHOC(RadioGroupIndicatorFrame, function(props, forwardedRef) {
|
|
89
|
+
var { forceMount, disabled, ...indicatorProps } = props;
|
|
90
|
+
var { checked, ...useIndicatorRest } = useRadioGroupItemIndicator({
|
|
91
|
+
radioGroupItemContext: RadioGroupItemContext,
|
|
92
|
+
disabled
|
|
93
|
+
});
|
|
94
|
+
if (forceMount || checked) {
|
|
95
|
+
return /* @__PURE__ */ jsx(RadioGroupIndicatorFrame, {
|
|
96
|
+
...useIndicatorRest,
|
|
97
|
+
ref: forwardedRef,
|
|
98
|
+
...indicatorProps
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
});
|
|
103
|
+
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
104
|
+
var RadioGroup = withStaticProperties(RadioGroupComponent, {
|
|
105
|
+
Item: RadioGroupItem,
|
|
106
|
+
Indicator: RadioGroupIndicator
|
|
106
107
|
});
|
|
107
|
-
|
|
108
|
+
RadioGroup.displayName = "RadioGroup";
|
|
109
|
+
|
|
110
|
+
export { RadioGroup, RadioGroupContext, RadioGroupFrame, RadioGroupIndicatorFrame, RadioGroupItemContext, RadioGroupItemFrame };
|
|
108
111
|
//# sourceMappingURL=RadioGroup.native.js.map
|