@fluentui-react-native/radio-group 0.22.0 → 0.22.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.
- package/CHANGELOG.md +22 -0
- package/lib/Radio/Radio.d.ts +2 -7
- package/lib/Radio/Radio.ios.d.ts +2 -7
- package/lib/Radio/Radio.ios.js +31 -50
- package/lib/Radio/Radio.js +31 -46
- package/lib/Radio/Radio.styling.d.ts +1 -1
- package/lib/Radio/Radio.styling.js +88 -109
- package/lib/Radio/Radio.types.d.ts +170 -176
- package/lib/Radio/Radio.types.js +1 -1
- package/lib/Radio/RadioTokens.android.d.ts +1 -1
- package/lib/Radio/RadioTokens.android.js +42 -42
- package/lib/Radio/RadioTokens.android.js.map +1 -1
- package/lib/Radio/RadioTokens.d.ts +1 -1
- package/lib/Radio/RadioTokens.ios.d.ts +1 -1
- package/lib/Radio/RadioTokens.ios.js +39 -39
- package/lib/Radio/RadioTokens.ios.js.map +1 -1
- package/lib/Radio/RadioTokens.js +76 -76
- package/lib/Radio/RadioTokens.js.map +1 -1
- package/lib/Radio/RadioTokens.win32.d.ts +1 -1
- package/lib/Radio/RadioTokens.win32.js +89 -89
- package/lib/Radio/RadioTokens.win32.js.map +1 -1
- package/lib/Radio/__tests__/RadioExperimental.test.d.ts +1 -1
- package/lib/Radio/__tests__/RadioExperimental.test.js +14 -14
- package/lib/Radio/useRadio.d.ts +1 -1
- package/lib/Radio/useRadio.js +70 -91
- package/lib/Radio/useRadio.win32.d.ts +1 -1
- package/lib/Radio/useRadio.win32.js +121 -143
- package/lib/RadioGroup/RadioGroup.d.ts +2 -7
- package/lib/RadioGroup/RadioGroup.js +34 -48
- package/lib/RadioGroup/RadioGroup.styling.d.ts +1 -1
- package/lib/RadioGroup/RadioGroup.styling.js +42 -51
- package/lib/RadioGroup/RadioGroup.types.d.ts +117 -117
- package/lib/RadioGroup/RadioGroup.types.js +1 -1
- package/lib/RadioGroup/RadioGroupTokens.android.d.ts +1 -1
- package/lib/RadioGroup/RadioGroupTokens.android.js +1 -1
- package/lib/RadioGroup/RadioGroupTokens.d.ts +1 -1
- package/lib/RadioGroup/RadioGroupTokens.ios.d.ts +1 -1
- package/lib/RadioGroup/RadioGroupTokens.ios.js +1 -1
- package/lib/RadioGroup/RadioGroupTokens.js +12 -12
- package/lib/RadioGroup/RadioGroupTokens.js.map +1 -1
- package/lib/RadioGroup/RadioGroupTokens.mobile.d.ts +1 -1
- package/lib/RadioGroup/RadioGroupTokens.mobile.js +13 -13
- package/lib/RadioGroup/RadioGroupTokens.mobile.js.map +1 -1
- package/lib/RadioGroup/__tests__/RadioGroupExperimental.test.d.ts +1 -1
- package/lib/RadioGroup/__tests__/RadioGroupExperimental.test.js +56 -98
- package/lib/RadioGroup/radioGroupContext.d.ts +1 -1
- package/lib/RadioGroup/radioGroupContext.js +15 -19
- package/lib/RadioGroup/useRadioGroup.d.ts +1 -1
- package/lib/RadioGroup/useRadioGroup.js +63 -93
- package/lib/RadioGroup/useRadioGroupContextValue.d.ts +1 -1
- package/lib/RadioGroup/useRadioGroupContextValue.js +2 -2
- package/lib/index.d.ts +4 -25
- package/lib/index.js +1 -1
- package/lib/legacy/MacOSRadioButtonNativeComponent.d.ts +6 -6
- package/lib/legacy/MacOSRadioButtonNativeComponent.js +1 -1
- package/lib/legacy/RadioButton.d.ts +2 -8
- package/lib/legacy/RadioButton.js +80 -96
- package/lib/legacy/RadioButton.macos.d.ts +2 -8
- package/lib/legacy/RadioButton.macos.js +48 -48
- package/lib/legacy/RadioButton.settings.d.ts +2 -2
- package/lib/legacy/RadioButton.settings.js +81 -81
- package/lib/legacy/RadioButton.types.d.ts +45 -45
- package/lib/legacy/RadioButton.types.js +1 -1
- package/lib/legacy/RadioButton.win32.d.ts +2 -8
- package/lib/legacy/RadioButton.win32.js +132 -151
- package/lib/legacy/RadioGroup.d.ts +2 -8
- package/lib/legacy/RadioGroup.js +84 -108
- package/lib/legacy/RadioGroup.settings.d.ts +1 -1
- package/lib/legacy/RadioGroup.settings.js +21 -21
- package/lib/legacy/RadioGroup.types.d.ts +79 -78
- package/lib/legacy/RadioGroup.types.js +1 -1
- package/lib/legacy/__tests__/RadioButton.test.d.ts +1 -1
- package/lib/legacy/__tests__/RadioButton.test.js +8 -8
- package/lib/legacy/__tests__/RadioButtonGroup.test.d.ts +1 -1
- package/lib/legacy/__tests__/RadioButtonGroup.test.js +18 -34
- package/lib-commonjs/Radio/Radio.d.ts +2 -7
- package/lib-commonjs/Radio/Radio.ios.d.ts +2 -7
- package/lib-commonjs/Radio/Radio.ios.js +40 -64
- package/lib-commonjs/Radio/Radio.js +39 -59
- package/lib-commonjs/Radio/Radio.styling.d.ts +1 -1
- package/lib-commonjs/Radio/Radio.styling.js +94 -115
- package/lib-commonjs/Radio/Radio.types.d.ts +170 -176
- package/lib-commonjs/Radio/Radio.types.js +3 -3
- package/lib-commonjs/Radio/RadioTokens.android.d.ts +1 -1
- package/lib-commonjs/Radio/RadioTokens.android.js +45 -45
- package/lib-commonjs/Radio/RadioTokens.android.js.map +1 -1
- package/lib-commonjs/Radio/RadioTokens.d.ts +1 -1
- package/lib-commonjs/Radio/RadioTokens.ios.d.ts +1 -1
- package/lib-commonjs/Radio/RadioTokens.ios.js +42 -42
- package/lib-commonjs/Radio/RadioTokens.ios.js.map +1 -1
- package/lib-commonjs/Radio/RadioTokens.js +79 -79
- package/lib-commonjs/Radio/RadioTokens.js.map +1 -1
- package/lib-commonjs/Radio/RadioTokens.win32.d.ts +1 -1
- package/lib-commonjs/Radio/RadioTokens.win32.js +92 -92
- package/lib-commonjs/Radio/RadioTokens.win32.js.map +1 -1
- package/lib-commonjs/Radio/__tests__/RadioExperimental.test.d.ts +1 -1
- package/lib-commonjs/Radio/__tests__/RadioExperimental.test.js +48 -65
- package/lib-commonjs/Radio/useRadio.d.ts +1 -1
- package/lib-commonjs/Radio/useRadio.js +105 -143
- package/lib-commonjs/Radio/useRadio.win32.d.ts +1 -1
- package/lib-commonjs/Radio/useRadio.win32.js +157 -196
- package/lib-commonjs/RadioGroup/RadioGroup.d.ts +2 -7
- package/lib-commonjs/RadioGroup/RadioGroup.js +45 -65
- package/lib-commonjs/RadioGroup/RadioGroup.styling.d.ts +1 -1
- package/lib-commonjs/RadioGroup/RadioGroup.styling.js +48 -57
- package/lib-commonjs/RadioGroup/RadioGroup.types.d.ts +117 -117
- package/lib-commonjs/RadioGroup/RadioGroup.types.js +3 -3
- package/lib-commonjs/RadioGroup/RadioGroupTokens.android.d.ts +1 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.android.js +5 -10
- package/lib-commonjs/RadioGroup/RadioGroupTokens.d.ts +1 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.ios.d.ts +1 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.ios.js +5 -10
- package/lib-commonjs/RadioGroup/RadioGroupTokens.js +15 -15
- package/lib-commonjs/RadioGroup/RadioGroupTokens.js.map +1 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.d.ts +1 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.js +16 -16
- package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.js.map +1 -1
- package/lib-commonjs/RadioGroup/__tests__/RadioGroupExperimental.test.d.ts +1 -1
- package/lib-commonjs/RadioGroup/__tests__/RadioGroupExperimental.test.js +91 -153
- package/lib-commonjs/RadioGroup/radioGroupContext.d.ts +1 -1
- package/lib-commonjs/RadioGroup/radioGroupContext.js +47 -68
- package/lib-commonjs/RadioGroup/useRadioGroup.d.ts +1 -1
- package/lib-commonjs/RadioGroup/useRadioGroup.js +97 -144
- package/lib-commonjs/RadioGroup/useRadioGroupContextValue.d.ts +1 -1
- package/lib-commonjs/RadioGroup/useRadioGroupContextValue.js +4 -4
- package/lib-commonjs/index.d.ts +4 -25
- package/lib-commonjs/index.js +32 -128
- package/lib-commonjs/legacy/MacOSRadioButtonNativeComponent.d.ts +6 -6
- package/lib-commonjs/legacy/MacOSRadioButtonNativeComponent.js +7 -9
- package/lib-commonjs/legacy/RadioButton.d.ts +2 -8
- package/lib-commonjs/legacy/RadioButton.js +121 -162
- package/lib-commonjs/legacy/RadioButton.macos.d.ts +2 -8
- package/lib-commonjs/legacy/RadioButton.macos.js +88 -107
- package/lib-commonjs/legacy/RadioButton.settings.d.ts +2 -2
- package/lib-commonjs/legacy/RadioButton.settings.js +84 -84
- package/lib-commonjs/legacy/RadioButton.types.d.ts +45 -45
- package/lib-commonjs/legacy/RadioButton.types.js +3 -3
- package/lib-commonjs/legacy/RadioButton.win32.d.ts +2 -8
- package/lib-commonjs/legacy/RadioButton.win32.js +173 -217
- package/lib-commonjs/legacy/RadioGroup.d.ts +2 -8
- package/lib-commonjs/legacy/RadioGroup.js +125 -168
- package/lib-commonjs/legacy/RadioGroup.settings.d.ts +1 -1
- package/lib-commonjs/legacy/RadioGroup.settings.js +24 -24
- package/lib-commonjs/legacy/RadioGroup.types.d.ts +79 -78
- package/lib-commonjs/legacy/RadioGroup.types.js +3 -3
- package/lib-commonjs/legacy/__tests__/RadioButton.test.d.ts +1 -1
- package/lib-commonjs/legacy/__tests__/RadioButton.test.js +42 -59
- package/lib-commonjs/legacy/__tests__/RadioButtonGroup.test.d.ts +1 -1
- package/lib-commonjs/legacy/__tests__/RadioButtonGroup.test.js +53 -96
- package/package.json +27 -26
- package/src/Radio/RadioTokens.android.ts +1 -1
- package/src/Radio/RadioTokens.ios.ts +1 -1
- package/src/Radio/RadioTokens.ts +1 -1
- package/src/Radio/RadioTokens.win32.ts +1 -1
- package/src/RadioGroup/RadioGroupTokens.mobile.ts +1 -1
- package/src/RadioGroup/RadioGroupTokens.ts +1 -1
package/lib/legacy/RadioGroup.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui-react-native/framework-base/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @fluentui-react-native/framework-base */
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { View } from 'react-native';
|
|
@@ -11,117 +11,93 @@ import { mergeSettings } from '@uifabricshared/foundation-settings';
|
|
|
11
11
|
import { settings } from './RadioGroup.settings';
|
|
12
12
|
import { radioGroupName } from './RadioGroup.types';
|
|
13
13
|
export const RadioGroupContext = React.createContext({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/* key: string */ {
|
|
18
|
-
return;
|
|
14
|
+
selectedKey: null,
|
|
15
|
+
onChange: ( /* key: string */ /* key: string */) => {
|
|
16
|
+
return;
|
|
19
17
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/* ref: React.RefObject<any>*/ {
|
|
23
|
-
return;
|
|
18
|
+
updateSelectedButtonRef: ( /* ref: React.RefObject<any>*/ /* ref: React.RefObject<any>*/) => {
|
|
19
|
+
return;
|
|
24
20
|
},
|
|
25
|
-
|
|
21
|
+
buttonKeys: [],
|
|
26
22
|
});
|
|
27
23
|
export const RadioGroup = compose({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
setSelectedButtonRef
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
removeRadioButtonKey: onRemoveRadioButtonKey,
|
|
88
|
-
addRadioButtonEnabledKey: onAddRadioButtonEnabledKey,
|
|
89
|
-
removeRadioButtonEnabledKey: onRemoveRadioButtonEnabledKey,
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
const styleProps = useStyling(userProps, (override) => state[override] || userProps[override]);
|
|
93
|
-
const slotProps = mergeSettings(styleProps, {
|
|
94
|
-
root: { accessibilityLabel: accessibilityLabel ?? ariaLabel ?? label, accessibilityRole: 'radiogroup', ...rest },
|
|
95
|
-
label: { children: label },
|
|
96
|
-
container: { isCircularNavigation: true, defaultTabbableElement: selectedButtonRef },
|
|
97
|
-
});
|
|
98
|
-
return { slotProps, state };
|
|
99
|
-
},
|
|
100
|
-
render: (Slots, renderData, ...children) => {
|
|
101
|
-
if (renderData.state == undefined) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
return _jsx(
|
|
105
|
-
RadioGroupContext.Provider,
|
|
106
|
-
// Passes in the selected key and a hook function to update the newly selected button and call the client's onChange callback
|
|
107
|
-
{
|
|
24
|
+
displayName: radioGroupName,
|
|
25
|
+
usePrepareProps: (userProps, useStyling) => {
|
|
26
|
+
const { label, ariaLabel, accessibilityLabel, selectedKey, defaultSelectedKey, ...rest } = userProps;
|
|
27
|
+
// This hook updates the Selected Button and calls the customer's onClick function. This gets called after a button is pressed.
|
|
28
|
+
const data = useSelectedKey(selectedKey || defaultSelectedKey || null, userProps.onChange);
|
|
29
|
+
const [selectedButtonRef, setSelectedButtonRef] = React.useState(React.useRef(null));
|
|
30
|
+
const onSelectButtonRef = React.useCallback((ref) => {
|
|
31
|
+
setSelectedButtonRef(ref);
|
|
32
|
+
}, [setSelectedButtonRef]);
|
|
33
|
+
const [invoked, setInvoked] = React.useState(false);
|
|
34
|
+
const onInvoked = React.useCallback((check) => {
|
|
35
|
+
setInvoked(check);
|
|
36
|
+
}, [setInvoked]);
|
|
37
|
+
const [buttonKeys, setButtonKeys] = React.useState([]);
|
|
38
|
+
const onAddRadioButtonKey = React.useCallback((buttonKey) => {
|
|
39
|
+
buttonKeys.push(buttonKey);
|
|
40
|
+
setButtonKeys(buttonKeys);
|
|
41
|
+
}, [setButtonKeys]);
|
|
42
|
+
const onRemoveRadioButtonKey = React.useCallback((buttonKey) => {
|
|
43
|
+
buttonKeys.filter((item) => item !== buttonKey);
|
|
44
|
+
setButtonKeys(buttonKeys);
|
|
45
|
+
}, [setButtonKeys]);
|
|
46
|
+
const [enabledButtonKeys, setEnabledButtonKeys] = React.useState([]);
|
|
47
|
+
const onAddRadioButtonEnabledKey = React.useCallback((buttonKey) => {
|
|
48
|
+
enabledButtonKeys.push(buttonKey);
|
|
49
|
+
setEnabledButtonKeys(enabledButtonKeys);
|
|
50
|
+
}, [setEnabledButtonKeys]);
|
|
51
|
+
const onRemoveRadioButtonEnabledKey = React.useCallback((buttonKey) => {
|
|
52
|
+
enabledButtonKeys.filter((item) => item !== buttonKey);
|
|
53
|
+
setEnabledButtonKeys(enabledButtonKeys);
|
|
54
|
+
}, [setEnabledButtonKeys]);
|
|
55
|
+
const state = {
|
|
56
|
+
context: {
|
|
57
|
+
selectedKey: selectedKey ?? data.selectedKey,
|
|
58
|
+
onChange: data.onKeySelect,
|
|
59
|
+
updateSelectedButtonRef: onSelectButtonRef,
|
|
60
|
+
invoked: invoked,
|
|
61
|
+
updateInvoked: onInvoked,
|
|
62
|
+
buttonKeys: buttonKeys,
|
|
63
|
+
enabledButtonKeys: enabledButtonKeys,
|
|
64
|
+
addRadioButtonKey: onAddRadioButtonKey,
|
|
65
|
+
removeRadioButtonKey: onRemoveRadioButtonKey,
|
|
66
|
+
addRadioButtonEnabledKey: onAddRadioButtonEnabledKey,
|
|
67
|
+
removeRadioButtonEnabledKey: onRemoveRadioButtonEnabledKey,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const styleProps = useStyling(userProps, (override) => state[override] || userProps[override]);
|
|
71
|
+
const slotProps = mergeSettings(styleProps, {
|
|
72
|
+
root: { accessibilityLabel: accessibilityLabel ?? ariaLabel ?? label, accessibilityRole: 'radiogroup', ...rest },
|
|
73
|
+
label: { children: label },
|
|
74
|
+
container: { isCircularNavigation: true, defaultTabbableElement: selectedButtonRef },
|
|
75
|
+
});
|
|
76
|
+
return { slotProps, state };
|
|
77
|
+
},
|
|
78
|
+
render: (Slots, renderData, ...children) => {
|
|
79
|
+
if (renderData.state == undefined) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return (_jsx(RadioGroupContext.Provider
|
|
108
83
|
// Passes in the selected key and a hook function to update the newly selected button and call the client's onChange callback
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
84
|
+
, {
|
|
85
|
+
// Passes in the selected key and a hook function to update the newly selected button and call the client's onChange callback
|
|
86
|
+
value: renderData.state.context, children: _jsxs(Slots.root, { children: [
|
|
87
|
+
_jsx(Slots.label, {}), _jsx(Slots.container, { children: children })
|
|
88
|
+
] }) }));
|
|
89
|
+
},
|
|
90
|
+
settings,
|
|
91
|
+
slots: {
|
|
92
|
+
root: View,
|
|
93
|
+
label: Text,
|
|
94
|
+
container: FocusZone,
|
|
95
|
+
},
|
|
96
|
+
styles: {
|
|
97
|
+
root: [],
|
|
98
|
+
label: [foregroundColorTokens, textTokens],
|
|
99
|
+
container: [],
|
|
100
|
+
},
|
|
125
101
|
});
|
|
126
102
|
export default RadioGroup;
|
|
127
|
-
//# sourceMappingURL=RadioGroup.js.map
|
|
103
|
+
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { IComposeSettings } from '@uifabricshared/foundation-compose';
|
|
2
2
|
import type { IRadioGroupType } from './RadioGroup.types';
|
|
3
3
|
export declare const settings: IComposeSettings<IRadioGroupType>;
|
|
4
|
-
//# sourceMappingURL=RadioGroup.settings.d.ts.map
|
|
4
|
+
//# sourceMappingURL=RadioGroup.settings.d.ts.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { radioGroupName } from './RadioGroup.types';
|
|
2
2
|
export const settings = [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
{
|
|
4
|
+
tokens: {
|
|
5
|
+
color: 'menuItemText',
|
|
6
|
+
},
|
|
7
|
+
root: {
|
|
8
|
+
accessible: true,
|
|
9
|
+
accessibilityRole: 'radio',
|
|
10
|
+
style: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'flex-start',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
label: {
|
|
17
|
+
style: {
|
|
18
|
+
fontSize: 16,
|
|
19
|
+
fontWeight: '600',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
6
22
|
},
|
|
7
|
-
|
|
8
|
-
accessible: true,
|
|
9
|
-
accessibilityRole: 'radio',
|
|
10
|
-
style: {
|
|
11
|
-
display: 'flex',
|
|
12
|
-
alignItems: 'flex-start',
|
|
13
|
-
flexDirection: 'column',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
label: {
|
|
17
|
-
style: {
|
|
18
|
-
fontSize: 16,
|
|
19
|
-
fontWeight: '600',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
radioGroupName,
|
|
23
|
+
radioGroupName,
|
|
24
24
|
];
|
|
25
|
-
//# sourceMappingURL=RadioGroup.settings.js.map
|
|
25
|
+
//# sourceMappingURL=RadioGroup.settings.js.map
|
|
@@ -4,92 +4,93 @@ import type { FocusZoneProps } from '@fluentui-react-native/focus-zone';
|
|
|
4
4
|
import type { ITextProps } from '@fluentui-react-native/text';
|
|
5
5
|
import type { IForegroundColorTokens, FontTokens } from '@fluentui-react-native/tokens';
|
|
6
6
|
import type { IRenderData } from '@uifabricshared/foundation-composable';
|
|
7
|
-
export declare const radioGroupName =
|
|
7
|
+
export declare const radioGroupName = "RadioGroup";
|
|
8
8
|
export interface IRadioGroupContext {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The currently selected RadioButton's key
|
|
11
|
+
*/
|
|
12
|
+
selectedKey: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Updates the selected button and calls the client’s onChange callback
|
|
15
|
+
*/
|
|
16
|
+
onChange?: (key: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Updates the selected button's ref to set as the default tabbable element
|
|
19
|
+
*/
|
|
20
|
+
updateSelectedButtonRef?: (ref: React.RefObject<any>) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Array of radio button keys in the group
|
|
23
|
+
*/
|
|
24
|
+
buttonKeys?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Populate the buttonKeys array (all RadioButton keys) at mount and un-mount
|
|
27
|
+
*/
|
|
28
|
+
addRadioButtonKey?: (value: string) => void;
|
|
29
|
+
removeRadioButtonKey?: (value: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Array of enabled Radio keys in the RadioGroup
|
|
32
|
+
* @platform win32
|
|
33
|
+
*/
|
|
34
|
+
enabledButtonKeys?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Populate the enabledButtonKeys array (only enabled/valid RadioButton keys) at mount and un-mount
|
|
37
|
+
* @platform win32
|
|
38
|
+
*/
|
|
39
|
+
addRadioButtonEnabledKey?: (value: string) => void;
|
|
40
|
+
removeRadioButtonEnabledKey?: (value: string) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Updates invoked to signal that arrow key has been pressed and focus needs to be set
|
|
43
|
+
* @platform win32
|
|
44
|
+
*/
|
|
45
|
+
updateInvoked?: (check: boolean) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Signals whether arrow key has been pressed
|
|
48
|
+
* @platform win32
|
|
49
|
+
*/
|
|
50
|
+
invoked?: boolean;
|
|
51
51
|
}
|
|
52
52
|
export interface IRadioGroupState {
|
|
53
|
-
|
|
53
|
+
context: IRadioGroupContext;
|
|
54
54
|
}
|
|
55
55
|
export type IRadioGroupProps = React.PropsWithChildren<{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Descriptive label for the RadioGroup. This will be displayed as the title of the radio group to the user.
|
|
58
|
+
*/
|
|
59
|
+
label: string;
|
|
60
|
+
/**
|
|
61
|
+
* The key of the RadioButton that will initially be selected
|
|
62
|
+
*/
|
|
63
|
+
defaultSelectedKey?: string;
|
|
64
|
+
/**
|
|
65
|
+
* A label for screen readers. If not provided, it will be set to the label of the radio group.
|
|
66
|
+
* @deprecated Use accessibilityLabel instead.
|
|
67
|
+
*/
|
|
68
|
+
ariaLabel?: string;
|
|
69
|
+
accessibilityLabel?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The key of the selected option. If you provide this, you must maintain selection state by observing
|
|
72
|
+
* onChange events and passing a new value in when changed. This overrides defaultSelectedKey
|
|
73
|
+
* and makes the RadioGroup a controlled component.
|
|
74
|
+
*/
|
|
75
|
+
selectedKey?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Callback for receiving a notification when the choice has been changed
|
|
78
|
+
*/
|
|
79
|
+
onChange?: (key: string) => void;
|
|
80
|
+
testID?: string;
|
|
81
81
|
}>;
|
|
82
|
-
export interface IRadioGroupTokens extends IForegroundColorTokens, FontTokens {
|
|
82
|
+
export interface IRadioGroupTokens extends IForegroundColorTokens, FontTokens {
|
|
83
|
+
}
|
|
83
84
|
export interface IRadioGroupSlotProps {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
root: React.PropsWithRef<ViewProps>;
|
|
86
|
+
label: ITextProps;
|
|
87
|
+
container: FocusZoneProps;
|
|
87
88
|
}
|
|
88
89
|
export type IRadioGroupRenderData = IRenderData<IRadioGroupSlotProps, IRadioGroupState>;
|
|
89
90
|
export interface IRadioGroupType {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
props: IRadioGroupProps;
|
|
92
|
+
tokens: IRadioGroupTokens;
|
|
93
|
+
slotProps: IRadioGroupSlotProps;
|
|
94
|
+
state: IRadioGroupState;
|
|
94
95
|
}
|
|
95
|
-
//# sourceMappingURL=RadioGroup.types.d.ts.map
|
|
96
|
+
//# sourceMappingURL=RadioGroup.types.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const radioGroupName = 'RadioGroup';
|
|
2
|
-
//# sourceMappingURL=RadioGroup.types.js.map
|
|
2
|
+
//# sourceMappingURL=RadioGroup.types.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=RadioButton.test.d.ts.map
|
|
2
|
+
//# sourceMappingURL=RadioButton.test.d.ts.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx } from
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { act } from 'react';
|
|
3
3
|
import * as renderer from 'react-test-renderer';
|
|
4
4
|
import { RadioButton } from '../RadioButton';
|
|
5
5
|
describe('RadioButton component tests', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
it('RadioButton default', () => {
|
|
7
|
+
let component;
|
|
8
|
+
act(() => {
|
|
9
|
+
component = renderer.create(_jsx(RadioButton, { buttonKey: "key1", content: "Default Button" }));
|
|
10
|
+
});
|
|
11
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
10
12
|
});
|
|
11
|
-
expect(component.toJSON()).toMatchSnapshot();
|
|
12
|
-
});
|
|
13
13
|
});
|
|
14
|
-
//# sourceMappingURL=RadioButton.test.js.map
|
|
14
|
+
//# sourceMappingURL=RadioButton.test.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=RadioButtonGroup.test.d.ts.map
|
|
2
|
+
//# sourceMappingURL=RadioButtonGroup.test.d.ts.map
|
|
@@ -1,42 +1,26 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { act } from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import * as renderer from 'react-test-renderer';
|
|
5
5
|
import { RadioGroup, RadioButton } from '../..';
|
|
6
6
|
describe('RadioButton component tests', () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_jsx(RadioButton, { buttonKey: 'key1', content: 'RadioButton1' }),
|
|
16
|
-
_jsx(RadioButton, { buttonKey: 'key2', content: 'RadioButton2' }),
|
|
17
|
-
],
|
|
18
|
-
}),
|
|
19
|
-
);
|
|
7
|
+
it('RadioButton default', () => {
|
|
8
|
+
let component;
|
|
9
|
+
act(() => {
|
|
10
|
+
component = renderer.create(_jsxs(RadioGroup, { label: "Uncontrolled RadioGroup", defaultSelectedKey: "key2", children: [
|
|
11
|
+
_jsx(RadioButton, { buttonKey: "key1", content: "RadioButton1" }), _jsx(RadioButton, { buttonKey: "key2", content: "RadioButton2" })
|
|
12
|
+
] }));
|
|
13
|
+
});
|
|
14
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
20
15
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
defaultSelectedKey: 'key2',
|
|
30
|
-
children: _jsxs(View, {
|
|
31
|
-
children: [
|
|
32
|
-
_jsx(RadioButton, { buttonKey: 'key1', content: 'RadioButton1', accessibilityPosInSet: 1, accessibilitySetSize: 2 }),
|
|
33
|
-
_jsx(RadioButton, { buttonKey: 'key2', content: 'RadioButton2', accessibilityPosInSet: 2, accessibilitySetSize: 2 }),
|
|
34
|
-
],
|
|
35
|
-
}),
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
16
|
+
it('RadioButton not direct child of radio group', () => {
|
|
17
|
+
let component;
|
|
18
|
+
act(() => {
|
|
19
|
+
component = renderer.create(_jsx(RadioGroup, { label: "Uncontrolled RadioGroup", defaultSelectedKey: "key2", children: _jsxs(View, { children: [
|
|
20
|
+
_jsx(RadioButton, { buttonKey: "key1", content: "RadioButton1", accessibilityPosInSet: 1, accessibilitySetSize: 2 }), _jsx(RadioButton, { buttonKey: "key2", content: "RadioButton2", accessibilityPosInSet: 2, accessibilitySetSize: 2 })
|
|
21
|
+
] }) }));
|
|
22
|
+
});
|
|
23
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
38
24
|
});
|
|
39
|
-
expect(component.toJSON()).toMatchSnapshot();
|
|
40
|
-
});
|
|
41
25
|
});
|
|
42
|
-
//# sourceMappingURL=RadioButtonGroup.test.js.map
|
|
26
|
+
//# sourceMappingURL=RadioButtonGroup.test.js.map
|
|
@@ -9,10 +9,5 @@ import type { RadioProps } from './Radio.types';
|
|
|
9
9
|
* @returns Whether the styles that are assigned to the layer should be applied to the Radio
|
|
10
10
|
*/
|
|
11
11
|
export declare const radioLookup: (layer: string, state: PressableState, userProps: RadioProps) => boolean;
|
|
12
|
-
export declare const Radio: import(
|
|
13
|
-
|
|
14
|
-
import('./Radio.types').RadioSlotProps,
|
|
15
|
-
import('./Radio.types').RadioTokens,
|
|
16
|
-
import('@fluentui-react-native/framework').ObjectBase
|
|
17
|
-
>;
|
|
18
|
-
//# sourceMappingURL=Radio.d.ts.map
|
|
12
|
+
export declare const Radio: import("@fluentui-react-native/framework").ComposableComponent<RadioProps, import("./Radio.types").RadioSlotProps, import("./Radio.types").RadioTokens, import("@fluentui-react-native/framework").ObjectBase>;
|
|
13
|
+
//# sourceMappingURL=Radio.d.ts.map
|
|
@@ -9,10 +9,5 @@ import type { RadioProps } from './Radio.types';
|
|
|
9
9
|
* @returns Whether the styles that are assigned to the layer should be applied to the Radio
|
|
10
10
|
*/
|
|
11
11
|
export declare const radioLookup: (layer: string, state: PressableState, userProps: RadioProps) => boolean;
|
|
12
|
-
export declare const Radio: import(
|
|
13
|
-
|
|
14
|
-
import('./Radio.types').RadioSlotProps,
|
|
15
|
-
import('./Radio.types').RadioTokens,
|
|
16
|
-
import('@fluentui-react-native/framework').ObjectBase
|
|
17
|
-
>;
|
|
18
|
-
//# sourceMappingURL=Radio.ios.d.ts.map
|
|
12
|
+
export declare const Radio: import("@fluentui-react-native/framework").ComposableComponent<RadioProps, import("./Radio.types").RadioSlotProps, import("./Radio.types").RadioTokens, import("@fluentui-react-native/framework").ObjectBase>;
|
|
13
|
+
//# sourceMappingURL=Radio.ios.d.ts.map
|