@tamagui/checkbox 3.0.0-beta.807.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.
@@ -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
- }, { accept: { activeStyle: "style" } });
45
+ });
46
46
  const CheckboxFrame = (0, import_core.styled)(import_core.View, {
47
47
  displayName: "Checkbox",
48
48
  render: "button",
@@ -53,21 +53,19 @@ const CheckboxFrame = (0, import_core.styled)(import_core.View, {
53
53
  pointerEvents: "none",
54
54
  userSelect: "none"
55
55
  } } }
56
- }, { accept: { activeStyle: "style" } });
56
+ });
57
57
  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(_props, forwardedRef) {
62
- const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _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)(propsActive, [checked, setChecked], forwardedRef);
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.jsx)(CheckboxContext.Provider, {
83
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxContext.Provider, {
86
84
  value: memoizedContext,
87
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_CheckboxStyledContext.CheckboxStyledContext.Provider, {
88
- size: propsActive.size ?? styledContext?.size ?? true,
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
+ style: [checkboxProps.style, isActive && activeStyle],
89
93
  active: isActive,
90
94
  disabled,
91
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {
92
- render: "button",
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) => {
@@ -110,7 +103,7 @@ const CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFram
110
103
  if (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {
111
104
  pointerEvents: "none",
112
105
  ...indicatorProps,
113
- ...active && activeStyle ? activeStyle : void 0,
106
+ style: [indicatorProps.style, active && activeStyle],
114
107
  ref: forwardedRef,
115
108
  children
116
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
- }, { accept: { activeStyle: "style" } });
47
+ });
48
48
  var CheckboxFrame = (0, import_core.styled)(import_core.View, {
49
49
  displayName: "Checkbox",
50
50
  render: "button",
@@ -55,21 +55,19 @@ var CheckboxFrame = (0, import_core.styled)(import_core.View, {
55
55
  pointerEvents: "none",
56
56
  userSelect: "none"
57
57
  } } }
58
- }, { accept: { activeStyle: "style" } });
58
+ });
59
59
  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(_props, forwardedRef) {
64
- var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _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)(propsActive, [checked, setChecked], forwardedRef);
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
- var _propsActive_size, _ref;
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.jsxs)(import_CheckboxStyledContext.CheckboxStyledContext.Provider, {
105
- size: (_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,
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
+ style: [checkboxProps.style, isActive && activeStyle],
106
109
  active: isActive,
107
110
  disabled,
108
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {
109
- render: "button",
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) {
@@ -127,7 +119,7 @@ var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame,
127
119
  if (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {
128
120
  pointerEvents: "none",
129
121
  ...indicatorProps,
130
- ...active && activeStyle ? activeStyle : void 0,
122
+ style: [indicatorProps.style, active && activeStyle],
131
123
  ref: forwardedRef,
132
124
  children
133
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
- }, { accept: { activeStyle: "style" } });
47
+ });
48
48
  var CheckboxFrame = (0, import_core.styled)(import_core.View, {
49
49
  displayName: "Checkbox",
50
50
  render: "button",
@@ -55,21 +55,19 @@ var CheckboxFrame = (0, import_core.styled)(import_core.View, {
55
55
  pointerEvents: "none",
56
56
  userSelect: "none"
57
57
  } } }
58
- }, { accept: { activeStyle: "style" } });
58
+ });
59
59
  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(_props, forwardedRef) {
64
- var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _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)(propsActive, [checked, setChecked], forwardedRef);
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
- var _propsActive_size, _ref;
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.jsxs)(import_CheckboxStyledContext.CheckboxStyledContext.Provider, {
105
- size: (_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,
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
+ style: [checkboxProps.style, isActive && activeStyle],
106
109
  active: isActive,
107
110
  disabled,
108
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxFrame, {
109
- render: "button",
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) {
@@ -127,7 +119,7 @@ var CheckboxIndicator = (0, import_core.createStyledHOC)(CheckboxIndicatorFrame,
127
119
  if (forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxIndicatorFrame, {
128
120
  pointerEvents: "none",
129
121
  ...indicatorProps,
130
- ...active && activeStyle ? activeStyle : void 0,
122
+ style: [indicatorProps.style, active && activeStyle],
131
123
  ref: forwardedRef,
132
124
  children
133
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}, { 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,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC/B,KAAK,IAAI,QAAQ,KAAK,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AAU,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});\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,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,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CACpE,OAAO;CACP,YAAY;AACb,CAAC,IAAI,QACL,GACD;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE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AY,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"}
@@ -1,5 +1,5 @@
1
1
  import { isIndeterminate, useCheckbox } from "@tamagui/checkbox-headless";
2
- import { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, useProps, withStaticProperties } from "@tamagui/core";
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";
@@ -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
- }, { accept: { activeStyle: "style" } });
11
+ });
12
12
  const CheckboxFrame = styled(View, {
13
13
  displayName: "Checkbox",
14
14
  render: "button",
@@ -19,21 +19,19 @@ const CheckboxFrame = styled(View, {
19
19
  pointerEvents: "none",
20
20
  userSelect: "none"
21
21
  } } }
22
- }, { accept: { activeStyle: "style" } });
22
+ });
23
23
  const CheckboxContext = React.createContext({
24
24
  checked: false,
25
25
  disabled: false
26
26
  });
27
- const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(_props, forwardedRef) {
28
- const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _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(propsActive, [checked, setChecked], forwardedRef);
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__ */ jsx(CheckboxContext.Provider, {
49
+ return /* @__PURE__ */ jsxs(CheckboxContext.Provider, {
52
50
  value: memoizedContext,
53
- children: /* @__PURE__ */ jsxs(CheckboxStyledContext.Provider, {
54
- size: propsActive.size ?? styledContext?.size ?? true,
51
+ children: [/* @__PURE__ */ jsx(CheckboxFrame, {
52
+ render: "button",
53
+ ref: checkboxRef,
54
+ theme: activeTheme ?? null,
55
+ ...isWeb && { type: "button" },
56
+ checked,
57
+ ...checkboxProps,
58
+ style: [checkboxProps.style, isActive && activeStyle],
55
59
  active: isActive,
56
60
  disabled,
57
- children: [/* @__PURE__ */ jsx(CheckboxFrame, {
58
- render: "button",
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;
@@ -75,7 +68,7 @@ const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function C
75
68
  if (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {
76
69
  pointerEvents: "none",
77
70
  ...indicatorProps,
78
- ...active && activeStyle ? activeStyle : void 0,
71
+ style: [indicatorProps.style, active && activeStyle],
79
72
  ref: forwardedRef,
80
73
  children
81
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, useProps, 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(_props, forwardedRef) {\n\tconst { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _props;\n\tconst propsActive = useProps(props);\n\tconst styledContext = React.useContext(CheckboxStyledContext.context);\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(propsActive, [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__ */ jsx(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: /* @__PURE__ */ jsxs(CheckboxStyledContext.Provider, {\n\t\t\tsize: propsActive.size ?? styledContext?.size ?? true,\n\t\t\tactive: isActive,\n\t\t\tdisabled,\n\t\t\tchildren: [/* @__PURE__ */ jsx(CheckboxFrame, {\n\t\t\t\trender: \"button\",\n\t\t\t\tref: checkboxRef,\n\t\t\t\ttheme: activeTheme ?? null,\n\t\t\t\t...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}), { 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,QAAQ,cAAc;CAC7G,MAAM,EAAE,SAAS,aAAa,gBAAgB,iBAAiB,QAAQ,aAAa,aAAa,GAAG,UAAU;CAC9G,MAAM,cAAc,SAAS,KAAK;CAClC,MAAM,gBAAgB,MAAM,WAAW,sBAAsB,OAAO;CACpE,MAAM,CAAC,UAAU,OAAO,cAAc,qBAAqB;EAC1D,MAAM;EACN,aAAa;EACb,UAAU;CACX,CAAC;CACD,MAAM,EAAE,eAAe,aAAa,gBAAgB,YAAY,aAAa,CAAC,SAAS,UAAU,GAAG,YAAY;CAChH,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,oBAAI,gBAAgB,UAAU;EACpD,OAAO;EACP,UAA0B,qBAAK,sBAAsB,UAAU;GAC9D,MAAM,YAAY,QAAQ,eAAe,QAAQ;GACjD,QAAQ;GACR;GACA,UAAU,CAAiB,oBAAI,eAAe;IAC7C,QAAQ;IACR,KAAK;IACL,OAAO,eAAe;IACtB,GAAG,SAAS,EAAE,MAAM,SAAS;IAC7B;IACA;IACA,GAAG;IACH,GAAG;IACH,GAAG,YAAY,cAAc,cAAc,KAAK;IAChD,UAAU,YAAY;GACvB,CAAC,GAAG,WAAW;EAChB,CAAC;CACF,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
+ {"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"}
@@ -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, useProps, withStaticProperties } from "@tamagui/core";
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";
@@ -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
- }, { accept: { activeStyle: "style" } });
12
+ });
13
13
  var CheckboxFrame = styled(View, {
14
14
  displayName: "Checkbox",
15
15
  render: "button",
@@ -20,21 +20,19 @@ var CheckboxFrame = styled(View, {
20
20
  pointerEvents: "none",
21
21
  userSelect: "none"
22
22
  } } }
23
- }, { accept: { activeStyle: "style" } });
23
+ });
24
24
  var CheckboxContext = /* @__PURE__ */ React.createContext({
25
25
  checked: false,
26
26
  disabled: false
27
27
  });
28
- var Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(_props, forwardedRef) {
29
- var { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _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(propsActive, [checked, setChecked], forwardedRef);
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
- var _propsActive_size, _ref;
67
- return /* @__PURE__ */ jsx(CheckboxContext.Provider, {
64
+ return /* @__PURE__ */ jsxs(CheckboxContext.Provider, {
68
65
  value: memoizedContext,
69
- children: /* @__PURE__ */ jsxs(CheckboxStyledContext.Provider, {
70
- size: (_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,
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
+ style: [checkboxProps.style, isActive && activeStyle],
71
74
  active: isActive,
72
75
  disabled,
73
- children: [/* @__PURE__ */ jsx(CheckboxFrame, {
74
- render: "button",
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;
@@ -91,7 +83,7 @@ var Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Che
91
83
  if (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {
92
84
  pointerEvents: "none",
93
85
  ...indicatorProps,
94
- ...active && activeStyle ? activeStyle : void 0,
86
+ style: [indicatorProps.style, active && activeStyle],
95
87
  ref: forwardedRef,
96
88
  children
97
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, useProps, 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(_props, forwardedRef) {\n\tvar { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _props;\n\tvar propsActive = useProps(props);\n\tvar styledContext = React.useContext(CheckboxStyledContext.context);\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(propsActive, [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\tvar _propsActive_size, _ref;\n\treturn /* @__PURE__ */ jsx(CheckboxContext.Provider, {\n\t\tvalue: memoizedContext,\n\t\tchildren: /* @__PURE__ */ jsxs(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__ */ 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...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}), { 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,QAAQ,cAAc;CAC3G,IAAI,EAAE,SAAS,aAAa,gBAAgB,iBAAiB,QAAQ,aAAa,aAAa,GAAG,UAAU;CAC5G,IAAI,cAAc,SAAS,KAAK;CAChC,IAAI,gBAAgB,MAAM,WAAW,sBAAsB,OAAO;CAClE,IAAI,CAAC,UAAU,OAAO,cAAc,qBAAqB;EACxD,MAAM;EACN,aAAa;EACb,UAAU;CACX,CAAC;CACD,IAAI,EAAE,eAAe,aAAa,gBAAgB,YAAY,aAAa,CAAC,SAAS,UAAU,GAAG,YAAY;CAC9G,MAAM,UAAU,WAAW;EAC1B,IAAI,CAAC,MAAM,IAAI;EACf,IAAI,MAAM,UAAU;EACpB,OAAO,kBAAkB,MAAM,IAAI;GAClC,gBA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,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"}
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,MAAM;CACzC,aAAa;CACb,SAAS;AACV,CAAC;AACD,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,CAAC;AACD,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,aAAa,aAAa,GAAG,UAAU;CAC5G,IAAI,CAAC,UAAU,OAAO,cAAc,qBAAqB;EACxD,MAAM;EACN,aAAa;EACb,UAAU;CACX,CAAC;CACD,IAAI,EAAE,eAAe,aAAa,gBAAgB,YAAY,OAAO,CAAC,SAAS,UAAU,GAAG,YAAY;CACxG,MAAM,UAAU,WAAW;EAC1B,IAAI,CAAC,MAAM,IAAI;EACf,IAAI,MAAM,UAAU;EACpB,OAAO,kBAAkB,MAAM,IAAI;GAClC,gBAAgB,WAAW;IAC1B,eAAe,QAAQ,eAAe,KAAK,KAAK,WAAW,SAAS,OAAO;KAC1E,OAAO,CAAC;IACT,CAAC;GACF;GACA,OAAO,WAAW,CAAC;EACpB,CAAC;CACF,GAAG,CAAC,MAAM,IAAI,MAAM,QAAQ,CAAC;CAC7B,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,IAAI,kBAAkB,QAAQ,WAAW;EACxC,OAAO;GACN;GACA,UAAU,cAAc;EACzB;CACD,GAAG,CAAC,SAAS,cAAc,QAAQ,CAAC;CACpC,IAAI,WAAW,CAAC,CAAC;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"}
@@ -1,5 +1,5 @@
1
1
  import { isIndeterminate, useCheckbox } from "@tamagui/checkbox-headless";
2
- import { View, createStyledHOC, isWeb, shouldRenderNativePlatform, styled, useProps, withStaticProperties } from "@tamagui/core";
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";
@@ -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
- }, { accept: { activeStyle: "style" } });
11
+ });
12
12
  const CheckboxFrame = styled(View, {
13
13
  displayName: "Checkbox",
14
14
  render: "button",
@@ -19,21 +19,19 @@ const CheckboxFrame = styled(View, {
19
19
  pointerEvents: "none",
20
20
  userSelect: "none"
21
21
  } } }
22
- }, { accept: { activeStyle: "style" } });
22
+ });
23
23
  const CheckboxContext = React.createContext({
24
24
  checked: false,
25
25
  disabled: false
26
26
  });
27
- const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function Checkbox(_props, forwardedRef) {
28
- const { checked: checkedProp, defaultChecked, onCheckedChange, native, activeStyle, activeTheme, ...props } = _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(propsActive, [checked, setChecked], forwardedRef);
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__ */ jsx(CheckboxContext.Provider, {
49
+ return /* @__PURE__ */ jsxs(CheckboxContext.Provider, {
52
50
  value: memoizedContext,
53
- children: /* @__PURE__ */ jsxs(CheckboxStyledContext.Provider, {
54
- size: propsActive.size ?? styledContext?.size ?? true,
51
+ children: [/* @__PURE__ */ jsx(CheckboxFrame, {
52
+ render: "button",
53
+ ref: checkboxRef,
54
+ theme: activeTheme ?? null,
55
+ ...isWeb && { type: "button" },
56
+ checked,
57
+ ...checkboxProps,
58
+ style: [checkboxProps.style, isActive && activeStyle],
55
59
  active: isActive,
56
60
  disabled,
57
- children: [/* @__PURE__ */ jsx(CheckboxFrame, {
58
- render: "button",
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;
@@ -75,7 +68,7 @@ const Checkbox2 = withStaticProperties(createStyledHOC(CheckboxFrame, function C
75
68
  if (forceMount || isIndeterminate(context.checked) || context.checked === true) return /* @__PURE__ */ jsx(CheckboxIndicatorFrame, {
76
69
  pointerEvents: "none",
77
70
  ...indicatorProps,
78
- ...active && activeStyle ? activeStyle : void 0,
71
+ style: [indicatorProps.style, active && activeStyle],
79
72
  ref: forwardedRef,
80
73
  children
81
74
  });