@fluentui-react-native/menu 1.4.34 → 1.6.0
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.json +37 -1
- package/CHANGELOG.md +19 -2
- package/SPEC.md +254 -39
- package/assets/Menu_android.png +0 -0
- package/assets/checkbox_android.png +0 -0
- package/lib/Menu/Menu.d.ts.map +1 -1
- package/lib/Menu/Menu.js +2 -6
- package/lib/Menu/Menu.js.map +1 -1
- package/lib/Menu/Menu.types.d.ts +21 -1
- package/lib/Menu/Menu.types.d.ts.map +1 -1
- package/lib/Menu/Menu.types.js +6 -0
- package/lib/Menu/Menu.types.js.map +1 -1
- package/lib/Menu/renderMenu.android.d.ts +5 -0
- package/lib/Menu/renderMenu.android.d.ts.map +1 -0
- package/lib/Menu/renderMenu.android.js +14 -0
- package/lib/Menu/renderMenu.android.js.map +1 -0
- package/lib/Menu/renderMenu.d.ts +5 -0
- package/lib/Menu/renderMenu.d.ts.map +1 -0
- package/lib/Menu/renderMenu.js +10 -0
- package/lib/Menu/renderMenu.js.map +1 -0
- package/lib/Menu/useMenu.android.d.ts +3 -0
- package/lib/Menu/useMenu.android.d.ts.map +1 -0
- package/lib/Menu/useMenu.android.js +257 -0
- package/lib/Menu/useMenu.android.js.map +1 -0
- package/lib/MenuCallout/MenuCallout.android.d.ts +4 -0
- package/lib/MenuCallout/MenuCallout.android.d.ts.map +1 -0
- package/lib/MenuCallout/MenuCallout.android.js +33 -0
- package/lib/MenuCallout/MenuCallout.android.js.map +1 -0
- package/lib/MenuCallout/MenuCallout.d.ts +4 -0
- package/lib/MenuCallout/MenuCallout.d.ts.map +1 -0
- package/lib/MenuCallout/MenuCallout.js +15 -0
- package/lib/MenuCallout/MenuCallout.js.map +1 -0
- package/lib/MenuCallout/MenuCallout.types.d.ts +18 -0
- package/lib/MenuCallout/MenuCallout.types.d.ts.map +1 -0
- package/lib/MenuCallout/MenuCallout.types.js +2 -0
- package/lib/MenuCallout/MenuCallout.types.js.map +1 -0
- package/lib/MenuCallout/index.d.ts +4 -0
- package/lib/MenuCallout/index.d.ts.map +1 -0
- package/lib/MenuCallout/index.js +3 -0
- package/lib/MenuCallout/index.js.map +1 -0
- package/lib/MenuDivider/MenuDivider.d.ts +2 -1
- package/lib/MenuDivider/MenuDivider.d.ts.map +1 -1
- package/lib/MenuDivider/MenuDivider.styling.d.ts.map +1 -1
- package/lib/MenuDivider/MenuDivider.styling.js +4 -8
- package/lib/MenuDivider/MenuDivider.styling.js.map +1 -1
- package/lib/MenuDivider/MenuDivider.types.d.ts +6 -1
- package/lib/MenuDivider/MenuDivider.types.d.ts.map +1 -1
- package/lib/MenuDivider/MenuDivider.types.js +1 -0
- package/lib/MenuDivider/MenuDivider.types.js.map +1 -1
- package/lib/MenuDivider/MenuDividerTokens.android.d.ts +5 -0
- package/lib/MenuDivider/MenuDividerTokens.android.d.ts.map +1 -0
- package/lib/MenuDivider/MenuDividerTokens.android.js +7 -0
- package/lib/MenuDivider/MenuDividerTokens.android.js.map +1 -0
- package/lib/MenuDivider/index.d.ts +1 -1
- package/lib/MenuDivider/index.d.ts.map +1 -1
- package/lib/MenuItem/MenuItem.styling.d.ts.map +1 -1
- package/lib/MenuItem/MenuItem.styling.js +2 -1
- package/lib/MenuItem/MenuItem.styling.js.map +1 -1
- package/lib/MenuItem/MenuItem.types.d.ts +5 -0
- package/lib/MenuItem/MenuItem.types.d.ts.map +1 -1
- package/lib/MenuItem/MenuItemTokens.android.d.ts +5 -0
- package/lib/MenuItem/MenuItemTokens.android.d.ts.map +1 -0
- package/lib/MenuItem/MenuItemTokens.android.js +20 -0
- package/lib/MenuItem/MenuItemTokens.android.js.map +1 -0
- package/lib/MenuItem/useMenuItem.d.ts.map +1 -1
- package/lib/MenuItem/useMenuItem.js.map +1 -1
- package/lib/MenuItemCheckbox/MenuItemCheckbox.d.ts.map +1 -1
- package/lib/MenuItemCheckbox/MenuItemCheckbox.js +5 -10
- package/lib/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
- package/lib/MenuItemCheckbox/MenuItemCheckbox.styling.d.ts.map +1 -1
- package/lib/MenuItemCheckbox/MenuItemCheckbox.styling.js +25 -20
- package/lib/MenuItemCheckbox/MenuItemCheckbox.styling.js.map +1 -1
- package/lib/MenuItemCheckbox/MenuItemCheckbox.types.d.ts +40 -0
- package/lib/MenuItemCheckbox/MenuItemCheckbox.types.d.ts.map +1 -1
- package/lib/MenuItemCheckbox/MenuItemCheckboxTokens.android.d.ts +5 -0
- package/lib/MenuItemCheckbox/MenuItemCheckboxTokens.android.d.ts.map +1 -0
- package/lib/MenuItemCheckbox/MenuItemCheckboxTokens.android.js +41 -0
- package/lib/MenuItemCheckbox/MenuItemCheckboxTokens.android.js.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadio.d.ts +6 -3
- package/lib/MenuItemRadio/MenuItemRadio.d.ts.map +1 -1
- package/lib/MenuItemRadio/MenuItemRadio.js +37 -9
- package/lib/MenuItemRadio/MenuItemRadio.js.map +1 -1
- package/lib/MenuItemRadio/MenuItemRadio.styling.android.d.ts +6 -0
- package/lib/MenuItemRadio/MenuItemRadio.styling.android.d.ts.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadio.styling.android.js +57 -0
- package/lib/MenuItemRadio/MenuItemRadio.styling.android.js.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadio.styling.d.ts +5 -0
- package/lib/MenuItemRadio/MenuItemRadio.styling.d.ts.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadio.styling.js +37 -0
- package/lib/MenuItemRadio/MenuItemRadio.styling.js.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadio.types.d.ts +137 -0
- package/lib/MenuItemRadio/MenuItemRadio.types.d.ts.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadio.types.js +2 -0
- package/lib/MenuItemRadio/MenuItemRadio.types.js.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadioTokens.android.d.ts +5 -0
- package/lib/MenuItemRadio/MenuItemRadioTokens.android.d.ts.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadioTokens.android.js +44 -0
- package/lib/MenuItemRadio/MenuItemRadioTokens.android.js.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadioTokens.d.ts +5 -0
- package/lib/MenuItemRadio/MenuItemRadioTokens.d.ts.map +1 -0
- package/lib/MenuItemRadio/MenuItemRadioTokens.js +52 -0
- package/lib/MenuItemRadio/MenuItemRadioTokens.js.map +1 -0
- package/lib/MenuItemRadio/index.d.ts +2 -1
- package/lib/MenuItemRadio/index.d.ts.map +1 -1
- package/lib/MenuItemRadio/index.js +1 -1
- package/lib/MenuItemRadio/index.js.map +1 -1
- package/lib/MenuItemRadio/useMenuItemRadio.d.ts +2 -2
- package/lib/MenuItemRadio/useMenuItemRadio.d.ts.map +1 -1
- package/lib/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib/MenuList/MenuList.styling.d.ts.map +1 -1
- package/lib/MenuList/MenuList.styling.js +2 -1
- package/lib/MenuList/MenuList.styling.js.map +1 -1
- package/lib/MenuList/MenuList.types.d.ts +6 -0
- package/lib/MenuList/MenuList.types.d.ts.map +1 -1
- package/lib/MenuList/MenuListTokens.android.d.ts +5 -0
- package/lib/MenuList/MenuListTokens.android.d.ts.map +1 -0
- package/lib/MenuList/MenuListTokens.android.js +7 -0
- package/lib/MenuList/MenuListTokens.android.js.map +1 -0
- package/lib/MenuPopover/MenuPopover.d.ts +4 -2
- package/lib/MenuPopover/MenuPopover.d.ts.map +1 -1
- package/lib/MenuPopover/MenuPopover.js +2 -2
- package/lib/MenuPopover/MenuPopover.js.map +1 -1
- package/lib/MenuPopover/MenuPopover.types.d.ts +12 -1
- package/lib/MenuPopover/MenuPopover.types.d.ts.map +1 -1
- package/lib/MenuPopover/MenuPopoverTokens.android.d.ts +5 -0
- package/lib/MenuPopover/MenuPopoverTokens.android.d.ts.map +1 -0
- package/lib/MenuPopover/MenuPopoverTokens.android.js +14 -0
- package/lib/MenuPopover/MenuPopoverTokens.android.js.map +1 -0
- package/lib/MenuPopover/MenuPopoverTokens.d.ts +4 -2
- package/lib/MenuPopover/MenuPopoverTokens.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Menu/Menu.d.ts.map +1 -1
- package/lib-commonjs/Menu/Menu.js +2 -6
- package/lib-commonjs/Menu/Menu.js.map +1 -1
- package/lib-commonjs/Menu/Menu.types.d.ts +21 -1
- package/lib-commonjs/Menu/Menu.types.d.ts.map +1 -1
- package/lib-commonjs/Menu/Menu.types.js +7 -1
- package/lib-commonjs/Menu/Menu.types.js.map +1 -1
- package/lib-commonjs/Menu/renderMenu.android.d.ts +5 -0
- package/lib-commonjs/Menu/renderMenu.android.d.ts.map +1 -0
- package/lib-commonjs/Menu/renderMenu.android.js +19 -0
- package/lib-commonjs/Menu/renderMenu.android.js.map +1 -0
- package/lib-commonjs/Menu/renderMenu.d.ts +5 -0
- package/lib-commonjs/Menu/renderMenu.d.ts.map +1 -0
- package/lib-commonjs/Menu/renderMenu.js +15 -0
- package/lib-commonjs/Menu/renderMenu.js.map +1 -0
- package/lib-commonjs/Menu/useMenu.android.d.ts +3 -0
- package/lib-commonjs/Menu/useMenu.android.d.ts.map +1 -0
- package/lib-commonjs/Menu/useMenu.android.js +261 -0
- package/lib-commonjs/Menu/useMenu.android.js.map +1 -0
- package/lib-commonjs/MenuCallout/MenuCallout.android.d.ts +4 -0
- package/lib-commonjs/MenuCallout/MenuCallout.android.d.ts.map +1 -0
- package/lib-commonjs/MenuCallout/MenuCallout.android.js +36 -0
- package/lib-commonjs/MenuCallout/MenuCallout.android.js.map +1 -0
- package/lib-commonjs/MenuCallout/MenuCallout.d.ts +4 -0
- package/lib-commonjs/MenuCallout/MenuCallout.d.ts.map +1 -0
- package/lib-commonjs/MenuCallout/MenuCallout.js +18 -0
- package/lib-commonjs/MenuCallout/MenuCallout.js.map +1 -0
- package/lib-commonjs/MenuCallout/MenuCallout.types.d.ts +18 -0
- package/lib-commonjs/MenuCallout/MenuCallout.types.d.ts.map +1 -0
- package/lib-commonjs/MenuCallout/MenuCallout.types.js +5 -0
- package/lib-commonjs/MenuCallout/MenuCallout.types.js.map +1 -0
- package/lib-commonjs/MenuCallout/index.d.ts +4 -0
- package/lib-commonjs/MenuCallout/index.d.ts.map +1 -0
- package/lib-commonjs/MenuCallout/index.js +8 -0
- package/lib-commonjs/MenuCallout/index.js.map +1 -0
- package/lib-commonjs/MenuDivider/MenuDivider.d.ts +2 -1
- package/lib-commonjs/MenuDivider/MenuDivider.d.ts.map +1 -1
- package/lib-commonjs/MenuDivider/MenuDivider.styling.d.ts.map +1 -1
- package/lib-commonjs/MenuDivider/MenuDivider.styling.js +4 -8
- package/lib-commonjs/MenuDivider/MenuDivider.styling.js.map +1 -1
- package/lib-commonjs/MenuDivider/MenuDivider.types.d.ts +6 -1
- package/lib-commonjs/MenuDivider/MenuDivider.types.d.ts.map +1 -1
- package/lib-commonjs/MenuDivider/MenuDivider.types.js +2 -1
- package/lib-commonjs/MenuDivider/MenuDivider.types.js.map +1 -1
- package/lib-commonjs/MenuDivider/MenuDividerTokens.android.d.ts +5 -0
- package/lib-commonjs/MenuDivider/MenuDividerTokens.android.d.ts.map +1 -0
- package/lib-commonjs/MenuDivider/MenuDividerTokens.android.js +11 -0
- package/lib-commonjs/MenuDivider/MenuDividerTokens.android.js.map +1 -0
- package/lib-commonjs/MenuDivider/index.d.ts +1 -1
- package/lib-commonjs/MenuDivider/index.d.ts.map +1 -1
- package/lib-commonjs/MenuItem/MenuItem.styling.d.ts.map +1 -1
- package/lib-commonjs/MenuItem/MenuItem.styling.js +2 -1
- package/lib-commonjs/MenuItem/MenuItem.styling.js.map +1 -1
- package/lib-commonjs/MenuItem/MenuItem.types.d.ts +5 -0
- package/lib-commonjs/MenuItem/MenuItem.types.d.ts.map +1 -1
- package/lib-commonjs/MenuItem/MenuItemTokens.android.d.ts +5 -0
- package/lib-commonjs/MenuItem/MenuItemTokens.android.d.ts.map +1 -0
- package/lib-commonjs/MenuItem/MenuItemTokens.android.js +24 -0
- package/lib-commonjs/MenuItem/MenuItemTokens.android.js.map +1 -0
- package/lib-commonjs/MenuItem/useMenuItem.d.ts.map +1 -1
- package/lib-commonjs/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.d.ts.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.js +4 -9
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.styling.d.ts.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.styling.js +25 -20
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.styling.js.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.types.d.ts +40 -0
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.types.d.ts.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckboxTokens.android.d.ts +5 -0
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckboxTokens.android.d.ts.map +1 -0
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckboxTokens.android.js +45 -0
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckboxTokens.android.js.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.d.ts +6 -3
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.d.ts.map +1 -1
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.js +39 -10
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.js.map +1 -1
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.styling.android.d.ts +6 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.styling.android.d.ts.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.styling.android.js +60 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.styling.android.js.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.styling.d.ts +5 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.styling.d.ts.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.styling.js +40 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.styling.js.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.types.d.ts +137 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.types.d.ts.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.types.js +5 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadio.types.js.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadioTokens.android.d.ts +5 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadioTokens.android.d.ts.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadioTokens.android.js +48 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadioTokens.android.js.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadioTokens.d.ts +5 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadioTokens.d.ts.map +1 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadioTokens.js +56 -0
- package/lib-commonjs/MenuItemRadio/MenuItemRadioTokens.js.map +1 -0
- package/lib-commonjs/MenuItemRadio/index.d.ts +2 -1
- package/lib-commonjs/MenuItemRadio/index.d.ts.map +1 -1
- package/lib-commonjs/MenuItemRadio/index.js +1 -2
- package/lib-commonjs/MenuItemRadio/index.js.map +1 -1
- package/lib-commonjs/MenuItemRadio/useMenuItemRadio.d.ts +2 -2
- package/lib-commonjs/MenuItemRadio/useMenuItemRadio.d.ts.map +1 -1
- package/lib-commonjs/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib-commonjs/MenuList/MenuList.styling.d.ts.map +1 -1
- package/lib-commonjs/MenuList/MenuList.styling.js +2 -1
- package/lib-commonjs/MenuList/MenuList.styling.js.map +1 -1
- package/lib-commonjs/MenuList/MenuList.types.d.ts +6 -0
- package/lib-commonjs/MenuList/MenuList.types.d.ts.map +1 -1
- package/lib-commonjs/MenuList/MenuListTokens.android.d.ts +5 -0
- package/lib-commonjs/MenuList/MenuListTokens.android.d.ts.map +1 -0
- package/lib-commonjs/MenuList/MenuListTokens.android.js +11 -0
- package/lib-commonjs/MenuList/MenuListTokens.android.js.map +1 -0
- package/lib-commonjs/MenuPopover/MenuPopover.d.ts +4 -2
- package/lib-commonjs/MenuPopover/MenuPopover.d.ts.map +1 -1
- package/lib-commonjs/MenuPopover/MenuPopover.js +2 -2
- package/lib-commonjs/MenuPopover/MenuPopover.js.map +1 -1
- package/lib-commonjs/MenuPopover/MenuPopover.types.d.ts +12 -1
- package/lib-commonjs/MenuPopover/MenuPopover.types.d.ts.map +1 -1
- package/lib-commonjs/MenuPopover/MenuPopoverTokens.android.d.ts +5 -0
- package/lib-commonjs/MenuPopover/MenuPopoverTokens.android.d.ts.map +1 -0
- package/lib-commonjs/MenuPopover/MenuPopoverTokens.android.js +17 -0
- package/lib-commonjs/MenuPopover/MenuPopoverTokens.android.js.map +1 -0
- package/lib-commonjs/MenuPopover/MenuPopoverTokens.d.ts +4 -2
- package/lib-commonjs/MenuPopover/MenuPopoverTokens.d.ts.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.d.ts.map +1 -1
- package/lib-commonjs/index.js +1 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +2 -2
- package/src/Menu/Menu.tsx +3 -13
- package/src/Menu/Menu.types.ts +24 -1
- package/src/Menu/renderMenu.android.tsx +26 -0
- package/src/Menu/renderMenu.tsx +18 -0
- package/src/Menu/useMenu.android.ts +325 -0
- package/src/MenuCallout/MenuCallout.android.tsx +60 -0
- package/src/MenuCallout/MenuCallout.tsx +20 -0
- package/src/MenuCallout/MenuCallout.types.ts +22 -0
- package/src/MenuCallout/index.ts +3 -0
- package/src/MenuDivider/MenuDivider.styling.ts +4 -0
- package/src/MenuDivider/MenuDivider.types.ts +7 -1
- package/src/MenuDivider/MenuDividerTokens.android.ts +11 -0
- package/src/MenuDivider/index.ts +1 -1
- package/src/MenuItem/MenuItem.styling.ts +3 -1
- package/src/MenuItem/MenuItem.types.ts +6 -0
- package/src/MenuItem/MenuItemTokens.android.ts +24 -0
- package/src/MenuItem/useMenuItem.ts +0 -1
- package/src/MenuItemCheckbox/MenuItemCheckbox.styling.ts +29 -2
- package/src/MenuItemCheckbox/MenuItemCheckbox.tsx +15 -2
- package/src/MenuItemCheckbox/MenuItemCheckbox.types.ts +47 -0
- package/src/MenuItemCheckbox/MenuItemCheckboxTokens.android.ts +46 -0
- package/src/MenuItemRadio/MenuItemRadio.styling.android.ts +98 -0
- package/src/MenuItemRadio/MenuItemRadio.styling.ts +75 -0
- package/src/MenuItemRadio/MenuItemRadio.tsx +68 -9
- package/src/MenuItemRadio/MenuItemRadio.types.ts +160 -0
- package/src/MenuItemRadio/MenuItemRadioTokens.android.ts +51 -0
- package/src/MenuItemRadio/MenuItemRadioTokens.ts +56 -0
- package/src/MenuItemRadio/index.ts +9 -1
- package/src/MenuItemRadio/useMenuItemRadio.ts +2 -2
- package/src/MenuList/MenuList.styling.ts +3 -0
- package/src/MenuList/MenuList.types.ts +7 -0
- package/src/MenuList/MenuListTokens.android.ts +11 -0
- package/src/MenuPopover/MenuPopover.tsx +6 -2
- package/src/MenuPopover/MenuPopover.types.ts +14 -1
- package/src/MenuPopover/MenuPopoverTokens.android.ts +21 -0
- package/src/index.ts +10 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Animated, Modal, TouchableWithoutFeedback, View, StyleSheet, ScrollView } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { stagedComponent } from '@fluentui-react-native/framework';
|
|
5
|
+
import { mergeProps } from '@fluentui-react-native/framework';
|
|
6
|
+
|
|
7
|
+
import type { MenuCalloutProps } from './MenuCallout.types';
|
|
8
|
+
import { menuCalloutName } from './MenuCallout.types';
|
|
9
|
+
import { useMenuContext } from '../context';
|
|
10
|
+
|
|
11
|
+
const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView);
|
|
12
|
+
|
|
13
|
+
export const MenuCallout = stagedComponent((props: MenuCalloutProps) => {
|
|
14
|
+
const context = useMenuContext();
|
|
15
|
+
|
|
16
|
+
return (_rest: MenuCalloutProps, children: React.ReactNode) => {
|
|
17
|
+
const mergedProps = mergeProps(props, _rest);
|
|
18
|
+
const tokens = props.tokens;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Modal
|
|
22
|
+
{...mergedProps}
|
|
23
|
+
visible={context.open}
|
|
24
|
+
onRequestClose={context.onRequestClose}
|
|
25
|
+
supportedOrientations={['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right']}
|
|
26
|
+
transparent
|
|
27
|
+
>
|
|
28
|
+
<TouchableWithoutFeedback onPress={context.onRequestClose} accessible={false}>
|
|
29
|
+
<View style={[StyleSheet.absoluteFill]}>
|
|
30
|
+
<Animated.View
|
|
31
|
+
onLayout={context.onMenuLayout}
|
|
32
|
+
style={[
|
|
33
|
+
context.shadowMenuContainerStyle,
|
|
34
|
+
{
|
|
35
|
+
maxHeight: mergedProps.maxHeight ? mergedProps.maxHeight : tokens.maxHeight,
|
|
36
|
+
maxWidth: tokens.maxWidth,
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
borderRadius: tokens.cornerRadius,
|
|
39
|
+
elevation: tokens.elevation,
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
},
|
|
42
|
+
]}
|
|
43
|
+
>
|
|
44
|
+
{context.menuHeight + tokens.minPadding >= tokens.maxHeight ||
|
|
45
|
+
context.menuHeight + tokens.minPadding >= mergedProps.maxHeight ? (
|
|
46
|
+
<AnimatedScrollView style={[context.animationStarted && context.menuSize]}>{children}</AnimatedScrollView>
|
|
47
|
+
) : (
|
|
48
|
+
<Animated.View style={[context.animationStarted && context.menuSize]}>{children}</Animated.View>
|
|
49
|
+
)}
|
|
50
|
+
</Animated.View>
|
|
51
|
+
</View>
|
|
52
|
+
</TouchableWithoutFeedback>
|
|
53
|
+
</Modal>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
MenuCallout.displayName = menuCalloutName;
|
|
59
|
+
|
|
60
|
+
export default MenuCallout;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Callout } from '@fluentui-react-native/callout';
|
|
4
|
+
import { stagedComponent } from '@fluentui-react-native/framework';
|
|
5
|
+
import { mergeProps } from '@fluentui-react-native/framework';
|
|
6
|
+
|
|
7
|
+
import type { MenuCalloutProps } from './MenuCallout.types';
|
|
8
|
+
import { menuCalloutName } from './MenuCallout.types';
|
|
9
|
+
|
|
10
|
+
export const MenuCallout = stagedComponent((props: MenuCalloutProps) => {
|
|
11
|
+
return (_rest: MenuCalloutProps, children: React.ReactNode) => {
|
|
12
|
+
const mergedProps = mergeProps(props, _rest);
|
|
13
|
+
|
|
14
|
+
return <Callout {...mergedProps}>{children}</Callout>;
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
MenuCallout.displayName = menuCalloutName;
|
|
19
|
+
|
|
20
|
+
export default MenuCallout;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ICalloutProps, ICalloutTokens } from '@fluentui-react-native/callout';
|
|
2
|
+
|
|
3
|
+
export const menuCalloutName = 'MenuCallout';
|
|
4
|
+
|
|
5
|
+
// Support for anchorRect and beakWidth will come at a later time.
|
|
6
|
+
// Omitting dismissBehaviors as it doesn't seem to make sense as a token
|
|
7
|
+
export type MenuCalloutTokens =
|
|
8
|
+
| Omit<ICalloutTokens, 'anchorRect' | 'beakWidth' | 'dismissBehaviors'> & {
|
|
9
|
+
/**
|
|
10
|
+
* The token for the corner radius for the Modal MenuPopover
|
|
11
|
+
* @platform android
|
|
12
|
+
*/
|
|
13
|
+
cornerRadius?: number;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Shadown elevation token for the Modal MenuPopover
|
|
17
|
+
* @platform android
|
|
18
|
+
*/
|
|
19
|
+
elevation?: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type MenuCalloutProps = ICalloutProps & { tokens: MenuCalloutTokens };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
1
3
|
import type { UseStylingOptions } from '@fluentui-react-native/framework';
|
|
2
4
|
import { buildProps } from '@fluentui-react-native/framework';
|
|
3
5
|
|
|
@@ -7,6 +9,7 @@ import { defaultMenuDividerTokens } from './MenuDividerTokens';
|
|
|
7
9
|
|
|
8
10
|
export const stylingSettings: UseStylingOptions<MenuDividerProps, MenuDividerSlotProps, MenuDividerTokens> = {
|
|
9
11
|
tokens: [defaultMenuDividerTokens, menuDividerName],
|
|
12
|
+
tokensThatAreAlsoProps: ['insetSize'],
|
|
10
13
|
slotProps: {
|
|
11
14
|
root: buildProps(
|
|
12
15
|
(tokens: MenuDividerTokens) => ({
|
|
@@ -17,6 +20,7 @@ export const stylingSettings: UseStylingOptions<MenuDividerProps, MenuDividerSlo
|
|
|
17
20
|
margin: tokens.margin,
|
|
18
21
|
marginVertical: tokens.marginVertical,
|
|
19
22
|
display: 'flex',
|
|
23
|
+
...(Platform.OS === 'android' && { marginStart: tokens.insetSize }),
|
|
20
24
|
},
|
|
21
25
|
}),
|
|
22
26
|
['backgroundColor', 'height', 'margin', 'marginVertical', 'width'],
|
|
@@ -6,14 +6,20 @@ import type { IBackgroundColorTokens } from '@fluentui-react-native/tokens';
|
|
|
6
6
|
|
|
7
7
|
export const menuDividerName = 'MenuDivider';
|
|
8
8
|
|
|
9
|
+
export const MenuDividerInsetSizes = [0, 16, 56, 68, 72, 108] as const;
|
|
10
|
+
export type MenuDividerInsetSize = (typeof MenuDividerInsetSizes)[number];
|
|
11
|
+
|
|
9
12
|
export type MenuDividerTokens = IBackgroundColorTokens & {
|
|
10
13
|
height?: number;
|
|
11
14
|
margin?: number;
|
|
12
15
|
marginVertical?: number;
|
|
13
16
|
width?: ViewStyle['width'];
|
|
17
|
+
insetSize?: MenuDividerInsetSize;
|
|
14
18
|
};
|
|
15
19
|
|
|
16
|
-
export type MenuDividerProps = IViewProps
|
|
20
|
+
export type MenuDividerProps = IViewProps & {
|
|
21
|
+
insetSize?: MenuDividerInsetSize;
|
|
22
|
+
};
|
|
17
23
|
|
|
18
24
|
export interface MenuDividerSlotProps {
|
|
19
25
|
root: React.PropsWithRef<IViewProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Theme } from '@fluentui-react-native/framework';
|
|
2
|
+
import { globalTokens } from '@fluentui-react-native/theme-tokens';
|
|
3
|
+
import type { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
4
|
+
|
|
5
|
+
import type { MenuDividerTokens } from './MenuDivider.types';
|
|
6
|
+
|
|
7
|
+
export const defaultMenuDividerTokens: TokenSettings<MenuDividerTokens, Theme> = (t: Theme): MenuDividerTokens => ({
|
|
8
|
+
backgroundColor: t.colors.neutralStroke2,
|
|
9
|
+
height: globalTokens.stroke.width10,
|
|
10
|
+
insetSize: 0,
|
|
11
|
+
});
|
package/src/MenuDivider/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { MenuDivider } from './MenuDivider';
|
|
2
2
|
export { menuDividerName } from './MenuDivider.types';
|
|
3
|
-
export type { MenuDividerProps, MenuDividerTokens, MenuDividerSlotProps, MenuDividerType } from './MenuDivider.types';
|
|
3
|
+
export type { MenuDividerProps, MenuDividerTokens, MenuDividerSlotProps, MenuDividerType, MenuDividerInsetSize } from './MenuDivider.types';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
1
3
|
import type { Theme, UseStylingOptions } from '@fluentui-react-native/framework';
|
|
2
4
|
import { buildProps } from '@fluentui-react-native/framework';
|
|
3
5
|
import { borderStyles, fontStyles, layoutStyles } from '@fluentui-react-native/tokens';
|
|
@@ -30,7 +32,7 @@ export const stylingSettings: UseStylingOptions<MenuItemProps, MenuItemSlotProps
|
|
|
30
32
|
style: {
|
|
31
33
|
height: tokens.checkmarkSize,
|
|
32
34
|
width: tokens.checkmarkSize,
|
|
33
|
-
marginEnd: tokens.gap,
|
|
35
|
+
marginEnd: Platform.OS === 'android' ? tokens.marginEndForCheckedAndroid : tokens.gap,
|
|
34
36
|
},
|
|
35
37
|
}),
|
|
36
38
|
['checkmarkSize', 'gap'],
|
|
@@ -31,6 +31,12 @@ export interface MenuItemTokens extends LayoutTokens, FontTokens, IBorderTokens,
|
|
|
31
31
|
*/
|
|
32
32
|
iconSize?: number;
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Amount of space in pixels at the end of the item control that is reserved to align the item's text with other items which have checkmarks
|
|
36
|
+
* @platform android
|
|
37
|
+
*/
|
|
38
|
+
marginEndForCheckedAndroid?: number;
|
|
39
|
+
|
|
34
40
|
/**
|
|
35
41
|
* Color of the indicator that shows that an item has a submenu
|
|
36
42
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Theme } from '@fluentui-react-native/framework';
|
|
2
|
+
import { globalTokens } from '@fluentui-react-native/theme-tokens';
|
|
3
|
+
import type { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
4
|
+
|
|
5
|
+
import type { MenuItemTokens } from './MenuItem.types';
|
|
6
|
+
|
|
7
|
+
export const defaultMenuItemTokens: TokenSettings<MenuItemTokens, Theme> = (t: Theme): MenuItemTokens => ({
|
|
8
|
+
color: t.colors.neutralForeground1,
|
|
9
|
+
variant: 'body1',
|
|
10
|
+
paddingHorizontal: globalTokens.size160,
|
|
11
|
+
paddingVertical: globalTokens.size60,
|
|
12
|
+
iconColor: t.colors.neutralForeground3,
|
|
13
|
+
iconSize: globalTokens.size240,
|
|
14
|
+
marginEndForCheckedAndroid: globalTokens.size360,
|
|
15
|
+
pressed: {
|
|
16
|
+
backgroundColor: t.colors.neutralBackground1Pressed,
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
backgroundColor: t.colors.neutralBackground1,
|
|
20
|
+
color: t.colors.neutralForegroundDisabled1,
|
|
21
|
+
iconColor: t.colors.disabledText,
|
|
22
|
+
},
|
|
23
|
+
gap: globalTokens.size160,
|
|
24
|
+
});
|
|
@@ -28,7 +28,6 @@ export const useMenuItem = (props: MenuItemProps): MenuItemInfo => {
|
|
|
28
28
|
const onInvoke = React.useCallback(
|
|
29
29
|
(e: InteractionEvent) => {
|
|
30
30
|
const isRtl = I18nManager.isRTL;
|
|
31
|
-
|
|
32
31
|
const isArrowKey = isKeyPressEvent(e) && (e.nativeEvent.key === 'ArrowLeft' || e.nativeEvent.key === 'ArrowRight');
|
|
33
32
|
const isArrowOpen =
|
|
34
33
|
hasSubmenu &&
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
1
3
|
import type { Theme, UseStylingOptions } from '@fluentui-react-native/framework';
|
|
2
4
|
import { buildProps } from '@fluentui-react-native/framework';
|
|
3
5
|
import { borderStyles, fontStyles, layoutStyles } from '@fluentui-react-native/tokens';
|
|
@@ -7,6 +9,7 @@ import { menuItemCheckboxName } from './MenuItemCheckbox.types';
|
|
|
7
9
|
import { defaultMenuItemCheckboxTokens } from './MenuItemCheckboxTokens';
|
|
8
10
|
|
|
9
11
|
export const menuItemCheckboxStates: (keyof MenuItemCheckboxTokens)[] = ['hovered', 'focused', 'pressed', 'disabled', 'checked'];
|
|
12
|
+
const hasPressRententionForA11y = Platform.OS === 'android';
|
|
10
13
|
|
|
11
14
|
export const stylingSettings: UseStylingOptions<MenuItemCheckboxProps, MenuItemCheckboxSlotProps, MenuItemCheckboxTokens> = {
|
|
12
15
|
tokens: [defaultMenuItemCheckboxTokens, menuItemCheckboxName],
|
|
@@ -25,14 +28,37 @@ export const stylingSettings: UseStylingOptions<MenuItemCheckboxProps, MenuItemC
|
|
|
25
28
|
}),
|
|
26
29
|
['backgroundColor', ...borderStyles.keys, ...layoutStyles.keys],
|
|
27
30
|
),
|
|
31
|
+
...(Platform.OS === 'android' && {
|
|
32
|
+
checkbox: buildProps(
|
|
33
|
+
(tokens: MenuItemCheckboxTokens) => ({
|
|
34
|
+
style: {
|
|
35
|
+
height: tokens.checkboxSize,
|
|
36
|
+
marginEnd: tokens.paddingHorizontal,
|
|
37
|
+
width: tokens.checkboxSize,
|
|
38
|
+
backgroundColor: tokens.checkboxBackgroundColor,
|
|
39
|
+
borderColor: tokens.checkboxBorderColor,
|
|
40
|
+
borderRadius: tokens.checkboxBorderRadius,
|
|
41
|
+
borderWidth: tokens.checkboxBorderWidth,
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
},
|
|
45
|
+
...(hasPressRententionForA11y && {
|
|
46
|
+
pressRetentionOffset: typeof tokens.padding === 'number' ? tokens.padding : parseFloat(tokens.padding), /// Retention of the press area outside of the checkbox equal to padding to match accessibility requirement
|
|
47
|
+
}),
|
|
48
|
+
android_ripple: { color: tokens.rippleColor, radius: tokens.checkmarkSize, foreground: true },
|
|
49
|
+
}),
|
|
50
|
+
['checkboxBackgroundColor', 'checkboxBorderColor', 'checkboxBorderRadius', 'checkboxBorderWidth', 'checkboxSize', 'rippleColor'],
|
|
51
|
+
),
|
|
52
|
+
}),
|
|
53
|
+
|
|
28
54
|
checkmark: buildProps(
|
|
29
55
|
(tokens: MenuItemCheckboxTokens) => ({
|
|
30
56
|
opacity: tokens.checkmarkVisibility,
|
|
31
|
-
color: tokens.color,
|
|
57
|
+
color: tokens.checkmarkColor ?? tokens.color,
|
|
32
58
|
height: tokens.checkmarkSize,
|
|
33
59
|
width: tokens.checkmarkSize,
|
|
34
60
|
viewBox: '0 0 ' + (tokens.checkmarkSize - tokens.checkmarkPadding * 2) + ' ' + (tokens.checkmarkSize - tokens.checkmarkPadding * 2),
|
|
35
|
-
style: { marginEnd: tokens.gap },
|
|
61
|
+
...(Platform.OS !== 'android' && { style: { marginEnd: tokens.gap } }),
|
|
36
62
|
}),
|
|
37
63
|
['checkmarkPadding', 'checkmarkSize', 'checkmarkVisibility', 'color', 'gap'],
|
|
38
64
|
),
|
|
@@ -41,6 +67,7 @@ export const stylingSettings: UseStylingOptions<MenuItemCheckboxProps, MenuItemC
|
|
|
41
67
|
style: {
|
|
42
68
|
flexGrow: 1,
|
|
43
69
|
color: tokens.color,
|
|
70
|
+
...(Platform.OS === 'android' && { flexShrink: 1 }),
|
|
44
71
|
...fontStyles.from(tokens, theme),
|
|
45
72
|
},
|
|
46
73
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx withSlots */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Image, Pressable, View } from 'react-native';
|
|
3
|
+
import { Image, Platform, Pressable, View } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import type { Slots, UseSlots } from '@fluentui-react-native/framework';
|
|
6
6
|
import { compose, mergeProps, withSlots } from '@fluentui-react-native/framework';
|
|
@@ -24,6 +24,7 @@ export const MenuItemCheckbox = compose<MenuItemCheckboxType>({
|
|
|
24
24
|
...stylingSettings,
|
|
25
25
|
slots: {
|
|
26
26
|
root: Pressable,
|
|
27
|
+
...(Platform.OS === 'android' && { checkbox: Pressable }),
|
|
27
28
|
checkmark: SvgXml,
|
|
28
29
|
content: Text,
|
|
29
30
|
iconPlaceholder: View,
|
|
@@ -44,17 +45,29 @@ export const menuItemFinalRender = (
|
|
|
44
45
|
): React.FunctionComponent<MenuItemCheckboxProps> => {
|
|
45
46
|
return (final: MenuItemCheckboxProps, children: React.ReactNode) => {
|
|
46
47
|
const { accessibilityLabel, icon, tooltip, ...mergedProps } = mergeProps(menuItem.props, final);
|
|
48
|
+
|
|
47
49
|
const checkmarkXml = `
|
|
48
50
|
<svg>
|
|
49
51
|
<path fill='currentColor' d='M9.85355 3.14645C10.0488 3.34171 10.0488 3.65829 9.85355 3.85355L5.35355 8.35355C5.15829 8.54882 4.84171 8.54882 4.64645 8.35355L2.64645 6.35355C2.45118 6.15829 2.45118 5.84171 2.64645 5.64645C2.84171 5.45118 3.15829 5.45118 3.35355 5.64645L5 7.29289L9.14645 3.14645C9.34171 2.95118 9.65829 2.95118 9.85355 3.14645Z' />
|
|
50
52
|
</svg>`;
|
|
51
53
|
|
|
54
|
+
const androidCheckmarkPath = `
|
|
55
|
+
<svg>
|
|
56
|
+
<path fill='currentColor' d='M9.76497 3.20474C10.0661 3.48915 10.0797 3.96383 9.79526 4.26497L5.54526 8.76497C5.40613 8.91228 5.21332 8.99703 5.01071 8.99993C4.8081 9.00282 4.61295 8.92361 4.46967 8.78033L2.21967 6.53033C1.92678 6.23744 1.92678 5.76257 2.21967 5.46967C2.51256 5.17678 2.98744 5.17678 3.28033 5.46967L4.98463 7.17397L8.70474 3.23503C8.98915 2.9339 9.46383 2.92033 9.76497 3.20474Z' />
|
|
57
|
+
</svg>`;
|
|
58
|
+
|
|
52
59
|
const label = getAccessibilityLabel(accessibilityLabel, children[0]);
|
|
53
60
|
const tooltipResult = getTooltip(tooltip, menuItem.state.hasTooltips, children[0]);
|
|
54
61
|
|
|
55
62
|
return (
|
|
56
63
|
<Slots.root {...mergedProps} accessibilityLabel={label}>
|
|
57
|
-
|
|
64
|
+
{Platform.OS === 'android' ? (
|
|
65
|
+
<Slots.checkbox onPress={mergedProps.onPress} accessible={false} focusable={false}>
|
|
66
|
+
<Slots.checkmark xml={androidCheckmarkPath} />
|
|
67
|
+
</Slots.checkbox>
|
|
68
|
+
) : (
|
|
69
|
+
<Slots.checkmark accessible={false} xml={checkmarkXml} />
|
|
70
|
+
)}
|
|
58
71
|
{(icon || menuItem.state.hasIcons) && (
|
|
59
72
|
<Slots.iconPlaceholder accessible={false}>
|
|
60
73
|
{icon && icon.source && <Slots.imgIcon accessible={false} {...icon} />}
|
|
@@ -38,6 +38,52 @@ export interface MenuItemCheckboxTokens
|
|
|
38
38
|
*/
|
|
39
39
|
iconSize?: number;
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Color of the background of the box containing the checkmark.
|
|
43
|
+
* @platform android
|
|
44
|
+
*/
|
|
45
|
+
checkboxBackgroundColor?: ColorValue;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Color of the border of the box containing the checkmark.
|
|
49
|
+
* @platform android
|
|
50
|
+
*/
|
|
51
|
+
checkboxBorderColor?: ColorValue;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Border radius of the box containing the checkmark.
|
|
55
|
+
* @platform android
|
|
56
|
+
*/
|
|
57
|
+
checkboxBorderRadius?: number;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Width of the border around the box containing the checkmark.
|
|
61
|
+
* @platform android
|
|
62
|
+
*/
|
|
63
|
+
checkboxBorderWidth?: number;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Height and width of the box containing the checkmark.
|
|
67
|
+
* @platform android
|
|
68
|
+
*/
|
|
69
|
+
checkboxSize?: number;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Ripple color for Android.
|
|
73
|
+
*
|
|
74
|
+
* A ripple animation is shown on click for Android. This sets the color of the ripple.
|
|
75
|
+
* @platform android
|
|
76
|
+
*/
|
|
77
|
+
rippleColor?: ColorValue;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Ripple radius for circular radio on Android.
|
|
81
|
+
*
|
|
82
|
+
* A ripple animation is shown on click for Android. This sets the radius of the circular ripple shown on the radio button.
|
|
83
|
+
* @platform android
|
|
84
|
+
*/
|
|
85
|
+
rippleRadius?: number;
|
|
86
|
+
|
|
41
87
|
/**
|
|
42
88
|
* States of the item control
|
|
43
89
|
*/
|
|
@@ -62,6 +108,7 @@ export interface MenuItemCheckboxInfo {
|
|
|
62
108
|
|
|
63
109
|
export interface MenuItemCheckboxSlotProps {
|
|
64
110
|
root: React.PropsWithRef<PressablePropsExtended>;
|
|
111
|
+
checkbox?: PressablePropsExtended; // Android only
|
|
65
112
|
checkmark?: XmlProps;
|
|
66
113
|
content?: TextProps;
|
|
67
114
|
iconPlaceholder?: React.PropsWithRef<IViewProps>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Theme } from '@fluentui-react-native/framework';
|
|
2
|
+
import { globalTokens } from '@fluentui-react-native/theme-tokens';
|
|
3
|
+
import type { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
4
|
+
|
|
5
|
+
import type { MenuItemCheckboxTokens } from './MenuItemCheckbox.types';
|
|
6
|
+
|
|
7
|
+
export const defaultMenuItemCheckboxTokens: TokenSettings<MenuItemCheckboxTokens, Theme> = (t: Theme): MenuItemCheckboxTokens => ({
|
|
8
|
+
checkmarkSize: globalTokens.size120,
|
|
9
|
+
checkmarkVisibility: 0,
|
|
10
|
+
color: t.colors.neutralForeground1,
|
|
11
|
+
variant: 'body1',
|
|
12
|
+
gap: globalTokens.size160,
|
|
13
|
+
iconColor: t.colors.neutralForeground2,
|
|
14
|
+
iconSize: globalTokens.size200,
|
|
15
|
+
maxWidth: 300,
|
|
16
|
+
paddingVertical: globalTokens.size60,
|
|
17
|
+
paddingHorizontal: globalTokens.size160,
|
|
18
|
+
checkmarkPadding: globalTokens.sizeNone,
|
|
19
|
+
checkboxBorderWidth: globalTokens.stroke.width15,
|
|
20
|
+
checkboxBorderRadius: globalTokens.corner.radius40,
|
|
21
|
+
checkboxSize: globalTokens.size200,
|
|
22
|
+
checkboxBorderColor: t.colors.neutralStrokeAccessible,
|
|
23
|
+
|
|
24
|
+
rippleColor: '#D4D4D4',
|
|
25
|
+
pressed: {
|
|
26
|
+
backgroundColor: t.colors.neutralBackground1Pressed,
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
backgroundColor: t.colors.neutralBackground1,
|
|
30
|
+
checkboxBorderColor: t.colors.neutralStrokeDisabled,
|
|
31
|
+
color: t.colors.neutralForegroundDisabled1,
|
|
32
|
+
iconColor: t.colors.neutralForegroundDisabled,
|
|
33
|
+
// Unselected, Disabled
|
|
34
|
+
rippleColor: '#D4D4D4',
|
|
35
|
+
checked: {
|
|
36
|
+
checkboxBackgroundColor: t.colors.brandBackgroundDisabled,
|
|
37
|
+
checkmarkVisibility: 1,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
checked: {
|
|
41
|
+
checkmarkVisibility: 1,
|
|
42
|
+
checkboxBackgroundColor: t.colors.brandBackground,
|
|
43
|
+
checkboxBorderWidth: globalTokens.stroke.widthNone,
|
|
44
|
+
checkmarkColor: t.colors.neutralForegroundOnColor,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { Theme, UseStylingOptions } from '@fluentui-react-native/framework';
|
|
4
|
+
import { buildProps } from '@fluentui-react-native/framework';
|
|
5
|
+
import { borderStyles, fontStyles, layoutStyles } from '@fluentui-react-native/tokens';
|
|
6
|
+
|
|
7
|
+
import type { MenuItemRadioProps, MenuItemRadioSlotProps } from './MenuItemRadio.types';
|
|
8
|
+
import { menuItemRadioName } from './MenuItemRadio.types';
|
|
9
|
+
import { defaultMenuItemRadioTokens } from './MenuItemRadioTokens';
|
|
10
|
+
import type { MenuItemRadioTokens } from '../MenuItemRadio/MenuItemRadio.types';
|
|
11
|
+
|
|
12
|
+
export const menuItemRadioStates: (keyof MenuItemRadioTokens)[] = ['hovered', 'focused', 'pressed', 'disabled', 'checked'];
|
|
13
|
+
|
|
14
|
+
export const stylingSettings: UseStylingOptions<MenuItemRadioProps, MenuItemRadioSlotProps, MenuItemRadioTokens> = {
|
|
15
|
+
tokens: [defaultMenuItemRadioTokens, menuItemRadioName],
|
|
16
|
+
states: menuItemRadioStates,
|
|
17
|
+
slotProps: {
|
|
18
|
+
root: buildProps(
|
|
19
|
+
(tokens: MenuItemRadioTokens, theme: Theme) => ({
|
|
20
|
+
style: {
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
backgroundColor: tokens.backgroundColor,
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
...layoutStyles.from(tokens, theme),
|
|
26
|
+
...borderStyles.from(tokens, theme),
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
['backgroundColor', ...borderStyles.keys, ...layoutStyles.keys],
|
|
30
|
+
),
|
|
31
|
+
|
|
32
|
+
radioButton: buildProps(
|
|
33
|
+
(tokens: MenuItemRadioTokens) => ({
|
|
34
|
+
style: {
|
|
35
|
+
backgroundColor: 'transparent',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
marginEnd: tokens.paddingHorizontal,
|
|
39
|
+
width: tokens.radioOuterCircleSize,
|
|
40
|
+
height: tokens.radioOuterCircleSize,
|
|
41
|
+
borderWidth: tokens.radioBorderWidth,
|
|
42
|
+
borderStyle: tokens.radioBorderStyle,
|
|
43
|
+
borderRadius: tokens.radioOuterCircleSize / 2,
|
|
44
|
+
borderColor: tokens.radioBorder,
|
|
45
|
+
},
|
|
46
|
+
android_ripple: { color: tokens.rippleColor, radius: tokens.rippleRadius, borderless: true },
|
|
47
|
+
}),
|
|
48
|
+
['radioBorderWidth', 'radioBorderStyle', 'radioOuterCircleSize', 'rippleColor', 'rippleRadius', 'radioBorder'],
|
|
49
|
+
),
|
|
50
|
+
|
|
51
|
+
radioInnerCircle: buildProps(
|
|
52
|
+
(tokens: MenuItemRadioTokens) => ({
|
|
53
|
+
style: {
|
|
54
|
+
opacity: tokens.radioVisibility,
|
|
55
|
+
borderRadius: tokens.radioInnerCircleSize / 2,
|
|
56
|
+
height: tokens.radioInnerCircleSize,
|
|
57
|
+
width: tokens.radioInnerCircleSize,
|
|
58
|
+
backgroundColor: tokens.radioFill,
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
['radioInnerCircleSize', 'radioVisibility', 'radioFill'],
|
|
62
|
+
),
|
|
63
|
+
|
|
64
|
+
content: buildProps(
|
|
65
|
+
(tokens: MenuItemRadioTokens, theme: Theme) => ({
|
|
66
|
+
style: {
|
|
67
|
+
flexGrow: 1,
|
|
68
|
+
color: tokens.color,
|
|
69
|
+
...(Platform.OS === 'android' && { flexShrink: 1 }),
|
|
70
|
+
...fontStyles.from(tokens, theme),
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
['color', ...fontStyles.keys],
|
|
74
|
+
),
|
|
75
|
+
iconPlaceholder: buildProps(
|
|
76
|
+
(tokens: MenuItemRadioTokens) => ({
|
|
77
|
+
style: {
|
|
78
|
+
minHeight: tokens.iconSize,
|
|
79
|
+
minWidth: tokens.iconSize,
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
justifyContent: 'center',
|
|
82
|
+
marginEnd: tokens.gap,
|
|
83
|
+
},
|
|
84
|
+
}),
|
|
85
|
+
['checkmarkSize', 'gap'],
|
|
86
|
+
),
|
|
87
|
+
imgIcon: buildProps(
|
|
88
|
+
(tokens: MenuItemRadioTokens) => ({
|
|
89
|
+
style: { tintColor: tokens.iconColor, height: tokens.iconSize, width: tokens.iconSize },
|
|
90
|
+
}),
|
|
91
|
+
['gap', 'iconColor', 'iconSize'],
|
|
92
|
+
),
|
|
93
|
+
fontOrSvgIcon: buildProps(
|
|
94
|
+
(tokens: MenuItemRadioTokens) => ({ color: tokens.iconColor, size: tokens.iconSize }),
|
|
95
|
+
['gap', 'iconColor', 'iconSize'],
|
|
96
|
+
),
|
|
97
|
+
},
|
|
98
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { Theme, UseStylingOptions } from '@fluentui-react-native/framework';
|
|
4
|
+
import { buildProps } from '@fluentui-react-native/framework';
|
|
5
|
+
import { borderStyles, fontStyles, layoutStyles } from '@fluentui-react-native/tokens';
|
|
6
|
+
|
|
7
|
+
import type { MenuItemRadioProps, MenuItemRadioSlotProps, MenuItemRadioTokens } from './MenuItemRadio.types';
|
|
8
|
+
import { menuItemRadioName } from './MenuItemRadio.types';
|
|
9
|
+
import { defaultMenuItemRadioTokens } from './MenuItemRadioTokens';
|
|
10
|
+
|
|
11
|
+
export const menuItemRadioStates: (keyof MenuItemRadioTokens)[] = ['hovered', 'focused', 'pressed', 'disabled', 'checked'];
|
|
12
|
+
|
|
13
|
+
export const stylingSettings: UseStylingOptions<MenuItemRadioProps, MenuItemRadioSlotProps, MenuItemRadioTokens> = {
|
|
14
|
+
tokens: [defaultMenuItemRadioTokens, menuItemRadioName],
|
|
15
|
+
states: menuItemRadioStates,
|
|
16
|
+
slotProps: {
|
|
17
|
+
root: buildProps(
|
|
18
|
+
(tokens: MenuItemRadioTokens, theme: Theme) => ({
|
|
19
|
+
style: {
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
backgroundColor: tokens.backgroundColor,
|
|
22
|
+
display: 'flex',
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
...layoutStyles.from(tokens, theme),
|
|
25
|
+
...borderStyles.from(tokens, theme),
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
['backgroundColor', ...borderStyles.keys, ...layoutStyles.keys],
|
|
29
|
+
),
|
|
30
|
+
checkmark: buildProps(
|
|
31
|
+
(tokens: MenuItemRadioTokens) => ({
|
|
32
|
+
opacity: tokens.checkmarkVisibility,
|
|
33
|
+
color: tokens.checkmarkColor ?? tokens.color,
|
|
34
|
+
height: tokens.checkmarkSize,
|
|
35
|
+
width: tokens.checkmarkSize,
|
|
36
|
+
viewBox: '0 0 ' + (tokens.checkmarkSize - tokens.checkmarkPadding * 2) + ' ' + (tokens.checkmarkSize - tokens.checkmarkPadding * 2),
|
|
37
|
+
...(Platform.OS !== 'android' && { style: { marginEnd: tokens.gap } }),
|
|
38
|
+
}),
|
|
39
|
+
['checkmarkPadding', 'checkmarkSize', 'checkmarkVisibility', 'color', 'gap'],
|
|
40
|
+
),
|
|
41
|
+
content: buildProps(
|
|
42
|
+
(tokens: MenuItemRadioTokens, theme: Theme) => ({
|
|
43
|
+
style: {
|
|
44
|
+
flexGrow: 1,
|
|
45
|
+
color: tokens.color,
|
|
46
|
+
...(Platform.OS === 'android' && { flexShrink: 1 }),
|
|
47
|
+
...fontStyles.from(tokens, theme),
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
['color', ...fontStyles.keys],
|
|
51
|
+
),
|
|
52
|
+
iconPlaceholder: buildProps(
|
|
53
|
+
(tokens: MenuItemRadioTokens) => ({
|
|
54
|
+
style: {
|
|
55
|
+
minHeight: tokens.iconSize,
|
|
56
|
+
minWidth: tokens.iconSize,
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
marginEnd: tokens.gap,
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
['checkmarkSize', 'gap'],
|
|
63
|
+
),
|
|
64
|
+
imgIcon: buildProps(
|
|
65
|
+
(tokens: MenuItemRadioTokens) => ({
|
|
66
|
+
style: { tintColor: tokens.iconColor, height: tokens.iconSize, width: tokens.iconSize },
|
|
67
|
+
}),
|
|
68
|
+
['gap', 'iconColor', 'iconSize'],
|
|
69
|
+
),
|
|
70
|
+
fontOrSvgIcon: buildProps(
|
|
71
|
+
(tokens: MenuItemRadioTokens) => ({ color: tokens.iconColor, size: tokens.iconSize }),
|
|
72
|
+
['gap', 'iconColor', 'iconSize'],
|
|
73
|
+
),
|
|
74
|
+
},
|
|
75
|
+
};
|