@fluentui-react-native/radio-group 0.22.3 → 0.22.5
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/.cache/tsconfig.tsbuildinfo +1 -0
- package/CHANGELOG.md +52 -0
- package/jest.config.cjs +1 -0
- package/lib/Radio/Radio.d.ts +1 -1
- package/lib/Radio/Radio.d.ts.map +1 -1
- package/lib/Radio/Radio.ios.d.ts +1 -1
- package/lib/Radio/Radio.ios.d.ts.map +1 -1
- package/lib/Radio/Radio.ios.js +2 -4
- package/lib/Radio/Radio.ios.js.map +1 -1
- package/lib/Radio/Radio.js +2 -4
- package/lib/Radio/Radio.js.map +1 -1
- package/lib/Radio/__tests__/RadioExperimental.test.js.map +1 -1
- package/lib/Radio/useRadio.d.ts.map +1 -1
- package/lib/Radio/useRadio.js.map +1 -1
- package/lib/Radio/useRadio.win32.d.ts.map +1 -1
- package/lib/Radio/useRadio.win32.js +6 -7
- package/lib/Radio/useRadio.win32.js.map +1 -1
- package/lib/RadioGroup/RadioGroup.d.ts +1 -1
- package/lib/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/lib/RadioGroup/RadioGroup.js +1 -2
- package/lib/RadioGroup/RadioGroup.js.map +1 -1
- package/lib/RadioGroup/__tests__/RadioGroupExperimental.test.js +6 -18
- package/lib/RadioGroup/__tests__/RadioGroupExperimental.test.js.map +1 -1
- package/lib/RadioGroup/radioGroupContext.js +6 -6
- package/lib/RadioGroup/radioGroupContext.js.map +1 -1
- package/lib/RadioGroup/useRadioGroup.d.ts.map +1 -1
- package/lib/RadioGroup/useRadioGroup.js.map +1 -1
- package/lib/RadioGroup/useRadioGroupContextValue.d.ts +2 -1
- package/lib/RadioGroup/useRadioGroupContextValue.d.ts.map +1 -1
- package/lib/RadioGroup/useRadioGroupContextValue.js.map +1 -1
- package/lib/legacy/MacOSRadioButtonNativeComponent.d.ts.map +1 -1
- package/lib/legacy/RadioButton.d.ts.map +1 -1
- package/lib/legacy/RadioButton.js +1 -2
- package/lib/legacy/RadioButton.js.map +1 -1
- package/lib/legacy/RadioButton.macos.d.ts.map +1 -1
- package/lib/legacy/RadioButton.macos.js.map +1 -1
- package/lib/legacy/RadioButton.win32.d.ts.map +1 -1
- package/lib/legacy/RadioButton.win32.js +7 -9
- package/lib/legacy/RadioButton.win32.js.map +1 -1
- package/lib/legacy/RadioGroup.d.ts.map +1 -1
- package/lib/legacy/RadioGroup.js +3 -5
- package/lib/legacy/RadioGroup.js.map +1 -1
- package/lib/legacy/__tests__/RadioButton.test.js.map +1 -1
- package/lib/legacy/__tests__/RadioButtonGroup.test.js +2 -6
- package/lib/legacy/__tests__/RadioButtonGroup.test.js.map +1 -1
- package/package.json +25 -30
- package/src/Radio/useRadio.win32.ts +7 -6
- package/src/legacy/RadioButton.win32.tsx +7 -6
- package/tsconfig.json +53 -3
- package/babel.config.js +0 -1
- package/jest.config.js +0 -2
- package/lib-commonjs/Radio/Radio.d.ts +0 -13
- package/lib-commonjs/Radio/Radio.d.ts.map +0 -1
- package/lib-commonjs/Radio/Radio.ios.d.ts +0 -13
- package/lib-commonjs/Radio/Radio.ios.d.ts.map +0 -1
- package/lib-commonjs/Radio/Radio.ios.js +0 -55
- package/lib-commonjs/Radio/Radio.ios.js.map +0 -1
- package/lib-commonjs/Radio/Radio.js +0 -54
- package/lib-commonjs/Radio/Radio.js.map +0 -1
- package/lib-commonjs/Radio/Radio.styling.d.ts +0 -5
- package/lib-commonjs/Radio/Radio.styling.d.ts.map +0 -1
- package/lib-commonjs/Radio/Radio.styling.js +0 -98
- package/lib-commonjs/Radio/Radio.styling.js.map +0 -1
- package/lib-commonjs/Radio/Radio.types.d.ts +0 -186
- package/lib-commonjs/Radio/Radio.types.d.ts.map +0 -1
- package/lib-commonjs/Radio/Radio.types.js +0 -5
- package/lib-commonjs/Radio/Radio.types.js.map +0 -1
- package/lib-commonjs/Radio/RadioTokens.android.d.ts +0 -5
- package/lib-commonjs/Radio/RadioTokens.android.d.ts.map +0 -1
- package/lib-commonjs/Radio/RadioTokens.android.js +0 -53
- package/lib-commonjs/Radio/RadioTokens.android.js.map +0 -1
- package/lib-commonjs/Radio/RadioTokens.d.ts +0 -5
- package/lib-commonjs/Radio/RadioTokens.d.ts.map +0 -1
- package/lib-commonjs/Radio/RadioTokens.ios.d.ts +0 -5
- package/lib-commonjs/Radio/RadioTokens.ios.d.ts.map +0 -1
- package/lib-commonjs/Radio/RadioTokens.ios.js +0 -51
- package/lib-commonjs/Radio/RadioTokens.ios.js.map +0 -1
- package/lib-commonjs/Radio/RadioTokens.js +0 -88
- package/lib-commonjs/Radio/RadioTokens.js.map +0 -1
- package/lib-commonjs/Radio/RadioTokens.win32.d.ts +0 -5
- package/lib-commonjs/Radio/RadioTokens.win32.d.ts.map +0 -1
- package/lib-commonjs/Radio/RadioTokens.win32.js +0 -102
- package/lib-commonjs/Radio/RadioTokens.win32.js.map +0 -1
- package/lib-commonjs/Radio/__tests__/RadioExperimental.test.d.ts +0 -2
- package/lib-commonjs/Radio/__tests__/RadioExperimental.test.d.ts.map +0 -1
- package/lib-commonjs/Radio/__tests__/RadioExperimental.test.js +0 -56
- package/lib-commonjs/Radio/__tests__/RadioExperimental.test.js.map +0 -1
- package/lib-commonjs/Radio/useRadio.d.ts +0 -3
- package/lib-commonjs/Radio/useRadio.d.ts.map +0 -1
- package/lib-commonjs/Radio/useRadio.js +0 -121
- package/lib-commonjs/Radio/useRadio.js.map +0 -1
- package/lib-commonjs/Radio/useRadio.win32.d.ts +0 -3
- package/lib-commonjs/Radio/useRadio.win32.d.ts.map +0 -1
- package/lib-commonjs/Radio/useRadio.win32.js +0 -180
- package/lib-commonjs/Radio/useRadio.win32.js.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroup.d.ts +0 -12
- package/lib-commonjs/RadioGroup/RadioGroup.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroup.js +0 -59
- package/lib-commonjs/RadioGroup/RadioGroup.js.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroup.styling.d.ts +0 -5
- package/lib-commonjs/RadioGroup/RadioGroup.styling.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroup.styling.js +0 -52
- package/lib-commonjs/RadioGroup/RadioGroup.styling.js.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroup.types.d.ts +0 -134
- package/lib-commonjs/RadioGroup/RadioGroup.types.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroup.types.js +0 -5
- package/lib-commonjs/RadioGroup/RadioGroup.types.js.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.android.d.ts +0 -3
- package/lib-commonjs/RadioGroup/RadioGroupTokens.android.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.android.js +0 -6
- package/lib-commonjs/RadioGroup/RadioGroupTokens.android.js.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.d.ts +0 -5
- package/lib-commonjs/RadioGroup/RadioGroupTokens.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.ios.d.ts +0 -2
- package/lib-commonjs/RadioGroup/RadioGroupTokens.ios.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.ios.js +0 -6
- package/lib-commonjs/RadioGroup/RadioGroupTokens.ios.js.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.js +0 -19
- package/lib-commonjs/RadioGroup/RadioGroupTokens.js.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.d.ts +0 -5
- package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.js +0 -20
- package/lib-commonjs/RadioGroup/RadioGroupTokens.mobile.js.map +0 -1
- package/lib-commonjs/RadioGroup/__tests__/RadioGroupExperimental.test.d.ts +0 -2
- package/lib-commonjs/RadioGroup/__tests__/RadioGroupExperimental.test.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/__tests__/RadioGroupExperimental.test.js +0 -104
- package/lib-commonjs/RadioGroup/__tests__/RadioGroupExperimental.test.js.map +0 -1
- package/lib-commonjs/RadioGroup/radioGroupContext.d.ts +0 -10
- package/lib-commonjs/RadioGroup/radioGroupContext.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/radioGroupContext.js +0 -59
- package/lib-commonjs/RadioGroup/radioGroupContext.js.map +0 -1
- package/lib-commonjs/RadioGroup/useRadioGroup.d.ts +0 -3
- package/lib-commonjs/RadioGroup/useRadioGroup.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/useRadioGroup.js +0 -108
- package/lib-commonjs/RadioGroup/useRadioGroup.js.map +0 -1
- package/lib-commonjs/RadioGroup/useRadioGroupContextValue.d.ts +0 -3
- package/lib-commonjs/RadioGroup/useRadioGroupContextValue.d.ts.map +0 -1
- package/lib-commonjs/RadioGroup/useRadioGroupContextValue.js +0 -8
- package/lib-commonjs/RadioGroup/useRadioGroupContextValue.js.map +0 -1
- package/lib-commonjs/index.d.ts +0 -18
- package/lib-commonjs/index.d.ts.map +0 -1
- package/lib-commonjs/index.js +0 -32
- package/lib-commonjs/index.js.map +0 -1
- package/lib-commonjs/legacy/MacOSRadioButtonNativeComponent.d.ts +0 -17
- package/lib-commonjs/legacy/MacOSRadioButtonNativeComponent.d.ts.map +0 -1
- package/lib-commonjs/legacy/MacOSRadioButtonNativeComponent.js +0 -13
- package/lib-commonjs/legacy/MacOSRadioButtonNativeComponent.js.map +0 -1
- package/lib-commonjs/legacy/RadioButton.d.ts +0 -4
- package/lib-commonjs/legacy/RadioButton.d.ts.map +0 -1
- package/lib-commonjs/legacy/RadioButton.js +0 -135
- package/lib-commonjs/legacy/RadioButton.js.map +0 -1
- package/lib-commonjs/legacy/RadioButton.macos.d.ts +0 -4
- package/lib-commonjs/legacy/RadioButton.macos.d.ts.map +0 -1
- package/lib-commonjs/legacy/RadioButton.macos.js +0 -106
- package/lib-commonjs/legacy/RadioButton.macos.js.map +0 -1
- package/lib-commonjs/legacy/RadioButton.settings.d.ts +0 -5
- package/lib-commonjs/legacy/RadioButton.settings.d.ts.map +0 -1
- package/lib-commonjs/legacy/RadioButton.settings.js +0 -98
- package/lib-commonjs/legacy/RadioButton.settings.js.map +0 -1
- package/lib-commonjs/legacy/RadioButton.types.d.ts +0 -62
- package/lib-commonjs/legacy/RadioButton.types.d.ts.map +0 -1
- package/lib-commonjs/legacy/RadioButton.types.js +0 -5
- package/lib-commonjs/legacy/RadioButton.types.js.map +0 -1
- package/lib-commonjs/legacy/RadioButton.win32.d.ts +0 -4
- package/lib-commonjs/legacy/RadioButton.win32.d.ts.map +0 -1
- package/lib-commonjs/legacy/RadioButton.win32.js +0 -192
- package/lib-commonjs/legacy/RadioButton.win32.js.map +0 -1
- package/lib-commonjs/legacy/RadioGroup.d.ts +0 -7
- package/lib-commonjs/legacy/RadioGroup.d.ts.map +0 -1
- package/lib-commonjs/legacy/RadioGroup.js +0 -135
- package/lib-commonjs/legacy/RadioGroup.js.map +0 -1
- package/lib-commonjs/legacy/RadioGroup.settings.d.ts +0 -4
- package/lib-commonjs/legacy/RadioGroup.settings.d.ts.map +0 -1
- package/lib-commonjs/legacy/RadioGroup.settings.js +0 -28
- package/lib-commonjs/legacy/RadioGroup.settings.js.map +0 -1
- package/lib-commonjs/legacy/RadioGroup.types.d.ts +0 -96
- package/lib-commonjs/legacy/RadioGroup.types.d.ts.map +0 -1
- package/lib-commonjs/legacy/RadioGroup.types.js +0 -5
- package/lib-commonjs/legacy/RadioGroup.types.js.map +0 -1
- package/lib-commonjs/legacy/__tests__/RadioButton.test.d.ts +0 -2
- package/lib-commonjs/legacy/__tests__/RadioButton.test.d.ts.map +0 -1
- package/lib-commonjs/legacy/__tests__/RadioButton.test.js +0 -49
- package/lib-commonjs/legacy/__tests__/RadioButton.test.js.map +0 -1
- package/lib-commonjs/legacy/__tests__/RadioButtonGroup.test.d.ts +0 -2
- package/lib-commonjs/legacy/__tests__/RadioButtonGroup.test.d.ts.map +0 -1
- package/lib-commonjs/legacy/__tests__/RadioButtonGroup.test.js +0 -61
- package/lib-commonjs/legacy/__tests__/RadioButtonGroup.test.js.map +0 -1
|
@@ -1,121 +0,0 @@
|
|
|
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;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
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;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.useRadio = void 0;
|
|
37
|
-
const React = __importStar(require("react"));
|
|
38
|
-
const framework_1 = require("@fluentui-react-native/framework");
|
|
39
|
-
const interactive_hooks_1 = require("@fluentui-react-native/interactive-hooks");
|
|
40
|
-
const radioGroupContext_1 = require("../RadioGroup/radioGroupContext");
|
|
41
|
-
const defaultAccessibilityActions = [{ name: 'Select' }];
|
|
42
|
-
const useRadio = (props) => {
|
|
43
|
-
const defaultComponentRef = React.useRef(null);
|
|
44
|
-
// Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
|
|
45
|
-
const radioGroupContext = (0, radioGroupContext_1.useRadioGroupContext)();
|
|
46
|
-
const { disabled: groupDisabled, layout, onChange, updateSelectedButtonRef, value: selectedValue, values } = radioGroupContext;
|
|
47
|
-
const { label, subtext, value, disabled, labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after', accessibilityActions, accessibilityLabel, accessibilityHint, accessibilityState, componentRef = defaultComponentRef, accessibilityPosInSet, accessibilitySetSize, enableFocusRing, ...rest } = props;
|
|
48
|
-
const isDisabled = groupDisabled || disabled;
|
|
49
|
-
const buttonRef = (0, interactive_hooks_1.useViewCommandFocus)(componentRef);
|
|
50
|
-
/* We don't want to call the user's onChange multiple times on the same selection. */
|
|
51
|
-
const changeSelection = React.useCallback(() => {
|
|
52
|
-
if (value !== selectedValue) {
|
|
53
|
-
onChange && onChange(value);
|
|
54
|
-
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
55
|
-
}
|
|
56
|
-
}, [componentRef, onChange, selectedValue, updateSelectedButtonRef, value]);
|
|
57
|
-
/* We use the componentRef of the currently selected button to maintain the default tabbable
|
|
58
|
-
element in a RadioGroup. Since the componentRef isn't generated until after initial render,
|
|
59
|
-
we must update it once here. */
|
|
60
|
-
React.useEffect(() => {
|
|
61
|
-
if (value === selectedValue && !isDisabled) {
|
|
62
|
-
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
63
|
-
}
|
|
64
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
|
|
65
|
-
}, []);
|
|
66
|
-
// Ensure focus is placed on button after click
|
|
67
|
-
const changeSelectionWithFocus = (0, interactive_hooks_1.useOnPressWithFocus)(componentRef, changeSelection);
|
|
68
|
-
/* RadioButton changes selection when focus is moved between each RadioButton and on a click */
|
|
69
|
-
const pressable = (0, interactive_hooks_1.usePressableState)({
|
|
70
|
-
...rest,
|
|
71
|
-
onPress: changeSelectionWithFocus,
|
|
72
|
-
onFocus: changeSelection,
|
|
73
|
-
});
|
|
74
|
-
const accessibilityActionsProp = React.useMemo(() => (accessibilityActions ? [...defaultAccessibilityActions, ...accessibilityActions] : defaultAccessibilityActions), [accessibilityActions]);
|
|
75
|
-
// Used when creating accessibility properties in mergeSettings below
|
|
76
|
-
const onAccessibilityAction = React.useCallback((event) => {
|
|
77
|
-
switch (event.nativeEvent.actionName) {
|
|
78
|
-
case 'Select':
|
|
79
|
-
changeSelection();
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
}, [changeSelection]);
|
|
83
|
-
const state = {
|
|
84
|
-
...pressable.state,
|
|
85
|
-
selected: selectedValue === props.value && !isDisabled,
|
|
86
|
-
disabled: isDisabled || false,
|
|
87
|
-
labelPositionBelow: labelPosition === 'below',
|
|
88
|
-
};
|
|
89
|
-
return {
|
|
90
|
-
props: {
|
|
91
|
-
value,
|
|
92
|
-
label,
|
|
93
|
-
subtext,
|
|
94
|
-
labelPosition,
|
|
95
|
-
...rest,
|
|
96
|
-
ref: buttonRef,
|
|
97
|
-
...pressable.props,
|
|
98
|
-
accessibilityRole: 'radio',
|
|
99
|
-
accessibilityLabel: accessibilityLabel ?? label,
|
|
100
|
-
accessibilityHint: accessibilityHint ?? subtext,
|
|
101
|
-
accessibilityState: getAccessibilityState(state.disabled, state.selected, accessibilityState),
|
|
102
|
-
accessibilityActions: accessibilityActionsProp,
|
|
103
|
-
accessibilityPosInSet: accessibilityPosInSet ?? values.findIndex((x) => x == value) + 1,
|
|
104
|
-
accessibilitySetSize: accessibilitySetSize ?? values.length,
|
|
105
|
-
focusable: !state.disabled,
|
|
106
|
-
disabled: isDisabled,
|
|
107
|
-
enableFocusRing: enableFocusRing ?? true,
|
|
108
|
-
onAccessibilityAction: onAccessibilityAction,
|
|
109
|
-
},
|
|
110
|
-
state: state,
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
exports.useRadio = useRadio;
|
|
114
|
-
const getAccessibilityState = (0, framework_1.memoize)(getAccessibilityStateWorker);
|
|
115
|
-
function getAccessibilityStateWorker(disabled, selected, accessibilityState) {
|
|
116
|
-
if (accessibilityState) {
|
|
117
|
-
return { disabled, selected, ...accessibilityState };
|
|
118
|
-
}
|
|
119
|
-
return { disabled, selected };
|
|
120
|
-
}
|
|
121
|
-
//# sourceMappingURL=useRadio.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRadio.js","sourceRoot":"","sources":["../../src/Radio/useRadio.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,KAAK,kCAAc;AAG/B,gEAA2D;AAC3D,gFAAuH;AAGvH,uEAAuE;AAEvE,MAAM,2BAA2B,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AAElD,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAAa,EAAE,CAAC;IACxD,MAAM,mBAAmB,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/C,2GAA2G;IAC3G,MAAM,iBAAiB,GAAG,IAAA,wCAAoB,GAAE,CAAC;IACjD,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,uBAAuB,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC;IAE/H,MAAM,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ACvF,oBAAoB,EAAE,oBAAoB,IAAI,MAAM,CAAC,MAAM;YAC3D,SAAS,EAAE,CAAC,KAAK,CAAC,QAAQ;YAC1B,QAAQ,EAAE,UAAU;YACpB,eAAe,EAAE,eAAe,IAAI,IAAI;YACxC,qBAAqB,EAAE,qBAAqB;SAC7C;QACD,KAAK,EAAE,KAAK;KACb,CAAC;AAAA,CACH,CAAC;AAvGW,QAAA,QAAQ,GAAR,QAAQ,CAuGnB;AAEF,MAAM,qBAAqB,GAAG,IAAA,mBAAO,EAAC,2BAA2B,CAAC,CAAC;AACnE,SAAS,2BAA2B,CAAC,QAAiB,EAAE,QAAiB,EAAE,kBAAuC,EAAE;IAClH,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACvD,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAAA,CAC/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRadio.win32.d.ts","sourceRoot":"","sources":["../../src/Radio/useRadio.win32.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAY3D,eAAO,MAAM,QAAQ,kCAkLpB,CAAC"}
|
|
@@ -1,180 +0,0 @@
|
|
|
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;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
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;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.useRadio = void 0;
|
|
37
|
-
const React = __importStar(require("react"));
|
|
38
|
-
const react_native_1 = require("react-native");
|
|
39
|
-
const framework_1 = require("@fluentui-react-native/framework");
|
|
40
|
-
const interactive_hooks_1 = require("@fluentui-react-native/interactive-hooks");
|
|
41
|
-
const radioGroupContext_1 = require("../RadioGroup/radioGroupContext");
|
|
42
|
-
const defaultAccessibilityActions = [{ name: 'Select' }];
|
|
43
|
-
var DirectionalArrowKeys;
|
|
44
|
-
(function (DirectionalArrowKeys) {
|
|
45
|
-
DirectionalArrowKeys["ArrowUp"] = "ArrowUp";
|
|
46
|
-
DirectionalArrowKeys["ArrowDown"] = "ArrowDown";
|
|
47
|
-
DirectionalArrowKeys["ArrowRight"] = "ArrowRight";
|
|
48
|
-
DirectionalArrowKeys["ArrowLeft"] = "ArrowLeft";
|
|
49
|
-
})(DirectionalArrowKeys || (DirectionalArrowKeys = {}));
|
|
50
|
-
const useRadio = (props) => {
|
|
51
|
-
const defaultComponentRef = React.useRef(null);
|
|
52
|
-
// Grabs the context information from RadioGroup (currently selected button and client's onChange callback)
|
|
53
|
-
const radioGroupContext = (0, radioGroupContext_1.useRadioGroupContext)();
|
|
54
|
-
const { addRadioEnabledValue, addRadioValue, disabled: groupDisabled, enabledValues, invoked, layout, onChange, removeRadioEnabledValue, removeRadioValue, updateInvoked, updateSelectedButtonRef, value: selectedValue, values, } = radioGroupContext;
|
|
55
|
-
const { label, subtext, value, disabled, accessibilityActions, accessibilityLabel, accessibilityHint, accessibilityState, componentRef = defaultComponentRef, accessibilityPosInSet, accessibilitySetSize, ...rest } = props;
|
|
56
|
-
const labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after';
|
|
57
|
-
const isDisabled = groupDisabled || disabled;
|
|
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 (value !== selectedValue) {
|
|
62
|
-
onChange && onChange(value);
|
|
63
|
-
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
64
|
-
}
|
|
65
|
-
}, [componentRef, onChange, selectedValue, updateSelectedButtonRef, value]);
|
|
66
|
-
/* We use the componentRef of the currently selected button to maintain the default tabbable
|
|
67
|
-
element in a RadioGroup. Since the componentRef isn't generated until after initial render,
|
|
68
|
-
we must update it once here. */
|
|
69
|
-
React.useEffect(() => {
|
|
70
|
-
if (value === selectedValue && !isDisabled) {
|
|
71
|
-
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
72
|
-
}
|
|
73
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
|
|
74
|
-
}, []);
|
|
75
|
-
// Explicitly only run on mount and unmount
|
|
76
|
-
React.useEffect(() => {
|
|
77
|
-
addRadioValue(value);
|
|
78
|
-
return () => {
|
|
79
|
-
removeRadioValue(value);
|
|
80
|
-
};
|
|
81
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally run only on mount/unmount
|
|
82
|
-
}, []);
|
|
83
|
-
React.useEffect(() => {
|
|
84
|
-
if (isDisabled) {
|
|
85
|
-
removeRadioEnabledValue(value);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
addRadioEnabledValue(value);
|
|
89
|
-
}
|
|
90
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- only re-run when isDisabled changes
|
|
91
|
-
}, [isDisabled]);
|
|
92
|
-
const isRTL = react_native_1.I18nManager.isRTL;
|
|
93
|
-
const onInvoke = React.useCallback((e) => {
|
|
94
|
-
if (e.nativeEvent.key in DirectionalArrowKeys) {
|
|
95
|
-
const length = enabledValues.length;
|
|
96
|
-
const previous = e.nativeEvent.key === DirectionalArrowKeys.ArrowUp ||
|
|
97
|
-
(isRTL ? e.nativeEvent.key === DirectionalArrowKeys.ArrowRight : e.nativeEvent.key === DirectionalArrowKeys.ArrowLeft);
|
|
98
|
-
const next = e.nativeEvent.key === DirectionalArrowKeys.ArrowDown ||
|
|
99
|
-
(isRTL ? e.nativeEvent.key === DirectionalArrowKeys.ArrowLeft : e.nativeEvent.key === DirectionalArrowKeys.ArrowRight);
|
|
100
|
-
const currRadioIndex = enabledValues.indexOf(selectedValue);
|
|
101
|
-
let newCurrRadioIndex;
|
|
102
|
-
if (next) {
|
|
103
|
-
newCurrRadioIndex = (currRadioIndex + 1) % length;
|
|
104
|
-
onChange && onChange(enabledValues[newCurrRadioIndex]);
|
|
105
|
-
updateInvoked && updateInvoked(true);
|
|
106
|
-
}
|
|
107
|
-
else if (previous) {
|
|
108
|
-
newCurrRadioIndex = (currRadioIndex - 1 + length) % length;
|
|
109
|
-
onChange && onChange(enabledValues[newCurrRadioIndex]);
|
|
110
|
-
updateInvoked && updateInvoked(true);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}, [enabledValues, isRTL, onChange, selectedValue, updateInvoked]);
|
|
114
|
-
// Sets the updated selected button ref and focus if this Radio is selected via arrow key.
|
|
115
|
-
React.useEffect(() => {
|
|
116
|
-
if (invoked && value === selectedValue && !isDisabled) {
|
|
117
|
-
updateSelectedButtonRef && componentRef && updateSelectedButtonRef(componentRef);
|
|
118
|
-
componentRef?.current?.focus();
|
|
119
|
-
updateInvoked && updateInvoked(false);
|
|
120
|
-
}
|
|
121
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- only re-run when invoked changes
|
|
122
|
-
}, [invoked]);
|
|
123
|
-
const keys = ['ArrowDown', 'ArrowRight', 'ArrowUp', 'ArrowLeft'];
|
|
124
|
-
// Explicitly override onKeyDown to override the native behavior of moving focus with arrow keys.
|
|
125
|
-
const onKeyDownProps = (0, interactive_hooks_1.useKeyDownProps)(onInvoke, ...keys);
|
|
126
|
-
// Ensure focus is placed on button after click
|
|
127
|
-
const changeSelectionWithFocus = (0, interactive_hooks_1.useOnPressWithFocus)(componentRef, changeSelection);
|
|
128
|
-
/* Radio changes selection when focus is moved between each RadioButton and on a click */
|
|
129
|
-
const pressable = (0, interactive_hooks_1.usePressableState)({
|
|
130
|
-
...rest,
|
|
131
|
-
onPress: changeSelectionWithFocus,
|
|
132
|
-
onFocus: changeSelection,
|
|
133
|
-
});
|
|
134
|
-
const accessibilityActionsProp = React.useMemo(() => (accessibilityActions ? [...defaultAccessibilityActions, ...accessibilityActions] : defaultAccessibilityActions), [accessibilityActions]);
|
|
135
|
-
// Used when creating accessibility properties in mergeSettings below
|
|
136
|
-
const onAccessibilityAction = React.useCallback((event) => {
|
|
137
|
-
switch (event.nativeEvent.actionName) {
|
|
138
|
-
case 'Select':
|
|
139
|
-
changeSelection();
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
}, [changeSelection]);
|
|
143
|
-
const state = {
|
|
144
|
-
...pressable.state,
|
|
145
|
-
selected: selectedValue === props.value && !isDisabled,
|
|
146
|
-
disabled: isDisabled || false,
|
|
147
|
-
};
|
|
148
|
-
return {
|
|
149
|
-
props: {
|
|
150
|
-
value,
|
|
151
|
-
label,
|
|
152
|
-
subtext,
|
|
153
|
-
labelPosition,
|
|
154
|
-
...rest,
|
|
155
|
-
ref: buttonRef,
|
|
156
|
-
...pressable.props,
|
|
157
|
-
accessibilityRole: 'radio',
|
|
158
|
-
accessibilityLabel: accessibilityLabel ?? label,
|
|
159
|
-
accessibilityHint: accessibilityHint ?? subtext,
|
|
160
|
-
accessibilityState: getAccessibilityState(state.disabled, state.selected, accessibilityState),
|
|
161
|
-
accessibilityActions: accessibilityActionsProp,
|
|
162
|
-
accessibilityPosInSet: accessibilityPosInSet ?? values.findIndex((x) => x == value) + 1,
|
|
163
|
-
accessibilitySetSize: accessibilitySetSize ?? values.length,
|
|
164
|
-
focusable: !state.disabled,
|
|
165
|
-
disabled: isDisabled,
|
|
166
|
-
onAccessibilityAction: onAccessibilityAction,
|
|
167
|
-
...onKeyDownProps,
|
|
168
|
-
},
|
|
169
|
-
state: state,
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
exports.useRadio = useRadio;
|
|
173
|
-
const getAccessibilityState = (0, framework_1.memoize)(getAccessibilityStateWorker);
|
|
174
|
-
function getAccessibilityStateWorker(disabled, selected, accessibilityState) {
|
|
175
|
-
if (accessibilityState) {
|
|
176
|
-
return { disabled, selected, ...accessibilityState };
|
|
177
|
-
}
|
|
178
|
-
return { disabled, selected };
|
|
179
|
-
}
|
|
180
|
-
//# sourceMappingURL=useRadio.win32.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRadio.win32.js","sourceRoot":"","sources":["../../src/Radio/useRadio.win32.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,KAAK,kCAAc;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AE,CAAC;IACvD,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAAA,CAC/B"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { RadioGroupProps, RadioGroupState } from './RadioGroup.types';
|
|
2
|
-
/**
|
|
3
|
-
* A function which determines if a set of styles should be applied to the component given the current state and props of the radiogroup.
|
|
4
|
-
*
|
|
5
|
-
* @param layer The name of the state that is being checked for
|
|
6
|
-
* @param state The current state of the radiogroup
|
|
7
|
-
* @param userProps The props that were passed into the radiogroup
|
|
8
|
-
* @returns Whether the styles that are assigned to the layer should be applied to the radiogroup
|
|
9
|
-
*/
|
|
10
|
-
export declare const radioGroupLookup: (layer: string, state: RadioGroupState, userProps: RadioGroupProps) => boolean;
|
|
11
|
-
export declare const RadioGroup: import("@fluentui-react-native/framework").ComposableComponent<RadioGroupProps, import("./RadioGroup.types").RadioGroupSlotProps, import("./RadioGroup.types").RadioGroupTokens, import("@fluentui-react-native/framework").ObjectBase>;
|
|
12
|
-
//# sourceMappingURL=RadioGroup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAkB,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAM3F;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,gFAQ5B,CAAC;AAEF,eAAO,MAAM,UAAU,yOAqDrB,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RadioGroup = exports.radioGroupLookup = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("@fluentui-react-native/framework-base/jsx-runtime");
|
|
5
|
-
const react_native_1 = require("react-native");
|
|
6
|
-
const focus_zone_1 = require("@fluentui-react-native/focus-zone");
|
|
7
|
-
const framework_1 = require("@fluentui-react-native/framework");
|
|
8
|
-
const text_1 = require("@fluentui-react-native/text");
|
|
9
|
-
const RadioGroup_styling_1 = require("./RadioGroup.styling");
|
|
10
|
-
const RadioGroup_types_1 = require("./RadioGroup.types");
|
|
11
|
-
const radioGroupContext_1 = require("./radioGroupContext");
|
|
12
|
-
const useRadioGroup_1 = require("./useRadioGroup");
|
|
13
|
-
const useRadioGroupContextValue_1 = require("./useRadioGroupContextValue");
|
|
14
|
-
/**
|
|
15
|
-
* A function which determines if a set of styles should be applied to the component given the current state and props of the radiogroup.
|
|
16
|
-
*
|
|
17
|
-
* @param layer The name of the state that is being checked for
|
|
18
|
-
* @param state The current state of the radiogroup
|
|
19
|
-
* @param userProps The props that were passed into the radiogroup
|
|
20
|
-
* @returns Whether the styles that are assigned to the layer should be applied to the radiogroup
|
|
21
|
-
*/
|
|
22
|
-
const radioGroupLookup = (layer, state, userProps) => {
|
|
23
|
-
return (state[layer] ||
|
|
24
|
-
userProps[layer] ||
|
|
25
|
-
(!(react_native_1.Platform.OS === 'win32' || react_native_1.Platform.OS === 'android') &&
|
|
26
|
-
layer === 'isHorizontal' &&
|
|
27
|
-
(userProps['layout'] === 'horizontal' || userProps['layout'] === 'horizontal-stacked')));
|
|
28
|
-
};
|
|
29
|
-
exports.radioGroupLookup = radioGroupLookup;
|
|
30
|
-
exports.RadioGroup = (0, framework_1.compose)({
|
|
31
|
-
displayName: RadioGroup_types_1.radioGroupName,
|
|
32
|
-
...RadioGroup_styling_1.stylingSettings,
|
|
33
|
-
slots: {
|
|
34
|
-
root: react_native_1.View,
|
|
35
|
-
label: react_native_1.View,
|
|
36
|
-
labelText: text_1.TextV1,
|
|
37
|
-
required: text_1.TextV1,
|
|
38
|
-
options: react_native_1.View,
|
|
39
|
-
container: focus_zone_1.FocusZone,
|
|
40
|
-
},
|
|
41
|
-
useRender: (userProps, useSlots) => {
|
|
42
|
-
const radioGroup = (0, useRadioGroup_1.useRadioGroup)(userProps);
|
|
43
|
-
const contextValue = (0, useRadioGroupContextValue_1.useRadioGroupContextValue)(radioGroup.state);
|
|
44
|
-
const Slots = useSlots(userProps, (layer) => (0, exports.radioGroupLookup)(layer, radioGroup.state, userProps));
|
|
45
|
-
return (final, ...children) => {
|
|
46
|
-
if (!radioGroup.state) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
const { label, required, defaultTabbableElement, isCircularNavigation, ...mergedProps } = (0, framework_1.mergeProps)(radioGroup.props, final);
|
|
50
|
-
const labelComponent = (jsx_runtime_1.jsxs(Slots.label, { children: [
|
|
51
|
-
jsx_runtime_1.jsx(Slots.labelText, { children: label }, "label"), !!required && jsx_runtime_1.jsx(Slots.required, { children: '*' })] }));
|
|
52
|
-
const isFocusZoneImplemented = ['macos', 'win32'].includes(react_native_1.Platform.OS);
|
|
53
|
-
const radioGroupContent = jsx_runtime_1.jsx(Slots.options, { children: children });
|
|
54
|
-
const radioGroupContentWithFocusZone = (jsx_runtime_1.jsx(Slots.container, { disabled: radioGroup.state.selectedButtonDisabled, isCircularNavigation: true, defaultTabbableElement: defaultTabbableElement, children: radioGroupContent }));
|
|
55
|
-
return (jsx_runtime_1.jsx(radioGroupContext_1.RadioGroupProvider, { value: contextValue, children: jsx_runtime_1.jsxs(Slots.root, { ...mergedProps, children: [label && labelComponent, isFocusZoneImplemented ? radioGroupContentWithFocusZone : radioGroupContent] }) }));
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../src/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":";;;;AAEA,+CAA8C;AAE9C,kEAA8D;AAE9D,gEAAuE;AACvE,sDAA6D;AAE7D,6DAAuD;AAEvD,yDAAoD;AACpD,2DAAyD;AACzD,mDAAgD;AAChD,2EAAwE;AAExE;;;;;;;GAOG;AACI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,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,GAAG,WAAW,EAAE,GAAG,IAAA,sBAAU,EAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAE9H,MAAM,cAAc,GAAG,CACrB,mBAAC,KAAK,CAAC,KAAK;oBACV,kBAAC,KAAK,CAAC,SAAS,cAAc,KAAK,IAAd,OAAO,CAA0B,EACrD,CAAC,CAAC,QAAQ,IAAI,kBAAC,KAAK,CAAC,QAAQ,cAAE,GAAG,GAAkB,IACzC,CACf,CAAC;YAEF,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,uBAAQ,CAAC,EAAY,CAAC,CAAC;YAElF,MAAM,iBAAiB,GAAG,kBAAC,KAAK,CAAC,OAAO,cAAE,QAAQ,GAAiB,CAAC;YACpE,MAAM,8BAA8B,GAAG,CACrC,kBAAC,KAAK,CAAC,SAAS,IACd,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,sBAAsB,EACjD,oBAAoB,QACpB,sBAAsB,EAAE,sBAAsB,YAE7C,iBAAiB,GACF,CACnB,CAAC;YAEF,OAAO,CACL,kBAAC,sCAAkB,IAAC,KAAK,EAAE,YAAY,YACrC,mBAAC,KAAK,CAAC,IAAI,OAAK,WAAW,aACxB,KAAK,IAAI,cAAc,EACvB,sBAAsB,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,iBAAiB,IACjE,GACM,CACtB,CAAC;QAAA,CACH,CAAC;IAAA,CACH;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { UseStylingOptions } from '@fluentui-react-native/framework';
|
|
2
|
-
import type { RadioGroupTokens, RadioGroupSlotProps, RadioGroupProps } from './RadioGroup.types';
|
|
3
|
-
export declare const radioGroupStates: (keyof RadioGroupTokens)[];
|
|
4
|
-
export declare const stylingSettings: UseStylingOptions<RadioGroupProps, RadioGroupSlotProps, RadioGroupTokens>;
|
|
5
|
-
//# sourceMappingURL=RadioGroup.styling.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.styling.d.ts","sourceRoot":"","sources":["../../src/RadioGroup/RadioGroup.styling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAIjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIjG,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,gBAAgB,CAAC,EAAiC,CAAC;AAEzF,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,eAAe,EAAE,mBAAmB,EAAE,gBAAgB,CAmDrG,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stylingSettings = exports.radioGroupStates = void 0;
|
|
4
|
-
const framework_1 = require("@fluentui-react-native/framework");
|
|
5
|
-
const tokens_1 = require("@fluentui-react-native/tokens");
|
|
6
|
-
const RadioGroup_types_1 = require("./RadioGroup.types");
|
|
7
|
-
const RadioGroupTokens_1 = require("./RadioGroupTokens");
|
|
8
|
-
exports.radioGroupStates = ['isHorizontal', 'disabled'];
|
|
9
|
-
exports.stylingSettings = {
|
|
10
|
-
tokens: [RadioGroupTokens_1.defaultRadioGroupTokens, RadioGroup_types_1.radioGroupName],
|
|
11
|
-
states: exports.radioGroupStates,
|
|
12
|
-
slotProps: {
|
|
13
|
-
root: (0, framework_1.buildProps)(() => ({
|
|
14
|
-
style: {
|
|
15
|
-
display: 'flex',
|
|
16
|
-
alignItems: 'flex-start',
|
|
17
|
-
flexDirection: 'column',
|
|
18
|
-
},
|
|
19
|
-
})),
|
|
20
|
-
label: (0, framework_1.buildProps)(() => ({
|
|
21
|
-
style: {
|
|
22
|
-
display: 'flex',
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
flexDirection: 'row',
|
|
25
|
-
alignSelf: 'flex-start',
|
|
26
|
-
},
|
|
27
|
-
})),
|
|
28
|
-
labelText: (0, framework_1.buildProps)((tokens, theme) => ({
|
|
29
|
-
variant: tokens.variant,
|
|
30
|
-
style: {
|
|
31
|
-
color: tokens.color,
|
|
32
|
-
...tokens_1.fontStyles.from(tokens, theme),
|
|
33
|
-
},
|
|
34
|
-
}), ['color', ...tokens_1.fontStyles.keys]),
|
|
35
|
-
required: (0, framework_1.buildProps)((tokens) => ({
|
|
36
|
-
variant: tokens.variant,
|
|
37
|
-
style: {
|
|
38
|
-
color: tokens.requiredColor,
|
|
39
|
-
paddingStart: tokens.requiredPadding,
|
|
40
|
-
},
|
|
41
|
-
}), ['requiredColor', 'requiredPadding']),
|
|
42
|
-
options: (0, framework_1.buildProps)((tokens) => ({
|
|
43
|
-
style: {
|
|
44
|
-
display: 'flex',
|
|
45
|
-
justifyContent: 'space-around',
|
|
46
|
-
alignItems: 'flex-start',
|
|
47
|
-
flexDirection: tokens.flexDirection,
|
|
48
|
-
},
|
|
49
|
-
}), ['flexDirection']),
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=RadioGroup.styling.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.styling.js","sourceRoot":"","sources":["../../src/RadioGroup/RadioGroup.styling.ts"],"names":[],"mappings":";;;AACA,gEAA8D;AAC9D,0DAA2D;AAG3D,yDAAoD;AACpD,yDAA6D;AAEhD,QAAA,gBAAgB,GAA+B,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAE5E,QAAA,eAAe,GAA8E;IACxG,MAAM,EAAE,CAAC,0CAAuB,EAAE,iCAAc,CAAC;IACjD,MAAM,EAAE,QAAA,gBAAgB;IACxB,SAAS,EAAE;QACT,IAAI,EAAE,IAAA,sBAAU,EAAC,GAAG,EAAE,CAAC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from 'react-native';
|
|
2
|
-
import type { IViewProps } from '@fluentui-react-native/adapters';
|
|
3
|
-
import type { FocusZoneProps } from '@fluentui-react-native/focus-zone';
|
|
4
|
-
import type { TextProps } from '@fluentui-react-native/text';
|
|
5
|
-
import type { IForegroundColorTokens, FontTokens } from '@fluentui-react-native/tokens';
|
|
6
|
-
export declare const radioGroupName = "RadioGroup";
|
|
7
|
-
export interface RadioGroupState extends RadioGroupProps {
|
|
8
|
-
/**
|
|
9
|
-
* The currently selected RadioButton's key
|
|
10
|
-
*/
|
|
11
|
-
value: string | null;
|
|
12
|
-
/**
|
|
13
|
-
* Updates the selected button and calls the client’s onChange callback
|
|
14
|
-
*/
|
|
15
|
-
onChange?: (value: string) => void;
|
|
16
|
-
/**
|
|
17
|
-
* Updates the selected button's ref to set as the default tabbable element
|
|
18
|
-
*/
|
|
19
|
-
updateSelectedButtonRef?: (ref: React.RefObject<any>) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Updates the group container's defaultTabbableElement
|
|
22
|
-
*/
|
|
23
|
-
selectedButtonRef?: React.MutableRefObject<any>;
|
|
24
|
-
/**
|
|
25
|
-
* Populate the values array (all Radio keys) at mount and un-mount
|
|
26
|
-
*/
|
|
27
|
-
addRadioValue?: (value: string) => void;
|
|
28
|
-
removeRadioValue?: (value: string) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Array of all Radio keys in the RadioGroup
|
|
31
|
-
*/
|
|
32
|
-
values?: string[];
|
|
33
|
-
/**
|
|
34
|
-
* Populate the enabledValues array (only enabled/valid Radio keys) at mount and un-mount
|
|
35
|
-
* @platform win32
|
|
36
|
-
*/
|
|
37
|
-
addRadioEnabledValue?: (value: string) => void;
|
|
38
|
-
removeRadioEnabledValue?: (value: string) => void;
|
|
39
|
-
/**
|
|
40
|
-
* Array of enabled Radio keys in the RadioGroup
|
|
41
|
-
* @platform win32
|
|
42
|
-
*/
|
|
43
|
-
enabledValues?: string[];
|
|
44
|
-
/**
|
|
45
|
-
* Updates invoked to signal that arrow key has been pressed and focus needs to be set
|
|
46
|
-
* @platform win32
|
|
47
|
-
*/
|
|
48
|
-
updateInvoked?: (check: boolean) => void;
|
|
49
|
-
/**
|
|
50
|
-
* Signals whether arrow key has been pressed
|
|
51
|
-
* @platform win32
|
|
52
|
-
*/
|
|
53
|
-
invoked?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Signals whether the currently selected radio is disabled. If this is the case, the FocusZone state is set to 'disabled'.
|
|
56
|
-
* @platform win32
|
|
57
|
-
*/
|
|
58
|
-
selectedButtonDisabled?: boolean;
|
|
59
|
-
}
|
|
60
|
-
export interface RadioGroupTokens extends IForegroundColorTokens, FontTokens {
|
|
61
|
-
/**
|
|
62
|
-
* Color of required indicator
|
|
63
|
-
*/
|
|
64
|
-
requiredColor?: ColorValue;
|
|
65
|
-
/**
|
|
66
|
-
* Amount of padding between the end of the label and the start of the required text
|
|
67
|
-
*/
|
|
68
|
-
requiredPadding?: ViewStyle['padding'];
|
|
69
|
-
/**
|
|
70
|
-
* The flex direction of the Radios
|
|
71
|
-
*/
|
|
72
|
-
flexDirection?: ViewStyle['flexDirection'];
|
|
73
|
-
/**
|
|
74
|
-
* States that can be applied to a RadioGroup
|
|
75
|
-
*/
|
|
76
|
-
disabled?: RadioGroupTokens;
|
|
77
|
-
isHorizontal?: RadioGroupTokens;
|
|
78
|
-
}
|
|
79
|
-
export interface RadioGroupProps extends Pick<FocusZoneProps, 'isCircularNavigation' | 'defaultTabbableElement'>, IViewProps {
|
|
80
|
-
/**
|
|
81
|
-
* Descriptive label for the RadioGroup. This will be displayed as the title of the radio group to the user.
|
|
82
|
-
*/
|
|
83
|
-
label?: string;
|
|
84
|
-
/**
|
|
85
|
-
* The key of the RadioButton that will initially be selected.
|
|
86
|
-
*
|
|
87
|
-
* This is mutually-exclusive if radiogroup is disabled or radio button is disabled.
|
|
88
|
-
*/
|
|
89
|
-
defaultValue?: string;
|
|
90
|
-
/**
|
|
91
|
-
* The key of the selected option. If you provide this, you must maintain selection state by observing
|
|
92
|
-
* onChange events and passing a new value in when changed. This overrides defaultSelectedKey
|
|
93
|
-
* and makes the RadioGroup a controlled component.
|
|
94
|
-
*/
|
|
95
|
-
value?: string;
|
|
96
|
-
/**
|
|
97
|
-
* Require a selection in this group. Adds the 'required' prop to all child Radio items.
|
|
98
|
-
*/
|
|
99
|
-
required?: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Sets the RadioGroup to disabled if true
|
|
102
|
-
*/
|
|
103
|
-
disabled?: boolean;
|
|
104
|
-
/**
|
|
105
|
-
* The position of the label relative to the indicator.
|
|
106
|
-
* 'horizontal' and 'horizontal-stacked' are not supported from Fluent Android and Win32, renders as-is.
|
|
107
|
-
*
|
|
108
|
-
* @default vertical
|
|
109
|
-
*/
|
|
110
|
-
layout?: 'vertical' | 'horizontal' | 'horizontal-stacked';
|
|
111
|
-
/**
|
|
112
|
-
* Callback for receiving a notification when the choice has been changed
|
|
113
|
-
*/
|
|
114
|
-
onChange?: (key: string) => void;
|
|
115
|
-
}
|
|
116
|
-
export interface RadioGroupInfo {
|
|
117
|
-
props: RadioGroupProps;
|
|
118
|
-
state: RadioGroupState;
|
|
119
|
-
}
|
|
120
|
-
export interface RadioGroupSlotProps {
|
|
121
|
-
root: React.PropsWithRef<IViewProps>;
|
|
122
|
-
label?: IViewProps;
|
|
123
|
-
labelText?: TextProps;
|
|
124
|
-
required?: TextProps;
|
|
125
|
-
options: IViewProps;
|
|
126
|
-
container: FocusZoneProps;
|
|
127
|
-
}
|
|
128
|
-
export interface RadioGroupType {
|
|
129
|
-
props: RadioGroupProps;
|
|
130
|
-
tokens: RadioGroupTokens;
|
|
131
|
-
slotProps: RadioGroupSlotProps;
|
|
132
|
-
state: RadioGroupState;
|
|
133
|
-
}
|
|
134
|
-
//# sourceMappingURL=RadioGroup.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.types.d.ts","sourceRoot":"","sources":["../../src/RadioGroup/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,SAAS,CAAC;IACrB,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,EAAE,eAAe,CAAC;CACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.types.js","sourceRoot":"","sources":["../../src/RadioGroup/RadioGroup.types.ts"],"names":[],"mappings":";;;AAOa,QAAA,cAAc,GAAG,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroupTokens.android.d.ts","sourceRoot":"","sources":["../../src/RadioGroup/RadioGroupTokens.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|