@tamagui/checkbox-headless 1.89.26 → 1.89.27-1708113113238
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.native.js +88 -33
- package/dist/cjs/BubbleInput.native.js.map +3 -3
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/cjs/useCheckbox.native.js +140 -49
- package/dist/cjs/useCheckbox.native.js.map +3 -3
- package/dist/cjs/utils.native.js.map +3 -3
- package/dist/esm/BubbleInput.native.js +87 -33
- package/dist/esm/BubbleInput.native.js.map +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/useCheckbox.native.js +139 -49
- package/dist/esm/useCheckbox.native.js.map +3 -3
- package/dist/esm/utils.native.js.map +3 -3
- package/dist/jsx/BubbleInput.native.js +87 -33
- package/dist/jsx/BubbleInput.native.js.map +3 -3
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/useCheckbox.native.js +139 -49
- package/dist/jsx/useCheckbox.native.js.map +3 -3
- package/dist/jsx/utils.native.js.map +3 -3
- package/package.json +10 -10
|
@@ -26,42 +26,97 @@ __export(BubbleInput_exports, {
|
|
|
26
26
|
BubbleInput: () => BubbleInput
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(BubbleInput_exports);
|
|
29
|
-
var import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react")), import_utils = require("./utils")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
var import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react")), import_utils = require("./utils");
|
|
30
|
+
function _define_property(obj, key, value) {
|
|
31
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
32
|
+
value,
|
|
33
|
+
enumerable: !0,
|
|
34
|
+
configurable: !0,
|
|
35
|
+
writable: !0
|
|
36
|
+
}) : obj[key] = value, obj;
|
|
37
|
+
}
|
|
38
|
+
function _object_spread(target) {
|
|
39
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
40
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
41
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
42
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
43
|
+
}))), ownKeys2.forEach(function(key) {
|
|
44
|
+
_define_property(target, key, source[key]);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
}
|
|
49
|
+
function ownKeys(object, enumerableOnly) {
|
|
50
|
+
var keys = Object.keys(object);
|
|
51
|
+
if (Object.getOwnPropertySymbols) {
|
|
52
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
53
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
54
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
55
|
+
})), keys.push.apply(keys, symbols);
|
|
56
|
+
}
|
|
57
|
+
return keys;
|
|
58
|
+
}
|
|
59
|
+
function _object_spread_props(target, source) {
|
|
60
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
61
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
62
|
+
}), target;
|
|
63
|
+
}
|
|
64
|
+
function _object_without_properties(source, excluded) {
|
|
65
|
+
if (source == null)
|
|
66
|
+
return {};
|
|
67
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
68
|
+
if (Object.getOwnPropertySymbols) {
|
|
69
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
70
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
71
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
72
|
+
}
|
|
73
|
+
return target;
|
|
74
|
+
}
|
|
75
|
+
function _object_without_properties_loose(source, excluded) {
|
|
76
|
+
if (source == null)
|
|
77
|
+
return {};
|
|
78
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
79
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
80
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
81
|
+
return target;
|
|
82
|
+
}
|
|
83
|
+
var BubbleInput = function(props) {
|
|
84
|
+
var checked = props.checked, _props_bubbles = props.bubbles, bubbles = _props_bubbles === void 0 ? !0 : _props_bubbles, control = props.control, isHidden = props.isHidden, inputProps = _object_without_properties(props, [
|
|
85
|
+
"checked",
|
|
86
|
+
"bubbles",
|
|
87
|
+
"control",
|
|
88
|
+
"isHidden"
|
|
89
|
+
]), ref = React.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
90
|
+
return React.useEffect(function() {
|
|
91
|
+
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
37
92
|
if (prevChecked !== checked && setChecked) {
|
|
38
|
-
|
|
93
|
+
var event = new Event("click", {
|
|
94
|
+
bubbles
|
|
95
|
+
});
|
|
39
96
|
input.indeterminate = (0, import_utils.isIndeterminate)(checked), setChecked.call(input, (0, import_utils.isIndeterminate)(checked) ? !1 : checked), input.dispatchEvent(event);
|
|
40
97
|
}
|
|
41
|
-
}, [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
);
|
|
98
|
+
}, [
|
|
99
|
+
prevChecked,
|
|
100
|
+
checked,
|
|
101
|
+
bubbles
|
|
102
|
+
]), /* @__PURE__ */ React.createElement("input", _object_spread_props(_object_spread({
|
|
103
|
+
type: "checkbox",
|
|
104
|
+
defaultChecked: (0, import_utils.isIndeterminate)(checked) ? !1 : checked
|
|
105
|
+
}, inputProps), {
|
|
106
|
+
tabIndex: -1,
|
|
107
|
+
ref,
|
|
108
|
+
"aria-hidden": isHidden,
|
|
109
|
+
style: _object_spread({}, isHidden ? {
|
|
110
|
+
// ...controlSize,
|
|
111
|
+
position: "absolute",
|
|
112
|
+
pointerEvents: "none",
|
|
113
|
+
opacity: 0,
|
|
114
|
+
margin: 0
|
|
115
|
+
} : {
|
|
116
|
+
appearance: "auto",
|
|
117
|
+
accentColor: "var(--color6)"
|
|
118
|
+
}, props.style)
|
|
119
|
+
}));
|
|
65
120
|
};
|
|
66
121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67
122
|
0 && (module.exports = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/BubbleInput.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/BubbleInput.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0BAA4B,kCAC5B,QAAuB,2BAGvB,eAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUzB,IAAMA,cAAc,SAACC,OAAAA;AAC1B,MAAQC,UAA8DD,MAA9DC,SAAAA,iBAA8DD,MAArDE,SAAAA,UAAAA,mBAAAA,SAAU,KAAA,gBAAMC,UAAqCH,MAArCG,SAASC,WAA4BJ,MAA5BI,UAAaC,aAAAA,2BAAeL,OAAAA;IAA9DC;IAASC;IAAgBC;IAASC;MACpCE,MAAMC,MAAMC,OAAyB,IAAA,GACrCC,kBAAcC,iCAAYT,OAAAA;AAGhCM,eAAMI,UAAU,WAAA;AACd,QAAMC,QAAQN,IAAIO,SACZC,aAAaC,OAAOC,iBAAiBC,WACrCC,aAAaC,OAAOC,yBACxBN,YACA,SAAA,GAEIO,aAAaH,WAAWI;AAE9B,QAAIb,gBAAgBR,WAAWoB,YAAY;AACzC,UAAME,QAAQ,IAAIC,MAAM,SAAS;QAAEtB;MAAQ,CAAA;AAC3CU,YAAMa,oBAAgBC,8BAAgBzB,OAAAA,GACtCoB,WAAWM,KAAKf,WAAOc,8BAAgBzB,OAAAA,IAAW,KAAQA,OAAAA,GAC1DW,MAAMgB,cAAcL,KAAAA;IACtB;EACF,GAAG;IAACd;IAAaR;IAASC;GAAQ,GAGhC,sBAAA,cAACU,SAAAA,qBAAAA,eAAAA;IACCiB,MAAK;IACLC,oBAAgBJ,8BAAgBzB,OAAAA,IAAW,KAAQA;KAC/CI,UAAAA,GAAAA;IACJ0B,UAAU;IACVzB;IACA0B,eAAa5B;IACb6B,OAAO,eAAA,CAAA,GACD7B,WACA;;MAEE8B,UAAU;MACVC,eAAe;MACfC,SAAS;MACTC,QAAQ;IACV,IACA;MACEC,YAAY;MACZC,aAAa;IACf,GAEDvC,MAAMiC,KAAK;;AAItB;",
|
|
5
|
+
"names": ["BubbleInput", "props", "checked", "bubbles", "control", "isHidden", "inputProps", "ref", "React", "useRef", "prevChecked", "usePrevious", "useEffect", "input", "current", "inputProto", "window", "HTMLInputElement", "prototype", "descriptor", "Object", "getOwnPropertyDescriptor", "setChecked", "set", "event", "Event", "indeterminate", "isIndeterminate", "call", "dispatchEvent", "type", "defaultChecked", "tabIndex", "aria-hidden", "style", "position", "pointerEvents", "opacity", "margin", "appearance", "accentColor"]
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;AAAA
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;AAAA;;wBAAc,0BAAd;AACA,wBAAc,oBADd;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -26,59 +26,150 @@ __export(useCheckbox_exports, {
|
|
|
26
26
|
useCheckbox: () => useCheckbox
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(useCheckbox_exports);
|
|
29
|
-
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")
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
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");
|
|
30
|
+
function _array_like_to_array(arr, len) {
|
|
31
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
32
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
33
|
+
arr2[i] = arr[i];
|
|
34
|
+
return arr2;
|
|
35
|
+
}
|
|
36
|
+
function _array_with_holes(arr) {
|
|
37
|
+
if (Array.isArray(arr))
|
|
38
|
+
return arr;
|
|
39
|
+
}
|
|
40
|
+
function _define_property(obj, key, value) {
|
|
41
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
42
|
+
value,
|
|
43
|
+
enumerable: !0,
|
|
44
|
+
configurable: !0,
|
|
45
|
+
writable: !0
|
|
46
|
+
}) : obj[key] = value, obj;
|
|
47
|
+
}
|
|
48
|
+
function _iterable_to_array_limit(arr, i) {
|
|
49
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
50
|
+
if (_i != null) {
|
|
51
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
52
|
+
try {
|
|
53
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
54
|
+
;
|
|
55
|
+
} catch (err) {
|
|
56
|
+
_d = !0, _e = err;
|
|
57
|
+
} finally {
|
|
58
|
+
try {
|
|
59
|
+
!_n && _i.return != null && _i.return();
|
|
60
|
+
} finally {
|
|
61
|
+
if (_d)
|
|
62
|
+
throw _e;
|
|
52
63
|
}
|
|
53
|
-
|
|
64
|
+
}
|
|
65
|
+
return _arr;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function _non_iterable_rest() {
|
|
69
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
70
|
+
}
|
|
71
|
+
function _object_spread(target) {
|
|
72
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
73
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
74
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
75
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
76
|
+
}))), ownKeys2.forEach(function(key) {
|
|
77
|
+
_define_property(target, key, source[key]);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return target;
|
|
81
|
+
}
|
|
82
|
+
function ownKeys(object, enumerableOnly) {
|
|
83
|
+
var keys = Object.keys(object);
|
|
84
|
+
if (Object.getOwnPropertySymbols) {
|
|
85
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
86
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
87
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
88
|
+
})), keys.push.apply(keys, symbols);
|
|
89
|
+
}
|
|
90
|
+
return keys;
|
|
91
|
+
}
|
|
92
|
+
function _object_spread_props(target, source) {
|
|
93
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
94
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
95
|
+
}), target;
|
|
96
|
+
}
|
|
97
|
+
function _object_without_properties(source, excluded) {
|
|
98
|
+
if (source == null)
|
|
99
|
+
return {};
|
|
100
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
101
|
+
if (Object.getOwnPropertySymbols) {
|
|
102
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
103
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
104
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
105
|
+
}
|
|
106
|
+
return target;
|
|
107
|
+
}
|
|
108
|
+
function _object_without_properties_loose(source, excluded) {
|
|
109
|
+
if (source == null)
|
|
110
|
+
return {};
|
|
111
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
112
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
113
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
114
|
+
return target;
|
|
115
|
+
}
|
|
116
|
+
function _sliced_to_array(arr, i) {
|
|
117
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
118
|
+
}
|
|
119
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
120
|
+
if (o) {
|
|
121
|
+
if (typeof o == "string")
|
|
122
|
+
return _array_like_to_array(o, minLen);
|
|
123
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
124
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
125
|
+
return Array.from(n);
|
|
126
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
127
|
+
return _array_like_to_array(o, minLen);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function useCheckbox(props, param, ref) {
|
|
131
|
+
var _param = _sliced_to_array(param, 2), checked = _param[0], setChecked = _param[1], ariaLabelledby = props.labelledBy, name = props.name, required = props.required, disabled = props.disabled, _props_value = props.value, value = _props_value === void 0 ? "on" : _props_value, onCheckedChange = props.onCheckedChange, checkboxProps = _object_without_properties(props, [
|
|
132
|
+
"labelledBy",
|
|
133
|
+
"name",
|
|
134
|
+
"required",
|
|
135
|
+
"disabled",
|
|
136
|
+
"value",
|
|
137
|
+
"onCheckedChange"
|
|
138
|
+
]), _React_useState = _sliced_to_array(import_react.default.useState(null), 2), button = _React_useState[0], setButton = _React_useState[1], composedRefs = (0, import_compose_refs.useComposedRefs)(ref, function(node) {
|
|
139
|
+
return setButton(node);
|
|
140
|
+
}), 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;
|
|
141
|
+
return {
|
|
142
|
+
bubbleInput: import_constants.isWeb && isFormControl ? /* @__PURE__ */ import_react.default.createElement(import_BubbleInput.BubbleInput, {
|
|
143
|
+
isHidden: !0,
|
|
144
|
+
control: button,
|
|
145
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
146
|
+
name,
|
|
147
|
+
value,
|
|
148
|
+
checked,
|
|
149
|
+
required,
|
|
150
|
+
disabled
|
|
151
|
+
}) : null,
|
|
54
152
|
checkboxRef: composedRefs,
|
|
55
|
-
checkboxProps: {
|
|
153
|
+
checkboxProps: _object_spread_props(_object_spread({
|
|
56
154
|
role: "checkbox",
|
|
57
155
|
"aria-labelledby": labelledBy,
|
|
58
|
-
"aria-checked": (0, import_utils.isIndeterminate)(checked) ? "mixed" : checked
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
(event) => {
|
|
76
|
-
setChecked(
|
|
77
|
-
(prevChecked) => (0, import_utils.isIndeterminate)(prevChecked) ? !0 : !prevChecked
|
|
78
|
-
), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
79
|
-
}
|
|
80
|
-
)
|
|
81
|
-
}
|
|
156
|
+
"aria-checked": (0, import_utils.isIndeterminate)(checked) ? "mixed" : checked
|
|
157
|
+
}, checkboxProps, import_constants.isWeb && {
|
|
158
|
+
type: "button",
|
|
159
|
+
value,
|
|
160
|
+
"data-state": (0, import_utils.getState)(checked),
|
|
161
|
+
"data-disabled": disabled ? "" : void 0,
|
|
162
|
+
disabled,
|
|
163
|
+
onKeyDown: (0, import_helpers.composeEventHandlers)(props.onKeyDown, function(event) {
|
|
164
|
+
event.key === "Enter" && event.preventDefault();
|
|
165
|
+
})
|
|
166
|
+
}), {
|
|
167
|
+
onPress: (0, import_helpers.composeEventHandlers)(props.onPress, function(event) {
|
|
168
|
+
setChecked(function(prevChecked) {
|
|
169
|
+
return (0, import_utils.isIndeterminate)(prevChecked) ? !0 : !prevChecked;
|
|
170
|
+
}), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
171
|
+
})
|
|
172
|
+
})
|
|
82
173
|
};
|
|
83
174
|
}
|
|
84
175
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/useCheckbox.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["React"]
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/useCheckbox.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0BAAgC,kCAChC,mBAAsB,+BAEtB,iBAAqC,6BACrC,eAAgC,2BAChC,eAAkB,2BAGlB,qBAA4B,0BAC5B,eAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBnC,SAASA,YACdC,OACA,OAIAC,KAAiB;MAJjB,SAAA,iBAAA,OAAA,CAAA,GAACC,UAAD,OAAA,CAAA,GAAUC,aAAV,OAAA,CAAA,GAOcC,iBAOVJ,MAPFK,YACAC,OAMEN,MANFM,MACAC,WAKEP,MALFO,UACAC,WAIER,MAJFQ,UAAAA,eAIER,MAHFS,OAAAA,QAAAA,iBAAAA,SAAQ,OAAA,cACRC,kBAEEV,MAFFU,iBACGC,gBAAAA,2BACDX,OAAAA;IAPFK;IACAC;IACAC;IACAC;IACAC;IACAC;MAG0BE,kBAAAA,iBAAAA,aAAAA,QAAMC,SAAmC,IAAA,GAAA,CAAA,GAA9DC,SAAqBF,gBAAAA,CAAAA,GAAbG,YAAaH,gBAAAA,CAAAA,GACtBI,mBAAeC,qCAAgBhB,KAAK,SAACiB,MAAAA;WAASH,UAAUG,IAAAA;MACxDC,mCAAmCP,aAAAA,QAAMQ,OAAO,EAAA,GAEhDC,gBAAgBC,yBAASR,SAASS,EAAQT,OAAOU,QAAQ,MAAA,IAAW,KAAQ,IAE5EC,cAAUC,8BAAgBZ,MAAAA,GAC1BT,aAAaD,kBAAkBqB;AAErC,SAAO;IACLE,aACEL,0BAASD,gBACP,6BAAAT,QAAA,cAACgB,gCAAAA;MACCC,UAAAA;MACAC,SAAShB;MACTiB,SAAS,CAACZ,iCAAiCa;MAC3C1B;MACAG;MACAP;MACAK;MACAC;SAEA;IACNyB,aAAajB;IACbL,eAAe,qBAAA,eAAA;MACbuB,MAAM;MACN,mBAAmB7B;MACnB,oBAAgB8B,8BAAgBjC,OAAAA,IAAW,UAAUA;OAClDS,eACCW,0BAAS;MACXc,MAAM;MACN3B;MACA,kBAAc4B,uBAASnC,OAAAA;MACvB,iBAAiBM,WAAW,KAAK8B;MACjC9B;MACA+B,eAAWC,qCACRxC,MAA6CuC,WAC9C,SAACE,OAAAA;AAEC,QAAIA,MAAMC,QAAQ,WAASD,MAAME,eAAc;MACjD,CAAA;IAEJ,CAAA,GAAA;MACAC,aAASJ,qCACPxC,MAAM4C,SACN,SAACH,OAAAA;AACCtC,mBAAW,SAAC0C,aAAAA;qBACVV,8BAAgBU,WAAAA,IAAe,KAAO,CAACA;YAErCxB,iBAAiB,0BAA0BoB,UAC7CtB,iCAAiCa,UAAUS,MAAMK,qBAAoB,GAIhE3B,iCAAiCa,WAASS,MAAMM,gBAAe;MAExE,CAAA;;EAGN;AACF;",
|
|
5
|
+
"names": ["useCheckbox", "props", "ref", "checked", "setChecked", "ariaLabelledby", "labelledBy", "name", "required", "disabled", "value", "onCheckedChange", "checkboxProps", "React", "useState", "button", "setButton", "composedRefs", "useComposedRefs", "node", "hasConsumerStoppedPropagationRef", "useRef", "isFormControl", "isWeb", "Boolean", "closest", "labelId", "useLabelContext", "bubbleInput", "BubbleInput", "isHidden", "control", "bubbles", "current", "checkboxRef", "role", "isIndeterminate", "type", "getState", "undefined", "onKeyDown", "composeEventHandlers", "event", "key", "preventDefault", "onPress", "prevChecked", "isPropagationStopped", "stopPropagation"]
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/utils.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAEA;;;;;;AAAO,SAASA,gBAAgBC,SAAsB;AACpD,SAAOA,YAAY;AACrB;AAEO,SAASC,SAASD,SAAqB;AAC5C,SAAOD,gBAAgBC,OAAAA,IAAW,kBAAkBA,UAAU,YAAY;AAC5E;",
|
|
5
|
+
"names": ["isIndeterminate", "checked", "getState"]
|
|
6
6
|
}
|
|
@@ -1,42 +1,96 @@
|
|
|
1
1
|
import { usePrevious } from "@tamagui/use-previous";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { isIndeterminate } from "./utils";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
function _define_property(obj, key, value) {
|
|
5
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
6
|
+
value,
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
configurable: !0,
|
|
9
|
+
writable: !0
|
|
10
|
+
}) : obj[key] = value, obj;
|
|
11
|
+
}
|
|
12
|
+
function _object_spread(target) {
|
|
13
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
15
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
16
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
17
|
+
}))), ownKeys2.forEach(function(key) {
|
|
18
|
+
_define_property(target, key, source[key]);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return target;
|
|
22
|
+
}
|
|
23
|
+
function ownKeys(object, enumerableOnly) {
|
|
24
|
+
var keys = Object.keys(object);
|
|
25
|
+
if (Object.getOwnPropertySymbols) {
|
|
26
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
27
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
28
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
29
|
+
})), keys.push.apply(keys, symbols);
|
|
30
|
+
}
|
|
31
|
+
return keys;
|
|
32
|
+
}
|
|
33
|
+
function _object_spread_props(target, source) {
|
|
34
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
35
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
36
|
+
}), target;
|
|
37
|
+
}
|
|
38
|
+
function _object_without_properties(source, excluded) {
|
|
39
|
+
if (source == null)
|
|
40
|
+
return {};
|
|
41
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
42
|
+
if (Object.getOwnPropertySymbols) {
|
|
43
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
44
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
45
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
}
|
|
49
|
+
function _object_without_properties_loose(source, excluded) {
|
|
50
|
+
if (source == null)
|
|
51
|
+
return {};
|
|
52
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
53
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
54
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
55
|
+
return target;
|
|
56
|
+
}
|
|
57
|
+
var BubbleInput = function(props) {
|
|
58
|
+
var checked = props.checked, _props_bubbles = props.bubbles, bubbles = _props_bubbles === void 0 ? !0 : _props_bubbles, control = props.control, isHidden = props.isHidden, inputProps = _object_without_properties(props, [
|
|
59
|
+
"checked",
|
|
60
|
+
"bubbles",
|
|
61
|
+
"control",
|
|
62
|
+
"isHidden"
|
|
63
|
+
]), ref = React.useRef(null), prevChecked = usePrevious(checked);
|
|
64
|
+
return React.useEffect(function() {
|
|
65
|
+
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
12
66
|
if (prevChecked !== checked && setChecked) {
|
|
13
|
-
|
|
67
|
+
var event = new Event("click", {
|
|
68
|
+
bubbles
|
|
69
|
+
});
|
|
14
70
|
input.indeterminate = isIndeterminate(checked), setChecked.call(input, isIndeterminate(checked) ? !1 : checked), input.dispatchEvent(event);
|
|
15
71
|
}
|
|
16
|
-
}, [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
);
|
|
72
|
+
}, [
|
|
73
|
+
prevChecked,
|
|
74
|
+
checked,
|
|
75
|
+
bubbles
|
|
76
|
+
]), /* @__PURE__ */ React.createElement("input", _object_spread_props(_object_spread({
|
|
77
|
+
type: "checkbox",
|
|
78
|
+
defaultChecked: isIndeterminate(checked) ? !1 : checked
|
|
79
|
+
}, inputProps), {
|
|
80
|
+
tabIndex: -1,
|
|
81
|
+
ref,
|
|
82
|
+
"aria-hidden": isHidden,
|
|
83
|
+
style: _object_spread({}, isHidden ? {
|
|
84
|
+
// ...controlSize,
|
|
85
|
+
position: "absolute",
|
|
86
|
+
pointerEvents: "none",
|
|
87
|
+
opacity: 0,
|
|
88
|
+
margin: 0
|
|
89
|
+
} : {
|
|
90
|
+
appearance: "auto",
|
|
91
|
+
accentColor: "var(--color6)"
|
|
92
|
+
}, props.style)
|
|
93
|
+
}));
|
|
40
94
|
};
|
|
41
95
|
export {
|
|
42
96
|
BubbleInput
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/BubbleInput.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/BubbleInput.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,mBAAmB;AAC5B,YAAYC,WAAW;AAGvB,SAASC,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUzB,IAAMC,cAAc,SAACC,OAAAA;AAC1B,MAAQC,UAA8DD,MAA9DC,SAAAA,iBAA8DD,MAArDE,SAAAA,UAAAA,mBAAAA,SAAU,KAAA,gBAAMC,UAAqCH,MAArCG,SAASC,WAA4BJ,MAA5BI,UAAaC,aAAAA,2BAAeL,OAAAA;IAA9DC;IAASC;IAAgBC;IAASC;MACpCE,MAAMT,MAAMU,OAAyB,IAAA,GACrCC,cAAcZ,YAAYK,OAAAA;AAGhCJ,eAAMY,UAAU,WAAA;AACd,QAAMC,QAAQJ,IAAIK,SACZC,aAAaC,OAAOC,iBAAiBC,WACrCC,aAAaC,OAAOC,yBACxBN,YACA,SAAA,GAEIO,aAAaH,WAAWI;AAE9B,QAAIZ,gBAAgBP,WAAWkB,YAAY;AACzC,UAAME,QAAQ,IAAIC,MAAM,SAAS;QAAEpB;MAAQ,CAAA;AAC3CQ,YAAMa,gBAAgBzB,gBAAgBG,OAAAA,GACtCkB,WAAWK,KAAKd,OAAOZ,gBAAgBG,OAAAA,IAAW,KAAQA,OAAAA,GAC1DS,MAAMe,cAAcJ,KAAAA;IACtB;EACF,GAAG;IAACb;IAAaP;IAASC;GAAQ,GAGhC,sBAAA,cAACQ,SAAAA,qBAAAA,eAAAA;IACCgB,MAAK;IACLC,gBAAgB7B,gBAAgBG,OAAAA,IAAW,KAAQA;KAC/CI,UAAAA,GAAAA;IACJuB,UAAU;IACVtB;IACAuB,eAAazB;IACb0B,OAAO,eAAA,CAAA,GACD1B,WACA;;MAEE2B,UAAU;MACVC,eAAe;MACfC,SAAS;MACTC,QAAQ;IACV,IACA;MACEC,YAAY;MACZC,aAAa;IACf,GAEDpC,MAAM8B,KAAK;;AAItB;",
|
|
5
|
+
"names": ["usePrevious", "React", "isIndeterminate", "BubbleInput", "props", "checked", "bubbles", "control", "isHidden", "inputProps", "ref", "useRef", "prevChecked", "useEffect", "input", "current", "inputProto", "window", "HTMLInputElement", "prototype", "descriptor", "Object", "getOwnPropertyDescriptor", "setChecked", "set", "event", "Event", "indeterminate", "call", "dispatchEvent", "type", "defaultChecked", "tabIndex", "aria-hidden", "style", "position", "pointerEvents", "opacity", "margin", "appearance", "accentColor"]
|
|
6
6
|
}
|
|
@@ -5,59 +5,149 @@ import { useLabelContext } from "@tamagui/label";
|
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { BubbleInput } from "./BubbleInput";
|
|
7
7
|
import { getState, isIndeterminate } from "./utils";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
8
|
+
function _array_like_to_array(arr, len) {
|
|
9
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
10
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
11
|
+
arr2[i] = arr[i];
|
|
12
|
+
return arr2;
|
|
13
|
+
}
|
|
14
|
+
function _array_with_holes(arr) {
|
|
15
|
+
if (Array.isArray(arr))
|
|
16
|
+
return arr;
|
|
17
|
+
}
|
|
18
|
+
function _define_property(obj, key, value) {
|
|
19
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
20
|
+
value,
|
|
21
|
+
enumerable: !0,
|
|
22
|
+
configurable: !0,
|
|
23
|
+
writable: !0
|
|
24
|
+
}) : obj[key] = value, obj;
|
|
25
|
+
}
|
|
26
|
+
function _iterable_to_array_limit(arr, i) {
|
|
27
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
28
|
+
if (_i != null) {
|
|
29
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
30
|
+
try {
|
|
31
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
32
|
+
;
|
|
33
|
+
} catch (err) {
|
|
34
|
+
_d = !0, _e = err;
|
|
35
|
+
} finally {
|
|
36
|
+
try {
|
|
37
|
+
!_n && _i.return != null && _i.return();
|
|
38
|
+
} finally {
|
|
39
|
+
if (_d)
|
|
40
|
+
throw _e;
|
|
31
41
|
}
|
|
32
|
-
|
|
42
|
+
}
|
|
43
|
+
return _arr;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function _non_iterable_rest() {
|
|
47
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
|
+
}
|
|
49
|
+
function _object_spread(target) {
|
|
50
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
51
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
52
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
53
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
54
|
+
}))), ownKeys2.forEach(function(key) {
|
|
55
|
+
_define_property(target, key, source[key]);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return target;
|
|
59
|
+
}
|
|
60
|
+
function ownKeys(object, enumerableOnly) {
|
|
61
|
+
var keys = Object.keys(object);
|
|
62
|
+
if (Object.getOwnPropertySymbols) {
|
|
63
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
64
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
65
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
66
|
+
})), keys.push.apply(keys, symbols);
|
|
67
|
+
}
|
|
68
|
+
return keys;
|
|
69
|
+
}
|
|
70
|
+
function _object_spread_props(target, source) {
|
|
71
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
72
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
73
|
+
}), target;
|
|
74
|
+
}
|
|
75
|
+
function _object_without_properties(source, excluded) {
|
|
76
|
+
if (source == null)
|
|
77
|
+
return {};
|
|
78
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
79
|
+
if (Object.getOwnPropertySymbols) {
|
|
80
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
81
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
82
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
83
|
+
}
|
|
84
|
+
return target;
|
|
85
|
+
}
|
|
86
|
+
function _object_without_properties_loose(source, excluded) {
|
|
87
|
+
if (source == null)
|
|
88
|
+
return {};
|
|
89
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
90
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
91
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
92
|
+
return target;
|
|
93
|
+
}
|
|
94
|
+
function _sliced_to_array(arr, i) {
|
|
95
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
96
|
+
}
|
|
97
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
98
|
+
if (o) {
|
|
99
|
+
if (typeof o == "string")
|
|
100
|
+
return _array_like_to_array(o, minLen);
|
|
101
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
102
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
103
|
+
return Array.from(n);
|
|
104
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
105
|
+
return _array_like_to_array(o, minLen);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function useCheckbox(props, param, ref) {
|
|
109
|
+
var _param = _sliced_to_array(param, 2), checked = _param[0], setChecked = _param[1], ariaLabelledby = props.labelledBy, name = props.name, required = props.required, disabled = props.disabled, _props_value = props.value, value = _props_value === void 0 ? "on" : _props_value, onCheckedChange = props.onCheckedChange, checkboxProps = _object_without_properties(props, [
|
|
110
|
+
"labelledBy",
|
|
111
|
+
"name",
|
|
112
|
+
"required",
|
|
113
|
+
"disabled",
|
|
114
|
+
"value",
|
|
115
|
+
"onCheckedChange"
|
|
116
|
+
]), _React_useState = _sliced_to_array(React.useState(null), 2), button = _React_useState[0], setButton = _React_useState[1], composedRefs = useComposedRefs(ref, function(node) {
|
|
117
|
+
return setButton(node);
|
|
118
|
+
}), hasConsumerStoppedPropagationRef = React.useRef(!1), isFormControl = isWeb ? button ? !!button.closest("form") : !0 : !1, labelId = useLabelContext(button), labelledBy = ariaLabelledby || labelId;
|
|
119
|
+
return {
|
|
120
|
+
bubbleInput: isWeb && isFormControl ? /* @__PURE__ */ React.createElement(BubbleInput, {
|
|
121
|
+
isHidden: !0,
|
|
122
|
+
control: button,
|
|
123
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
124
|
+
name,
|
|
125
|
+
value,
|
|
126
|
+
checked,
|
|
127
|
+
required,
|
|
128
|
+
disabled
|
|
129
|
+
}) : null,
|
|
33
130
|
checkboxRef: composedRefs,
|
|
34
|
-
checkboxProps: {
|
|
131
|
+
checkboxProps: _object_spread_props(_object_spread({
|
|
35
132
|
role: "checkbox",
|
|
36
133
|
"aria-labelledby": labelledBy,
|
|
37
|
-
"aria-checked": isIndeterminate(checked) ? "mixed" : checked
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(event) => {
|
|
55
|
-
setChecked(
|
|
56
|
-
(prevChecked) => isIndeterminate(prevChecked) ? !0 : !prevChecked
|
|
57
|
-
), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
}
|
|
134
|
+
"aria-checked": isIndeterminate(checked) ? "mixed" : checked
|
|
135
|
+
}, checkboxProps, isWeb && {
|
|
136
|
+
type: "button",
|
|
137
|
+
value,
|
|
138
|
+
"data-state": getState(checked),
|
|
139
|
+
"data-disabled": disabled ? "" : void 0,
|
|
140
|
+
disabled,
|
|
141
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, function(event) {
|
|
142
|
+
event.key === "Enter" && event.preventDefault();
|
|
143
|
+
})
|
|
144
|
+
}), {
|
|
145
|
+
onPress: composeEventHandlers(props.onPress, function(event) {
|
|
146
|
+
setChecked(function(prevChecked) {
|
|
147
|
+
return isIndeterminate(prevChecked) ? !0 : !prevChecked;
|
|
148
|
+
}), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
149
|
+
})
|
|
150
|
+
})
|
|
61
151
|
};
|
|
62
152
|
}
|
|
63
153
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/useCheckbox.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/useCheckbox.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,uBAAuB;AAChC,SAASC,aAAa;AAEtB,SAASC,4BAA4B;AACrC,SAASC,uBAAuB;AAChC,OAAOC,WAAW;AAGlB,SAASC,mBAAmB;AAC5B,SAASC,UAAUC,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBnC,SAASC,YACdC,OACA,OAIAC,KAAiB;MAJjB,SAAA,iBAAA,OAAA,CAAA,GAACC,UAAD,OAAA,CAAA,GAAUC,aAAV,OAAA,CAAA,GAOcC,iBAOVJ,MAPFK,YACAC,OAMEN,MANFM,MACAC,WAKEP,MALFO,UACAC,WAIER,MAJFQ,UAAAA,eAIER,MAHFS,OAAAA,QAAAA,iBAAAA,SAAQ,OAAA,cACRC,kBAEEV,MAFFU,iBACGC,gBAAAA,2BACDX,OAAAA;IAPFK;IACAC;IACAC;IACAC;IACAC;IACAC;MAG0Bf,kBAAAA,iBAAAA,MAAMiB,SAAmC,IAAA,GAAA,CAAA,GAA9DC,SAAqBlB,gBAAAA,CAAAA,GAAbmB,YAAanB,gBAAAA,CAAAA,GACtBoB,eAAexB,gBAAgBU,KAAK,SAACe,MAAAA;WAASF,UAAUE,IAAAA;MACxDC,mCAAmCtB,MAAMuB,OAAO,EAAA,GAEhDC,gBAAgB3B,QAASqB,SAASO,EAAQP,OAAOQ,QAAQ,MAAA,IAAW,KAAQ,IAE5EC,UAAU5B,gBAAgBmB,MAAAA,GAC1BR,aAAaD,kBAAkBkB;AAErC,SAAO;IACLC,aACE/B,SAAS2B,gBACP,sBAAA,cAACvB,aAAAA;MACC4B,UAAAA;MACAC,SAASZ;MACTa,SAAS,CAACT,iCAAiCU;MAC3CrB;MACAG;MACAP;MACAK;MACAC;SAEA;IACNoB,aAAab;IACbJ,eAAe,qBAAA,eAAA;MACbkB,MAAM;MACN,mBAAmBxB;MACnB,gBAAgBP,gBAAgBI,OAAAA,IAAW,UAAUA;OAClDS,eACCnB,SAAS;MACXsC,MAAM;MACNrB;MACA,cAAcZ,SAASK,OAAAA;MACvB,iBAAiBM,WAAW,KAAKuB;MACjCvB;MACAwB,WAAWvC,qBACRO,MAA6CgC,WAC9C,SAACC,OAAAA;AAEC,QAAIA,MAAMC,QAAQ,WAASD,MAAME,eAAc;MACjD,CAAA;IAEJ,CAAA,GAAA;MACAC,SAAS3C,qBACPO,MAAMoC,SACN,SAACH,OAAAA;AACC9B,mBAAW,SAACkC,aAAAA;iBACVvC,gBAAgBuC,WAAAA,IAAe,KAAO,CAACA;YAErClB,iBAAiB,0BAA0Bc,UAC7ChB,iCAAiCU,UAAUM,MAAMK,qBAAoB,GAIhErB,iCAAiCU,WAASM,MAAMM,gBAAe;MAExE,CAAA;;EAGN;AACF;",
|
|
5
|
+
"names": ["useComposedRefs", "isWeb", "composeEventHandlers", "useLabelContext", "React", "BubbleInput", "getState", "isIndeterminate", "useCheckbox", "props", "ref", "checked", "setChecked", "ariaLabelledby", "labelledBy", "name", "required", "disabled", "value", "onCheckedChange", "checkboxProps", "useState", "button", "setButton", "composedRefs", "node", "hasConsumerStoppedPropagationRef", "useRef", "isFormControl", "Boolean", "closest", "labelId", "bubbleInput", "isHidden", "control", "bubbles", "current", "checkboxRef", "role", "type", "undefined", "onKeyDown", "event", "key", "preventDefault", "onPress", "prevChecked", "isPropagationStopped", "stopPropagation"]
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils.tsx"],
|
|
4
|
-
"mappings": "AAEO,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/utils.tsx"],
|
|
4
|
+
"mappings": "AAEO,SAASA,gBAAgBC,SAAsB;AACpD,SAAOA,YAAY;AACrB;AAEO,SAASC,SAASD,SAAqB;AAC5C,SAAOD,gBAAgBC,OAAAA,IAAW,kBAAkBA,UAAU,YAAY;AAC5E;",
|
|
5
|
+
"names": ["isIndeterminate", "checked", "getState"]
|
|
6
6
|
}
|
|
@@ -1,42 +1,96 @@
|
|
|
1
1
|
import { usePrevious } from "@tamagui/use-previous";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { isIndeterminate } from "./utils";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
function _define_property(obj, key, value) {
|
|
5
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
6
|
+
value,
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
configurable: !0,
|
|
9
|
+
writable: !0
|
|
10
|
+
}) : obj[key] = value, obj;
|
|
11
|
+
}
|
|
12
|
+
function _object_spread(target) {
|
|
13
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
15
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
16
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
17
|
+
}))), ownKeys2.forEach(function(key) {
|
|
18
|
+
_define_property(target, key, source[key]);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return target;
|
|
22
|
+
}
|
|
23
|
+
function ownKeys(object, enumerableOnly) {
|
|
24
|
+
var keys = Object.keys(object);
|
|
25
|
+
if (Object.getOwnPropertySymbols) {
|
|
26
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
27
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
28
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
29
|
+
})), keys.push.apply(keys, symbols);
|
|
30
|
+
}
|
|
31
|
+
return keys;
|
|
32
|
+
}
|
|
33
|
+
function _object_spread_props(target, source) {
|
|
34
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
35
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
36
|
+
}), target;
|
|
37
|
+
}
|
|
38
|
+
function _object_without_properties(source, excluded) {
|
|
39
|
+
if (source == null)
|
|
40
|
+
return {};
|
|
41
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
42
|
+
if (Object.getOwnPropertySymbols) {
|
|
43
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
44
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
45
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
}
|
|
49
|
+
function _object_without_properties_loose(source, excluded) {
|
|
50
|
+
if (source == null)
|
|
51
|
+
return {};
|
|
52
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
53
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
54
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
55
|
+
return target;
|
|
56
|
+
}
|
|
57
|
+
var BubbleInput = function(props) {
|
|
58
|
+
var checked = props.checked, _props_bubbles = props.bubbles, bubbles = _props_bubbles === void 0 ? !0 : _props_bubbles, control = props.control, isHidden = props.isHidden, inputProps = _object_without_properties(props, [
|
|
59
|
+
"checked",
|
|
60
|
+
"bubbles",
|
|
61
|
+
"control",
|
|
62
|
+
"isHidden"
|
|
63
|
+
]), ref = React.useRef(null), prevChecked = usePrevious(checked);
|
|
64
|
+
return React.useEffect(function() {
|
|
65
|
+
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
12
66
|
if (prevChecked !== checked && setChecked) {
|
|
13
|
-
|
|
67
|
+
var event = new Event("click", {
|
|
68
|
+
bubbles
|
|
69
|
+
});
|
|
14
70
|
input.indeterminate = isIndeterminate(checked), setChecked.call(input, isIndeterminate(checked) ? !1 : checked), input.dispatchEvent(event);
|
|
15
71
|
}
|
|
16
|
-
}, [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
);
|
|
72
|
+
}, [
|
|
73
|
+
prevChecked,
|
|
74
|
+
checked,
|
|
75
|
+
bubbles
|
|
76
|
+
]), /* @__PURE__ */ React.createElement("input", _object_spread_props(_object_spread({
|
|
77
|
+
type: "checkbox",
|
|
78
|
+
defaultChecked: isIndeterminate(checked) ? !1 : checked
|
|
79
|
+
}, inputProps), {
|
|
80
|
+
tabIndex: -1,
|
|
81
|
+
ref,
|
|
82
|
+
"aria-hidden": isHidden,
|
|
83
|
+
style: _object_spread({}, isHidden ? {
|
|
84
|
+
// ...controlSize,
|
|
85
|
+
position: "absolute",
|
|
86
|
+
pointerEvents: "none",
|
|
87
|
+
opacity: 0,
|
|
88
|
+
margin: 0
|
|
89
|
+
} : {
|
|
90
|
+
appearance: "auto",
|
|
91
|
+
accentColor: "var(--color6)"
|
|
92
|
+
}, props.style)
|
|
93
|
+
}));
|
|
40
94
|
};
|
|
41
95
|
export {
|
|
42
96
|
BubbleInput
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/BubbleInput.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/BubbleInput.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,mBAAmB;AAC5B,YAAYC,WAAW;AAGvB,SAASC,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUzB,IAAMC,cAAc,SAACC,OAAAA;AAC1B,MAAQC,UAA8DD,MAA9DC,SAAAA,iBAA8DD,MAArDE,SAAAA,UAAAA,mBAAAA,SAAU,KAAA,gBAAMC,UAAqCH,MAArCG,SAASC,WAA4BJ,MAA5BI,UAAaC,aAAAA,2BAAeL,OAAAA;IAA9DC;IAASC;IAAgBC;IAASC;MACpCE,MAAMT,MAAMU,OAAyB,IAAA,GACrCC,cAAcZ,YAAYK,OAAAA;AAGhCJ,eAAMY,UAAU,WAAA;AACd,QAAMC,QAAQJ,IAAIK,SACZC,aAAaC,OAAOC,iBAAiBC,WACrCC,aAAaC,OAAOC,yBACxBN,YACA,SAAA,GAEIO,aAAaH,WAAWI;AAE9B,QAAIZ,gBAAgBP,WAAWkB,YAAY;AACzC,UAAME,QAAQ,IAAIC,MAAM,SAAS;QAAEpB;MAAQ,CAAA;AAC3CQ,YAAMa,gBAAgBzB,gBAAgBG,OAAAA,GACtCkB,WAAWK,KAAKd,OAAOZ,gBAAgBG,OAAAA,IAAW,KAAQA,OAAAA,GAC1DS,MAAMe,cAAcJ,KAAAA;IACtB;EACF,GAAG;IAACb;IAAaP;IAASC;GAAQ,GAGhC,sBAAA,cAACQ,SAAAA,qBAAAA,eAAAA;IACCgB,MAAK;IACLC,gBAAgB7B,gBAAgBG,OAAAA,IAAW,KAAQA;KAC/CI,UAAAA,GAAAA;IACJuB,UAAU;IACVtB;IACAuB,eAAazB;IACb0B,OAAO,eAAA,CAAA,GACD1B,WACA;;MAEE2B,UAAU;MACVC,eAAe;MACfC,SAAS;MACTC,QAAQ;IACV,IACA;MACEC,YAAY;MACZC,aAAa;IACf,GAEDpC,MAAM8B,KAAK;;AAItB;",
|
|
5
|
+
"names": ["usePrevious", "React", "isIndeterminate", "BubbleInput", "props", "checked", "bubbles", "control", "isHidden", "inputProps", "ref", "useRef", "prevChecked", "useEffect", "input", "current", "inputProto", "window", "HTMLInputElement", "prototype", "descriptor", "Object", "getOwnPropertyDescriptor", "setChecked", "set", "event", "Event", "indeterminate", "call", "dispatchEvent", "type", "defaultChecked", "tabIndex", "aria-hidden", "style", "position", "pointerEvents", "opacity", "margin", "appearance", "accentColor"]
|
|
6
6
|
}
|
|
@@ -5,59 +5,149 @@ import { useLabelContext } from "@tamagui/label";
|
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { BubbleInput } from "./BubbleInput";
|
|
7
7
|
import { getState, isIndeterminate } from "./utils";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
8
|
+
function _array_like_to_array(arr, len) {
|
|
9
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
10
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
11
|
+
arr2[i] = arr[i];
|
|
12
|
+
return arr2;
|
|
13
|
+
}
|
|
14
|
+
function _array_with_holes(arr) {
|
|
15
|
+
if (Array.isArray(arr))
|
|
16
|
+
return arr;
|
|
17
|
+
}
|
|
18
|
+
function _define_property(obj, key, value) {
|
|
19
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
20
|
+
value,
|
|
21
|
+
enumerable: !0,
|
|
22
|
+
configurable: !0,
|
|
23
|
+
writable: !0
|
|
24
|
+
}) : obj[key] = value, obj;
|
|
25
|
+
}
|
|
26
|
+
function _iterable_to_array_limit(arr, i) {
|
|
27
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
28
|
+
if (_i != null) {
|
|
29
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
30
|
+
try {
|
|
31
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
32
|
+
;
|
|
33
|
+
} catch (err) {
|
|
34
|
+
_d = !0, _e = err;
|
|
35
|
+
} finally {
|
|
36
|
+
try {
|
|
37
|
+
!_n && _i.return != null && _i.return();
|
|
38
|
+
} finally {
|
|
39
|
+
if (_d)
|
|
40
|
+
throw _e;
|
|
31
41
|
}
|
|
32
|
-
|
|
42
|
+
}
|
|
43
|
+
return _arr;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function _non_iterable_rest() {
|
|
47
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
|
+
}
|
|
49
|
+
function _object_spread(target) {
|
|
50
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
51
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
52
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
53
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
54
|
+
}))), ownKeys2.forEach(function(key) {
|
|
55
|
+
_define_property(target, key, source[key]);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return target;
|
|
59
|
+
}
|
|
60
|
+
function ownKeys(object, enumerableOnly) {
|
|
61
|
+
var keys = Object.keys(object);
|
|
62
|
+
if (Object.getOwnPropertySymbols) {
|
|
63
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
64
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
65
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
66
|
+
})), keys.push.apply(keys, symbols);
|
|
67
|
+
}
|
|
68
|
+
return keys;
|
|
69
|
+
}
|
|
70
|
+
function _object_spread_props(target, source) {
|
|
71
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
72
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
73
|
+
}), target;
|
|
74
|
+
}
|
|
75
|
+
function _object_without_properties(source, excluded) {
|
|
76
|
+
if (source == null)
|
|
77
|
+
return {};
|
|
78
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
79
|
+
if (Object.getOwnPropertySymbols) {
|
|
80
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
81
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
82
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
83
|
+
}
|
|
84
|
+
return target;
|
|
85
|
+
}
|
|
86
|
+
function _object_without_properties_loose(source, excluded) {
|
|
87
|
+
if (source == null)
|
|
88
|
+
return {};
|
|
89
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
90
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
91
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
92
|
+
return target;
|
|
93
|
+
}
|
|
94
|
+
function _sliced_to_array(arr, i) {
|
|
95
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
96
|
+
}
|
|
97
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
98
|
+
if (o) {
|
|
99
|
+
if (typeof o == "string")
|
|
100
|
+
return _array_like_to_array(o, minLen);
|
|
101
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
102
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
103
|
+
return Array.from(n);
|
|
104
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
105
|
+
return _array_like_to_array(o, minLen);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function useCheckbox(props, param, ref) {
|
|
109
|
+
var _param = _sliced_to_array(param, 2), checked = _param[0], setChecked = _param[1], ariaLabelledby = props.labelledBy, name = props.name, required = props.required, disabled = props.disabled, _props_value = props.value, value = _props_value === void 0 ? "on" : _props_value, onCheckedChange = props.onCheckedChange, checkboxProps = _object_without_properties(props, [
|
|
110
|
+
"labelledBy",
|
|
111
|
+
"name",
|
|
112
|
+
"required",
|
|
113
|
+
"disabled",
|
|
114
|
+
"value",
|
|
115
|
+
"onCheckedChange"
|
|
116
|
+
]), _React_useState = _sliced_to_array(React.useState(null), 2), button = _React_useState[0], setButton = _React_useState[1], composedRefs = useComposedRefs(ref, function(node) {
|
|
117
|
+
return setButton(node);
|
|
118
|
+
}), hasConsumerStoppedPropagationRef = React.useRef(!1), isFormControl = isWeb ? button ? !!button.closest("form") : !0 : !1, labelId = useLabelContext(button), labelledBy = ariaLabelledby || labelId;
|
|
119
|
+
return {
|
|
120
|
+
bubbleInput: isWeb && isFormControl ? /* @__PURE__ */ React.createElement(BubbleInput, {
|
|
121
|
+
isHidden: !0,
|
|
122
|
+
control: button,
|
|
123
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
124
|
+
name,
|
|
125
|
+
value,
|
|
126
|
+
checked,
|
|
127
|
+
required,
|
|
128
|
+
disabled
|
|
129
|
+
}) : null,
|
|
33
130
|
checkboxRef: composedRefs,
|
|
34
|
-
checkboxProps: {
|
|
131
|
+
checkboxProps: _object_spread_props(_object_spread({
|
|
35
132
|
role: "checkbox",
|
|
36
133
|
"aria-labelledby": labelledBy,
|
|
37
|
-
"aria-checked": isIndeterminate(checked) ? "mixed" : checked
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(event) => {
|
|
55
|
-
setChecked(
|
|
56
|
-
(prevChecked) => isIndeterminate(prevChecked) ? !0 : !prevChecked
|
|
57
|
-
), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
}
|
|
134
|
+
"aria-checked": isIndeterminate(checked) ? "mixed" : checked
|
|
135
|
+
}, checkboxProps, isWeb && {
|
|
136
|
+
type: "button",
|
|
137
|
+
value,
|
|
138
|
+
"data-state": getState(checked),
|
|
139
|
+
"data-disabled": disabled ? "" : void 0,
|
|
140
|
+
disabled,
|
|
141
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, function(event) {
|
|
142
|
+
event.key === "Enter" && event.preventDefault();
|
|
143
|
+
})
|
|
144
|
+
}), {
|
|
145
|
+
onPress: composeEventHandlers(props.onPress, function(event) {
|
|
146
|
+
setChecked(function(prevChecked) {
|
|
147
|
+
return isIndeterminate(prevChecked) ? !0 : !prevChecked;
|
|
148
|
+
}), isFormControl && "isPropagationStopped" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
149
|
+
})
|
|
150
|
+
})
|
|
61
151
|
};
|
|
62
152
|
}
|
|
63
153
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/useCheckbox.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/useCheckbox.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,uBAAuB;AAChC,SAASC,aAAa;AAEtB,SAASC,4BAA4B;AACrC,SAASC,uBAAuB;AAChC,OAAOC,WAAW;AAGlB,SAASC,mBAAmB;AAC5B,SAASC,UAAUC,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBnC,SAASC,YACdC,OACA,OAIAC,KAAiB;MAJjB,SAAA,iBAAA,OAAA,CAAA,GAACC,UAAD,OAAA,CAAA,GAAUC,aAAV,OAAA,CAAA,GAOcC,iBAOVJ,MAPFK,YACAC,OAMEN,MANFM,MACAC,WAKEP,MALFO,UACAC,WAIER,MAJFQ,UAAAA,eAIER,MAHFS,OAAAA,QAAAA,iBAAAA,SAAQ,OAAA,cACRC,kBAEEV,MAFFU,iBACGC,gBAAAA,2BACDX,OAAAA;IAPFK;IACAC;IACAC;IACAC;IACAC;IACAC;MAG0Bf,kBAAAA,iBAAAA,MAAMiB,SAAmC,IAAA,GAAA,CAAA,GAA9DC,SAAqBlB,gBAAAA,CAAAA,GAAbmB,YAAanB,gBAAAA,CAAAA,GACtBoB,eAAexB,gBAAgBU,KAAK,SAACe,MAAAA;WAASF,UAAUE,IAAAA;MACxDC,mCAAmCtB,MAAMuB,OAAO,EAAA,GAEhDC,gBAAgB3B,QAASqB,SAASO,EAAQP,OAAOQ,QAAQ,MAAA,IAAW,KAAQ,IAE5EC,UAAU5B,gBAAgBmB,MAAAA,GAC1BR,aAAaD,kBAAkBkB;AAErC,SAAO;IACLC,aACE/B,SAAS2B,gBACP,sBAAA,cAACvB,aAAAA;MACC4B,UAAAA;MACAC,SAASZ;MACTa,SAAS,CAACT,iCAAiCU;MAC3CrB;MACAG;MACAP;MACAK;MACAC;SAEA;IACNoB,aAAab;IACbJ,eAAe,qBAAA,eAAA;MACbkB,MAAM;MACN,mBAAmBxB;MACnB,gBAAgBP,gBAAgBI,OAAAA,IAAW,UAAUA;OAClDS,eACCnB,SAAS;MACXsC,MAAM;MACNrB;MACA,cAAcZ,SAASK,OAAAA;MACvB,iBAAiBM,WAAW,KAAKuB;MACjCvB;MACAwB,WAAWvC,qBACRO,MAA6CgC,WAC9C,SAACC,OAAAA;AAEC,QAAIA,MAAMC,QAAQ,WAASD,MAAME,eAAc;MACjD,CAAA;IAEJ,CAAA,GAAA;MACAC,SAAS3C,qBACPO,MAAMoC,SACN,SAACH,OAAAA;AACC9B,mBAAW,SAACkC,aAAAA;iBACVvC,gBAAgBuC,WAAAA,IAAe,KAAO,CAACA;YAErClB,iBAAiB,0BAA0Bc,UAC7ChB,iCAAiCU,UAAUM,MAAMK,qBAAoB,GAIhErB,iCAAiCU,WAASM,MAAMM,gBAAe;MAExE,CAAA;;EAGN;AACF;",
|
|
5
|
+
"names": ["useComposedRefs", "isWeb", "composeEventHandlers", "useLabelContext", "React", "BubbleInput", "getState", "isIndeterminate", "useCheckbox", "props", "ref", "checked", "setChecked", "ariaLabelledby", "labelledBy", "name", "required", "disabled", "value", "onCheckedChange", "checkboxProps", "useState", "button", "setButton", "composedRefs", "node", "hasConsumerStoppedPropagationRef", "useRef", "isFormControl", "Boolean", "closest", "labelId", "bubbleInput", "isHidden", "control", "bubbles", "current", "checkboxRef", "role", "type", "undefined", "onKeyDown", "event", "key", "preventDefault", "onPress", "prevChecked", "isPropagationStopped", "stopPropagation"]
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils.tsx"],
|
|
4
|
-
"mappings": "AAEO,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/checkbox-headless/src/utils.tsx"],
|
|
4
|
+
"mappings": "AAEO,SAASA,gBAAgBC,SAAsB;AACpD,SAAOA,YAAY;AACrB;AAEO,SAASC,SAASD,SAAqB;AAC5C,SAAOD,gBAAgBC,OAAAA,IAAW,kBAAkBA,UAAU,YAAY;AAC5E;",
|
|
5
|
+
"names": ["isIndeterminate", "checked", "getState"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/checkbox-headless",
|
|
3
|
-
"version": "1.89.
|
|
3
|
+
"version": "1.89.27-1708113113238",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"clean:build": "tamagui-build clean:build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tamagui/compose-refs": "1.89.
|
|
27
|
-
"@tamagui/constants": "1.89.
|
|
28
|
-
"@tamagui/create-context": "1.89.
|
|
29
|
-
"@tamagui/focusable": "1.89.
|
|
30
|
-
"@tamagui/helpers": "1.89.
|
|
31
|
-
"@tamagui/label": "1.89.
|
|
32
|
-
"@tamagui/use-controllable-state": "1.89.
|
|
33
|
-
"@tamagui/use-previous": "1.89.
|
|
26
|
+
"@tamagui/compose-refs": "1.89.27-1708113113238",
|
|
27
|
+
"@tamagui/constants": "1.89.27-1708113113238",
|
|
28
|
+
"@tamagui/create-context": "1.89.27-1708113113238",
|
|
29
|
+
"@tamagui/focusable": "1.89.27-1708113113238",
|
|
30
|
+
"@tamagui/helpers": "1.89.27-1708113113238",
|
|
31
|
+
"@tamagui/label": "1.89.27-1708113113238",
|
|
32
|
+
"@tamagui/use-controllable-state": "1.89.27-1708113113238",
|
|
33
|
+
"@tamagui/use-previous": "1.89.27-1708113113238"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|
|
36
36
|
"./package.json": "./package.json",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react": "*"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@tamagui/build": "1.89.
|
|
48
|
+
"@tamagui/build": "1.89.27-1708113113238",
|
|
49
49
|
"react": "^18.2.0"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|