@tamagui/checkbox 1.88.18 → 1.88.20

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.
Files changed (31) hide show
  1. package/package.json +15 -15
  2. package/dist/cjs/CheckboxStyledContext.js +0 -25
  3. package/dist/cjs/CheckboxStyledContext.js.map +0 -6
  4. package/dist/cjs/CheckboxStyledContext.native.js +0 -30
  5. package/dist/cjs/CheckboxStyledContext.native.js.map +0 -6
  6. package/dist/cjs/createCheckbox.js +0 -149
  7. package/dist/cjs/createCheckbox.js.map +0 -6
  8. package/dist/cjs/createCheckbox.native.js +0 -155
  9. package/dist/cjs/createCheckbox.native.js.map +0 -6
  10. package/dist/esm/CheckboxStyledContext.js +0 -9
  11. package/dist/esm/CheckboxStyledContext.js.map +0 -6
  12. package/dist/esm/CheckboxStyledContext.mjs +0 -6
  13. package/dist/esm/CheckboxStyledContext.native.js +0 -30
  14. package/dist/esm/CheckboxStyledContext.native.js.map +0 -6
  15. package/dist/esm/createCheckbox.js +0 -140
  16. package/dist/esm/createCheckbox.js.map +0 -6
  17. package/dist/esm/createCheckbox.mjs +0 -127
  18. package/dist/esm/createCheckbox.native.js +0 -155
  19. package/dist/esm/createCheckbox.native.js.map +0 -6
  20. package/dist/jsx/CheckboxStyledContext.js +0 -9
  21. package/dist/jsx/CheckboxStyledContext.js.map +0 -6
  22. package/dist/jsx/CheckboxStyledContext.mjs +0 -6
  23. package/dist/jsx/CheckboxStyledContext.native.js +0 -30
  24. package/dist/jsx/CheckboxStyledContext.native.js.map +0 -6
  25. package/dist/jsx/createCheckbox.js +0 -140
  26. package/dist/jsx/createCheckbox.js.map +0 -6
  27. package/dist/jsx/createCheckbox.mjs +0 -127
  28. package/dist/jsx/createCheckbox.native.js +0 -155
  29. package/dist/jsx/createCheckbox.native.js.map +0 -6
  30. package/types/CheckboxStyledContext.d.ts.map +0 -1
  31. package/types/createCheckbox.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/checkbox",
3
- "version": "1.88.18",
3
+ "version": "1.88.20",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -24,19 +24,19 @@
24
24
  "clean:build": "tamagui-build clean:build"
25
25
  },
26
26
  "dependencies": {
27
- "@tamagui/compose-refs": "1.88.18",
28
- "@tamagui/constants": "1.88.18",
29
- "@tamagui/core": "1.88.18",
30
- "@tamagui/create-context": "1.88.18",
31
- "@tamagui/focusable": "1.88.18",
32
- "@tamagui/font-size": "1.88.18",
33
- "@tamagui/get-token": "1.88.18",
34
- "@tamagui/helpers": "1.88.18",
35
- "@tamagui/helpers-tamagui": "1.88.18",
36
- "@tamagui/label": "1.88.18",
37
- "@tamagui/stacks": "1.88.18",
38
- "@tamagui/use-controllable-state": "1.88.18",
39
- "@tamagui/use-previous": "1.88.18"
27
+ "@tamagui/compose-refs": "1.88.20",
28
+ "@tamagui/constants": "1.88.20",
29
+ "@tamagui/core": "1.88.20",
30
+ "@tamagui/create-context": "1.88.20",
31
+ "@tamagui/focusable": "1.88.20",
32
+ "@tamagui/font-size": "1.88.20",
33
+ "@tamagui/get-token": "1.88.20",
34
+ "@tamagui/helpers": "1.88.20",
35
+ "@tamagui/helpers-tamagui": "1.88.20",
36
+ "@tamagui/label": "1.88.20",
37
+ "@tamagui/stacks": "1.88.20",
38
+ "@tamagui/use-controllable-state": "1.88.20",
39
+ "@tamagui/use-previous": "1.88.20"
40
40
  },
41
41
  "exports": {
42
42
  "./package.json": "./package.json",
@@ -51,7 +51,7 @@
51
51
  "react": "*"
52
52
  },
53
53
  "devDependencies": {
54
- "@tamagui/build": "1.88.18",
54
+ "@tamagui/build": "1.88.20",
55
55
  "react": "^18.2.0"
56
56
  },
57
57
  "publishConfig": {
@@ -1,25 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var CheckboxStyledContext_exports = {};
16
- __export(CheckboxStyledContext_exports, {
17
- CheckboxStyledContext: () => CheckboxStyledContext
18
- });
19
- module.exports = __toCommonJS(CheckboxStyledContext_exports);
20
- var import_core = require("@tamagui/core");
21
- const CheckboxStyledContext = (0, import_core.createStyledContext)({
22
- size: "$true",
23
- scaleIcon: 1
24
- });
25
- //# sourceMappingURL=CheckboxStyledContext.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/CheckboxStyledContext.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAoC;AAE7B,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
5
- "names": []
6
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
- var CheckboxStyledContext_exports = {};
17
- __export(CheckboxStyledContext_exports, {
18
- CheckboxStyledContext: () => CheckboxStyledContext
19
- });
20
- module.exports = __toCommonJS(CheckboxStyledContext_exports);
21
- var import_core = require("@tamagui/core");
22
- const CheckboxStyledContext = (0, import_core.createStyledContext)({
23
- size: "$true",
24
- scaleIcon: 1
25
- });
26
- // Annotate the CommonJS export names for ESM import in node:
27
- 0 && (module.exports = {
28
- CheckboxStyledContext
29
- });
30
- //# sourceMappingURL=CheckboxStyledContext.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/CheckboxStyledContext.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAoC;AAE7B,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
5
- "names": []
6
- }
@@ -1,149 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var createCheckbox_exports = {};
24
- __export(createCheckbox_exports, {
25
- CheckboxContext: () => CheckboxContext,
26
- createCheckbox: () => createCheckbox
27
- });
28
- module.exports = __toCommonJS(createCheckbox_exports);
29
- var import_checkbox_headless = require("@tamagui/checkbox-headless"), import_core = require("@tamagui/core"), import_font_size = require("@tamagui/font-size"), import_get_token = require("@tamagui/get-token"), import_helpers_tamagui = require("@tamagui/helpers-tamagui"), import_use_controllable_state = require("@tamagui/use-controllable-state"), import_react = __toESM(require("react")), import_Checkbox = require("./Checkbox"), import_CheckboxStyledContext = require("./CheckboxStyledContext"), import_jsx_runtime = require("react/jsx-runtime");
30
- const CheckboxContext = import_react.default.createContext({
31
- checked: !1,
32
- disabled: !1
33
- }), ensureContext = (x) => {
34
- x.context || (x.context = CheckboxContext);
35
- };
36
- function createCheckbox(createProps) {
37
- const {
38
- disableActiveTheme,
39
- Frame = import_Checkbox.CheckboxFrame,
40
- Indicator = import_Checkbox.CheckboxIndicatorFrame
41
- } = createProps;
42
- ensureContext(Frame), ensureContext(Indicator);
43
- const FrameComponent = Frame.styleable(
44
- function(_props, forwardedRef) {
45
- const {
46
- scaleSize = 0.45,
47
- sizeAdjust = 0,
48
- scaleIcon,
49
- checked: checkedProp,
50
- defaultChecked,
51
- onCheckedChange,
52
- native,
53
- unstyled = !1,
54
- ...props
55
- } = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
56
- let adjustedSize = 0, size = 0;
57
- unstyled || (adjustedSize = (0, import_core.getVariableValue)(
58
- (0, import_get_token.getSize)(propsActive.size ?? styledContext?.size ?? "$true", {
59
- shift: sizeAdjust
60
- })
61
- ), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
62
- const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
63
- prop: checkedProp,
64
- defaultProp: defaultChecked,
65
- onChange: onCheckedChange
66
- }), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
67
- // @ts-ignore
68
- propsActive,
69
- [checked, setChecked],
70
- forwardedRef
71
- );
72
- return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
- "input",
74
- {
75
- type: "checkbox",
76
- defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
77
- tabIndex: -1,
78
- ref: checkboxRef,
79
- disabled: checkboxProps.disabled,
80
- style: {
81
- appearance: "auto",
82
- accentColor: "var(--color6)",
83
- ...checkboxProps.style
84
- // TODO: any
85
- }
86
- }
87
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
88
- CheckboxContext.Provider,
89
- {
90
- value: {
91
- checked,
92
- disabled: checkboxProps.disabled
93
- },
94
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
95
- import_CheckboxStyledContext.CheckboxStyledContext.Provider,
96
- {
97
- size: propsActive.size ?? styledContext?.size ?? "$true",
98
- scaleIcon: scaleIcon ?? styledContext?.scaleIcon ?? 1,
99
- children: [
100
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
- Frame,
102
- {
103
- ...!unstyled && {
104
- width: size,
105
- height: size
106
- },
107
- tag: "button",
108
- ref: checkboxRef,
109
- ...unstyled === !1 && {
110
- size,
111
- theme: checked ? "active" : null
112
- },
113
- checked,
114
- disabled: checkboxProps.disabled,
115
- ...checkboxProps,
116
- children: propsActive.children
117
- }
118
- ),
119
- bubbleInput
120
- ]
121
- }
122
- )
123
- }
124
- );
125
- }
126
- ), IndicatorComponent = Indicator.styleable(
127
- (props, forwardedRef) => {
128
- const {
129
- // __scopeCheckbox,
130
- children: childrenProp,
131
- forceMount,
132
- disablePassStyles,
133
- unstyled = !1,
134
- ...indicatorProps
135
- } = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
136
- let children = childrenProp;
137
- if (!unstyled) {
138
- const iconSize = (typeof styledContext.size == "number" ? styledContext.size * 0.65 : (0, import_font_size.getFontSize)(styledContext.size)) * styledContext.scaleIcon, theme = (0, import_core.useTheme)(), getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color: theme.color });
139
- children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
140
- }
141
- const context = (0, import_react.useContext)(CheckboxContext);
142
- return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children }) : null;
143
- }
144
- );
145
- return (0, import_core.withStaticProperties)(FrameComponent, {
146
- Indicator: IndicatorComponent
147
- });
148
- }
149
- //# sourceMappingURL=createCheckbox.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/createCheckbox.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,+BAA6C,uCAE7C,cAMO,0BACP,mBAA4B,+BAC5B,mBAAwB,+BACxB,yBAAiC,qCACjC,gCAAqC,4CACrC,eAAkC,2BAElC,kBAAsD,uBACtD,+BAAsC,oCAkH5B;AA3EH,MAAM,kBAAkB,aAAAA,QAAM,cAGlC;AAAA,EACD,SAAS;AAAA,EACT,UAAU;AACZ,CAAC,GAEK,gBAAgB,CAAC,MAAW;AAChC,EAAK,EAAE,YACL,EAAE,UAAU;AAEhB;AAEO,SAAS,eAGd,aAAyE;AACzE,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ;AAAA,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ACT;AAAA,EACF;AAEA,aAAO,kCAAqB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,EACb,CAAC;AACH;",
5
- "names": ["React"]
6
- }
@@ -1,155 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
24
- var createCheckbox_exports = {};
25
- __export(createCheckbox_exports, {
26
- CheckboxContext: () => CheckboxContext,
27
- createCheckbox: () => createCheckbox
28
- });
29
- module.exports = __toCommonJS(createCheckbox_exports);
30
- var import_checkbox_headless = require("@tamagui/checkbox-headless"), import_core = require("@tamagui/core"), import_font_size = require("@tamagui/font-size"), import_get_token = require("@tamagui/get-token"), import_helpers_tamagui = require("@tamagui/helpers-tamagui"), import_use_controllable_state = require("@tamagui/use-controllable-state"), import_react = __toESM(require("react")), import_Checkbox = require("./Checkbox"), import_CheckboxStyledContext = require("./CheckboxStyledContext"), import_jsx_runtime = require("react/jsx-runtime");
31
- const CheckboxContext = import_react.default.createContext({
32
- checked: !1,
33
- disabled: !1
34
- }), ensureContext = (x) => {
35
- x.context || (x.context = CheckboxContext);
36
- };
37
- function createCheckbox(createProps) {
38
- const {
39
- disableActiveTheme,
40
- Frame = import_Checkbox.CheckboxFrame,
41
- Indicator = import_Checkbox.CheckboxIndicatorFrame
42
- } = createProps;
43
- ensureContext(Frame), ensureContext(Indicator);
44
- const FrameComponent = Frame.styleable(
45
- function(_props, forwardedRef) {
46
- const {
47
- scaleSize = 0.45,
48
- sizeAdjust = 0,
49
- scaleIcon,
50
- checked: checkedProp,
51
- defaultChecked,
52
- onCheckedChange,
53
- native,
54
- unstyled = !1,
55
- ...props
56
- } = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
57
- let adjustedSize = 0, size = 0;
58
- unstyled || (adjustedSize = (0, import_core.getVariableValue)(
59
- (0, import_get_token.getSize)(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
60
- shift: sizeAdjust
61
- })
62
- ), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
63
- const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
64
- prop: checkedProp,
65
- defaultProp: defaultChecked,
66
- onChange: onCheckedChange
67
- }), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
68
- // @ts-ignore
69
- propsActive,
70
- [checked, setChecked],
71
- forwardedRef
72
- );
73
- return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
- "input",
75
- {
76
- type: "checkbox",
77
- defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
78
- tabIndex: -1,
79
- ref: checkboxRef,
80
- disabled: checkboxProps.disabled,
81
- style: {
82
- appearance: "auto",
83
- accentColor: "var(--color6)",
84
- ...checkboxProps.style
85
- // TODO: any
86
- }
87
- }
88
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
- CheckboxContext.Provider,
90
- {
91
- value: {
92
- checked,
93
- disabled: checkboxProps.disabled
94
- },
95
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
96
- import_CheckboxStyledContext.CheckboxStyledContext.Provider,
97
- {
98
- size: propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true",
99
- scaleIcon: scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon) ?? 1,
100
- children: [
101
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
- Frame,
103
- {
104
- ...!unstyled && {
105
- width: size,
106
- height: size
107
- },
108
- tag: "button",
109
- ref: checkboxRef,
110
- ...unstyled === !1 && {
111
- size,
112
- theme: checked ? "active" : null
113
- },
114
- checked,
115
- disabled: checkboxProps.disabled,
116
- ...checkboxProps,
117
- children: propsActive.children
118
- }
119
- ),
120
- bubbleInput
121
- ]
122
- }
123
- )
124
- }
125
- );
126
- }
127
- ), IndicatorComponent = Indicator.styleable(
128
- (props, forwardedRef) => {
129
- const {
130
- // __scopeCheckbox,
131
- children: childrenProp,
132
- forceMount,
133
- disablePassStyles,
134
- unstyled = !1,
135
- ...indicatorProps
136
- } = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
137
- let children = childrenProp;
138
- if (!unstyled) {
139
- const iconSize = (typeof styledContext.size == "number" ? styledContext.size * 0.65 : (0, import_font_size.getFontSize)(styledContext.size)) * styledContext.scaleIcon, theme = (0, import_core.useTheme)(), getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color: theme.color });
140
- children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
141
- }
142
- const context = (0, import_react.useContext)(CheckboxContext);
143
- return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children }) : null;
144
- }
145
- );
146
- return (0, import_core.withStaticProperties)(FrameComponent, {
147
- Indicator: IndicatorComponent
148
- });
149
- }
150
- // Annotate the CommonJS export names for ESM import in node:
151
- 0 && (module.exports = {
152
- CheckboxContext,
153
- createCheckbox
154
- });
155
- //# sourceMappingURL=createCheckbox.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/createCheckbox.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,+BAA6C,uCAE7C,cAMO,0BACP,mBAA4B,+BAC5B,mBAAwB,+BACxB,yBAAiC,qCACjC,gCAAqC,4CACrC,eAAkC,2BAElC,kBAAsD,uBACtD,+BAAsC,oCAkH5B;AA3EH,MAAM,kBAAkB,aAAAA,QAAM,cAGlC;AAAA,EACD,SAAS;AAAA,EACT,UAAU;AACZ,CAAC,GAEK,gBAAgB,CAAC,MAAW;AAChC,EAAK,EAAE,YACL,EAAE,UAAU;AAEhB;AAEO,SAAS,eAGd,aAAyE;AACzE,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ;AAAA,IACR,YAAY;AAAA,EACd,IAAI;AAMJ,gBAAc,KAAK,GACnB,cAAc,SAAS;AAEvB,QAAM,iBAAiB,MAAM;AAAA,IAC3B,SAAkB,QAAQ,cAAc;AACtC,YAAM;AAAA,QACJ,YAAY;AAAA,QACZ,aAAa;AAAA,QACb;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX,GAAG;AAAA,MACL,IAAI,QACE,kBAAc,sBAAS,KAAK,GAG5B,gBAAgB,aAAAA,QAAM,WAAW,kDAAqB;AAC5D,UAAI,eAAe,GACf,OAAO;AACX,MAAK,aACH,mBAAe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gBACf;AAAA,gBACC;AAAA;AAAA;AAAA,UACH;AAAA;AAAA,MACF;AAAA,IAEJ;AAAA,EACF,GAEM,qBAAqB,UAAU;AAAA,IACnC,CAAC,OAAO,iBAAiB;AACvB,YAAM;AAAA;AAAA,QAEJ,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX,GAAG;AAAA,MACL,IAAI,OACE,gBAAgB,aAAAA,QAAM,WAAW,kDAAqB;AAC5D,UAAI,WAAW;AAEf,UAAI,CAAC,UAAU;AACb,cAAM,YACH,OAAO,cAAc,QAAS,WAC3B,cAAc,OAAO,WACrB,8BAAY,cAAc,IAAW,KAAK,cAAc,WACxD,YAAQ,sBAAS,GACjB,oBAAgB,yCAAiB,EAAE,MAAM,UAAU,OAAO,MAAM,MAAM,CAAC;AAG7E,mBADkB,aAAAA,QAAM,SAAS,QAAQ,YAAY,EAChC,IAAI,CAAC,UACpB,qBAAqB,CAAC,aAAAA,QAAM,eAAe,KAAK,IAC3C,QAEF,cAAc,KAAK,CAC3B;AAAA,MACH;AAEA,YAAM,cAAU,yBAAW,eAAe;AAC1C,aAAI,kBAAc,0CAAgB,QAAQ,OAAO,KAAK,QAAQ,YAAY,KAEtE,4CAAC,aAAU,eAAc,QAAQ,GAAG,gBAAgB,KAAK,cACtD,UACH,IAGG;AAAA,IACT;AAAA,EACF;AAEA,aAAO,kCAAqB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,EACb,CAAC;AACH;",
5
- "names": ["React"]
6
- }
@@ -1,9 +0,0 @@
1
- import { createStyledContext } from "@tamagui/core";
2
- const CheckboxStyledContext = createStyledContext({
3
- size: "$true",
4
- scaleIcon: 1
5
- });
6
- export {
7
- CheckboxStyledContext
8
- };
9
- //# sourceMappingURL=CheckboxStyledContext.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/CheckboxStyledContext.tsx"],
4
- "mappings": "AACA,SAAS,2BAA2B;AAE7B,MAAM,wBAAwB,oBAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
5
- "names": []
6
- }
@@ -1,6 +0,0 @@
1
- import { createStyledContext } from "@tamagui/core";
2
- const CheckboxStyledContext = createStyledContext({
3
- size: "$true",
4
- scaleIcon: 1
5
- });
6
- export { CheckboxStyledContext };
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
- var CheckboxStyledContext_exports = {};
17
- __export(CheckboxStyledContext_exports, {
18
- CheckboxStyledContext: () => CheckboxStyledContext
19
- });
20
- module.exports = __toCommonJS(CheckboxStyledContext_exports);
21
- var import_core = require("@tamagui/core");
22
- const CheckboxStyledContext = (0, import_core.createStyledContext)({
23
- size: "$true",
24
- scaleIcon: 1
25
- });
26
- // Annotate the CommonJS export names for ESM import in node:
27
- 0 && (module.exports = {
28
- CheckboxStyledContext
29
- });
30
- //# sourceMappingURL=CheckboxStyledContext.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/CheckboxStyledContext.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAoC;AAE7B,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
5
- "names": []
6
- }
@@ -1,140 +0,0 @@
1
- import { isIndeterminate, useCheckbox } from "@tamagui/checkbox-headless";
2
- import {
3
- getVariableValue,
4
- shouldRenderNativePlatform,
5
- useProps,
6
- useTheme,
7
- withStaticProperties
8
- } from "@tamagui/core";
9
- import { getFontSize } from "@tamagui/font-size";
10
- import { getSize } from "@tamagui/get-token";
11
- import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
12
- import { useControllableState } from "@tamagui/use-controllable-state";
13
- import React, { useContext } from "react";
14
- import { CheckboxFrame, CheckboxIndicatorFrame } from "./Checkbox";
15
- import { CheckboxStyledContext } from "./CheckboxStyledContext";
16
- import { jsx, jsxs } from "react/jsx-runtime";
17
- const CheckboxContext = React.createContext({
18
- checked: !1,
19
- disabled: !1
20
- }), ensureContext = (x) => {
21
- x.context || (x.context = CheckboxContext);
22
- };
23
- function createCheckbox(createProps) {
24
- const {
25
- disableActiveTheme,
26
- Frame = CheckboxFrame,
27
- Indicator = CheckboxIndicatorFrame
28
- } = createProps;
29
- ensureContext(Frame), ensureContext(Indicator);
30
- const FrameComponent = Frame.styleable(
31
- function(_props, forwardedRef) {
32
- const {
33
- scaleSize = 0.45,
34
- sizeAdjust = 0,
35
- scaleIcon,
36
- checked: checkedProp,
37
- defaultChecked,
38
- onCheckedChange,
39
- native,
40
- unstyled = !1,
41
- ...props
42
- } = _props, propsActive = useProps(props), styledContext = React.useContext(CheckboxStyledContext);
43
- let adjustedSize = 0, size = 0;
44
- unstyled || (adjustedSize = getVariableValue(
45
- getSize(propsActive.size ?? styledContext?.size ?? "$true", {
46
- shift: sizeAdjust
47
- })
48
- ), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
49
- const [checked = !1, setChecked] = useControllableState({
50
- prop: checkedProp,
51
- defaultProp: defaultChecked,
52
- onChange: onCheckedChange
53
- }), { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(
54
- // @ts-ignore
55
- propsActive,
56
- [checked, setChecked],
57
- forwardedRef
58
- );
59
- return shouldRenderNativePlatform(native) === "web" ? /* @__PURE__ */ jsx(
60
- "input",
61
- {
62
- type: "checkbox",
63
- defaultChecked: isIndeterminate(checked) ? !1 : checked,
64
- tabIndex: -1,
65
- ref: checkboxRef,
66
- disabled: checkboxProps.disabled,
67
- style: {
68
- appearance: "auto",
69
- accentColor: "var(--color6)",
70
- ...checkboxProps.style
71
- // TODO: any
72
- }
73
- }
74
- ) : /* @__PURE__ */ jsx(
75
- CheckboxContext.Provider,
76
- {
77
- value: {
78
- checked,
79
- disabled: checkboxProps.disabled
80
- },
81
- children: /* @__PURE__ */ jsxs(
82
- CheckboxStyledContext.Provider,
83
- {
84
- size: propsActive.size ?? styledContext?.size ?? "$true",
85
- scaleIcon: scaleIcon ?? styledContext?.scaleIcon ?? 1,
86
- children: [
87
- /* @__PURE__ */ jsx(
88
- Frame,
89
- {
90
- ...!unstyled && {
91
- width: size,
92
- height: size
93
- },
94
- tag: "button",
95
- ref: checkboxRef,
96
- ...unstyled === !1 && {
97
- size,
98
- theme: checked ? "active" : null
99
- },
100
- checked,
101
- disabled: checkboxProps.disabled,
102
- ...checkboxProps,
103
- children: propsActive.children
104
- }
105
- ),
106
- bubbleInput
107
- ]
108
- }
109
- )
110
- }
111
- );
112
- }
113
- ), IndicatorComponent = Indicator.styleable(
114
- (props, forwardedRef) => {
115
- const {
116
- // __scopeCheckbox,
117
- children: childrenProp,
118
- forceMount,
119
- disablePassStyles,
120
- unstyled = !1,
121
- ...indicatorProps
122
- } = props, styledContext = React.useContext(CheckboxStyledContext);
123
- let children = childrenProp;
124
- if (!unstyled) {
125
- const iconSize = (typeof styledContext.size == "number" ? styledContext.size * 0.65 : getFontSize(styledContext.size)) * styledContext.scaleIcon, theme = useTheme(), getThemedIcon = useGetThemedIcon({ size: iconSize, color: theme.color });
126
- children = React.Children.toArray(childrenProp).map((child) => disablePassStyles || !React.isValidElement(child) ? child : getThemedIcon(child));
127
- }
128
- const context = useContext(CheckboxContext);
129
- return forceMount || isIndeterminate(context.checked) || context.checked === !0 ? /* @__PURE__ */ jsx(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children }) : null;
130
- }
131
- );
132
- return withStaticProperties(FrameComponent, {
133
- Indicator: IndicatorComponent
134
- });
135
- }
136
- export {
137
- CheckboxContext,
138
- createCheckbox
139
- };
140
- //# sourceMappingURL=createCheckbox.js.map