@tamagui/checkbox 1.88.2 → 1.88.4
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 +0 -4
- package/dist/cjs/createCheckbox.js +3 -8
- package/dist/cjs/createCheckbox.js.map +1 -1
- package/dist/esm/CheckboxStyledContext.native.js +25 -4
- package/dist/esm/CheckboxStyledContext.native.js.map +1 -1
- package/dist/esm/createCheckbox.native.js +56 -44
- package/dist/esm/createCheckbox.native.js.map +2 -2
- package/dist/jsx/CheckboxStyledContext.native.js +25 -4
- package/dist/jsx/CheckboxStyledContext.native.js.map +1 -1
- package/dist/jsx/createCheckbox.js +53 -40
- package/dist/jsx/createCheckbox.js.map +1 -1
- package/dist/jsx/createCheckbox.native.js +99 -74
- package/dist/jsx/createCheckbox.native.js.map +2 -2
- package/package.json +15 -15
|
@@ -22,8 +22,4 @@ const CheckboxStyledContext = (0, import_core.createStyledContext)({
|
|
|
22
22
|
size: "$true",
|
|
23
23
|
scaleIcon: 1
|
|
24
24
|
});
|
|
25
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
-
0 && (module.exports = {
|
|
27
|
-
CheckboxStyledContext
|
|
28
|
-
});
|
|
29
25
|
//# sourceMappingURL=CheckboxStyledContext.js.map
|
|
@@ -52,7 +52,7 @@ function createCheckbox({
|
|
|
52
52
|
} = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
53
53
|
let adjustedSize = 0, size = 0;
|
|
54
54
|
unstyled || (adjustedSize = (0, import_core.getVariableValue)(
|
|
55
|
-
(0, import_get_token.getSize)(propsActive.size ??
|
|
55
|
+
(0, import_get_token.getSize)(propsActive.size ?? styledContext?.size ?? "$true", {
|
|
56
56
|
shift: sizeAdjust
|
|
57
57
|
})
|
|
58
58
|
), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
|
|
@@ -91,8 +91,8 @@ function createCheckbox({
|
|
|
91
91
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
92
92
|
import_CheckboxStyledContext.CheckboxStyledContext.Provider,
|
|
93
93
|
{
|
|
94
|
-
size: propsActive.size ??
|
|
95
|
-
scaleIcon: scaleIcon ??
|
|
94
|
+
size: propsActive.size ?? styledContext?.size ?? "$true",
|
|
95
|
+
scaleIcon: scaleIcon ?? styledContext?.scaleIcon ?? 1,
|
|
96
96
|
children: [
|
|
97
97
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
98
|
Frame,
|
|
@@ -143,9 +143,4 @@ function createCheckbox({
|
|
|
143
143
|
Indicator: IndicatorComponent
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
-
0 && (module.exports = {
|
|
148
|
-
CheckboxContext,
|
|
149
|
-
createCheckbox
|
|
150
|
-
});
|
|
151
146
|
//# sourceMappingURL=createCheckbox.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,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AAqB,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
5
|
"names": ["React"]
|
|
6
6
|
}
|
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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)({
|
|
3
23
|
size: "$true",
|
|
4
24
|
scaleIcon: 1
|
|
5
25
|
});
|
|
6
|
-
export
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
7
28
|
CheckboxStyledContext
|
|
8
|
-
};
|
|
29
|
+
});
|
|
9
30
|
//# sourceMappingURL=CheckboxStyledContext.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/CheckboxStyledContext.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgD;AAEzC,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,31 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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({
|
|
21
32
|
checked: !1,
|
|
22
33
|
disabled: !1
|
|
23
34
|
}), ensureContext = (x) => {
|
|
24
35
|
x.context || (x.context = CheckboxContext);
|
|
25
36
|
};
|
|
26
37
|
function createCheckbox({
|
|
27
|
-
Frame = CheckboxFrame,
|
|
28
|
-
Indicator = CheckboxIndicatorFrame
|
|
38
|
+
Frame = import_Checkbox.CheckboxFrame,
|
|
39
|
+
Indicator = import_Checkbox.CheckboxIndicatorFrame
|
|
29
40
|
}) {
|
|
30
41
|
ensureContext(Frame), ensureContext(Indicator);
|
|
31
42
|
const FrameComponent = Frame.styleable(function(_props, forwardedRef) {
|
|
@@ -39,28 +50,28 @@ function createCheckbox({
|
|
|
39
50
|
native,
|
|
40
51
|
unstyled = !1,
|
|
41
52
|
...props
|
|
42
|
-
} = _props, propsActive = useProps(props), styledContext =
|
|
53
|
+
} = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
43
54
|
let adjustedSize = 0, size = 0;
|
|
44
|
-
unstyled || (adjustedSize = getVariableValue(
|
|
45
|
-
getSize(propsActive.size ?? styledContext
|
|
55
|
+
unstyled || (adjustedSize = (0, import_core.getVariableValue)(
|
|
56
|
+
(0, import_get_token.getSize)(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
|
|
46
57
|
shift: sizeAdjust
|
|
47
58
|
})
|
|
48
59
|
), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
|
|
49
|
-
const [checked = !1, setChecked] = useControllableState({
|
|
60
|
+
const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
50
61
|
prop: checkedProp,
|
|
51
62
|
defaultProp: defaultChecked,
|
|
52
63
|
onChange: onCheckedChange
|
|
53
|
-
}), { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(
|
|
64
|
+
}), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
54
65
|
// @ts-ignore
|
|
55
66
|
propsActive,
|
|
56
67
|
[checked, setChecked],
|
|
57
68
|
forwardedRef
|
|
58
69
|
);
|
|
59
|
-
return shouldRenderNativePlatform(native) === "web" ? /* @__PURE__ */ jsx(
|
|
70
|
+
return (0, import_core.shouldRenderNativePlatform)(native) === "web" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
71
|
"input",
|
|
61
72
|
{
|
|
62
73
|
type: "checkbox",
|
|
63
|
-
defaultChecked: isIndeterminate(checked) ? !1 : checked,
|
|
74
|
+
defaultChecked: (0, import_checkbox_headless.isIndeterminate)(checked) ? !1 : checked,
|
|
64
75
|
tabIndex: -1,
|
|
65
76
|
ref: checkboxRef,
|
|
66
77
|
disabled: checkboxProps.disabled,
|
|
@@ -71,20 +82,20 @@ function createCheckbox({
|
|
|
71
82
|
// TODO: any
|
|
72
83
|
}
|
|
73
84
|
}
|
|
74
|
-
) : /* @__PURE__ */ jsx(
|
|
85
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
86
|
CheckboxContext.Provider,
|
|
76
87
|
{
|
|
77
88
|
value: {
|
|
78
89
|
checked,
|
|
79
90
|
disabled: checkboxProps.disabled
|
|
80
91
|
},
|
|
81
|
-
children: /* @__PURE__ */ jsxs(
|
|
82
|
-
CheckboxStyledContext.Provider,
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
93
|
+
import_CheckboxStyledContext.CheckboxStyledContext.Provider,
|
|
83
94
|
{
|
|
84
|
-
size: propsActive.size ?? styledContext
|
|
85
|
-
scaleIcon: scaleIcon ?? styledContext
|
|
95
|
+
size: propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true",
|
|
96
|
+
scaleIcon: scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon) ?? 1,
|
|
86
97
|
children: [
|
|
87
|
-
/* @__PURE__ */ jsx(
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
99
|
Frame,
|
|
89
100
|
{
|
|
90
101
|
...!unstyled && {
|
|
@@ -117,24 +128,25 @@ function createCheckbox({
|
|
|
117
128
|
disablePassStyles,
|
|
118
129
|
unstyled = !1,
|
|
119
130
|
...indicatorProps
|
|
120
|
-
} = props, styledContext =
|
|
131
|
+
} = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
121
132
|
let children = childrenProp;
|
|
122
133
|
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 =
|
|
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));
|
|
125
136
|
}
|
|
126
|
-
const context = useContext(CheckboxContext);
|
|
127
|
-
return forceMount || isIndeterminate(context.checked) || context.checked === !0 ? (
|
|
137
|
+
const context = (0, import_react.useContext)(CheckboxContext);
|
|
138
|
+
return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? (
|
|
128
139
|
// @ts-ignore
|
|
129
|
-
/* @__PURE__ */ jsx(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
130
141
|
) : null;
|
|
131
142
|
});
|
|
132
|
-
return withStaticProperties(FrameComponent, {
|
|
143
|
+
return (0, import_core.withStaticProperties)(FrameComponent, {
|
|
133
144
|
Indicator: IndicatorComponent
|
|
134
145
|
});
|
|
135
146
|
}
|
|
136
|
-
export
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
137
149
|
CheckboxContext,
|
|
138
150
|
createCheckbox
|
|
139
|
-
};
|
|
151
|
+
});
|
|
140
152
|
//# sourceMappingURL=createCheckbox.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createCheckbox.tsx"],
|
|
4
|
-
"mappings": "AAAA;AAAA
|
|
5
|
-
"names": []
|
|
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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C;AACH;",
|
|
5
|
+
"names": ["React"]
|
|
6
6
|
}
|
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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)({
|
|
3
23
|
size: "$true",
|
|
4
24
|
scaleIcon: 1
|
|
5
25
|
});
|
|
6
|
-
export
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
7
28
|
CheckboxStyledContext
|
|
8
|
-
};
|
|
29
|
+
});
|
|
9
30
|
//# sourceMappingURL=CheckboxStyledContext.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/CheckboxStyledContext.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgD;AAEzC,MAAM,4BAAwB,iCAAoB;AAAA,EACvD,MAAM;AAAA,EACN,WAAW;AACb,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -16,6 +16,7 @@ import { useControllableState } from "@tamagui/use-controllable-state";
|
|
|
16
16
|
import React, { useContext } from "react";
|
|
17
17
|
import { CheckboxFrame, CheckboxIndicatorFrame } from "./Checkbox";
|
|
18
18
|
import { CheckboxStyledContext } from "./CheckboxStyledContext";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
20
|
const CheckboxContext = React.createContext({
|
|
20
21
|
checked: !1,
|
|
21
22
|
disabled: !1
|
|
@@ -55,47 +56,59 @@ function createCheckbox({
|
|
|
55
56
|
[checked, setChecked],
|
|
56
57
|
forwardedRef
|
|
57
58
|
);
|
|
58
|
-
return shouldRenderNativePlatform(native) === "web" ?
|
|
59
|
-
|
|
60
|
-
defaultChecked={isIndeterminate(checked) ? !1 : checked}
|
|
61
|
-
tabIndex={-1}
|
|
62
|
-
ref={checkboxRef}
|
|
63
|
-
disabled={checkboxProps.disabled}
|
|
64
|
-
style={{
|
|
65
|
-
appearance: "auto",
|
|
66
|
-
accentColor: "var(--color6)",
|
|
67
|
-
...checkboxProps.style
|
|
68
|
-
// TODO: any
|
|
69
|
-
}}
|
|
70
|
-
/> : <CheckboxContext.Provider
|
|
71
|
-
value={{
|
|
72
|
-
checked,
|
|
73
|
-
disabled: checkboxProps.disabled
|
|
74
|
-
}}
|
|
75
|
-
><CheckboxStyledContext.Provider
|
|
76
|
-
size={propsActive.size ?? styledContext?.size ?? "$true"}
|
|
77
|
-
scaleIcon={scaleIcon ?? styledContext?.scaleIcon ?? 1}
|
|
78
|
-
>
|
|
59
|
+
return shouldRenderNativePlatform(native) === "web" ? /* @__PURE__ */ jsx(
|
|
60
|
+
"input",
|
|
79
61
|
{
|
|
80
|
-
|
|
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
|
+
}
|
|
81
73
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
+
);
|
|
99
112
|
}), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
|
|
100
113
|
const {
|
|
101
114
|
// __scopeCheckbox,
|
|
@@ -113,7 +126,7 @@ function createCheckbox({
|
|
|
113
126
|
const context = useContext(CheckboxContext);
|
|
114
127
|
return forceMount || isIndeterminate(context.checked) || context.checked === !0 ? (
|
|
115
128
|
// @ts-ignore
|
|
116
|
-
|
|
129
|
+
/* @__PURE__ */ jsx(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
117
130
|
) : null;
|
|
118
131
|
});
|
|
119
132
|
return withStaticProperties(FrameComponent, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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;
|
|
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,6BAA6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AW,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
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,30 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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({
|
|
20
32
|
checked: !1,
|
|
21
33
|
disabled: !1
|
|
22
34
|
}), ensureContext = (x) => {
|
|
23
35
|
x.context || (x.context = CheckboxContext);
|
|
24
36
|
};
|
|
25
37
|
function createCheckbox({
|
|
26
|
-
Frame = CheckboxFrame,
|
|
27
|
-
Indicator = CheckboxIndicatorFrame
|
|
38
|
+
Frame = import_Checkbox.CheckboxFrame,
|
|
39
|
+
Indicator = import_Checkbox.CheckboxIndicatorFrame
|
|
28
40
|
}) {
|
|
29
41
|
ensureContext(Frame), ensureContext(Indicator);
|
|
30
42
|
const FrameComponent = Frame.styleable(function(_props, forwardedRef) {
|
|
@@ -38,64 +50,76 @@ function createCheckbox({
|
|
|
38
50
|
native,
|
|
39
51
|
unstyled = !1,
|
|
40
52
|
...props
|
|
41
|
-
} = _props, propsActive = useProps(props), styledContext =
|
|
53
|
+
} = _props, propsActive = (0, import_core.useProps)(props), styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
42
54
|
let adjustedSize = 0, size = 0;
|
|
43
|
-
unstyled || (adjustedSize = getVariableValue(
|
|
44
|
-
getSize(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
|
|
55
|
+
unstyled || (adjustedSize = (0, import_core.getVariableValue)(
|
|
56
|
+
(0, import_get_token.getSize)(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
|
|
45
57
|
shift: sizeAdjust
|
|
46
58
|
})
|
|
47
59
|
), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);
|
|
48
|
-
const [checked = !1, setChecked] = useControllableState({
|
|
60
|
+
const [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
49
61
|
prop: checkedProp,
|
|
50
62
|
defaultProp: defaultChecked,
|
|
51
63
|
onChange: onCheckedChange
|
|
52
|
-
}), { checkboxProps, checkboxRef, bubbleInput } = useCheckbox(
|
|
64
|
+
}), { checkboxProps, checkboxRef, bubbleInput } = (0, import_checkbox_headless.useCheckbox)(
|
|
53
65
|
// @ts-ignore
|
|
54
66
|
propsActive,
|
|
55
67
|
[checked, setChecked],
|
|
56
68
|
forwardedRef
|
|
57
69
|
);
|
|
58
|
-
return shouldRenderNativePlatform(native) === "web" ?
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
><CheckboxStyledContext.Provider
|
|
76
|
-
size={propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true"}
|
|
77
|
-
scaleIcon={scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon) ?? 1}
|
|
78
|
-
>
|
|
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,
|
|
79
87
|
{
|
|
80
|
-
|
|
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
|
+
)
|
|
81
121
|
}
|
|
82
|
-
|
|
83
|
-
{...!unstyled && {
|
|
84
|
-
width: size,
|
|
85
|
-
height: size
|
|
86
|
-
}}
|
|
87
|
-
tag="button"
|
|
88
|
-
ref={checkboxRef}
|
|
89
|
-
{...unstyled === !1 && {
|
|
90
|
-
size,
|
|
91
|
-
theme: checked ? "active" : null
|
|
92
|
-
}}
|
|
93
|
-
checked={checked}
|
|
94
|
-
disabled={checkboxProps.disabled}
|
|
95
|
-
{...checkboxProps}
|
|
96
|
-
>{propsActive.children}</Frame>
|
|
97
|
-
{bubbleInput}
|
|
98
|
-
</CheckboxStyledContext.Provider></CheckboxContext.Provider>;
|
|
122
|
+
);
|
|
99
123
|
}), IndicatorComponent = Indicator.styleable((props, forwardedRef) => {
|
|
100
124
|
const {
|
|
101
125
|
// __scopeCheckbox,
|
|
@@ -104,24 +128,25 @@ function createCheckbox({
|
|
|
104
128
|
disablePassStyles,
|
|
105
129
|
unstyled = !1,
|
|
106
130
|
...indicatorProps
|
|
107
|
-
} = props, styledContext =
|
|
131
|
+
} = props, styledContext = import_react.default.useContext(import_CheckboxStyledContext.CheckboxStyledContext);
|
|
108
132
|
let children = childrenProp;
|
|
109
133
|
if (!unstyled) {
|
|
110
|
-
const iconSize = (typeof styledContext.size == "number" ? styledContext.size * 0.65 : getFontSize(styledContext.size)) * styledContext.scaleIcon, theme = useTheme(), getThemedIcon = useGetThemedIcon({ size: iconSize, color: theme.color });
|
|
111
|
-
children =
|
|
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));
|
|
112
136
|
}
|
|
113
|
-
const context = useContext(CheckboxContext);
|
|
114
|
-
return forceMount || isIndeterminate(context.checked) || context.checked === !0 ? (
|
|
137
|
+
const context = (0, import_react.useContext)(CheckboxContext);
|
|
138
|
+
return forceMount || (0, import_checkbox_headless.isIndeterminate)(context.checked) || context.checked === !0 ? (
|
|
115
139
|
// @ts-ignore
|
|
116
|
-
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, { pointerEvents: "none", ...indicatorProps, ref: forwardedRef, children })
|
|
117
141
|
) : null;
|
|
118
142
|
});
|
|
119
|
-
return withStaticProperties(FrameComponent, {
|
|
143
|
+
return (0, import_core.withStaticProperties)(FrameComponent, {
|
|
120
144
|
Indicator: IndicatorComponent
|
|
121
145
|
});
|
|
122
146
|
}
|
|
123
|
-
export
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
124
149
|
CheckboxContext,
|
|
125
150
|
createCheckbox
|
|
126
|
-
};
|
|
151
|
+
});
|
|
127
152
|
//# sourceMappingURL=createCheckbox.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createCheckbox.tsx"],
|
|
4
|
-
"mappings": "AAAA;AAAA
|
|
5
|
-
"names": []
|
|
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,S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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
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/checkbox",
|
|
3
|
-
"version": "1.88.
|
|
3
|
+
"version": "1.88.4",
|
|
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.4",
|
|
28
|
+
"@tamagui/constants": "1.88.4",
|
|
29
|
+
"@tamagui/core": "1.88.4",
|
|
30
|
+
"@tamagui/create-context": "1.88.4",
|
|
31
|
+
"@tamagui/focusable": "1.88.4",
|
|
32
|
+
"@tamagui/font-size": "1.88.4",
|
|
33
|
+
"@tamagui/get-token": "1.88.4",
|
|
34
|
+
"@tamagui/helpers": "1.88.4",
|
|
35
|
+
"@tamagui/helpers-tamagui": "1.88.4",
|
|
36
|
+
"@tamagui/label": "1.88.4",
|
|
37
|
+
"@tamagui/stacks": "1.88.4",
|
|
38
|
+
"@tamagui/use-controllable-state": "1.88.4",
|
|
39
|
+
"@tamagui/use-previous": "1.88.4"
|
|
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.4",
|
|
55
55
|
"react": "^18.2.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|