@tamagui/checkbox 1.88.11 → 1.88.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/CheckboxStyledContext.js +25 -0
- package/dist/cjs/CheckboxStyledContext.js.map +6 -0
- package/dist/cjs/CheckboxStyledContext.native.js +30 -0
- package/dist/cjs/CheckboxStyledContext.native.js.map +6 -0
- package/dist/cjs/createCheckbox.js +146 -0
- package/dist/cjs/createCheckbox.js.map +6 -0
- package/dist/cjs/createCheckbox.native.js +152 -0
- package/dist/cjs/createCheckbox.native.js.map +6 -0
- package/dist/esm/CheckboxStyledContext.js +9 -0
- package/dist/esm/CheckboxStyledContext.js.map +6 -0
- package/dist/esm/CheckboxStyledContext.native.js +30 -0
- package/dist/esm/CheckboxStyledContext.native.js.map +6 -0
- package/dist/esm/createCheckbox.js +140 -0
- package/dist/esm/createCheckbox.js.map +6 -0
- package/dist/esm/createCheckbox.native.js +152 -0
- package/dist/esm/createCheckbox.native.js.map +6 -0
- package/dist/jsx/CheckboxStyledContext.js +9 -0
- package/dist/jsx/CheckboxStyledContext.js.map +6 -0
- package/dist/jsx/CheckboxStyledContext.native.js +30 -0
- package/dist/jsx/CheckboxStyledContext.native.js.map +6 -0
- package/dist/jsx/createCheckbox.js +140 -0
- package/dist/jsx/createCheckbox.js.map +6 -0
- package/dist/jsx/createCheckbox.native.js +152 -0
- package/dist/jsx/createCheckbox.native.js.map +6 -0
- package/package.json +15 -15
- package/types/CheckboxStyledContext.d.ts.map +1 -0
- package/types/createCheckbox.d.ts.map +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
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
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
|
@@ -0,0 +1,146 @@
|
|
|
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({
|
|
37
|
+
Frame = import_Checkbox.CheckboxFrame,
|
|
38
|
+
Indicator = import_Checkbox.CheckboxIndicatorFrame
|
|
39
|
+
}) {
|
|
40
|
+
ensureContext(Frame), ensureContext(Indicator);
|
|
41
|
+
const FrameComponent = Frame.styleable(function(_props, forwardedRef) {
|
|
42
|
+
const {
|
|
43
|
+
scaleSize = 0.45,
|
|
44
|
+
sizeAdjust = 0,
|
|
45
|
+
scaleIcon,
|
|
46
|
+
checked: checkedProp,
|
|
47
|
+
defaultChecked,
|
|
48
|
+
onCheckedChange,
|
|
49
|
+
native,
|
|
50
|
+
unstyled = !1,
|
|
51
|
+
...props
|
|
52
|
+
} = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
53
|
+
let adjustedSize = 0, size = 0;
|
|
54
|
+
unstyled || (adjustedSize = (0, import_core.getVariableValue)(
|
|
55
|
+
(0, import_get_token.getSize)(propsActive.size ?? styledContext?.size ?? "$true", {
|
|
56
|
+
shift: sizeAdjust
|
|
57
|
+
})
|
|
58
|
+
), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
|
|
59
|
+
const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
60
|
+
prop: checkedProp,
|
|
61
|
+
defaultProp: defaultChecked,
|
|
62
|
+
onChange: onCheckedChange
|
|
63
|
+
}), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
propsActive,
|
|
66
|
+
[checked, setChecked],
|
|
67
|
+
forwardedRef
|
|
68
|
+
);
|
|
69
|
+
return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
|
+
"input",
|
|
71
|
+
{
|
|
72
|
+
type: "checkbox",
|
|
73
|
+
defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
|
|
74
|
+
tabIndex: -1,
|
|
75
|
+
ref: checkboxRef,
|
|
76
|
+
disabled: checkboxProps.disabled,
|
|
77
|
+
style: {
|
|
78
|
+
appearance: "auto",
|
|
79
|
+
accentColor: "var(--color6)",
|
|
80
|
+
...checkboxProps.style
|
|
81
|
+
// TODO: any
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
85
|
+
CheckboxContext.Provider,
|
|
86
|
+
{
|
|
87
|
+
value: {
|
|
88
|
+
checked,
|
|
89
|
+
disabled: checkboxProps.disabled
|
|
90
|
+
},
|
|
91
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
92
|
+
import_CheckboxStyledContext.CheckboxStyledContext.Provider,
|
|
93
|
+
{
|
|
94
|
+
size: propsActive.size ?? styledContext?.size ?? "$true",
|
|
95
|
+
scaleIcon: scaleIcon ?? styledContext?.scaleIcon ?? 1,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
|
+
Frame,
|
|
99
|
+
{
|
|
100
|
+
...!unstyled && {
|
|
101
|
+
width: size,
|
|
102
|
+
height: size
|
|
103
|
+
},
|
|
104
|
+
tag: "button",
|
|
105
|
+
ref: checkboxRef,
|
|
106
|
+
...unstyled === !1 && {
|
|
107
|
+
size,
|
|
108
|
+
theme: checked ? "active" : null
|
|
109
|
+
},
|
|
110
|
+
checked,
|
|
111
|
+
disabled: checkboxProps.disabled,
|
|
112
|
+
...checkboxProps,
|
|
113
|
+
children: propsActive.children
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
bubbleInput
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
|
|
123
|
+
const {
|
|
124
|
+
// __scopeCheckbox,
|
|
125
|
+
children: childrenProp,
|
|
126
|
+
forceMount,
|
|
127
|
+
disablePassStyles,
|
|
128
|
+
unstyled = !1,
|
|
129
|
+
...indicatorProps
|
|
130
|
+
} = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
131
|
+
let children = childrenProp;
|
|
132
|
+
if (!unstyled) {
|
|
133
|
+
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 });
|
|
134
|
+
children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
|
|
135
|
+
}
|
|
136
|
+
const context = (0, import_react.useContext)(CheckboxContext);
|
|
137
|
+
return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? (
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
140
|
+
) : null;
|
|
141
|
+
});
|
|
142
|
+
return (0, import_core.withStaticProperties)(FrameComponent, {
|
|
143
|
+
Indicator: IndicatorComponent
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=createCheckbox.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/createCheckbox.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAKO,uCACP,cASO,0BACP,mBAA4B,+BAC5B,mBAAwB,+BACxB,yBAAiC,qCACjC,gCAAqC,4CACrC,eAAkC,2BAElC,kBAAsD,uBACtD,+BAAsC,oCA8G9B;AAvED,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;AAAA,EACA,QAAQ;AAAA,EACR,YAAY;AACd,GAGG;AACD,gBAAc,KAAK,GACnB,cAAc,SAAS;AAGvB,QAAM,iBAAiB,MAAM,UAAU,SAAkB,QAAQ,cAAc;AAC7E,UAAM;AAAA,MACJ,YAAY;AAAA,MACZ,a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
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({
|
|
38
|
+
Frame = import_Checkbox.CheckboxFrame,
|
|
39
|
+
Indicator = import_Checkbox.CheckboxIndicatorFrame
|
|
40
|
+
}) {
|
|
41
|
+
ensureContext(Frame), ensureContext(Indicator);
|
|
42
|
+
const FrameComponent = Frame.styleable(function(_props, forwardedRef) {
|
|
43
|
+
const {
|
|
44
|
+
scaleSize = 0.45,
|
|
45
|
+
sizeAdjust = 0,
|
|
46
|
+
scaleIcon,
|
|
47
|
+
checked: checkedProp,
|
|
48
|
+
defaultChecked,
|
|
49
|
+
onCheckedChange,
|
|
50
|
+
native,
|
|
51
|
+
unstyled = !1,
|
|
52
|
+
...props
|
|
53
|
+
} = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
54
|
+
let adjustedSize = 0, size = 0;
|
|
55
|
+
unstyled || (adjustedSize = (0, import_core.getVariableValue)(
|
|
56
|
+
(0, import_get_token.getSize)(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
|
|
57
|
+
shift: sizeAdjust
|
|
58
|
+
})
|
|
59
|
+
), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
|
|
60
|
+
const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
61
|
+
prop: checkedProp,
|
|
62
|
+
defaultProp: defaultChecked,
|
|
63
|
+
onChange: onCheckedChange
|
|
64
|
+
}), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
propsActive,
|
|
67
|
+
[checked, setChecked],
|
|
68
|
+
forwardedRef
|
|
69
|
+
);
|
|
70
|
+
return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
"input",
|
|
72
|
+
{
|
|
73
|
+
type: "checkbox",
|
|
74
|
+
defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
|
|
75
|
+
tabIndex: -1,
|
|
76
|
+
ref: checkboxRef,
|
|
77
|
+
disabled: checkboxProps.disabled,
|
|
78
|
+
style: {
|
|
79
|
+
appearance: "auto",
|
|
80
|
+
accentColor: "var(--color6)",
|
|
81
|
+
...checkboxProps.style
|
|
82
|
+
// TODO: any
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
CheckboxContext.Provider,
|
|
87
|
+
{
|
|
88
|
+
value: {
|
|
89
|
+
checked,
|
|
90
|
+
disabled: checkboxProps.disabled
|
|
91
|
+
},
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
93
|
+
import_CheckboxStyledContext.CheckboxStyledContext.Provider,
|
|
94
|
+
{
|
|
95
|
+
size: propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true",
|
|
96
|
+
scaleIcon: scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon) ?? 1,
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
Frame,
|
|
100
|
+
{
|
|
101
|
+
...!unstyled && {
|
|
102
|
+
width: size,
|
|
103
|
+
height: size
|
|
104
|
+
},
|
|
105
|
+
tag: "button",
|
|
106
|
+
ref: checkboxRef,
|
|
107
|
+
...unstyled === !1 && {
|
|
108
|
+
size,
|
|
109
|
+
theme: checked ? "active" : null
|
|
110
|
+
},
|
|
111
|
+
checked,
|
|
112
|
+
disabled: checkboxProps.disabled,
|
|
113
|
+
...checkboxProps,
|
|
114
|
+
children: propsActive.children
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
bubbleInput
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
|
|
124
|
+
const {
|
|
125
|
+
// __scopeCheckbox,
|
|
126
|
+
children: childrenProp,
|
|
127
|
+
forceMount,
|
|
128
|
+
disablePassStyles,
|
|
129
|
+
unstyled = !1,
|
|
130
|
+
...indicatorProps
|
|
131
|
+
} = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
132
|
+
let children = childrenProp;
|
|
133
|
+
if (!unstyled) {
|
|
134
|
+
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 });
|
|
135
|
+
children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
|
|
136
|
+
}
|
|
137
|
+
const context = (0, import_react.useContext)(CheckboxContext);
|
|
138
|
+
return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? (
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
141
|
+
) : null;
|
|
142
|
+
});
|
|
143
|
+
return (0, import_core.withStaticProperties)(FrameComponent, {
|
|
144
|
+
Indicator: IndicatorComponent
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
149
|
+
CheckboxContext,
|
|
150
|
+
createCheckbox
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=createCheckbox.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/createCheckbox.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAKO,uCACP,cASO,0BACP,mBAA4B,+BAC5B,mBAAwB,+BACxB,yBAAiC,qCACjC,gCAAqC,4CACrC,eAAkC,2BAElC,kBAAsD,uBACtD,+BAAsC,oCA8G9B;AAvED,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;AAAA,EACA,QAAQ;AAAA,EACR,YAAY;AACd,GAGG;AACD,gBAAc,KAAK,GACnB,cAAc,SAAS;AAGvB,QAAM,iBAAiB,MAAM,UAAU,SAAkB,QAAQ,cAAc;AAC7E,UAAM;AAAA,MACJ,YAAY;AAAA,MACZ,aAAa;AAAA,MACb;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,GAAG;AAAA,IACL,IAAI,QACE,kBAAc,sBAAS,KAAK,GAG5B,gBAAgB,aAAAA,QAAM,WAAW,kDAAqB;AAC5D,QAAI,eAAe,GACf,OAAO;AACX,IAAK,aACH,mBAAe;AAAA,UACb,0BAAQ,YAAY,SAAQ,+CAAe,SAAQ,SAAS;AAAA,QAC1D,OAAO;AAAA,MACT,CAAC;AAAA,IACH,GACA,OAAO,YAAY,KAAK,MAAM,eAAe,SAAS,IAAI;AAG5D,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U;AAAA,MACV;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,GAAG;AAAA,IACL,IAAI,OACE,gBAAgB,aAAAA,QAAM,WAAW,kDAAqB;AAC5D,QAAI,WAAW;AAEf,QAAI,CAAC,UAAU;AACb,YAAM,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,iBADkB,aAAAA,QAAM,SAAS,QAAQ,YAAY,EAChC,IAAI,CAAC,UACpB,qBAAqB,CAAC,aAAAA,QAAM,eAAe,KAAK,IAC3C,QAEF,cAAc,KAAK,CAC3B;AAAA,IACH;AAEA,UAAM,cAAU,yBAAW,eAAe;AAC1C,WAAI,kBAAc,0CAAgB,QAAQ,OAAO,KAAK,QAAQ,YAAY;AAAA;AAAA,MAGtE,4CAAC,aAAU,eAAc,QAAQ,GAAG,gBAAgB,KAAK,cACtD,UACH;AAAA,QAGG;AAAA,EACT,CAAC;AAED,aAAO,kCAAqB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,EACb,CAAC;AACH;",
|
|
5
|
+
"names": ["React"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isIndeterminate,
|
|
3
|
+
useCheckbox
|
|
4
|
+
} from "@tamagui/checkbox-headless";
|
|
5
|
+
import {
|
|
6
|
+
getVariableValue,
|
|
7
|
+
shouldRenderNativePlatform,
|
|
8
|
+
useProps,
|
|
9
|
+
useTheme,
|
|
10
|
+
withStaticProperties
|
|
11
|
+
} from "@tamagui/core";
|
|
12
|
+
import { getFontSize } from "@tamagui/font-size";
|
|
13
|
+
import { getSize } from "@tamagui/get-token";
|
|
14
|
+
import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
15
|
+
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
16
|
+
import React, { useContext } from "react";
|
|
17
|
+
import { CheckboxFrame, CheckboxIndicatorFrame } from "./Checkbox";
|
|
18
|
+
import { CheckboxStyledContext } from "./CheckboxStyledContext";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
const CheckboxContext = React.createContext({
|
|
21
|
+
checked: !1,
|
|
22
|
+
disabled: !1
|
|
23
|
+
}), ensureContext = (x) => {
|
|
24
|
+
x.context || (x.context = CheckboxContext);
|
|
25
|
+
};
|
|
26
|
+
function createCheckbox({
|
|
27
|
+
Frame = CheckboxFrame,
|
|
28
|
+
Indicator = CheckboxIndicatorFrame
|
|
29
|
+
}) {
|
|
30
|
+
ensureContext(Frame), ensureContext(Indicator);
|
|
31
|
+
const FrameComponent = Frame.styleable(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
|
+
}), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
|
|
113
|
+
const {
|
|
114
|
+
// __scopeCheckbox,
|
|
115
|
+
children: childrenProp,
|
|
116
|
+
forceMount,
|
|
117
|
+
disablePassStyles,
|
|
118
|
+
unstyled = !1,
|
|
119
|
+
...indicatorProps
|
|
120
|
+
} = props, styledContext = React.useContext(CheckboxStyledContext);
|
|
121
|
+
let children = childrenProp;
|
|
122
|
+
if (!unstyled) {
|
|
123
|
+
const iconSize = (typeof styledContext.size == "number" ? styledContext.size * 0.65 : getFontSize(styledContext.size)) * styledContext.scaleIcon, theme = useTheme(), getThemedIcon = useGetThemedIcon({ size: iconSize, color: theme.color });
|
|
124
|
+
children = React.Children.toArray(childrenProp).map((child) => disablePassStyles || !React.isValidElement(child) ? child : getThemedIcon(child));
|
|
125
|
+
}
|
|
126
|
+
const context = useContext(CheckboxContext);
|
|
127
|
+
return forceMount || isIndeterminate(context.checked) || context.checked === !0 ? (
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
/* @__PURE__ */ jsx(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
130
|
+
) : null;
|
|
131
|
+
});
|
|
132
|
+
return withStaticProperties(FrameComponent, {
|
|
133
|
+
Indicator: IndicatorComponent
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
CheckboxContext,
|
|
138
|
+
createCheckbox
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=createCheckbox.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/createCheckbox.tsx"],
|
|
4
|
+
"mappings": "AAAA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AACrC,OAAO,SAAS,kBAAkB;AAElC,SAAS,eAAe,8BAA8B;AACtD,SAAS,6BAA6B;AA8G9B,cAsBA,YAtBA;AAvED,MAAM,kBAAkB,MAAM,cAGlC;AAAA,EAC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Y;AAAA;AAAA,MAGtE,oBAAC,aAAU,eAAc,QAAQ,GAAG,gBAAgB,KAAK,cACtD,UACH;AAAA,QAGG;AAAA,EACT,CAAC;AAED,SAAO,qBAAqB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,EACb,CAAC;AACH;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
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({
|
|
38
|
+
Frame = import_Checkbox.CheckboxFrame,
|
|
39
|
+
Indicator = import_Checkbox.CheckboxIndicatorFrame
|
|
40
|
+
}) {
|
|
41
|
+
ensureContext(Frame), ensureContext(Indicator);
|
|
42
|
+
const FrameComponent = Frame.styleable(function(_props, forwardedRef) {
|
|
43
|
+
const {
|
|
44
|
+
scaleSize = 0.45,
|
|
45
|
+
sizeAdjust = 0,
|
|
46
|
+
scaleIcon,
|
|
47
|
+
checked: checkedProp,
|
|
48
|
+
defaultChecked,
|
|
49
|
+
onCheckedChange,
|
|
50
|
+
native,
|
|
51
|
+
unstyled = !1,
|
|
52
|
+
...props
|
|
53
|
+
} = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
54
|
+
let adjustedSize = 0, size = 0;
|
|
55
|
+
unstyled || (adjustedSize = (0, import_core.getVariableValue)(
|
|
56
|
+
(0, import_get_token.getSize)(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
|
|
57
|
+
shift: sizeAdjust
|
|
58
|
+
})
|
|
59
|
+
), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
|
|
60
|
+
const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
61
|
+
prop: checkedProp,
|
|
62
|
+
defaultProp: defaultChecked,
|
|
63
|
+
onChange: onCheckedChange
|
|
64
|
+
}), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
propsActive,
|
|
67
|
+
[checked, setChecked],
|
|
68
|
+
forwardedRef
|
|
69
|
+
);
|
|
70
|
+
return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
"input",
|
|
72
|
+
{
|
|
73
|
+
type: "checkbox",
|
|
74
|
+
defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
|
|
75
|
+
tabIndex: -1,
|
|
76
|
+
ref: checkboxRef,
|
|
77
|
+
disabled: checkboxProps.disabled,
|
|
78
|
+
style: {
|
|
79
|
+
appearance: "auto",
|
|
80
|
+
accentColor: "var(--color6)",
|
|
81
|
+
...checkboxProps.style
|
|
82
|
+
// TODO: any
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
CheckboxContext.Provider,
|
|
87
|
+
{
|
|
88
|
+
value: {
|
|
89
|
+
checked,
|
|
90
|
+
disabled: checkboxProps.disabled
|
|
91
|
+
},
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
93
|
+
import_CheckboxStyledContext.CheckboxStyledContext.Provider,
|
|
94
|
+
{
|
|
95
|
+
size: propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true",
|
|
96
|
+
scaleIcon: scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon) ?? 1,
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
Frame,
|
|
100
|
+
{
|
|
101
|
+
...!unstyled && {
|
|
102
|
+
width: size,
|
|
103
|
+
height: size
|
|
104
|
+
},
|
|
105
|
+
tag: "button",
|
|
106
|
+
ref: checkboxRef,
|
|
107
|
+
...unstyled === !1 && {
|
|
108
|
+
size,
|
|
109
|
+
theme: checked ? "active" : null
|
|
110
|
+
},
|
|
111
|
+
checked,
|
|
112
|
+
disabled: checkboxProps.disabled,
|
|
113
|
+
...checkboxProps,
|
|
114
|
+
children: propsActive.children
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
bubbleInput
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
|
|
124
|
+
const {
|
|
125
|
+
// __scopeCheckbox,
|
|
126
|
+
children: childrenProp,
|
|
127
|
+
forceMount,
|
|
128
|
+
disablePassStyles,
|
|
129
|
+
unstyled = !1,
|
|
130
|
+
...indicatorProps
|
|
131
|
+
} = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
132
|
+
let children = childrenProp;
|
|
133
|
+
if (!unstyled) {
|
|
134
|
+
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 });
|
|
135
|
+
children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
|
|
136
|
+
}
|
|
137
|
+
const context = (0, import_react.useContext)(CheckboxContext);
|
|
138
|
+
return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? (
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
141
|
+
) : null;
|
|
142
|
+
});
|
|
143
|
+
return (0, import_core.withStaticProperties)(FrameComponent, {
|
|
144
|
+
Indicator: IndicatorComponent
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
149
|
+
CheckboxContext,
|
|
150
|
+
createCheckbox
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=createCheckbox.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/createCheckbox.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAKO,uCACP,cASO,0BACP,mBAA4B,+BAC5B,mBAAwB,+BACxB,yBAAiC,qCACjC,gCAAqC,4CACrC,eAAkC,2BAElC,kBAAsD,uBACtD,+BAAsC,oCA8G9B;AAvED,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;AAAA,EACA,QAAQ;AAAA,EACR,YAAY;AACd,GAGG;AACD,gBAAc,KAAK,GACnB,cAAc,SAAS;AAGvB,QAAM,iBAAiB,MAAM,UAAU,SAAkB,QAAQ,cAAc;AAC7E,UAAM;AAAA,MACJ,YAAY;AAAA,MACZ,aAAa;AAAA,MACb;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,GAAG;AAAA,IACL,IAAI,QACE,kBAAc,sB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;AAAA,kBAC9B;AAAA,kBAEA;AAAA,kBACA,UAAU,cAAc;AAAA,kBACvB,GAAG;AAAA,kBAEH,sBAAY;AAAA;AAAA,cACf;AAAA,cACC;AAAA;AAAA;AAAA,QACH;AAAA;AAAA,IACF;AAAA,EAEJ,CAAC,GAGK,qBAAqB,UAAU,UAAU,CAAC,OAAO,iBAAiB;AACtE,UAAM;AAAA;AAAA,MAEJ,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,GAAG;AAAA,IACL,IAAI,OACE,gBAAgB,aAAAA,QAAM,WAAW,kDAAqB;AAC5D,QAAI,WAAW;AAEf,QAAI,CAAC,UAAU;AACb,YAAM,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,iBADkB,aAAAA,QAAM,SAAS,QAAQ,YAAY,EAChC,IAAI,CAAC,UACpB,qBAAqB,CAAC,aAAAA,QAAM,eAAe,KAAK,IAC3C,QAEF,cAAc,KAAK,CAC3B;AAAA,IACH;AAEA,UAAM,cAAU,yBAAW,eAAe;AAC1C,WAAI,kBAAc,0CAAgB,QAAQ,OAAO,KAAK,QAAQ,YAAY;AAAA;AAAA,MAGtE,4CAAC,aAAU,eAAc,QAAQ,GAAG,gBAAgB,KAAK,cACtD,UACH;AAAA,QAGG;AAAA,EACT,CAAC;AAED,aAAO,kCAAqB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,EACb,CAAC;AACH;",
|
|
5
|
+
"names": ["React"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isIndeterminate,
|
|
3
|
+
useCheckbox
|
|
4
|
+
} from "@tamagui/checkbox-headless";
|
|
5
|
+
import {
|
|
6
|
+
getVariableValue,
|
|
7
|
+
shouldRenderNativePlatform,
|
|
8
|
+
useProps,
|
|
9
|
+
useTheme,
|
|
10
|
+
withStaticProperties
|
|
11
|
+
} from "@tamagui/core";
|
|
12
|
+
import { getFontSize } from "@tamagui/font-size";
|
|
13
|
+
import { getSize } from "@tamagui/get-token";
|
|
14
|
+
import { useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
15
|
+
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
16
|
+
import React, { useContext } from "react";
|
|
17
|
+
import { CheckboxFrame, CheckboxIndicatorFrame } from "./Checkbox";
|
|
18
|
+
import { CheckboxStyledContext } from "./CheckboxStyledContext";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
const CheckboxContext = React.createContext({
|
|
21
|
+
checked: !1,
|
|
22
|
+
disabled: !1
|
|
23
|
+
}), ensureContext = (x) => {
|
|
24
|
+
x.context || (x.context = CheckboxContext);
|
|
25
|
+
};
|
|
26
|
+
function createCheckbox({
|
|
27
|
+
Frame = CheckboxFrame,
|
|
28
|
+
Indicator = CheckboxIndicatorFrame
|
|
29
|
+
}) {
|
|
30
|
+
ensureContext(Frame), ensureContext(Indicator);
|
|
31
|
+
const FrameComponent = Frame.styleable(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
|
+
}), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
|
|
113
|
+
const {
|
|
114
|
+
// __scopeCheckbox,
|
|
115
|
+
children: childrenProp,
|
|
116
|
+
forceMount,
|
|
117
|
+
disablePassStyles,
|
|
118
|
+
unstyled = !1,
|
|
119
|
+
...indicatorProps
|
|
120
|
+
} = props, styledContext = React.useContext(CheckboxStyledContext);
|
|
121
|
+
let children = childrenProp;
|
|
122
|
+
if (!unstyled) {
|
|
123
|
+
const iconSize = (typeof styledContext.size == "number" ? styledContext.size * 0.65 : getFontSize(styledContext.size)) * styledContext.scaleIcon, theme = useTheme(), getThemedIcon = useGetThemedIcon({ size: iconSize, color: theme.color });
|
|
124
|
+
children = React.Children.toArray(childrenProp).map((child) => disablePassStyles || !React.isValidElement(child) ? child : getThemedIcon(child));
|
|
125
|
+
}
|
|
126
|
+
const context = useContext(CheckboxContext);
|
|
127
|
+
return forceMount || isIndeterminate(context.checked) || context.checked === !0 ? (
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
/* @__PURE__ */ jsx(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
130
|
+
) : null;
|
|
131
|
+
});
|
|
132
|
+
return withStaticProperties(FrameComponent, {
|
|
133
|
+
Indicator: IndicatorComponent
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
CheckboxContext,
|
|
138
|
+
createCheckbox
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=createCheckbox.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/createCheckbox.tsx"],
|
|
4
|
+
"mappings": "AAAA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EAIE;AAAA,EACA;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AM,UAAU,OAAO,MAAM,MAAM,CAAC;AAG7E,iBADkB,MAAM,SAAS,QAAQ,YAAY,EAChC,IAAI,CAAC,UACpB,qBAAqB,CAAC,MAAM,eAAe,KAAK,IAC3C,QAEF,cAAc,KAAK,CAC3B;AAAA,IACH;AAEA,UAAM,UAAU,WAAW,eAAe;AAC1C,WAAI,cAAc,gBAAgB,QAAQ,OAAO,KAAK,QAAQ,YAAY;AAAA;AAAA,MAGtE,oBAAC,aAAU,eAAc,QAAQ,GAAG,gBAAgB,KAAK,cACtD,UACH;AAAA,QAGG;AAAA,EACT,CAAC;AAED,SAAO,qBAAqB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,EACb,CAAC;AACH;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
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({
|
|
38
|
+
Frame = import_Checkbox.CheckboxFrame,
|
|
39
|
+
Indicator = import_Checkbox.CheckboxIndicatorFrame
|
|
40
|
+
}) {
|
|
41
|
+
ensureContext(Frame), ensureContext(Indicator);
|
|
42
|
+
const FrameComponent = Frame.styleable(function(_props, forwardedRef) {
|
|
43
|
+
const {
|
|
44
|
+
scaleSize = 0.45,
|
|
45
|
+
sizeAdjust = 0,
|
|
46
|
+
scaleIcon,
|
|
47
|
+
checked: checkedProp,
|
|
48
|
+
defaultChecked,
|
|
49
|
+
onCheckedChange,
|
|
50
|
+
native,
|
|
51
|
+
unstyled = !1,
|
|
52
|
+
...props
|
|
53
|
+
} = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
54
|
+
let adjustedSize = 0, size = 0;
|
|
55
|
+
unstyled || (adjustedSize = (0, import_core.getVariableValue)(
|
|
56
|
+
(0, import_get_token.getSize)(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
|
|
57
|
+
shift: sizeAdjust
|
|
58
|
+
})
|
|
59
|
+
), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
|
|
60
|
+
const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
61
|
+
prop: checkedProp,
|
|
62
|
+
defaultProp: defaultChecked,
|
|
63
|
+
onChange: onCheckedChange
|
|
64
|
+
}), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
propsActive,
|
|
67
|
+
[checked, setChecked],
|
|
68
|
+
forwardedRef
|
|
69
|
+
);
|
|
70
|
+
return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
"input",
|
|
72
|
+
{
|
|
73
|
+
type: "checkbox",
|
|
74
|
+
defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
|
|
75
|
+
tabIndex: -1,
|
|
76
|
+
ref: checkboxRef,
|
|
77
|
+
disabled: checkboxProps.disabled,
|
|
78
|
+
style: {
|
|
79
|
+
appearance: "auto",
|
|
80
|
+
accentColor: "var(--color6)",
|
|
81
|
+
...checkboxProps.style
|
|
82
|
+
// TODO: any
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
CheckboxContext.Provider,
|
|
87
|
+
{
|
|
88
|
+
value: {
|
|
89
|
+
checked,
|
|
90
|
+
disabled: checkboxProps.disabled
|
|
91
|
+
},
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
93
|
+
import_CheckboxStyledContext.CheckboxStyledContext.Provider,
|
|
94
|
+
{
|
|
95
|
+
size: propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true",
|
|
96
|
+
scaleIcon: scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon) ?? 1,
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
Frame,
|
|
100
|
+
{
|
|
101
|
+
...!unstyled && {
|
|
102
|
+
width: size,
|
|
103
|
+
height: size
|
|
104
|
+
},
|
|
105
|
+
tag: "button",
|
|
106
|
+
ref: checkboxRef,
|
|
107
|
+
...unstyled === !1 && {
|
|
108
|
+
size,
|
|
109
|
+
theme: checked ? "active" : null
|
|
110
|
+
},
|
|
111
|
+
checked,
|
|
112
|
+
disabled: checkboxProps.disabled,
|
|
113
|
+
...checkboxProps,
|
|
114
|
+
children: propsActive.children
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
bubbleInput
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
|
|
124
|
+
const {
|
|
125
|
+
// __scopeCheckbox,
|
|
126
|
+
children: childrenProp,
|
|
127
|
+
forceMount,
|
|
128
|
+
disablePassStyles,
|
|
129
|
+
unstyled = !1,
|
|
130
|
+
...indicatorProps
|
|
131
|
+
} = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
132
|
+
let children = childrenProp;
|
|
133
|
+
if (!unstyled) {
|
|
134
|
+
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 });
|
|
135
|
+
children = import_react.default.Children.toArray(childrenProp).map((child) => disablePassStyles || !import_react.default.isValidElement(child) ? child : getThemedIcon(child));
|
|
136
|
+
}
|
|
137
|
+
const context = (0, import_react.useContext)(CheckboxContext);
|
|
138
|
+
return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? (
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
141
|
+
) : null;
|
|
142
|
+
});
|
|
143
|
+
return (0, import_core.withStaticProperties)(FrameComponent, {
|
|
144
|
+
Indicator: IndicatorComponent
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
149
|
+
CheckboxContext,
|
|
150
|
+
createCheckbox
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=createCheckbox.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/createCheckbox.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAKO,uCACP,cASO,0BACP,mBAA4B,+BAC5B,mBAAwB,+BACxB,yBAAiC,qCACjC,gCAAqC,4CACrC,eAAkC,2BAElC,kBAAsD,uBACtD,+BAAsC,oCA8G9B;AAvED,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;AAAA,EACA,QAAQ;AAAA,EACR,YAAY;AACd,GAGG;AACD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AgB;AAAA,IAC1C,WAAW;AAAA,EACb,CAAC;AACH;",
|
|
5
|
+
"names": ["React"]
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/checkbox",
|
|
3
|
-
"version": "1.88.
|
|
3
|
+
"version": "1.88.12",
|
|
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.
|
|
28
|
-
"@tamagui/constants": "1.88.
|
|
29
|
-
"@tamagui/core": "1.88.
|
|
30
|
-
"@tamagui/create-context": "1.88.
|
|
31
|
-
"@tamagui/focusable": "1.88.
|
|
32
|
-
"@tamagui/font-size": "1.88.
|
|
33
|
-
"@tamagui/get-token": "1.88.
|
|
34
|
-
"@tamagui/helpers": "1.88.
|
|
35
|
-
"@tamagui/helpers-tamagui": "1.88.
|
|
36
|
-
"@tamagui/label": "1.88.
|
|
37
|
-
"@tamagui/stacks": "1.88.
|
|
38
|
-
"@tamagui/use-controllable-state": "1.88.
|
|
39
|
-
"@tamagui/use-previous": "1.88.
|
|
27
|
+
"@tamagui/compose-refs": "1.88.12",
|
|
28
|
+
"@tamagui/constants": "1.88.12",
|
|
29
|
+
"@tamagui/core": "1.88.12",
|
|
30
|
+
"@tamagui/create-context": "1.88.12",
|
|
31
|
+
"@tamagui/focusable": "1.88.12",
|
|
32
|
+
"@tamagui/font-size": "1.88.12",
|
|
33
|
+
"@tamagui/get-token": "1.88.12",
|
|
34
|
+
"@tamagui/helpers": "1.88.12",
|
|
35
|
+
"@tamagui/helpers-tamagui": "1.88.12",
|
|
36
|
+
"@tamagui/label": "1.88.12",
|
|
37
|
+
"@tamagui/stacks": "1.88.12",
|
|
38
|
+
"@tamagui/use-controllable-state": "1.88.12",
|
|
39
|
+
"@tamagui/use-previous": "1.88.12"
|
|
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.
|
|
54
|
+
"@tamagui/build": "1.88.12",
|
|
55
55
|
"react": "^18.2.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxStyledContext.d.ts","sourceRoot":"","sources":["../src/CheckboxStyledContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,eAAe,CAAA;AAE/D,eAAO,MAAM,qBAAqB;;;EAGhC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCheckbox.d.ts","sourceRoot":"","sources":["../src/createCheckbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,IAAI,0BAA0B,EAGjD,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EAMX,MAAM,eAAe,CAAA;AAKtB,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,KAAK,6BAA6B,GAAG;IACnC,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,KAAK,kBAAkB,GAAG,0BAA0B,GAAG;IACrD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;CAC5B,CAAA;AACD,KAAK,iBAAiB,GAAG,UAAU,CAAA;AACnC,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,kBAA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