@tamagui/checkbox-headless 1.135.4-1761749240853 → 1.135.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/BubbleInput.cjs +1 -1
- package/dist/cjs/BubbleInput.js +1 -1
- package/dist/cjs/BubbleInput.js.map +1 -1
- package/dist/cjs/BubbleInput.native.js +53 -70
- package/dist/cjs/BubbleInput.native.js.map +6 -1
- package/dist/cjs/index.native.js +14 -14
- package/dist/cjs/index.native.js.map +6 -1
- package/dist/cjs/useCheckbox.cjs +1 -1
- package/dist/cjs/useCheckbox.js +1 -1
- package/dist/cjs/useCheckbox.js.map +1 -1
- package/dist/cjs/useCheckbox.native.js +36 -63
- package/dist/cjs/useCheckbox.native.js.map +6 -1
- package/dist/cjs/utils.native.js +15 -17
- package/dist/cjs/utils.native.js.map +6 -1
- package/dist/jsx/BubbleInput.native.js +44 -86
- package/dist/jsx/BubbleInput.native.js.map +6 -1
- package/dist/jsx/index.native.js +3 -22
- package/dist/jsx/index.native.js.map +6 -1
- package/dist/jsx/useCheckbox.native.js +31 -80
- package/dist/jsx/useCheckbox.native.js.map +6 -1
- package/dist/jsx/utils.native.js +5 -29
- package/dist/jsx/utils.native.js.map +6 -1
- package/package.json +11 -12
package/dist/cjs/BubbleInput.cjs
CHANGED
|
@@ -35,7 +35,7 @@ __export(BubbleInput_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(BubbleInput_exports);
|
|
37
37
|
var import_use_previous = require("@tamagui/use-previous"),
|
|
38
|
-
React = __toESM(require("react")
|
|
38
|
+
React = __toESM(require("react")),
|
|
39
39
|
import_utils = require("./utils.cjs"),
|
|
40
40
|
import_jsx_runtime = require("react/jsx-runtime");
|
|
41
41
|
const BubbleInput = props => {
|
package/dist/cjs/BubbleInput.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(BubbleInput_exports, {
|
|
|
25
25
|
BubbleInput: () => BubbleInput
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(BubbleInput_exports);
|
|
28
|
-
var import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react")
|
|
28
|
+
var import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react")), import_utils = require("./utils"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
29
|
const BubbleInput = (props) => {
|
|
30
30
|
const { checked, bubbles = !0, control, isHidden, ...inputProps } = props, ref = React.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
31
31
|
return React.useEffect(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/BubbleInput.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4B,kCAC5B,QAAuB,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4B,kCAC5B,QAAuB,2BAGvB,eAAgC,oBAkC5B;AAxBG,MAAM,cAAc,CAAC,UAA4B;AACtD,QAAM,EAAE,SAAS,UAAU,IAAM,SAAS,UAAU,GAAG,WAAW,IAAI,OAChE,MAAM,MAAM,OAAyB,IAAI,GACzC,kBAAc,iCAAY,OAAO;AAGvC,eAAM,UAAU,MAAM;AACpB,UAAM,QAAQ,IAAI,SACZ,aAAa,OAAO,iBAAiB,WAKrC,aAJa,OAAO;AAAA,MACxB;AAAA,MACA;AAAA,IACF,EAC8B;AAE9B,QAAI,gBAAgB,WAAW,YAAY;AACzC,YAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,QAAQ,CAAC;AAC5C,YAAM,oBAAgB,8BAAgB,OAAO,GAC7C,WAAW,KAAK,WAAO,8BAAgB,OAAO,IAAI,KAAQ,OAAO,GACjE,MAAM,cAAc,KAAK;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,aAAa,SAAS,OAAO,CAAC,GAGhC;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,oBAAgB,8BAAgB,OAAO,IAAI,KAAQ;AAAA,MAClD,GAAG;AAAA,MACJ,UAAU;AAAA,MACV;AAAA,MACA,eAAa;AAAA,MACb,OAAO;AAAA,QACL,GAAI,WACA;AAAA;AAAA,UAEE,UAAU;AAAA,UACV,eAAe;AAAA,UACf,SAAS;AAAA,UACT,QAAQ;AAAA,QACV,IACA;AAAA,UACE,YAAY;AAAA,UACZ,aAAa;AAAA,QACf;AAAA,QAEJ,GAAG,MAAM;AAAA,MACX;AAAA;AAAA,EACF;AAEJ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,86 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf,
|
|
8
|
-
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
7
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
-
});
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
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
|
+
};
|
|
22
16
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
17
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
18
|
// file that has been converted to a CommonJS file using a Babel-
|
|
25
19
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
20
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}) : target, mod)),
|
|
31
|
-
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: !0
|
|
33
|
-
}), mod);
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
34
24
|
var BubbleInput_exports = {};
|
|
35
25
|
__export(BubbleInput_exports, {
|
|
36
26
|
BubbleInput: () => BubbleInput
|
|
37
27
|
});
|
|
38
28
|
module.exports = __toCommonJS(BubbleInput_exports);
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime"),
|
|
40
|
-
|
|
41
|
-
React
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
style
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
accentColor: "var(--color6)"
|
|
81
|
-
}),
|
|
82
|
-
...props.style
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=BubbleInput.native.js.map
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react")), import_utils = require("./utils"), BubbleInput = function(props) {
|
|
30
|
+
var { checked, bubbles = !0, control, isHidden, ...inputProps } = props, ref = React.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
31
|
+
return React.useEffect(function() {
|
|
32
|
+
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
33
|
+
if (prevChecked !== checked && setChecked) {
|
|
34
|
+
var event = new Event("click", {
|
|
35
|
+
bubbles
|
|
36
|
+
});
|
|
37
|
+
input.indeterminate = (0, import_utils.isIndeterminate)(checked), setChecked.call(input, (0, import_utils.isIndeterminate)(checked) ? !1 : checked), input.dispatchEvent(event);
|
|
38
|
+
}
|
|
39
|
+
}, [
|
|
40
|
+
prevChecked,
|
|
41
|
+
checked,
|
|
42
|
+
bubbles
|
|
43
|
+
]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
44
|
+
type: "checkbox",
|
|
45
|
+
defaultChecked: (0, import_utils.isIndeterminate)(checked) ? !1 : checked,
|
|
46
|
+
...inputProps,
|
|
47
|
+
tabIndex: -1,
|
|
48
|
+
ref,
|
|
49
|
+
"aria-hidden": isHidden,
|
|
50
|
+
style: {
|
|
51
|
+
...isHidden ? {
|
|
52
|
+
// ...controlSize,
|
|
53
|
+
position: "absolute",
|
|
54
|
+
pointerEvents: "none",
|
|
55
|
+
opacity: 0,
|
|
56
|
+
margin: 0
|
|
57
|
+
} : {
|
|
58
|
+
appearance: "auto",
|
|
59
|
+
accentColor: "var(--color6)"
|
|
60
|
+
},
|
|
61
|
+
...props.style
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
BubbleInput
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=BubbleInput.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BubbleInput.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B,8BAC5B,sBAA4B,kCAC5B,QAAuB,2BACvB,eAAgC,oBACrB,cAAc,SAAS,OAAO;AACrC,MAAI,EAAE,SAAS,UAAU,IAAM,SAAS,UAAU,GAAG,WAAW,IAAI,OAChE,MAAM,MAAM,OAAO,IAAI,GACvB,kBAAc,iCAAY,OAAO;AAGrC,eAAM,UAAU,WAAW;AACvB,QAAI,QAAQ,IAAI,SACZ,aAAa,OAAO,iBAAiB,WACrC,aAAa,OAAO,yBAAyB,YAAY,SAAS,GAClE,aAAa,WAAW;AAC5B,QAAI,gBAAgB,WAAW,YAAY;AACvC,UAAI,QAAQ,IAAI,MAAM,SAAS;AAAA,QAC3B;AAAA,MACJ,CAAC;AACD,YAAM,oBAAgB,8BAAgB,OAAO,GAC7C,WAAW,KAAK,WAAO,8BAAgB,OAAO,IAAI,KAAQ,OAAO,GACjE,MAAM,cAAc,KAAK;AAAA,IAC7B;AAAA,EACJ,GAAG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC,GACoB,uCAAAA,KAAK,SAAS;AAAA,IAC/B,MAAM;AAAA,IACN,oBAAgB,8BAAgB,OAAO,IAAI,KAAQ;AAAA,IACnD,GAAG;AAAA,IACH,UAAU;AAAA,IACV;AAAA,IACA,eAAe;AAAA,IACf,OAAO;AAAA,MACH,GAAG,WAAW;AAAA;AAAA,QAEV,UAAU;AAAA,QACV,eAAe;AAAA,QACf,SAAS;AAAA,QACT,QAAQ;AAAA,MACZ,IAAI;AAAA,QACA,YAAY;AAAA,QACZ,aAAa;AAAA,MACjB;AAAA,MACA,GAAG,MAAM;AAAA,IACb;AAAA,EACJ,CAAC;AACL;",
|
|
5
|
+
"names": ["_jsx"]
|
|
6
|
+
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
6
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: !0
|
|
17
|
-
}), mod);
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
18
13
|
var index_exports = {};
|
|
19
14
|
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./useCheckbox
|
|
21
|
-
__reExport(index_exports, require("./utils
|
|
22
|
-
|
|
15
|
+
__reExport(index_exports, require("./useCheckbox"), module.exports);
|
|
16
|
+
__reExport(index_exports, require("./utils"), module.exports);
|
|
17
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
18
|
+
0 && (module.exports = {
|
|
19
|
+
...require("./useCheckbox"),
|
|
20
|
+
...require("./utils")
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,0BAAd;AACA,0BAAc,oBADd;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/cjs/useCheckbox.cjs
CHANGED
|
@@ -38,7 +38,7 @@ var import_compose_refs = require("@tamagui/compose-refs"),
|
|
|
38
38
|
import_constants = require("@tamagui/constants"),
|
|
39
39
|
import_helpers = require("@tamagui/helpers"),
|
|
40
40
|
import_label = require("@tamagui/label"),
|
|
41
|
-
import_react = __toESM(require("react")
|
|
41
|
+
import_react = __toESM(require("react")),
|
|
42
42
|
import_BubbleInput = require("./BubbleInput.cjs"),
|
|
43
43
|
import_utils = require("./utils.cjs"),
|
|
44
44
|
import_jsx_runtime = require("react/jsx-runtime");
|
package/dist/cjs/useCheckbox.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(useCheckbox_exports, {
|
|
|
25
25
|
useCheckbox: () => useCheckbox
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(useCheckbox_exports);
|
|
28
|
-
var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_helpers = require("@tamagui/helpers"), import_label = require("@tamagui/label"), import_react = __toESM(require("react")
|
|
28
|
+
var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_helpers = require("@tamagui/helpers"), import_label = require("@tamagui/label"), import_react = __toESM(require("react")), import_BubbleInput = require("./BubbleInput"), import_utils = require("./utils"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
29
|
function useCheckbox(props, [checked, setChecked], ref) {
|
|
30
30
|
const {
|
|
31
31
|
labelledBy: ariaLabelledby,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useCheckbox.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgC,kCAChC,mBAAsB,+BAEtB,iBAAqC,6BACrC,eAAgC,2BAChC,eAA+B,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgC,kCAChC,mBAAsB,+BAEtB,iBAAqC,6BACrC,eAAgC,2BAChC,eAA+B,2BAG/B,qBAA4B,0BAC5B,eAA0C,oBAgFlC;AAvDD,SAAS,YACd,OACA,CAAC,SAAS,UAAU,GAIpB,KACA;AACA,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA,GAAG;AAAA,EACL,IAAI,OACE,CAAC,QAAQ,SAAS,IAAI,aAAAA,QAAM,SAAmC,IAAI,GACnE,mBAAe,qCAAgB,KAAK,SAAgB,GACpD,mCAAmC,aAAAA,QAAM,OAAO,EAAK,GAErD,gBAAgB,yBAAS,SAAS,EAAQ,OAAO,QAAQ,MAAM,IAAK,KAAQ,IAE5E,cAAU,8BAAgB,MAAM,GAChC,aAAa,kBAAkB,SAE/B,gBAAiB,MAA6C,WAE9D,oBAAgB;AAAA,IACpB,UACE,qCAAqB,eAAe,CAAC,UAAU;AAE7C,MAAI,MAAM,QAAQ,WAAS,MAAM,eAAe;AAAA,IAClD,CAAC;AAAA,IACH,CAAC,aAAa;AAAA,EAChB,GAEM,kBAAc;AAAA,IAClB,UACE,qCAAqB,MAAM,SAAgB,CAAC,UAAgC;AAC1E,iBAAW,CAAC,oBAAiB,8BAAgB,WAAW,IAAI,KAAO,CAAC,WAAY,GAC5E,iBAAiB,0BAA0B,UAC7C,iCAAiC,UAAU,MAAM,qBAAqB,GAIjE,iCAAiC,WAAS,MAAM,gBAAgB;AAAA,IAEzE,CAAC;AAAA,IACH,CAAC,aAAa;AAAA,EAChB;AAEA,SAAO;AAAA,IACL,aACE,0BAAS,gBACP;AAAA,MAAC;AAAA;AAAA,QACC,UAAQ;AAAA,QACR,SAAS;AAAA,QACT,SAAS,CAAC,iCAAiC;AAAA,QAC3C;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF,IACE;AAAA,IACN,aAAa;AAAA,IACb,eAAe;AAAA,MACb,MAAM;AAAA,MACN,mBAAmB;AAAA,MACnB,oBAAgB,8BAAgB,OAAO,IAAI,UAAU;AAAA,MACrD,GAAG;AAAA,MACH,GAAI,0BAAS;AAAA,QACX,MAAM;AAAA,QACN;AAAA,QACA,kBAAc,uBAAS,OAAO;AAAA,QAC9B,iBAAiB,WAAW,KAAK;AAAA,QACjC;AAAA,QACA,WAAW,WAAW,SAAY;AAAA,MACpC;AAAA,MACA,SAAS,WAAW,SAAY;AAAA,IAClC;AAAA,EACF;AACF;",
|
|
5
5
|
"names": ["React"]
|
|
6
6
|
}
|
|
@@ -1,81 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf,
|
|
8
|
-
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
7
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
-
});
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
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
|
+
};
|
|
22
16
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
17
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
18
|
// file that has been converted to a CommonJS file using a Babel-
|
|
25
19
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
20
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}) : target, mod)),
|
|
31
|
-
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: !0
|
|
33
|
-
}), mod);
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
34
24
|
var useCheckbox_exports = {};
|
|
35
25
|
__export(useCheckbox_exports, {
|
|
36
26
|
useCheckbox: () => useCheckbox
|
|
37
27
|
});
|
|
38
28
|
module.exports = __toCommonJS(useCheckbox_exports);
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime"),
|
|
40
|
-
import_compose_refs = require("@tamagui/compose-refs"),
|
|
41
|
-
import_constants = require("@tamagui/constants"),
|
|
42
|
-
import_helpers = require("@tamagui/helpers"),
|
|
43
|
-
import_label = require("@tamagui/label"),
|
|
44
|
-
import_react = __toESM(require("react"), 1),
|
|
45
|
-
import_BubbleInput = require("./BubbleInput.native.js"),
|
|
46
|
-
import_utils = require("./utils.native.js");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_helpers = require("@tamagui/helpers"), import_label = require("@tamagui/label"), import_react = __toESM(require("react")), import_BubbleInput = require("./BubbleInput"), import_utils = require("./utils");
|
|
47
30
|
function useCheckbox(props, param, ref) {
|
|
48
|
-
var [checked, setChecked] = param,
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
isFormControl
|
|
62
|
-
|
|
63
|
-
labelledBy = ariaLabelledby || labelId,
|
|
64
|
-
parentKeyDown = props.onKeyDown,
|
|
65
|
-
handleKeyDown = (0, import_react.useMemo)(function () {
|
|
66
|
-
return (0, import_helpers.composeEventHandlers)(parentKeyDown, function (event) {
|
|
67
|
-
event.key === "Enter" && event.preventDefault();
|
|
68
|
-
});
|
|
69
|
-
}, [parentKeyDown]),
|
|
70
|
-
handlePress = (0, import_react.useMemo)(function () {
|
|
71
|
-
return (0, import_helpers.composeEventHandlers)(props.onPress, function (event) {
|
|
72
|
-
setChecked(function (prevChecked) {
|
|
73
|
-
return (0, import_utils.isIndeterminate)(prevChecked) ? !0 : !prevChecked;
|
|
74
|
-
}), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
75
|
-
});
|
|
76
|
-
}, [isFormControl]);
|
|
31
|
+
var [checked, setChecked] = param, { labelledBy: ariaLabelledby, name, required, disabled, value = "on", onCheckedChange, ...checkboxProps } = props, [button, setButton] = import_react.default.useState(null), composedRefs = (0, import_compose_refs.useComposedRefs)(ref, setButton), hasConsumerStoppedPropagationRef = import_react.default.useRef(!1), isFormControl = import_constants.isWeb ? button ? !!button.closest("form") : !0 : !1, labelId = (0, import_label.useLabelContext)(button), labelledBy = ariaLabelledby || labelId, parentKeyDown = props.onKeyDown, handleKeyDown = (0, import_react.useMemo)(function() {
|
|
32
|
+
return (0, import_helpers.composeEventHandlers)(parentKeyDown, function(event) {
|
|
33
|
+
event.key === "Enter" && event.preventDefault();
|
|
34
|
+
});
|
|
35
|
+
}, [
|
|
36
|
+
parentKeyDown
|
|
37
|
+
]), handlePress = (0, import_react.useMemo)(function() {
|
|
38
|
+
return (0, import_helpers.composeEventHandlers)(props.onPress, function(event) {
|
|
39
|
+
setChecked(function(prevChecked) {
|
|
40
|
+
return (0, import_utils.isIndeterminate)(prevChecked) ? !0 : !prevChecked;
|
|
41
|
+
}), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
42
|
+
});
|
|
43
|
+
}, [
|
|
44
|
+
isFormControl
|
|
45
|
+
]);
|
|
77
46
|
return {
|
|
78
|
-
bubbleInput: import_constants.isWeb && isFormControl ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_BubbleInput.BubbleInput, {
|
|
47
|
+
bubbleInput: import_constants.isWeb && isFormControl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BubbleInput.BubbleInput, {
|
|
79
48
|
isHidden: !0,
|
|
80
49
|
control: button,
|
|
81
50
|
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
@@ -91,16 +60,20 @@ function useCheckbox(props, param, ref) {
|
|
|
91
60
|
"aria-labelledby": labelledBy,
|
|
92
61
|
"aria-checked": (0, import_utils.isIndeterminate)(checked) ? "mixed" : checked,
|
|
93
62
|
...checkboxProps,
|
|
94
|
-
...
|
|
63
|
+
...import_constants.isWeb && {
|
|
95
64
|
type: "button",
|
|
96
65
|
value,
|
|
97
66
|
"data-state": (0, import_utils.getState)(checked),
|
|
98
67
|
"data-disabled": disabled ? "" : void 0,
|
|
99
68
|
disabled,
|
|
100
69
|
onKeyDown: disabled ? void 0 : handleKeyDown
|
|
101
|
-
}
|
|
70
|
+
},
|
|
102
71
|
onPress: disabled ? void 0 : handlePress
|
|
103
72
|
}
|
|
104
73
|
};
|
|
105
74
|
}
|
|
106
|
-
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
useCheckbox
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=useCheckbox.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useCheckbox.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B,8BAC5B,sBAAgC,kCAChC,mBAAsB,+BACtB,iBAAqC,6BACrC,eAAgC,2BAChC,eAA+B,2BAC/B,qBAA4B,0BAC5B,eAA0C;AAI7B,SAAS,YAAY,OAAO,OAAO,KAAK;AACjD,MAAI,CAAC,SAAS,UAAU,IAAI,OACxB,EAAE,YAAY,gBAAgB,MAAM,UAAU,UAAU,QAAQ,MAAM,iBAAiB,GAAG,cAAc,IAAI,OAC5G,CAAC,QAAQ,SAAS,IAAI,aAAAA,QAAM,SAAS,IAAI,GACzC,mBAAe,qCAAgB,KAAK,SAAS,GAC7C,mCAAmC,aAAAA,QAAM,OAAO,EAAK,GAErD,gBAAgB,yBAAQ,SAAS,EAAQ,OAAO,QAAQ,MAAM,IAAK,KAAO,IAC1E,cAAU,8BAAgB,MAAM,GAChC,aAAa,kBAAkB,SAC/B,gBAAgB,MAAM,WACtB,oBAAgB,sBAAQ,WAAW;AACnC,eAAO,qCAAqB,eAAe,SAAS,OAAO;AAEvD,MAAI,MAAM,QAAQ,WAAS,MAAM,eAAe;AAAA,IACpD,CAAC;AAAA,EACL,GAAG;AAAA,IACC;AAAA,EACJ,CAAC,GACG,kBAAc,sBAAQ,WAAW;AACjC,eAAO,qCAAqB,MAAM,SAAS,SAAS,OAAO;AACvD,iBAAW,SAAS,aAAa;AAC7B,mBAAO,8BAAgB,WAAW,IAAI,KAAO,CAAC;AAAA,MAClD,CAAC,GACG,iBAAiB,0BAA0B,UAC3C,iCAAiC,UAAU,MAAM,qBAAqB,GAIjE,iCAAiC,WAAS,MAAM,gBAAgB;AAAA,IAE7E,CAAC;AAAA,EACL,GAAG;AAAA,IACC;AAAA,EACJ,CAAC;AACD,SAAO;AAAA,IACH,aAAa,0BAAS,gBAA8B,uCAAAC,KAAK,gCAAa;AAAA,MAClE,UAAU;AAAA,MACV,SAAS;AAAA,MACT,SAAS,CAAC,iCAAiC;AAAA,MAC3C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC,IAAI;AAAA,IACL,aAAa;AAAA,IACb,eAAe;AAAA,MACX,MAAM;AAAA,MACN,mBAAmB;AAAA,MACnB,oBAAgB,8BAAgB,OAAO,IAAI,UAAU;AAAA,MACrD,GAAG;AAAA,MACH,GAAG,0BAAS;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA,kBAAc,uBAAS,OAAO;AAAA,QAC9B,iBAAiB,WAAW,KAAK;AAAA,QACjC;AAAA,QACA,WAAW,WAAW,SAAY;AAAA,MACtC;AAAA,MACA,SAAS,WAAW,SAAY;AAAA,IACpC;AAAA,EACJ;AACJ;",
|
|
5
|
+
"names": ["React", "_jsx"]
|
|
6
|
+
}
|
package/dist/cjs/utils.native.js
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
6
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: !0
|
|
22
|
-
}), mod);
|
|
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);
|
|
23
16
|
var utils_exports = {};
|
|
24
17
|
__export(utils_exports, {
|
|
25
18
|
getState: () => getState,
|
|
@@ -32,4 +25,9 @@ function isIndeterminate(checked) {
|
|
|
32
25
|
function getState(checked) {
|
|
33
26
|
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
34
27
|
}
|
|
35
|
-
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
getState,
|
|
31
|
+
isIndeterminate
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,gBAAgB,SAAS;AACrC,SAAO,YAAY;AACvB;AACO,SAAS,SAAS,SAAS;AAC9B,SAAO,gBAAgB,OAAO,IAAI,kBAAkB,UAAU,YAAY;AAC9E;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -1,86 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
checked,
|
|
46
|
-
bubbles = !0,
|
|
47
|
-
control,
|
|
48
|
-
isHidden,
|
|
49
|
-
...inputProps
|
|
50
|
-
} = props,
|
|
51
|
-
ref = React.useRef(null),
|
|
52
|
-
prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
53
|
-
return React.useEffect(function () {
|
|
54
|
-
var input = ref.current,
|
|
55
|
-
inputProto = window.HTMLInputElement.prototype,
|
|
56
|
-
descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"),
|
|
57
|
-
setChecked = descriptor.set;
|
|
58
|
-
if (prevChecked !== checked && setChecked) {
|
|
59
|
-
var event = new Event("click", {
|
|
60
|
-
bubbles
|
|
61
|
-
});
|
|
62
|
-
input.indeterminate = (0, import_utils.isIndeterminate)(checked), setChecked.call(input, (0, import_utils.isIndeterminate)(checked) ? !1 : checked), input.dispatchEvent(event);
|
|
63
|
-
}
|
|
64
|
-
}, [prevChecked, checked, bubbles]), /* @__PURE__ */(0, import_jsx_runtime.jsx)("input", {
|
|
65
|
-
type: "checkbox",
|
|
66
|
-
defaultChecked: (0, import_utils.isIndeterminate)(checked) ? !1 : checked,
|
|
67
|
-
...inputProps,
|
|
68
|
-
tabIndex: -1,
|
|
69
|
-
ref,
|
|
70
|
-
"aria-hidden": isHidden,
|
|
71
|
-
style: {
|
|
72
|
-
...(isHidden ? {
|
|
73
|
-
// ...controlSize,
|
|
74
|
-
position: "absolute",
|
|
75
|
-
pointerEvents: "none",
|
|
76
|
-
opacity: 0,
|
|
77
|
-
margin: 0
|
|
78
|
-
} : {
|
|
79
|
-
appearance: "auto",
|
|
80
|
-
accentColor: "var(--color6)"
|
|
81
|
-
}),
|
|
82
|
-
...props.style
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=BubbleInput.native.js.map
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { usePrevious } from "@tamagui/use-previous";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { isIndeterminate } from "./utils";
|
|
5
|
+
var BubbleInput = function(props) {
|
|
6
|
+
var { checked, bubbles = !0, control, isHidden, ...inputProps } = props, ref = React.useRef(null), prevChecked = usePrevious(checked);
|
|
7
|
+
return React.useEffect(function() {
|
|
8
|
+
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
9
|
+
if (prevChecked !== checked && setChecked) {
|
|
10
|
+
var event = new Event("click", {
|
|
11
|
+
bubbles
|
|
12
|
+
});
|
|
13
|
+
input.indeterminate = isIndeterminate(checked), setChecked.call(input, isIndeterminate(checked) ? !1 : checked), input.dispatchEvent(event);
|
|
14
|
+
}
|
|
15
|
+
}, [
|
|
16
|
+
prevChecked,
|
|
17
|
+
checked,
|
|
18
|
+
bubbles
|
|
19
|
+
]), /* @__PURE__ */ _jsx("input", {
|
|
20
|
+
type: "checkbox",
|
|
21
|
+
defaultChecked: isIndeterminate(checked) ? !1 : checked,
|
|
22
|
+
...inputProps,
|
|
23
|
+
tabIndex: -1,
|
|
24
|
+
ref,
|
|
25
|
+
"aria-hidden": isHidden,
|
|
26
|
+
style: {
|
|
27
|
+
...isHidden ? {
|
|
28
|
+
// ...controlSize,
|
|
29
|
+
position: "absolute",
|
|
30
|
+
pointerEvents: "none",
|
|
31
|
+
opacity: 0,
|
|
32
|
+
margin: 0
|
|
33
|
+
} : {
|
|
34
|
+
appearance: "auto",
|
|
35
|
+
accentColor: "var(--color6)"
|
|
36
|
+
},
|
|
37
|
+
...props.style
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
BubbleInput
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=BubbleInput.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BubbleInput.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,OAAO,YAAY;AAC5B,SAAS,mBAAmB;AAC5B,YAAY,WAAW;AACvB,SAAS,uBAAuB;AACzB,IAAI,cAAc,SAAS,OAAO;AACrC,MAAI,EAAE,SAAS,UAAU,IAAM,SAAS,UAAU,GAAG,WAAW,IAAI,OAChE,MAAM,MAAM,OAAO,IAAI,GACvB,cAAc,YAAY,OAAO;AAGrC,eAAM,UAAU,WAAW;AACvB,QAAI,QAAQ,IAAI,SACZ,aAAa,OAAO,iBAAiB,WACrC,aAAa,OAAO,yBAAyB,YAAY,SAAS,GAClE,aAAa,WAAW;AAC5B,QAAI,gBAAgB,WAAW,YAAY;AACvC,UAAI,QAAQ,IAAI,MAAM,SAAS;AAAA,QAC3B;AAAA,MACJ,CAAC;AACD,YAAM,gBAAgB,gBAAgB,OAAO,GAC7C,WAAW,KAAK,OAAO,gBAAgB,OAAO,IAAI,KAAQ,OAAO,GACjE,MAAM,cAAc,KAAK;AAAA,IAC7B;AAAA,EACJ,GAAG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC,GACoB,qBAAK,SAAS;AAAA,IAC/B,MAAM;AAAA,IACN,gBAAgB,gBAAgB,OAAO,IAAI,KAAQ;AAAA,IACnD,GAAG;AAAA,IACH,UAAU;AAAA,IACV;AAAA,IACA,eAAe;AAAA,IACf,OAAO;AAAA,MACH,GAAG,WAAW;AAAA;AAAA,QAEV,UAAU;AAAA,QACV,eAAe;AAAA,QACf,SAAS;AAAA,QACT,QAAQ;AAAA,MACZ,IAAI;AAAA,QACA,YAAY;AAAA,QACZ,aAAa;AAAA,MACjB;AAAA,MACA,GAAG,MAAM;AAAA,IACb;AAAA,EACJ,CAAC;AACL;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/jsx/index.native.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
9
|
-
get: () => from[key],
|
|
10
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
-
});
|
|
12
|
-
return to;
|
|
13
|
-
},
|
|
14
|
-
__reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: !0
|
|
17
|
-
}), mod);
|
|
18
|
-
var index_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./useCheckbox.native.js"), module.exports);
|
|
21
|
-
__reExport(index_exports, require("./utils.native.js"), module.exports);
|
|
22
|
-
//# sourceMappingURL=index.native.js.map
|
|
1
|
+
export * from "./useCheckbox";
|
|
2
|
+
export * from "./utils";
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -1,81 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
+
import { isWeb } from "@tamagui/constants";
|
|
4
|
+
import { composeEventHandlers } from "@tamagui/helpers";
|
|
5
|
+
import { useLabelContext } from "@tamagui/label";
|
|
6
|
+
import React, { useMemo } from "react";
|
|
7
|
+
import { BubbleInput } from "./BubbleInput";
|
|
8
|
+
import { getState, isIndeterminate } from "./utils";
|
|
9
|
+
function useCheckbox(props, param, ref) {
|
|
10
|
+
var [checked, setChecked] = param, { labelledBy: ariaLabelledby, name, required, disabled, value = "on", onCheckedChange, ...checkboxProps } = props, [button, setButton] = React.useState(null), composedRefs = useComposedRefs(ref, setButton), hasConsumerStoppedPropagationRef = React.useRef(!1), isFormControl = isWeb ? button ? !!button.closest("form") : !0 : !1, labelId = useLabelContext(button), labelledBy = ariaLabelledby || labelId, parentKeyDown = props.onKeyDown, handleKeyDown = useMemo(function() {
|
|
11
|
+
return composeEventHandlers(parentKeyDown, function(event) {
|
|
12
|
+
event.key === "Enter" && event.preventDefault();
|
|
13
13
|
});
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
}, [
|
|
15
|
+
parentKeyDown
|
|
16
|
+
]), handlePress = useMemo(function() {
|
|
17
|
+
return composeEventHandlers(props.onPress, function(event) {
|
|
18
|
+
setChecked(function(prevChecked) {
|
|
19
|
+
return isIndeterminate(prevChecked) ? !0 : !prevChecked;
|
|
20
|
+
}), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
19
21
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: !0
|
|
30
|
-
}) : target, mod)),
|
|
31
|
-
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: !0
|
|
33
|
-
}), mod);
|
|
34
|
-
var useCheckbox_exports = {};
|
|
35
|
-
__export(useCheckbox_exports, {
|
|
36
|
-
useCheckbox: () => useCheckbox
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(useCheckbox_exports);
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime"),
|
|
40
|
-
import_compose_refs = require("@tamagui/compose-refs"),
|
|
41
|
-
import_constants = require("@tamagui/constants"),
|
|
42
|
-
import_helpers = require("@tamagui/helpers"),
|
|
43
|
-
import_label = require("@tamagui/label"),
|
|
44
|
-
import_react = __toESM(require("react"), 1),
|
|
45
|
-
import_BubbleInput = require("./BubbleInput.native.js"),
|
|
46
|
-
import_utils = require("./utils.native.js");
|
|
47
|
-
function useCheckbox(props, param, ref) {
|
|
48
|
-
var [checked, setChecked] = param,
|
|
49
|
-
{
|
|
50
|
-
labelledBy: ariaLabelledby,
|
|
51
|
-
name,
|
|
52
|
-
required,
|
|
53
|
-
disabled,
|
|
54
|
-
value = "on",
|
|
55
|
-
onCheckedChange,
|
|
56
|
-
...checkboxProps
|
|
57
|
-
} = props,
|
|
58
|
-
[button, setButton] = import_react.default.useState(null),
|
|
59
|
-
composedRefs = (0, import_compose_refs.useComposedRefs)(ref, setButton),
|
|
60
|
-
hasConsumerStoppedPropagationRef = import_react.default.useRef(!1),
|
|
61
|
-
isFormControl = import_constants.isWeb ? button ? !!button.closest("form") : !0 : !1,
|
|
62
|
-
labelId = (0, import_label.useLabelContext)(button),
|
|
63
|
-
labelledBy = ariaLabelledby || labelId,
|
|
64
|
-
parentKeyDown = props.onKeyDown,
|
|
65
|
-
handleKeyDown = (0, import_react.useMemo)(function () {
|
|
66
|
-
return (0, import_helpers.composeEventHandlers)(parentKeyDown, function (event) {
|
|
67
|
-
event.key === "Enter" && event.preventDefault();
|
|
68
|
-
});
|
|
69
|
-
}, [parentKeyDown]),
|
|
70
|
-
handlePress = (0, import_react.useMemo)(function () {
|
|
71
|
-
return (0, import_helpers.composeEventHandlers)(props.onPress, function (event) {
|
|
72
|
-
setChecked(function (prevChecked) {
|
|
73
|
-
return (0, import_utils.isIndeterminate)(prevChecked) ? !0 : !prevChecked;
|
|
74
|
-
}), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
75
|
-
});
|
|
76
|
-
}, [isFormControl]);
|
|
22
|
+
}, [
|
|
23
|
+
isFormControl
|
|
24
|
+
]);
|
|
77
25
|
return {
|
|
78
|
-
bubbleInput:
|
|
26
|
+
bubbleInput: isWeb && isFormControl ? /* @__PURE__ */ _jsx(BubbleInput, {
|
|
79
27
|
isHidden: !0,
|
|
80
28
|
control: button,
|
|
81
29
|
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
@@ -89,18 +37,21 @@ function useCheckbox(props, param, ref) {
|
|
|
89
37
|
checkboxProps: {
|
|
90
38
|
role: "checkbox",
|
|
91
39
|
"aria-labelledby": labelledBy,
|
|
92
|
-
"aria-checked":
|
|
40
|
+
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
|
|
93
41
|
...checkboxProps,
|
|
94
|
-
...
|
|
42
|
+
...isWeb && {
|
|
95
43
|
type: "button",
|
|
96
44
|
value,
|
|
97
|
-
"data-state":
|
|
45
|
+
"data-state": getState(checked),
|
|
98
46
|
"data-disabled": disabled ? "" : void 0,
|
|
99
47
|
disabled,
|
|
100
48
|
onKeyDown: disabled ? void 0 : handleKeyDown
|
|
101
|
-
}
|
|
49
|
+
},
|
|
102
50
|
onPress: disabled ? void 0 : handlePress
|
|
103
51
|
}
|
|
104
52
|
};
|
|
105
53
|
}
|
|
106
|
-
|
|
54
|
+
export {
|
|
55
|
+
useCheckbox
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=useCheckbox.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useCheckbox.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,OAAO,YAAY;AAC5B,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,OAAO,SAAS,eAAe;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,UAAU,uBAAuB;AAI7B,SAAS,YAAY,OAAO,OAAO,KAAK;AACjD,MAAI,CAAC,SAAS,UAAU,IAAI,OACxB,EAAE,YAAY,gBAAgB,MAAM,UAAU,UAAU,QAAQ,MAAM,iBAAiB,GAAG,cAAc,IAAI,OAC5G,CAAC,QAAQ,SAAS,IAAI,MAAM,SAAS,IAAI,GACzC,eAAe,gBAAgB,KAAK,SAAS,GAC7C,mCAAmC,MAAM,OAAO,EAAK,GAErD,gBAAgB,QAAQ,SAAS,EAAQ,OAAO,QAAQ,MAAM,IAAK,KAAO,IAC1E,UAAU,gBAAgB,MAAM,GAChC,aAAa,kBAAkB,SAC/B,gBAAgB,MAAM,WACtB,gBAAgB,QAAQ,WAAW;AACnC,WAAO,qBAAqB,eAAe,SAAS,OAAO;AAEvD,MAAI,MAAM,QAAQ,WAAS,MAAM,eAAe;AAAA,IACpD,CAAC;AAAA,EACL,GAAG;AAAA,IACC;AAAA,EACJ,CAAC,GACG,cAAc,QAAQ,WAAW;AACjC,WAAO,qBAAqB,MAAM,SAAS,SAAS,OAAO;AACvD,iBAAW,SAAS,aAAa;AAC7B,eAAO,gBAAgB,WAAW,IAAI,KAAO,CAAC;AAAA,MAClD,CAAC,GACG,iBAAiB,0BAA0B,UAC3C,iCAAiC,UAAU,MAAM,qBAAqB,GAIjE,iCAAiC,WAAS,MAAM,gBAAgB;AAAA,IAE7E,CAAC;AAAA,EACL,GAAG;AAAA,IACC;AAAA,EACJ,CAAC;AACD,SAAO;AAAA,IACH,aAAa,SAAS,gBAA8B,qBAAK,aAAa;AAAA,MAClE,UAAU;AAAA,MACV,SAAS;AAAA,MACT,SAAS,CAAC,iCAAiC;AAAA,MAC3C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC,IAAI;AAAA,IACL,aAAa;AAAA,IACb,eAAe;AAAA,MACX,MAAM;AAAA,MACN,mBAAmB;AAAA,MACnB,gBAAgB,gBAAgB,OAAO,IAAI,UAAU;AAAA,MACrD,GAAG;AAAA,MACH,GAAG,SAAS;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA,cAAc,SAAS,OAAO;AAAA,QAC9B,iBAAiB,WAAW,KAAK;AAAA,QACjC;AAAA,QACA,WAAW,WAAW,SAAY;AAAA,MACtC;AAAA,MACA,SAAS,WAAW,SAAY;AAAA,IACpC;AAAA,EACJ;AACJ;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/jsx/utils.native.js
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: !0
|
|
11
|
-
});
|
|
12
|
-
},
|
|
13
|
-
__copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: !0
|
|
22
|
-
}), mod);
|
|
23
|
-
var utils_exports = {};
|
|
24
|
-
__export(utils_exports, {
|
|
25
|
-
getState: () => getState,
|
|
26
|
-
isIndeterminate: () => isIndeterminate
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(utils_exports);
|
|
29
1
|
function isIndeterminate(checked) {
|
|
30
2
|
return checked === "indeterminate";
|
|
31
3
|
}
|
|
32
4
|
function getState(checked) {
|
|
33
5
|
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
34
6
|
}
|
|
35
|
-
|
|
7
|
+
export {
|
|
8
|
+
getState,
|
|
9
|
+
isIndeterminate
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils.tsx"],
|
|
4
|
+
"mappings": "AAAO,SAAS,gBAAgB,SAAS;AACrC,SAAO,YAAY;AACvB;AACO,SAAS,SAAS,SAAS;AAC9B,SAAO,gBAAgB,OAAO,IAAI,kBAAkB,UAAU,YAAY;AAC9E;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/checkbox-headless",
|
|
3
|
-
"version": "1.135.4
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "1.135.4",
|
|
5
4
|
"sideEffects": [
|
|
6
5
|
"*.css"
|
|
7
6
|
],
|
|
@@ -24,15 +23,15 @@
|
|
|
24
23
|
"clean:build": "tamagui-build clean:build"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@tamagui/compose-refs": "1.135.4
|
|
28
|
-
"@tamagui/constants": "1.135.4
|
|
29
|
-
"@tamagui/create-context": "1.135.4
|
|
30
|
-
"@tamagui/focusable": "1.135.4
|
|
31
|
-
"@tamagui/helpers": "1.135.4
|
|
32
|
-
"@tamagui/label": "1.135.4
|
|
33
|
-
"@tamagui/use-controllable-state": "1.135.4
|
|
34
|
-
"@tamagui/use-previous": "1.135.4
|
|
35
|
-
"@tamagui/web": "1.135.4
|
|
26
|
+
"@tamagui/compose-refs": "1.135.4",
|
|
27
|
+
"@tamagui/constants": "1.135.4",
|
|
28
|
+
"@tamagui/create-context": "1.135.4",
|
|
29
|
+
"@tamagui/focusable": "1.135.4",
|
|
30
|
+
"@tamagui/helpers": "1.135.4",
|
|
31
|
+
"@tamagui/label": "1.135.4",
|
|
32
|
+
"@tamagui/use-controllable-state": "1.135.4",
|
|
33
|
+
"@tamagui/use-previous": "1.135.4",
|
|
34
|
+
"@tamagui/web": "1.135.4"
|
|
36
35
|
},
|
|
37
36
|
"exports": {
|
|
38
37
|
"./package.json": "./package.json",
|
|
@@ -48,7 +47,7 @@
|
|
|
48
47
|
}
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
|
-
"@tamagui/build": "1.135.4
|
|
50
|
+
"@tamagui/build": "1.135.4",
|
|
52
51
|
"react": "*",
|
|
53
52
|
"react-native": "^0.79.2"
|
|
54
53
|
},
|