@tamagui/checkbox 1.79.7 → 1.79.8
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.js +69 -0
- package/dist/cjs/BubbleInput.js.map +6 -0
- package/dist/cjs/BubbleInput.native.js +70 -0
- package/dist/cjs/BubbleInput.native.js.map +6 -0
- package/dist/cjs/CheckboxIndicator.js +70 -0
- package/dist/cjs/CheckboxIndicator.js.map +6 -0
- package/dist/cjs/CheckboxIndicator.native.js +71 -0
- package/dist/cjs/CheckboxIndicator.native.js.map +6 -0
- package/dist/cjs/CheckboxStyledContext.js +29 -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/ScopedProps.js +189 -0
- package/dist/cjs/ScopedProps.js.map +6 -0
- package/dist/cjs/ScopedProps.native.js +199 -0
- package/dist/cjs/ScopedProps.native.js.map +6 -0
- package/dist/cjs/createCheckbox.js +167 -0
- package/dist/cjs/createCheckbox.js.map +6 -0
- package/dist/cjs/createCheckbox.native.js +177 -0
- package/dist/cjs/createCheckbox.native.js.map +6 -0
- package/dist/cjs/isIndeterminate.js +32 -0
- package/dist/cjs/isIndeterminate.js.map +6 -0
- package/dist/cjs/isIndeterminate.native.js +33 -0
- package/dist/cjs/isIndeterminate.native.js.map +6 -0
- package/dist/cjs/utils.js +32 -0
- package/dist/cjs/utils.js.map +6 -0
- package/dist/cjs/utils.native.js +33 -0
- package/dist/cjs/utils.native.js.map +6 -0
- package/dist/esm/BubbleInput.js +44 -0
- package/dist/esm/BubbleInput.js.map +6 -0
- package/dist/esm/BubbleInput.native.js +44 -0
- package/dist/esm/BubbleInput.native.js.map +6 -0
- package/dist/esm/CheckboxIndicator.js +57 -0
- package/dist/esm/CheckboxIndicator.js.map +6 -0
- package/dist/esm/CheckboxIndicator.native.js +57 -0
- package/dist/esm/CheckboxIndicator.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 +9 -0
- package/dist/esm/CheckboxStyledContext.native.js.map +6 -0
- package/dist/esm/ScopedProps.js +175 -0
- package/dist/esm/ScopedProps.js.map +6 -0
- package/dist/esm/ScopedProps.native.js +184 -0
- package/dist/esm/ScopedProps.native.js.map +6 -0
- package/dist/esm/createCheckbox.js +156 -0
- package/dist/esm/createCheckbox.js.map +6 -0
- package/dist/esm/createCheckbox.native.js +165 -0
- package/dist/esm/createCheckbox.native.js.map +6 -0
- package/dist/esm/isIndeterminate.js +11 -0
- package/dist/esm/isIndeterminate.js.map +6 -0
- package/dist/esm/isIndeterminate.native.js +11 -0
- package/dist/esm/isIndeterminate.native.js.map +6 -0
- package/dist/esm/utils.js +11 -0
- package/dist/esm/utils.js.map +6 -0
- package/dist/esm/utils.native.js +11 -0
- package/dist/esm/utils.native.js.map +6 -0
- package/dist/jsx/BubbleInput.js +40 -0
- package/dist/jsx/BubbleInput.js.map +6 -0
- package/dist/jsx/BubbleInput.native.js +40 -0
- package/dist/jsx/BubbleInput.native.js.map +6 -0
- package/dist/jsx/CheckboxIndicator.js +52 -0
- package/dist/jsx/CheckboxIndicator.js.map +6 -0
- package/dist/jsx/CheckboxIndicator.native.js +52 -0
- package/dist/jsx/CheckboxIndicator.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 +9 -0
- package/dist/jsx/CheckboxStyledContext.native.js.map +6 -0
- package/dist/jsx/ScopedProps.js +160 -0
- package/dist/jsx/ScopedProps.js.map +6 -0
- package/dist/jsx/ScopedProps.native.js +169 -0
- package/dist/jsx/ScopedProps.native.js.map +6 -0
- package/dist/jsx/createCheckbox.js +137 -0
- package/dist/jsx/createCheckbox.js.map +6 -0
- package/dist/jsx/createCheckbox.native.js +146 -0
- package/dist/jsx/createCheckbox.native.js.map +6 -0
- package/dist/jsx/isIndeterminate.js +11 -0
- package/dist/jsx/isIndeterminate.js.map +6 -0
- package/dist/jsx/isIndeterminate.native.js +11 -0
- package/dist/jsx/isIndeterminate.native.js.map +6 -0
- package/dist/jsx/utils.js +11 -0
- package/dist/jsx/utils.js.map +6 -0
- package/dist/jsx/utils.native.js +11 -0
- package/dist/jsx/utils.native.js.map +6 -0
- package/package.json +12 -12
- package/types/BubbleInput.d.ts.map +1 -0
- package/types/CheckboxIndicator.d.ts.map +1 -0
- package/types/CheckboxStyledContext.d.ts.map +1 -0
- package/types/ScopedProps.d.ts.map +1 -0
- package/types/createCheckbox.d.ts.map +1 -0
- package/types/isIndeterminate.d.ts.map +1 -0
- package/types/utils.d.ts.map +1 -0
|
@@ -0,0 +1,69 @@
|
|
|
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 BubbleInput_exports = {};
|
|
24
|
+
__export(BubbleInput_exports, {
|
|
25
|
+
BubbleInput: () => BubbleInput
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(BubbleInput_exports);
|
|
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
|
+
const BubbleInput = (props) => {
|
|
30
|
+
const { checked, bubbles = !0, control, isHidden, ...inputProps } = props, ref = React.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
31
|
+
return React.useEffect(() => {
|
|
32
|
+
const input = ref.current, inputProto = window.HTMLInputElement.prototype, setChecked = Object.getOwnPropertyDescriptor(
|
|
33
|
+
inputProto,
|
|
34
|
+
"checked"
|
|
35
|
+
).set;
|
|
36
|
+
if (prevChecked !== checked && setChecked) {
|
|
37
|
+
const event = new Event("click", { bubbles });
|
|
38
|
+
input.indeterminate = (0, import_utils.isIndeterminate)(checked), setChecked.call(input, (0, import_utils.isIndeterminate)(checked) ? !1 : checked), input.dispatchEvent(event);
|
|
39
|
+
}
|
|
40
|
+
}, [prevChecked, checked, bubbles]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
41
|
+
"input",
|
|
42
|
+
{
|
|
43
|
+
type: "checkbox",
|
|
44
|
+
defaultChecked: (0, import_utils.isIndeterminate)(checked) ? !1 : checked,
|
|
45
|
+
...inputProps,
|
|
46
|
+
tabIndex: -1,
|
|
47
|
+
ref,
|
|
48
|
+
"aria-hidden": isHidden,
|
|
49
|
+
style: {
|
|
50
|
+
...isHidden ? {
|
|
51
|
+
// ...controlSize,
|
|
52
|
+
position: "absolute",
|
|
53
|
+
pointerEvents: "none",
|
|
54
|
+
opacity: 0,
|
|
55
|
+
margin: 0
|
|
56
|
+
} : {
|
|
57
|
+
appearance: "auto",
|
|
58
|
+
accentColor: "var(--color6)"
|
|
59
|
+
},
|
|
60
|
+
...props.style
|
|
61
|
+
}
|
|
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
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BubbleInput.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4B,kCAC5B,QAAuB,2BAGvB,eAAgC,oBA0B5B;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
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 BubbleInput_exports = {};
|
|
25
|
+
__export(BubbleInput_exports, {
|
|
26
|
+
BubbleInput: () => BubbleInput
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(BubbleInput_exports);
|
|
29
|
+
var import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react")), import_utils = require("./utils"), import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
const BubbleInput = (props) => {
|
|
31
|
+
const { checked, bubbles = !0, control, isHidden, ...inputProps } = props, ref = React.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
32
|
+
return React.useEffect(() => {
|
|
33
|
+
const input = ref.current, inputProto = window.HTMLInputElement.prototype, setChecked = Object.getOwnPropertyDescriptor(
|
|
34
|
+
inputProto,
|
|
35
|
+
"checked"
|
|
36
|
+
).set;
|
|
37
|
+
if (prevChecked !== checked && setChecked) {
|
|
38
|
+
const event = new Event("click", { bubbles });
|
|
39
|
+
input.indeterminate = (0, import_utils.isIndeterminate)(checked), setChecked.call(input, (0, import_utils.isIndeterminate)(checked) ? !1 : checked), input.dispatchEvent(event);
|
|
40
|
+
}
|
|
41
|
+
}, [prevChecked, checked, bubbles]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
42
|
+
"input",
|
|
43
|
+
{
|
|
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
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
BubbleInput
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=BubbleInput.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BubbleInput.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4B,kCAC5B,QAAuB,2BAGvB,eAAgC,oBA0B5B;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
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 CheckboxIndicator_exports = {};
|
|
24
|
+
__export(CheckboxIndicator_exports, {
|
|
25
|
+
Checkbox: () => Checkbox
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(CheckboxIndicator_exports);
|
|
28
|
+
var import_core = require("@tamagui/core"), import_font_size = require("@tamagui/font-size"), import_helpers_tamagui = require("@tamagui/helpers-tamagui"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")), import_Checkbox = require("./Checkbox"), import_CheckboxStyledContext = require("./CheckboxStyledContext"), import_utils = require("./utils"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
const INDICATOR_NAME = "CheckboxIndicator", CheckboxIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
30
|
+
// use Checkbox for easier themes
|
|
31
|
+
name: INDICATOR_NAME,
|
|
32
|
+
context: import_CheckboxStyledContext.CheckboxStyledContext
|
|
33
|
+
}), CheckboxIndicator = CheckboxIndicatorFrame.extractable(
|
|
34
|
+
React.forwardRef(
|
|
35
|
+
(props, forwardedRef) => {
|
|
36
|
+
const {
|
|
37
|
+
__scopeCheckbox,
|
|
38
|
+
children: childrenProp,
|
|
39
|
+
forceMount,
|
|
40
|
+
disablePassStyles,
|
|
41
|
+
...indicatorProps
|
|
42
|
+
} = props;
|
|
43
|
+
process.env.NODE_ENV === "development" && !childrenProp && console.warn(
|
|
44
|
+
"Warning: You created a Checkbox.Indicator without passing an child prop for it to use as an icon."
|
|
45
|
+
);
|
|
46
|
+
const context = (0, import_Checkbox.useCheckboxContext)(INDICATOR_NAME, __scopeCheckbox), styledContext = React.useContext(import_CheckboxStyledContext.CheckboxStyledContext), 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 }), children = React.Children.toArray(childrenProp).map((child) => disablePassStyles || !React.isValidElement(child) ? child : getThemedIcon(child));
|
|
47
|
+
return forceMount || (0, import_utils.isIndeterminate)(context.state) || context.state === !0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
+
CheckboxIndicatorFrame,
|
|
49
|
+
{
|
|
50
|
+
"data-state": (0, import_utils.getState)(context.state),
|
|
51
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
52
|
+
pointerEvents: "none",
|
|
53
|
+
...indicatorProps,
|
|
54
|
+
ref: forwardedRef,
|
|
55
|
+
children
|
|
56
|
+
}
|
|
57
|
+
) : null;
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
CheckboxIndicator.displayName = INDICATOR_NAME;
|
|
62
|
+
const Checkbox = (0, import_core.withStaticProperties)(import_Checkbox.CheckboxComponent, {
|
|
63
|
+
Indicator: CheckboxIndicator,
|
|
64
|
+
Props: import_CheckboxStyledContext.CheckboxStyledContext.Provider
|
|
65
|
+
});
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
Checkbox
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=CheckboxIndicator.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/CheckboxIndicator.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAMO,0BACP,mBAA4B,+BAE5B,yBAAiC,qCACjC,gBAA+B,4BAC/B,QAAuB,2BAEvB,kBAKO,uBACP,+BAAsC,oCACtC,eAA0C,oBAuEhC;AAxDV,MAAM,iBAAiB,qBAEjB,6BAAyB,oBAAO,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
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 CheckboxIndicator_exports = {};
|
|
25
|
+
__export(CheckboxIndicator_exports, {
|
|
26
|
+
Checkbox: () => Checkbox
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(CheckboxIndicator_exports);
|
|
29
|
+
var import_core = require("@tamagui/core"), import_font_size = require("@tamagui/font-size"), import_helpers_tamagui = require("@tamagui/helpers-tamagui"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")), import_Checkbox = require("./Checkbox"), import_CheckboxStyledContext = require("./CheckboxStyledContext"), import_utils = require("./utils"), import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
const INDICATOR_NAME = "CheckboxIndicator", CheckboxIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
31
|
+
// use Checkbox for easier themes
|
|
32
|
+
name: INDICATOR_NAME,
|
|
33
|
+
context: import_CheckboxStyledContext.CheckboxStyledContext
|
|
34
|
+
}), CheckboxIndicator = CheckboxIndicatorFrame.extractable(
|
|
35
|
+
React.forwardRef(
|
|
36
|
+
(props, forwardedRef) => {
|
|
37
|
+
const {
|
|
38
|
+
__scopeCheckbox,
|
|
39
|
+
children: childrenProp,
|
|
40
|
+
forceMount,
|
|
41
|
+
disablePassStyles,
|
|
42
|
+
...indicatorProps
|
|
43
|
+
} = props;
|
|
44
|
+
process.env.NODE_ENV === "development" && !childrenProp && console.warn(
|
|
45
|
+
"Warning: You created a Checkbox.Indicator without passing an child prop for it to use as an icon."
|
|
46
|
+
);
|
|
47
|
+
const context = (0, import_Checkbox.useCheckboxContext)(INDICATOR_NAME, __scopeCheckbox), styledContext = React.useContext(import_CheckboxStyledContext.CheckboxStyledContext), 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 }), children = React.Children.toArray(childrenProp).map((child) => disablePassStyles || !React.isValidElement(child) ? child : getThemedIcon(child));
|
|
48
|
+
return forceMount || (0, import_utils.isIndeterminate)(context.state) || context.state === !0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
|
+
CheckboxIndicatorFrame,
|
|
50
|
+
{
|
|
51
|
+
"data-state": (0, import_utils.getState)(context.state),
|
|
52
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
53
|
+
pointerEvents: "none",
|
|
54
|
+
...indicatorProps,
|
|
55
|
+
ref: forwardedRef,
|
|
56
|
+
children
|
|
57
|
+
}
|
|
58
|
+
) : null;
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
CheckboxIndicator.displayName = INDICATOR_NAME;
|
|
63
|
+
const Checkbox = (0, import_core.withStaticProperties)(import_Checkbox.CheckboxComponent, {
|
|
64
|
+
Indicator: CheckboxIndicator,
|
|
65
|
+
Props: import_CheckboxStyledContext.CheckboxStyledContext.Provider
|
|
66
|
+
});
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
Checkbox
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=CheckboxIndicator.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/CheckboxIndicator.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAMO,0BACP,mBAA4B,+BAE5B,yBAAiC,qCACjC,gBAA+B,4BAC/B,QAAuB,2BAEvB,kBAKO,uBACP,+BAAsC,oCACtC,eAA0C,oBAuEhC;AAxDV,MAAM,iBAAiB,qBAEjB,6BAAyB,oBAAO,8BAAgB;AAAA;AAAA,EAEpD,MAAM;AAAA,EACN,SAAS;AACX,CAAC,GAgBK,oBAAoB,uBAAuB;AAAA,EAC/C,MAAM;AAAA,IACJ,CAAC,OAA4C,iBAAiB;AAC5D,YAAM;AAAA,QACJ;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MACL,IAAI;AACJ,MAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,gBAC7C,QAAQ;AAAA,QACN;AAAA,MACF;AAEF,YAAM,cAAU,oCAAmB,gBAAgB,eAAe,GAC5D,gBAAgB,MAAM,WAAW,kDAAqB,GACtD,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,GAGvE,WADY,MAAM,SAAS,QAAQ,YAAY,EAC1B,IAAI,CAAC,UAC1B,qBAAqB,CAAC,MAAM,eAAe,KAAK,IAC3C,QAEF,cAAc,KAAK,CAC3B;AAED,aAAI,kBAAc,8BAAgB,QAAQ,KAAK,KAAK,QAAQ,UAAU,KAElE;AAAA,QAAC;AAAA;AAAA,UACC,kBAAY,uBAAS,QAAQ,KAAK;AAAA,UAClC,iBAAe,QAAQ,WAAW,KAAK;AAAA,UACvC,eAAc;AAAA,UACb,GAAG;AAAA,UACJ,KAAK;AAAA,UAEJ;AAAA;AAAA,MACH,IAGG;AAAA,IACT;AAAA,EACF;AACF;AAEA,kBAAkB,cAAc;AAEzB,MAAM,eAAW,kCAAqB,mCAAmB;AAAA,EAC9D,WAAW;AAAA,EACX,OAAO,mDAAsB;AAC/B,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
CheckboxStyledContext
|
|
28
|
+
});
|
|
29
|
+
//# 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,189 @@
|
|
|
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 ScopedProps_exports = {};
|
|
24
|
+
__export(ScopedProps_exports, {
|
|
25
|
+
CheckboxComponent: () => CheckboxComponent,
|
|
26
|
+
CheckboxFrame: () => CheckboxFrame,
|
|
27
|
+
CheckboxProvider: () => CheckboxProvider,
|
|
28
|
+
createCheckboxScope: () => createCheckboxScope,
|
|
29
|
+
useCheckboxContext: () => useCheckboxContext
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(ScopedProps_exports);
|
|
32
|
+
var import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_focusable = require("@tamagui/focusable"), import_get_token = require("@tamagui/get-token"), import_label = require("@tamagui/label"), import_stacks = require("@tamagui/stacks"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_BubbleInput = require("./BubbleInput"), import_CheckboxStyledContext = require("./CheckboxStyledContext"), import_isIndeterminate = require("./isIndeterminate"), import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
const CHECKBOX_NAME = "Checkbox", CheckboxFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
34
|
+
name: CHECKBOX_NAME,
|
|
35
|
+
tag: "button",
|
|
36
|
+
context: import_CheckboxStyledContext.CheckboxStyledContext,
|
|
37
|
+
variants: {
|
|
38
|
+
unstyled: {
|
|
39
|
+
false: {
|
|
40
|
+
size: "$true",
|
|
41
|
+
backgroundColor: "$background",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
pressTheme: !0,
|
|
45
|
+
focusable: !0,
|
|
46
|
+
borderWidth: 1,
|
|
47
|
+
borderColor: "$borderColor",
|
|
48
|
+
hoverStyle: {
|
|
49
|
+
borderColor: "$borderColorHover"
|
|
50
|
+
},
|
|
51
|
+
focusStyle: {
|
|
52
|
+
borderColor: "$borderColorFocus",
|
|
53
|
+
outlineStyle: "solid",
|
|
54
|
+
outlineWidth: 2,
|
|
55
|
+
outlineColor: "$borderColorFocus"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
disabled: {
|
|
60
|
+
true: {
|
|
61
|
+
pointerEvents: "none",
|
|
62
|
+
userSelect: "none",
|
|
63
|
+
cursor: "not-allowed",
|
|
64
|
+
hoverStyle: {
|
|
65
|
+
borderColor: "$borderColor",
|
|
66
|
+
backgroundColor: "$background"
|
|
67
|
+
},
|
|
68
|
+
pressStyle: {
|
|
69
|
+
borderColor: "$borderColor",
|
|
70
|
+
backgroundColor: "$backgroundColor"
|
|
71
|
+
},
|
|
72
|
+
focusStyle: {
|
|
73
|
+
outlineWidth: 0
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
size: {
|
|
78
|
+
"...size": (val, { tokens }) => ({
|
|
79
|
+
borderRadius: (0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) / 8
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
defaultVariants: {
|
|
84
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
85
|
+
}
|
|
86
|
+
}), [createCheckboxContext, createCheckboxScope] = (0, import_create_context.createContextScope)(CHECKBOX_NAME), [CheckboxProvider, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME), CheckboxComponent = CheckboxFrame.styleable(
|
|
87
|
+
function(props, forwardedRef) {
|
|
88
|
+
const {
|
|
89
|
+
__scopeCheckbox,
|
|
90
|
+
labelledBy: ariaLabelledby,
|
|
91
|
+
name,
|
|
92
|
+
checked: checkedProp,
|
|
93
|
+
defaultChecked,
|
|
94
|
+
required,
|
|
95
|
+
scaleSize = 0.45,
|
|
96
|
+
sizeAdjust = 0,
|
|
97
|
+
disabled,
|
|
98
|
+
value = "on",
|
|
99
|
+
onCheckedChange,
|
|
100
|
+
native,
|
|
101
|
+
scaleIcon,
|
|
102
|
+
...checkboxProps
|
|
103
|
+
} = props, [button, setButton] = React.useState(null), composedRefs = (0, import_core.useComposedRefs)(forwardedRef, (node) => setButton(node)), hasConsumerStoppedPropagationRef = React.useRef(!1), propsActive = (0, import_core.useProps)(props), isFormControl = import_core.isWeb ? button ? !!button.closest("form") : !0 : !1, [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
|
|
104
|
+
prop: checkedProp,
|
|
105
|
+
defaultProp: defaultChecked,
|
|
106
|
+
onChange: onCheckedChange
|
|
107
|
+
}), styledContext = React.useContext(import_CheckboxStyledContext.CheckboxStyledContext), adjustedSize = (0, import_core.getVariableValue)(
|
|
108
|
+
(0, import_get_token.getSize)(propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true", {
|
|
109
|
+
shift: sizeAdjust
|
|
110
|
+
})
|
|
111
|
+
), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize, labelId = (0, import_label.useLabelContext)(button);
|
|
112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckboxProvider, { scope: __scopeCheckbox, state: checked, disabled, children: import_core.isWeb && native ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
113
|
+
import_BubbleInput.BubbleInput,
|
|
114
|
+
{
|
|
115
|
+
control: button,
|
|
116
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
117
|
+
name,
|
|
118
|
+
value,
|
|
119
|
+
checked,
|
|
120
|
+
required,
|
|
121
|
+
disabled,
|
|
122
|
+
id: props.id
|
|
123
|
+
}
|
|
124
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
126
|
+
CheckboxFrame,
|
|
127
|
+
{
|
|
128
|
+
width: size,
|
|
129
|
+
height: size,
|
|
130
|
+
tag: "button",
|
|
131
|
+
role: "checkbox",
|
|
132
|
+
"aria-labelledby": ariaLabelledby || labelId,
|
|
133
|
+
"aria-checked": (0, import_isIndeterminate.isIndeterminate)(checked) ? "mixed" : checked,
|
|
134
|
+
"aria-required": required,
|
|
135
|
+
"data-state": (0, import_isIndeterminate.getState)(checked),
|
|
136
|
+
"data-disabled": disabled ? "" : void 0,
|
|
137
|
+
disabled,
|
|
138
|
+
...checkboxProps,
|
|
139
|
+
ref: composedRefs,
|
|
140
|
+
...import_core.isWeb && {
|
|
141
|
+
type: "button",
|
|
142
|
+
value,
|
|
143
|
+
onKeyDown: (0, import_core.composeEventHandlers)(
|
|
144
|
+
props.onKeyDown,
|
|
145
|
+
(event) => {
|
|
146
|
+
event.key === "Enter" && event.preventDefault();
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
},
|
|
150
|
+
onPress: (0, import_core.composeEventHandlers)(props.onPress, (event) => {
|
|
151
|
+
setChecked(
|
|
152
|
+
(prevChecked) => (0, import_isIndeterminate.isIndeterminate)(prevChecked) ? !0 : !prevChecked
|
|
153
|
+
), isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
154
|
+
}),
|
|
155
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
+
import_CheckboxStyledContext.CheckboxStyledContext.Provider,
|
|
157
|
+
{
|
|
158
|
+
size: propsActive.size ?? (styledContext == null ? void 0 : styledContext.size) ?? "$true",
|
|
159
|
+
scaleIcon: scaleIcon ?? (styledContext == null ? void 0 : styledContext.scaleIcon) ?? 1,
|
|
160
|
+
children: propsActive.children
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
import_core.isWeb && isFormControl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
166
|
+
import_BubbleInput.BubbleInput,
|
|
167
|
+
{
|
|
168
|
+
isHidden: !0,
|
|
169
|
+
control: button,
|
|
170
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
171
|
+
name,
|
|
172
|
+
value,
|
|
173
|
+
checked,
|
|
174
|
+
required,
|
|
175
|
+
disabled
|
|
176
|
+
}
|
|
177
|
+
) : null
|
|
178
|
+
] }) });
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
182
|
+
0 && (module.exports = {
|
|
183
|
+
CheckboxComponent,
|
|
184
|
+
CheckboxFrame,
|
|
185
|
+
CheckboxProvider,
|
|
186
|
+
createCheckboxScope,
|
|
187
|
+
useCheckboxContext
|
|
188
|
+
});
|
|
189
|
+
//# sourceMappingURL=ScopedProps.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ScopedProps.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAQO,0BAEP,wBAAmC,oCACnC,mBAAkC,+BAClC,mBAAwB,+BACxB,eAAgC,2BAChC,gBAA+B,4BAC/B,gCAAqC,4CACrC,QAAuB,2BAEvB,qBAA4B,0BAC5B,+BAAsC,oCACtC,yBAA0C,8BA4KhC;AArKV,MAAM,gBAAgB,YAET,oBAAgB,oBAAO,8BAAgB;AAAA,EAClD,MAAM;AAAA,EACN,KAAK;AAAA,EAEL,SAAS;AAAA,EACT,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,iBAAiB;AAAA,QACjB,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,aAAa;AAAA,QACb,aAAa;AAAA,QAEb,YAAY;AAAA,UACV,aAAa;AAAA,QACf;AAAA,QAEA,YAAY;AAAA,UACV,aAAa;AAAA,UACb,cAAc;AAAA,UACd,cAAc;AAAA,UACd,cAAc;AAAA,QAChB;AAAA,MACF;AAAA,IACF;AAAA,IAEA,UAAU;AAAA,MACR,MA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