@tamagui/radio-headless 1.97.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.
Files changed (70) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/BubbleInput.js +65 -0
  3. package/dist/cjs/BubbleInput.js.map +6 -0
  4. package/dist/cjs/BubbleInput.native.js +126 -0
  5. package/dist/cjs/BubbleInput.native.js.map +6 -0
  6. package/dist/cjs/index.js +16 -0
  7. package/dist/cjs/index.js.map +6 -0
  8. package/dist/cjs/index.native.js +22 -0
  9. package/dist/cjs/index.native.js.map +6 -0
  10. package/dist/cjs/useRadioGroup.js +160 -0
  11. package/dist/cjs/useRadioGroup.js.map +6 -0
  12. package/dist/cjs/useRadioGroup.native.js +258 -0
  13. package/dist/cjs/useRadioGroup.native.js.map +6 -0
  14. package/dist/cjs/utils.js +23 -0
  15. package/dist/cjs/utils.js.map +6 -0
  16. package/dist/cjs/utils.native.js +28 -0
  17. package/dist/cjs/utils.native.js.map +6 -0
  18. package/dist/esm/BubbleInput.js +43 -0
  19. package/dist/esm/BubbleInput.js.map +6 -0
  20. package/dist/esm/BubbleInput.mjs +47 -0
  21. package/dist/esm/BubbleInput.native.js +99 -0
  22. package/dist/esm/BubbleInput.native.js.map +6 -0
  23. package/dist/esm/index.js +3 -0
  24. package/dist/esm/index.js.map +6 -0
  25. package/dist/esm/index.mjs +2 -0
  26. package/dist/esm/index.native.js +3 -0
  27. package/dist/esm/index.native.js.map +6 -0
  28. package/dist/esm/useRadioGroup.js +153 -0
  29. package/dist/esm/useRadioGroup.js.map +6 -0
  30. package/dist/esm/useRadioGroup.mjs +165 -0
  31. package/dist/esm/useRadioGroup.native.js +244 -0
  32. package/dist/esm/useRadioGroup.native.js.map +6 -0
  33. package/dist/esm/utils.js +7 -0
  34. package/dist/esm/utils.js.map +6 -0
  35. package/dist/esm/utils.mjs +4 -0
  36. package/dist/esm/utils.native.js +7 -0
  37. package/dist/esm/utils.native.js.map +6 -0
  38. package/dist/jsx/BubbleInput.js +43 -0
  39. package/dist/jsx/BubbleInput.js.map +6 -0
  40. package/dist/jsx/BubbleInput.mjs +47 -0
  41. package/dist/jsx/BubbleInput.native.js +99 -0
  42. package/dist/jsx/BubbleInput.native.js.map +6 -0
  43. package/dist/jsx/index.js +3 -0
  44. package/dist/jsx/index.js.map +6 -0
  45. package/dist/jsx/index.mjs +2 -0
  46. package/dist/jsx/index.native.js +3 -0
  47. package/dist/jsx/index.native.js.map +6 -0
  48. package/dist/jsx/useRadioGroup.js +153 -0
  49. package/dist/jsx/useRadioGroup.js.map +6 -0
  50. package/dist/jsx/useRadioGroup.mjs +165 -0
  51. package/dist/jsx/useRadioGroup.native.js +244 -0
  52. package/dist/jsx/useRadioGroup.native.js.map +6 -0
  53. package/dist/jsx/utils.js +7 -0
  54. package/dist/jsx/utils.js.map +6 -0
  55. package/dist/jsx/utils.mjs +4 -0
  56. package/dist/jsx/utils.native.js +7 -0
  57. package/dist/jsx/utils.native.js.map +6 -0
  58. package/package.json +55 -0
  59. package/src/BubbleInput.tsx +59 -0
  60. package/src/index.ts +2 -0
  61. package/src/useRadioGroup.tsx +256 -0
  62. package/src/utils.tsx +3 -0
  63. package/types/BubbleInput.d.ts +11 -0
  64. package/types/BubbleInput.d.ts.map +1 -0
  65. package/types/index.d.ts +3 -0
  66. package/types/index.d.ts.map +1 -0
  67. package/types/useRadioGroup.d.ts +100 -0
  68. package/types/useRadioGroup.d.ts.map +1 -0
  69. package/types/utils.d.ts +2 -0
  70. package/types/utils.d.ts.map +1 -0
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var useRadioGroup_exports = {};
17
+ __export(useRadioGroup_exports, {
18
+ useRadioGroup: () => useRadioGroup,
19
+ useRadioGroupItem: () => useRadioGroupItem,
20
+ useRadioGroupItemIndicator: () => useRadioGroupItemIndicator
21
+ });
22
+ module.exports = __toCommonJS(useRadioGroup_exports);
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++)
27
+ arr2[i] = arr[i];
28
+ return arr2;
29
+ }
30
+ function _array_with_holes(arr) {
31
+ if (Array.isArray(arr))
32
+ return arr;
33
+ }
34
+ function _define_property(obj, key, value) {
35
+ return key in obj ? Object.defineProperty(obj, key, {
36
+ value,
37
+ enumerable: !0,
38
+ configurable: !0,
39
+ writable: !0
40
+ }) : obj[key] = value, obj;
41
+ }
42
+ function _iterable_to_array_limit(arr, i) {
43
+ var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
44
+ if (_i != null) {
45
+ var _arr = [], _n = !0, _d = !1, _s, _e;
46
+ try {
47
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
48
+ ;
49
+ } catch (err) {
50
+ _d = !0, _e = err;
51
+ } finally {
52
+ try {
53
+ !_n && _i.return != null && _i.return();
54
+ } finally {
55
+ if (_d)
56
+ throw _e;
57
+ }
58
+ }
59
+ return _arr;
60
+ }
61
+ }
62
+ function _non_iterable_rest() {
63
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
64
+ }
65
+ function _object_spread(target) {
66
+ for (var i = 1; i < arguments.length; i++) {
67
+ var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
68
+ typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
69
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
70
+ }))), ownKeys2.forEach(function(key) {
71
+ _define_property(target, key, source[key]);
72
+ });
73
+ }
74
+ return target;
75
+ }
76
+ function ownKeys(object, enumerableOnly) {
77
+ var keys = Object.keys(object);
78
+ if (Object.getOwnPropertySymbols) {
79
+ var symbols = Object.getOwnPropertySymbols(object);
80
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
81
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
82
+ })), keys.push.apply(keys, symbols);
83
+ }
84
+ return keys;
85
+ }
86
+ function _object_spread_props(target, source) {
87
+ return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
88
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
89
+ }), target;
90
+ }
91
+ function _object_without_properties(source, excluded) {
92
+ if (source == null)
93
+ return {};
94
+ var target = _object_without_properties_loose(source, excluded), key, i;
95
+ if (Object.getOwnPropertySymbols) {
96
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
97
+ for (i = 0; i < sourceSymbolKeys.length; i++)
98
+ key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
99
+ }
100
+ return target;
101
+ }
102
+ function _object_without_properties_loose(source, excluded) {
103
+ if (source == null)
104
+ return {};
105
+ var target = {}, sourceKeys = Object.keys(source), key, i;
106
+ for (i = 0; i < sourceKeys.length; i++)
107
+ key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
108
+ return target;
109
+ }
110
+ function _sliced_to_array(arr, i) {
111
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
112
+ }
113
+ function _unsupported_iterable_to_array(o, minLen) {
114
+ if (o) {
115
+ if (typeof o == "string")
116
+ return _array_like_to_array(o, minLen);
117
+ var n = Object.prototype.toString.call(o).slice(8, -1);
118
+ if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
119
+ return Array.from(n);
120
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
121
+ return _array_like_to_array(o, minLen);
122
+ }
123
+ }
124
+ function useRadioGroup(params) {
125
+ var valueProp = params.value, onValueChange = params.onValueChange, defaultValue = params.defaultValue, required = params.required, disabled = params.disabled, name = params.name, native = params.native, accentColor = params.accentColor, orientation = params.orientation, ref = params.ref, _useControllableState = _sliced_to_array((0, import_use_controllable_state.useControllableState)({
126
+ prop: valueProp,
127
+ defaultProp: defaultValue,
128
+ onChange: onValueChange
129
+ }), 2), value = _useControllableState[0], setValue = _useControllableState[1];
130
+ return {
131
+ providerValue: {
132
+ value,
133
+ onChange: setValue,
134
+ required,
135
+ disabled,
136
+ name,
137
+ native,
138
+ accentColor
139
+ },
140
+ frameAttrs: {
141
+ role: "radiogroup",
142
+ "aria-orientation": orientation,
143
+ "data-disabled": disabled ? "" : void 0
144
+ },
145
+ rovingFocusGroupAttrs: {
146
+ orientation,
147
+ loop: !0
148
+ }
149
+ };
150
+ }
151
+ var ARROW_KEYS = [
152
+ "ArrowUp",
153
+ "ArrowDown",
154
+ "ArrowLeft",
155
+ "ArrowRight"
156
+ ], useRadioGroupItem = function(params) {
157
+ var radioGroupContext = params.radioGroupContext, value = params.value, ariaLabelledby = params.labelledBy, itemDisabled = params.disabled, refProp = params.ref, id = params.id, onPress = params.onPress, onKeyDown = params.onKeyDown, onFocus = params.onFocus, _useContext = (0, import_react.useContext)(radioGroupContext), groupValue = _useContext.value, disabled = _useContext.disabled, required = _useContext.required, onChange = _useContext.onChange, name = _useContext.name, native = _useContext.native, accentColor = _useContext.accentColor, _useState = _sliced_to_array((0, import_react.useState)(null), 2), button = _useState[0], setButton = _useState[1], hasConsumerStoppedPropagationRef = (0, import_react.useRef)(!1), ref = (0, import_react.useRef)(null), composedRefs = (0, import_compose_refs.useComposedRefs)(refProp, function(node) {
158
+ return setButton(node);
159
+ }, 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;
160
+ (0, import_react.useEffect)(function() {
161
+ if (import_constants.isWeb) {
162
+ var handleKeyDown = function(event) {
163
+ ARROW_KEYS.includes(event.key) && (isArrowKeyPressedRef.current = !0);
164
+ }, handleKeyUp = function() {
165
+ isArrowKeyPressedRef.current = !1;
166
+ };
167
+ return document.addEventListener("keydown", handleKeyDown), document.addEventListener("keyup", handleKeyUp), function() {
168
+ document.removeEventListener("keydown", handleKeyDown), document.removeEventListener("keyup", handleKeyUp);
169
+ };
170
+ }
171
+ }, []), (0, import_react.useEffect)(function() {
172
+ if (id && !disabled)
173
+ return (0, import_focusable.registerFocusable)(id, {
174
+ focusAndSelect: function() {
175
+ onChange == null || onChange(value);
176
+ },
177
+ focus: function() {
178
+ }
179
+ });
180
+ }, [
181
+ id,
182
+ value,
183
+ disabled
184
+ ]);
185
+ var isDisabled = disabled || itemDisabled;
186
+ return {
187
+ providerValue: {
188
+ checked
189
+ },
190
+ checked,
191
+ isFormControl,
192
+ bubbleInput: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BubbleInput.BubbleInput, _object_spread({
193
+ isHidden: !native,
194
+ control: button,
195
+ bubbles: !hasConsumerStoppedPropagationRef.current,
196
+ name,
197
+ value,
198
+ checked,
199
+ required,
200
+ disabled: isDisabled
201
+ }, import_constants.isWeb && native && {
202
+ accentColor,
203
+ id
204
+ })),
205
+ native,
206
+ frameAttrs: _object_spread(_object_spread_props(_object_spread({
207
+ "data-state": (0, import_utils.getState)(checked),
208
+ "data-disabled": isDisabled ? "" : void 0,
209
+ role: "radio",
210
+ "aria-labelledby": labelledBy,
211
+ "aria-checked": checked,
212
+ "aria-required": required,
213
+ disabled: isDisabled,
214
+ ref: composedRefs
215
+ }, import_constants.isWeb && {
216
+ type: "button",
217
+ value
218
+ }), {
219
+ id,
220
+ onPress: (0, import_helpers.composeEventHandlers)(onPress, function(event) {
221
+ checked || onChange == null || onChange(value), isFormControl && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());
222
+ })
223
+ }), import_constants.isWeb && {
224
+ onKeyDown: (0, import_helpers.composeEventHandlers)(onKeyDown, function(event) {
225
+ event.key === "Enter" && event.preventDefault();
226
+ }),
227
+ onFocus: (0, import_helpers.composeEventHandlers)(onFocus, function() {
228
+ if (isArrowKeyPressedRef.current) {
229
+ var _ref_current;
230
+ (_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.click();
231
+ }
232
+ })
233
+ }),
234
+ rovingFocusGroupAttrs: {
235
+ asChild: "expect-style",
236
+ focusable: !isDisabled,
237
+ active: checked
238
+ }
239
+ };
240
+ };
241
+ function useRadioGroupItemIndicator(params) {
242
+ var radioGroupItemContext = params.radioGroupItemContext, disabled = params.disabled, rest = _object_without_properties(params, [
243
+ "radioGroupItemContext",
244
+ "disabled"
245
+ ]), checked = (0, import_react.useContext)(radioGroupItemContext).checked;
246
+ return _object_spread({
247
+ checked,
248
+ "data-state": (0, import_utils.getState)(checked),
249
+ "data-disabled": disabled ? "" : void 0
250
+ }, rest);
251
+ }
252
+ // Annotate the CommonJS export names for ESM import in node:
253
+ 0 && (module.exports = {
254
+ useRadioGroup,
255
+ useRadioGroupItem,
256
+ useRadioGroupItemIndicator
257
+ });
258
+ //# sourceMappingURL=useRadioGroup.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/packages/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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAclB,SAASA,cAAcC,QAA2B;AACvD,MACSC,YAULD,OAVFE,OACAC,gBASEH,OATFG,eACAC,eAQEJ,OARFI,cACAC,WAOEL,OAPFK,UACAC,WAMEN,OANFM,UACAC,OAKEP,OALFO,MACAC,SAIER,OAJFQ,QACAC,cAGET,OAHFS,aACAC,cAEEV,OAFFU,aACAC,MACEX,OADFW,KAEwBC,wBAAAA,qBAAAA,oDAAqB;IAC7CC,MAAMZ;IACNa,aAAaV;IACbW,UAAUZ;EACZ,CAAA,GAAA,CAAA,GAJOD,QAAmBU,sBAAAA,CAAAA,GAAZI,WAAYJ,sBAAAA,CAAAA;AAM1B,SAAO;IACLK,eAAe;MACbf;MACAa,UAAUC;MACVX;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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AI8C,aAAO,QAAX9C,iBAAAA,UAAAA,aAAmCmE,MAAK;QAC5C;MACF,CAAA;IACF,CAAA;IAEFzD,uBAAuB;MACrB0D,SAAS;MACTC,WAAW,CAACf;MACZgB,QAAQhC;IACV;EACF;AACF;AAWO,SAASiC,2BAA2BlF,QAAwC;AACjF,MAAQmF,wBAA6CnF,OAA7CmF,uBAAuB7E,WAAsBN,OAAtBM,UAAa8E,OAAAA,2BAASpF,QAAAA;IAA7CmF;IAAuB7E;MACvB2C,cAAYf,yBAAWiD,qBAAAA,EAAvBlC;AAER,SAAO,eAAA;IACLA;IACA,kBAAcuB,uBAASvB,OAAAA;IACvB,iBAAiB3C,WAAW,KAAKc;KAC9BgE,IAAAA;AAEP;",
5
+ "names": ["useRadioGroup", "params", "valueProp", "value", "onValueChange", "defaultValue", "required", "disabled", "name", "native", "accentColor", "orientation", "ref", "useControllableState", "prop", "defaultProp", "onChange", "setValue", "providerValue", "frameAttrs", "role", "undefined", "rovingFocusGroupAttrs", "loop", "ARROW_KEYS", "useRadioGroupItem", "radioGroupContext", "ariaLabelledby", "labelledBy", "itemDisabled", "refProp", "id", "onPress", "onKeyDown", "onFocus", "useContext", "groupValue", "useState", "button", "setButton", "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
+ }
@@ -0,0 +1,23 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var utils_exports = {};
16
+ __export(utils_exports, {
17
+ getState: () => getState
18
+ });
19
+ module.exports = __toCommonJS(utils_exports);
20
+ function getState(checked) {
21
+ return checked ? "checked" : "unchecked";
22
+ }
23
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,SAAS,SAAkB;AACzC,SAAO,UAAU,YAAY;AAC/B;",
5
+ "names": []
6
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var utils_exports = {};
17
+ __export(utils_exports, {
18
+ getState: () => getState
19
+ });
20
+ module.exports = __toCommonJS(utils_exports);
21
+ function getState(checked) {
22
+ return checked ? "checked" : "unchecked";
23
+ }
24
+ // Annotate the CommonJS export names for ESM import in node:
25
+ 0 && (module.exports = {
26
+ getState
27
+ });
28
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/packages/radio-headless/src/utils.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;;;;;AAAO,SAASA,SAASC,SAAgB;AACvC,SAAOA,UAAU,YAAY;AAC/B;",
5
+ "names": ["getState", "checked"]
6
+ }
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { usePrevious } from "@tamagui/use-previous";
3
+ import { jsx } from "react/jsx-runtime";
4
+ const BubbleInput = (props) => {
5
+ const { checked, bubbles = !0, control, isHidden, accentColor, ...inputProps } = props, ref = React.useRef(null), prevChecked = usePrevious(checked);
6
+ return React.useEffect(() => {
7
+ const input = ref.current, inputProto = window.HTMLInputElement.prototype, setChecked = Object.getOwnPropertyDescriptor(
8
+ inputProto,
9
+ "checked"
10
+ ).set;
11
+ if (prevChecked !== checked && setChecked) {
12
+ const event = new Event("click", { bubbles });
13
+ setChecked.call(input, checked), input.dispatchEvent(event);
14
+ }
15
+ }, [prevChecked, checked, bubbles]), /* @__PURE__ */ jsx(
16
+ "input",
17
+ {
18
+ type: "radio",
19
+ defaultChecked: checked,
20
+ ...inputProps,
21
+ tabIndex: -1,
22
+ ref,
23
+ "aria-hidden": isHidden,
24
+ style: {
25
+ ...isHidden ? {
26
+ // ...controlSize,
27
+ position: "absolute",
28
+ pointerEvents: "none",
29
+ opacity: 0,
30
+ margin: 0
31
+ } : {
32
+ appearance: "auto",
33
+ accentColor
34
+ },
35
+ ...props.style
36
+ }
37
+ }
38
+ );
39
+ };
40
+ export {
41
+ BubbleInput
42
+ };
43
+ //# sourceMappingURL=BubbleInput.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/BubbleInput.tsx"],
4
+ "mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAgCxB;AAtBG,MAAM,cAAc,CAAC,UAA4B;AACtD,QAAM,EAAE,SAAS,UAAU,IAAM,SAAS,UAAU,aAAa,GAAG,WAAW,IAAI,OAC7E,MAAM,MAAM,OAAyB,IAAI,GACzC,cAAc,YAAY,OAAO;AAGvC,eAAM,UAAU,MAAM;AACpB,UAAM,QAAQ,IAAI,SACZ,aAAa,OAAO,iBAAiB,WAKrC,aAJa,OAAO;AAAA,MACxB;AAAA,MACA;AAAA,IACF,EAC8B;AAC9B,QAAI,gBAAgB,WAAW,YAAY;AACzC,YAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,QAAQ,CAAC;AAC5C,iBAAW,KAAK,OAAO,OAAO,GAC9B,MAAM,cAAc,KAAK;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,aAAa,SAAS,OAAO,CAAC,GAGhC;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,gBAAgB;AAAA,MACf,GAAG;AAAA,MACJ,UAAU;AAAA,MACV;AAAA,MACA,eAAa;AAAA,MACb,OAAO;AAAA,QACL,GAAI,WACA;AAAA;AAAA,UAEE,UAAU;AAAA,UACV,eAAe;AAAA,UACf,SAAS;AAAA,UACT,QAAQ;AAAA,QACV,IACA;AAAA,UACE,YAAY;AAAA,UACZ;AAAA,QACF;AAAA,QAEJ,GAAG,MAAM;AAAA,MACX;AAAA;AAAA,EACF;AAEJ;",
5
+ "names": []
6
+ }
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import { usePrevious } from "@tamagui/use-previous";
3
+ import { jsx } from "react/jsx-runtime";
4
+ const BubbleInput = props => {
5
+ const {
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(() => {
16
+ const input = ref.current,
17
+ inputProto = window.HTMLInputElement.prototype,
18
+ setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
19
+ if (prevChecked !== checked && setChecked) {
20
+ const event = new Event("click", {
21
+ bubbles
22
+ });
23
+ setChecked.call(input, checked), input.dispatchEvent(event);
24
+ }
25
+ }, [prevChecked, checked, bubbles]), /* @__PURE__ */jsx("input", {
26
+ type: "radio",
27
+ defaultChecked: checked,
28
+ ...inputProps,
29
+ tabIndex: -1,
30
+ ref,
31
+ "aria-hidden": isHidden,
32
+ style: {
33
+ ...(isHidden ? {
34
+ // ...controlSize,
35
+ position: "absolute",
36
+ pointerEvents: "none",
37
+ opacity: 0,
38
+ margin: 0
39
+ } : {
40
+ appearance: "auto",
41
+ accentColor
42
+ }),
43
+ ...props.style
44
+ }
45
+ });
46
+ };
47
+ export { BubbleInput };
@@ -0,0 +1,99 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
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)
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, accentColor = props.accentColor, inputProps = _object_without_properties(props, [
59
+ "checked",
60
+ "bubbles",
61
+ "control",
62
+ "isHidden",
63
+ "accentColor"
64
+ ]), ref = React.useRef(null), prevChecked = usePrevious(checked);
65
+ return React.useEffect(function() {
66
+ var input = ref.current, inputProto = window.HTMLInputElement.prototype, descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked"), setChecked = descriptor.set;
67
+ if (prevChecked !== checked && setChecked) {
68
+ var event = new Event("click", {
69
+ bubbles
70
+ });
71
+ setChecked.call(input, checked), input.dispatchEvent(event);
72
+ }
73
+ }, [
74
+ prevChecked,
75
+ checked,
76
+ bubbles
77
+ ]), /* @__PURE__ */ _jsx("input", _object_spread_props(_object_spread({
78
+ type: "radio",
79
+ defaultChecked: checked
80
+ }, inputProps), {
81
+ tabIndex: -1,
82
+ ref,
83
+ "aria-hidden": isHidden,
84
+ style: _object_spread({}, isHidden ? {
85
+ // ...controlSize,
86
+ position: "absolute",
87
+ pointerEvents: "none",
88
+ opacity: 0,
89
+ margin: 0
90
+ } : {
91
+ appearance: "auto",
92
+ accentColor
93
+ }, props.style)
94
+ }));
95
+ };
96
+ export {
97
+ BubbleInput
98
+ };
99
+ //# sourceMappingURL=BubbleInput.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/packages/radio-headless/src/BubbleInput.tsx"],
4
+ "mappings": ";AAAA,OAAOA,WAAW;AAClB,SAASC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUrB,IAAMC,cAAc,SAACC,OAAAA;AAC1B,MAAQC,UAA2ED,MAA3EC,SAAAA,iBAA2ED,MAAlEE,SAAAA,UAAAA,mBAAAA,SAAU,KAAA,gBAAMC,UAAkDH,MAAlDG,SAASC,WAAyCJ,MAAzCI,UAAUC,cAA+BL,MAA/BK,aAAgBC,aAAAA,2BAAeN,OAAAA;IAA3EC;IAASC;IAAgBC;IAASC;IAAUC;MAC9CE,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,qBAAAA,eAAAA;IACCe,MAAK;IACLC,gBAAgB1B;KACZK,UAAAA,GAAAA;IACJsB,UAAU;IACVrB;IACAsB,eAAazB;IACb0B,OAAO,eAAA,CAAA,GACD1B,WACA;;MAEE2B,UAAU;MACVC,eAAe;MACfC,SAAS;MACTC,QAAQ;IACV,IACA;MACEC,YAAY;MACZ9B;IACF,GAEDL,MAAM8B,KAAK;;AAItB;",
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
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./useRadioGroup";
2
+ export * from "./utils";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": "AAAA,cAAc;AACd,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./useRadioGroup.mjs";
2
+ export * from "./utils.mjs";
@@ -0,0 +1,3 @@
1
+ export * from "./useRadioGroup";
2
+ export * from "./utils";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/packages/radio-headless/src/index.ts"],
4
+ "mappings": "AAAA,cAAc;AACd,cAAc;",
5
+ "names": []
6
+ }