@tamagui/checkbox 3.0.0-beta.807.1 → 3.0.0-beta.831.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 +14 -21
- package/dist/cjs/Checkbox.native.cjs +14 -22
- package/dist/cjs/Checkbox.native.js +14 -22
- package/dist/cjs/Checkbox.native.js.map +1 -1
- package/dist/esm/Checkbox.mjs +15 -22
- package/dist/esm/Checkbox.mjs.map +1 -1
- package/dist/esm/Checkbox.native.js +15 -23
- package/dist/esm/Checkbox.native.js.map +1 -1
- package/dist/jsx/Checkbox.mjs +15 -22
- package/dist/jsx/Checkbox.mjs.map +1 -1
- package/dist/jsx/Checkbox.native.cjs +14 -22
- package/dist/jsx/Checkbox.native.js +14 -22
- package/dist/jsx/Checkbox.native.js.map +1 -1
- package/package.json +6 -6
- package/src/Checkbox.tsx +14 -24
- package/types/Checkbox.d.ts.map +1 -1
package/dist/cjs/Checkbox.cjs
CHANGED
|
@@ -58,16 +58,14 @@ const CheckboxContext = import_react.default.createContext({
|
|
|
58
58
|
checked: false,
|
|
59
59
|
disabled: false
|
|
60
60
|
});
|
|
61
|
-
const CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(
|
|
62
|
-
const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } =
|
|
63
|
-
const propsActive = (0, import_core.useProps)(props);
|
|
64
|
-
const styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext.context);
|
|
61
|
+
const CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {
|
|
62
|
+
const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;
|
|
65
63
|
const [checked = false, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
66
64
|
prop: checkedProp,
|
|
67
65
|
defaultProp: defaultChecked,
|
|
68
66
|
onChange: onCheckedChange
|
|
69
67
|
});
|
|
70
|
-
const { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
68
|
+
const { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(props, [checked, setChecked], forwardedRef);
|
|
71
69
|
if ((0, import_core.shouldRenderNativePlatform)(native) === "web") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
72
70
|
type: "checkbox",
|
|
73
71
|
defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? false : checked,
|
|
@@ -82,25 +80,20 @@ const CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, functi
|
|
|
82
80
|
}), [checked, checkboxProps.disabled]);
|
|
83
81
|
const isActive = !!checked;
|
|
84
82
|
const disabled = checkboxProps.disabled;
|
|
85
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxContext.Provider, {
|
|
86
84
|
value: memoizedContext,
|
|
87
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
88
|
-
|
|
85
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {
|
|
86
|
+
render: "button",
|
|
87
|
+
ref: checkboxRef,
|
|
88
|
+
theme: activeTheme ?? null,
|
|
89
|
+
...import_core.isWeb && { type: "button" },
|
|
90
|
+
checked,
|
|
91
|
+
...checkboxProps,
|
|
92
|
+
...isActive && activeStyle ? activeStyle : void 0,
|
|
89
93
|
active: isActive,
|
|
90
94
|
disabled,
|
|
91
|
-
children:
|
|
92
|
-
|
|
93
|
-
ref: checkboxRef,
|
|
94
|
-
theme: activeTheme ?? null,
|
|
95
|
-
...import_core.isWeb && { type: "button" },
|
|
96
|
-
checked,
|
|
97
|
-
disabled,
|
|
98
|
-
...checkboxProps,
|
|
99
|
-
...props,
|
|
100
|
-
...isActive && activeStyle ? activeStyle : void 0,
|
|
101
|
-
children: propsActive.children
|
|
102
|
-
}), bubbleInput]
|
|
103
|
-
})
|
|
95
|
+
children: props.children
|
|
96
|
+
}), bubbleInput]
|
|
104
97
|
});
|
|
105
98
|
});
|
|
106
99
|
const CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame, (props, forwardedRef) => {
|
|
@@ -60,16 +60,14 @@ var CheckboxContext = /* @__PURE__ */ import_react.default.createContext({
|
|
|
60
60
|
checked: false,
|
|
61
61
|
disabled: false
|
|
62
62
|
});
|
|
63
|
-
var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(
|
|
64
|
-
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } =
|
|
65
|
-
var propsActive = (0, import_core.useProps)(props);
|
|
66
|
-
var styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext.context);
|
|
63
|
+
var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {
|
|
64
|
+
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;
|
|
67
65
|
var [checked = false, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
68
66
|
prop: checkedProp,
|
|
69
67
|
defaultProp: defaultChecked,
|
|
70
68
|
onChange: onCheckedChange
|
|
71
69
|
});
|
|
72
|
-
var { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
70
|
+
var { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(props, [checked, setChecked], forwardedRef);
|
|
73
71
|
import_react.default.useEffect(function() {
|
|
74
72
|
if (!props.id) return;
|
|
75
73
|
if (props.disabled) return;
|
|
@@ -98,26 +96,20 @@ var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function
|
|
|
98
96
|
}, [checked, checkboxProps.disabled]);
|
|
99
97
|
var isActive = !!checked;
|
|
100
98
|
var disabled = checkboxProps.disabled;
|
|
101
|
-
|
|
102
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxContext.Provider, {
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxContext.Provider, {
|
|
103
100
|
value: memoizedContext,
|
|
104
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
105
|
-
|
|
101
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {
|
|
102
|
+
render: "button",
|
|
103
|
+
ref: checkboxRef,
|
|
104
|
+
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
105
|
+
...import_core.isWeb && { type: "button" },
|
|
106
|
+
checked,
|
|
107
|
+
...checkboxProps,
|
|
108
|
+
...isActive && activeStyle ? activeStyle : void 0,
|
|
106
109
|
active: isActive,
|
|
107
110
|
disabled,
|
|
108
|
-
children:
|
|
109
|
-
|
|
110
|
-
ref: checkboxRef,
|
|
111
|
-
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
112
|
-
...import_core.isWeb && { type: "button" },
|
|
113
|
-
checked,
|
|
114
|
-
disabled,
|
|
115
|
-
...checkboxProps,
|
|
116
|
-
...props,
|
|
117
|
-
...isActive && activeStyle ? activeStyle : void 0,
|
|
118
|
-
children: propsActive.children
|
|
119
|
-
}), bubbleInput]
|
|
120
|
-
})
|
|
111
|
+
children: props.children
|
|
112
|
+
}), bubbleInput]
|
|
121
113
|
});
|
|
122
114
|
});
|
|
123
115
|
var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame, function(props, forwardedRef) {
|
|
@@ -60,16 +60,14 @@ var CheckboxContext = /* @__PURE__ */ import_react.default.createContext({
|
|
|
60
60
|
checked: false,
|
|
61
61
|
disabled: false
|
|
62
62
|
});
|
|
63
|
-
var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(
|
|
64
|
-
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } =
|
|
65
|
-
var propsActive = (0, import_core.useProps)(props);
|
|
66
|
-
var styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext.context);
|
|
63
|
+
var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {
|
|
64
|
+
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;
|
|
67
65
|
var [checked = false, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
68
66
|
prop: checkedProp,
|
|
69
67
|
defaultProp: defaultChecked,
|
|
70
68
|
onChange: onCheckedChange
|
|
71
69
|
});
|
|
72
|
-
var { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
70
|
+
var { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(props, [checked, setChecked], forwardedRef);
|
|
73
71
|
import_react.default.useEffect(function() {
|
|
74
72
|
if (!props.id) return;
|
|
75
73
|
if (props.disabled) return;
|
|
@@ -98,26 +96,20 @@ var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function
|
|
|
98
96
|
}, [checked, checkboxProps.disabled]);
|
|
99
97
|
var isActive = !!checked;
|
|
100
98
|
var disabled = checkboxProps.disabled;
|
|
101
|
-
|
|
102
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxContext.Provider, {
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxContext.Provider, {
|
|
103
100
|
value: memoizedContext,
|
|
104
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
105
|
-
|
|
101
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {
|
|
102
|
+
render: "button",
|
|
103
|
+
ref: checkboxRef,
|
|
104
|
+
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
105
|
+
...import_core.isWeb && { type: "button" },
|
|
106
|
+
checked,
|
|
107
|
+
...checkboxProps,
|
|
108
|
+
...isActive && activeStyle ? activeStyle : void 0,
|
|
106
109
|
active: isActive,
|
|
107
110
|
disabled,
|
|
108
|
-
children:
|
|
109
|
-
|
|
110
|
-
ref: checkboxRef,
|
|
111
|
-
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
112
|
-
...import_core.isWeb && { type: "button" },
|
|
113
|
-
checked,
|
|
114
|
-
disabled,
|
|
115
|
-
...checkboxProps,
|
|
116
|
-
...props,
|
|
117
|
-
...isActive && activeStyle ? activeStyle : void 0,
|
|
118
|
-
children: propsActive.children
|
|
119
|
-
}), bubbleInput]
|
|
120
|
-
})
|
|
111
|
+
children: props.children
|
|
112
|
+
}), bubbleInput]
|
|
121
113
|
});
|
|
122
114
|
});
|
|
123
115
|
var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame, function(props, forwardedRef) {
|
|
@@ -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}, { accept: { activeStyle: \"style\" } });\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}, { accept: { activeStyle: \"style\" } });\nvar CheckboxContext = /* @__PURE__ */ import_react.default.createContext({\n\tchecked: false,\n\tdisabled: false\n});\nvar CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(_props, forwardedRef) {\n\tvar { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _props;\n\tvar propsActive = (0, import_core.useProps)(props);\n\tvar styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext.context);\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)(\n\t\t// @ts-ignore\n\t\tpropsActive,\n\t\t[checked, setChecked],\n\t\tforwardedRef\n\t);\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\tvar _propsActive_size, _ref;\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_CheckboxStyledContext.CheckboxStyledContext.Provider, {\n\t\t\tsize: (_ref = (_propsActive_size = propsActive.size) !== null && _propsActive_size !== void 0 ? _propsActive_size : styledContext === null || styledContext === void 0 ? void 0 : styledContext.size) !== null && _ref !== void 0 ? _ref : true,\n\t\t\tactive: isActive,\n\t\t\tdisabled,\n\t\t\tchildren: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {\n\t\t\t\trender: \"button\",\n\t\t\t\tref: checkboxRef,\n\t\t\t\ttheme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,\n\t\t\t\t...import_core.isWeb && { type: \"button\" },\n\t\t\t\tchecked,\n\t\t\t\tdisabled,\n\t\t\t\t...checkboxProps,\n\t\t\t\t...props,\n\t\t\t\t...isActive && activeStyle ? activeStyle : void 0,\n\t\t\t\tchildren: propsActive.children\n\t\t\t}), bubbleInput]\n\t\t})\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\t...active && activeStyle ? activeStyle : void 0,\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,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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,GAAG,UAAU,cAAc,cAAc,KAAK;EAC9C,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC;AACD,IAAI,aAAa,GAAG,YAAY,qBAAoB,CAAE,mBAAmB,EAAE,WAAW,kBAAkB,CAAC"}
|
|
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}, { accept: { activeStyle: \"style\" } });\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}, { accept: { activeStyle: \"style\" } });\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\t...isActive && activeStyle ? activeStyle : void 0,\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\t...active && activeStyle ? activeStyle : void 0,\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,GAAG,MAAM,KAAK;EAC3D,CAAC;CACF;CACA,OAAO;AACR;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKpG,cAAc,CAAC,OAA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AS;GACzC;GACA,GAAG;GACH,GAAG,YAAY,cAAc,cAAc,KAAK;GAChD,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,GAAG,UAAU,cAAc,cAAc,KAAK;EAC9C,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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isIndeterminate, useCheckbox } from "@tamagui/checkbox-headless";
|
|
2
|
-
import { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled,
|
|
2
|
+
import { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from "@tamagui/core";
|
|
3
3
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
4
4
|
import React, { useMemo } from "react";
|
|
5
5
|
import { CheckboxStyledContext } from "./CheckboxStyledContext.mjs";
|
|
@@ -24,16 +24,14 @@ const CheckboxContext = React.createContext({
|
|
|
24
24
|
checked: false,
|
|
25
25
|
disabled: false
|
|
26
26
|
});
|
|
27
|
-
const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(
|
|
28
|
-
const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } =
|
|
29
|
-
const propsActive = useProps(props);
|
|
30
|
-
const styledContext = React.useContext(CheckboxStyledContext.context);
|
|
27
|
+
const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {
|
|
28
|
+
const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;
|
|
31
29
|
const [checked = false, setChecked] = useControllableState({
|
|
32
30
|
prop: checkedProp,
|
|
33
31
|
defaultProp: defaultChecked,
|
|
34
32
|
onChange: onCheckedChange
|
|
35
33
|
});
|
|
36
|
-
const { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(
|
|
34
|
+
const { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(props, [checked, setChecked], forwardedRef);
|
|
37
35
|
if (shouldRenderNativePlatform(native) === "web") return /* @__PURE__ */ jsx("input", {
|
|
38
36
|
type: "checkbox",
|
|
39
37
|
defaultChecked: isIndeterminate(checked) ? false : checked,
|
|
@@ -48,25 +46,20 @@ const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function C
|
|
|
48
46
|
}), [checked, checkboxProps.disabled]);
|
|
49
47
|
const isActive = !!checked;
|
|
50
48
|
const disabled = checkboxProps.disabled;
|
|
51
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ jsxs(CheckboxContext.Provider, {
|
|
52
50
|
value: memoizedContext,
|
|
53
|
-
children: /* @__PURE__ */
|
|
54
|
-
|
|
51
|
+
children: [/* @__PURE__ */ jsx(CheckboxFrame, {
|
|
52
|
+
render: "button",
|
|
53
|
+
ref: checkboxRef,
|
|
54
|
+
theme: activeTheme ?? null,
|
|
55
|
+
...isWeb && { type: "button" },
|
|
56
|
+
checked,
|
|
57
|
+
...checkboxProps,
|
|
58
|
+
...isActive && activeStyle ? activeStyle : void 0,
|
|
55
59
|
active: isActive,
|
|
56
60
|
disabled,
|
|
57
|
-
children:
|
|
58
|
-
|
|
59
|
-
ref: checkboxRef,
|
|
60
|
-
theme: activeTheme ?? null,
|
|
61
|
-
...isWeb && { type: "button" },
|
|
62
|
-
checked,
|
|
63
|
-
disabled,
|
|
64
|
-
...checkboxProps,
|
|
65
|
-
...props,
|
|
66
|
-
...isActive && activeStyle ? activeStyle : void 0,
|
|
67
|
-
children: propsActive.children
|
|
68
|
-
}), bubbleInput]
|
|
69
|
-
})
|
|
61
|
+
children: props.children
|
|
62
|
+
}), bubbleInput]
|
|
70
63
|
});
|
|
71
64
|
}), { Indicator: createStyledHOC(CheckboxIndicatorFrame, (props, forwardedRef) => {
|
|
72
65
|
const { children, forceMount, activeStyle, ...indicatorProps } = props;
|
|
@@ -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,
|
|
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}, { accept: { activeStyle: \"style\" } });\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}, { accept: { activeStyle: \"style\" } });\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\t...isActive && activeStyle ? activeStyle : void 0,\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\t...active && activeStyle ? activeStyle : void 0,\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,GAAG,EAAE,QAAQ,EAAE,aAAa,QAAQ,EAAE,CAAC;AACvC,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,GAAG,EAAE,QAAQ,EAAE,aAAa,QAAQ,EAAE,CAAC;AACvC,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,GAAG,YAAY,cAAc,cAAc,KAAK;GAChD,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,GAAG,UAAU,cAAc,cAAc,KAAK;EAC9C,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { isIndeterminate, useCheckbox } from "@tamagui/checkbox-headless";
|
|
3
|
-
import { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled,
|
|
3
|
+
import { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from "@tamagui/core";
|
|
4
4
|
import { registerFocusable } from "@tamagui/focusable";
|
|
5
5
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
6
6
|
import React, { useMemo } from "react";
|
|
@@ -25,16 +25,14 @@ var CheckboxContext = /* @__PURE__ */ React.createContext({
|
|
|
25
25
|
checked: false,
|
|
26
26
|
disabled: false
|
|
27
27
|
});
|
|
28
|
-
var Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(
|
|
29
|
-
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } =
|
|
30
|
-
var propsActive = useProps(props);
|
|
31
|
-
var styledContext = React.useContext(CheckboxStyledContext.context);
|
|
28
|
+
var Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {
|
|
29
|
+
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;
|
|
32
30
|
var [checked = false, setChecked] = useControllableState({
|
|
33
31
|
prop: checkedProp,
|
|
34
32
|
defaultProp: defaultChecked,
|
|
35
33
|
onChange: onCheckedChange
|
|
36
34
|
});
|
|
37
|
-
var { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(
|
|
35
|
+
var { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(props, [checked, setChecked], forwardedRef);
|
|
38
36
|
React.useEffect(function() {
|
|
39
37
|
if (!props.id) return;
|
|
40
38
|
if (props.disabled) return;
|
|
@@ -63,26 +61,20 @@ var Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Che
|
|
|
63
61
|
}, [checked, checkboxProps.disabled]);
|
|
64
62
|
var isActive = !!checked;
|
|
65
63
|
var disabled = checkboxProps.disabled;
|
|
66
|
-
|
|
67
|
-
return /* @__PURE__ */ jsx(CheckboxContext.Provider, {
|
|
64
|
+
return /* @__PURE__ */ jsxs(CheckboxContext.Provider, {
|
|
68
65
|
value: memoizedContext,
|
|
69
|
-
children: /* @__PURE__ */
|
|
70
|
-
|
|
66
|
+
children: [/* @__PURE__ */ jsx(CheckboxFrame, {
|
|
67
|
+
render: "button",
|
|
68
|
+
ref: checkboxRef,
|
|
69
|
+
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
70
|
+
...isWeb && { type: "button" },
|
|
71
|
+
checked,
|
|
72
|
+
...checkboxProps,
|
|
73
|
+
...isActive && activeStyle ? activeStyle : void 0,
|
|
71
74
|
active: isActive,
|
|
72
75
|
disabled,
|
|
73
|
-
children:
|
|
74
|
-
|
|
75
|
-
ref: checkboxRef,
|
|
76
|
-
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
77
|
-
...isWeb && { type: "button" },
|
|
78
|
-
checked,
|
|
79
|
-
disabled,
|
|
80
|
-
...checkboxProps,
|
|
81
|
-
...props,
|
|
82
|
-
...isActive && activeStyle ? activeStyle : void 0,
|
|
83
|
-
children: propsActive.children
|
|
84
|
-
}), bubbleInput]
|
|
85
|
-
})
|
|
76
|
+
children: props.children
|
|
77
|
+
}), bubbleInput]
|
|
86
78
|
});
|
|
87
79
|
}), { Indicator: createStyledHOC(CheckboxIndicatorFrame, function(props, forwardedRef) {
|
|
88
80
|
var { children, forceMount, activeStyle, ...indicatorProps } = props;
|
|
@@ -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,
|
|
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}, { accept: { activeStyle: \"style\" } });\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}, { accept: { activeStyle: \"style\" } });\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\t...isActive && activeStyle ? activeStyle : void 0,\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\t...active && activeStyle ? activeStyle : void 0,\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,MAAM;CACzC,aAAa;CACb,SAAS;AACV,GAAG,EAAE,QAAQ,EAAE,aAAa,QAAQ,EAAE,CAAC;AACvC,IAAI,gBAAgB,OAAO,MAAM;CAChC,aAAa;CACb,QAAQ;CACR,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,UAAU,EAAE,UAAU,EAAE,MAAM;EAC7B,eAAe;EACf,YAAY;CACb,EAAE,EAAE;AACL,GAAG,EAAE,QAAQ,EAAE,aAAa,QAAQ,EAAE,CAAC;AACvC,IAAI,kBAAkC,sBAAM,cAAc;CACzD,SAAS;CACT,UAAU;AACX,CAAC;AACD,IAAI,YAAY,qBAAqB,gBAAgB,eAAe,SAAS,SAAS,SAAS,cAAc;CAC5G,IAAI,EAAE,SAAS,aAAa,gBAAgB,iBAAiB,QAAQ,aAA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c;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,GAAG,UAAU,cAAc,cAAc,KAAK;EAC9C,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC,EAAE,CAAC"}
|
package/dist/jsx/Checkbox.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isIndeterminate, useCheckbox } from "@tamagui/checkbox-headless";
|
|
2
|
-
import { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled,
|
|
2
|
+
import { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, withStaticProperties } from "@tamagui/core";
|
|
3
3
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
4
4
|
import React, { useMemo } from "react";
|
|
5
5
|
import { CheckboxStyledContext } from "./CheckboxStyledContext.mjs";
|
|
@@ -24,16 +24,14 @@ const CheckboxContext = React.createContext({
|
|
|
24
24
|
checked: false,
|
|
25
25
|
disabled: false
|
|
26
26
|
});
|
|
27
|
-
const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(
|
|
28
|
-
const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } =
|
|
29
|
-
const propsActive = useProps(props);
|
|
30
|
-
const styledContext = React.useContext(CheckboxStyledContext.context);
|
|
27
|
+
const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {
|
|
28
|
+
const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;
|
|
31
29
|
const [checked = false, setChecked] = useControllableState({
|
|
32
30
|
prop: checkedProp,
|
|
33
31
|
defaultProp: defaultChecked,
|
|
34
32
|
onChange: onCheckedChange
|
|
35
33
|
});
|
|
36
|
-
const { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(
|
|
34
|
+
const { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(props, [checked, setChecked], forwardedRef);
|
|
37
35
|
if (shouldRenderNativePlatform(native) === "web") return /* @__PURE__ */ jsx("input", {
|
|
38
36
|
type: "checkbox",
|
|
39
37
|
defaultChecked: isIndeterminate(checked) ? false : checked,
|
|
@@ -48,25 +46,20 @@ const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function C
|
|
|
48
46
|
}), [checked, checkboxProps.disabled]);
|
|
49
47
|
const isActive = !!checked;
|
|
50
48
|
const disabled = checkboxProps.disabled;
|
|
51
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ jsxs(CheckboxContext.Provider, {
|
|
52
50
|
value: memoizedContext,
|
|
53
|
-
children: /* @__PURE__ */
|
|
54
|
-
|
|
51
|
+
children: [/* @__PURE__ */ jsx(CheckboxFrame, {
|
|
52
|
+
render: "button",
|
|
53
|
+
ref: checkboxRef,
|
|
54
|
+
theme: activeTheme ?? null,
|
|
55
|
+
...isWeb && { type: "button" },
|
|
56
|
+
checked,
|
|
57
|
+
...checkboxProps,
|
|
58
|
+
...isActive && activeStyle ? activeStyle : void 0,
|
|
55
59
|
active: isActive,
|
|
56
60
|
disabled,
|
|
57
|
-
children:
|
|
58
|
-
|
|
59
|
-
ref: checkboxRef,
|
|
60
|
-
theme: activeTheme ?? null,
|
|
61
|
-
...isWeb && { type: "button" },
|
|
62
|
-
checked,
|
|
63
|
-
disabled,
|
|
64
|
-
...checkboxProps,
|
|
65
|
-
...props,
|
|
66
|
-
...isActive && activeStyle ? activeStyle : void 0,
|
|
67
|
-
children: propsActive.children
|
|
68
|
-
}), bubbleInput]
|
|
69
|
-
})
|
|
61
|
+
children: props.children
|
|
62
|
+
}), bubbleInput]
|
|
70
63
|
});
|
|
71
64
|
}), { Indicator: createStyledHOC(CheckboxIndicatorFrame, (props, forwardedRef) => {
|
|
72
65
|
const { children, forceMount, activeStyle, ...indicatorProps } = props;
|
|
@@ -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,
|
|
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}, { accept: { activeStyle: \"style\" } });\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}, { accept: { activeStyle: \"style\" } });\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\t...isActive && activeStyle ? activeStyle : void 0,\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\t...active && activeStyle ? activeStyle : void 0,\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,GAAG,EAAE,QAAQ,EAAE,aAAa,QAAQ,E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;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,GAAG,UAAU,cAAc,cAAc,KAAK;EAC9C,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC,EAAE,CAAC"}
|
|
@@ -60,16 +60,14 @@ var CheckboxContext = /* @__PURE__ */ import_react.default.createContext({
|
|
|
60
60
|
checked: false,
|
|
61
61
|
disabled: false
|
|
62
62
|
});
|
|
63
|
-
var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(
|
|
64
|
-
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } =
|
|
65
|
-
var propsActive = (0, import_core.useProps)(props);
|
|
66
|
-
var styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext.context);
|
|
63
|
+
var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {
|
|
64
|
+
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;
|
|
67
65
|
var [checked = false, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
68
66
|
prop: checkedProp,
|
|
69
67
|
defaultProp: defaultChecked,
|
|
70
68
|
onChange: onCheckedChange
|
|
71
69
|
});
|
|
72
|
-
var { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
70
|
+
var { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(props, [checked, setChecked], forwardedRef);
|
|
73
71
|
import_react.default.useEffect(function() {
|
|
74
72
|
if (!props.id) return;
|
|
75
73
|
if (props.disabled) return;
|
|
@@ -98,26 +96,20 @@ var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function
|
|
|
98
96
|
}, [checked, checkboxProps.disabled]);
|
|
99
97
|
var isActive = !!checked;
|
|
100
98
|
var disabled = checkboxProps.disabled;
|
|
101
|
-
|
|
102
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxContext.Provider, {
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxContext.Provider, {
|
|
103
100
|
value: memoizedContext,
|
|
104
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
105
|
-
|
|
101
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {
|
|
102
|
+
render: "button",
|
|
103
|
+
ref: checkboxRef,
|
|
104
|
+
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
105
|
+
...import_core.isWeb && { type: "button" },
|
|
106
|
+
checked,
|
|
107
|
+
...checkboxProps,
|
|
108
|
+
...isActive && activeStyle ? activeStyle : void 0,
|
|
106
109
|
active: isActive,
|
|
107
110
|
disabled,
|
|
108
|
-
children:
|
|
109
|
-
|
|
110
|
-
ref: checkboxRef,
|
|
111
|
-
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
112
|
-
...import_core.isWeb && { type: "button" },
|
|
113
|
-
checked,
|
|
114
|
-
disabled,
|
|
115
|
-
...checkboxProps,
|
|
116
|
-
...props,
|
|
117
|
-
...isActive && activeStyle ? activeStyle : void 0,
|
|
118
|
-
children: propsActive.children
|
|
119
|
-
}), bubbleInput]
|
|
120
|
-
})
|
|
111
|
+
children: props.children
|
|
112
|
+
}), bubbleInput]
|
|
121
113
|
});
|
|
122
114
|
});
|
|
123
115
|
var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame, function(props, forwardedRef) {
|
|
@@ -60,16 +60,14 @@ var CheckboxContext = /* @__PURE__ */ import_react.default.createContext({
|
|
|
60
60
|
checked: false,
|
|
61
61
|
disabled: false
|
|
62
62
|
});
|
|
63
|
-
var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(
|
|
64
|
-
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } =
|
|
65
|
-
var propsActive = (0, import_core.useProps)(props);
|
|
66
|
-
var styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext.context);
|
|
63
|
+
var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(propsIn, forwardedRef) {
|
|
64
|
+
var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = propsIn;
|
|
67
65
|
var [checked = false, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
68
66
|
prop: checkedProp,
|
|
69
67
|
defaultProp: defaultChecked,
|
|
70
68
|
onChange: onCheckedChange
|
|
71
69
|
});
|
|
72
|
-
var { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
70
|
+
var { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(props, [checked, setChecked], forwardedRef);
|
|
73
71
|
import_react.default.useEffect(function() {
|
|
74
72
|
if (!props.id) return;
|
|
75
73
|
if (props.disabled) return;
|
|
@@ -98,26 +96,20 @@ var CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function
|
|
|
98
96
|
}, [checked, checkboxProps.disabled]);
|
|
99
97
|
var isActive = !!checked;
|
|
100
98
|
var disabled = checkboxProps.disabled;
|
|
101
|
-
|
|
102
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxContext.Provider, {
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxContext.Provider, {
|
|
103
100
|
value: memoizedContext,
|
|
104
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
105
|
-
|
|
101
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {
|
|
102
|
+
render: "button",
|
|
103
|
+
ref: checkboxRef,
|
|
104
|
+
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
105
|
+
...import_core.isWeb && { type: "button" },
|
|
106
|
+
checked,
|
|
107
|
+
...checkboxProps,
|
|
108
|
+
...isActive && activeStyle ? activeStyle : void 0,
|
|
106
109
|
active: isActive,
|
|
107
110
|
disabled,
|
|
108
|
-
children:
|
|
109
|
-
|
|
110
|
-
ref: checkboxRef,
|
|
111
|
-
theme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,
|
|
112
|
-
...import_core.isWeb && { type: "button" },
|
|
113
|
-
checked,
|
|
114
|
-
disabled,
|
|
115
|
-
...checkboxProps,
|
|
116
|
-
...props,
|
|
117
|
-
...isActive && activeStyle ? activeStyle : void 0,
|
|
118
|
-
children: propsActive.children
|
|
119
|
-
}), bubbleInput]
|
|
120
|
-
})
|
|
111
|
+
children: props.children
|
|
112
|
+
}), bubbleInput]
|
|
121
113
|
});
|
|
122
114
|
});
|
|
123
115
|
var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame, function(props, forwardedRef) {
|
|
@@ -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}, { accept: { activeStyle: \"style\" } });\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}, { accept: { activeStyle: \"style\" } });\nvar CheckboxContext = /* @__PURE__ */ import_react.default.createContext({\n\tchecked: false,\n\tdisabled: false\n});\nvar CheckboxComponent = (0, import_core.createStyledHOC)(CheckboxFrame, function Checkbox(_props, forwardedRef) {\n\tvar { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _props;\n\tvar propsActive = (0, import_core.useProps)(props);\n\tvar styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext.context);\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)(\n\t\t// @ts-ignore\n\t\tpropsActive,\n\t\t[checked, setChecked],\n\t\tforwardedRef\n\t);\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\tvar _propsActive_size, _ref;\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_CheckboxStyledContext.CheckboxStyledContext.Provider, {\n\t\t\tsize: (_ref = (_propsActive_size = propsActive.size) !== null && _propsActive_size !== void 0 ? _propsActive_size : styledContext === null || styledContext === void 0 ? void 0 : styledContext.size) !== null && _ref !== void 0 ? _ref : true,\n\t\t\tactive: isActive,\n\t\t\tdisabled,\n\t\t\tchildren: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {\n\t\t\t\trender: \"button\",\n\t\t\t\tref: checkboxRef,\n\t\t\t\ttheme: activeTheme !== null && activeTheme !== void 0 ? activeTheme : null,\n\t\t\t\t...import_core.isWeb && { type: \"button\" },\n\t\t\t\tchecked,\n\t\t\t\tdisabled,\n\t\t\t\t...checkboxProps,\n\t\t\t\t...props,\n\t\t\t\t...isActive && activeStyle ? activeStyle : void 0,\n\t\t\t\tchildren: propsActive.children\n\t\t\t}), bubbleInput]\n\t\t})\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\t...active && activeStyle ? activeStyle : void 0,\n\t\tref: forwardedRef,\n\t\tchildren\n\t});\n\treturn null;\n});\nvar Checkbox2 = (0, import_core.withStaticProperties)(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,GAAG,YAAY,cAAc,cAAc,KAAK;IAChD,UAAU,YAAY;GACvB,CAAC,GAAG,WAAW;EAChB,CAAC;CACF,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,GAAG,UAAU,cAAc,cAAc,KAAK;EAC9C,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC;AACD,IAAI,aAAa,GAAG,YAAY,qBAAoB,CAAE,mBAAmB,EAAE,WAAW,kBAAkB,CAAC"}
|
|
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}, { accept: { activeStyle: \"style\" } });\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}, { accept: { activeStyle: \"style\" } });\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\t...isActive && activeStyle ? activeStyle : void 0,\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\t...active && activeStyle ? activeStyle : void 0,\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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AAU;EAC7E,OAAO;EACP,UAAU,CAAiB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,eAAe;GACrE,QAAQ;GACR,KAAK;GACL,OAAO,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,cAAc;GACtE,GAAG,YAAY,SAAS,EAAE,MAAM,SAAS;GACzC;GACA,GAAG;GACH,GAAG,YAAY,cAAc,cAAc,KAAK;GAChD,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,GAAG,UAAU,cAAc,cAAc,KAAK;EAC9C,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR,CAAC;AACD,IAAI,aAAa,GAAG,YAAY,qBAAoB,CAAE,mBAAmB,EAAE,WAAW,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/checkbox",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.831.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.831.1",
|
|
39
|
+
"@tamagui/core": "3.0.0-beta.831.1",
|
|
40
|
+
"@tamagui/focusable": "3.0.0-beta.831.1",
|
|
41
|
+
"@tamagui/use-controllable-state": "3.0.0-beta.831.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@tamagui/build": "3.0.0-beta.
|
|
44
|
+
"@tamagui/build": "3.0.0-beta.831.1",
|
|
45
45
|
"react": "19.2.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
package/src/Checkbox.tsx
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
isWeb,
|
|
13
13
|
shouldRenderNativePlatform,
|
|
14
14
|
styled,
|
|
15
|
-
useProps,
|
|
16
15
|
View,
|
|
17
16
|
withStaticProperties,
|
|
18
17
|
} from '@tamagui/core'
|
|
@@ -109,7 +108,7 @@ export const CheckboxContext = React.createContext<{
|
|
|
109
108
|
|
|
110
109
|
const CheckboxComponent = createStyledHOC(
|
|
111
110
|
CheckboxFrame,
|
|
112
|
-
function Checkbox(
|
|
111
|
+
function Checkbox(propsIn: CheckboxProps, forwardedRef) {
|
|
113
112
|
const {
|
|
114
113
|
checked: checkedProp,
|
|
115
114
|
defaultChecked,
|
|
@@ -118,10 +117,8 @@ const CheckboxComponent = createStyledHOC(
|
|
|
118
117
|
activeStyle,
|
|
119
118
|
activeTheme,
|
|
120
119
|
...props
|
|
121
|
-
} =
|
|
122
|
-
const propsActive = useProps(props)
|
|
120
|
+
} = propsIn
|
|
123
121
|
|
|
124
|
-
const styledContext = React.useContext(CheckboxStyledContext.context)
|
|
125
122
|
const [checked = false, setChecked] = useControllableState({
|
|
126
123
|
prop: checkedProp,
|
|
127
124
|
defaultProp: defaultChecked!,
|
|
@@ -129,8 +126,7 @@ const CheckboxComponent = createStyledHOC(
|
|
|
129
126
|
})
|
|
130
127
|
|
|
131
128
|
const { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(
|
|
132
|
-
|
|
133
|
-
propsActive,
|
|
129
|
+
props,
|
|
134
130
|
[checked, setChecked],
|
|
135
131
|
forwardedRef
|
|
136
132
|
)
|
|
@@ -176,26 +172,20 @@ const CheckboxComponent = createStyledHOC(
|
|
|
176
172
|
|
|
177
173
|
return (
|
|
178
174
|
<CheckboxContext.Provider value={memoizedContext}>
|
|
179
|
-
<
|
|
180
|
-
|
|
175
|
+
<CheckboxFrame
|
|
176
|
+
render="button"
|
|
177
|
+
ref={checkboxRef}
|
|
178
|
+
theme={activeTheme ?? null}
|
|
179
|
+
{...(isWeb && { type: 'button' })}
|
|
180
|
+
checked={checked}
|
|
181
|
+
{...(checkboxProps as CheckboxProps)}
|
|
182
|
+
{...(isActive && activeStyle ? (activeStyle as object) : undefined)}
|
|
181
183
|
active={isActive}
|
|
182
184
|
disabled={disabled}
|
|
183
185
|
>
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
theme={activeTheme ?? null}
|
|
188
|
-
{...(isWeb && { type: 'button' })}
|
|
189
|
-
checked={checked}
|
|
190
|
-
disabled={disabled}
|
|
191
|
-
{...(checkboxProps as CheckboxProps)}
|
|
192
|
-
{...props}
|
|
193
|
-
{...(isActive && activeStyle ? (activeStyle as object) : undefined)}
|
|
194
|
-
>
|
|
195
|
-
{propsActive.children}
|
|
196
|
-
</CheckboxFrame>
|
|
197
|
-
{bubbleInput}
|
|
198
|
-
</CheckboxStyledContext.Provider>
|
|
186
|
+
{props.children}
|
|
187
|
+
</CheckboxFrame>
|
|
188
|
+
{bubbleInput}
|
|
199
189
|
</CheckboxContext.Provider>
|
|
200
190
|
)
|
|
201
191
|
}
|
package/types/Checkbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../src/Checkbox.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,IAAI,0BAA0B,EACjD,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../src/Checkbox.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,IAAI,0BAA0B,EACjD,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAWtE,OAAO,KAAkB,MAAM,OAAO,CAAA;AAMtC,eAAO,MAAM,sBAAsB;;;;;;;qBAS7B,WAAW,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAApB,WAAW,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;CAGzB,CAAA;AAID,eAAO,MAAM,aAAa;;;;;;;qBAoBpB,WAAW,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAApB,WAAW,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;CAGzB,CAAA;AAED,KAAK,6BAA6B,GAAG;IACnC,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,KAAK,kBAAkB,GAAG,0BAA0B,GAAG;IACrD,MAAM,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;CAC5B,CAAA;AAED,KAAK,6BAA6B,GAAG;IACnC,WAAW,CAAC,EAAE,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAA;IAC5C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,KAA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