@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.
- package/CHANGELOG.md +60 -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.d.ts.map +1 -1
- package/lib/Radio/useRadio.js +72 -91
- package/lib/Radio/useRadio.js.map +1 -1
- package/lib/Radio/useRadio.win32.d.ts +1 -1
- package/lib/Radio/useRadio.win32.d.ts.map +1 -1
- package/lib/Radio/useRadio.win32.js +126 -143
- package/lib/Radio/useRadio.win32.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib/legacy/RadioButton.js +82 -96
- package/lib/legacy/RadioButton.js.map +1 -1
- package/lib/legacy/RadioButton.macos.d.ts +2 -8
- package/lib/legacy/RadioButton.macos.d.ts.map +1 -1
- package/lib/legacy/RadioButton.macos.js +50 -48
- package/lib/legacy/RadioButton.macos.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib/legacy/RadioButton.win32.js +136 -151
- package/lib/legacy/RadioButton.win32.js.map +1 -1
- package/lib/legacy/RadioGroup.d.ts +2 -8
- package/lib/legacy/RadioGroup.d.ts.map +1 -1
- package/lib/legacy/RadioGroup.js +80 -108
- package/lib/legacy/RadioGroup.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib-commonjs/Radio/useRadio.js +107 -143
- package/lib-commonjs/Radio/useRadio.js.map +1 -1
- package/lib-commonjs/Radio/useRadio.win32.d.ts +1 -1
- package/lib-commonjs/Radio/useRadio.win32.d.ts.map +1 -1
- package/lib-commonjs/Radio/useRadio.win32.js +162 -196
- package/lib-commonjs/Radio/useRadio.win32.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib-commonjs/legacy/RadioButton.js +123 -162
- package/lib-commonjs/legacy/RadioButton.js.map +1 -1
- package/lib-commonjs/legacy/RadioButton.macos.d.ts +2 -8
- package/lib-commonjs/legacy/RadioButton.macos.d.ts.map +1 -1
- package/lib-commonjs/legacy/RadioButton.macos.js +90 -107
- package/lib-commonjs/legacy/RadioButton.macos.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib-commonjs/legacy/RadioButton.win32.js +177 -217
- package/lib-commonjs/legacy/RadioButton.win32.js.map +1 -1
- package/lib-commonjs/legacy/RadioGroup.d.ts +2 -8
- package/lib-commonjs/legacy/RadioGroup.d.ts.map +1 -1
- package/lib-commonjs/legacy/RadioGroup.js +121 -168
- package/lib-commonjs/legacy/RadioGroup.js.map +1 -1
- 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 +35 -34
- 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/Radio/useRadio.ts +13 -11
- package/src/Radio/useRadio.win32.ts +45 -26
- package/src/RadioGroup/RadioGroupTokens.mobile.ts +1 -1
- package/src/RadioGroup/RadioGroupTokens.ts +1 -1
- package/src/legacy/RadioButton.macos.tsx +10 -8
- package/src/legacy/RadioButton.tsx +13 -11
- package/src/legacy/RadioButton.win32.tsx +46 -30
- package/src/legacy/RadioGroup.tsx +4 -8
- package/eslint.config.js +0 -3
|
@@ -1,66 +1,49 @@
|
|
|
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,
|
|
53
|
-
const jsx_runtime_1 = require(
|
|
54
|
-
const react_1 = require(
|
|
55
|
-
const renderer = __importStar(require(
|
|
56
|
-
const RadioButton_1 = require(
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
|
+
const react_1 = require("react");
|
|
38
|
+
const renderer = __importStar(require("react-test-renderer"));
|
|
39
|
+
const RadioButton_1 = require("../RadioButton");
|
|
57
40
|
describe('RadioButton component tests', () => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
41
|
+
it('RadioButton default', () => {
|
|
42
|
+
let component;
|
|
43
|
+
(0, react_1.act)(() => {
|
|
44
|
+
component = renderer.create(jsx_runtime_1.jsx(RadioButton_1.RadioButton, { buttonKey: "key1", content: "Default Button" }));
|
|
45
|
+
});
|
|
46
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
62
47
|
});
|
|
63
|
-
expect(component.toJSON()).toMatchSnapshot();
|
|
64
|
-
});
|
|
65
48
|
});
|
|
66
|
-
//# sourceMappingURL=RadioButton.test.js.map
|
|
49
|
+
//# 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,104 +1,61 @@
|
|
|
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,
|
|
53
|
-
const jsx_runtime_1 = require(
|
|
54
|
-
const react_1 = require(
|
|
55
|
-
const react_native_1 = require(
|
|
56
|
-
const renderer = __importStar(require(
|
|
57
|
-
const __1 = require(
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
|
+
const react_1 = require("react");
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const renderer = __importStar(require("react-test-renderer"));
|
|
40
|
+
const __1 = require("../..");
|
|
58
41
|
describe('RadioButton component tests', () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
jsx_runtime_1.jsx(__1.RadioButton, { buttonKey: 'key1', content: 'RadioButton1' }),
|
|
68
|
-
jsx_runtime_1.jsx(__1.RadioButton, { buttonKey: 'key2', content: 'RadioButton2' }),
|
|
69
|
-
],
|
|
70
|
-
}),
|
|
71
|
-
);
|
|
42
|
+
it('RadioButton default', () => {
|
|
43
|
+
let component;
|
|
44
|
+
(0, react_1.act)(() => {
|
|
45
|
+
component = renderer.create(jsx_runtime_1.jsxs(__1.RadioGroup, { label: "Uncontrolled RadioGroup", defaultSelectedKey: "key2", children: [
|
|
46
|
+
jsx_runtime_1.jsx(__1.RadioButton, { buttonKey: "key1", content: "RadioButton1" }), jsx_runtime_1.jsx(__1.RadioButton, { buttonKey: "key2", content: "RadioButton2" })
|
|
47
|
+
] }));
|
|
48
|
+
});
|
|
49
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
72
50
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
defaultSelectedKey: 'key2',
|
|
82
|
-
children: jsx_runtime_1.jsxs(react_native_1.View, {
|
|
83
|
-
children: [
|
|
84
|
-
jsx_runtime_1.jsx(__1.RadioButton, {
|
|
85
|
-
buttonKey: 'key1',
|
|
86
|
-
content: 'RadioButton1',
|
|
87
|
-
accessibilityPosInSet: 1,
|
|
88
|
-
accessibilitySetSize: 2,
|
|
89
|
-
}),
|
|
90
|
-
jsx_runtime_1.jsx(__1.RadioButton, {
|
|
91
|
-
buttonKey: 'key2',
|
|
92
|
-
content: 'RadioButton2',
|
|
93
|
-
accessibilityPosInSet: 2,
|
|
94
|
-
accessibilitySetSize: 2,
|
|
95
|
-
}),
|
|
96
|
-
],
|
|
97
|
-
}),
|
|
98
|
-
}),
|
|
99
|
-
);
|
|
51
|
+
it('RadioButton not direct child of radio group', () => {
|
|
52
|
+
let component;
|
|
53
|
+
(0, react_1.act)(() => {
|
|
54
|
+
component = renderer.create(jsx_runtime_1.jsx(__1.RadioGroup, { label: "Uncontrolled RadioGroup", defaultSelectedKey: "key2", children: jsx_runtime_1.jsxs(react_native_1.View, { children: [
|
|
55
|
+
jsx_runtime_1.jsx(__1.RadioButton, { buttonKey: "key1", content: "RadioButton1", accessibilityPosInSet: 1, accessibilitySetSize: 2 }), jsx_runtime_1.jsx(__1.RadioButton, { buttonKey: "key2", content: "RadioButton2", accessibilityPosInSet: 2, accessibilitySetSize: 2 })
|
|
56
|
+
] }) }));
|
|
57
|
+
});
|
|
58
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
100
59
|
});
|
|
101
|
-
expect(component.toJSON()).toMatchSnapshot();
|
|
102
|
-
});
|
|
103
60
|
});
|
|
104
|
-
//# sourceMappingURL=RadioButtonGroup.test.js.map
|
|
61
|
+
//# sourceMappingURL=RadioButtonGroup.test.js.map
|
package/package.json
CHANGED
|
@@ -1,80 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/radio-group",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.3",
|
|
4
4
|
"description": "A cross-platform Radio Group component using the Fluent Design System",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "",
|
|
5
7
|
"repository": {
|
|
6
8
|
"type": "git",
|
|
7
9
|
"url": "https://github.com/microsoft/fluentui-react-native.git",
|
|
8
10
|
"directory": "packages/components/RadioGroup"
|
|
9
11
|
},
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"author": "",
|
|
12
12
|
"sideEffects": false,
|
|
13
|
+
"main": "lib-commonjs/index.js",
|
|
14
|
+
"module": "lib/index.js",
|
|
15
|
+
"types": "lib/index.d.ts",
|
|
13
16
|
"exports": {
|
|
14
17
|
".": {
|
|
15
18
|
"types": "./lib/index.d.ts",
|
|
16
19
|
"import": "./lib/index.js",
|
|
17
|
-
"require": "./lib-commonjs/index.js"
|
|
20
|
+
"require": "./lib-commonjs/index.js",
|
|
21
|
+
"default": "./src/index.ts"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
20
|
-
"main": "lib-commonjs/index.js",
|
|
21
|
-
"module": "lib/index.js",
|
|
22
|
-
"types": "lib/index.d.ts",
|
|
23
24
|
"scripts": {
|
|
24
25
|
"build": "fluentui-scripts build",
|
|
25
26
|
"build-cjs": "tsgo --outDir lib-commonjs",
|
|
26
|
-
"build-
|
|
27
|
+
"build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
|
|
27
28
|
"clean": "fluentui-scripts clean",
|
|
28
29
|
"depcheck": "fluentui-scripts depcheck",
|
|
29
|
-
"
|
|
30
|
+
"format": "fluentui-scripts format",
|
|
31
|
+
"lint": "fluentui-scripts lint",
|
|
30
32
|
"lint-package": "fluentui-scripts lint-package",
|
|
31
|
-
"prettier": "fluentui-scripts prettier",
|
|
32
33
|
"test": "fluentui-scripts jest",
|
|
33
34
|
"update-snapshots": "fluentui-scripts jest -u"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@fluentui-react-native/adapters": "0.14.
|
|
37
|
-
"@fluentui-react-native/focus-zone": "0.22.
|
|
38
|
-
"@fluentui-react-native/framework": "0.15.
|
|
39
|
-
"@fluentui-react-native/interactive-hooks": "0.28.
|
|
40
|
-
"@fluentui-react-native/pressable": "0.13.
|
|
41
|
-
"@fluentui-react-native/text": "0.25.
|
|
42
|
-
"@fluentui-react-native/theme-tokens": "0.28.
|
|
43
|
-
"@fluentui-react-native/tokens": "0.24.
|
|
44
|
-
"@fluentui-react-native/use-styling": "0.14.
|
|
45
|
-
"@uifabricshared/foundation-composable": "0.14.
|
|
46
|
-
"@uifabricshared/foundation-compose": "1.16.
|
|
47
|
-
"@uifabricshared/foundation-settings": "0.16.
|
|
37
|
+
"@fluentui-react-native/adapters": "0.14.3",
|
|
38
|
+
"@fluentui-react-native/focus-zone": "0.22.3",
|
|
39
|
+
"@fluentui-react-native/framework": "0.15.3",
|
|
40
|
+
"@fluentui-react-native/interactive-hooks": "0.28.3",
|
|
41
|
+
"@fluentui-react-native/pressable": "0.13.3",
|
|
42
|
+
"@fluentui-react-native/text": "0.25.3",
|
|
43
|
+
"@fluentui-react-native/theme-tokens": "0.28.3",
|
|
44
|
+
"@fluentui-react-native/tokens": "0.24.3",
|
|
45
|
+
"@fluentui-react-native/use-styling": "0.14.3",
|
|
46
|
+
"@uifabricshared/foundation-composable": "0.14.3",
|
|
47
|
+
"@uifabricshared/foundation-compose": "1.16.3",
|
|
48
|
+
"@uifabricshared/foundation-settings": "0.16.3"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@babel/core": "^7.20.0",
|
|
51
52
|
"@fluentui-react-native/babel-config": "0.1.1",
|
|
52
|
-
"@fluentui-react-native/
|
|
53
|
-
"@fluentui-react-native/
|
|
54
|
-
"@fluentui-react-native/jest-config": "0.1.1",
|
|
53
|
+
"@fluentui-react-native/framework-base": "0.3.3",
|
|
54
|
+
"@fluentui-react-native/jest-config": "0.1.0",
|
|
55
55
|
"@fluentui-react-native/kit-config": "0.1.2",
|
|
56
|
-
"@fluentui-react-native/
|
|
57
|
-
"@fluentui-react-native/
|
|
56
|
+
"@fluentui-react-native/lint-config-rules": "0.1.3",
|
|
57
|
+
"@fluentui-react-native/scripts": "0.1.0",
|
|
58
|
+
"@fluentui-react-native/test-tools": "0.1.0",
|
|
58
59
|
"@office-iss/react-native-win32": "^0.74.0",
|
|
59
60
|
"@react-native-community/cli": "^20.0.0",
|
|
60
61
|
"@react-native-community/cli-platform-android": "^20.0.0",
|
|
61
62
|
"@react-native-community/cli-platform-ios": "^20.0.0",
|
|
62
63
|
"@react-native/babel-preset": "^0.81.0",
|
|
63
64
|
"@react-native/metro-config": "^0.81.0",
|
|
64
|
-
"@types/react": "~19.1.
|
|
65
|
+
"@types/react": "~19.1.4",
|
|
65
66
|
"@types/react-test-renderer": "^19.1.0",
|
|
66
|
-
"react": "19.1.
|
|
67
|
-
"react-native": "^0.81.
|
|
67
|
+
"react": "19.1.4",
|
|
68
|
+
"react-native": "^0.81.6",
|
|
68
69
|
"react-native-macos": "^0.81.0",
|
|
69
70
|
"react-native-svg": "^15.12.1",
|
|
70
71
|
"react-native-windows": "^0.81.0",
|
|
71
|
-
"react-test-renderer": "19.1.
|
|
72
|
+
"react-test-renderer": "19.1.4"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
75
|
"@office-iss/react-native-win32": "^0.74.0",
|
|
75
|
-
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.
|
|
76
|
-
"react": "18.2.0 || 19.0.0 || 19.1.
|
|
77
|
-
"react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.
|
|
76
|
+
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.4",
|
|
77
|
+
"react": "18.2.0 || 19.0.0 || 19.1.4",
|
|
78
|
+
"react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.6",
|
|
78
79
|
"react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
|
|
79
80
|
"react-native-svg": ">=15.0.0 <15.13.0 || >=15.4.0 <15.13.0 || ^15.11.2 || ^15.12.1",
|
|
80
81
|
"react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
|
package/src/Radio/RadioTokens.ts
CHANGED
package/src/Radio/useRadio.ts
CHANGED
|
@@ -14,13 +14,14 @@ export const useRadio = (props: RadioProps): RadioInfo => {
|
|
|
14
14
|
|
|
15
15
|
// Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
|
|
16
16
|
const radioGroupContext = useRadioGroupContext();
|
|
17
|
+
const { disabled: groupDisabled, layout, onChange, updateSelectedButtonRef, value: selectedValue, values } = radioGroupContext;
|
|
17
18
|
|
|
18
19
|
const {
|
|
19
20
|
label,
|
|
20
21
|
subtext,
|
|
21
22
|
value,
|
|
22
23
|
disabled,
|
|
23
|
-
labelPosition =
|
|
24
|
+
labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after',
|
|
24
25
|
accessibilityActions,
|
|
25
26
|
accessibilityLabel,
|
|
26
27
|
accessibilityHint,
|
|
@@ -32,25 +33,26 @@ export const useRadio = (props: RadioProps): RadioInfo => {
|
|
|
32
33
|
...rest
|
|
33
34
|
} = props;
|
|
34
35
|
|
|
35
|
-
const isDisabled =
|
|
36
|
+
const isDisabled = groupDisabled || disabled;
|
|
36
37
|
|
|
37
38
|
const buttonRef = useViewCommandFocus(componentRef);
|
|
38
39
|
|
|
39
40
|
/* We don't want to call the user's onChange multiple times on the same selection. */
|
|
40
41
|
const changeSelection = React.useCallback(() => {
|
|
41
|
-
if (value !==
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
if (value !== selectedValue) {
|
|
43
|
+
onChange && onChange(value);
|
|
44
|
+
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
44
45
|
}
|
|
45
|
-
}, [
|
|
46
|
+
}, [componentRef, onChange, selectedValue, updateSelectedButtonRef, value]);
|
|
46
47
|
|
|
47
48
|
/* We use the componentRef of the currently selected button to maintain the default tabbable
|
|
48
49
|
element in a RadioGroup. Since the componentRef isn't generated until after initial render,
|
|
49
50
|
we must update it once here. */
|
|
50
51
|
React.useEffect(() => {
|
|
51
|
-
if (value ===
|
|
52
|
-
|
|
52
|
+
if (value === selectedValue && !isDisabled) {
|
|
53
|
+
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
53
54
|
}
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
|
|
54
56
|
}, []);
|
|
55
57
|
|
|
56
58
|
// Ensure focus is placed on button after click
|
|
@@ -82,7 +84,7 @@ export const useRadio = (props: RadioProps): RadioInfo => {
|
|
|
82
84
|
|
|
83
85
|
const state = {
|
|
84
86
|
...pressable.state,
|
|
85
|
-
selected:
|
|
87
|
+
selected: selectedValue === props.value && !isDisabled,
|
|
86
88
|
disabled: isDisabled || false,
|
|
87
89
|
labelPositionBelow: labelPosition === 'below',
|
|
88
90
|
};
|
|
@@ -101,8 +103,8 @@ export const useRadio = (props: RadioProps): RadioInfo => {
|
|
|
101
103
|
accessibilityHint: accessibilityHint ?? subtext,
|
|
102
104
|
accessibilityState: getAccessibilityState(state.disabled, state.selected, accessibilityState),
|
|
103
105
|
accessibilityActions: accessibilityActionsProp,
|
|
104
|
-
accessibilityPosInSet: accessibilityPosInSet ??
|
|
105
|
-
accessibilitySetSize: accessibilitySetSize ??
|
|
106
|
+
accessibilityPosInSet: accessibilityPosInSet ?? values.findIndex((x) => x == value) + 1,
|
|
107
|
+
accessibilitySetSize: accessibilitySetSize ?? values.length,
|
|
106
108
|
focusable: !state.disabled,
|
|
107
109
|
disabled: isDisabled,
|
|
108
110
|
enableFocusRing: enableFocusRing ?? true,
|
|
@@ -23,6 +23,21 @@ export const useRadio = (props: RadioProps): RadioInfo => {
|
|
|
23
23
|
|
|
24
24
|
// Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
|
|
25
25
|
const radioGroupContext = useRadioGroupContext();
|
|
26
|
+
const {
|
|
27
|
+
addRadioEnabledValue,
|
|
28
|
+
addRadioValue,
|
|
29
|
+
disabled: groupDisabled,
|
|
30
|
+
enabledValues,
|
|
31
|
+
invoked,
|
|
32
|
+
layout,
|
|
33
|
+
onChange,
|
|
34
|
+
removeRadioEnabledValue,
|
|
35
|
+
removeRadioValue,
|
|
36
|
+
updateInvoked,
|
|
37
|
+
updateSelectedButtonRef,
|
|
38
|
+
value: selectedValue,
|
|
39
|
+
values,
|
|
40
|
+
} = radioGroupContext;
|
|
26
41
|
|
|
27
42
|
const {
|
|
28
43
|
label,
|
|
@@ -39,44 +54,47 @@ export const useRadio = (props: RadioProps): RadioInfo => {
|
|
|
39
54
|
...rest
|
|
40
55
|
} = props;
|
|
41
56
|
|
|
42
|
-
const labelPosition =
|
|
57
|
+
const labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after';
|
|
43
58
|
|
|
44
|
-
const isDisabled =
|
|
59
|
+
const isDisabled = groupDisabled || disabled;
|
|
45
60
|
|
|
46
61
|
const buttonRef = useViewCommandFocus(componentRef);
|
|
47
62
|
|
|
48
63
|
/* We don't want to call the user's onChange multiple times on the same selection. */
|
|
49
64
|
const changeSelection = React.useCallback(() => {
|
|
50
|
-
if (value !==
|
|
51
|
-
|
|
52
|
-
|
|
65
|
+
if (value !== selectedValue) {
|
|
66
|
+
onChange && onChange(value);
|
|
67
|
+
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
53
68
|
}
|
|
54
|
-
}, [
|
|
69
|
+
}, [componentRef, onChange, selectedValue, updateSelectedButtonRef, value]);
|
|
55
70
|
|
|
56
71
|
/* We use the componentRef of the currently selected button to maintain the default tabbable
|
|
57
72
|
element in a RadioGroup. Since the componentRef isn't generated until after initial render,
|
|
58
73
|
we must update it once here. */
|
|
59
74
|
React.useEffect(() => {
|
|
60
|
-
if (value ===
|
|
61
|
-
|
|
75
|
+
if (value === selectedValue && !isDisabled) {
|
|
76
|
+
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
62
77
|
}
|
|
78
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
|
|
63
79
|
}, []);
|
|
64
80
|
|
|
65
81
|
// Explicitly only run on mount and unmount
|
|
66
82
|
React.useEffect(() => {
|
|
67
|
-
|
|
83
|
+
addRadioValue(value);
|
|
68
84
|
|
|
69
85
|
return () => {
|
|
70
|
-
|
|
86
|
+
removeRadioValue(value);
|
|
71
87
|
};
|
|
88
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
|
|
72
89
|
}, []);
|
|
73
90
|
|
|
74
91
|
React.useEffect(() => {
|
|
75
92
|
if (isDisabled) {
|
|
76
|
-
|
|
93
|
+
removeRadioEnabledValue(value);
|
|
77
94
|
} else {
|
|
78
|
-
|
|
95
|
+
addRadioEnabledValue(value);
|
|
79
96
|
}
|
|
97
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- only re-run when isDisabled changes
|
|
80
98
|
}, [isDisabled]);
|
|
81
99
|
|
|
82
100
|
const isRTL = I18nManager.isRTL;
|
|
@@ -84,37 +102,38 @@ export const useRadio = (props: RadioProps): RadioInfo => {
|
|
|
84
102
|
const onInvoke = React.useCallback(
|
|
85
103
|
(e: KeyPressEvent) => {
|
|
86
104
|
if (e.nativeEvent.key in DirectionalArrowKeys) {
|
|
87
|
-
const length =
|
|
105
|
+
const length = enabledValues.length;
|
|
88
106
|
const previous =
|
|
89
107
|
e.nativeEvent.key === DirectionalArrowKeys.ArrowUp ||
|
|
90
108
|
(isRTL ? e.nativeEvent.key === DirectionalArrowKeys.ArrowRight : e.nativeEvent.key === DirectionalArrowKeys.ArrowLeft);
|
|
91
109
|
const next =
|
|
92
110
|
e.nativeEvent.key === DirectionalArrowKeys.ArrowDown ||
|
|
93
111
|
(isRTL ? e.nativeEvent.key === DirectionalArrowKeys.ArrowLeft : e.nativeEvent.key === DirectionalArrowKeys.ArrowRight);
|
|
94
|
-
const currRadioIndex =
|
|
112
|
+
const currRadioIndex = enabledValues.indexOf(selectedValue);
|
|
95
113
|
let newCurrRadioIndex;
|
|
96
114
|
if (next) {
|
|
97
115
|
newCurrRadioIndex = (currRadioIndex + 1) % length;
|
|
98
|
-
|
|
99
|
-
|
|
116
|
+
onChange && onChange(enabledValues[newCurrRadioIndex]);
|
|
117
|
+
updateInvoked && updateInvoked(true);
|
|
100
118
|
} else if (previous) {
|
|
101
119
|
newCurrRadioIndex = (currRadioIndex - 1 + length) % length;
|
|
102
|
-
|
|
103
|
-
|
|
120
|
+
onChange && onChange(enabledValues[newCurrRadioIndex]);
|
|
121
|
+
updateInvoked && updateInvoked(true);
|
|
104
122
|
}
|
|
105
123
|
}
|
|
106
124
|
},
|
|
107
|
-
[
|
|
125
|
+
[enabledValues, isRTL, onChange, selectedValue, updateInvoked],
|
|
108
126
|
);
|
|
109
127
|
|
|
110
128
|
// Sets the updated selected button ref and focus if this Radio is selected via arrow key.
|
|
111
129
|
React.useEffect(() => {
|
|
112
|
-
if (
|
|
113
|
-
|
|
130
|
+
if (invoked && value === selectedValue && !isDisabled) {
|
|
131
|
+
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
114
132
|
componentRef?.current?.focus();
|
|
115
|
-
|
|
133
|
+
updateInvoked && updateInvoked(false);
|
|
116
134
|
}
|
|
117
|
-
|
|
135
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- only re-run when invoked changes
|
|
136
|
+
}, [invoked]);
|
|
118
137
|
|
|
119
138
|
const keys = ['ArrowDown', 'ArrowRight', 'ArrowUp', 'ArrowLeft'];
|
|
120
139
|
|
|
@@ -150,7 +169,7 @@ export const useRadio = (props: RadioProps): RadioInfo => {
|
|
|
150
169
|
|
|
151
170
|
const state = {
|
|
152
171
|
...pressable.state,
|
|
153
|
-
selected:
|
|
172
|
+
selected: selectedValue === props.value && !isDisabled,
|
|
154
173
|
disabled: isDisabled || false,
|
|
155
174
|
};
|
|
156
175
|
|
|
@@ -168,8 +187,8 @@ export const useRadio = (props: RadioProps): RadioInfo => {
|
|
|
168
187
|
accessibilityHint: accessibilityHint ?? subtext,
|
|
169
188
|
accessibilityState: getAccessibilityState(state.disabled, state.selected, accessibilityState),
|
|
170
189
|
accessibilityActions: accessibilityActionsProp,
|
|
171
|
-
accessibilityPosInSet: accessibilityPosInSet ??
|
|
172
|
-
accessibilitySetSize: accessibilitySetSize ??
|
|
190
|
+
accessibilityPosInSet: accessibilityPosInSet ?? values.findIndex((x) => x == value) + 1,
|
|
191
|
+
accessibilitySetSize: accessibilitySetSize ?? values.length,
|
|
173
192
|
focusable: !state.disabled,
|
|
174
193
|
disabled: isDisabled,
|
|
175
194
|
onAccessibilityAction: onAccessibilityAction,
|