@tamagui/radio-headless 1.110.4 → 1.111.0
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 +19 -74
- package/dist/cjs/BubbleInput.native.js.map +1 -1
- package/dist/cjs/useRadioGroup.native.js +33 -125
- package/dist/cjs/useRadioGroup.native.js.map +2 -2
- package/dist/esm/BubbleInput.native.js +18 -72
- package/dist/esm/BubbleInput.native.js.map +1 -1
- package/dist/esm/BubbleInput.native.mjs +49 -0
- package/dist/esm/BubbleInput.native.mjs.map +1 -0
- package/dist/esm/index.native.mjs +3 -0
- package/dist/esm/index.native.mjs.map +1 -0
- package/dist/esm/useRadioGroup.native.js +35 -127
- package/dist/esm/useRadioGroup.native.js.map +2 -2
- package/dist/esm/useRadioGroup.native.mjs +178 -0
- package/dist/esm/useRadioGroup.native.mjs.map +1 -0
- package/dist/esm/utils.native.mjs +5 -0
- package/dist/esm/utils.native.mjs.map +1 -0
- package/dist/jsx/BubbleInput.native.js +18 -72
- package/dist/jsx/BubbleInput.native.js.map +1 -1
- package/dist/jsx/useRadioGroup.native.js +33 -125
- package/dist/jsx/useRadioGroup.native.js.map +2 -2
- package/package.json +10 -10
|
@@ -26,66 +26,8 @@ __export(BubbleInput_exports, {
|
|
|
26
26
|
BubbleInput: () => BubbleInput
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(BubbleInput_exports);
|
|
29
|
-
var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(require("react")), import_use_previous = require("@tamagui/use-previous")
|
|
30
|
-
|
|
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) return {};
|
|
66
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
67
|
-
if (Object.getOwnPropertySymbols) {
|
|
68
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
69
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
70
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
71
|
-
}
|
|
72
|
-
return target;
|
|
73
|
-
}
|
|
74
|
-
function _object_without_properties_loose(source, excluded) {
|
|
75
|
-
if (source == null) return {};
|
|
76
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
77
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
78
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
79
|
-
return target;
|
|
80
|
-
}
|
|
81
|
-
var BubbleInput = function(props) {
|
|
82
|
-
var checked = props.checked, _props_bubbles = props.bubbles, bubbles = _props_bubbles === void 0 ? !0 : _props_bubbles, control = props.control, isHidden = props.isHidden, accentColor = props.accentColor, inputProps = _object_without_properties(props, [
|
|
83
|
-
"checked",
|
|
84
|
-
"bubbles",
|
|
85
|
-
"control",
|
|
86
|
-
"isHidden",
|
|
87
|
-
"accentColor"
|
|
88
|
-
]), ref = import_react.default.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(require("react")), import_use_previous = require("@tamagui/use-previous"), BubbleInput = function(props) {
|
|
30
|
+
var { checked, bubbles = !0, control, isHidden, accentColor, ...inputProps } = props, ref = import_react.default.useRef(null), prevChecked = (0, import_use_previous.usePrevious)(checked);
|
|
89
31
|
return import_react.default.useEffect(function() {
|
|
90
32
|
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
91
33
|
if (prevChecked !== checked && setChecked) {
|
|
@@ -98,24 +40,27 @@ var BubbleInput = function(props) {
|
|
|
98
40
|
prevChecked,
|
|
99
41
|
checked,
|
|
100
42
|
bubbles
|
|
101
|
-
]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input",
|
|
43
|
+
]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
102
44
|
type: "radio",
|
|
103
|
-
defaultChecked: checked
|
|
104
|
-
|
|
45
|
+
defaultChecked: checked,
|
|
46
|
+
...inputProps,
|
|
105
47
|
tabIndex: -1,
|
|
106
48
|
ref,
|
|
107
49
|
"aria-hidden": isHidden,
|
|
108
|
-
style:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
50
|
+
style: {
|
|
51
|
+
...isHidden ? {
|
|
52
|
+
// ...controlSize,
|
|
53
|
+
position: "absolute",
|
|
54
|
+
pointerEvents: "none",
|
|
55
|
+
opacity: 0,
|
|
56
|
+
margin: 0
|
|
57
|
+
} : {
|
|
58
|
+
appearance: "auto",
|
|
59
|
+
accentColor
|
|
60
|
+
},
|
|
61
|
+
...props.style
|
|
62
|
+
}
|
|
63
|
+
});
|
|
119
64
|
};
|
|
120
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
121
66
|
0 && (module.exports = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/radio-headless/src/BubbleInput.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAClB,sBAA4B
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAClB,sBAA4B,kCAUfA,cAAc,SAACC,OAAAA;AAC1B,MAAM,EAAEC,SAASC,UAAU,IAAMC,SAASC,UAAUC,aAAa,GAAGC,WAAAA,IAAeN,OAC7EO,MAAMC,aAAAA,QAAMC,OAAyB,IAAA,GACrCC,kBAAcC,iCAAYV,OAAAA;AAGhCO,sBAAAA,QAAMI,UAAU,WAAA;AACd,QAAMC,QAAQN,IAAIO,SACZC,aAAaC,OAAOC,iBAAiBC,WACrCC,aAAaC,OAAOC,yBACxBN,YACA,SAAA,GAEIO,aAAaH,WAAWI;AAC9B,QAAIb,gBAAgBT,WAAWqB,YAAY;AACzC,UAAME,QAAQ,IAAIC,MAAM,SAAS;QAAEvB;MAAQ,CAAA;AAC3CoB,iBAAWI,KAAKb,OAAOZ,OAAAA,GACvBY,MAAMc,cAAcH,KAAAA;IACtB;EACF,GAAG;IAACd;IAAaT;IAASC;GAAQ,GAGhC,uCAAA0B,KAACf,SAAAA;IACCgB,MAAK;IACLC,gBAAgB7B;IACf,GAAGK;IACJyB,UAAU;IACVxB;IACAyB,eAAa5B;IACb6B,OAAO;MACL,GAAI7B,WACA;;QAEE8B,UAAU;QACVC,eAAe;QACfC,SAAS;QACTC,QAAQ;MACV,IACA;QACEC,YAAY;QACZjC;MACF;MAEJ,GAAGL,MAAMiC;IACX;;AAGN;",
|
|
5
5
|
"names": ["BubbleInput", "props", "checked", "bubbles", "control", "isHidden", "accentColor", "inputProps", "ref", "React", "useRef", "prevChecked", "usePrevious", "useEffect", "input", "current", "inputProto", "window", "HTMLInputElement", "prototype", "descriptor", "Object", "getOwnPropertyDescriptor", "setChecked", "set", "event", "Event", "call", "dispatchEvent", "_jsx", "type", "defaultChecked", "tabIndex", "aria-hidden", "style", "position", "pointerEvents", "opacity", "margin", "appearance"]
|
|
6
6
|
}
|
|
@@ -21,104 +21,12 @@ __export(useRadioGroup_exports, {
|
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(useRadioGroup_exports);
|
|
23
23
|
var import_jsx_runtime = require("react/jsx-runtime"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_focusable = require("@tamagui/focusable"), import_helpers = require("@tamagui/helpers"), import_label = require("@tamagui/label"), import_use_controllable_state = require("@tamagui/use-controllable-state"), import_react = require("react"), import_BubbleInput = require("./BubbleInput"), import_utils = require("./utils");
|
|
24
|
-
function _array_like_to_array(arr, len) {
|
|
25
|
-
(len == null || len > arr.length) && (len = arr.length);
|
|
26
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
27
|
-
return arr2;
|
|
28
|
-
}
|
|
29
|
-
function _array_with_holes(arr) {
|
|
30
|
-
if (Array.isArray(arr)) return arr;
|
|
31
|
-
}
|
|
32
|
-
function _define_property(obj, key, value) {
|
|
33
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
34
|
-
value,
|
|
35
|
-
enumerable: !0,
|
|
36
|
-
configurable: !0,
|
|
37
|
-
writable: !0
|
|
38
|
-
}) : obj[key] = value, obj;
|
|
39
|
-
}
|
|
40
|
-
function _iterable_to_array_limit(arr, i) {
|
|
41
|
-
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
42
|
-
if (_i != null) {
|
|
43
|
-
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
44
|
-
try {
|
|
45
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
46
|
-
;
|
|
47
|
-
} catch (err) {
|
|
48
|
-
_d = !0, _e = err;
|
|
49
|
-
} finally {
|
|
50
|
-
try {
|
|
51
|
-
!_n && _i.return != null && _i.return();
|
|
52
|
-
} finally {
|
|
53
|
-
if (_d) throw _e;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return _arr;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function _non_iterable_rest() {
|
|
60
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
61
|
-
}
|
|
62
|
-
function _object_spread(target) {
|
|
63
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
64
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
65
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
66
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
67
|
-
}))), ownKeys2.forEach(function(key) {
|
|
68
|
-
_define_property(target, key, source[key]);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return target;
|
|
72
|
-
}
|
|
73
|
-
function ownKeys(object, enumerableOnly) {
|
|
74
|
-
var keys = Object.keys(object);
|
|
75
|
-
if (Object.getOwnPropertySymbols) {
|
|
76
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
77
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
78
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
79
|
-
})), keys.push.apply(keys, symbols);
|
|
80
|
-
}
|
|
81
|
-
return keys;
|
|
82
|
-
}
|
|
83
|
-
function _object_spread_props(target, source) {
|
|
84
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
85
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
86
|
-
}), target;
|
|
87
|
-
}
|
|
88
|
-
function _object_without_properties(source, excluded) {
|
|
89
|
-
if (source == null) return {};
|
|
90
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
91
|
-
if (Object.getOwnPropertySymbols) {
|
|
92
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
93
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
94
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
95
|
-
}
|
|
96
|
-
return target;
|
|
97
|
-
}
|
|
98
|
-
function _object_without_properties_loose(source, excluded) {
|
|
99
|
-
if (source == null) return {};
|
|
100
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
101
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
102
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
103
|
-
return target;
|
|
104
|
-
}
|
|
105
|
-
function _sliced_to_array(arr, i) {
|
|
106
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
107
|
-
}
|
|
108
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
109
|
-
if (o) {
|
|
110
|
-
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
111
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
112
|
-
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
113
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
24
|
function useRadioGroup(params) {
|
|
117
|
-
var
|
|
25
|
+
var { value: valueProp, onValueChange, defaultValue, required, disabled, name, native, accentColor, orientation, ref } = params, [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
118
26
|
prop: valueProp,
|
|
119
27
|
defaultProp: defaultValue,
|
|
120
28
|
onChange: onValueChange
|
|
121
|
-
})
|
|
29
|
+
});
|
|
122
30
|
return {
|
|
123
31
|
providerValue: {
|
|
124
32
|
value,
|
|
@@ -146,7 +54,7 @@ var ARROW_KEYS = [
|
|
|
146
54
|
"ArrowLeft",
|
|
147
55
|
"ArrowRight"
|
|
148
56
|
], useRadioGroupItem = function(params) {
|
|
149
|
-
var
|
|
57
|
+
var { radioGroupContext, value, labelledBy: ariaLabelledby, disabled: itemDisabled, ref: refProp, id, onPress, onKeyDown, onFocus } = params, { value: groupValue, disabled, required, onChange, name, native, accentColor } = (0, import_react.useContext)(radioGroupContext), [button, setButton] = (0, import_react.useState)(null), hasConsumerStoppedPropagationRef = (0, import_react.useRef)(!1), ref = (0, import_react.useRef)(null), composedRefs = (0, import_compose_refs.useComposedRefs)(refProp, function(node) {
|
|
150
58
|
return setButton(node);
|
|
151
59
|
}, ref), isArrowKeyPressedRef = (0, import_react.useRef)(!1), isFormControl = import_constants.isWeb ? button ? !!button.closest("form") : !0 : !1, checked = groupValue === value, labelId = (0, import_label.useLabelContext)(button), labelledBy = ariaLabelledby || labelId;
|
|
152
60
|
(0, import_react.useEffect)(function() {
|
|
@@ -181,7 +89,7 @@ var ARROW_KEYS = [
|
|
|
181
89
|
},
|
|
182
90
|
checked,
|
|
183
91
|
isFormControl,
|
|
184
|
-
bubbleInput: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BubbleInput.BubbleInput,
|
|
92
|
+
bubbleInput: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BubbleInput.BubbleInput, {
|
|
185
93
|
isHidden: !native,
|
|
186
94
|
control: button,
|
|
187
95
|
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
@@ -189,13 +97,14 @@ var ARROW_KEYS = [
|
|
|
189
97
|
value,
|
|
190
98
|
checked,
|
|
191
99
|
required,
|
|
192
|
-
disabled: isDisabled
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
100
|
+
disabled: isDisabled,
|
|
101
|
+
...import_constants.isWeb && native && {
|
|
102
|
+
accentColor,
|
|
103
|
+
id
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
197
106
|
native,
|
|
198
|
-
frameAttrs:
|
|
107
|
+
frameAttrs: {
|
|
199
108
|
"data-state": (0, import_utils.getState)(checked),
|
|
200
109
|
"data-disabled": isDisabled ? "" : void 0,
|
|
201
110
|
role: "radio",
|
|
@@ -203,26 +112,27 @@ var ARROW_KEYS = [
|
|
|
203
112
|
"aria-checked": checked,
|
|
204
113
|
"aria-required": required,
|
|
205
114
|
disabled: isDisabled,
|
|
206
|
-
ref: composedRefs
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
115
|
+
ref: composedRefs,
|
|
116
|
+
...import_constants.isWeb && {
|
|
117
|
+
type: "button",
|
|
118
|
+
value
|
|
119
|
+
},
|
|
211
120
|
id,
|
|
212
121
|
onPress: (0, import_helpers.composeEventHandlers)(onPress, function(event) {
|
|
213
122
|
checked || onChange == null || onChange(value), isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
|
|
214
|
-
})
|
|
215
|
-
}), import_constants.isWeb && {
|
|
216
|
-
onKeyDown: (0, import_helpers.composeEventHandlers)(onKeyDown, function(event) {
|
|
217
|
-
event.key === "Enter" && event.preventDefault();
|
|
218
123
|
}),
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
124
|
+
...import_constants.isWeb && {
|
|
125
|
+
onKeyDown: (0, import_helpers.composeEventHandlers)(onKeyDown, function(event) {
|
|
126
|
+
event.key === "Enter" && event.preventDefault();
|
|
127
|
+
}),
|
|
128
|
+
onFocus: (0, import_helpers.composeEventHandlers)(onFocus, function() {
|
|
129
|
+
if (isArrowKeyPressedRef.current) {
|
|
130
|
+
var _ref_current;
|
|
131
|
+
(_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.click();
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
},
|
|
226
136
|
rovingFocusGroupAttrs: {
|
|
227
137
|
asChild: "expect-style",
|
|
228
138
|
focusable: !isDisabled,
|
|
@@ -231,15 +141,13 @@ var ARROW_KEYS = [
|
|
|
231
141
|
};
|
|
232
142
|
};
|
|
233
143
|
function useRadioGroupItemIndicator(params) {
|
|
234
|
-
var
|
|
235
|
-
|
|
236
|
-
"disabled"
|
|
237
|
-
]), checked = (0, import_react.useContext)(radioGroupItemContext).checked;
|
|
238
|
-
return _object_spread({
|
|
144
|
+
var { radioGroupItemContext, disabled, ...rest } = params, { checked } = (0, import_react.useContext)(radioGroupItemContext);
|
|
145
|
+
return {
|
|
239
146
|
checked,
|
|
240
147
|
"data-state": (0, import_utils.getState)(checked),
|
|
241
|
-
"data-disabled": disabled ? "" : void 0
|
|
242
|
-
|
|
148
|
+
"data-disabled": disabled ? "" : void 0,
|
|
149
|
+
...rest
|
|
150
|
+
};
|
|
243
151
|
}
|
|
244
152
|
// Annotate the CommonJS export names for ESM import in node:
|
|
245
153
|
0 && (module.exports = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/radio-headless/src/useRadioGroup.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;uDAAA,sBAAgC,kCAChC,mBAAsB,+BACtB,mBAAkC,+BAClC,iBAAqC,6BACrC,eAAgC,2BAChC,gCAAqC,4CAGrC,eAAwD,kBAExD,qBAA4B,0BAC5B,eAAyB
|
|
5
|
-
"names": ["useRadioGroup", "params", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;uDAAA,sBAAgC,kCAChC,mBAAsB,+BACtB,mBAAkC,+BAClC,iBAAqC,6BACrC,eAAgC,2BAChC,gCAAqC,4CAGrC,eAAwD,kBAExD,qBAA4B,0BAC5B,eAAyB;AAclB,SAASA,cAAcC,QAA2B;AACvD,MAAM,EACJC,OAAOC,WACPC,eACAC,cACAC,UACAC,UACAC,MACAC,QACAC,aACAC,aACAC,IAAG,IACDX,QACE,CAACC,OAAOW,QAAAA,QAAYC,oDAAqB;IAC7CC,MAAMZ;IACNa,aAAaX;IACbY,UAAUb;EACZ,CAAA;AAEA,SAAO;IACLc,eAAe;MACbhB;MACAe,UAAUJ;MACVP;MACAC;MACAC;MACAC;MACAC;IACF;IACAS,YAAY;MACVC,MAAM;MACN,oBAAoBT;MACpB,iBAAiBJ,WAAW,KAAKc;IACnC;IACAC,uBAAuB;MACrBX;MACAY,MAAM;IACR;EACF;AACF;AAwBA,IAAMC,aAAa;EAAC;EAAW;EAAa;EAAa;GAE5CC,oBAAoB,SAACxB,QAAAA;AAChC,MAAM,EACJyB,mBACAxB,OACAyB,YAAYC,gBACZrB,U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"names": ["useRadioGroup", "params", "value", "valueProp", "onValueChange", "defaultValue", "required", "disabled", "name", "native", "accentColor", "orientation", "ref", "setValue", "useControllableState", "prop", "defaultProp", "onChange", "providerValue", "frameAttrs", "role", "undefined", "rovingFocusGroupAttrs", "loop", "ARROW_KEYS", "useRadioGroupItem", "radioGroupContext", "labelledBy", "ariaLabelledby", "itemDisabled", "refProp", "id", "onPress", "onKeyDown", "onFocus", "groupValue", "useContext", "button", "setButton", "useState", "hasConsumerStoppedPropagationRef", "useRef", "composedRefs", "useComposedRefs", "node", "isArrowKeyPressedRef", "isFormControl", "isWeb", "Boolean", "closest", "checked", "labelId", "useLabelContext", "useEffect", "handleKeyDown", "event", "includes", "key", "current", "handleKeyUp", "document", "addEventListener", "removeEventListener", "registerFocusable", "focusAndSelect", "focus", "isDisabled", "bubbleInput", "_jsx", "BubbleInput", "isHidden", "control", "bubbles", "getState", "type", "composeEventHandlers", "isPropagationStopped", "stopPropagation", "preventDefault", "click", "asChild", "focusable", "active", "useRadioGroupItemIndicator", "radioGroupItemContext", "rest"]
|
|
6
6
|
}
|
|
@@ -1,65 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { usePrevious } from "@tamagui/use-previous";
|
|
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) return {};
|
|
40
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
41
|
-
if (Object.getOwnPropertySymbols) {
|
|
42
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
43
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
44
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
45
|
-
}
|
|
46
|
-
return target;
|
|
47
|
-
}
|
|
48
|
-
function _object_without_properties_loose(source, excluded) {
|
|
49
|
-
if (source == null) return {};
|
|
50
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
51
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
52
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
53
|
-
return target;
|
|
54
|
-
}
|
|
55
4
|
var BubbleInput = function(props) {
|
|
56
|
-
var
|
|
57
|
-
"checked",
|
|
58
|
-
"bubbles",
|
|
59
|
-
"control",
|
|
60
|
-
"isHidden",
|
|
61
|
-
"accentColor"
|
|
62
|
-
]), ref = React.useRef(null), prevChecked = usePrevious(checked);
|
|
5
|
+
var { checked, bubbles = !0, control, isHidden, accentColor, ...inputProps } = props, ref = React.useRef(null), prevChecked = usePrevious(checked);
|
|
63
6
|
return React.useEffect(function() {
|
|
64
7
|
var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
|
|
65
8
|
if (prevChecked !== checked && setChecked) {
|
|
@@ -72,24 +15,27 @@ var BubbleInput = function(props) {
|
|
|
72
15
|
prevChecked,
|
|
73
16
|
checked,
|
|
74
17
|
bubbles
|
|
75
|
-
]), /* @__PURE__ */ _jsx("input",
|
|
18
|
+
]), /* @__PURE__ */ _jsx("input", {
|
|
76
19
|
type: "radio",
|
|
77
|
-
defaultChecked: checked
|
|
78
|
-
|
|
20
|
+
defaultChecked: checked,
|
|
21
|
+
...inputProps,
|
|
79
22
|
tabIndex: -1,
|
|
80
23
|
ref,
|
|
81
24
|
"aria-hidden": isHidden,
|
|
82
|
-
style:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
25
|
+
style: {
|
|
26
|
+
...isHidden ? {
|
|
27
|
+
// ...controlSize,
|
|
28
|
+
position: "absolute",
|
|
29
|
+
pointerEvents: "none",
|
|
30
|
+
opacity: 0,
|
|
31
|
+
margin: 0
|
|
32
|
+
} : {
|
|
33
|
+
appearance: "auto",
|
|
34
|
+
accentColor
|
|
35
|
+
},
|
|
36
|
+
...props.style
|
|
37
|
+
}
|
|
38
|
+
});
|
|
93
39
|
};
|
|
94
40
|
export {
|
|
95
41
|
BubbleInput
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/radio-headless/src/BubbleInput.tsx"],
|
|
4
|
-
"mappings": ";AAAA,OAAOA,WAAW;AAClB,SAASC,mBAAmB
|
|
4
|
+
"mappings": ";AAAA,OAAOA,WAAW;AAClB,SAASC,mBAAmB;AAUrB,IAAMC,cAAc,SAACC,OAAAA;AAC1B,MAAM,EAAEC,SAASC,UAAU,IAAMC,SAASC,UAAUC,aAAa,GAAGC,WAAAA,IAAeN,OAC7EO,MAAMV,MAAMW,OAAyB,IAAA,GACrCC,cAAcX,YAAYG,OAAAA;AAGhCJ,eAAMa,UAAU,WAAA;AACd,QAAMC,QAAQJ,IAAIK,SACZC,aAAaC,OAAOC,iBAAiBC,WACrCC,aAAaC,OAAOC,yBACxBN,YACA,SAAA,GAEIO,aAAaH,WAAWI;AAC9B,QAAIZ,gBAAgBR,WAAWmB,YAAY;AACzC,UAAME,QAAQ,IAAIC,MAAM,SAAS;QAAErB;MAAQ,CAAA;AAC3CkB,iBAAWI,KAAKb,OAAOV,OAAAA,GACvBU,MAAMc,cAAcH,KAAAA;IACtB;EACF,GAAG;IAACb;IAAaR;IAASC;GAAQ,GAGhC,qBAACS,SAAAA;IACCe,MAAK;IACLC,gBAAgB1B;IACf,GAAGK;IACJsB,UAAU;IACVrB;IACAsB,eAAazB;IACb0B,OAAO;MACL,GAAI1B,WACA;;QAEE2B,UAAU;QACVC,eAAe;QACfC,SAAS;QACTC,QAAQ;MACV,IACA;QACEC,YAAY;QACZ9B;MACF;MAEJ,GAAGL,MAAM8B;IACX;;AAGN;",
|
|
5
5
|
"names": ["React", "usePrevious", "BubbleInput", "props", "checked", "bubbles", "control", "isHidden", "accentColor", "inputProps", "ref", "useRef", "prevChecked", "useEffect", "input", "current", "inputProto", "window", "HTMLInputElement", "prototype", "descriptor", "Object", "getOwnPropertyDescriptor", "setChecked", "set", "event", "Event", "call", "dispatchEvent", "type", "defaultChecked", "tabIndex", "aria-hidden", "style", "position", "pointerEvents", "opacity", "margin", "appearance"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { usePrevious } from "@tamagui/use-previous";
|
|
4
|
+
var BubbleInput = function (props) {
|
|
5
|
+
var {
|
|
6
|
+
checked,
|
|
7
|
+
bubbles = !0,
|
|
8
|
+
control,
|
|
9
|
+
isHidden,
|
|
10
|
+
accentColor,
|
|
11
|
+
...inputProps
|
|
12
|
+
} = props,
|
|
13
|
+
ref = React.useRef(null),
|
|
14
|
+
prevChecked = usePrevious(checked);
|
|
15
|
+
return React.useEffect(function () {
|
|
16
|
+
var input = ref.current,
|
|
17
|
+
inputProto = window.HTMLInputElement.prototype,
|
|
18
|
+
descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"),
|
|
19
|
+
setChecked = descriptor.set;
|
|
20
|
+
if (prevChecked !== checked && setChecked) {
|
|
21
|
+
var event = new Event("click", {
|
|
22
|
+
bubbles
|
|
23
|
+
});
|
|
24
|
+
setChecked.call(input, checked), input.dispatchEvent(event);
|
|
25
|
+
}
|
|
26
|
+
}, [prevChecked, checked, bubbles]), /* @__PURE__ */_jsx("input", {
|
|
27
|
+
type: "radio",
|
|
28
|
+
defaultChecked: checked,
|
|
29
|
+
...inputProps,
|
|
30
|
+
tabIndex: -1,
|
|
31
|
+
ref,
|
|
32
|
+
"aria-hidden": isHidden,
|
|
33
|
+
style: {
|
|
34
|
+
...(isHidden ? {
|
|
35
|
+
// ...controlSize,
|
|
36
|
+
position: "absolute",
|
|
37
|
+
pointerEvents: "none",
|
|
38
|
+
opacity: 0,
|
|
39
|
+
margin: 0
|
|
40
|
+
} : {
|
|
41
|
+
appearance: "auto",
|
|
42
|
+
accentColor
|
|
43
|
+
}),
|
|
44
|
+
...props.style
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
export { BubbleInput };
|
|
49
|
+
//# sourceMappingURL=BubbleInput.native.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["jsx","_jsx","React","usePrevious","BubbleInput","props","checked","bubbles","control","isHidden","accentColor","inputProps","ref","useRef","prevChecked","useEffect","input","current","inputProto","window","HTMLInputElement","prototype","descriptor","Object","getOwnPropertyDescriptor","setChecked","set","event","Event","call","dispatchEvent","type","defaultChecked","tabIndex","style","position","pointerEvents","opacity","margin","appearance"],"sources":["../../src/BubbleInput.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAOA,GAAA,IAAAC,IAAW;AAClB,OAAAC,KAAS;AAgCL,SAAAC,WAAA;AAtBG,IAAAC,WAAM,YAAAA,CAAeC,KAA4B;EACtD;MAAMC,OAAE;MAAAC,OAAS,KAAU;MAAAC,OAAM;MAAAC,QAAS;MAAAC,WAAU;MAAA,GAAaC;IAAG,IAAWN,KAAI;IAAAO,GAC7E,GAAAV,KAAM,CAAAW,MAAM,KAAyB;IAAIC,WACzC,GAAAX,WAAc,CAAAG,OAAY;EAGhC,OAAAJ,KAAA,CAAMa,SAAA,CAAU,YAAM;IACpB,IAAAC,KAAM,GAAAJ,GAAQ,CAAAK,OAAI;MAAAC,UACZ,GAAAC,MAAa,CAAAC,gBAAO,CAAAC,SAAiB;MAAAC,UAKrC,GAAAC,MAJa,CAAAC,wBAAO,CAAAN,UAAA;MAAAO,UAAA,GAAAH,UAAA,CAAAI,GAAA;IAAA,IACxBZ,WAAA,KAAAR,OAAA,IAAAmB,UAAA;MACA,IAAAE,KAAA,OAAAC,KAAA;QAE4BrB;MAC9B,EAAI;MACFkB,UAAM,CAAAI,IAAQ,CAAAb,KAAI,EAAAV,OAAM,GAASU,KAAE,CAAAc,aAAS,CAAAH,KAAA;IAC5C;EACyB,GAC3B,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