@tamagui/radio-headless 2.7.7 → 3.0.0-beta.643.1

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 (62) hide show
  1. package/dist/cjs/BubbleInput.cjs +57 -71
  2. package/dist/cjs/BubbleInput.native.cjs +75 -0
  3. package/dist/cjs/BubbleInput.native.js +57 -70
  4. package/dist/cjs/BubbleInput.native.js.map +1 -1
  5. package/dist/cjs/index.cjs +10 -11
  6. package/dist/cjs/index.native.cjs +22 -0
  7. package/dist/cjs/index.native.js +10 -10
  8. package/dist/cjs/index.native.js.map +1 -1
  9. package/dist/cjs/useRadioGroup.cjs +143 -176
  10. package/dist/cjs/useRadioGroup.native.cjs +190 -0
  11. package/dist/cjs/useRadioGroup.native.js +162 -190
  12. package/dist/cjs/useRadioGroup.native.js.map +1 -1
  13. package/dist/cjs/utils.cjs +16 -19
  14. package/dist/cjs/utils.native.cjs +29 -0
  15. package/dist/cjs/utils.native.js +16 -18
  16. package/dist/cjs/utils.native.js.map +1 -1
  17. package/dist/esm/BubbleInput.mjs +41 -45
  18. package/dist/esm/BubbleInput.mjs.map +1 -1
  19. package/dist/esm/BubbleInput.native.js +42 -46
  20. package/dist/esm/BubbleInput.native.js.map +1 -1
  21. package/dist/esm/index.js +3 -3
  22. package/dist/esm/index.mjs +3 -3
  23. package/dist/esm/index.native.js +3 -3
  24. package/dist/esm/useRadioGroup.mjs +128 -158
  25. package/dist/esm/useRadioGroup.mjs.map +1 -1
  26. package/dist/esm/useRadioGroup.native.js +147 -173
  27. package/dist/esm/useRadioGroup.native.js.map +1 -1
  28. package/dist/esm/utils.mjs +2 -1
  29. package/dist/esm/utils.mjs.map +1 -1
  30. package/dist/esm/utils.native.js +2 -1
  31. package/dist/esm/utils.native.js.map +1 -1
  32. package/dist/jsx/BubbleInput.mjs +41 -45
  33. package/dist/jsx/BubbleInput.mjs.map +1 -1
  34. package/dist/jsx/BubbleInput.native.cjs +75 -0
  35. package/dist/jsx/BubbleInput.native.js +57 -70
  36. package/dist/jsx/BubbleInput.native.js.map +1 -1
  37. package/dist/jsx/index.js +3 -3
  38. package/dist/jsx/index.mjs +3 -3
  39. package/dist/jsx/index.native.cjs +22 -0
  40. package/dist/jsx/index.native.js +10 -10
  41. package/dist/jsx/index.native.js.map +1 -1
  42. package/dist/jsx/useRadioGroup.mjs +128 -158
  43. package/dist/jsx/useRadioGroup.mjs.map +1 -1
  44. package/dist/jsx/useRadioGroup.native.cjs +190 -0
  45. package/dist/jsx/useRadioGroup.native.js +162 -190
  46. package/dist/jsx/useRadioGroup.native.js.map +1 -1
  47. package/dist/jsx/utils.mjs +2 -1
  48. package/dist/jsx/utils.mjs.map +1 -1
  49. package/dist/jsx/utils.native.cjs +29 -0
  50. package/dist/jsx/utils.native.js +16 -18
  51. package/dist/jsx/utils.native.js.map +1 -1
  52. package/package.json +12 -12
  53. package/src/useRadioGroup.tsx +1 -1
  54. package/types/BubbleInput.d.ts +1 -1
  55. package/types/BubbleInput.d.ts.map +1 -1
  56. package/types/useRadioGroup.d.ts +10 -10
  57. package/types/useRadioGroup.d.ts.map +1 -1
  58. package/dist/esm/index.js.map +0 -1
  59. package/dist/esm/index.mjs.map +0 -1
  60. package/dist/esm/index.native.js.map +0 -1
  61. package/dist/jsx/index.js.map +0 -1
  62. package/dist/jsx/index.mjs.map +0 -1
@@ -8,183 +8,157 @@ import { useControllableState } from "@tamagui/use-controllable-state";
8
8
  import { useContext, useEffect, useRef, useState } from "react";
9
9
  import { BubbleInput } from "./BubbleInput.native.js";
10
10
  import { getState } from "./utils.native.js";
11
+
11
12
  function useRadioGroup(params) {
12
- var {
13
- value: valueProp,
14
- onValueChange,
15
- defaultValue,
16
- required,
17
- disabled,
18
- name,
19
- native,
20
- accentColor,
21
- orientation,
22
- ref
23
- } = params;
24
- var [value, setValue] = useControllableState({
25
- prop: valueProp,
26
- defaultProp: defaultValue,
27
- onChange: onValueChange
28
- });
29
- return {
30
- providerValue: {
31
- value,
32
- onChange: setValue,
33
- required,
34
- disabled,
35
- name,
36
- native,
37
- accentColor
38
- },
39
- frameAttrs: {
40
- role: "radiogroup",
41
- "aria-orientation": orientation,
42
- "data-disabled": disabled ? "" : void 0
43
- },
44
- rovingFocusGroupAttrs: {
45
- orientation,
46
- loop: true
47
- }
48
- };
13
+ var { value: valueProp, onValueChange, defaultValue, required, disabled, name, native, accentColor, orientation, ref } = params;
14
+ var [value, setValue] = useControllableState({
15
+ prop: valueProp,
16
+ defaultProp: defaultValue,
17
+ onChange: onValueChange
18
+ });
19
+ return {
20
+ providerValue: {
21
+ value,
22
+ onChange: setValue,
23
+ required,
24
+ disabled,
25
+ name,
26
+ native,
27
+ accentColor
28
+ },
29
+ frameAttrs: {
30
+ role: "radiogroup",
31
+ "aria-orientation": orientation,
32
+ "data-disabled": disabled ? "" : void 0
33
+ },
34
+ rovingFocusGroupAttrs: {
35
+ orientation,
36
+ loop: true
37
+ }
38
+ };
49
39
  }
50
- var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
51
- var useRadioGroupItem = function (params) {
52
- var {
53
- radioGroupContext,
54
- value,
55
- labelledBy: ariaLabelledby,
56
- disabled: itemDisabled,
57
- ref: refProp,
58
- id,
59
- onPress,
60
- onKeyDown,
61
- onFocus
62
- } = params;
63
- var {
64
- value: groupValue,
65
- disabled,
66
- required,
67
- onChange,
68
- name,
69
- native,
70
- accentColor
71
- } = useContext(radioGroupContext);
72
- var [button, setButton] = useState(null);
73
- var hasConsumerStoppedPropagationRef = useRef(false);
74
- var ref = useRef(null);
75
- var composedRefs = useComposedRefs(refProp, function (node) {
76
- return setButton(node);
77
- }, ref);
78
- var isArrowKeyPressedRef = useRef(false);
79
- var isFormControl = isWeb ? button ? Boolean(button.closest("form")) : true : false;
80
- var checked = groupValue === value;
81
- var labelId = useLabelContext(button);
82
- var labelledBy = ariaLabelledby || labelId;
83
- useEffect(function () {
84
- if (isWeb) {
85
- var handleKeyDown = function (event) {
86
- if (ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;
87
- };
88
- var handleKeyUp = function () {
89
- isArrowKeyPressedRef.current = false;
90
- };
91
- document.addEventListener("keydown", handleKeyDown);
92
- document.addEventListener("keyup", handleKeyUp);
93
- return function () {
94
- document.removeEventListener("keydown", handleKeyDown);
95
- document.removeEventListener("keyup", handleKeyUp);
96
- };
97
- }
98
- }, []);
99
- useEffect(function () {
100
- if (!id) return;
101
- if (disabled) return;
102
- return registerFocusable(id, {
103
- focusAndSelect: function () {
104
- onChange === null || onChange === void 0 || onChange(value);
105
- },
106
- focus: function () {}
107
- });
108
- }, [id, value, disabled]);
109
- var isDisabled = disabled || itemDisabled;
110
- return {
111
- providerValue: {
112
- checked
113
- },
114
- checked,
115
- isFormControl,
116
- bubbleInput: /* @__PURE__ */jsx(BubbleInput, {
117
- isHidden: !native,
118
- control: button,
119
- bubbles: !hasConsumerStoppedPropagationRef.current,
120
- name,
121
- value,
122
- checked,
123
- required,
124
- disabled: isDisabled,
125
- ...(isWeb && native && {
126
- accentColor,
127
- id
128
- })
129
- }),
130
- native,
131
- frameAttrs: {
132
- "data-state": getState(checked),
133
- "data-disabled": isDisabled ? "" : void 0,
134
- role: "radio",
135
- "aria-labelledby": labelledBy,
136
- "aria-checked": checked,
137
- "aria-required": required,
138
- disabled: isDisabled,
139
- ref: composedRefs,
140
- ...(isWeb && {
141
- type: "button",
142
- value
143
- }),
144
- id,
145
- onPress: composeEventHandlers(onPress, function (event) {
146
- if (!checked) onChange === null || onChange === void 0 || onChange(value);
147
- if (isFormControl) {
148
- hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
149
- if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
150
- }
151
- }),
152
- ...(isWeb && {
153
- onKeyDown: composeEventHandlers(onKeyDown, function (event) {
154
- if (event.key === "Enter" || event.key === " ") {
155
- if (!checked) onChange === null || onChange === void 0 || onChange(value);
156
- }
157
- }),
158
- onFocus: composeEventHandlers(onFocus, function () {
159
- if (isArrowKeyPressedRef.current) {
160
- var _ref_current;
161
- (_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.click();
162
- }
163
- })
164
- })
165
- },
166
- rovingFocusGroupAttrs: {
167
- asChild: "except-style",
168
- focusable: !isDisabled,
169
- active: checked
170
- }
171
- };
40
+ var ARROW_KEYS = [
41
+ "ArrowUp",
42
+ "ArrowDown",
43
+ "ArrowLeft",
44
+ "ArrowRight"
45
+ ];
46
+ var useRadioGroupItem = function(params) {
47
+ var { radioGroupContext, value, labelledBy: ariaLabelledby, disabled: itemDisabled, ref: refProp, id, onPress, onKeyDown, onFocus } = params;
48
+ var { value: groupValue, disabled, required, onChange, name, native, accentColor } = useContext(radioGroupContext);
49
+ var [button, setButton] = useState(null);
50
+ var hasConsumerStoppedPropagationRef = useRef(false);
51
+ var ref = useRef(null);
52
+ var composedRefs = useComposedRefs(refProp, function(node) {
53
+ return setButton(node);
54
+ }, ref);
55
+ var isArrowKeyPressedRef = useRef(false);
56
+ var isFormControl = isWeb ? button ? Boolean(button.closest("form")) : true : false;
57
+ var checked = groupValue === value;
58
+ var labelId = useLabelContext(button);
59
+ var labelledBy = ariaLabelledby || labelId;
60
+ useEffect(function() {
61
+ if (isWeb) {
62
+ var handleKeyDown = function(event) {
63
+ if (ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;
64
+ };
65
+ var handleKeyUp = function() {
66
+ isArrowKeyPressedRef.current = false;
67
+ };
68
+ document.addEventListener("keydown", handleKeyDown);
69
+ document.addEventListener("keyup", handleKeyUp);
70
+ return function() {
71
+ document.removeEventListener("keydown", handleKeyDown);
72
+ document.removeEventListener("keyup", handleKeyUp);
73
+ };
74
+ }
75
+ }, []);
76
+ useEffect(function() {
77
+ if (!id) return;
78
+ if (disabled) return;
79
+ return registerFocusable(id, {
80
+ focusAndSelect: function() {
81
+ onChange === null || onChange === void 0 || onChange(value);
82
+ },
83
+ focus: function() {}
84
+ });
85
+ }, [
86
+ id,
87
+ value,
88
+ disabled
89
+ ]);
90
+ var isDisabled = disabled || itemDisabled;
91
+ return {
92
+ providerValue: { checked },
93
+ checked,
94
+ isFormControl,
95
+ bubbleInput: /* @__PURE__ */ jsx(BubbleInput, {
96
+ isHidden: !native,
97
+ control: button,
98
+ bubbles: !hasConsumerStoppedPropagationRef.current,
99
+ name,
100
+ value,
101
+ checked,
102
+ required,
103
+ disabled: isDisabled,
104
+ ...isWeb && native && {
105
+ accentColor,
106
+ id
107
+ }
108
+ }),
109
+ native,
110
+ frameAttrs: {
111
+ "data-state": getState(checked),
112
+ "data-disabled": isDisabled ? "" : void 0,
113
+ role: "radio",
114
+ "aria-labelledby": labelledBy,
115
+ "aria-checked": checked,
116
+ "aria-required": required,
117
+ disabled: isDisabled,
118
+ ref: composedRefs,
119
+ ...isWeb && {
120
+ type: "button",
121
+ value
122
+ },
123
+ id,
124
+ onPress: composeEventHandlers(onPress, function(event) {
125
+ if (!checked) onChange === null || onChange === void 0 || onChange(value);
126
+ if (isFormControl) {
127
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
128
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
129
+ }
130
+ }),
131
+ ...isWeb && {
132
+ onKeyDown: composeEventHandlers(onKeyDown, function(event) {
133
+ if (event.key === "Enter" || event.key === " ") {
134
+ if (!checked) onChange === null || onChange === void 0 || onChange(value);
135
+ }
136
+ }),
137
+ onFocus: composeEventHandlers(onFocus, function() {
138
+ if (isArrowKeyPressedRef.current) {
139
+ var _ref_current;
140
+ (_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.click();
141
+ }
142
+ })
143
+ }
144
+ },
145
+ rovingFocusGroupAttrs: {
146
+ asChild: "except-style",
147
+ tabIndex: isDisabled ? -1 : 0,
148
+ active: checked
149
+ }
150
+ };
172
151
  };
173
152
  function useRadioGroupItemIndicator(params) {
174
- var {
175
- radioGroupItemContext,
176
- disabled,
177
- ...rest
178
- } = params;
179
- var {
180
- checked
181
- } = useContext(radioGroupItemContext);
182
- return {
183
- checked,
184
- "data-state": getState(checked),
185
- "data-disabled": disabled ? "" : void 0,
186
- ...rest
187
- };
153
+ var { radioGroupItemContext, disabled, ...rest } = params;
154
+ var { checked } = useContext(radioGroupItemContext);
155
+ return {
156
+ checked,
157
+ "data-state": getState(checked),
158
+ "data-disabled": disabled ? "" : void 0,
159
+ ...rest
160
+ };
188
161
  }
162
+
189
163
  export { useRadioGroup, useRadioGroupItem, useRadioGroupItemIndicator };
190
164
  //# sourceMappingURL=useRadioGroup.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsx","useComposedRefs","isWeb","registerFocusable","composeEventHandlers","useLabelContext","useControllableState","useContext","useEffect","useRef","useState","BubbleInput","getState","useRadioGroup","params","value","valueProp","onValueChange","defaultValue","required","disabled","name","native","accentColor","orientation","ref","setValue","prop","defaultProp","onChange","providerValue","frameAttrs","role","rovingFocusGroupAttrs","loop","ARROW_KEYS","useRadioGroupItem","radioGroupContext","labelledBy","ariaLabelledby","itemDisabled","refProp","id","onPress","onKeyDown","onFocus","groupValue","button","setButton","hasConsumerStoppedPropagationRef","composedRefs","node","isArrowKeyPressedRef","isFormControl","Boolean","closest","checked","labelId","handleKeyDown","event","includes","key","current","handleKeyUp","document","addEventListener","removeEventListener","focusAndSelect","focus","isDisabled","bubbleInput","isHidden","control","bubbles","type","isPropagationStopped","stopPropagation","_ref_current","click","asChild","focusable","active","useRadioGroupItemIndicator","radioGroupItemContext","rest"],"sources":["useRadioGroup.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { registerFocusable } from \"@tamagui/focusable\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { useLabelContext } from \"@tamagui/label\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { useContext, useEffect, useRef, useState } from \"react\";\nimport { BubbleInput } from \"./BubbleInput\";\nimport { getState } from \"./utils\";\n\nfunction useRadioGroup(params) {\n\tvar { value: valueProp, onValueChange, defaultValue, required, disabled, name, native, accentColor, orientation, ref } = params;\n\tvar [value, setValue] = useControllableState({\n\t\tprop: valueProp,\n\t\tdefaultProp: defaultValue,\n\t\tonChange: onValueChange\n\t});\n\treturn {\n\t\tproviderValue: {\n\t\t\tvalue,\n\t\t\tonChange: setValue,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\tname,\n\t\t\tnative,\n\t\t\taccentColor\n\t\t},\n\t\tframeAttrs: {\n\t\t\trole: \"radiogroup\",\n\t\t\t\"aria-orientation\": orientation,\n\t\t\t\"data-disabled\": disabled ? \"\" : void 0\n\t\t},\n\t\trovingFocusGroupAttrs: {\n\t\t\torientation,\n\t\t\tloop: true\n\t\t}\n\t};\n}\nvar ARROW_KEYS = [\n\t\"ArrowUp\",\n\t\"ArrowDown\",\n\t\"ArrowLeft\",\n\t\"ArrowRight\"\n];\nvar useRadioGroupItem = function(params) {\n\tvar { radioGroupContext, value, labelledBy: ariaLabelledby, disabled: itemDisabled, ref: refProp, id, onPress, onKeyDown, onFocus } = params;\n\tvar { value: groupValue, disabled, required, onChange, name, native, accentColor } = useContext(radioGroupContext);\n\tvar [button, setButton] = useState(null);\n\tvar hasConsumerStoppedPropagationRef = useRef(false);\n\tvar ref = useRef(null);\n\tvar composedRefs = useComposedRefs(refProp, function(node) {\n\t\treturn setButton(node);\n\t}, ref);\n\tvar isArrowKeyPressedRef = useRef(false);\n\tvar isFormControl = isWeb ? button ? Boolean(button.closest(\"form\")) : true : false;\n\tvar checked = groupValue === value;\n\tvar labelId = useLabelContext(button);\n\tvar labelledBy = ariaLabelledby || labelId;\n\tuseEffect(function() {\n\t\tif (isWeb) {\n\t\t\tvar handleKeyDown = function(event) {\n\t\t\t\tif (ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;\n\t\t\t};\n\t\t\tvar handleKeyUp = function() {\n\t\t\t\tisArrowKeyPressedRef.current = false;\n\t\t\t};\n\t\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\t\tdocument.addEventListener(\"keyup\", handleKeyUp);\n\t\t\treturn function() {\n\t\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t\t\tdocument.removeEventListener(\"keyup\", handleKeyUp);\n\t\t\t};\n\t\t}\n\t}, []);\n\tuseEffect(function() {\n\t\tif (!id) return;\n\t\tif (disabled) return;\n\t\treturn registerFocusable(id, {\n\t\t\tfocusAndSelect: function() {\n\t\t\t\tonChange === null || onChange === void 0 || onChange(value);\n\t\t\t},\n\t\t\tfocus: function() {}\n\t\t});\n\t}, [\n\t\tid,\n\t\tvalue,\n\t\tdisabled\n\t]);\n\tvar isDisabled = disabled || itemDisabled;\n\treturn {\n\t\tproviderValue: { checked },\n\t\tchecked,\n\t\tisFormControl,\n\t\tbubbleInput: /* @__PURE__ */ jsx(BubbleInput, {\n\t\t\tisHidden: !native,\n\t\t\tcontrol: button,\n\t\t\tbubbles: !hasConsumerStoppedPropagationRef.current,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tchecked,\n\t\t\trequired,\n\t\t\tdisabled: isDisabled,\n\t\t\t...isWeb && native && {\n\t\t\t\taccentColor,\n\t\t\t\tid\n\t\t\t}\n\t\t}),\n\t\tnative,\n\t\tframeAttrs: {\n\t\t\t\"data-state\": getState(checked),\n\t\t\t\"data-disabled\": isDisabled ? \"\" : void 0,\n\t\t\trole: \"radio\",\n\t\t\t\"aria-labelledby\": labelledBy,\n\t\t\t\"aria-checked\": checked,\n\t\t\t\"aria-required\": required,\n\t\t\tdisabled: isDisabled,\n\t\t\tref: composedRefs,\n\t\t\t...isWeb && {\n\t\t\t\ttype: \"button\",\n\t\t\t\tvalue\n\t\t\t},\n\t\t\tid,\n\t\t\tonPress: composeEventHandlers(onPress, function(event) {\n\t\t\t\tif (!checked) onChange === null || onChange === void 0 || onChange(value);\n\t\t\t\tif (isFormControl) {\n\t\t\t\t\thasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n\t\t\t\t\tif (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n\t\t\t\t}\n\t\t\t}),\n\t\t\t...isWeb && {\n\t\t\t\tonKeyDown: composeEventHandlers(onKeyDown, function(event) {\n\t\t\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\t\t\tif (!checked) onChange === null || onChange === void 0 || onChange(value);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tonFocus: composeEventHandlers(onFocus, function() {\n\t\t\t\t\tif (isArrowKeyPressedRef.current) {\n\t\t\t\t\t\tvar _ref_current;\n\t\t\t\t\t\t(_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.click();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\trovingFocusGroupAttrs: {\n\t\t\tasChild: \"except-style\",\n\t\t\tfocusable: !isDisabled,\n\t\t\tactive: checked\n\t\t}\n\t};\n};\nfunction useRadioGroupItemIndicator(params) {\n\tvar { radioGroupItemContext, disabled, ...rest } = params;\n\tvar { checked } = useContext(radioGroupItemContext);\n\treturn {\n\t\tchecked,\n\t\t\"data-state\": getState(checked),\n\t\t\"data-disabled\": disabled ? \"\" : void 0,\n\t\t...rest\n\t};\n}\n\nexport { useRadioGroup, useRadioGroupItem, useRadioGroupItemIndicator };"],"mappings":"AAAA,SAASA,GAAG,QAAQ,mBAAmB;AACvC,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,oBAAoB,QAAQ,kBAAkB;AACvD,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,oBAAoB,QAAQ,iCAAiC;AACtE,SAASC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/D,SAASC,WAAW,QAAQ,yBAAe;AAC3C,SAASC,QAAQ,QAAQ,mBAAS;AAElC,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qB;IAAE/D,QAAQ;IAAE,GAAGgE;EAAK,CAAC,GAAGtE,MAAM;EACzD,IAAI;IAAE0C;EAAQ,CAAC,GAAGjD,UAAU,CAAC4E,qBAAqB,CAAC;EACnD,OAAO;IACN3B,OAAO;IACP,YAAY,EAAE5C,QAAQ,CAAC4C,OAAO,CAAC;IAC/B,eAAe,EAAEpC,QAAQ,GAAG,EAAE,GAAG,KAAK,CAAC;IACvC,GAAGgE;EACJ,CAAC;AACF;AAEA,SAASvE,aAAa,EAAEuB,iBAAiB,EAAE8C,0BAA0B","ignoreList":[]}
1
+ {"version":3,"file":"useRadioGroup.native.js","names":[],"sources":["esm/useRadioGroup.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { registerFocusable } from \"@tamagui/focusable\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { useLabelContext } from \"@tamagui/label\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { useContext, useEffect, useRef, useState } from \"react\";\nimport { BubbleInput } from \"./BubbleInput\";\nimport { getState } from \"./utils\";\n\nfunction useRadioGroup(params) {\n\tvar { value: valueProp, onValueChange, defaultValue, required, disabled, name, native, accentColor, orientation, ref } = params;\n\tvar [value, setValue] = useControllableState({\n\t\tprop: valueProp,\n\t\tdefaultProp: defaultValue,\n\t\tonChange: onValueChange\n\t});\n\treturn {\n\t\tproviderValue: {\n\t\t\tvalue,\n\t\t\tonChange: setValue,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\tname,\n\t\t\tnative,\n\t\t\taccentColor\n\t\t},\n\t\tframeAttrs: {\n\t\t\trole: \"radiogroup\",\n\t\t\t\"aria-orientation\": orientation,\n\t\t\t\"data-disabled\": disabled ? \"\" : void 0\n\t\t},\n\t\trovingFocusGroupAttrs: {\n\t\t\torientation,\n\t\t\tloop: true\n\t\t}\n\t};\n}\nvar ARROW_KEYS = [\n\t\"ArrowUp\",\n\t\"ArrowDown\",\n\t\"ArrowLeft\",\n\t\"ArrowRight\"\n];\nvar useRadioGroupItem = function(params) {\n\tvar { radioGroupContext, value, labelledBy: ariaLabelledby, disabled: itemDisabled, ref: refProp, id, onPress, onKeyDown, onFocus } = params;\n\tvar { value: groupValue, disabled, required, onChange, name, native, accentColor } = useContext(radioGroupContext);\n\tvar [button, setButton] = useState(null);\n\tvar hasConsumerStoppedPropagationRef = useRef(false);\n\tvar ref = useRef(null);\n\tvar composedRefs = useComposedRefs(refProp, function(node) {\n\t\treturn setButton(node);\n\t}, ref);\n\tvar isArrowKeyPressedRef = useRef(false);\n\tvar isFormControl = isWeb ? button ? Boolean(button.closest(\"form\")) : true : false;\n\tvar checked = groupValue === value;\n\tvar labelId = useLabelContext(button);\n\tvar labelledBy = ariaLabelledby || labelId;\n\tuseEffect(function() {\n\t\tif (isWeb) {\n\t\t\tvar handleKeyDown = function(event) {\n\t\t\t\tif (ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;\n\t\t\t};\n\t\t\tvar handleKeyUp = function() {\n\t\t\t\tisArrowKeyPressedRef.current = false;\n\t\t\t};\n\t\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\t\tdocument.addEventListener(\"keyup\", handleKeyUp);\n\t\t\treturn function() {\n\t\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t\t\tdocument.removeEventListener(\"keyup\", handleKeyUp);\n\t\t\t};\n\t\t}\n\t}, []);\n\tuseEffect(function() {\n\t\tif (!id) return;\n\t\tif (disabled) return;\n\t\treturn registerFocusable(id, {\n\t\t\tfocusAndSelect: function() {\n\t\t\t\tonChange === null || onChange === void 0 || onChange(value);\n\t\t\t},\n\t\t\tfocus: function() {}\n\t\t});\n\t}, [\n\t\tid,\n\t\tvalue,\n\t\tdisabled\n\t]);\n\tvar isDisabled = disabled || itemDisabled;\n\treturn {\n\t\tproviderValue: { checked },\n\t\tchecked,\n\t\tisFormControl,\n\t\tbubbleInput: /* @__PURE__ */ jsx(BubbleInput, {\n\t\t\tisHidden: !native,\n\t\t\tcontrol: button,\n\t\t\tbubbles: !hasConsumerStoppedPropagationRef.current,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tchecked,\n\t\t\trequired,\n\t\t\tdisabled: isDisabled,\n\t\t\t...isWeb && native && {\n\t\t\t\taccentColor,\n\t\t\t\tid\n\t\t\t}\n\t\t}),\n\t\tnative,\n\t\tframeAttrs: {\n\t\t\t\"data-state\": getState(checked),\n\t\t\t\"data-disabled\": isDisabled ? \"\" : void 0,\n\t\t\trole: \"radio\",\n\t\t\t\"aria-labelledby\": labelledBy,\n\t\t\t\"aria-checked\": checked,\n\t\t\t\"aria-required\": required,\n\t\t\tdisabled: isDisabled,\n\t\t\tref: composedRefs,\n\t\t\t...isWeb && {\n\t\t\t\ttype: \"button\",\n\t\t\t\tvalue\n\t\t\t},\n\t\t\tid,\n\t\t\tonPress: composeEventHandlers(onPress, function(event) {\n\t\t\t\tif (!checked) onChange === null || onChange === void 0 || onChange(value);\n\t\t\t\tif (isFormControl) {\n\t\t\t\t\thasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n\t\t\t\t\tif (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n\t\t\t\t}\n\t\t\t}),\n\t\t\t...isWeb && {\n\t\t\t\tonKeyDown: composeEventHandlers(onKeyDown, function(event) {\n\t\t\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\t\t\tif (!checked) onChange === null || onChange === void 0 || onChange(value);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tonFocus: composeEventHandlers(onFocus, function() {\n\t\t\t\t\tif (isArrowKeyPressedRef.current) {\n\t\t\t\t\t\tvar _ref_current;\n\t\t\t\t\t\t(_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.click();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\trovingFocusGroupAttrs: {\n\t\t\tasChild: \"except-style\",\n\t\t\ttabIndex: isDisabled ? -1 : 0,\n\t\t\tactive: checked\n\t\t}\n\t};\n};\nfunction useRadioGroupItemIndicator(params) {\n\tvar { radioGroupItemContext, disabled, ...rest } = params;\n\tvar { checked } = useContext(radioGroupItemContext);\n\treturn {\n\t\tchecked,\n\t\t\"data-state\": getState(checked),\n\t\t\"data-disabled\": disabled ? \"\" : void 0,\n\t\t...rest\n\t};\n}\n\nexport { useRadioGroup, useRadioGroupItem, useRadioGroupItemIndicator };"],"mappings":";;;;;;;;;;;;AAWA,SAAS,cAAc,QAAQ;CAC9B,IAAI,EAAE,OAAO,WAAW,eAAe,cAAc,UAAU,UAAU,MAAM,QAAQ,aAAa,aAAa,QAAQ;CACzH,IAAI,CAAC,OAAO,YAAY,qBAAqB;EAC5C,MAAM;EACN,aAAa;EACb,UAAU;CACX,CAAC;CACD,OAAO;EACN,eAAe;GACd;GACA,UAAU;GACV;GACA;GACA;GACA;GACA;EACD;EACA,YAAY;GACX,MAAM;GACN,oBAAoB;GACpB,iBAAiB,WAAW,KAAK,KAAK;EACvC;EACA,uBAAuB;GACtB;GACA,MAAM;EACP;CACD;AACD;AACA,IAAI,aAAa;CAChB;CACA;CACA;CACA;AACD;AACA,IAAI,oBAAoB,SAAS,QAAQ;CACxC,IAAI,EAAE,mBAAmB,OAAO,YAAY,gBAAgB,UAAU,cAAc,KAAK,SAAS,IAAI,SAAS,WAAW,YAAY;CACtI,IAAI,EAAE,OAAO,YAAY,UAAU,UAAU,UAAU,MAAM,QAAQ,gBAAgB,WAAW,iBAAiB;CACjH,IAAI,CAAC,QAAQ,aAAa,SAAS,IAAI;CACvC,IAAI,mCAAmC,OAAO,KAAK;CACnD,IAAI,MAAM,OAAO,IAAI;CACrB,IAAI,eAAe,gBAAgB,SAAS,SAAS,MAAM;EAC1D,OAAO,UAAU,IAAI;CACtB,GAAG,GAAG;CACN,IAAI,uBAAuB,OAAO,KAAK;CACvC,IAAI,gBAAgB,QAAQ,S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Aa,KAAK,KAAK,SAAS,KAAK;IACxE,IAAI,eAAe;KAClB,iCAAiC,UAAU,MAAM,qBAAqB;KACtE,IAAI,CAAC,iCAAiC,SAAS,MAAM,gBAAgB;IACtE;GACD,CAAC;GACD,GAAG,SAAS;IACX,WAAW,qBAAqB,WAAW,SAAS,OAAO;KAC1D,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;MAC/C,IAAI,CAAC,SAAS,aAAa,QAAQ,aAAa,KAAK,KAAK,SAAS,KAAK;KACzE;IACD,CAAC;IACD,SAAS,qBAAqB,SAAS,WAAW;KACjD,IAAI,qBAAqB,SAAS;MACjC,IAAI;MACJ,CAAC,eAAe,IAAI,aAAa,QAAQ,iBAAiB,KAAK,KAAK,aAAa,MAAM;KACxF;IACD,CAAC;GACF;EACD;EACA,uBAAuB;GACtB,SAAS;GACT,UAAU,aAAa,CAAC,IAAI;GAC5B,QAAQ;EACT;CACD;AACD;AACA,SAAS,2BAA2B,QAAQ;CAC3C,IAAI,EAAE,uBAAuB,UAAU,GAAG,SAAS;CACnD,IAAI,EAAE,YAAY,WAAW,qBAAqB;CAClD,OAAO;EACN;EACA,cAAc,SAAS,OAAO;EAC9B,iBAAiB,WAAW,KAAK,KAAK;EACtC,GAAG;CACJ;AACD"}
@@ -1,5 +1,6 @@
1
1
  function getState(checked) {
2
- return checked ? "checked" : "unchecked";
2
+ return checked ? "checked" : "unchecked";
3
3
  }
4
+
4
5
  export { getState };
5
6
  //# sourceMappingURL=utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["getState","checked"],"sources":["../../src/utils.tsx"],"sourcesContent":[null],"mappings":"AAAO,SAASA,SAASC,OAAA,EAAkB;EACzC,OAAOA,OAAA,GAAU,YAAY;AAC/B","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["esm/utils.js"],"sourcesContent":["function getState(checked) {\n return checked ? \"checked\" : \"unchecked\";\n}\nexport {\n getState\n};\n//# sourceMappingURL=utils.js.map\n"],"mappings":";AAAA,SAAS,SAAS,SAAS;CACzB,OAAO,UAAU,YAAY;AAC/B"}
@@ -1,5 +1,6 @@
1
1
  function getState(checked) {
2
- return checked ? "checked" : "unchecked";
2
+ return checked ? "checked" : "unchecked";
3
3
  }
4
+
4
5
  export { getState };
5
6
  //# sourceMappingURL=utils.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getState","checked"],"sources":["../../src/utils.tsx"],"sourcesContent":[null],"mappings":"AAAO,SAASA,SAASC,OAAA,EAAkB;EACzC,OAAOA,OAAA,GAAU,YAAY;AAC/B","ignoreList":[]}
1
+ {"version":3,"file":"utils.native.js","names":[],"sources":["esm/utils.native.js"],"sourcesContent":["function getState(checked) {\n return checked ? \"checked\" : \"unchecked\";\n}\nexport {\n getState\n};\n//# sourceMappingURL=utils.js.map\n"],"mappings":";AAAA,SAAS,SAAS,SAAS;CACzB,OAAO,UAAU,YAAY;AAC/B"}
@@ -1,51 +1,47 @@
1
1
  import React from "react";
2
2
  import { usePrevious } from "@tamagui/use-previous";
3
3
  import { jsx } from "react/jsx-runtime";
4
- const BubbleInput = props => {
5
- const {
6
- checked,
7
- bubbles = true,
8
- control,
9
- isHidden,
10
- accentColor,
11
- ...inputProps
12
- } = props;
13
- const ref = React.useRef(null);
14
- const prevChecked = usePrevious(checked);
15
- React.useEffect(() => {
16
- const input = ref.current;
17
- const inputProto = window.HTMLInputElement.prototype;
18
- const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
19
- const setChecked = descriptor.set;
20
- if (prevChecked !== checked && setChecked) {
21
- const event = new Event("click", {
22
- bubbles
23
- });
24
- setChecked.call(input, checked);
25
- input.dispatchEvent(event);
26
- }
27
- }, [prevChecked, checked, bubbles]);
28
- return /* @__PURE__ */jsx("input", {
29
- type: "radio",
30
- defaultChecked: checked,
31
- ...inputProps,
32
- tabIndex: -1,
33
- ref,
34
- "aria-hidden": isHidden,
35
- style: {
36
- ...(isHidden ? {
37
- // ...controlSize,
38
- position: "absolute",
39
- pointerEvents: "none",
40
- opacity: 0,
41
- margin: 0
42
- } : {
43
- appearance: "auto",
44
- accentColor
45
- }),
46
- ...props.style
47
- }
48
- });
4
+
5
+ const BubbleInput = (props) => {
6
+ const { checked, bubbles = true, control, isHidden, accentColor, ...inputProps } = props;
7
+ const ref = React.useRef(null);
8
+ const prevChecked = usePrevious(checked);
9
+ React.useEffect(() => {
10
+ const input = ref.current;
11
+ const inputProto = window.HTMLInputElement.prototype;
12
+ const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
13
+ const setChecked = descriptor.set;
14
+ if (prevChecked !== checked && setChecked) {
15
+ const event = new Event("click", { bubbles });
16
+ setChecked.call(input, checked);
17
+ input.dispatchEvent(event);
18
+ }
19
+ }, [
20
+ prevChecked,
21
+ checked,
22
+ bubbles
23
+ ]);
24
+ return /* @__PURE__ */ jsx("input", {
25
+ type: "radio",
26
+ defaultChecked: checked,
27
+ ...inputProps,
28
+ tabIndex: -1,
29
+ ref,
30
+ "aria-hidden": isHidden,
31
+ style: {
32
+ ...isHidden ? {
33
+ position: "absolute",
34
+ pointerEvents: "none",
35
+ opacity: 0,
36
+ margin: 0
37
+ } : {
38
+ appearance: "auto",
39
+ accentColor
40
+ },
41
+ ...props.style
42
+ }
43
+ });
49
44
  };
45
+
50
46
  export { BubbleInput };
51
47
  //# sourceMappingURL=BubbleInput.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","usePrevious","jsx","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,OAAOA,KAAA,MAAW;AAClB,SAASC,WAAA,QAAmB;AAgCxB,SAAAC,GAAA;AAtBG,MAAMC,WAAA,GAAeC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"react\";\nimport { usePrevious } from \"@tamagui/use-previous\";\nimport { jsx } from \"react/jsx-runtime\";\nconst BubbleInput = (props) => {\n const { checked, bubbles = true, control, isHidden, accentColor, ...inputProps } = props;\n const ref = React.useRef(null);\n const prevChecked = usePrevious(checked);\n React.useEffect(() => {\n const input = ref.current;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n \"checked\"\n );\n const setChecked = descriptor.set;\n if (prevChecked !== checked && setChecked) {\n const event = new Event(\"click\", { bubbles });\n setChecked.call(input, checked);\n input.dispatchEvent(event);\n }\n }, [prevChecked, checked, bubbles]);\n return /* @__PURE__ */ jsx(\n \"input\",\n {\n type: \"radio\",\n defaultChecked: checked,\n ...inputProps,\n tabIndex: -1,\n ref,\n \"aria-hidden\": isHidden,\n style: {\n ...isHidden ? {\n // ...controlSize,\n position: \"absolute\",\n pointerEvents: \"none\",\n opacity: 0,\n margin: 0\n } : {\n appearance: \"auto\",\n accentColor\n },\n ...props.style\n }\n }\n );\n};\nexport {\n BubbleInput\n};\n//# sourceMappingURL=BubbleInput.js.map\n"],"mappings":";;;;;AAGA,MAAM,eAAe,UAAU;CAC7B,MAAM,EAAE,SAAS,UAAU,MAAM,SAAS,UAAU,aAAa,GAAG,eAAe;CACnF,MAAM,MAAM,MAAM,OAAO,IAAI;CAC7B,MAAM,cAAc,YAAY,OAAO;CACvC,MAAM,gBAAgB;EACpB,MAAM,QAAQ,IAAI;EAClB,MAAM,aAAa,OAAO,iBAAiB;EAC3C,MAAM,aAAa,OAAO,yBACxB,YACA,SACF;EACA,MAAM,aAAa,WAAW;EAC9B,IAAI,gBAAgB,WAAW,YAAY;GACzC,MAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,QAAQ,CAAC;GAC5C,WAAW,KAAK,OAAO,OAAO;GAC9B,MAAM,cAAc,KAAK;EAC3B;CACF,GAAG;EAAC;EAAa;EAAS;CAAO,CAAC;CAClC,OAAuB,oBACrB,SACA;EACE,MAAM;EACN,gBAAgB;EAChB,GAAG;EACH,UAAU,CAAC;EACX;EACA,eAAe;EACf,OAAO;GACL,GAAG,WAAW;IAEZ,UAAU;IACV,eAAe;IACf,SAAS;IACT,QAAQ;GACV,IAAI;IACF,YAAY;IACZ;GACF;GACA,GAAG,MAAM;EACX;CACF,CACF;AACF"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var BubbleInput_exports = {};
31
+ __export(BubbleInput_exports, { BubbleInput: () => BubbleInput });
32
+ module.exports = __toCommonJS(BubbleInput_exports);
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_react = __toESM(require("react"), 1);
35
+ var import_use_previous = require("@tamagui/use-previous");
36
+ var BubbleInput = function(props) {
37
+ var { checked, bubbles = true, control, isHidden, accentColor, ...inputProps } = props;
38
+ var ref = import_react.default.useRef(null);
39
+ var prevChecked = (0, import_use_previous.usePrevious)(checked);
40
+ import_react.default.useEffect(function() {
41
+ var input = ref.current;
42
+ var inputProto = window.HTMLInputElement.prototype;
43
+ var descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
44
+ var setChecked = descriptor.set;
45
+ if (prevChecked !== checked && setChecked) {
46
+ var event = new Event("click", { bubbles });
47
+ setChecked.call(input, checked);
48
+ input.dispatchEvent(event);
49
+ }
50
+ }, [
51
+ prevChecked,
52
+ checked,
53
+ bubbles
54
+ ]);
55
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
56
+ type: "radio",
57
+ defaultChecked: checked,
58
+ ...inputProps,
59
+ tabIndex: -1,
60
+ ref,
61
+ "aria-hidden": isHidden,
62
+ style: {
63
+ ...isHidden ? {
64
+ position: "absolute",
65
+ pointerEvents: "none",
66
+ opacity: 0,
67
+ margin: 0
68
+ } : {
69
+ appearance: "auto",
70
+ accentColor
71
+ },
72
+ ...props.style
73
+ }
74
+ });
75
+ };