@tamagui/checkbox 3.0.0-beta.831.1 → 3.0.0-beta.881.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/Checkbox.cjs +4 -4
- package/dist/cjs/Checkbox.native.cjs +4 -4
- package/dist/cjs/Checkbox.native.js +4 -4
- package/dist/cjs/Checkbox.native.js.map +1 -1
- package/dist/esm/Checkbox.mjs +4 -4
- package/dist/esm/Checkbox.mjs.map +1 -1
- package/dist/esm/Checkbox.native.js +4 -4
- package/dist/esm/Checkbox.native.js.map +1 -1
- package/dist/jsx/Checkbox.mjs +4 -4
- package/dist/jsx/Checkbox.mjs.map +1 -1
- package/dist/jsx/Checkbox.native.cjs +4 -4
- package/dist/jsx/Checkbox.native.js +4 -4
- package/dist/jsx/Checkbox.native.js.map +1 -1
- package/package.json +6 -6
- package/src/Checkbox.tsx +25 -41
- package/types/Checkbox.d.ts +38 -368
- package/types/Checkbox.d.ts.map +1 -1
package/dist/cjs/Checkbox.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
42
42
|
const CheckboxIndicatorFrame = (0, import_core.styled)(import_core.View, {
|
|
43
43
|
displayName: "CheckboxIndicator",
|
|
44
44
|
context: import_CheckboxStyledContext.CheckboxStyledContext
|
|
45
|
-
}
|
|
45
|
+
});
|
|
46
46
|
const CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
47
47
|
displayName: "Checkbox",
|
|
48
48
|
render: "button",
|
|
@@ -53,7 +53,7 @@ const CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
|
53
53
|
pointerEvents: "none",
|
|
54
54
|
userSelect: "none"
|
|
55
55
|
} } }
|
|
56
|
-
}
|
|
56
|
+
});
|
|
57
57
|
const CheckboxContext = import_react.default.createContext({
|
|
58
58
|
checked: false,
|
|
59
59
|
disabled: false
|
|
@@ -89,7 +89,7 @@ const CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, functi
|
|
|
89
89
|
...import_core.isWeb && { type: "button" },
|
|
90
90
|
checked,
|
|
91
91
|
...checkboxProps,
|
|
92
|
-
|
|
92
|
+
style: [checkboxProps.style, isActive && activeStyle],
|
|
93
93
|
active: isActive,
|
|
94
94
|
disabled,
|
|
95
95
|
children: props.children
|
|
@@ -103,7 +103,7 @@ const CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFram
|
|
|
103
103
|
if (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {
|
|
104
104
|
pointerEvents: "none",
|
|
105
105
|
...indicatorProps,
|
|
106
|
-
|
|
106
|
+
style: [indicatorProps.style, active && activeStyle],
|
|
107
107
|
ref: forwardedRef,
|
|
108
108
|
children
|
|
109
109
|
});
|
|
@@ -44,7 +44,7 @@ var import_CheckboxStyledContext = require("./CheckboxStyledContext.native.js");
|
|
|
44
44
|
var CheckboxIndicatorFrame = (0, import_core.styled)(import_core.View, {
|
|
45
45
|
displayName: "CheckboxIndicator",
|
|
46
46
|
context: import_CheckboxStyledContext.CheckboxStyledContext
|
|
47
|
-
}
|
|
47
|
+
});
|
|
48
48
|
var CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
49
49
|
displayName: "Checkbox",
|
|
50
50
|
render: "button",
|
|
@@ -55,7 +55,7 @@ var CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
|
55
55
|
pointerEvents: "none",
|
|
56
56
|
userSelect: "none"
|
|
57
57
|
} } }
|
|
58
|
-
}
|
|
58
|
+
});
|
|
59
59
|
var CheckboxContext = /* @__PURE__ */ import_react.default.createContext({
|
|
60
60
|
checked: false,
|
|
61
61
|
disabled: false
|
|
@@ -105,7 +105,7 @@ var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function
|
|
|
105
105
|
...import_core.isWeb && { type: "button" },
|
|
106
106
|
checked,
|
|
107
107
|
...checkboxProps,
|
|
108
|
-
|
|
108
|
+
style: [checkboxProps.style, isActive && activeStyle],
|
|
109
109
|
active: isActive,
|
|
110
110
|
disabled,
|
|
111
111
|
children: props.children
|
|
@@ -119,7 +119,7 @@ var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame,
|
|
|
119
119
|
if (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {
|
|
120
120
|
pointerEvents: "none",
|
|
121
121
|
...indicatorProps,
|
|
122
|
-
|
|
122
|
+
style: [indicatorProps.style, active && activeStyle],
|
|
123
123
|
ref: forwardedRef,
|
|
124
124
|
children
|
|
125
125
|
});
|
|
@@ -44,7 +44,7 @@ var import_CheckboxStyledContext = require("./CheckboxStyledContext.native.js");
|
|
|
44
44
|
var CheckboxIndicatorFrame = (0, import_core.styled)(import_core.View, {
|
|
45
45
|
displayName: "CheckboxIndicator",
|
|
46
46
|
context: import_CheckboxStyledContext.CheckboxStyledContext
|
|
47
|
-
}
|
|
47
|
+
});
|
|
48
48
|
var CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
49
49
|
displayName: "Checkbox",
|
|
50
50
|
render: "button",
|
|
@@ -55,7 +55,7 @@ var CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
|
55
55
|
pointerEvents: "none",
|
|
56
56
|
userSelect: "none"
|
|
57
57
|
} } }
|
|
58
|
-
}
|
|
58
|
+
});
|
|
59
59
|
var CheckboxContext = /* @__PURE__ */ import_react.default.createContext({
|
|
60
60
|
checked: false,
|
|
61
61
|
disabled: false
|
|
@@ -105,7 +105,7 @@ var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function
|
|
|
105
105
|
...import_core.isWeb && { type: "button" },
|
|
106
106
|
checked,
|
|
107
107
|
...checkboxProps,
|
|
108
|
-
|
|
108
|
+
style: [checkboxProps.style, isActive && activeStyle],
|
|
109
109
|
active: isActive,
|
|
110
110
|
disabled,
|
|
111
111
|
children: props.children
|
|
@@ -119,7 +119,7 @@ var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame,
|
|
|
119
119
|
if (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {
|
|
120
120
|
pointerEvents: "none",
|
|
121
121
|
...indicatorProps,
|
|
122
|
-
|
|
122
|
+
style: [indicatorProps.style, active && activeStyle],
|
|
123
123
|
ref: forwardedRef,
|
|
124
124
|
children
|
|
125
125
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.native.js","names":[],"sources":["cjs/Checkbox.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\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n\t// If the importer is in node compatibility mode or this is not an ESM\n\t// file that has been converted to a CommonJS file using a Babel-\n\t// compatible transform (i.e. \"__esModule\" has not been set), then set\n\t// \"default\" to the CommonJS \"module.exports\" for node compatibility.\n\tisNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\t\tvalue: mod,\n\t\tenumerable: true\n\t}) : target,\n\tmod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Checkbox_exports = {};\n__export(Checkbox_exports, {\n\tCheckbox: () => Checkbox2,\n\tCheckboxContext: () => CheckboxContext,\n\tCheckboxFrame: () => CheckboxFrame,\n\tCheckboxIndicatorFrame: () => CheckboxIndicatorFrame\n});\nmodule.exports = __toCommonJS(Checkbox_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_checkbox_headless = require(\"@tamagui/checkbox-headless\");\nvar import_core = require(\"@tamagui/core\");\nvar import_focusable = require(\"@tamagui/focusable\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_CheckboxStyledContext = require(\"./CheckboxStyledContext\");\nvar CheckboxIndicatorFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: import_CheckboxStyledContext.CheckboxStyledContext\n}
|
|
1
|
+
{"version":3,"file":"Checkbox.native.js","names":[],"sources":["cjs/Checkbox.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\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n\t// If the importer is in node compatibility mode or this is not an ESM\n\t// file that has been converted to a CommonJS file using a Babel-\n\t// compatible transform (i.e. \"__esModule\" has not been set), then set\n\t// \"default\" to the CommonJS \"module.exports\" for node compatibility.\n\tisNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\t\tvalue: mod,\n\t\tenumerable: true\n\t}) : target,\n\tmod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Checkbox_exports = {};\n__export(Checkbox_exports, {\n\tCheckbox: () => Checkbox2,\n\tCheckboxContext: () => CheckboxContext,\n\tCheckboxFrame: () => CheckboxFrame,\n\tCheckboxIndicatorFrame: () => CheckboxIndicatorFrame\n});\nmodule.exports = __toCommonJS(Checkbox_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_checkbox_headless = require(\"@tamagui/checkbox-headless\");\nvar import_core = require(\"@tamagui/core\");\nvar import_focusable = require(\"@tamagui/focusable\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_CheckboxStyledContext = require(\"./CheckboxStyledContext\");\nvar CheckboxIndicatorFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: import_CheckboxStyledContext.CheckboxStyledContext\n});\nvar CheckboxFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"Checkbox\",\n\trender: \"button\",\n\tcontext: import_CheckboxStyledContext.CheckboxStyledContext,\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tvariants: { disabled: { true: {\n\t\tpointerEvents: \"none\",\n\t\tuserSelect: \"none\"\n\t} } }\n});\nvar CheckboxContext = /* @__PURE__ */ import_react.default.createContext({\n\tchecked: false,\n\tdisabled: false\n});\nvar CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {\n\tvar { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;\n\tvar [checked = false, setChecked] = (0, import_use_controllable_state.useControllableState)({\n\t\tprop: checkedProp,\n\t\tdefaultProp: defaultChecked,\n\t\tonChange: onCheckedChange\n\t});\n\tvar { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(props, [checked, setChecked], forwardedRef);\n\timport_react.default.useEffect(function() {\n\t\tif (!props.id) return;\n\t\tif (props.disabled) return;\n\t\treturn (0, import_focusable.registerFocusable)(props.id, {\n\t\t\tfocusAndSelect: function() {\n\t\t\t\tsetChecked === null || setChecked === void 0 || setChecked(function(value) {\n\t\t\t\t\treturn !value;\n\t\t\t\t});\n\t\t\t},\n\t\t\tfocus: function() {}\n\t\t});\n\t}, [props.id, props.disabled]);\n\tif ((0, import_core.shouldRenderNativePlatform)(native) === \"web\") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"input\", {\n\t\ttype: \"checkbox\",\n\t\tdefaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? false : checked,\n\t\ttabIndex: -1,\n\t\tref: checkboxRef,\n\t\tdisabled: checkboxProps.disabled,\n\t\tstyle: checkboxProps.style\n\t});\n\tvar memoizedContext = (0, import_react.useMemo)(function() {\n\t\treturn {\n\t\t\tchecked,\n\t\t\tdisabled: checkboxProps.disabled\n\t\t};\n\t}, [checked, checkboxProps.disabled]);\n\tvar isActive = !!checked;\n\tvar disabled = checkboxProps.disabled;\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {\n\t\t\trender: \"button\",\n\t\t\tref: checkboxRef,\n\t\t\ttheme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,\n\t\t\t...import_core.isWeb && { type: \"button\" },\n\t\t\tchecked,\n\t\t\t...checkboxProps,\n\t\t\tstyle: [checkboxProps.style, isActive && activeStyle],\n\t\t\tactive: isActive,\n\t\t\tdisabled,\n\t\t\tchildren: props.children\n\t\t}), bubbleInput]\n\t});\n});\nvar CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame, function(props, forwardedRef) {\n\tvar { children, forceMount, activeStyle, ...indicatorProps } = props;\n\tvar { active } = import_CheckboxStyledContext.CheckboxStyledContext.useStyledContext();\n\tvar context = import_react.default.useContext(CheckboxContext);\n\tif (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {\n\t\tpointerEvents: \"none\",\n\t\t...indicatorProps,\n\t\tstyle: [indicatorProps.style, active && activeStyle],\n\t\tref: forwardedRef,\n\t\tchildren\n\t});\n\treturn null;\n});\nvar Checkbox2 = (0, import_core.withStaticProperties)(CheckboxComponent, { Indicator: CheckboxIndicator });\n//# sourceMappingURL=Checkbox.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;CAC/B,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;CACb,CAAC;AACF;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC7C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EACnE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GAAG,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QAAQ,UAAU,IAAI,KAAK;GAC9G,WAAW,KAAK;GAChB,YAAY,EAAE,OAAO,iBAAiB,MAAM,G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AgB,QAAQ,gBAAgB,KAAK,IAAI,cAAc;GACtE,GAAG,YAAY,SAAS,EAAE,MAAM,SAAS;GACzC;GACA,GAAG;GACH,OAAO,CAAC,cAAc,OAAO,YAAY,WAAW;GACpD,QAAQ;GACR;GACA,UAAU,MAAM;EACjB,CAAC,GAAG,WAAW;CAChB,CAAC;AACF,CAAC;AACD,IAAI,qBAAqB,GAAG,YAAY,gBAAe,CAAE,wBAAwB,SAAS,OAAO,cAAc;CAC9G,IAAI,EAAE,UAAU,YAAY,aAAa,GAAG,mBAAmB;CAC/D,IAAI,EAAE,WAAW,6BAA6B,sBAAsB,iBAAiB;CACrF,IAAI,UAAU,aAAa,QAAQ,WAAW,eAAe;CAC7D,IAAI,eAAe,GAAG,yBAAyB,gBAAe,CAAE,QAAQ,OAAO,KAAK,QAAQ,YAAY,MAAM,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,wBAAwB;EACxL,eAAe;EACf,GAAG;EACH,OAAO,CAAC,eAAe,OAAO,UAAU,WAAW;EACnD,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC;AACD,IAAI,aAAa,GAAG,YAAY,qBAAoB,CAAE,mBAAmB,EAAE,WAAW,kBAAkB,CAAC"}
|
package/dist/esm/Checkbox.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
const CheckboxIndicatorFrame = styled(View, {
|
|
9
9
|
displayName: "CheckboxIndicator",
|
|
10
10
|
context: CheckboxStyledContext
|
|
11
|
-
}
|
|
11
|
+
});
|
|
12
12
|
const CheckboxFrame = styled(View, {
|
|
13
13
|
displayName: "Checkbox",
|
|
14
14
|
render: "button",
|
|
@@ -19,7 +19,7 @@ const CheckboxFrame = styled(View, {
|
|
|
19
19
|
pointerEvents: "none",
|
|
20
20
|
userSelect: "none"
|
|
21
21
|
} } }
|
|
22
|
-
}
|
|
22
|
+
});
|
|
23
23
|
const CheckboxContext = React.createContext({
|
|
24
24
|
checked: false,
|
|
25
25
|
disabled: false
|
|
@@ -55,7 +55,7 @@ const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function C
|
|
|
55
55
|
...isWeb && { type: "button" },
|
|
56
56
|
checked,
|
|
57
57
|
...checkboxProps,
|
|
58
|
-
|
|
58
|
+
style: [checkboxProps.style, isActive && activeStyle],
|
|
59
59
|
active: isActive,
|
|
60
60
|
disabled,
|
|
61
61
|
children: props.children
|
|
@@ -68,7 +68,7 @@ const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function C
|
|
|
68
68
|
if (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {
|
|
69
69
|
pointerEvents: "none",
|
|
70
70
|
...indicatorProps,
|
|
71
|
-
|
|
71
|
+
style: [indicatorProps.style, active && activeStyle],
|
|
72
72
|
ref: forwardedRef,
|
|
73
73
|
children
|
|
74
74
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","names":[],"sources":["esm/Checkbox.js"],"sourcesContent":["import { isIndeterminate, useCheckbox } from \"@tamagui/checkbox-headless\";\nimport { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from \"@tamagui/core\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useMemo } from \"react\";\nimport { CheckboxStyledContext } from \"./CheckboxStyledContext\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\n\nconst CheckboxIndicatorFrame = styled(View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: CheckboxStyledContext\n}
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":[],"sources":["esm/Checkbox.js"],"sourcesContent":["import { isIndeterminate, useCheckbox } from \"@tamagui/checkbox-headless\";\nimport { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from \"@tamagui/core\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useMemo } from \"react\";\nimport { CheckboxStyledContext } from \"./CheckboxStyledContext\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\n\nconst CheckboxIndicatorFrame = styled(View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: CheckboxStyledContext\n});\nconst CheckboxFrame = styled(View, {\n\tdisplayName: \"Checkbox\",\n\trender: \"button\",\n\tcontext: CheckboxStyledContext,\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tvariants: { disabled: { true: {\n\t\tpointerEvents: \"none\",\n\t\tuserSelect: \"none\"\n\t} } }\n});\nconst CheckboxContext = React.createContext({\n\tchecked: false,\n\tdisabled: false\n});\nconst Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {\n\tconst { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;\n\tconst [checked = false, setChecked] = useControllableState({\n\t\tprop: checkedProp,\n\t\tdefaultProp: defaultChecked,\n\t\tonChange: onCheckedChange\n\t});\n\tconst { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(props, [checked, setChecked], forwardedRef);\n\tif (shouldRenderNativePlatform(native) === \"web\") return /* @__PURE__ */ jsx(\"input\", {\n\t\ttype: \"checkbox\",\n\t\tdefaultChecked: isIndeterminate(checked) ? false : checked,\n\t\ttabIndex: -1,\n\t\tref: checkboxRef,\n\t\tdisabled: checkboxProps.disabled,\n\t\tstyle: checkboxProps.style\n\t});\n\tconst memoizedContext = useMemo(() => ({\n\t\tchecked,\n\t\tdisabled: checkboxProps.disabled\n\t}), [checked, checkboxProps.disabled]);\n\tconst isActive = !!checked;\n\tconst disabled = checkboxProps.disabled;\n\treturn /* @__PURE__ */ jsxs(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: [/* @__PURE__ */ jsx(CheckboxFrame, {\n\t\t\trender: \"button\",\n\t\t\tref: checkboxRef,\n\t\t\ttheme: activeTheme ?? null,\n\t\t\t...isWeb && { type: \"button\" },\n\t\t\tchecked,\n\t\t\t...checkboxProps,\n\t\t\tstyle: [checkboxProps.style, isActive && activeStyle],\n\t\t\tactive: isActive,\n\t\t\tdisabled,\n\t\t\tchildren: props.children\n\t\t}), bubbleInput]\n\t});\n}), { Indicator: createStyledHOC(CheckboxIndicatorFrame, (props, forwardedRef) => {\n\tconst { children, forceMount, activeStyle, ...indicatorProps } = props;\n\tconst { active } = CheckboxStyledContext.useStyledContext();\n\tconst context = React.useContext(CheckboxContext);\n\tif (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {\n\t\tpointerEvents: \"none\",\n\t\t...indicatorProps,\n\t\tstyle: [indicatorProps.style, active && activeStyle],\n\t\tref: forwardedRef,\n\t\tchildren\n\t});\n\treturn null;\n}) });\n\nexport { Checkbox2 as Checkbox, CheckboxContext, CheckboxFrame, CheckboxIndicatorFrame };"],"mappings":";;;;;;;;AAOA,MAAM,yBAAyB,OAAO,MAAM;CAC3C,aAAa;CACb,SAAS;AACV,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CAClC,aAAa;CACb,QAAQ;CACR,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,UAAU,EAAE,UAAU,EAAE,MAAM;EAC7B,eAAe;EACf,YAAY;CACb,EAAE,EAAE;AACL,CAAC;AACD,MAAM,kBAAkB,MAAM,cAAc;CAC3C,SAAS;CACT,UAAU;AACX,CAAC;AACD,MAAM,YAAY,qBAAqB,gBAAgB,eAAe,SAAS,SAAS,SAAS,cAAc;CAC9G,MAAM,EAAE,SAAS,aAAa,gBAAgB,iBAAiB,QAAQ,aAAa,aAAa,GAAG,UAAU;CAC9G,MAAM,CAAC,UAAU,OAAO,cAAc,qBAAqB;EAC1D,MAAM;EACN,aAAa;EACb,UAAU;CACX,CAAC;CACD,MAAM,EAAE,eAAe,aAAa,gBAAgB,YAAY,OAAO,CAAC,SAAS,UAAU,GAAG,YAAY;CAC1G,IAAI,2BAA2B,MAAM,MAAM,OAAO,OAAuB,oBAAI,SAAS;EACrF,MAAM;EACN,gBAAgB,gBAAgB,OAAO,IAAI,QAAQ;EACnD,UAAU,CAAC;EACX,KAAK;EACL,UAAU,cAAc;EACxB,OAAO,cAAc;CACtB,CAAC;CACD,MAAM,kBAAkB,eAAe;EACtC;EACA,UAAU,cAAc;CACzB,IAAI,CAAC,SAAS,cAAc,QAAQ,CAAC;CACrC,MAAM,WAAW,CAAC,CAAC;CACnB,MAAM,WAAW,cAAc;CAC/B,OAAuB,qBAAK,gBAAgB,UAAU;EACrD,OAAO;EACP,UAAU,CAAiB,oBAAI,eAAe;GAC7C,QAAQ;GACR,KAAK;GACL,OAAO,eAAe;GACtB,GAAG,SAAS,EAAE,MAAM,SAAS;GAC7B;GACA,GAAG;GACH,OAAO,CAAC,cAAc,OAAO,YAAY,WAAW;GACpD,QAAQ;GACR;GACA,UAAU,MAAM;EACjB,CAAC,GAAG,WAAW;CAChB,CAAC;AACF,CAAC,GAAG,EAAE,WAAW,gBAAgB,yBAAyB,OAAO,iBAAiB;CACjF,MAAM,EAAE,UAAU,YAAY,aAAa,GAAG,mBAAmB;CACjE,MAAM,EAAE,WAAW,sBAAsB,iBAAiB;CAC1D,MAAM,UAAU,MAAM,WAAW,eAAe;CAChD,IAAI,cAAc,gBAAgB,QAAQ,OAAO,KAAK,QAAQ,YAAY,MAAM,OAAuB,oBAAI,wBAAwB;EAClI,eAAe;EACf,GAAG;EACH,OAAO,CAAC,eAAe,OAAO,UAAU,WAAW;EACnD,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC,EAAE,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { CheckboxStyledContext } from "./CheckboxStyledContext.native.js";
|
|
|
9
9
|
var CheckboxIndicatorFrame = styled(View, {
|
|
10
10
|
displayName: "CheckboxIndicator",
|
|
11
11
|
context: CheckboxStyledContext
|
|
12
|
-
}
|
|
12
|
+
});
|
|
13
13
|
var CheckboxFrame = styled(View, {
|
|
14
14
|
displayName: "Checkbox",
|
|
15
15
|
render: "button",
|
|
@@ -20,7 +20,7 @@ var CheckboxFrame = styled(View, {
|
|
|
20
20
|
pointerEvents: "none",
|
|
21
21
|
userSelect: "none"
|
|
22
22
|
} } }
|
|
23
|
-
}
|
|
23
|
+
});
|
|
24
24
|
var CheckboxContext = /* @__PURE__ */ React.createContext({
|
|
25
25
|
checked: false,
|
|
26
26
|
disabled: false
|
|
@@ -70,7 +70,7 @@ var Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Che
|
|
|
70
70
|
...isWeb && { type: "button" },
|
|
71
71
|
checked,
|
|
72
72
|
...checkboxProps,
|
|
73
|
-
|
|
73
|
+
style: [checkboxProps.style, isActive && activeStyle],
|
|
74
74
|
active: isActive,
|
|
75
75
|
disabled,
|
|
76
76
|
children: props.children
|
|
@@ -83,7 +83,7 @@ var Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Che
|
|
|
83
83
|
if (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {
|
|
84
84
|
pointerEvents: "none",
|
|
85
85
|
...indicatorProps,
|
|
86
|
-
|
|
86
|
+
style: [indicatorProps.style, active && activeStyle],
|
|
87
87
|
ref: forwardedRef,
|
|
88
88
|
children
|
|
89
89
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.native.js","names":[],"sources":["esm/Checkbox.native.js"],"sourcesContent":["import { jsx, jsxs } from \"react/jsx-runtime\";\nimport { isIndeterminate, useCheckbox } from \"@tamagui/checkbox-headless\";\nimport { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from \"@tamagui/core\";\nimport { registerFocusable } from \"@tamagui/focusable\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useMemo } from \"react\";\nimport { CheckboxStyledContext } from \"./CheckboxStyledContext\";\n\nvar CheckboxIndicatorFrame = styled(View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: CheckboxStyledContext\n}
|
|
1
|
+
{"version":3,"file":"Checkbox.native.js","names":[],"sources":["esm/Checkbox.native.js"],"sourcesContent":["import { jsx, jsxs } from \"react/jsx-runtime\";\nimport { isIndeterminate, useCheckbox } from \"@tamagui/checkbox-headless\";\nimport { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from \"@tamagui/core\";\nimport { registerFocusable } from \"@tamagui/focusable\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useMemo } from \"react\";\nimport { CheckboxStyledContext } from \"./CheckboxStyledContext\";\n\nvar CheckboxIndicatorFrame = styled(View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: CheckboxStyledContext\n});\nvar CheckboxFrame = styled(View, {\n\tdisplayName: \"Checkbox\",\n\trender: \"button\",\n\tcontext: CheckboxStyledContext,\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tvariants: { disabled: { true: {\n\t\tpointerEvents: \"none\",\n\t\tuserSelect: \"none\"\n\t} } }\n});\nvar CheckboxContext = /* @__PURE__ */ React.createContext({\n\tchecked: false,\n\tdisabled: false\n});\nvar Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {\n\tvar { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;\n\tvar [checked = false, setChecked] = useControllableState({\n\t\tprop: checkedProp,\n\t\tdefaultProp: defaultChecked,\n\t\tonChange: onCheckedChange\n\t});\n\tvar { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(props, [checked, setChecked], forwardedRef);\n\tReact.useEffect(function() {\n\t\tif (!props.id) return;\n\t\tif (props.disabled) return;\n\t\treturn registerFocusable(props.id, {\n\t\t\tfocusAndSelect: function() {\n\t\t\t\tsetChecked === null || setChecked === void 0 || setChecked(function(value) {\n\t\t\t\t\treturn !value;\n\t\t\t\t});\n\t\t\t},\n\t\t\tfocus: function() {}\n\t\t});\n\t}, [props.id, props.disabled]);\n\tif (shouldRenderNativePlatform(native) === \"web\") return /* @__PURE__ */ jsx(\"input\", {\n\t\ttype: \"checkbox\",\n\t\tdefaultChecked: isIndeterminate(checked) ? false : checked,\n\t\ttabIndex: -1,\n\t\tref: checkboxRef,\n\t\tdisabled: checkboxProps.disabled,\n\t\tstyle: checkboxProps.style\n\t});\n\tvar memoizedContext = useMemo(function() {\n\t\treturn {\n\t\t\tchecked,\n\t\t\tdisabled: checkboxProps.disabled\n\t\t};\n\t}, [checked, checkboxProps.disabled]);\n\tvar isActive = !!checked;\n\tvar disabled = checkboxProps.disabled;\n\treturn /* @__PURE__ */ jsxs(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: [/* @__PURE__ */ jsx(CheckboxFrame, {\n\t\t\trender: \"button\",\n\t\t\tref: checkboxRef,\n\t\t\ttheme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,\n\t\t\t...isWeb && { type: \"button\" },\n\t\t\tchecked,\n\t\t\t...checkboxProps,\n\t\t\tstyle: [checkboxProps.style, isActive && activeStyle],\n\t\t\tactive: isActive,\n\t\t\tdisabled,\n\t\t\tchildren: props.children\n\t\t}), bubbleInput]\n\t});\n}), { Indicator: createStyledHOC(CheckboxIndicatorFrame, function(props, forwardedRef) {\n\tvar { children, forceMount, activeStyle, ...indicatorProps } = props;\n\tvar { active } = CheckboxStyledContext.useStyledContext();\n\tvar context = React.useContext(CheckboxContext);\n\tif (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {\n\t\tpointerEvents: \"none\",\n\t\t...indicatorProps,\n\t\tstyle: [indicatorProps.style, active && activeStyle],\n\t\tref: forwardedRef,\n\t\tchildren\n\t});\n\treturn null;\n}) });\n\nexport { Checkbox2 as Checkbox, CheckboxContext, CheckboxFrame, CheckboxIndicatorFrame };"],"mappings":";;;;;;;;;AAQA,IAAI,yBAAyB,OAAO,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AAC;CACjB,IAAI,WAAW,cAAc;CAC7B,OAAuB,qBAAK,gBAAgB,UAAU;EACrD,OAAO;EACP,UAAU,CAAiB,oBAAI,eAAe;GAC7C,QAAQ;GACR,KAAK;GACL,OAAO,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,cAAc;GACtE,GAAG,SAAS,EAAE,MAAM,SAAS;GAC7B;GACA,GAAG;GACH,OAAO,CAAC,cAAc,OAAO,YAAY,WAAW;GACpD,QAAQ;GACR;GACA,UAAU,MAAM;EACjB,CAAC,GAAG,WAAW;CAChB,CAAC;AACF,CAAC,GAAG,EAAE,WAAW,gBAAgB,wBAAwB,SAAS,OAAO,cAAc;CACtF,IAAI,EAAE,UAAU,YAAY,aAAa,GAAG,mBAAmB;CAC/D,IAAI,EAAE,WAAW,sBAAsB,iBAAiB;CACxD,IAAI,UAAU,MAAM,WAAW,eAAe;CAC9C,IAAI,cAAc,gBAAgB,QAAQ,OAAO,KAAK,QAAQ,YAAY,MAAM,OAAuB,oBAAI,wBAAwB;EAClI,eAAe;EACf,GAAG;EACH,OAAO,CAAC,eAAe,OAAO,UAAU,WAAW;EACnD,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC,EAAE,CAAC"}
|
package/dist/jsx/Checkbox.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
const CheckboxIndicatorFrame = styled(View, {
|
|
9
9
|
displayName: "CheckboxIndicator",
|
|
10
10
|
context: CheckboxStyledContext
|
|
11
|
-
}
|
|
11
|
+
});
|
|
12
12
|
const CheckboxFrame = styled(View, {
|
|
13
13
|
displayName: "Checkbox",
|
|
14
14
|
render: "button",
|
|
@@ -19,7 +19,7 @@ const CheckboxFrame = styled(View, {
|
|
|
19
19
|
pointerEvents: "none",
|
|
20
20
|
userSelect: "none"
|
|
21
21
|
} } }
|
|
22
|
-
}
|
|
22
|
+
});
|
|
23
23
|
const CheckboxContext = React.createContext({
|
|
24
24
|
checked: false,
|
|
25
25
|
disabled: false
|
|
@@ -55,7 +55,7 @@ const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function C
|
|
|
55
55
|
...isWeb && { type: "button" },
|
|
56
56
|
checked,
|
|
57
57
|
...checkboxProps,
|
|
58
|
-
|
|
58
|
+
style: [checkboxProps.style, isActive && activeStyle],
|
|
59
59
|
active: isActive,
|
|
60
60
|
disabled,
|
|
61
61
|
children: props.children
|
|
@@ -68,7 +68,7 @@ const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function C
|
|
|
68
68
|
if (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {
|
|
69
69
|
pointerEvents: "none",
|
|
70
70
|
...indicatorProps,
|
|
71
|
-
|
|
71
|
+
style: [indicatorProps.style, active && activeStyle],
|
|
72
72
|
ref: forwardedRef,
|
|
73
73
|
children
|
|
74
74
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","names":[],"sources":["jsx/Checkbox.js"],"sourcesContent":["import { isIndeterminate, useCheckbox } from \"@tamagui/checkbox-headless\";\nimport { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from \"@tamagui/core\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useMemo } from \"react\";\nimport { CheckboxStyledContext } from \"./CheckboxStyledContext\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\n\nconst CheckboxIndicatorFrame = styled(View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: CheckboxStyledContext\n}
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":[],"sources":["jsx/Checkbox.js"],"sourcesContent":["import { isIndeterminate, useCheckbox } from \"@tamagui/checkbox-headless\";\nimport { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from \"@tamagui/core\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport React, { useMemo } from \"react\";\nimport { CheckboxStyledContext } from \"./CheckboxStyledContext\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\n\nconst CheckboxIndicatorFrame = styled(View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: CheckboxStyledContext\n});\nconst CheckboxFrame = styled(View, {\n\tdisplayName: \"Checkbox\",\n\trender: \"button\",\n\tcontext: CheckboxStyledContext,\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tvariants: { disabled: { true: {\n\t\tpointerEvents: \"none\",\n\t\tuserSelect: \"none\"\n\t} } }\n});\nconst CheckboxContext = React.createContext({\n\tchecked: false,\n\tdisabled: false\n});\nconst Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {\n\tconst { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;\n\tconst [checked = false, setChecked] = useControllableState({\n\t\tprop: checkedProp,\n\t\tdefaultProp: defaultChecked,\n\t\tonChange: onCheckedChange\n\t});\n\tconst { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(props, [checked, setChecked], forwardedRef);\n\tif (shouldRenderNativePlatform(native) === \"web\") return /* @__PURE__ */ jsx(\"input\", {\n\t\ttype: \"checkbox\",\n\t\tdefaultChecked: isIndeterminate(checked) ? false : checked,\n\t\ttabIndex: -1,\n\t\tref: checkboxRef,\n\t\tdisabled: checkboxProps.disabled,\n\t\tstyle: checkboxProps.style\n\t});\n\tconst memoizedContext = useMemo(() => ({\n\t\tchecked,\n\t\tdisabled: checkboxProps.disabled\n\t}), [checked, checkboxProps.disabled]);\n\tconst isActive = !!checked;\n\tconst disabled = checkboxProps.disabled;\n\treturn /* @__PURE__ */ jsxs(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: [/* @__PURE__ */ jsx(CheckboxFrame, {\n\t\t\trender: \"button\",\n\t\t\tref: checkboxRef,\n\t\t\ttheme: activeTheme ?? null,\n\t\t\t...isWeb && { type: \"button\" },\n\t\t\tchecked,\n\t\t\t...checkboxProps,\n\t\t\tstyle: [checkboxProps.style, isActive && activeStyle],\n\t\t\tactive: isActive,\n\t\t\tdisabled,\n\t\t\tchildren: props.children\n\t\t}), bubbleInput]\n\t});\n}), { Indicator: createStyledHOC(CheckboxIndicatorFrame, (props, forwardedRef) => {\n\tconst { children, forceMount, activeStyle, ...indicatorProps } = props;\n\tconst { active } = CheckboxStyledContext.useStyledContext();\n\tconst context = React.useContext(CheckboxContext);\n\tif (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {\n\t\tpointerEvents: \"none\",\n\t\t...indicatorProps,\n\t\tstyle: [indicatorProps.style, active && activeStyle],\n\t\tref: forwardedRef,\n\t\tchildren\n\t});\n\treturn null;\n}) });\n\nexport { Checkbox2 as Checkbox, CheckboxContext, CheckboxFrame, CheckboxIndicatorFrame };"],"mappings":";;;;;;;;AAOA,MAAM,yBAAyB,OAAO,MAAM;CAC3C,aAAa;CACb,SAAS;AACV,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CAClC,aAAa;CACb,QAAQ;CACR,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,UAAU,EAAE,UAAU,EAAE,MAAM;EAC7B,eAAe;EACf,YAAY;CACb,EAAE,EAAE;AACL,CAAC;AACD,MAAM,kBAAkB,MAAM,cAAc;CAC3C,SAAS;CACT,UAAU;AACX,CAAC;AACD,MAAM,YAAY,qBAAqB,gBAAgB,eAAe,SAAS,SAAS,SAAS,cAAc;CAC9G,MAAM,EAAE,SAAS,aAAa,gBAAgB,iBAAiB,QAAQ,aAAa,aAAa,GAAG,UAAU;CAC9G,MAAM,CAAC,UAAU,OAAO,cAAc,qBAAqB;EAC1D,MAAM;EACN,aAAa;EACb,UAAU;CACX,CAAC;CACD,MAAM,EAAE,eAAe,aAAa,gBAAgB,YAAY,OAAO,CAAC,SAAS,UAAU,GAAG,YAAY;CAC1G,IAAI,2BAA2B,MAAM,MAAM,OAAO,OAAuB,oBAAI,SAAS;EACrF,MAAM;EACN,gBAAgB,gBAAgB,OAAO,IAAI,QAAQ;EACnD,UAAU,CAAC;EACX,KAAK;EACL,UAAU,cAAc;EACxB,OAAO,cAAc;CACtB,CAAC;CACD,MAAM,kBAAkB,eAAe;EACtC;EACA,UAAU,cAAc;CACzB,IAAI,CAAC,SAAS,cAAc,QAAQ,CAAC;CACrC,MAAM,WAAW,CAAC,CAAC;CACnB,MAAM,WAAW,cAAc;CAC/B,OAAuB,qBAAK,gBAAgB,UAAU;EACrD,OAAO;EACP,UAAU,CAAiB,oBAAI,eAAe;GAC7C,QAAQ;GACR,KAAK;GACL,OAAO,eAAe;GACtB,GAAG,SAAS,EAAE,MAAM,SAAS;GAC7B;GACA,GAAG;GACH,OAAO,CAAC,cAAc,OAAO,YAAY,WAAW;GACpD,QAAQ;GACR;GACA,UAAU,MAAM;EACjB,CAAC,GAAG,WAAW;CAChB,CAAC;AACF,CAAC,GAAG,EAAE,WAAW,gBAAgB,yBAAyB,OAAO,iBAAiB;CACjF,MAAM,EAAE,UAAU,YAAY,aAAa,GAAG,mBAAmB;CACjE,MAAM,EAAE,WAAW,sBAAsB,iBAAiB;CAC1D,MAAM,UAAU,MAAM,WAAW,eAAe;CAChD,IAAI,cAAc,gBAAgB,QAAQ,OAAO,KAAK,QAAQ,YAAY,MAAM,OAAuB,oBAAI,wBAAwB;EAClI,eAAe;EACf,GAAG;EACH,OAAO,CAAC,eAAe,OAAO,UAAU,WAAW;EACnD,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC,EAAE,CAAC"}
|
|
@@ -44,7 +44,7 @@ var import_CheckboxStyledContext = require("./CheckboxStyledContext.native.js");
|
|
|
44
44
|
var CheckboxIndicatorFrame = (0, import_core.styled)(import_core.View, {
|
|
45
45
|
displayName: "CheckboxIndicator",
|
|
46
46
|
context: import_CheckboxStyledContext.CheckboxStyledContext
|
|
47
|
-
}
|
|
47
|
+
});
|
|
48
48
|
var CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
49
49
|
displayName: "Checkbox",
|
|
50
50
|
render: "button",
|
|
@@ -55,7 +55,7 @@ var CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
|
55
55
|
pointerEvents: "none",
|
|
56
56
|
userSelect: "none"
|
|
57
57
|
} } }
|
|
58
|
-
}
|
|
58
|
+
});
|
|
59
59
|
var CheckboxContext = /* @__PURE__ */ import_react.default.createContext({
|
|
60
60
|
checked: false,
|
|
61
61
|
disabled: false
|
|
@@ -105,7 +105,7 @@ var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function
|
|
|
105
105
|
...import_core.isWeb && { type: "button" },
|
|
106
106
|
checked,
|
|
107
107
|
...checkboxProps,
|
|
108
|
-
|
|
108
|
+
style: [checkboxProps.style, isActive && activeStyle],
|
|
109
109
|
active: isActive,
|
|
110
110
|
disabled,
|
|
111
111
|
children: props.children
|
|
@@ -119,7 +119,7 @@ var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame,
|
|
|
119
119
|
if (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {
|
|
120
120
|
pointerEvents: "none",
|
|
121
121
|
...indicatorProps,
|
|
122
|
-
|
|
122
|
+
style: [indicatorProps.style, active && activeStyle],
|
|
123
123
|
ref: forwardedRef,
|
|
124
124
|
children
|
|
125
125
|
});
|
|
@@ -44,7 +44,7 @@ var import_CheckboxStyledContext = require("./CheckboxStyledContext.native.js");
|
|
|
44
44
|
var CheckboxIndicatorFrame = (0, import_core.styled)(import_core.View, {
|
|
45
45
|
displayName: "CheckboxIndicator",
|
|
46
46
|
context: import_CheckboxStyledContext.CheckboxStyledContext
|
|
47
|
-
}
|
|
47
|
+
});
|
|
48
48
|
var CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
49
49
|
displayName: "Checkbox",
|
|
50
50
|
render: "button",
|
|
@@ -55,7 +55,7 @@ var CheckboxFrame = (0, import_core.styled)(import_core.View, {
|
|
|
55
55
|
pointerEvents: "none",
|
|
56
56
|
userSelect: "none"
|
|
57
57
|
} } }
|
|
58
|
-
}
|
|
58
|
+
});
|
|
59
59
|
var CheckboxContext = /* @__PURE__ */ import_react.default.createContext({
|
|
60
60
|
checked: false,
|
|
61
61
|
disabled: false
|
|
@@ -105,7 +105,7 @@ var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function
|
|
|
105
105
|
...import_core.isWeb && { type: "button" },
|
|
106
106
|
checked,
|
|
107
107
|
...checkboxProps,
|
|
108
|
-
|
|
108
|
+
style: [checkboxProps.style, isActive && activeStyle],
|
|
109
109
|
active: isActive,
|
|
110
110
|
disabled,
|
|
111
111
|
children: props.children
|
|
@@ -119,7 +119,7 @@ var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame,
|
|
|
119
119
|
if (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {
|
|
120
120
|
pointerEvents: "none",
|
|
121
121
|
...indicatorProps,
|
|
122
|
-
|
|
122
|
+
style: [indicatorProps.style, active && activeStyle],
|
|
123
123
|
ref: forwardedRef,
|
|
124
124
|
children
|
|
125
125
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.native.js","names":[],"sources":["jsx/Checkbox.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\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n\t// If the importer is in node compatibility mode or this is not an ESM\n\t// file that has been converted to a CommonJS file using a Babel-\n\t// compatible transform (i.e. \"__esModule\" has not been set), then set\n\t// \"default\" to the CommonJS \"module.exports\" for node compatibility.\n\tisNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\t\tvalue: mod,\n\t\tenumerable: true\n\t}) : target,\n\tmod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Checkbox_exports = {};\n__export(Checkbox_exports, {\n\tCheckbox: () => Checkbox2,\n\tCheckboxContext: () => CheckboxContext,\n\tCheckboxFrame: () => CheckboxFrame,\n\tCheckboxIndicatorFrame: () => CheckboxIndicatorFrame\n});\nmodule.exports = __toCommonJS(Checkbox_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_checkbox_headless = require(\"@tamagui/checkbox-headless\");\nvar import_core = require(\"@tamagui/core\");\nvar import_focusable = require(\"@tamagui/focusable\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_CheckboxStyledContext = require(\"./CheckboxStyledContext\");\nvar CheckboxIndicatorFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: import_CheckboxStyledContext.CheckboxStyledContext\n}
|
|
1
|
+
{"version":3,"file":"Checkbox.native.js","names":[],"sources":["jsx/Checkbox.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\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n\t// If the importer is in node compatibility mode or this is not an ESM\n\t// file that has been converted to a CommonJS file using a Babel-\n\t// compatible transform (i.e. \"__esModule\" has not been set), then set\n\t// \"default\" to the CommonJS \"module.exports\" for node compatibility.\n\tisNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", {\n\t\tvalue: mod,\n\t\tenumerable: true\n\t}) : target,\n\tmod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Checkbox_exports = {};\n__export(Checkbox_exports, {\n\tCheckbox: () => Checkbox2,\n\tCheckboxContext: () => CheckboxContext,\n\tCheckboxFrame: () => CheckboxFrame,\n\tCheckboxIndicatorFrame: () => CheckboxIndicatorFrame\n});\nmodule.exports = __toCommonJS(Checkbox_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_checkbox_headless = require(\"@tamagui/checkbox-headless\");\nvar import_core = require(\"@tamagui/core\");\nvar import_focusable = require(\"@tamagui/focusable\");\nvar import_use_controllable_state = require(\"@tamagui/use-controllable-state\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_CheckboxStyledContext = require(\"./CheckboxStyledContext\");\nvar CheckboxIndicatorFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"CheckboxIndicator\",\n\tcontext: import_CheckboxStyledContext.CheckboxStyledContext\n});\nvar CheckboxFrame = (0, import_core.styled)(import_core.View, {\n\tdisplayName: \"Checkbox\",\n\trender: \"button\",\n\tcontext: import_CheckboxStyledContext.CheckboxStyledContext,\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tvariants: { disabled: { true: {\n\t\tpointerEvents: \"none\",\n\t\tuserSelect: \"none\"\n\t} } }\n});\nvar CheckboxContext = /* @__PURE__ */ import_react.default.createContext({\n\tchecked: false,\n\tdisabled: false\n});\nvar CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {\n\tvar { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;\n\tvar [checked = false, setChecked] = (0, import_use_controllable_state.useControllableState)({\n\t\tprop: checkedProp,\n\t\tdefaultProp: defaultChecked,\n\t\tonChange: onCheckedChange\n\t});\n\tvar { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(props, [checked, setChecked], forwardedRef);\n\timport_react.default.useEffect(function() {\n\t\tif (!props.id) return;\n\t\tif (props.disabled) return;\n\t\treturn (0, import_focusable.registerFocusable)(props.id, {\n\t\t\tfocusAndSelect: function() {\n\t\t\t\tsetChecked === null || setChecked === void 0 || setChecked(function(value) {\n\t\t\t\t\treturn !value;\n\t\t\t\t});\n\t\t\t},\n\t\t\tfocus: function() {}\n\t\t});\n\t}, [props.id, props.disabled]);\n\tif ((0, import_core.shouldRenderNativePlatform)(native) === \"web\") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"input\", {\n\t\ttype: \"checkbox\",\n\t\tdefaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? false : checked,\n\t\ttabIndex: -1,\n\t\tref: checkboxRef,\n\t\tdisabled: checkboxProps.disabled,\n\t\tstyle: checkboxProps.style\n\t});\n\tvar memoizedContext = (0, import_react.useMemo)(function() {\n\t\treturn {\n\t\t\tchecked,\n\t\t\tdisabled: checkboxProps.disabled\n\t\t};\n\t}, [checked, checkboxProps.disabled]);\n\tvar isActive = !!checked;\n\tvar disabled = checkboxProps.disabled;\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {\n\t\t\trender: \"button\",\n\t\t\tref: checkboxRef,\n\t\t\ttheme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,\n\t\t\t...import_core.isWeb && { type: \"button\" },\n\t\t\tchecked,\n\t\t\t...checkboxProps,\n\t\t\tstyle: [checkboxProps.style, isActive && activeStyle],\n\t\t\tactive: isActive,\n\t\t\tdisabled,\n\t\t\tchildren: props.children\n\t\t}), bubbleInput]\n\t});\n});\nvar CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame, function(props, forwardedRef) {\n\tvar { children, forceMount, activeStyle, ...indicatorProps } = props;\n\tvar { active } = import_CheckboxStyledContext.CheckboxStyledContext.useStyledContext();\n\tvar context = import_react.default.useContext(CheckboxContext);\n\tif (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {\n\t\tpointerEvents: \"none\",\n\t\t...indicatorProps,\n\t\tstyle: [indicatorProps.style, active && activeStyle],\n\t\tref: forwardedRef,\n\t\tchildren\n\t});\n\treturn null;\n});\nvar Checkbox2 = (0, import_core.withStaticProperties)(CheckboxComponent, { Indicator: CheckboxIndicator });\n//# sourceMappingURL=Checkbox.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,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HANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/checkbox",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.881.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"clean:build": "tamagui-build clean:build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/checkbox-headless": "3.0.0-beta.
|
|
39
|
-
"@tamagui/core": "3.0.0-beta.
|
|
40
|
-
"@tamagui/focusable": "3.0.0-beta.
|
|
41
|
-
"@tamagui/use-controllable-state": "3.0.0-beta.
|
|
38
|
+
"@tamagui/checkbox-headless": "3.0.0-beta.881.1",
|
|
39
|
+
"@tamagui/core": "3.0.0-beta.881.1",
|
|
40
|
+
"@tamagui/focusable": "3.0.0-beta.881.1",
|
|
41
|
+
"@tamagui/use-controllable-state": "3.0.0-beta.881.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@tamagui/build": "3.0.0-beta.
|
|
44
|
+
"@tamagui/build": "3.0.0-beta.881.1",
|
|
45
45
|
"react": "19.2.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
package/src/Checkbox.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
CheckboxExtraProps as HeadlessCheckboxExtraProps,
|
|
7
7
|
} from '@tamagui/checkbox-headless'
|
|
8
8
|
import { isIndeterminate, useCheckbox } from '@tamagui/checkbox-headless'
|
|
9
|
-
import type { GetProps, NativeValue, SizeTokens } from '@tamagui/core'
|
|
9
|
+
import type { GetProps, NativeValue, SizeTokens, StylePiece } from '@tamagui/core'
|
|
10
10
|
import {
|
|
11
11
|
createStyledHOC,
|
|
12
12
|
isWeb,
|
|
@@ -23,46 +23,30 @@ import { CheckboxStyledContext } from './CheckboxStyledContext'
|
|
|
23
23
|
|
|
24
24
|
const INDICATOR_NAME = 'CheckboxIndicator'
|
|
25
25
|
|
|
26
|
-
export const CheckboxIndicatorFrame = styled(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
context: CheckboxStyledContext,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
accept: {
|
|
35
|
-
activeStyle: 'style',
|
|
36
|
-
} as const,
|
|
37
|
-
}
|
|
38
|
-
)
|
|
26
|
+
export const CheckboxIndicatorFrame = styled(View, {
|
|
27
|
+
// use Checkbox for easier themes
|
|
28
|
+
displayName: INDICATOR_NAME,
|
|
29
|
+
context: CheckboxStyledContext,
|
|
30
|
+
})
|
|
39
31
|
|
|
40
32
|
const CHECKBOX_NAME = 'Checkbox'
|
|
41
33
|
|
|
42
|
-
export const CheckboxFrame = styled(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
pointerEvents: 'none',
|
|
55
|
-
userSelect: 'none',
|
|
56
|
-
},
|
|
34
|
+
export const CheckboxFrame = styled(View, {
|
|
35
|
+
displayName: CHECKBOX_NAME,
|
|
36
|
+
render: 'button',
|
|
37
|
+
context: CheckboxStyledContext,
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
|
|
41
|
+
variants: {
|
|
42
|
+
disabled: {
|
|
43
|
+
true: {
|
|
44
|
+
pointerEvents: 'none',
|
|
45
|
+
userSelect: 'none',
|
|
57
46
|
},
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
accept: {
|
|
62
|
-
activeStyle: 'style',
|
|
63
|
-
} as const,
|
|
64
|
-
}
|
|
65
|
-
)
|
|
47
|
+
},
|
|
48
|
+
} as const,
|
|
49
|
+
})
|
|
66
50
|
|
|
67
51
|
type CheckboxExpectingVariantProps = {
|
|
68
52
|
size?: SizeTokens | true
|
|
@@ -73,12 +57,12 @@ type CheckboxExtraProps = HeadlessCheckboxExtraProps & {
|
|
|
73
57
|
}
|
|
74
58
|
|
|
75
59
|
type CheckboxFrameActiveStyleProps = {
|
|
76
|
-
activeStyle?:
|
|
60
|
+
activeStyle?: StylePiece
|
|
77
61
|
activeTheme?: string | null
|
|
78
62
|
}
|
|
79
63
|
|
|
80
64
|
type CheckboxIndicatorActiveStyleProps = {
|
|
81
|
-
activeStyle?:
|
|
65
|
+
activeStyle?: StylePiece
|
|
82
66
|
}
|
|
83
67
|
|
|
84
68
|
export type CheckboxProps = GetProps<typeof CheckboxFrame> &
|
|
@@ -179,7 +163,7 @@ const CheckboxComponent = createStyledHOC(
|
|
|
179
163
|
{...(isWeb && { type: 'button' })}
|
|
180
164
|
checked={checked}
|
|
181
165
|
{...(checkboxProps as CheckboxProps)}
|
|
182
|
-
{
|
|
166
|
+
style={[checkboxProps.style, isActive && activeStyle]}
|
|
183
167
|
active={isActive}
|
|
184
168
|
disabled={disabled}
|
|
185
169
|
>
|
|
@@ -203,7 +187,7 @@ const CheckboxIndicator = createStyledHOC(
|
|
|
203
187
|
<CheckboxIndicatorFrame
|
|
204
188
|
pointerEvents="none"
|
|
205
189
|
{...indicatorProps}
|
|
206
|
-
{
|
|
190
|
+
style={[indicatorProps.style, active && activeStyle]}
|
|
207
191
|
ref={forwardedRef}
|
|
208
192
|
>
|
|
209
193
|
{children}
|