@tamagui/toggle-group 3.0.0-beta.1313.1 → 3.0.0-beta.1342.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 +1 -15
- package/dist/cjs/Toggle.native.cjs +1 -15
- package/dist/cjs/Toggle.native.js +1 -15
- package/dist/cjs/Toggle.native.js.map +1 -1
- package/dist/esm/Toggle.mjs +1 -15
- package/dist/esm/Toggle.mjs.map +1 -1
- package/dist/esm/Toggle.native.js +1 -15
- package/dist/esm/Toggle.native.js.map +1 -1
- package/dist/jsx/Toggle.mjs +1 -15
- package/dist/jsx/Toggle.mjs.map +1 -1
- package/dist/jsx/Toggle.native.cjs +1 -15
- package/dist/jsx/Toggle.native.js +1 -15
- package/dist/jsx/Toggle.native.js.map +1 -1
- package/package.json +15 -16
- package/src/Toggle.tsx +7 -21
- package/types/Toggle.d.ts +1 -4
- package/types/Toggle.d.ts.map +1 -1
- package/types/ToggleGroup.d.ts +2 -6
- package/types/ToggleGroup.d.ts.map +1 -1
package/dist/cjs/Toggle.cjs
CHANGED
|
@@ -26,7 +26,6 @@ __export(Toggle_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(Toggle_exports);
|
|
27
27
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
28
28
|
var import_helpers = require("@tamagui/helpers");
|
|
29
|
-
var import_size = require("@tamagui/size");
|
|
30
29
|
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
31
30
|
var import_web = require("@tamagui/web");
|
|
32
31
|
var import_context = require("./context.cjs");
|
|
@@ -36,22 +35,9 @@ const ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
36
35
|
displayName: NAME,
|
|
37
36
|
render: "button",
|
|
38
37
|
context: import_context.context,
|
|
39
|
-
size: true,
|
|
40
38
|
alignItems: "center",
|
|
41
39
|
justifyContent: "center",
|
|
42
|
-
variants: {
|
|
43
|
-
size: import_web.styled.dynamic((val, env) => {
|
|
44
|
-
if (!val) return;
|
|
45
|
-
const { frame, controlHeight } = (0, import_size.resolveSize)(val, env);
|
|
46
|
-
const side = controlHeight + 2;
|
|
47
|
-
return {
|
|
48
|
-
width: side,
|
|
49
|
-
height: side,
|
|
50
|
-
borderRadius: frame.borderRadius
|
|
51
|
-
};
|
|
52
|
-
}),
|
|
53
|
-
defaultActiveStyle: { true: {} }
|
|
54
|
-
}
|
|
40
|
+
variants: { defaultActiveStyle: { true: {} } }
|
|
55
41
|
});
|
|
56
42
|
const Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
57
43
|
const { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
@@ -35,7 +35,6 @@ module.exports = __toCommonJS(Toggle_exports);
|
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
37
37
|
var import_helpers = require("@tamagui/helpers");
|
|
38
|
-
var import_size = require("@tamagui/size");
|
|
39
38
|
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
40
39
|
var import_web = require("@tamagui/web");
|
|
41
40
|
var React = __toESM(require("react"), 1);
|
|
@@ -45,22 +44,9 @@ var ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
45
44
|
displayName: NAME,
|
|
46
45
|
render: "button",
|
|
47
46
|
context: import_context.context,
|
|
48
|
-
size: true,
|
|
49
47
|
alignItems: "center",
|
|
50
48
|
justifyContent: "center",
|
|
51
|
-
variants: {
|
|
52
|
-
size: import_web.styled.dynamic(function(val, env) {
|
|
53
|
-
if (!val) return;
|
|
54
|
-
var { frame, controlHeight } = (0, import_size.resolveSize)(val, env);
|
|
55
|
-
var side = controlHeight + 2;
|
|
56
|
-
return {
|
|
57
|
-
width: side,
|
|
58
|
-
height: side,
|
|
59
|
-
borderRadius: frame.borderRadius
|
|
60
|
-
};
|
|
61
|
-
}),
|
|
62
|
-
defaultActiveStyle: { true: {} }
|
|
63
|
-
}
|
|
49
|
+
variants: { defaultActiveStyle: { true: {} } }
|
|
64
50
|
});
|
|
65
51
|
var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
66
52
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
@@ -35,7 +35,6 @@ module.exports = __toCommonJS(Toggle_exports);
|
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
37
37
|
var import_helpers = require("@tamagui/helpers");
|
|
38
|
-
var import_size = require("@tamagui/size");
|
|
39
38
|
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
40
39
|
var import_web = require("@tamagui/web");
|
|
41
40
|
var React = __toESM(require("react"), 1);
|
|
@@ -45,22 +44,9 @@ var ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
45
44
|
displayName: NAME,
|
|
46
45
|
render: "button",
|
|
47
46
|
context: import_context.context,
|
|
48
|
-
size: true,
|
|
49
47
|
alignItems: "center",
|
|
50
48
|
justifyContent: "center",
|
|
51
|
-
variants: {
|
|
52
|
-
size: import_web.styled.dynamic(function(val, env) {
|
|
53
|
-
if (!val) return;
|
|
54
|
-
var { frame, controlHeight } = (0, import_size.resolveSize)(val, env);
|
|
55
|
-
var side = controlHeight + 2;
|
|
56
|
-
return {
|
|
57
|
-
width: side,
|
|
58
|
-
height: side,
|
|
59
|
-
borderRadius: frame.borderRadius
|
|
60
|
-
};
|
|
61
|
-
}),
|
|
62
|
-
defaultActiveStyle: { true: {} }
|
|
63
|
-
}
|
|
49
|
+
variants: { defaultActiveStyle: { true: {} } }
|
|
64
50
|
});
|
|
65
51
|
var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
66
52
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
@@ -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
|
|
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_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 alignItems: \"center\",\n justifyContent: \"center\",\n variants: {\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: active ? activeTheme !== null && activeTheme !== void 0 ? activeTheme : null : 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,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS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gB;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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRefComponent } from "@tamagui/compose-refs";
|
|
2
2
|
import { composeEventHandlers } from "@tamagui/helpers";
|
|
3
|
-
import { resolveSize } from "@tamagui/size";
|
|
4
3
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
5
4
|
import { View, styled } from "@tamagui/web";
|
|
6
5
|
import { context } from "./context.mjs";
|
|
@@ -11,22 +10,9 @@ const ToggleFrame = styled(View, {
|
|
|
11
10
|
displayName: NAME,
|
|
12
11
|
render: "button",
|
|
13
12
|
context,
|
|
14
|
-
size: true,
|
|
15
13
|
alignItems: "center",
|
|
16
14
|
justifyContent: "center",
|
|
17
|
-
variants: {
|
|
18
|
-
size: styled.dynamic((val, env) => {
|
|
19
|
-
if (!val) return;
|
|
20
|
-
const { frame, controlHeight } = resolveSize(val, env);
|
|
21
|
-
const side = controlHeight + 2;
|
|
22
|
-
return {
|
|
23
|
-
width: side,
|
|
24
|
-
height: side,
|
|
25
|
-
borderRadius: frame.borderRadius
|
|
26
|
-
};
|
|
27
|
-
}),
|
|
28
|
-
defaultActiveStyle: { true: {} }
|
|
29
|
-
}
|
|
15
|
+
variants: { defaultActiveStyle: { true: {} } }
|
|
30
16
|
});
|
|
31
17
|
const Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
|
|
32
18
|
const { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
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 {
|
|
1
|
+
{"version":3,"file":"Toggle.js","names":[],"sources":["esm/Toggle.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\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 alignItems: \"center\",\n justifyContent: \"center\",\n variants: {\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: active ? activeTheme ?? null : 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":";;;;;;;;AAMA,MAAM,OAAO;AACb,MAAM,cAAc,OAAO,MAAM;CAC/B,aAAa;CACb,QAAQ;CACR;CACA,YAAY;CACZ,gBAAgB;CAChB,UAAU,EACR,oBAAoB,EAClB,MAAM,CAAC,EACT,EACF;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,SAAS,eAAe,OAAO;EACtC,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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createRefComponent } from "@tamagui/compose-refs";
|
|
3
3
|
import { composeEventHandlers } from "@tamagui/helpers";
|
|
4
|
-
import { resolveSize } from "@tamagui/size";
|
|
5
4
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
6
5
|
import { View, styled } from "@tamagui/web";
|
|
7
6
|
import "react";
|
|
@@ -12,22 +11,9 @@ var ToggleFrame = styled(View, {
|
|
|
12
11
|
displayName: NAME,
|
|
13
12
|
render: "button",
|
|
14
13
|
context,
|
|
15
|
-
size: true,
|
|
16
14
|
alignItems: "center",
|
|
17
15
|
justifyContent: "center",
|
|
18
|
-
variants: {
|
|
19
|
-
size: styled.dynamic(function(val, env) {
|
|
20
|
-
if (!val) return;
|
|
21
|
-
var { frame, controlHeight } = resolveSize(val, env);
|
|
22
|
-
var side = controlHeight + 2;
|
|
23
|
-
return {
|
|
24
|
-
width: side,
|
|
25
|
-
height: side,
|
|
26
|
-
borderRadius: frame.borderRadius
|
|
27
|
-
};
|
|
28
|
-
}),
|
|
29
|
-
defaultActiveStyle: { true: {} }
|
|
30
|
-
}
|
|
16
|
+
variants: { defaultActiveStyle: { true: {} } }
|
|
31
17
|
});
|
|
32
18
|
var Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
|
|
33
19
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
@@ -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 {
|
|
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 { 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 alignItems: \"center\",\n justifyContent: \"center\",\n variants: {\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: active ? activeTheme !== null && activeTheme !== void 0 ? activeTheme : null : 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":";;;;;;;;;AAOA,IAAI,OAAO;AACX,IAAI,cAAc,OAAO,MAAM;CAC7B,aAAa;CACb,QAAQ;CACR;CACA,YAAY;CACZ,gBAAgB;CAChB,UAAU,EACR,oBAAoB,EAClB,MAAM,CAAC,EACT,EACF;AACF,CAAC;AACD,IAAI,SAAS,mBAAmB,SAAS,QAAQ,OAAO,cAAc;CACpE,IAAI,EAAE,QAAQ,YAAY,aAAa,gBAAgB,OAAO,gBAAgB,aAAa,GAAG,gBAAgB;CAC9G,IAAI,CAAC,SAAS,OAAO,aAAa,qBAAqB;EACrD,MAAM;EACN,UAAU;EACV,aAAa;CACf,CAAC;CACD,IAAI;CACJ,OAAuB,oBAAK,aAAa;EACvC,OAAO,SAAS,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,cAAc,OAAO;EACtF,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,SAAS,sBAAsB,iBAAiB,MAAM,aAAa,QAAQ,mBAAmB,KAAK,IAAI,iBAAiB,KAAK,GAAG,WAAW;GACzI,IAAI,CAAC,MAAM,UAAU;IACnB,UAAU,SAAS,MAAM;KACvB,OAAO,CAAC;IACV,CAAC;GACH;EACF,CAAC;CACH,CAAC;AACH,CAAC"}
|
package/dist/jsx/Toggle.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRefComponent } from "@tamagui/compose-refs";
|
|
2
2
|
import { composeEventHandlers } from "@tamagui/helpers";
|
|
3
|
-
import { resolveSize } from "@tamagui/size";
|
|
4
3
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
5
4
|
import { View, styled } from "@tamagui/web";
|
|
6
5
|
import { context } from "./context.mjs";
|
|
@@ -11,22 +10,9 @@ const ToggleFrame = styled(View, {
|
|
|
11
10
|
displayName: NAME,
|
|
12
11
|
render: "button",
|
|
13
12
|
context,
|
|
14
|
-
size: true,
|
|
15
13
|
alignItems: "center",
|
|
16
14
|
justifyContent: "center",
|
|
17
|
-
variants: {
|
|
18
|
-
size: styled.dynamic((val, env) => {
|
|
19
|
-
if (!val) return;
|
|
20
|
-
const { frame, controlHeight } = resolveSize(val, env);
|
|
21
|
-
const side = controlHeight + 2;
|
|
22
|
-
return {
|
|
23
|
-
width: side,
|
|
24
|
-
height: side,
|
|
25
|
-
borderRadius: frame.borderRadius
|
|
26
|
-
};
|
|
27
|
-
}),
|
|
28
|
-
defaultActiveStyle: { true: {} }
|
|
29
|
-
}
|
|
15
|
+
variants: { defaultActiveStyle: { true: {} } }
|
|
30
16
|
});
|
|
31
17
|
const Toggle = createRefComponent(function Toggle2(props, forwardedRef) {
|
|
32
18
|
const { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
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 {
|
|
1
|
+
{"version":3,"file":"Toggle.js","names":[],"sources":["jsx/Toggle.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/compose-refs\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\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 alignItems: \"center\",\n justifyContent: \"center\",\n variants: {\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: active ? activeTheme ?? null : 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":";;;;;;;;AAMA,MAAM,OAAO;AACb,MAAM,cAAc,OAAO,MAAM;CAC/B,aAAa;CACb,QAAQ;CACR;CACA,YAAY;CACZ,gBAAgB;CAChB,UAAU,EACR,oBAAoB,EAClB,MAAM,CAAC,EACT,EACF;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,SAAS,eAAe,OAAO;EACtC,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"}
|
|
@@ -35,7 +35,6 @@ module.exports = __toCommonJS(Toggle_exports);
|
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
37
37
|
var import_helpers = require("@tamagui/helpers");
|
|
38
|
-
var import_size = require("@tamagui/size");
|
|
39
38
|
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
40
39
|
var import_web = require("@tamagui/web");
|
|
41
40
|
var React = __toESM(require("react"), 1);
|
|
@@ -45,22 +44,9 @@ var ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
45
44
|
displayName: NAME,
|
|
46
45
|
render: "button",
|
|
47
46
|
context: import_context.context,
|
|
48
|
-
size: true,
|
|
49
47
|
alignItems: "center",
|
|
50
48
|
justifyContent: "center",
|
|
51
|
-
variants: {
|
|
52
|
-
size: import_web.styled.dynamic(function(val, env) {
|
|
53
|
-
if (!val) return;
|
|
54
|
-
var { frame, controlHeight } = (0, import_size.resolveSize)(val, env);
|
|
55
|
-
var side = controlHeight + 2;
|
|
56
|
-
return {
|
|
57
|
-
width: side,
|
|
58
|
-
height: side,
|
|
59
|
-
borderRadius: frame.borderRadius
|
|
60
|
-
};
|
|
61
|
-
}),
|
|
62
|
-
defaultActiveStyle: { true: {} }
|
|
63
|
-
}
|
|
49
|
+
variants: { defaultActiveStyle: { true: {} } }
|
|
64
50
|
});
|
|
65
51
|
var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
66
52
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
@@ -35,7 +35,6 @@ module.exports = __toCommonJS(Toggle_exports);
|
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
37
37
|
var import_helpers = require("@tamagui/helpers");
|
|
38
|
-
var import_size = require("@tamagui/size");
|
|
39
38
|
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
40
39
|
var import_web = require("@tamagui/web");
|
|
41
40
|
var React = __toESM(require("react"), 1);
|
|
@@ -45,22 +44,9 @@ var ToggleFrame = (0, import_web.styled)(import_web.View, {
|
|
|
45
44
|
displayName: NAME,
|
|
46
45
|
render: "button",
|
|
47
46
|
context: import_context.context,
|
|
48
|
-
size: true,
|
|
49
47
|
alignItems: "center",
|
|
50
48
|
justifyContent: "center",
|
|
51
|
-
variants: {
|
|
52
|
-
size: import_web.styled.dynamic(function(val, env) {
|
|
53
|
-
if (!val) return;
|
|
54
|
-
var { frame, controlHeight } = (0, import_size.resolveSize)(val, env);
|
|
55
|
-
var side = controlHeight + 2;
|
|
56
|
-
return {
|
|
57
|
-
width: side,
|
|
58
|
-
height: side,
|
|
59
|
-
borderRadius: frame.borderRadius
|
|
60
|
-
};
|
|
61
|
-
}),
|
|
62
|
-
defaultActiveStyle: { true: {} }
|
|
63
|
-
}
|
|
49
|
+
variants: { defaultActiveStyle: { true: {} } }
|
|
64
50
|
});
|
|
65
51
|
var Toggle = (0, import_compose_refs.createRefComponent)(function Toggle2(props, forwardedRef) {
|
|
66
52
|
var { active: activeProp, activeStyle, defaultActive = false, onActiveChange, activeTheme, ...buttonProps } = props;
|
|
@@ -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
|
|
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_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 alignItems: \"center\",\n justifyContent: \"center\",\n variants: {\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: active ? activeTheme !== null && activeTheme !== void 0 ? activeTheme : null : 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,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,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Q,gBAAgB,KAAK,IAAI,cAAc,OAAO;EACtF,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/toggle-group",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.1342.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,23 +35,22 @@
|
|
|
35
35
|
"clean:build": "tamagui-build clean:build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/compose-refs": "3.0.0-beta.
|
|
39
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
40
|
-
"@tamagui/create-context": "3.0.0-beta.
|
|
41
|
-
"@tamagui/focusable": "3.0.0-beta.
|
|
42
|
-
"@tamagui/font-size": "3.0.0-beta.
|
|
43
|
-
"@tamagui/get-token": "3.0.0-beta.
|
|
44
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
45
|
-
"@tamagui/helpers-tamagui": "3.0.0-beta.
|
|
46
|
-
"@tamagui/roving-focus": "3.0.0-beta.
|
|
47
|
-
"@tamagui/
|
|
48
|
-
"@tamagui/
|
|
49
|
-
"@tamagui/use-
|
|
50
|
-
"@tamagui/
|
|
51
|
-
"@tamagui/web": "3.0.0-beta.1313.1"
|
|
38
|
+
"@tamagui/compose-refs": "3.0.0-beta.1342.1",
|
|
39
|
+
"@tamagui/constants": "3.0.0-beta.1342.1",
|
|
40
|
+
"@tamagui/create-context": "3.0.0-beta.1342.1",
|
|
41
|
+
"@tamagui/focusable": "3.0.0-beta.1342.1",
|
|
42
|
+
"@tamagui/font-size": "3.0.0-beta.1342.1",
|
|
43
|
+
"@tamagui/get-token": "3.0.0-beta.1342.1",
|
|
44
|
+
"@tamagui/helpers": "3.0.0-beta.1342.1",
|
|
45
|
+
"@tamagui/helpers-tamagui": "3.0.0-beta.1342.1",
|
|
46
|
+
"@tamagui/roving-focus": "3.0.0-beta.1342.1",
|
|
47
|
+
"@tamagui/stacks": "3.0.0-beta.1342.1",
|
|
48
|
+
"@tamagui/use-controllable-state": "3.0.0-beta.1342.1",
|
|
49
|
+
"@tamagui/use-direction": "3.0.0-beta.1342.1",
|
|
50
|
+
"@tamagui/web": "3.0.0-beta.1342.1"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"@tamagui/build": "3.0.0-beta.
|
|
53
|
+
"@tamagui/build": "3.0.0-beta.1342.1",
|
|
55
54
|
"react": "19.2.3"
|
|
56
55
|
},
|
|
57
56
|
"peerDependencies": {
|
package/src/Toggle.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRefComponent } from '@tamagui/compose-refs'
|
|
2
2
|
import { composeEventHandlers } from '@tamagui/helpers'
|
|
3
|
-
import { resolveSize } from '@tamagui/size'
|
|
4
3
|
import { useControllableState } from '@tamagui/use-controllable-state'
|
|
5
4
|
import type { GetProps, StylePiece, TamaguiElement } from '@tamagui/web'
|
|
6
5
|
import { styled, View } from '@tamagui/web'
|
|
@@ -13,34 +12,21 @@ import { context } from './context'
|
|
|
13
12
|
|
|
14
13
|
const NAME = 'Toggle'
|
|
15
14
|
|
|
16
|
-
// Unstyled Toggle behavior frame: structural layout, the
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
15
|
+
// Unstyled Toggle behavior frame: structural layout, the native button
|
|
16
|
+
// render, and focus reset only. Hit-target dimensions live in the tamagui skin
|
|
17
|
+
// (code/ui/tamagui/src/components/ToggleGroup.tsx). All theme decoration
|
|
18
|
+
// (palette, border, hover/press/focus color styling) and the default "active"
|
|
19
|
+
// appearance live there too. The frame still emits the discrete state
|
|
20
|
+
// (aria-pressed / data-state) via the Toggle component below; the skins can
|
|
21
|
+
// supply a plain style prop object that is applied while active.
|
|
23
22
|
export const ToggleFrame = styled(View, {
|
|
24
23
|
displayName: NAME,
|
|
25
24
|
render: 'button',
|
|
26
25
|
context,
|
|
27
|
-
size: true,
|
|
28
26
|
alignItems: 'center',
|
|
29
27
|
justifyContent: 'center',
|
|
30
28
|
|
|
31
29
|
variants: {
|
|
32
|
-
size: styled.dynamic<any>((val, env) => {
|
|
33
|
-
if (!val) return
|
|
34
|
-
// a square hit target: the control height plus the skin's 1px border
|
|
35
|
-
const { frame, controlHeight } = resolveSize(val, env)
|
|
36
|
-
const side = controlHeight + 2
|
|
37
|
-
return {
|
|
38
|
-
width: side,
|
|
39
|
-
height: side,
|
|
40
|
-
borderRadius: frame.borderRadius,
|
|
41
|
-
}
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
30
|
defaultActiveStyle: {
|
|
45
31
|
true: {},
|
|
46
32
|
},
|
package/types/Toggle.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
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" | "defaultActiveStyle" |
|
|
3
|
+
export declare const ToggleFrame: React.FunctionComponent<Omit<import("@tamagui/web").StackNonStyleProps, "active" | "defaultActiveStyle" | keyof import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithFlatVariantValues<{
|
|
4
4
|
active?: boolean | undefined;
|
|
5
5
|
defaultActiveStyle?: boolean | undefined;
|
|
6
|
-
size?: any;
|
|
7
6
|
}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase>> & {
|
|
8
7
|
ref?: React.Ref<TamaguiElement> | undefined;
|
|
9
8
|
}> & import("@tamagui/web").StaticComponentObject<import("@tamagui/web").TamaDefer, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
10
9
|
active?: boolean | undefined;
|
|
11
10
|
defaultActiveStyle?: boolean | undefined;
|
|
12
|
-
size?: any;
|
|
13
11
|
}, import("@tamagui/web").StaticConfigPublic> & Omit<import("@tamagui/web").StaticConfigPublic, "staticConfig"> & {
|
|
14
12
|
__tama: [import("@tamagui/web").TamaDefer, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
15
13
|
active?: boolean | undefined;
|
|
16
14
|
defaultActiveStyle?: boolean | undefined;
|
|
17
|
-
size?: any;
|
|
18
15
|
}, import("@tamagui/web").StaticConfigPublic];
|
|
19
16
|
};
|
|
20
17
|
type ToggleFrameProps = GetProps<typeof ToggleFrame>;
|
package/types/Toggle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../src/Toggle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../src/Toggle.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAgB9B,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAYtB,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
|
@@ -34,11 +34,9 @@ declare const ToggleGroup: ((props: ScopedProps<ToggleGroupProps> & import("@tam
|
|
|
34
34
|
Item: import("@tamagui/web").TamaguiComponent<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
35
35
|
active?: boolean | undefined;
|
|
36
36
|
defaultActiveStyle?: boolean | undefined;
|
|
37
|
-
|
|
38
|
-
}>, "__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<{
|
|
37
|
+
}>, "__scopeToggleGroup" | "active" | "activeStyle" | "activeTheme" | "defaultActiveStyle" | "value" | keyof import("@tamagui/web").StackNonStyleProps | keyof import("@tamagui/web").StackStyleBase> & Omit<import("@tamagui/web").StackNonStyleProps, "active" | "defaultActiveStyle" | keyof import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithFlatVariantValues<{
|
|
39
38
|
active?: boolean | undefined;
|
|
40
39
|
defaultActiveStyle?: boolean | undefined;
|
|
41
|
-
size?: any;
|
|
42
40
|
}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase>> & {
|
|
43
41
|
activeStyle?: ToggleProps['activeStyle'];
|
|
44
42
|
activeTheme?: ToggleProps['activeTheme'];
|
|
@@ -47,10 +45,9 @@ declare const ToggleGroup: ((props: ScopedProps<ToggleGroupProps> & import("@tam
|
|
|
47
45
|
disabled?: boolean;
|
|
48
46
|
} & {
|
|
49
47
|
__scopeToggleGroup?: string;
|
|
50
|
-
}, import("@tamagui/react-native-types/src").View | (HTMLElement & import("@tamagui/web").TamaguiElementMethods), import("@tamagui/web").StackNonStyleProps & Omit<import("@tamagui/web").StackNonStyleProps, "active" | "defaultActiveStyle" |
|
|
48
|
+
}, import("@tamagui/react-native-types/src").View | (HTMLElement & import("@tamagui/web").TamaguiElementMethods), import("@tamagui/web").StackNonStyleProps & Omit<import("@tamagui/web").StackNonStyleProps, "active" | "defaultActiveStyle" | keyof import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase> & import("@tamagui/web").WithFlatVariantValues<{
|
|
51
49
|
active?: boolean | undefined;
|
|
52
50
|
defaultActiveStyle?: boolean | undefined;
|
|
53
|
-
size?: any;
|
|
54
51
|
}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase>> & {
|
|
55
52
|
activeStyle?: ToggleProps['activeStyle'];
|
|
56
53
|
activeTheme?: ToggleProps['activeTheme'];
|
|
@@ -62,7 +59,6 @@ declare const ToggleGroup: ((props: ScopedProps<ToggleGroupProps> & import("@tam
|
|
|
62
59
|
}, import("@tamagui/web").StackStyleBase, {
|
|
63
60
|
active?: boolean | undefined;
|
|
64
61
|
defaultActiveStyle?: boolean | undefined;
|
|
65
|
-
size?: any;
|
|
66
62
|
}, import("@tamagui/web").StaticConfigPublic>;
|
|
67
63
|
};
|
|
68
64
|
interface ToggleGroupImplSingleProps extends ToggleGroupImplProps {
|
|
@@ -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;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;AAmFD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzD,UAAU,sBAAuB,SAAQ,0BAA0B;IACjE,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,UAAU,wBAAyB,SAAQ,4BAA4B;IACrE,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,UAAU,uBAAwB,SAAQ,oBAAoB;IAC5D,IAAI,EAAE,QAAQ,GAA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