@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
|
@@ -1,182 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
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
|
-
|
|
25
|
+
return ownKeys(o);
|
|
43
26
|
};
|
|
44
27
|
return function (mod) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
Object.defineProperty(exports,
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
36
|
exports.RadioGroup = exports.RadioGroupContext = void 0;
|
|
54
|
-
const jsx_runtime_1 = require(
|
|
37
|
+
const jsx_runtime_1 = require("@fluentui-react-native/framework-base/jsx-runtime");
|
|
55
38
|
/** @jsxImportSource @fluentui-react-native/framework-base */
|
|
56
|
-
const React = __importStar(require(
|
|
57
|
-
const react_native_1 = require(
|
|
58
|
-
const focus_zone_1 = require(
|
|
59
|
-
const interactive_hooks_1 = require(
|
|
60
|
-
const text_1 = require(
|
|
61
|
-
const tokens_1 = require(
|
|
62
|
-
const foundation_compose_1 = require(
|
|
63
|
-
const foundation_settings_1 = require(
|
|
64
|
-
const RadioGroup_settings_1 = require(
|
|
65
|
-
const RadioGroup_types_1 = require(
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const react_native_1 = require("react-native");
|
|
41
|
+
const focus_zone_1 = require("@fluentui-react-native/focus-zone");
|
|
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 RadioGroup_settings_1 = require("./RadioGroup.settings");
|
|
48
|
+
const RadioGroup_types_1 = require("./RadioGroup.types");
|
|
66
49
|
exports.RadioGroupContext = React.createContext({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/* key: string */ {
|
|
71
|
-
return;
|
|
50
|
+
selectedKey: null,
|
|
51
|
+
onChange: ( /* key: string */ /* key: string */) => {
|
|
52
|
+
return;
|
|
72
53
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
/* ref: React.RefObject<any>*/ {
|
|
76
|
-
return;
|
|
54
|
+
updateSelectedButtonRef: ( /* ref: React.RefObject<any>*/ /* ref: React.RefObject<any>*/) => {
|
|
55
|
+
return;
|
|
77
56
|
},
|
|
78
|
-
|
|
57
|
+
buttonKeys: [],
|
|
79
58
|
});
|
|
80
59
|
exports.RadioGroup = (0, foundation_compose_1.compose)({
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
setSelectedButtonRef
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
removeRadioButtonKey: onRemoveRadioButtonKey,
|
|
141
|
-
addRadioButtonEnabledKey: onAddRadioButtonEnabledKey,
|
|
142
|
-
removeRadioButtonEnabledKey: onRemoveRadioButtonEnabledKey,
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
const styleProps = useStyling(userProps, (override) => state[override] || userProps[override]);
|
|
146
|
-
const slotProps = (0, foundation_settings_1.mergeSettings)(styleProps, {
|
|
147
|
-
root: { accessibilityLabel: accessibilityLabel ?? ariaLabel ?? label, accessibilityRole: 'radiogroup', ...rest },
|
|
148
|
-
label: { children: label },
|
|
149
|
-
container: { isCircularNavigation: true, defaultTabbableElement: selectedButtonRef },
|
|
150
|
-
});
|
|
151
|
-
return { slotProps, state };
|
|
152
|
-
},
|
|
153
|
-
render: (Slots, renderData, ...children) => {
|
|
154
|
-
if (renderData.state == undefined) {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
return jsx_runtime_1.jsx(
|
|
158
|
-
exports.RadioGroupContext.Provider,
|
|
159
|
-
// Passes in the selected key and a hook function to update the newly selected button and call the client's onChange callback
|
|
160
|
-
{
|
|
60
|
+
displayName: RadioGroup_types_1.radioGroupName,
|
|
61
|
+
usePrepareProps: (userProps, useStyling) => {
|
|
62
|
+
const { label, ariaLabel, accessibilityLabel, selectedKey, defaultSelectedKey, ...rest } = userProps;
|
|
63
|
+
// This hook updates the Selected Button and calls the customer's onClick function. This gets called after a button is pressed.
|
|
64
|
+
const data = (0, interactive_hooks_1.useSelectedKey)(selectedKey || defaultSelectedKey || null, userProps.onChange);
|
|
65
|
+
const [selectedButtonRef, setSelectedButtonRef] = React.useState(React.useRef(null));
|
|
66
|
+
const onSelectButtonRef = React.useCallback((ref) => {
|
|
67
|
+
setSelectedButtonRef(ref);
|
|
68
|
+
}, [setSelectedButtonRef]);
|
|
69
|
+
const [invoked, setInvoked] = React.useState(false);
|
|
70
|
+
const onInvoked = React.useCallback((check) => {
|
|
71
|
+
setInvoked(check);
|
|
72
|
+
}, [setInvoked]);
|
|
73
|
+
const [buttonKeys, setButtonKeys] = React.useState([]);
|
|
74
|
+
const onAddRadioButtonKey = React.useCallback((buttonKey) => {
|
|
75
|
+
buttonKeys.push(buttonKey);
|
|
76
|
+
setButtonKeys(buttonKeys);
|
|
77
|
+
}, [setButtonKeys]);
|
|
78
|
+
const onRemoveRadioButtonKey = React.useCallback((buttonKey) => {
|
|
79
|
+
buttonKeys.filter((item) => item !== buttonKey);
|
|
80
|
+
setButtonKeys(buttonKeys);
|
|
81
|
+
}, [setButtonKeys]);
|
|
82
|
+
const [enabledButtonKeys, setEnabledButtonKeys] = React.useState([]);
|
|
83
|
+
const onAddRadioButtonEnabledKey = React.useCallback((buttonKey) => {
|
|
84
|
+
enabledButtonKeys.push(buttonKey);
|
|
85
|
+
setEnabledButtonKeys(enabledButtonKeys);
|
|
86
|
+
}, [setEnabledButtonKeys]);
|
|
87
|
+
const onRemoveRadioButtonEnabledKey = React.useCallback((buttonKey) => {
|
|
88
|
+
enabledButtonKeys.filter((item) => item !== buttonKey);
|
|
89
|
+
setEnabledButtonKeys(enabledButtonKeys);
|
|
90
|
+
}, [setEnabledButtonKeys]);
|
|
91
|
+
const state = {
|
|
92
|
+
context: {
|
|
93
|
+
selectedKey: selectedKey ?? data.selectedKey,
|
|
94
|
+
onChange: data.onKeySelect,
|
|
95
|
+
updateSelectedButtonRef: onSelectButtonRef,
|
|
96
|
+
invoked: invoked,
|
|
97
|
+
updateInvoked: onInvoked,
|
|
98
|
+
buttonKeys: buttonKeys,
|
|
99
|
+
enabledButtonKeys: enabledButtonKeys,
|
|
100
|
+
addRadioButtonKey: onAddRadioButtonKey,
|
|
101
|
+
removeRadioButtonKey: onRemoveRadioButtonKey,
|
|
102
|
+
addRadioButtonEnabledKey: onAddRadioButtonEnabledKey,
|
|
103
|
+
removeRadioButtonEnabledKey: onRemoveRadioButtonEnabledKey,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
const styleProps = useStyling(userProps, (override) => state[override] || userProps[override]);
|
|
107
|
+
const slotProps = (0, foundation_settings_1.mergeSettings)(styleProps, {
|
|
108
|
+
root: { accessibilityLabel: accessibilityLabel ?? ariaLabel ?? label, accessibilityRole: 'radiogroup', ...rest },
|
|
109
|
+
label: { children: label },
|
|
110
|
+
container: { isCircularNavigation: true, defaultTabbableElement: selectedButtonRef },
|
|
111
|
+
});
|
|
112
|
+
return { slotProps, state };
|
|
113
|
+
},
|
|
114
|
+
render: (Slots, renderData, ...children) => {
|
|
115
|
+
if (renderData.state == undefined) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return (jsx_runtime_1.jsx(exports.RadioGroupContext.Provider
|
|
161
119
|
// Passes in the selected key and a hook function to update the newly selected button and call the client's onChange callback
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
},
|
|
120
|
+
, {
|
|
121
|
+
// Passes in the selected key and a hook function to update the newly selected button and call the client's onChange callback
|
|
122
|
+
value: renderData.state.context, children: jsx_runtime_1.jsxs(Slots.root, { children: [
|
|
123
|
+
jsx_runtime_1.jsx(Slots.label, {}), jsx_runtime_1.jsx(Slots.container, { children: children })
|
|
124
|
+
] }) }));
|
|
125
|
+
},
|
|
126
|
+
settings: RadioGroup_settings_1.settings,
|
|
127
|
+
slots: {
|
|
128
|
+
root: react_native_1.View,
|
|
129
|
+
label: text_1.Text,
|
|
130
|
+
container: focus_zone_1.FocusZone,
|
|
131
|
+
},
|
|
132
|
+
styles: {
|
|
133
|
+
root: [],
|
|
134
|
+
label: [tokens_1.foregroundColorTokens, tokens_1.textTokens],
|
|
135
|
+
container: [],
|
|
136
|
+
},
|
|
180
137
|
});
|
|
181
138
|
exports.default = exports.RadioGroup;
|
|
182
|
-
//# sourceMappingURL=RadioGroup.js.map
|
|
139
|
+
//# 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,28 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.settings = void 0;
|
|
4
|
-
const RadioGroup_types_1 = require(
|
|
4
|
+
const RadioGroup_types_1 = require("./RadioGroup.types");
|
|
5
5
|
exports.settings = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
{
|
|
7
|
+
tokens: {
|
|
8
|
+
color: 'menuItemText',
|
|
9
|
+
},
|
|
10
|
+
root: {
|
|
11
|
+
accessible: true,
|
|
12
|
+
accessibilityRole: 'radio',
|
|
13
|
+
style: {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'flex-start',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
label: {
|
|
20
|
+
style: {
|
|
21
|
+
fontSize: 16,
|
|
22
|
+
fontWeight: '600',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
9
25
|
},
|
|
10
|
-
|
|
11
|
-
accessible: true,
|
|
12
|
-
accessibilityRole: 'radio',
|
|
13
|
-
style: {
|
|
14
|
-
display: 'flex',
|
|
15
|
-
alignItems: 'flex-start',
|
|
16
|
-
flexDirection: 'column',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
label: {
|
|
20
|
-
style: {
|
|
21
|
-
fontSize: 16,
|
|
22
|
-
fontWeight: '600',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
RadioGroup_types_1.radioGroupName,
|
|
26
|
+
RadioGroup_types_1.radioGroupName,
|
|
27
27
|
];
|
|
28
|
-
//# sourceMappingURL=RadioGroup.settings.js.map
|
|
28
|
+
//# 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,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.radioGroupName = void 0;
|
|
4
4
|
exports.radioGroupName = 'RadioGroup';
|
|
5
|
-
//# sourceMappingURL=RadioGroup.types.js.map
|
|
5
|
+
//# 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
|