Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ad07d31
changed transparentStroke token to background to fix HC border bug
gulnazsayed Jan 25, 2023
f41555a
matched subtext bottom margin to label top margin
gulnazsayed Jan 25, 2023
4de34ba
Merge branch 'microsoft:main' into radiogroup/fixes
gulnazsayed Jan 25, 2023
f5e8b24
updated margin between labels
gulnazsayed Jan 25, 2023
17b8775
Change files
gulnazsayed Jan 25, 2023
8a782a8
text margin adjustment
gulnazsayed Feb 1, 2023
65539e6
code cleanup
gulnazsayed Feb 1, 2023
ce3586f
code cleanup
gulnazsayed Feb 1, 2023
ee11d5a
fixed horizontal-stacked alignment and focus rect
gulnazsayed Feb 9, 2023
63943d7
code cleanup
gulnazsayed Feb 9, 2023
f939a99
replaced labelMarginTop with labelMarginVertical
gulnazsayed Feb 9, 2023
d057d49
made win32 specific tokens
gulnazsayed Feb 9, 2023
3925b55
implementing new indicator for win32
gulnazsayed Feb 15, 2023
8c7680d
Merge branch 'microsoft:main' into radiogroup/fixes
gulnazsayed Feb 21, 2023
873e37f
resolved merge conflicts:
gulnazsayed Feb 21, 2023
23fb6e3
fixed merge conflict:
gulnazsayed Feb 21, 2023
dbfa7cf
Merge branch 'microsoft:main' into radiogroup/fixes
gulnazsayed Feb 27, 2023
38c0a22
fixed pressed state bug
gulnazsayed Feb 27, 2023
a9b6b7a
Change files
gulnazsayed Feb 27, 2023
1fe68c0
Update @fluentui-react-native-tester-40bf90bc-8cef-42c0-9e71-e0f8601e…
gulnazsayed Feb 27, 2023
b138379
Merge branch 'microsoft:main' into radiogroup/fixes
gulnazsayed Feb 28, 2023
7455dba
added dependency for text margin adjustment
gulnazsayed Mar 13, 2023
721e07b
Merge branch 'main' into radiogroup/fixes
gulnazsayed Mar 13, 2023
6181858
fixed padding issue for horizontal
gulnazsayed Mar 13, 2023
a34c3fb
fixed merge conflict
gulnazsayed Mar 13, 2023
1e25a8c
Update package.json
gulnazsayed Mar 13, 2023
818bf1a
added empty line
gulnazsayed Mar 13, 2023
f1c900c
fixed imports and added labelPadding
gulnazsayed Mar 13, 2023
544ddd1
replaced spec images
gulnazsayed Mar 13, 2023
722d412
Merge branch 'microsoft:main' into radiogroup/fixes
gulnazsayed Mar 15, 2023
7c1924f
Merge branch 'microsoft:main' into radiogroup/fixes
gulnazsayed Mar 16, 2023
72aa473
fixed focus border and spacing
gulnazsayed Mar 16, 2023
470a4a1
Merge branch 'radiogroup/fixes' of https://github.com/gulnazsayed/flu…
gulnazsayed Mar 16, 2023
0c25f33
removed enableFocusRing
gulnazsayed Mar 16, 2023
950103c
updated spec
gulnazsayed Mar 16, 2023
0770e34
updated snapshots and removed enableFocusRing from useRadio
gulnazsayed Mar 16, 2023
a2dd41f
removed enableFocusRing from win32 useRadio
gulnazsayed Mar 16, 2023
2948cf1
added enableFocusRing prop from other platforms
gulnazsayed Mar 16, 2023
e0fa2ae
reverted back to transparentStroke token
gulnazsayed Mar 21, 2023
6a779d9
added tokens for radio size
gulnazsayed Mar 21, 2023
f06377a
updated snapshots
gulnazsayed Mar 21, 2023
f00c0ef
Merge branch 'microsoft:main' into radiogroup/fixes
gulnazsayed Mar 22, 2023
e20e2e9
Merge branch 'microsoft:main' into radiogroup/fixes
gulnazsayed Mar 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const CustomizedRadioGroup: React.FunctionComponent = () => {
const [marginRight, setMarginRight] = React.useState<number>(6);
const [marginBottom, setMarginBottom] = React.useState<number>(6);
const [marginLeft, setMarginLeft] = React.useState<number>(4);
const [labelMarginTop, setLabelMarginTop] = React.useState<number>(5);
const [labelMarginVertical, setLabelMarginVertical] = React.useState<number>(4);
const [labelMarginRight, setLabelMarginRight] = React.useState<number>(2);
const [labelMarginLeft, setLabelMarginLeft] = React.useState<number>(0);
const [subtextMarginTop, setSubtextMarginTop] = React.useState<number>(2);
Expand Down Expand Up @@ -71,7 +71,7 @@ export const CustomizedRadioGroup: React.FunctionComponent = () => {
marginRight,
marginBottom,
marginLeft,
labelMarginTop,
labelMarginVertical,
labelMarginRight,
labelMarginLeft,
subtextMarginTop,
Expand Down Expand Up @@ -138,7 +138,7 @@ export const CustomizedRadioGroup: React.FunctionComponent = () => {
marginRight,
marginBottom,
marginLeft,
labelMarginTop,
labelMarginVertical,
labelMarginRight,
labelMarginLeft,
subtextMarginTop,
Expand Down Expand Up @@ -315,12 +315,12 @@ export const CustomizedRadioGroup: React.FunctionComponent = () => {
}}
/>
<TextInput
accessibilityLabel="Radio label margin top"
accessibilityLabel="Radio label margin vertical"
style={commonStyles.textBox}
placeholder="marginTop"
placeholder="marginVertical"
blurOnSubmit={true}
onSubmitEditing={(e) => {
setLabelMarginTop(parseInt(e.nativeEvent.text.toString()));
setLabelMarginVertical(parseInt(e.nativeEvent.text.toString()));
}}
/>
<TextInput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "polish bug fixes",
"packageName": "@fluentui-react-native/experimental-radio-group",
"email": "gulnazsayed@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "polish bug fixes",
"packageName": "@fluentui-react-native/tester",
"email": "gulnazsayed@microsoft.com",
"dependentChangeType": "patch"
}
6 changes: 0 additions & 6 deletions packages/experimental/RadioGroup/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,6 @@ export interface RadioProps extends PressablePropsExtended {
* A RefObject to access the IFocusable interface. Use this to access the public methods and properties of the component.
*/
componentRef?: React.RefObject<IFocusable>;

/**
* Whether to use native focus visuals for the component
* @default true
*/
enableFocusRing?: boolean;
}
```

Expand Down
Binary file modified packages/experimental/RadioGroup/assets/controlled_radiogroup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/experimental/RadioGroup/assets/disabled_item.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/experimental/RadioGroup/assets/disabled_radiogroup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/experimental/RadioGroup/assets/horizontal_radiogroup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/experimental/RadioGroup/assets/required_radiogroup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/experimental/RadioGroup/assets/subtext_radiogroup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 12 additions & 8 deletions packages/experimental/RadioGroup/src/Radio/Radio.styling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ export const stylingSettings: UseStylingOptions<RadioProps, RadioSlotProps, Radi
states: radioStates,
slotProps: {
root: buildProps(
(tokens: RadioTokens, theme: Theme) => ({
(tokens: RadioTokens) => ({
style: {
display: 'flex',
alignItems: tokens.alignItems,
flexDirection: tokens.flexDirection,
paddingHorizontal: tokens.rootHorizontalPadding,
paddingVertical: tokens.rootVerticalPadding,
...borderStyles.from(tokens, theme),
},
android_ripple: { color: tokens.rippleColor },
}),
['flexDirection', 'rootHorizontalPadding', 'rootVerticalPadding', 'rippleColor', 'alignItems', ...borderStyles.keys],
['flexDirection', 'rootHorizontalPadding', 'rootVerticalPadding', 'rippleColor', 'alignItems'],
),
button: buildProps(
(tokens: RadioTokens) => ({
style: {
backgroundColor: 'transparent',
backgroundColor: tokens.radioOuterCircleBackground,
width: tokens.radioOuterCircleSize,
height: tokens.radioOuterCircleSize,
alignItems: 'center',
Expand All @@ -46,6 +45,7 @@ export const stylingSettings: UseStylingOptions<RadioProps, RadioSlotProps, Radi
android_ripple: { color: tokens.rippleColor, radius: tokens.rippleRadius, borderless: true },
}),
[
'radioOuterCircleBackground',
'radioBorderWidth',
'radioBorderStyle',
'radioOuterCircleSize',
Expand All @@ -71,34 +71,38 @@ export const stylingSettings: UseStylingOptions<RadioProps, RadioSlotProps, Radi
['radioInnerCircleSize', 'radioVisibility', 'radioFill'],
),
labelContent: buildProps(
(tokens: RadioTokens) => ({
(tokens: RadioTokens, theme: Theme) => ({
style: {
alignItems: tokens.labelAlignItems,
flexDirection: 'column',
marginRight: tokens.labelMarginRight,
marginLeft: tokens.labelMarginLeft,
padding: tokens.labelPadding,
paddingRight: 0,
...borderStyles.from(tokens, theme),
},
}),
['labelAlignItems', 'labelMarginRight', 'labelMarginLeft', 'labelPadding'],
['labelAlignItems', 'labelMarginRight', 'labelMarginLeft', 'labelPadding', ...borderStyles.keys],
),
label: buildProps(
(tokens: RadioTokens, theme: Theme) => ({
variant: tokens.variant,
style: {
marginTop: tokens.labelMarginTop,
marginVertical: tokens.labelMarginVertical,
marginHorizontal: 2,
color: tokens.color,
...fontStyles.from(tokens, theme),
},
}),
['variant', 'labelMarginTop', 'color', ...fontStyles.keys],
['variant', 'labelMarginVertical', 'color', ...fontStyles.keys],
),
subtext: buildProps(
(tokens: RadioTokens) => ({
variant: tokens.subtextVariant,
style: {
marginTop: tokens.subtextMarginTop,
marginBottom: tokens.subtextMarginBottom,
marginHorizontal: 2,
color: tokens.color,
},
}),
Expand Down
11 changes: 9 additions & 2 deletions packages/experimental/RadioGroup/src/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const Radio = compose<RadioType>({
// now return the handler for finishing render
return (final: RadioProps) => {
const { label, subtext, ...mergedProps } = mergeProps(radio.props, final);
const { onPress, disabled } = mergedProps;
const { onPress, disabled, onPressIn, onPressOut } = mergedProps;
const isMobile = Platform.OS === 'android' || Platform.OS === 'ios';

const labelComponent = (
Expand All @@ -53,7 +53,14 @@ export const Radio = compose<RadioType>({

return (
<Slots.root {...mergedProps} {...(isMobile && { accessible: !disabled, focusable: !disabled })}>
<Slots.button accessible={false} onPress={onPress} disabled={disabled} focusable={false}>
<Slots.button
accessible={false}
onPress={onPress}
onPressIn={onPressIn}
onPressOut={onPressOut}
disabled={disabled}
focusable={false}
>
<Slots.innerCircle />
</Slots.button>
{labelComponent}
Expand Down
7 changes: 6 additions & 1 deletion packages/experimental/RadioGroup/src/Radio/Radio.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export interface RadioTokens extends FontTokens, IColorTokens, IForegroundColorT
*/
radioBorderWidth?: number;

/**
* Background color of outer circle
*/
radioOuterCircleBackground?: ColorValue;

/**
* The flex direction of the root
*/
Expand Down Expand Up @@ -98,7 +103,7 @@ export interface RadioTokens extends FontTokens, IColorTokens, IForegroundColorT
/**
* Label's top margin.
*/
labelMarginTop?: ViewStyle['marginTop'];
labelMarginVertical?: ViewStyle['marginVertical'];

/**
* Label's right margin.
Expand Down
12 changes: 5 additions & 7 deletions packages/experimental/RadioGroup/src/Radio/RadioTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export const defaultRadioTokens: TokenSettings<RadioTokens, Theme> = (t: Theme)
radioBorderStyle: 'solid',
radioBorder: t.colors.neutralStrokeAccessible,
color: t.colors.neutralForeground3,
radioOuterCircleSize: 20,
radioInnerCircleSize: 10,
labelMarginTop: globalTokens.size40 + 1,
radioOuterCircleSize: globalTokens.size200,
radioInnerCircleSize: globalTokens.size100,
labelMarginVertical: globalTokens.size40,
labelMarginRight: globalTokens.size20,
labelMarginLeft: globalTokens.sizeNone,
subtextVariant: 'caption1',
subtextMarginTop: globalTokens.size20,
subtextMarginBottom: globalTokens.size20,
subtextMarginTop: globalTokens.sizeNone,
subtextMarginBottom: globalTokens.size40 + 1,
marginTop: globalTokens.size60,
marginRight: globalTokens.size60,
marginBottom: globalTokens.size60,
Expand Down Expand Up @@ -77,8 +77,6 @@ export const defaultRadioTokens: TokenSettings<RadioTokens, Theme> = (t: Theme)
},

focused: {
borderColor: t.colors.focusBorder,

selected: {
// Checked, Focused
radioVisibility: 1,
Expand Down
111 changes: 111 additions & 0 deletions packages/experimental/RadioGroup/src/Radio/RadioTokens.win32.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import type { Theme } from '@fluentui-react-native/framework';
import { globalTokens } from '@fluentui-react-native/theme-tokens';
import type { TokenSettings } from '@fluentui-react-native/use-styling';

import type { RadioTokens } from './Radio.types';

export const defaultRadioTokens: TokenSettings<RadioTokens, Theme> = (t: Theme) =>
({
rootHorizontalPadding: globalTokens.size40,
borderColor: t.colors.transparentStroke,
borderStyle: 'solid',
borderWidth: globalTokens.stroke.width20,
borderRadius: globalTokens.corner.radius40,
radioBorderWidth: globalTokens.stroke.width10,
radioVisibility: 0,
variant: 'subheaderStandard',
radioBorderStyle: 'solid',
radioBorder: t.colors.neutralStrokeAccessible,
color: t.colors.neutralForeground1,
radioOuterCircleSize: globalTokens.size160,
radioInnerCircleSize: globalTokens.size80,
radioOuterCircleBackground: t.colors.neutralBackground1,
labelMarginVertical: globalTokens.size20,
labelMarginRight: globalTokens.sizeNone,
labelMarginLeft: globalTokens.sizeNone,
subtextVariant: 'caption1',
subtextMarginTop: globalTokens.sizeNone,
subtextMarginBottom: globalTokens.size40 + 1,
marginTop: globalTokens.size60,
marginRight: globalTokens.size40,
marginBottom: globalTokens.size60,
marginLeft: globalTokens.size40,
flexDirection: 'row',
alignItems: 'flex-start',
labelAlignItems: 'flex-start',

labelPositionBelow: {
flexDirection: 'column',
alignItems: 'center',
labelAlignItems: 'center',
labelMarginRight: globalTokens.sizeNone,
labelMarginVertical: globalTokens.size20,
labelPadding: globalTokens.size20,
marginLeft: globalTokens.size60,
marginRight: globalTokens.size60,
},

disabled: {
// Unchecked, Disabled
radioOuterCircleBackground: t.colors.neutralBackgroundDisabled,
radioBorder: t.colors.neutralStrokeDisabled,
color: t.colors.neutralForegroundDisabled,
radioVisibility: 0,
},

hovered: {
// Unchecked, Hover
radioOuterCircleBackground: t.colors.neutralBackground1,
radioBorder: t.colors.neutralStrokeAccessibleHover,
color: t.colors.neutralForeground1,

selected: {
// Checked, Hover
radioOuterCircleBackground: t.colors.brandBackgroundHover,
radioBorder: t.colors.compoundBrandStroke1Hover,
radioFill: t.colors.neutralForegroundOnBrand,
color: t.colors.neutralForeground1,
radioVisibility: 1,
radioInnerCircleSize: 10,
},
},

pressed: {
// Unchecked, Pressed
radioOuterCircleBackground: t.colors.neutralBackground1,
radioBorder: t.colors.neutralStrokeAccessiblePressed,
color: t.colors.neutralForeground1,

selected: {
// Checked, Pressed
radioOuterCircleBackground: t.colors.brandBackgroundPressed,
radioBorder: t.colors.compoundBrandStroke1Pressed,
radioFill: t.colors.neutralForegroundOnBrand,
color: t.colors.neutralForeground1,
radioVisibility: 1,
radioInnerCircleSize: 6,
},
},

focused: {
borderColor: t.colors.strokeFocus2,
selected: {
// Checked, Focused
radioVisibility: 1,
},
},

selected: {
// Checked, Rest
radioOuterCircleBackground: t.colors.brandBackground,
radioBorder: t.colors.compoundBrandStroke1,
radioFill: t.colors.neutralForegroundOnBrand,
color: t.colors.neutralForeground1,
radioVisibility: 1,

disabled: {
// Checked, Disabled
radioFill: t.colors.neutralForegroundDisabled,
},
},
} as RadioTokens);
Loading