@fluentui-react-native/radio-group 0.22.0 → 0.22.3

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 (187) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/lib/Radio/Radio.d.ts +2 -7
  3. package/lib/Radio/Radio.ios.d.ts +2 -7
  4. package/lib/Radio/Radio.ios.js +31 -50
  5. package/lib/Radio/Radio.js +31 -46
  6. package/lib/Radio/Radio.styling.d.ts +1 -1
  7. package/lib/Radio/Radio.styling.js +88 -109
  8. package/lib/Radio/Radio.types.d.ts +170 -176
  9. package/lib/Radio/Radio.types.js +1 -1
  10. package/lib/Radio/RadioTokens.android.d.ts +1 -1
  11. package/lib/Radio/RadioTokens.android.js +42 -42
  12. package/lib/Radio/RadioTokens.android.js.map +1 -1
  13. package/lib/Radio/RadioTokens.d.ts +1 -1
  14. package/lib/Radio/RadioTokens.ios.d.ts +1 -1
  15. package/lib/Radio/RadioTokens.ios.js +39 -39
  16. package/lib/Radio/RadioTokens.ios.js.map +1 -1
  17. package/lib/Radio/RadioTokens.js +76 -76
  18. package/lib/Radio/RadioTokens.js.map +1 -1
  19. package/lib/Radio/RadioTokens.win32.d.ts +1 -1
  20. package/lib/Radio/RadioTokens.win32.js +89 -89
  21. package/lib/Radio/RadioTokens.win32.js.map +1 -1
  22. package/lib/Radio/__tests__/RadioExperimental.test.d.ts +1 -1
  23. package/lib/Radio/__tests__/RadioExperimental.test.js +14 -14
  24. package/lib/Radio/useRadio.d.ts +1 -1
  25. package/lib/Radio/useRadio.d.ts.map +1 -1
  26. package/lib/Radio/useRadio.js +72 -91
  27. package/lib/Radio/useRadio.js.map +1 -1
  28. package/lib/Radio/useRadio.win32.d.ts +1 -1
  29. package/lib/Radio/useRadio.win32.d.ts.map +1 -1
  30. package/lib/Radio/useRadio.win32.js +126 -143
  31. package/lib/Radio/useRadio.win32.js.map +1 -1
  32. package/lib/RadioGroup/RadioGroup.d.ts +2 -7
  33. package/lib/RadioGroup/RadioGroup.js +34 -48
  34. package/lib/RadioGroup/RadioGroup.styling.d.ts +1 -1
  35. package/lib/RadioGroup/RadioGroup.styling.js +42 -51
  36. package/lib/RadioGroup/RadioGroup.types.d.ts +117 -117
  37. package/lib/RadioGroup/RadioGroup.types.js +1 -1
  38. package/lib/RadioGroup/RadioGroupTokens.android.d.ts +1 -1
  39. package/lib/RadioGroup/RadioGroupTokens.android.js +1 -1
  40. package/lib/RadioGroup/RadioGroupTokens.d.ts +1 -1
  41. package/lib/RadioGroup/RadioGroupTokens.ios.d.ts +1 -1
  42. package/lib/RadioGroup/RadioGroupTokens.ios.js +1 -1
  43. package/lib/RadioGroup/RadioGroupTokens.js +12 -12
  44. package/lib/RadioGroup/RadioGroupTokens.js.map +1 -1
  45. package/lib/RadioGroup/RadioGroupTokens.mobile.d.ts +1 -1
  46. package/lib/RadioGroup/RadioGroupTokens.mobile.js +13 -13
  47. package/lib/RadioGroup/RadioGroupTokens.mobile.js.map +1 -1
  48. package/lib/RadioGroup/__tests__/RadioGroupExperimental.test.d.ts +1 -1
  49. package/lib/RadioGroup/__tests__/RadioGroupExperimental.test.js +56 -98
  50. package/lib/RadioGroup/radioGroupContext.d.ts +1 -1
  51. package/lib/RadioGroup/radioGroupContext.js +15 -19
  52. package/lib/RadioGroup/useRadioGroup.d.ts +1 -1
  53. package/lib/RadioGroup/useRadioGroup.js +63 -93
  54. package/lib/RadioGroup/useRadioGroupContextValue.d.ts +1 -1
  55. package/lib/RadioGroup/useRadioGroupContextValue.js +2 -2
  56. package/lib/index.d.ts +4 -25
  57. package/lib/index.js +1 -1
  58. package/lib/legacy/MacOSRadioButtonNativeComponent.d.ts +6 -6
  59. package/lib/legacy/MacOSRadioButtonNativeComponent.js +1 -1
  60. package/lib/legacy/RadioButton.d.ts +2 -8
  61. package/lib/legacy/RadioButton.d.ts.map +1 -1
  62. package/lib/legacy/RadioButton.js +82 -96
  63. package/lib/legacy/RadioButton.js.map +1 -1
  64. package/lib/legacy/RadioButton.macos.d.ts +2 -8
  65. package/lib/legacy/RadioButton.macos.d.ts.map +1 -1
  66. package/lib/legacy/RadioButton.macos.js +50 -48
  67. package/lib/legacy/RadioButton.macos.js.map +1 -1
  68. package/lib/legacy/RadioButton.settings.d.ts +2 -2
  69. package/lib/legacy/RadioButton.settings.js +81 -81
  70. package/lib/legacy/RadioButton.types.d.ts +45 -45
  71. package/lib/legacy/RadioButton.types.js +1 -1
  72. package/lib/legacy/RadioButton.win32.d.ts +2 -8
  73. package/lib/legacy/RadioButton.win32.d.ts.map +1 -1
  74. package/lib/legacy/RadioButton.win32.js +136 -151
  75. package/lib/legacy/RadioButton.win32.js.map +1 -1
  76. package/lib/legacy/RadioGroup.d.ts +2 -8
  77. package/lib/legacy/RadioGroup.d.ts.map +1 -1
  78. package/lib/legacy/RadioGroup.js +80 -108
  79. package/lib/legacy/RadioGroup.js.map +1 -1
  80. package/lib/legacy/RadioGroup.settings.d.ts +1 -1
  81. package/lib/legacy/RadioGroup.settings.js +21 -21
  82. package/lib/legacy/RadioGroup.types.d.ts +79 -78
  83. package/lib/legacy/RadioGroup.types.js +1 -1
  84. package/lib/legacy/__tests__/RadioButton.test.d.ts +1 -1
  85. package/lib/legacy/__tests__/RadioButton.test.js +8 -8
  86. package/lib/legacy/__tests__/RadioButtonGroup.test.d.ts +1 -1
  87. package/lib/legacy/__tests__/RadioButtonGroup.test.js +18 -34
  88. package/lib-commonjs/Radio/Radio.d.ts +2 -7
  89. package/lib-commonjs/Radio/Radio.ios.d.ts +2 -7
  90. package/lib-commonjs/Radio/Radio.ios.js +40 -64
  91. package/lib-commonjs/Radio/Radio.js +39 -59
  92. package/lib-commonjs/Radio/Radio.styling.d.ts +1 -1
  93. package/lib-commonjs/Radio/Radio.styling.js +94 -115
  94. package/lib-commonjs/Radio/Radio.types.d.ts +170 -176
  95. package/lib-commonjs/Radio/Radio.types.js +3 -3
  96. package/lib-commonjs/Radio/RadioTokens.android.d.ts +1 -1
  97. package/lib-commonjs/Radio/RadioTokens.android.js +45 -45
  98. package/lib-commonjs/Radio/RadioTokens.android.js.map +1 -1
  99. package/lib-commonjs/Radio/RadioTokens.d.ts +1 -1
  100. package/lib-commonjs/Radio/RadioTokens.ios.d.ts +1 -1
  101. package/lib-commonjs/Radio/RadioTokens.ios.js +42 -42
  102. package/lib-commonjs/Radio/RadioTokens.ios.js.map +1 -1
  103. package/lib-commonjs/Radio/RadioTokens.js +79 -79
  104. package/lib-commonjs/Radio/RadioTokens.js.map +1 -1
  105. package/lib-commonjs/Radio/RadioTokens.win32.d.ts +1 -1
  106. package/lib-commonjs/Radio/RadioTokens.win32.js +92 -92
  107. package/lib-commonjs/Radio/RadioTokens.win32.js.map +1 -1
  108. package/lib-commonjs/Radio/__tests__/RadioExperimental.test.d.ts +1 -1
  109. package/lib-commonjs/Radio/__tests__/RadioExperimental.test.js +48 -65
  110. package/lib-commonjs/Radio/useRadio.d.ts +1 -1
  111. package/lib-commonjs/Radio/useRadio.d.ts.map +1 -1
  112. package/lib-commonjs/Radio/useRadio.js +107 -143
  113. package/lib-commonjs/Radio/useRadio.js.map +1 -1
  114. package/lib-commonjs/Radio/useRadio.win32.d.ts +1 -1
  115. package/lib-commonjs/Radio/useRadio.win32.d.ts.map +1 -1
  116. package/lib-commonjs/Radio/useRadio.win32.js +162 -196
  117. package/lib-commonjs/Radio/useRadio.win32.js.map +1 -1
  118. package/lib-commonjs/RadioGroup/RadioGroup.d.ts +2 -7
  119. package/lib-commonjs/RadioGroup/RadioGroup.js +45 -65
  120. package/lib-commonjs/RadioGroup/RadioGroup.styling.d.ts +1 -1
  121. package/lib-commonjs/RadioGroup/RadioGroup.styling.js +48 -57
  122. package/lib-commonjs/RadioGroup/RadioGroup.types.d.ts +117 -117
  123. package/lib-commonjs/RadioGroup/RadioGroup.types.js +3 -3
  124. package/lib-commonjs/RadioGroup/RadioGroupTokens.android.d.ts +1 -1
  125. package/lib-commonjs/RadioGroup/RadioGroupTokens.android.js +5 -10
  126. package/lib-commonjs/RadioGroup/RadioGroupTokens.d.ts +1 -1
  127. package/lib-commonjs/RadioGroup/RadioGroupTokens.ios.d.ts +1 -1
  128. package/lib-commonjs/RadioGroup/RadioGroupTokens.ios.js +5 -10
  129. package/lib-commonjs/RadioGroup/RadioGroupTokens.js +15 -15
  130. package/lib-commonjs/RadioGroup/RadioGroupTokens.js.map +1 -1
  131. package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.d.ts +1 -1
  132. package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.js +16 -16
  133. package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.js.map +1 -1
  134. package/lib-commonjs/RadioGroup/__tests__/RadioGroupExperimental.test.d.ts +1 -1
  135. package/lib-commonjs/RadioGroup/__tests__/RadioGroupExperimental.test.js +91 -153
  136. package/lib-commonjs/RadioGroup/radioGroupContext.d.ts +1 -1
  137. package/lib-commonjs/RadioGroup/radioGroupContext.js +47 -68
  138. package/lib-commonjs/RadioGroup/useRadioGroup.d.ts +1 -1
  139. package/lib-commonjs/RadioGroup/useRadioGroup.js +97 -144
  140. package/lib-commonjs/RadioGroup/useRadioGroupContextValue.d.ts +1 -1
  141. package/lib-commonjs/RadioGroup/useRadioGroupContextValue.js +4 -4
  142. package/lib-commonjs/index.d.ts +4 -25
  143. package/lib-commonjs/index.js +32 -128
  144. package/lib-commonjs/legacy/MacOSRadioButtonNativeComponent.d.ts +6 -6
  145. package/lib-commonjs/legacy/MacOSRadioButtonNativeComponent.js +7 -9
  146. package/lib-commonjs/legacy/RadioButton.d.ts +2 -8
  147. package/lib-commonjs/legacy/RadioButton.d.ts.map +1 -1
  148. package/lib-commonjs/legacy/RadioButton.js +123 -162
  149. package/lib-commonjs/legacy/RadioButton.js.map +1 -1
  150. package/lib-commonjs/legacy/RadioButton.macos.d.ts +2 -8
  151. package/lib-commonjs/legacy/RadioButton.macos.d.ts.map +1 -1
  152. package/lib-commonjs/legacy/RadioButton.macos.js +90 -107
  153. package/lib-commonjs/legacy/RadioButton.macos.js.map +1 -1
  154. package/lib-commonjs/legacy/RadioButton.settings.d.ts +2 -2
  155. package/lib-commonjs/legacy/RadioButton.settings.js +84 -84
  156. package/lib-commonjs/legacy/RadioButton.types.d.ts +45 -45
  157. package/lib-commonjs/legacy/RadioButton.types.js +3 -3
  158. package/lib-commonjs/legacy/RadioButton.win32.d.ts +2 -8
  159. package/lib-commonjs/legacy/RadioButton.win32.d.ts.map +1 -1
  160. package/lib-commonjs/legacy/RadioButton.win32.js +177 -217
  161. package/lib-commonjs/legacy/RadioButton.win32.js.map +1 -1
  162. package/lib-commonjs/legacy/RadioGroup.d.ts +2 -8
  163. package/lib-commonjs/legacy/RadioGroup.d.ts.map +1 -1
  164. package/lib-commonjs/legacy/RadioGroup.js +121 -168
  165. package/lib-commonjs/legacy/RadioGroup.js.map +1 -1
  166. package/lib-commonjs/legacy/RadioGroup.settings.d.ts +1 -1
  167. package/lib-commonjs/legacy/RadioGroup.settings.js +24 -24
  168. package/lib-commonjs/legacy/RadioGroup.types.d.ts +79 -78
  169. package/lib-commonjs/legacy/RadioGroup.types.js +3 -3
  170. package/lib-commonjs/legacy/__tests__/RadioButton.test.d.ts +1 -1
  171. package/lib-commonjs/legacy/__tests__/RadioButton.test.js +42 -59
  172. package/lib-commonjs/legacy/__tests__/RadioButtonGroup.test.d.ts +1 -1
  173. package/lib-commonjs/legacy/__tests__/RadioButtonGroup.test.js +53 -96
  174. package/package.json +35 -34
  175. package/src/Radio/RadioTokens.android.ts +1 -1
  176. package/src/Radio/RadioTokens.ios.ts +1 -1
  177. package/src/Radio/RadioTokens.ts +1 -1
  178. package/src/Radio/RadioTokens.win32.ts +1 -1
  179. package/src/Radio/useRadio.ts +13 -11
  180. package/src/Radio/useRadio.win32.ts +45 -26
  181. package/src/RadioGroup/RadioGroupTokens.mobile.ts +1 -1
  182. package/src/RadioGroup/RadioGroupTokens.ts +1 -1
  183. package/src/legacy/RadioButton.macos.tsx +10 -8
  184. package/src/legacy/RadioButton.tsx +13 -11
  185. package/src/legacy/RadioButton.win32.tsx +46 -30
  186. package/src/legacy/RadioGroup.tsx +4 -8
  187. package/eslint.config.js +0 -3
@@ -1,174 +1,135 @@
1
1
  /** @jsxImportSource @fluentui-react-native/framework-base */
2
2
  'use strict';
3
- var __createBinding =
4
- (this && this.__createBinding) ||
5
- (Object.create
6
- ? function (o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = {
11
- enumerable: true,
12
- get: function () {
13
- return m[k];
14
- },
15
- };
16
- }
17
- Object.defineProperty(o, k2, desc);
18
- }
19
- : function (o, m, k, k2) {
20
- if (k2 === undefined) k2 = k;
21
- o[k2] = m[k];
22
- });
23
- var __setModuleDefault =
24
- (this && this.__setModuleDefault) ||
25
- (Object.create
26
- ? function (o, v) {
27
- Object.defineProperty(o, 'default', { enumerable: true, value: v });
28
- }
29
- : function (o, v) {
30
- o['default'] = v;
31
- });
32
- var __importStar =
33
- (this && this.__importStar) ||
34
- (function () {
35
- var ownKeys = function (o) {
36
- ownKeys =
37
- Object.getOwnPropertyNames ||
38
- function (o) {
39
- var ar = [];
40
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
41
- return ar;
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
42
25
  };
43
- return ownKeys(o);
26
+ return ownKeys(o);
44
27
  };
45
28
  return function (mod) {
46
- if (mod && mod.__esModule) return mod;
47
- var result = {};
48
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== 'default') __createBinding(result, mod, k[i]);
49
- __setModuleDefault(result, mod);
50
- return result;
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
51
34
  };
52
- })();
53
- Object.defineProperty(exports, '__esModule', { value: true });
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
54
37
  exports.RadioButton = void 0;
55
- const jsx_runtime_1 = require('@fluentui-react-native/framework-base/jsx-runtime');
56
- const React = __importStar(require('react'));
57
- const react_native_1 = require('react-native');
58
- const adapters_1 = require('@fluentui-react-native/adapters');
59
- const interactive_hooks_1 = require('@fluentui-react-native/interactive-hooks');
60
- const text_1 = require('@fluentui-react-native/text');
61
- const tokens_1 = require('@fluentui-react-native/tokens');
62
- const foundation_compose_1 = require('@uifabricshared/foundation-compose');
63
- const foundation_settings_1 = require('@uifabricshared/foundation-settings');
64
- const RadioButton_settings_1 = require('./RadioButton.settings');
65
- const RadioButton_types_1 = require('./RadioButton.types');
66
- const RadioGroup_1 = require('./RadioGroup');
38
+ const jsx_runtime_1 = require("@fluentui-react-native/framework-base/jsx-runtime");
39
+ const React = __importStar(require("react"));
40
+ const react_native_1 = require("react-native");
41
+ const adapters_1 = require("@fluentui-react-native/adapters");
42
+ const interactive_hooks_1 = require("@fluentui-react-native/interactive-hooks");
43
+ const text_1 = require("@fluentui-react-native/text");
44
+ const tokens_1 = require("@fluentui-react-native/tokens");
45
+ const foundation_compose_1 = require("@uifabricshared/foundation-compose");
46
+ const foundation_settings_1 = require("@uifabricshared/foundation-settings");
47
+ const RadioButton_settings_1 = require("./RadioButton.settings");
48
+ const RadioButton_types_1 = require("./RadioButton.types");
49
+ const RadioGroup_1 = require("./RadioGroup");
67
50
  exports.RadioButton = (0, foundation_compose_1.compose)({
68
- displayName: RadioButton_types_1.radioButtonName,
69
- usePrepareProps: (userProps, useStyling) => {
70
- const defaultComponentRef = React.useRef(null);
71
- const {
72
- content,
73
- buttonKey,
74
- disabled,
75
- accessibilityLabel,
76
- ariaLabel,
77
- componentRef = defaultComponentRef,
78
- accessibilityPosInSet,
79
- ariaPosInSet,
80
- accessibilitySetSize,
81
- ariaSetSize,
82
- ...rest
83
- } = userProps;
84
- // Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
85
- const info = React.useContext(RadioGroup_1.RadioGroupContext);
86
- const buttonRef = (0, interactive_hooks_1.useViewCommandFocus)(componentRef);
87
- /* We don't want to call the user's onChange multiple times on the same selection. */
88
- const changeSelection = () => {
89
- if (buttonKey != info.selectedKey) {
90
- info.onChange && info.onChange(buttonKey);
91
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
92
- }
93
- };
94
- /* We use the componentRef of the currently selected button to maintain the default tabbable
51
+ displayName: RadioButton_types_1.radioButtonName,
52
+ usePrepareProps: (userProps, useStyling) => {
53
+ const defaultComponentRef = React.useRef(null);
54
+ const { content, buttonKey, disabled, accessibilityLabel, ariaLabel, componentRef = defaultComponentRef, accessibilityPosInSet, ariaPosInSet, accessibilitySetSize, ariaSetSize, ...rest } = userProps;
55
+ // Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
56
+ const info = React.useContext(RadioGroup_1.RadioGroupContext);
57
+ const { selectedKey, onChange, updateSelectedButtonRef, buttonKeys } = info;
58
+ const buttonRef = (0, interactive_hooks_1.useViewCommandFocus)(componentRef);
59
+ /* We don't want to call the user's onChange multiple times on the same selection. */
60
+ const changeSelection = React.useCallback(() => {
61
+ if (buttonKey != selectedKey) {
62
+ onChange && onChange(buttonKey);
63
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
64
+ }
65
+ }, [buttonKey, componentRef, onChange, selectedKey, updateSelectedButtonRef]);
66
+ /* We use the componentRef of the currently selected button to maintain the default tabbable
95
67
  element in a RadioGroup. Since the componentRef isn't generated until after initial render,
96
68
  we must update it once here. */
97
- React.useEffect(() => {
98
- if (buttonKey == info.selectedKey) {
99
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
100
- }
101
- }, []);
102
- // Ensure focus is placed on button after click
103
- const changeSelectionWithFocus = (0, interactive_hooks_1.useOnPressWithFocus)(componentRef, changeSelection);
104
- /* RadioButton changes selection when focus is moved between each RadioButton and on a click */
105
- const pressable = (0, interactive_hooks_1.useAsPressable)({
106
- ...rest,
107
- onPress: changeSelectionWithFocus,
108
- onFocus: changeSelection,
109
- });
110
- // Used when creating accessibility properties in mergeSettings below
111
- const onAccessibilityAction = React.useCallback(
112
- (event) => {
113
- switch (event.nativeEvent.actionName) {
114
- case 'Select':
115
- changeSelection();
116
- break;
117
- }
118
- },
119
- [info, buttonKey],
120
- );
121
- const state = {
122
- ...pressable.state,
123
- selected: info.selectedKey === userProps.buttonKey,
124
- disabled: disabled || false,
125
- };
126
- // Grab the styling information from the userProps, referencing the state as well as the props.
127
- const styleProps = useStyling(userProps, (override) => state[override] || userProps[override]);
128
- const slotProps = (0, foundation_settings_1.mergeSettings)(styleProps, {
129
- root: {
130
- ...rest,
131
- ref: buttonRef,
132
- ...pressable.props,
133
- accessibilityRole: 'radio',
134
- accessibilityLabel: accessibilityLabel ?? ariaLabel ?? content,
135
- accessibilityState: { disabled: state.disabled, selected: state.selected },
136
- accessibilityActions: [{ name: 'Select', label: RadioButton_settings_1.radioButtonSelectActionLabel }],
137
- accessibilityPosInSet: accessibilityPosInSet ?? ariaPosInSet ?? info.buttonKeys.findIndex((x) => x == buttonKey) + 1,
138
- accessibilitySetSize: accessibilitySetSize ?? ariaSetSize ?? info.buttonKeys.length,
139
- focusable: !state.disabled,
140
- onAccessibilityAction: onAccessibilityAction,
141
- },
142
- content: { children: content },
143
- });
144
- return { slotProps };
145
- },
146
- render: (Slots, _renderData, ...children) => {
147
- return jsx_runtime_1.jsxs(Slots.root, {
148
- children: [
149
- jsx_runtime_1.jsx(Slots.button, { children: jsx_runtime_1.jsx(Slots.innerCircle, {}) }),
150
- jsx_runtime_1.jsx(Slots.content, {}),
151
- children,
152
- ],
153
- });
154
- },
155
- settings: RadioButton_settings_1.settings,
156
- slots: {
157
- root: react_native_1.View,
158
- button: { slotType: react_native_1.View, filter: adapters_1.filterViewProps },
159
- innerCircle: { slotType: react_native_1.View, filter: adapters_1.filterViewProps },
160
- content: text_1.Text,
161
- },
162
- styles: {
163
- root: [],
164
- button: [tokens_1.borderTokens],
165
- innerCircle: [tokens_1.backgroundColorTokens],
166
- content: [
167
- tokens_1.foregroundColorTokens,
168
- tokens_1.textTokens,
169
- [{ source: 'textBorderColor', lookup: tokens_1.getPaletteFromTheme, target: 'borderColor' }],
170
- ],
171
- },
69
+ React.useEffect(() => {
70
+ if (buttonKey == selectedKey) {
71
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
72
+ }
73
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
74
+ }, []);
75
+ // Ensure focus is placed on button after click
76
+ const changeSelectionWithFocus = (0, interactive_hooks_1.useOnPressWithFocus)(componentRef, changeSelection);
77
+ /* RadioButton changes selection when focus is moved between each RadioButton and on a click */
78
+ const pressable = (0, interactive_hooks_1.useAsPressable)({
79
+ ...rest,
80
+ onPress: changeSelectionWithFocus,
81
+ onFocus: changeSelection,
82
+ });
83
+ // Used when creating accessibility properties in mergeSettings below
84
+ const onAccessibilityAction = React.useCallback((event) => {
85
+ switch (event.nativeEvent.actionName) {
86
+ case 'Select':
87
+ changeSelection();
88
+ break;
89
+ }
90
+ }, [changeSelection]);
91
+ const state = {
92
+ ...pressable.state,
93
+ selected: selectedKey === userProps.buttonKey,
94
+ disabled: disabled || false,
95
+ };
96
+ // Grab the styling information from the userProps, referencing the state as well as the props.
97
+ const styleProps = useStyling(userProps, (override) => state[override] || userProps[override]);
98
+ const slotProps = (0, foundation_settings_1.mergeSettings)(styleProps, {
99
+ root: {
100
+ ...rest,
101
+ ref: buttonRef,
102
+ ...pressable.props,
103
+ accessibilityRole: 'radio',
104
+ accessibilityLabel: accessibilityLabel ?? ariaLabel ?? content,
105
+ accessibilityState: { disabled: state.disabled, selected: state.selected },
106
+ accessibilityActions: [{ name: 'Select', label: RadioButton_settings_1.radioButtonSelectActionLabel }],
107
+ accessibilityPosInSet: accessibilityPosInSet ?? ariaPosInSet ?? buttonKeys.findIndex((x) => x == buttonKey) + 1,
108
+ accessibilitySetSize: accessibilitySetSize ?? ariaSetSize ?? buttonKeys.length,
109
+ focusable: !state.disabled,
110
+ onAccessibilityAction: onAccessibilityAction,
111
+ },
112
+ content: { children: content },
113
+ });
114
+ return { slotProps };
115
+ },
116
+ render: (Slots, _renderData, ...children) => {
117
+ return (jsx_runtime_1.jsxs(Slots.root, { children: [
118
+ jsx_runtime_1.jsx(Slots.button, { children: jsx_runtime_1.jsx(Slots.innerCircle, {}) }), jsx_runtime_1.jsx(Slots.content, {}), children] }));
119
+ },
120
+ settings: RadioButton_settings_1.settings,
121
+ slots: {
122
+ root: react_native_1.View,
123
+ button: { slotType: react_native_1.View, filter: adapters_1.filterViewProps },
124
+ innerCircle: { slotType: react_native_1.View, filter: adapters_1.filterViewProps },
125
+ content: text_1.Text,
126
+ },
127
+ styles: {
128
+ root: [],
129
+ button: [tokens_1.borderTokens],
130
+ innerCircle: [tokens_1.backgroundColorTokens],
131
+ content: [tokens_1.foregroundColorTokens, tokens_1.textTokens, [{ source: 'textBorderColor', lookup: tokens_1.getPaletteFromTheme, target: 'borderColor' }]],
132
+ },
172
133
  });
173
134
  exports.default = exports.RadioButton;
174
- //# sourceMappingURL=RadioButton.js.map
135
+ //# sourceMappingURL=RadioButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.js","sourceRoot":"","sources":["../../src/legacy/RadioButton.tsx"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,MAAY,KAAK,kCAAc;AAC/B,+CAAoC;AAEpC,8DAAkE;AAClE,gFAAoH;AACpH,sDAAmD;AACnD,0DAA4I;AAG5I,2EAA6D;AAC7D,6EAAoE;AAEpE,iEAAgF;AAEhF,2DAAsD;AACtD,6CAAiD;AAEpC,QAAA,WAAW,GAAG,IAAA,4BAAO,EAAmB;IACnD,WAAW,EAAE,mCAAe;IAE5B,eAAe,EAAE,CAAC,SAA4B,EAAE,UAAgD,EAAE,EAAE,CAAC;QACnG,MAAM,mBAAmB,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,EACJ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,SAAS,EACT,YAAY,GAAG,mBAAmB,EAClC,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,GAAG,IAAI,EACR,GAAG,SAAS,CAAC;QAEd,2GAA2G;QAC3G,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,8BAAiB,CAAC,CAAC;QAEjD,MAAM,SAAS,GAAG,IAAA,uCAAmB,EAAC,YAAY,CAAC,CAAC;QAEpD,qFAAqF;QACrF,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC;YAC5B,IAAI,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBAClC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ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B;IAED,MAAM,EAAE,CAAC,KAAoC,EAAE,WAAmC,EAAE,GAAG,QAA2B,EAAE,EAAE,CAAC;QACrH,OAAO,CACL,mBAAC,KAAK,CAAC,IAAI;gBACT,kBAAC,KAAK,CAAC,MAAM,cACX,kBAAC,KAAK,CAAC,WAAW,KAAG,GACR,EACf,kBAAC,KAAK,CAAC,OAAO,KAAG,EAChB,QAAQ,IACE,CACd,CAAC;IAAA,CACH;IAED,QAAQ,EAAR,+BAAQ;IACR,KAAK,EAAE;QACL,IAAI,EAAE,mBAAI;QACV,MAAM,EAAE,EAAE,QAAQ,EAAE,mBAAI,EAAE,MAAM,EAAE,0BAAe,EAAE;QACnD,WAAW,EAAE,EAAE,QAAQ,EAAE,mBAAI,EAAE,MAAM,EAAE,0BAAe,EAAE;QACxD,OAAO,EAAE,WAAI;KACd;IACD,MAAM,EAAE;QACN,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,CAAC,qBAAY,CAAC;QACtB,WAAW,EAAE,CAAC,8BAAqB,CAAC;QACpC,OAAO,EAAE,CAAC,8BAAqB,EAAE,mBAAU,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,4BAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;KAClI;CACF,CAAC,CAAC;kBAEY,QAAA,WAAW"}
@@ -1,10 +1,4 @@
1
1
  import type { IRadioButtonProps, IRadioButtonSlotProps } from './RadioButton.types';
2
- export declare const RadioButton: import('@uifabricshared/foundation-compose').IComposeReturnType<
3
- IRadioButtonProps,
4
- IRadioButtonSlotProps,
5
- import('./RadioButton.types').IRadioButtonTokens,
6
- object,
7
- object
8
- >;
2
+ export declare const RadioButton: import("@uifabricshared/foundation-compose").IComposeReturnType<IRadioButtonProps, IRadioButtonSlotProps, import("./RadioButton.types").IRadioButtonTokens, object, object>;
9
3
  export default RadioButton;
10
- //# sourceMappingURL=RadioButton.macos.d.ts.map
4
+ //# sourceMappingURL=RadioButton.macos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.macos.d.ts","sourceRoot":"","sources":["../../src/legacy/RadioButton.macos.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAoB,MAAM,qBAAqB,CAAC;AAItG,eAAO,MAAM,WAAW,6KAqDtB,CAAC;AAEH,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"RadioButton.macos.d.ts","sourceRoot":"","sources":["../../src/legacy/RadioButton.macos.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAoB,MAAM,qBAAqB,CAAC;AAItG,eAAO,MAAM,WAAW,6KAuDtB,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -1,123 +1,106 @@
1
- 'use strict';
2
- var __createBinding =
3
- (this && this.__createBinding) ||
4
- (Object.create
5
- ? function (o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = {
10
- enumerable: true,
11
- get: function () {
12
- return m[k];
13
- },
14
- };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }
18
- : function (o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- });
22
- var __setModuleDefault =
23
- (this && this.__setModuleDefault) ||
24
- (Object.create
25
- ? function (o, v) {
26
- Object.defineProperty(o, 'default', { enumerable: true, value: v });
27
- }
28
- : function (o, v) {
29
- o['default'] = v;
30
- });
31
- var __importStar =
32
- (this && this.__importStar) ||
33
- (function () {
34
- var ownKeys = function (o) {
35
- ownKeys =
36
- Object.getOwnPropertyNames ||
37
- function (o) {
38
- var ar = [];
39
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
40
- return ar;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
41
24
  };
42
- return ownKeys(o);
25
+ return ownKeys(o);
43
26
  };
44
27
  return function (mod) {
45
- if (mod && mod.__esModule) return mod;
46
- var result = {};
47
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== 'default') __createBinding(result, mod, k[i]);
48
- __setModuleDefault(result, mod);
49
- return result;
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
50
33
  };
51
- })();
52
- var __importDefault =
53
- (this && this.__importDefault) ||
54
- function (mod) {
55
- return mod && mod.__esModule ? mod : { default: mod };
56
- };
57
- Object.defineProperty(exports, '__esModule', { value: true });
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
58
39
  exports.RadioButton = void 0;
59
- const jsx_runtime_1 = require('@fluentui-react-native/framework-base/jsx-runtime');
40
+ const jsx_runtime_1 = require("@fluentui-react-native/framework-base/jsx-runtime");
60
41
  /**
61
42
  * Copyright (c) Microsoft Corporation.
62
43
  * Licensed under the MIT License.
63
44
  * @format
64
45
  */
65
46
  /** @jsxImportSource @fluentui-react-native/framework-base */
66
- const React = __importStar(require('react'));
67
- const foundation_compose_1 = require('@uifabricshared/foundation-compose');
68
- const foundation_settings_1 = require('@uifabricshared/foundation-settings');
69
- const MacOSRadioButtonNativeComponent_1 = __importDefault(require('./MacOSRadioButtonNativeComponent'));
70
- const RadioButton_types_1 = require('./RadioButton.types');
71
- const RadioGroup_1 = require('./RadioGroup');
47
+ const React = __importStar(require("react"));
48
+ const foundation_compose_1 = require("@uifabricshared/foundation-compose");
49
+ const foundation_settings_1 = require("@uifabricshared/foundation-settings");
50
+ const MacOSRadioButtonNativeComponent_1 = __importDefault(require("./MacOSRadioButtonNativeComponent"));
51
+ const RadioButton_types_1 = require("./RadioButton.types");
52
+ const RadioGroup_1 = require("./RadioGroup");
72
53
  exports.RadioButton = (0, foundation_compose_1.compose)({
73
- displayName: RadioButton_types_1.radioButtonName,
74
- usePrepareProps: (userProps, useStyling) => {
75
- const defaultComponentRef = React.useRef(null);
76
- const { content, buttonKey, disabled, componentRef = defaultComponentRef } = userProps;
77
- const info = React.useContext(RadioGroup_1.RadioGroupContext);
78
- // Reroute the native component's onPress event to RadioGroup's onChange
79
- const onPressRerouted = () => {
80
- // Prevent calls to RadioGroup's onChange on the currently selected button
81
- if (buttonKey != info.selectedKey) {
82
- info.onChange && info.onChange(buttonKey);
83
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
84
- }
85
- };
86
- /* We use the componentRef of the currently selected button to maintain the default tabbable
54
+ displayName: RadioButton_types_1.radioButtonName,
55
+ usePrepareProps: (userProps, useStyling) => {
56
+ const defaultComponentRef = React.useRef(null);
57
+ const { content, buttonKey, disabled, componentRef = defaultComponentRef } = userProps;
58
+ const info = React.useContext(RadioGroup_1.RadioGroupContext);
59
+ const { onChange, selectedKey, updateSelectedButtonRef } = info;
60
+ // Reroute the native component's onPress event to RadioGroup's onChange
61
+ const onPressRerouted = React.useCallback(() => {
62
+ // Prevent calls to RadioGroup's onChange on the currently selected button
63
+ if (buttonKey != selectedKey) {
64
+ onChange && onChange(buttonKey);
65
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
66
+ }
67
+ }, [buttonKey, componentRef, onChange, selectedKey, updateSelectedButtonRef]);
68
+ /* We use the componentRef of the currently selected button to maintain the default tabbable
87
69
  element in a RadioGroup. Since the componentRef isn't generated until after initial render,
88
70
  we must update it once here. */
89
- React.useEffect(() => {
90
- if (buttonKey === info.selectedKey) {
91
- info.updateSelectedButtonRef && componentRef && info.updateSelectedButtonRef(componentRef);
92
- }
93
- }, []);
94
- const styleProps = useStyling(userProps);
95
- const isSelected = info.selectedKey === buttonKey;
96
- const slotProps = (0, foundation_settings_1.mergeSettings)(styleProps, {
97
- root: {
98
- ref: componentRef,
99
- buttonKey: buttonKey,
100
- content: content,
101
- disabled: disabled,
102
- onPress: onPressRerouted,
103
- selected: isSelected,
104
- style: {
105
- minWidth: '100%',
106
- minHeight: 20,
107
- },
108
- },
109
- });
110
- return { slotProps };
111
- },
112
- slots: {
113
- root: MacOSRadioButtonNativeComponent_1.default,
114
- },
115
- styles: {
116
- root: [],
117
- },
118
- render: (Slots) => {
119
- return jsx_runtime_1.jsx(Slots.root, {});
120
- },
71
+ React.useEffect(() => {
72
+ if (buttonKey === selectedKey) {
73
+ updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
74
+ }
75
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
76
+ }, []);
77
+ const styleProps = useStyling(userProps);
78
+ const isSelected = selectedKey === buttonKey;
79
+ const slotProps = (0, foundation_settings_1.mergeSettings)(styleProps, {
80
+ root: {
81
+ ref: componentRef,
82
+ buttonKey: buttonKey,
83
+ content: content,
84
+ disabled: disabled,
85
+ onPress: onPressRerouted,
86
+ selected: isSelected,
87
+ style: {
88
+ minWidth: '100%',
89
+ minHeight: 20,
90
+ },
91
+ },
92
+ });
93
+ return { slotProps };
94
+ },
95
+ slots: {
96
+ root: MacOSRadioButtonNativeComponent_1.default,
97
+ },
98
+ styles: {
99
+ root: [],
100
+ },
101
+ render: (Slots) => {
102
+ return jsx_runtime_1.jsx(Slots.root, {});
103
+ },
121
104
  });
122
105
  exports.default = exports.RadioButton;
123
- //# sourceMappingURL=RadioButton.macos.js.map
106
+ //# sourceMappingURL=RadioButton.macos.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.macos.js","sourceRoot":"","sources":["../../src/legacy/RadioButton.macos.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,6DAA6D;AAC7D,MAAY,KAAK,kCAAc;AAG/B,2EAA6D;AAE7D,6EAAoE;AAEpE,wGAAsE;AAEtE,2DAAsD;AACtD,6CAAiD;AAEpC,QAAA,WAAW,GAAG,IAAA,4BAAO,EAAmB;IACnD,WAAW,EAAE,mCAAe;IAC5B,eAAe,EAAE,CAAC,SAA4B,EAAE,UAAgD,EAAE,EAAE,CAAC;QACnG,MAAM,mBAAmB,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,GAAG,mBAAmB,EAAE,GAAG,SAAS,CAAC;QACvF,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,8BAAiB,CAAC,CAAC;QAEjD,wEAAwE;QACxE,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC;YAC5B,0EAA0E;YAC1E,IAAI,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBAClC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC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AAC,SAAS,CAAC,CAAC;QACzC,MAAM,UAAU,GAAG,WAAW,KAAK,SAAS,CAAC;QAC7C,MAAM,SAAS,GAAG,IAAA,mCAAa,EAAwB,UAAU,EAAE;YACjE,IAAI,EAAE;gBACJ,GAAG,EAAE,YAAY;gBACjB,SAAS,EAAE,SAAS;gBACpB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,eAAe;gBACxB,QAAQ,EAAE,UAAU;gBACpB,KAAK,EAAE;oBACL,QAAQ,EAAE,MAAM;oBAChB,SAAS,EAAE,EAAE;iBACd;aACF;SACF,CAAC,CAAC;QAEH,OAAO,EAAE,SAAS,EAAE,CAAC;IAAA,CACtB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,yCAAqB;KAC5B;IACD,MAAM,EAAE;QACN,IAAI,EAAE,EAAE;KACT;IACD,MAAM,EAAE,CAAC,KAAoC,EAAE,EAAE,CAAC;QAChD,OAAO,kBAAC,KAAK,CAAC,IAAI,KAAG,CAAC;IAAA,CACvB;CACF,CAAC,CAAC;kBAEY,QAAA,WAAW"}
@@ -1,5 +1,5 @@
1
1
  import type { IComposeSettings } from '@uifabricshared/foundation-compose';
2
2
  import type { IRadioButtonType } from './RadioButton.types';
3
- export declare const radioButtonSelectActionLabel = 'Select a RadioButton';
3
+ export declare const radioButtonSelectActionLabel = "Select a RadioButton";
4
4
  export declare const settings: IComposeSettings<IRadioButtonType>;
5
- //# sourceMappingURL=RadioButton.settings.d.ts.map
5
+ //# sourceMappingURL=RadioButton.settings.d.ts.map