@tamagui/radio-headless 2.0.0-rc.4 → 2.0.0-rc.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BubbleInput.cjs +45 -40
- package/dist/cjs/BubbleInput.native.js +73 -69
- package/dist/cjs/BubbleInput.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/useRadioGroup.cjs +149 -138
- package/dist/cjs/useRadioGroup.native.js +163 -149
- package/dist/cjs/useRadioGroup.native.js.map +1 -1
- package/dist/cjs/utils.cjs +12 -10
- package/dist/cjs/utils.native.js +12 -10
- package/dist/cjs/utils.native.js.map +1 -1
- package/dist/esm/BubbleInput.mjs +18 -15
- package/dist/esm/BubbleInput.mjs.map +1 -1
- package/dist/esm/BubbleInput.native.js +18 -16
- package/dist/esm/BubbleInput.native.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/useRadioGroup.mjs +128 -118
- package/dist/esm/useRadioGroup.mjs.map +1 -1
- package/dist/esm/useRadioGroup.native.js +141 -129
- package/dist/esm/useRadioGroup.native.js.map +1 -1
- package/dist/jsx/BubbleInput.mjs +18 -15
- package/dist/jsx/BubbleInput.mjs.map +1 -1
- package/dist/jsx/BubbleInput.native.js +73 -69
- package/dist/jsx/BubbleInput.native.js.map +1 -1
- package/dist/jsx/index.js +2 -2
- package/dist/jsx/index.js.map +1 -6
- package/dist/jsx/index.native.js +7 -5
- package/dist/jsx/useRadioGroup.mjs +128 -118
- package/dist/jsx/useRadioGroup.mjs.map +1 -1
- package/dist/jsx/useRadioGroup.native.js +163 -149
- package/dist/jsx/useRadioGroup.native.js.map +1 -1
- package/dist/jsx/utils.native.js +12 -10
- package/package.json +15 -18
- package/dist/cjs/BubbleInput.js +0 -65
- package/dist/cjs/BubbleInput.js.map +0 -6
- package/dist/cjs/index.js +0 -16
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/useRadioGroup.js +0 -160
- package/dist/cjs/useRadioGroup.js.map +0 -6
- package/dist/cjs/utils.js +0 -23
- package/dist/cjs/utils.js.map +0 -6
- package/dist/esm/BubbleInput.js +0 -43
- package/dist/esm/BubbleInput.js.map +0 -6
- package/dist/esm/useRadioGroup.js +0 -153
- package/dist/esm/useRadioGroup.js.map +0 -6
- package/dist/esm/utils.js +0 -7
- package/dist/esm/utils.js.map +0 -6
- package/dist/jsx/BubbleInput.js +0 -43
- package/dist/jsx/BubbleInput.js.map +0 -6
- package/dist/jsx/useRadioGroup.js +0 -153
- package/dist/jsx/useRadioGroup.js.map +0 -6
- package/dist/jsx/utils.js +0 -7
- package/dist/jsx/utils.js.map +0 -6
package/dist/cjs/BubbleInput.cjs
CHANGED
|
@@ -2,63 +2,68 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var BubbleInput_exports = {};
|
|
33
35
|
__export(BubbleInput_exports, {
|
|
34
36
|
BubbleInput: () => BubbleInput
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(BubbleInput_exports);
|
|
37
|
-
var import_react = __toESM(require("react"), 1)
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
var import_react = __toESM(require("react"), 1);
|
|
40
|
+
var import_use_previous = require("@tamagui/use-previous");
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
42
|
const BubbleInput = props => {
|
|
41
43
|
const {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const input = ref.current
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
checked,
|
|
45
|
+
bubbles = true,
|
|
46
|
+
control,
|
|
47
|
+
isHidden,
|
|
48
|
+
accentColor,
|
|
49
|
+
...inputProps
|
|
50
|
+
} = props;
|
|
51
|
+
const ref = import_react.default.useRef(null);
|
|
52
|
+
const prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
53
|
+
import_react.default.useEffect(() => {
|
|
54
|
+
const input = ref.current;
|
|
55
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
56
|
+
const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
|
|
57
|
+
const setChecked = descriptor.set;
|
|
55
58
|
if (prevChecked !== checked && setChecked) {
|
|
56
59
|
const event = new Event("click", {
|
|
57
60
|
bubbles
|
|
58
61
|
});
|
|
59
|
-
setChecked.call(input, checked)
|
|
62
|
+
setChecked.call(input, checked);
|
|
63
|
+
input.dispatchEvent(event);
|
|
60
64
|
}
|
|
61
|
-
}, [prevChecked, checked, bubbles])
|
|
65
|
+
}, [prevChecked, checked, bubbles]);
|
|
66
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("input", {
|
|
62
67
|
type: "radio",
|
|
63
68
|
defaultChecked: checked,
|
|
64
69
|
...inputProps,
|
|
@@ -4,83 +4,87 @@ var __create = Object.create;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
8
|
-
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
18
|
get: () => from[key],
|
|
18
19
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
22
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
34
36
|
var BubbleInput_exports = {};
|
|
35
37
|
__export(BubbleInput_exports, {
|
|
36
38
|
BubbleInput: () => BubbleInput
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(BubbleInput_exports);
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var import_react = __toESM(require("react"), 1);
|
|
43
|
+
var import_use_previous = require("@tamagui/use-previous");
|
|
44
|
+
var BubbleInput = function (props) {
|
|
45
|
+
var {
|
|
46
|
+
checked,
|
|
47
|
+
bubbles = true,
|
|
48
|
+
control,
|
|
49
|
+
isHidden,
|
|
50
|
+
accentColor,
|
|
51
|
+
...inputProps
|
|
52
|
+
} = props;
|
|
53
|
+
var ref = import_react.default.useRef(null);
|
|
54
|
+
var prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
55
|
+
import_react.default.useEffect(function () {
|
|
56
|
+
var input = ref.current;
|
|
57
|
+
var inputProto = window.HTMLInputElement.prototype;
|
|
58
|
+
var descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
|
|
59
|
+
var setChecked = descriptor.set;
|
|
60
|
+
if (prevChecked !== checked && setChecked) {
|
|
61
|
+
var event = new Event("click", {
|
|
62
|
+
bubbles
|
|
63
|
+
});
|
|
64
|
+
setChecked.call(input, checked);
|
|
65
|
+
input.dispatchEvent(event);
|
|
66
|
+
}
|
|
67
|
+
}, [prevChecked, checked, bubbles]);
|
|
68
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("input", {
|
|
69
|
+
type: "radio",
|
|
70
|
+
defaultChecked: checked,
|
|
71
|
+
...inputProps,
|
|
72
|
+
tabIndex: -1,
|
|
73
|
+
ref,
|
|
74
|
+
"aria-hidden": isHidden,
|
|
75
|
+
style: {
|
|
76
|
+
...(isHidden ? {
|
|
77
|
+
// ...controlSize,
|
|
78
|
+
position: "absolute",
|
|
79
|
+
pointerEvents: "none",
|
|
80
|
+
opacity: 0,
|
|
81
|
+
margin: 0
|
|
82
|
+
} : {
|
|
83
|
+
appearance: "auto",
|
|
84
|
+
accentColor
|
|
85
|
+
}),
|
|
86
|
+
...props.style
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
86
90
|
//# sourceMappingURL=BubbleInput.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","BubbleInput_exports","__export","BubbleInput","module","exports","import_jsx_runtime","require","import_react","__toESM","import_use_previous","props","checked","bubbles","control","isHidden","accentColor","inputProps","ref","default","useRef","prevChecked","usePrevious","useEffect","input","current","inputProto","window","HTMLInputElement","prototype","descriptor","Object","getOwnPropertyDescriptor","setChecked","set","event","Event","call","dispatchEvent","jsx","type","defaultChecked","tabIndex","style","position","pointerEvents","opacity","margin","appearance"],"sources":["../../src/BubbleInput.tsx"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","BubbleInput_exports","__export","BubbleInput","module","exports","import_jsx_runtime","require","import_react","__toESM","import_use_previous","props","checked","bubbles","control","isHidden","accentColor","inputProps","ref","default","useRef","prevChecked","usePrevious","useEffect","input","current","inputProto","window","HTMLInputElement","prototype","descriptor","Object","getOwnPropertyDescriptor","setChecked","set","event","Event","call","dispatchEvent","jsx","type","defaultChecked","tabIndex","style","position","pointerEvents","opacity","margin","appearance"],"sources":["../../src/BubbleInput.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAA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ACb;IAAO,aACD,EAAAH,QACA;IAAA4B,KAAA;MAAA,IAAA5B,QAEE,GAAU;QAAA;QACK6B,QACf,YAAS;QAAAC,aACD;QACVC,OACA;QAAAC,MACE;MAAY,IACZ;QACFC,UAAA;QAEJhC;MACF;MAAA,GAAAL,KAAA,CAAAgC;IACF;EAEJ","ignoreList":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,15 +3,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
7
8
|
get: () => from[key],
|
|
8
9
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
10
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
13
15
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
14
|
-
value:
|
|
16
|
+
value: true
|
|
15
17
|
}), mod);
|
|
16
18
|
var index_exports = {};
|
|
17
19
|
module.exports = __toCommonJS(index_exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
10
|
get: () => from[key],
|
|
10
11
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
17
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value:
|
|
18
|
+
value: true
|
|
17
19
|
}), mod);
|
|
18
20
|
var index_exports = {};
|
|
19
21
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,4BADd,GAAAH,MAAA,CAAAC,OAAA","ignoreList":[]}
|