@tamagui/toggle-group 3.0.0-beta.831.1 → 3.0.0-beta.889.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/Toggle.cjs +11 -17
- package/dist/cjs/Toggle.native.cjs +12 -20
- package/dist/cjs/Toggle.native.js +12 -20
- package/dist/cjs/Toggle.native.js.map +1 -1
- package/dist/esm/Toggle.mjs +11 -17
- package/dist/esm/Toggle.mjs.map +1 -1
- package/dist/esm/Toggle.native.js +12 -20
- package/dist/esm/Toggle.native.js.map +1 -1
- package/dist/jsx/Toggle.mjs +11 -17
- package/dist/jsx/Toggle.mjs.map +1 -1
- package/dist/jsx/Toggle.native.cjs +12 -20
- package/dist/jsx/Toggle.native.js +12 -20
- package/dist/jsx/Toggle.native.js.map +1 -1
- package/package.json +16 -16
- package/src/Toggle.tsx +26 -40
- package/src/ToggleGroup.tsx +2 -0
- package/types/Toggle.d.ts +11 -47
- package/types/Toggle.d.ts.map +1 -1
- package/types/ToggleGroup.d.ts +18 -51
- package/types/ToggleGroup.d.ts.map +1 -1
package/dist/cjs/Toggle.cjs
CHANGED
|
@@ -41,24 +41,18 @@ const ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
41
41
|
justifyContent: "center",
|
|
42
42
|
display: "flex",
|
|
43
43
|
variants: {
|
|
44
|
-
size: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
width: size,
|
|
55
|
-
height: size
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
},
|
|
44
|
+
size: import_web.styled.dynamic((val, { tokens }) => {
|
|
45
|
+
if (!val) return;
|
|
46
|
+
const sizeToken = (0, import_size.resolveSizeToken)(val, "size");
|
|
47
|
+
const size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
48
|
+
return {
|
|
49
|
+
width: size,
|
|
50
|
+
height: size
|
|
51
|
+
};
|
|
52
|
+
}),
|
|
59
53
|
defaultActiveStyle: { true: {} }
|
|
60
54
|
}
|
|
61
|
-
}
|
|
55
|
+
});
|
|
62
56
|
const Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
63
57
|
const { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
64
58
|
const [active = false, setActive] = (0, import_use_controllable_state.useControllableState)({
|
|
@@ -73,7 +67,7 @@ const Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(prop
|
|
|
73
67
|
"data-disabled": props.disabled ? "" : void 0,
|
|
74
68
|
...active && !activeStyle && { defaultActiveStyle: true },
|
|
75
69
|
...buttonProps,
|
|
76
|
-
|
|
70
|
+
style: [buttonProps.style, active && activeStyle],
|
|
77
71
|
ref: forwardedRef,
|
|
78
72
|
onPress: (0, import_helpers.composeEventHandlers)(props.onPress ?? void 0, () => {
|
|
79
73
|
if (!props.disabled) {
|
|
@@ -50,27 +50,19 @@ var ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
50
50
|
justifyContent: "center",
|
|
51
51
|
display: "flex",
|
|
52
52
|
variants: {
|
|
53
|
-
size: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var sizeToken = (0, import_size.resolveSizeToken)(val, "size");
|
|
64
|
-
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
65
|
-
return {
|
|
66
|
-
width: size,
|
|
67
|
-
height: size
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
},
|
|
53
|
+
size: import_web.styled.dynamic(function(val, param) {
|
|
54
|
+
var { tokens } = param;
|
|
55
|
+
if (!val) return;
|
|
56
|
+
var sizeToken = (0, import_size.resolveSizeToken)(val, "size");
|
|
57
|
+
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
58
|
+
return {
|
|
59
|
+
width: size,
|
|
60
|
+
height: size
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
71
63
|
defaultActiveStyle: { true: {} }
|
|
72
64
|
}
|
|
73
|
-
}
|
|
65
|
+
});
|
|
74
66
|
var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
75
67
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
76
68
|
var [active = false, setActive] = (0, import_use_controllable_state.useControllableState)({
|
|
@@ -86,7 +78,7 @@ var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props,
|
|
|
86
78
|
"data-disabled": props.disabled ? "" : void 0,
|
|
87
79
|
...active && !activeStyle && { defaultActiveStyle: true },
|
|
88
80
|
...buttonProps,
|
|
89
|
-
|
|
81
|
+
style: [buttonProps.style, active && activeStyle],
|
|
90
82
|
ref: forwardedRef,
|
|
91
83
|
onPress: (0, import_helpers.composeEventHandlers)((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {
|
|
92
84
|
if (!props.disabled) {
|
|
@@ -50,27 +50,19 @@ var ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
50
50
|
justifyContent: "center",
|
|
51
51
|
display: "flex",
|
|
52
52
|
variants: {
|
|
53
|
-
size: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var sizeToken = (0, import_size.resolveSizeToken)(val, "size");
|
|
64
|
-
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
65
|
-
return {
|
|
66
|
-
width: size,
|
|
67
|
-
height: size
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
},
|
|
53
|
+
size: import_web.styled.dynamic(function(val, param) {
|
|
54
|
+
var { tokens } = param;
|
|
55
|
+
if (!val) return;
|
|
56
|
+
var sizeToken = (0, import_size.resolveSizeToken)(val, "size");
|
|
57
|
+
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
58
|
+
return {
|
|
59
|
+
width: size,
|
|
60
|
+
height: size
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
71
63
|
defaultActiveStyle: { true: {} }
|
|
72
64
|
}
|
|
73
|
-
}
|
|
65
|
+
});
|
|
74
66
|
var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
75
67
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
76
68
|
var [active = false, setActive] = (0, import_use_controllable_state.useControllableState)({
|
|
@@ -86,7 +78,7 @@ var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props,
|
|
|
86
78
|
"data-disabled": props.disabled ? "" : void 0,
|
|
87
79
|
...active && !activeStyle && { defaultActiveStyle: true },
|
|
88
80
|
...buttonProps,
|
|
89
|
-
|
|
81
|
+
style: [buttonProps.style, active && activeStyle],
|
|
90
82
|
ref: forwardedRef,
|
|
91
83
|
onPress: (0, import_helpers.composeEventHandlers)((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {
|
|
92
84
|
if (!props.disabled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.native.js","names":[],"sources":["cjs/Toggle.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 Toggle_exports = {};\n__export(Toggle_exports, {\n Toggle: () => Toggle,\n ToggleFrame: () => ToggleFrame\n});\nmodule.exports = __toCommonJS(Toggle_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_size = require(\"@tamagui/size\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_web = require(\"@tamagui/web\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar NAME = \"Toggle\";\nvar ToggleFrame = (0, import_web.styled)(import_web.View, {\n displayName: NAME,\n render: \"button\",\n context: import_context.context,\n size: true,\n alignItems: \"center\",\n justifyContent: \"center\",\n display: \"flex\",\n variants: {\n size:
|
|
1
|
+
{"version":3,"file":"Toggle.native.js","names":[],"sources":["cjs/Toggle.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 Toggle_exports = {};\n__export(Toggle_exports, {\n Toggle: () => Toggle,\n ToggleFrame: () => ToggleFrame\n});\nmodule.exports = __toCommonJS(Toggle_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_size = require(\"@tamagui/size\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_web = require(\"@tamagui/web\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar NAME = \"Toggle\";\nvar ToggleFrame = (0, import_web.styled)(import_web.View, {\n displayName: NAME,\n render: \"button\",\n context: import_context.context,\n size: true,\n alignItems: \"center\",\n justifyContent: \"center\",\n display: \"flex\",\n variants: {\n size: import_web.styled.dynamic(function(val, param) {\n var { tokens } = param;\n if (!val) return;\n var sizeToken = (0, import_size.resolveSizeToken)(val, \"size\");\n var size = typeof sizeToken === \"number\" ? sizeToken : tokens.size[sizeToken];\n return {\n width: size,\n height: size\n };\n }),\n defaultActiveStyle: {\n true: {}\n }\n }\n});\nvar Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {\n var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;\n var [active = false, setActive] = (0, import_use_controllable_state.useControllableState)({\n prop: activeProp,\n onChange: onActiveChange,\n defaultProp: defaultActive\n });\n var _props_onPress;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleFrame, {\n theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,\n \"aria-pressed\": active,\n \"data-state\": active ? \"on\" : \"off\",\n \"data-disabled\": props.disabled ? \"\" : void 0,\n ...active && !activeStyle && {\n defaultActiveStyle: true\n },\n ...buttonProps,\n style: [\n buttonProps.style,\n active && activeStyle\n ],\n ref: forwardedRef,\n onPress: (0, import_helpers.composeEventHandlers)((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {\n if (!props.disabled) {\n setActive(function(prev) {\n return !prev;\n });\n }\n })\n });\n});\n//# sourceMappingURL=Toggle.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,OAA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AAM,CAAC,EACT;CACF;AACF,CAAC;AACD,IAAI,UAAU,GAAG,oBAAoB,mBAAkB,CAAE,SAAS,QAAQ,OAAO,cAAc;CAC7F,IAAI,EAAE,QAAQ,YAAY,aAAa,gBAAgB,OAAO,gBAAgB,aAAa,GAAG,gBAAgB;CAC9G,IAAI,CAAC,SAAS,OAAO,cAAc,GAAG,8BAA8B,qBAAoB,CAAE;EACxF,MAAM;EACN,UAAU;EACV,aAAa;CACf,CAAC;CACD,IAAI;CACJ,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa;EAC9D,OAAO,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,cAAc;EACtE,gBAAgB;EAChB,cAAc,SAAS,OAAO;EAC9B,iBAAiB,MAAM,WAAW,KAAK,KAAK;EAC5C,GAAG,UAAU,CAAC,eAAe,EAC3B,oBAAoB,KACtB;EACA,GAAG;EACH,OAAO,CACL,YAAY,OACZ,UAAU,WACZ;EACA,KAAK;EACL,UAAU,GAAG,eAAe,qBAAoB,EAAG,iBAAiB,MAAM,aAAa,QAAQ,mBAAmB,KAAK,IAAI,iBAAiB,KAAK,GAAG,WAAW;GAC7J,IAAI,CAAC,MAAM,UAAU;IACnB,UAAU,SAAS,MAAM;KACvB,OAAO,CAAC;IACV,CAAC;GACH;EACF,CAAC;CACH,CAAC;AACH,CAAC"}
|
package/dist/esm/Toggle.mjs
CHANGED
|
@@ -16,24 +16,18 @@ const ToggleFrame = styled(View, {
|
|
|
16
16
|
justifyContent: "center",
|
|
17
17
|
display: "flex",
|
|
18
18
|
variants: {
|
|
19
|
-
size: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
width: size,
|
|
30
|
-
height: size
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
},
|
|
19
|
+
size: styled.dynamic((val, { tokens }) => {
|
|
20
|
+
if (!val) return;
|
|
21
|
+
const sizeToken = resolveSizeToken(val, "size");
|
|
22
|
+
const size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
23
|
+
return {
|
|
24
|
+
width: size,
|
|
25
|
+
height: size
|
|
26
|
+
};
|
|
27
|
+
}),
|
|
34
28
|
defaultActiveStyle: { true: {} }
|
|
35
29
|
}
|
|
36
|
-
}
|
|
30
|
+
});
|
|
37
31
|
const Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
|
|
38
32
|
const { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
39
33
|
const [active = false, setActive] = useControllableState({
|
|
@@ -48,7 +42,7 @@ const Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
|
|
|
48
42
|
"data-disabled": props.disabled ? "" : void 0,
|
|
49
43
|
...active && !activeStyle && { defaultActiveStyle: true },
|
|
50
44
|
...buttonProps,
|
|
51
|
-
|
|
45
|
+
style: [buttonProps.style, active && activeStyle],
|
|
52
46
|
ref: forwardedRef,
|
|
53
47
|
onPress: composeEventHandlers(props.onPress ?? void 0, () => {
|
|
54
48
|
if (!props.disabled) {
|
package/dist/esm/Toggle.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.js","names":[],"sources":["esm/Toggle.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { styled, View } from \"@tamagui/web\";\nimport { context } from \"./context\";\nimport { jsx } from \"react/jsx-runtime\";\nconst NAME = \"Toggle\";\nconst ToggleFrame = styled(
|
|
1
|
+
{"version":3,"file":"Toggle.js","names":[],"sources":["esm/Toggle.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { styled, View } from \"@tamagui/web\";\nimport { context } from \"./context\";\nimport { jsx } from \"react/jsx-runtime\";\nconst NAME = \"Toggle\";\nconst ToggleFrame = styled(View, {\n displayName: NAME,\n render: \"button\",\n context,\n size: true,\n alignItems: \"center\",\n justifyContent: \"center\",\n display: \"flex\",\n variants: {\n size: styled.dynamic((val, { tokens }) => {\n if (!val) return;\n const sizeToken = resolveSizeToken(val, \"size\");\n const size = typeof sizeToken === \"number\" ? sizeToken : tokens.size[sizeToken];\n return {\n width: size,\n height: size\n };\n }),\n defaultActiveStyle: {\n true: {}\n }\n }\n});\nconst Toggle = createRefComponent(\n function Toggle2(props, forwardedRef) {\n const {\n active: activeProp,\n activeStyle,\n defaultActive = false,\n onActiveChange,\n activeTheme,\n ...buttonProps\n } = props;\n const [active = false, setActive] = useControllableState({\n prop: activeProp,\n onChange: onActiveChange,\n defaultProp: defaultActive\n });\n return /* @__PURE__ */ jsx(\n ToggleFrame,\n {\n theme: activeTheme ?? null,\n \"aria-pressed\": active,\n \"data-state\": active ? \"on\" : \"off\",\n \"data-disabled\": props.disabled ? \"\" : void 0,\n ...active && !activeStyle && { defaultActiveStyle: true },\n ...buttonProps,\n style: [buttonProps.style, active && activeStyle],\n ref: forwardedRef,\n onPress: composeEventHandlers(props.onPress ?? void 0, () => {\n if (!props.disabled) {\n setActive((prev) => !prev);\n }\n })\n }\n );\n }\n);\nexport {\n Toggle,\n ToggleFrame\n};\n//# sourceMappingURL=Toggle.js.map\n"],"mappings":";;;;;;;;;AAOA,MAAM,OAAO;AACb,MAAM,cAAc,OAAO,MAAM;CAC/B,aAAa;CACb,QAAQ;CACR;CACA,MAAM;CACN,YAAY;CACZ,gBAAgB;CAChB,SAAS;CACT,UAAU;EACR,MAAM,OAAO,SAAS,KAAK,EAAE,aAAa;GACxC,IAAI,CAAC,KAAK;GACV,MAAM,YAAY,iBAAiB,KAAK,MAAM;GAC9C,MAAM,OAAO,OAAO,cAAc,WAAW,YAAY,OAAO,KAAK;GACrE,OAAO;IACL,OAAO;IACP,QAAQ;GACV;EACF,CAAC;EACD,oBAAoB,EAClB,MAAM,CAAC,EACT;CACF;AACF,CAAC;AACD,MAAM,SAAS,mBACb,SAAS,QAAQ,OAAO,cAAc;CACpC,MAAM,EACJ,QAAQ,YACR,aACA,gBAAgB,OAChB,gBACA,aACA,GAAG,gBACD;CACJ,MAAM,CAAC,SAAS,OAAO,aAAa,qBAAqB;EACvD,MAAM;EACN,UAAU;EACV,aAAa;CACf,CAAC;CACD,OAAuB,oBACrB,aACA;EACE,OAAO,eAAe;EACtB,gBAAgB;EAChB,cAAc,SAAS,OAAO;EAC9B,iBAAiB,MAAM,WAAW,KAAK,KAAK;EAC5C,GAAG,UAAU,CAAC,eAAe,EAAE,oBAAoB,KAAK;EACxD,GAAG;EACH,OAAO,CAAC,YAAY,OAAO,UAAU,WAAW;EAChD,KAAK;EACL,SAAS,qBAAqB,MAAM,WAAW,KAAK,SAAS;GAC3D,IAAI,CAAC,MAAM,UAAU;IACnB,WAAW,SAAS,CAAC,IAAI;GAC3B;EACF,CAAC;CACH,CACF;AACF,CACF"}
|
|
@@ -17,27 +17,19 @@ var ToggleFrame = styled(View, {
|
|
|
17
17
|
justifyContent: "center",
|
|
18
18
|
display: "flex",
|
|
19
19
|
variants: {
|
|
20
|
-
size: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var sizeToken = resolveSizeToken(val, "size");
|
|
31
|
-
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
32
|
-
return {
|
|
33
|
-
width: size,
|
|
34
|
-
height: size
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
},
|
|
20
|
+
size: styled.dynamic(function(val, param) {
|
|
21
|
+
var { tokens } = param;
|
|
22
|
+
if (!val) return;
|
|
23
|
+
var sizeToken = resolveSizeToken(val, "size");
|
|
24
|
+
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
25
|
+
return {
|
|
26
|
+
width: size,
|
|
27
|
+
height: size
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
38
30
|
defaultActiveStyle: { true: {} }
|
|
39
31
|
}
|
|
40
|
-
}
|
|
32
|
+
});
|
|
41
33
|
var Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
|
|
42
34
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
43
35
|
var [active = false, setActive] = useControllableState({
|
|
@@ -53,7 +45,7 @@ var Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
|
|
|
53
45
|
"data-disabled": props.disabled ? "" : void 0,
|
|
54
46
|
...active && !activeStyle && { defaultActiveStyle: true },
|
|
55
47
|
...buttonProps,
|
|
56
|
-
|
|
48
|
+
style: [buttonProps.style, active && activeStyle],
|
|
57
49
|
ref: forwardedRef,
|
|
58
50
|
onPress: composeEventHandlers((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {
|
|
59
51
|
if (!props.disabled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.native.js","names":[],"sources":["esm/Toggle.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { createRefComponent } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { styled, View } from \"@tamagui/web\";\nimport * as React from \"react\";\nimport { context } from \"./context\";\nvar NAME = \"Toggle\";\nvar ToggleFrame = styled(View, {\n displayName: NAME,\n render: \"button\",\n context,\n size: true,\n alignItems: \"center\",\n justifyContent: \"center\",\n display: \"flex\",\n variants: {\n size:
|
|
1
|
+
{"version":3,"file":"Toggle.native.js","names":[],"sources":["esm/Toggle.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { createRefComponent } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { styled, View } from \"@tamagui/web\";\nimport * as React from \"react\";\nimport { context } from \"./context\";\nvar NAME = \"Toggle\";\nvar ToggleFrame = styled(View, {\n displayName: NAME,\n render: \"button\",\n context,\n size: true,\n alignItems: \"center\",\n justifyContent: \"center\",\n display: \"flex\",\n variants: {\n size: styled.dynamic(function(val, param) {\n var { tokens } = param;\n if (!val) return;\n var sizeToken = resolveSizeToken(val, \"size\");\n var size = typeof sizeToken === \"number\" ? sizeToken : tokens.size[sizeToken];\n return {\n width: size,\n height: size\n };\n }),\n defaultActiveStyle: {\n true: {}\n }\n }\n});\nvar Toggle = createRefComponent(function Toggle2(props, forwardedRef) {\n var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;\n var [active = false, setActive] = useControllableState({\n prop: activeProp,\n onChange: onActiveChange,\n defaultProp: defaultActive\n });\n var _props_onPress;\n return /* @__PURE__ */ _jsx(ToggleFrame, {\n theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,\n \"aria-pressed\": active,\n \"data-state\": active ? \"on\" : \"off\",\n \"data-disabled\": props.disabled ? \"\" : void 0,\n ...active && !activeStyle && {\n defaultActiveStyle: true\n },\n ...buttonProps,\n style: [\n buttonProps.style,\n active && activeStyle\n ],\n ref: forwardedRef,\n onPress: composeEventHandlers((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {\n if (!props.disabled) {\n setActive(function(prev) {\n return !prev;\n });\n }\n })\n });\n});\nexport {\n Toggle,\n ToggleFrame\n};\n//# sourceMappingURL=Toggle.js.map\n"],"mappings":";;;;;;;;;;AAQA,IAAI,OAAO;A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|
display: "flex",
|
|
18
18
|
variants: {
|
|
19
|
-
size: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
width: size,
|
|
30
|
-
height: size
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
},
|
|
19
|
+
size: styled.dynamic((val, { tokens }) => {
|
|
20
|
+
if (!val) return;
|
|
21
|
+
const sizeToken = resolveSizeToken(val, "size");
|
|
22
|
+
const size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
23
|
+
return {
|
|
24
|
+
width: size,
|
|
25
|
+
height: size
|
|
26
|
+
};
|
|
27
|
+
}),
|
|
34
28
|
defaultActiveStyle: { true: {} }
|
|
35
29
|
}
|
|
36
|
-
}
|
|
30
|
+
});
|
|
37
31
|
const Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
|
|
38
32
|
const { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
39
33
|
const [active = false, setActive] = useControllableState({
|
|
@@ -48,7 +42,7 @@ const Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
|
|
|
48
42
|
"data-disabled": props.disabled ? "" : void 0,
|
|
49
43
|
...active && !activeStyle && { defaultActiveStyle: true },
|
|
50
44
|
...buttonProps,
|
|
51
|
-
|
|
45
|
+
style: [buttonProps.style, active && activeStyle],
|
|
52
46
|
ref: forwardedRef,
|
|
53
47
|
onPress: composeEventHandlers(props.onPress ?? void 0, () => {
|
|
54
48
|
if (!props.disabled) {
|
package/dist/jsx/Toggle.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.js","names":[],"sources":["jsx/Toggle.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { styled, View } from \"@tamagui/web\";\nimport { context } from \"./context\";\nimport { jsx } from \"react/jsx-runtime\";\nconst NAME = \"Toggle\";\nconst ToggleFrame = styled(
|
|
1
|
+
{"version":3,"file":"Toggle.js","names":[],"sources":["jsx/Toggle.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { resolveSizeToken } from \"@tamagui/size\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { styled, View } from \"@tamagui/web\";\nimport { context } from \"./context\";\nimport { jsx } from \"react/jsx-runtime\";\nconst NAME = \"Toggle\";\nconst ToggleFrame = styled(View, {\n displayName: NAME,\n render: \"button\",\n context,\n size: true,\n alignItems: \"center\",\n justifyContent: \"center\",\n display: \"flex\",\n variants: {\n size: styled.dynamic((val, { tokens }) => {\n if (!val) return;\n const sizeToken = resolveSizeToken(val, \"size\");\n const size = typeof sizeToken === \"number\" ? sizeToken : tokens.size[sizeToken];\n return {\n width: size,\n height: size\n };\n }),\n defaultActiveStyle: {\n true: {}\n }\n }\n});\nconst Toggle = createRefComponent(\n function Toggle2(props, forwardedRef) {\n const {\n active: activeProp,\n activeStyle,\n defaultActive = false,\n onActiveChange,\n activeTheme,\n ...buttonProps\n } = props;\n const [active = false, setActive] = useControllableState({\n prop: activeProp,\n onChange: onActiveChange,\n defaultProp: defaultActive\n });\n return /* @__PURE__ */ jsx(\n ToggleFrame,\n {\n theme: activeTheme ?? null,\n \"aria-pressed\": active,\n \"data-state\": active ? \"on\" : \"off\",\n \"data-disabled\": props.disabled ? \"\" : void 0,\n ...active && !activeStyle && { defaultActiveStyle: true },\n ...buttonProps,\n style: [buttonProps.style, active && activeStyle],\n ref: forwardedRef,\n onPress: composeEventHandlers(props.onPress ?? void 0, () => {\n if (!props.disabled) {\n setActive((prev) => !prev);\n }\n })\n }\n );\n }\n);\nexport {\n Toggle,\n ToggleFrame\n};\n//# sourceMappingURL=Toggle.js.map\n"],"mappings":";;;;;;;;;AAOA,MAAM,OAAO;AACb,MAAM,cAAc,OAAO,MAAM;CAC/B,aAAa;CACb,QAAQ;CACR;CACA,MAAM;CACN,YAAY;CACZ,gBAAgB;CAChB,SAAS;CACT,UAAU;EACR,MAAM,OAAO,SAAS,KAAK,EAAE,aAAa;GACxC,IAAI,CAAC,KAAK;GACV,MAAM,YAAY,iBAAiB,KAAK,MAAM;GAC9C,MAAM,OAAO,OAAO,cAAc,WAAW,YAAY,OAAO,KAAK;GACrE,OAAO;IACL,OAAO;IACP,QAAQ;GACV;EACF,CAAC;EACD,oBAAoB,EAClB,MAAM,CAAC,EACT;CACF;AACF,CAAC;AACD,MAAM,SAAS,mBACb,SAAS,QAAQ,OAAO,cAAc;CACpC,MAAM,EACJ,QAAQ,YACR,aACA,gBAAgB,OAChB,gBACA,aACA,GAAG,gBACD;CACJ,MAAM,CAAC,SAAS,OAAO,aAAa,qBAAqB;EACvD,MAAM;EACN,UAAU;EACV,aAAa;CACf,CAAC;CACD,OAAuB,oBACrB,aACA;EACE,OAAO,eAAe;EACtB,gBAAgB;EAChB,cAAc,SAAS,OAAO;EAC9B,iBAAiB,MAAM,WAAW,KAAK,KAAK;EAC5C,GAAG,UAAU,CAAC,eAAe,EAAE,oBAAoB,KAAK;EACxD,GAAG;EACH,OAAO,CAAC,YAAY,OAAO,UAAU,WAAW;EAChD,KAAK;EACL,SAAS,qBAAqB,MAAM,WAAW,KAAK,SAAS;GAC3D,IAAI,CAAC,MAAM,UAAU;IACnB,WAAW,SAAS,CAAC,IAAI;GAC3B;EACF,CAAC;CACH,CACF;AACF,CACF"}
|
|
@@ -50,27 +50,19 @@ var ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
50
50
|
justifyContent: "center",
|
|
51
51
|
display: "flex",
|
|
52
52
|
variants: {
|
|
53
|
-
size: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var sizeToken = (0, import_size.resolveSizeToken)(val, "size");
|
|
64
|
-
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
65
|
-
return {
|
|
66
|
-
width: size,
|
|
67
|
-
height: size
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
},
|
|
53
|
+
size: import_web.styled.dynamic(function(val, param) {
|
|
54
|
+
var { tokens } = param;
|
|
55
|
+
if (!val) return;
|
|
56
|
+
var sizeToken = (0, import_size.resolveSizeToken)(val, "size");
|
|
57
|
+
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
58
|
+
return {
|
|
59
|
+
width: size,
|
|
60
|
+
height: size
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
71
63
|
defaultActiveStyle: { true: {} }
|
|
72
64
|
}
|
|
73
|
-
}
|
|
65
|
+
});
|
|
74
66
|
var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
75
67
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
76
68
|
var [active = false, setActive] = (0, import_use_controllable_state.useControllableState)({
|
|
@@ -86,7 +78,7 @@ var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props,
|
|
|
86
78
|
"data-disabled": props.disabled ? "" : void 0,
|
|
87
79
|
...active && !activeStyle && { defaultActiveStyle: true },
|
|
88
80
|
...buttonProps,
|
|
89
|
-
|
|
81
|
+
style: [buttonProps.style, active && activeStyle],
|
|
90
82
|
ref: forwardedRef,
|
|
91
83
|
onPress: (0, import_helpers.composeEventHandlers)((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {
|
|
92
84
|
if (!props.disabled) {
|
|
@@ -50,27 +50,19 @@ var ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
50
50
|
justifyContent: "center",
|
|
51
51
|
display: "flex",
|
|
52
52
|
variants: {
|
|
53
|
-
size: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var sizeToken = (0, import_size.resolveSizeToken)(val, "size");
|
|
64
|
-
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
65
|
-
return {
|
|
66
|
-
width: size,
|
|
67
|
-
height: size
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
},
|
|
53
|
+
size: import_web.styled.dynamic(function(val, param) {
|
|
54
|
+
var { tokens } = param;
|
|
55
|
+
if (!val) return;
|
|
56
|
+
var sizeToken = (0, import_size.resolveSizeToken)(val, "size");
|
|
57
|
+
var size = typeof sizeToken === "number" ? sizeToken : tokens.size[sizeToken];
|
|
58
|
+
return {
|
|
59
|
+
width: size,
|
|
60
|
+
height: size
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
71
63
|
defaultActiveStyle: { true: {} }
|
|
72
64
|
}
|
|
73
|
-
}
|
|
65
|
+
});
|
|
74
66
|
var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
75
67
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
76
68
|
var [active = false, setActive] = (0, import_use_controllable_state.useControllableState)({
|
|
@@ -86,7 +78,7 @@ var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props,
|
|
|
86
78
|
"data-disabled": props.disabled ? "" : void 0,
|
|
87
79
|
...active && !activeStyle && { defaultActiveStyle: true },
|
|
88
80
|
...buttonProps,
|
|
89
|
-
|
|
81
|
+
style: [buttonProps.style, active && activeStyle],
|
|
90
82
|
ref: forwardedRef,
|
|
91
83
|
onPress: (0, import_helpers.composeEventHandlers)((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {
|
|
92
84
|
if (!props.disabled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.native.js","names":[],"sources":["jsx/Toggle.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 Toggle_exports = {};\n__export(Toggle_exports, {\n Toggle: () => Toggle,\n ToggleFrame: () => ToggleFrame\n});\nmodule.exports = __toCommonJS(Toggle_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_size = require(\"@tamagui/size\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_web = require(\"@tamagui/web\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar NAME = \"Toggle\";\nvar ToggleFrame = (0, import_web.styled)(import_web.View, {\n displayName: NAME,\n render: \"button\",\n context: import_context.context,\n size: true,\n alignItems: \"center\",\n justifyContent: \"center\",\n display: \"flex\",\n variants: {\n size:
|
|
1
|
+
{"version":3,"file":"Toggle.native.js","names":[],"sources":["jsx/Toggle.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 Toggle_exports = {};\n__export(Toggle_exports, {\n Toggle: () => Toggle,\n ToggleFrame: () => ToggleFrame\n});\nmodule.exports = __toCommonJS(Toggle_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_size = require(\"@tamagui/size\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_web = require(\"@tamagui/web\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_context = require(\"./context\");\nvar NAME = \"Toggle\";\nvar ToggleFrame = (0, import_web.styled)(import_web.View, {\n displayName: NAME,\n render: \"button\",\n context: import_context.context,\n size: true,\n alignItems: \"center\",\n justifyContent: \"center\",\n display: \"flex\",\n variants: {\n size: import_web.styled.dynamic(function(val, param) {\n var { tokens } = param;\n if (!val) return;\n var sizeToken = (0, import_size.resolveSizeToken)(val, \"size\");\n var size = typeof sizeToken === \"number\" ? sizeToken : tokens.size[sizeToken];\n return {\n width: size,\n height: size\n };\n }),\n defaultActiveStyle: {\n true: {}\n }\n }\n});\nvar Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {\n var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;\n var [active = false, setActive] = (0, import_use_controllable_state.useControllableState)({\n prop: activeProp,\n onChange: onActiveChange,\n defaultProp: defaultActive\n });\n var _props_onPress;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleFrame, {\n theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,\n \"aria-pressed\": active,\n \"data-state\": active ? \"on\" : \"off\",\n \"data-disabled\": props.disabled ? \"\" : void 0,\n ...active && !activeStyle && {\n defaultActiveStyle: true\n },\n ...buttonProps,\n style: [\n buttonProps.style,\n active && activeStyle\n ],\n ref: forwardedRef,\n onPress: (0, import_helpers.composeEventHandlers)((_props_onPress = props.onPress) !== null && _props_onPress !== void 0 ? _props_onPress : void 0, function() {\n if (!props.disabled) {\n setActive(function(prev) {\n return !prev;\n });\n }\n })\n });\n});\n//# sourceMappingURL=Toggle.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,IAA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ANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/toggle-group",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.889.1",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"clean:build": "tamagui-build clean:build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tamagui/compose-refs": "3.0.0-beta.
|
|
38
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
39
|
-
"@tamagui/create-context": "3.0.0-beta.
|
|
40
|
-
"@tamagui/focusable": "3.0.0-beta.
|
|
41
|
-
"@tamagui/font-size": "3.0.0-beta.
|
|
42
|
-
"@tamagui/get-token": "3.0.0-beta.
|
|
43
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
44
|
-
"@tamagui/helpers-tamagui": "3.0.0-beta.
|
|
45
|
-
"@tamagui/roving-focus": "3.0.0-beta.
|
|
46
|
-
"@tamagui/size": "3.0.0-beta.
|
|
47
|
-
"@tamagui/stacks": "3.0.0-beta.
|
|
48
|
-
"@tamagui/use-controllable-state": "3.0.0-beta.
|
|
49
|
-
"@tamagui/use-direction": "3.0.0-beta.
|
|
50
|
-
"@tamagui/web": "3.0.0-beta.
|
|
37
|
+
"@tamagui/compose-refs": "3.0.0-beta.889.1",
|
|
38
|
+
"@tamagui/constants": "3.0.0-beta.889.1",
|
|
39
|
+
"@tamagui/create-context": "3.0.0-beta.889.1",
|
|
40
|
+
"@tamagui/focusable": "3.0.0-beta.889.1",
|
|
41
|
+
"@tamagui/font-size": "3.0.0-beta.889.1",
|
|
42
|
+
"@tamagui/get-token": "3.0.0-beta.889.1",
|
|
43
|
+
"@tamagui/helpers": "3.0.0-beta.889.1",
|
|
44
|
+
"@tamagui/helpers-tamagui": "3.0.0-beta.889.1",
|
|
45
|
+
"@tamagui/roving-focus": "3.0.0-beta.889.1",
|
|
46
|
+
"@tamagui/size": "3.0.0-beta.889.1",
|
|
47
|
+
"@tamagui/stacks": "3.0.0-beta.889.1",
|
|
48
|
+
"@tamagui/use-controllable-state": "3.0.0-beta.889.1",
|
|
49
|
+
"@tamagui/use-direction": "3.0.0-beta.889.1",
|
|
50
|
+
"@tamagui/web": "3.0.0-beta.889.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@tamagui/build": "3.0.0-beta.
|
|
53
|
+
"@tamagui/build": "3.0.0-beta.889.1",
|
|
54
54
|
"react": "19.2.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
package/src/Toggle.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { createRefComponent } from '@tamagui/compose-refs'
|
|
|
2
2
|
import { composeEventHandlers } from '@tamagui/helpers'
|
|
3
3
|
import { resolveSizeToken } from '@tamagui/size'
|
|
4
4
|
import { useControllableState } from '@tamagui/use-controllable-state'
|
|
5
|
-
import type { GetProps,
|
|
5
|
+
import type { GetProps, StylePiece, TamaguiElement } from '@tamagui/web'
|
|
6
6
|
import { styled, View } from '@tamagui/web'
|
|
7
7
|
import * as React from 'react'
|
|
8
8
|
import { context } from './context'
|
|
@@ -20,45 +20,31 @@ const NAME = 'Toggle'
|
|
|
20
20
|
// (code/ui/tamagui/src/components/ToggleGroup.tsx). The frame still emits the
|
|
21
21
|
// discrete state (aria-pressed / data-state) via the Toggle component below; the
|
|
22
22
|
// skins can supply a plain style prop object that is applied while active.
|
|
23
|
-
export const ToggleFrame = styled(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
justifyContent: 'center',
|
|
32
|
-
display: 'flex',
|
|
23
|
+
export const ToggleFrame = styled(View, {
|
|
24
|
+
displayName: NAME,
|
|
25
|
+
render: 'button',
|
|
26
|
+
context,
|
|
27
|
+
size: true,
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
display: 'flex',
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
width: size,
|
|
46
|
-
height: size,
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
},
|
|
32
|
+
variants: {
|
|
33
|
+
size: styled.dynamic<any>((val, { tokens }) => {
|
|
34
|
+
if (!val) return
|
|
35
|
+
const sizeToken = resolveSizeToken(val, 'size')
|
|
36
|
+
const size = typeof sizeToken === 'number' ? sizeToken : tokens.size[sizeToken]
|
|
37
|
+
return {
|
|
38
|
+
width: size,
|
|
39
|
+
height: size,
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
accept: {
|
|
58
|
-
activeStyle: 'style',
|
|
59
|
-
} as const,
|
|
60
|
-
}
|
|
61
|
-
)
|
|
43
|
+
defaultActiveStyle: {
|
|
44
|
+
true: {},
|
|
45
|
+
},
|
|
46
|
+
} as const,
|
|
47
|
+
})
|
|
62
48
|
|
|
63
49
|
type ToggleFrameProps = GetProps<typeof ToggleFrame>
|
|
64
50
|
|
|
@@ -69,7 +55,7 @@ type ToggleItemExtraProps = {
|
|
|
69
55
|
active?: boolean
|
|
70
56
|
defaultActive?: boolean
|
|
71
57
|
onActiveChange?(active: boolean): void
|
|
72
|
-
activeStyle?:
|
|
58
|
+
activeStyle?: StylePiece | null
|
|
73
59
|
activeTheme?: string | null
|
|
74
60
|
}
|
|
75
61
|
|
|
@@ -100,7 +86,7 @@ export const Toggle = createRefComponent<TamaguiElement, ToggleProps>(
|
|
|
100
86
|
data-disabled={props.disabled ? '' : undefined}
|
|
101
87
|
{...(active && !activeStyle && { defaultActiveStyle: true })}
|
|
102
88
|
{...buttonProps}
|
|
103
|
-
{
|
|
89
|
+
style={[buttonProps.style, active && activeStyle]}
|
|
104
90
|
ref={forwardedRef}
|
|
105
91
|
onPress={composeEventHandlers(props.onPress ?? undefined, () => {
|
|
106
92
|
if (!props.disabled) {
|
package/src/ToggleGroup.tsx
CHANGED
|
@@ -30,6 +30,8 @@ const { Provider: ToggleGroupContext, useStyledContext: useToggleGroupContext }
|
|
|
30
30
|
createStyledContext<ToggleGroupContextValue>({})
|
|
31
31
|
|
|
32
32
|
type ToggleGroupItemProps = GetProps<typeof ToggleFrame> & {
|
|
33
|
+
activeStyle?: ToggleProps['activeStyle']
|
|
34
|
+
activeTheme?: ToggleProps['activeTheme']
|
|
33
35
|
value: string
|
|
34
36
|
id?: string
|
|
35
37
|
disabled?: boolean
|
package/types/Toggle.d.ts
CHANGED
|
@@ -1,57 +1,21 @@
|
|
|
1
|
-
import type { GetProps,
|
|
1
|
+
import type { GetProps, StylePiece, TamaguiElement } from '@tamagui/web';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
export declare const ToggleFrame: React.FunctionComponent<Omit<import("@tamagui/web").StackNonStyleProps, "active" | "
|
|
4
|
-
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").ViewProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
5
|
-
accept: {
|
|
6
|
-
readonly activeStyle: 'style';
|
|
7
|
-
};
|
|
8
|
-
}>> | undefined;
|
|
9
|
-
}> & import("@tamagui/web").WithFlatVariantValues<{
|
|
3
|
+
export declare const ToggleFrame: React.FunctionComponent<Omit<import("@tamagui/web").StackNonStyleProps, "active" | "defaultActiveStyle" | "size" | keyof import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithFlatVariantValues<{
|
|
10
4
|
active?: boolean | undefined;
|
|
11
5
|
defaultActiveStyle?: boolean | undefined;
|
|
12
|
-
size?:
|
|
13
|
-
}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase & {
|
|
14
|
-
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").ViewProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
15
|
-
accept: {
|
|
16
|
-
readonly activeStyle: 'style';
|
|
17
|
-
};
|
|
18
|
-
}>> | undefined;
|
|
19
|
-
}>> & {
|
|
6
|
+
size?: any;
|
|
7
|
+
}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase>> & {
|
|
20
8
|
ref?: React.Ref<TamaguiElement> | undefined;
|
|
21
|
-
}> & import("@tamagui/web").StaticComponentObject<import("@tamagui/web").TamaDefer, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase
|
|
22
|
-
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").ViewProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
23
|
-
accept: {
|
|
24
|
-
readonly activeStyle: 'style';
|
|
25
|
-
};
|
|
26
|
-
}>> | undefined;
|
|
27
|
-
}, {
|
|
9
|
+
}> & import("@tamagui/web").StaticComponentObject<import("@tamagui/web").TamaDefer, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
28
10
|
active?: boolean | undefined;
|
|
29
11
|
defaultActiveStyle?: boolean | undefined;
|
|
30
|
-
size?:
|
|
31
|
-
}, {
|
|
32
|
-
|
|
33
|
-
readonly activeStyle: 'style';
|
|
34
|
-
};
|
|
35
|
-
}> & Omit<{
|
|
36
|
-
accept: {
|
|
37
|
-
readonly activeStyle: 'style';
|
|
38
|
-
};
|
|
39
|
-
}, "staticConfig"> & {
|
|
40
|
-
__tama: [import("@tamagui/web").TamaDefer, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase & {
|
|
41
|
-
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").ViewProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
42
|
-
accept: {
|
|
43
|
-
readonly activeStyle: 'style';
|
|
44
|
-
};
|
|
45
|
-
}>> | undefined;
|
|
46
|
-
}, {
|
|
12
|
+
size?: any;
|
|
13
|
+
}, import("@tamagui/web").StaticConfigPublic> & Omit<import("@tamagui/web").StaticConfigPublic, "staticConfig"> & {
|
|
14
|
+
__tama: [import("@tamagui/web").TamaDefer, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
47
15
|
active?: boolean | undefined;
|
|
48
16
|
defaultActiveStyle?: boolean | undefined;
|
|
49
|
-
size?:
|
|
50
|
-
},
|
|
51
|
-
accept: {
|
|
52
|
-
readonly activeStyle: 'style';
|
|
53
|
-
};
|
|
54
|
-
}];
|
|
17
|
+
size?: any;
|
|
18
|
+
}, import("@tamagui/web").StaticConfigPublic];
|
|
55
19
|
};
|
|
56
20
|
type ToggleFrameProps = GetProps<typeof ToggleFrame>;
|
|
57
21
|
type ToggleItemExtraProps = {
|
|
@@ -61,7 +25,7 @@ type ToggleItemExtraProps = {
|
|
|
61
25
|
active?: boolean;
|
|
62
26
|
defaultActive?: boolean;
|
|
63
27
|
onActiveChange?(active: boolean): void;
|
|
64
|
-
activeStyle?:
|
|
28
|
+
activeStyle?: StylePiece | null;
|
|
65
29
|
activeTheme?: string | null;
|
|
66
30
|
};
|
|
67
31
|
export type ToggleProps = ToggleFrameProps & ToggleItemExtraProps;
|
package/types/Toggle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../src/Toggle.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../src/Toggle.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAgB9B,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAwBtB,CAAA;AAEF,KAAK,gBAAgB,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAA;AAEpD,KAAK,oBAAoB,GAAG;IAC1B,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;IACtC,WAAW,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,oBAAoB,CAAA;AAEjE,eAAO,MAAM,MAAM,2EAmClB,CAAA"}
|
package/types/ToggleGroup.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { RovingFocusGroup } from '@tamagui/roving-focus';
|
|
2
2
|
import type { GetProps, TamaguiElement } from '@tamagui/web';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import type { ToggleProps } from './Toggle';
|
|
4
5
|
import { ToggleFrame } from './Toggle';
|
|
5
6
|
type ToggleGroupItemProps = GetProps<typeof ToggleFrame> & {
|
|
7
|
+
activeStyle?: ToggleProps['activeStyle'];
|
|
8
|
+
activeTheme?: ToggleProps['activeTheme'];
|
|
6
9
|
value: string;
|
|
7
10
|
id?: string;
|
|
8
11
|
disabled?: boolean;
|
|
@@ -21,75 +24,39 @@ declare const ToggleGroup: ((props: ScopedProps<ToggleGroupProps> & import("@tam
|
|
|
21
24
|
displayName?: string;
|
|
22
25
|
propTypes?: any;
|
|
23
26
|
} & {
|
|
24
|
-
Item: import("@tamagui/web").TamaguiComponent<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase
|
|
25
|
-
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").ViewProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
26
|
-
accept: {
|
|
27
|
-
readonly activeStyle: 'style';
|
|
28
|
-
};
|
|
29
|
-
}>> | undefined;
|
|
30
|
-
}, {
|
|
27
|
+
Item: import("@tamagui/web").TamaguiComponent<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
31
28
|
active?: boolean | undefined;
|
|
32
29
|
defaultActiveStyle?: boolean | undefined;
|
|
33
|
-
size?:
|
|
34
|
-
}>, "__scopeToggleGroup" | "active" | "activeStyle" | "defaultActiveStyle" | "size" | "value" | keyof import("@tamagui/web").StackNonStyleProps | keyof import("@tamagui/web").StackStyleBase> & Omit<import("@tamagui/web").StackNonStyleProps, "active" | "
|
|
35
|
-
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").ViewProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
36
|
-
accept: {
|
|
37
|
-
readonly activeStyle: 'style';
|
|
38
|
-
};
|
|
39
|
-
}>> | undefined;
|
|
40
|
-
}> & import("@tamagui/web").WithFlatVariantValues<{
|
|
30
|
+
size?: any;
|
|
31
|
+
}>, "__scopeToggleGroup" | "active" | "activeStyle" | "activeTheme" | "defaultActiveStyle" | "size" | "value" | keyof import("@tamagui/web").StackNonStyleProps | keyof import("@tamagui/web").StackStyleBase> & Omit<import("@tamagui/web").StackNonStyleProps, "active" | "defaultActiveStyle" | "size" | keyof import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithFlatVariantValues<{
|
|
41
32
|
active?: boolean | undefined;
|
|
42
33
|
defaultActiveStyle?: boolean | undefined;
|
|
43
|
-
size?:
|
|
44
|
-
}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase & {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
readonly activeStyle: 'style';
|
|
48
|
-
};
|
|
49
|
-
}>> | undefined;
|
|
50
|
-
}>> & {
|
|
34
|
+
size?: any;
|
|
35
|
+
}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase>> & {
|
|
36
|
+
activeStyle?: ToggleProps['activeStyle'];
|
|
37
|
+
activeTheme?: ToggleProps['activeTheme'];
|
|
51
38
|
value: string;
|
|
52
39
|
id?: string;
|
|
53
40
|
disabled?: boolean;
|
|
54
41
|
} & {
|
|
55
42
|
__scopeToggleGroup?: string;
|
|
56
|
-
},
|
|
57
|
-
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").ViewProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
58
|
-
accept: {
|
|
59
|
-
readonly activeStyle: 'style';
|
|
60
|
-
};
|
|
61
|
-
}>> | undefined;
|
|
62
|
-
}> & import("@tamagui/web").WithFlatVariantValues<{
|
|
43
|
+
}, TamaguiElement, import("@tamagui/web").StackNonStyleProps & Omit<import("@tamagui/web").StackNonStyleProps, "active" | "defaultActiveStyle" | "size" | keyof import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithFlatVariantValues<{
|
|
63
44
|
active?: boolean | undefined;
|
|
64
45
|
defaultActiveStyle?: boolean | undefined;
|
|
65
|
-
size?:
|
|
66
|
-
}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase & {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
readonly activeStyle: 'style';
|
|
70
|
-
};
|
|
71
|
-
}>> | undefined;
|
|
72
|
-
}>> & {
|
|
46
|
+
size?: any;
|
|
47
|
+
}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase>> & {
|
|
48
|
+
activeStyle?: ToggleProps['activeStyle'];
|
|
49
|
+
activeTheme?: ToggleProps['activeTheme'];
|
|
73
50
|
value: string;
|
|
74
51
|
id?: string;
|
|
75
52
|
disabled?: boolean;
|
|
76
53
|
} & {
|
|
77
54
|
__scopeToggleGroup?: string;
|
|
78
|
-
}, import("@tamagui/web").StackStyleBase
|
|
79
|
-
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").ViewProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
80
|
-
accept: {
|
|
81
|
-
readonly activeStyle: 'style';
|
|
82
|
-
};
|
|
83
|
-
}>> | undefined;
|
|
84
|
-
}, {
|
|
55
|
+
}, import("@tamagui/web").StackStyleBase, {
|
|
85
56
|
active?: boolean | undefined;
|
|
86
57
|
defaultActiveStyle?: boolean | undefined;
|
|
87
|
-
size?:
|
|
88
|
-
},
|
|
89
|
-
accept: {
|
|
90
|
-
readonly activeStyle: 'style';
|
|
91
|
-
};
|
|
92
|
-
}>;
|
|
58
|
+
size?: any;
|
|
59
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
93
60
|
};
|
|
94
61
|
interface ToggleGroupImplSingleProps extends ToggleGroupImplProps {
|
|
95
62
|
/** The controlled stateful value of the item that is pressed. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleGroup.d.ts","sourceRoot":"","sources":["../src/ToggleGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAGxD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ToggleGroup.d.ts","sourceRoot":"","sources":["../src/ToggleGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAGxD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAU,WAAW,EAAE,MAAM,UAAU,CAAA;AAmB9C,KAAK,oBAAoB,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,GAAG;IACzD,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;IACxC,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AA+ED,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzD,UAAU,sBAAuB,SA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