@azure/communication-react 1.9.0-alpha-202310120012 → 1.9.0-alpha-202310130013

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.
@@ -2,5 +2,5 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT License.
4
4
  // GENERATED FILE. DO NOT EDIT MANUALLY.
5
- module.exports = '1.9.0-alpha-202310120012';
5
+ module.exports = '1.9.0-alpha-202310130013';
6
6
  //# sourceMappingURL=telemetryVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.9.0-alpha-202310120012';\n"]}
1
+ {"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.9.0-alpha-202310130013';\n"]}
@@ -45,10 +45,10 @@ export const _DrawerMenu = (props) => {
45
45
  }), [firstItemStyle, borderRadius]);
46
46
  return (React.createElement(_DrawerSurface, { disableMaxHeight: props.disableMaxHeight, styles: (_b = props.styles) === null || _b === void 0 ? void 0 : _b.drawerSurfaceStyles, onLightDismiss: props.onLightDismiss, heading: props.heading },
47
47
  React.createElement(Stack, { styles: props.styles, role: "menu", "data-ui-id": "drawer-menu" }, menuItemsToRender === null || menuItemsToRender === void 0 ? void 0 :
48
- menuItemsToRender.slice(0, 1).map((item) => (React.createElement(DrawerMenuItem, Object.assign({}, item, { key: '0', styles: modifiedFirstItemStyle, onItemClick: (ev, itemKey) => {
48
+ menuItemsToRender.slice(0, 1).map((item) => (React.createElement(DrawerMenuItem, Object.assign({}, item, { key: `${item.itemKey}` + '0', shouldFocusOnMount: true, styles: modifiedFirstItemStyle, onItemClick: (ev, itemKey) => {
49
49
  onItemClick(item, ev, itemKey);
50
50
  } })))), menuItemsToRender === null || menuItemsToRender === void 0 ? void 0 :
51
- menuItemsToRender.slice(1).map((item, i) => (React.createElement(DrawerMenuItem, Object.assign({}, item, { key: `${i + 1}`, onItemClick: (ev, itemKey) => {
51
+ menuItemsToRender.slice(1).map((item, i) => (React.createElement(DrawerMenuItem, Object.assign({}, item, { key: `${item.itemKey}` + `${i + 1}`, onItemClick: (ev, itemKey) => {
52
52
  onItemClick(item, ev, itemKey);
53
53
  } })))))));
54
54
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerMenu.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Drawer/DrawerMenu.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAuCvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAe,EAAE;;IAClE,gGAAgG;IAChG,iGAAiG;IACjG,+EAA+E;IAC/E,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ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C,CAC/B,CAAC;IAEF,OAAO,CACL,oBAAC,cAAc,IACb,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EACxC,MAAM,EAAE,MAAA,KAAK,CAAC,MAAM,0CAAE,mBAAmB,EACzC,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,OAAO,EAAE,KAAK,CAAC,OAAO;QAEtB,oBAAC,KAAK,IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAC,MAAM,gBAAY,aAAa,IAC9D,iBAAiB,aAAjB,iBAAiB;YAAjB,iBAAiB,CAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC5C,oBAAC,cAAc,oBACT,IAAI,IACR,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,sBAAsB,EAC9B,WAAW,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE;oBAC3B,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;gBACjC,CAAC,IACD,CACH,CAAC,EACD,iBAAiB,aAAjB,iBAAiB;YAAjB,iBAAiB,CAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAC5C,oBAAC,cAAc,oBACT,IAAI,IACR,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EACf,WAAW,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE;oBAC3B,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;gBACjC,CAAC,IACD,CACH,CAAC,CACI,CACO,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { merge, Stack } from '@fluentui/react';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { _DrawerSurfaceProps } from '.';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport { BaseCustomStyles } from '../../types';\nimport { DrawerMenuItem, _DrawerMenuItemProps } from './DrawerMenuItem';\nimport { _DrawerSurface, _DrawerSurfaceStyles } from './DrawerSurface';\n\n/**\n * Styles for the {@link _DrawerMenu}.\n *\n * @internal\n */\nexport interface _DrawerMenuStyles extends BaseCustomStyles {\n /** Styles for the {@link DrawerSurface} container. */\n drawerSurfaceStyles?: _DrawerSurfaceStyles;\n}\n\n/**\n * Props for the {@link _DrawerMenu}\n *\n * @internal\n */\nexport interface _DrawerMenuProps {\n items: _DrawerMenuItemProps[];\n\n /**\n * Callback when the drawer's light-dismissal is triggered.\n */\n onLightDismiss: () => void;\n\n /**\n * String to show in heading of drawer menu\n */\n heading?: string;\n\n /**\n * By default, maxHeight value is set to 75%.\n * Set value to true for no default maxHeight to be applied on drawerSurface\n */\n disableMaxHeight?: boolean;\n\n styles?: _DrawerMenuStyles;\n}\n\n/**\n * Takes a set of menu items and returns a created menu inside a {@link _DrawerSurface}.\n *\n * @internal\n */\nexport const _DrawerMenu = (props: _DrawerMenuProps): JSX.Element => {\n // This component breaks from a pure component pattern in order to internally support sub menus.\n // When a sub menu item is clicked the menu items displayed is updated to be that of the submenu.\n // To track this state we store a list of the keys clicked up until this point.\n const [selectedKeyPath, setSelectedKeyPath] = useState<string[]>([]);\n\n // Get the menu items that should be rendered\n const menuItemsToRender = useMemo(() => {\n let items: _DrawerMenuItemProps[] | undefined = props.items;\n for (const subMenuKey of selectedKeyPath) {\n items = items?.find((item) => item.itemKey === subMenuKey)?.subMenuProps;\n }\n return items;\n }, [props.items, selectedKeyPath]);\n\n // When an item is clicked and it contains a submenu, push the key for the submenu. This will ensure\n // a new render is triggered, menuItemsToRender will be re-calculated and the submenu will render.\n const onItemClick = useCallback(\n (\n item: _DrawerMenuItemProps,\n ev?: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement> | undefined,\n itemKey?: string | undefined\n ): void => {\n if (item.subMenuProps) {\n setSelectedKeyPath([...selectedKeyPath, item.itemKey]);\n }\n\n item.onItemClick?.(ev, itemKey);\n },\n [selectedKeyPath]\n );\n\n // Ensure the first item has a border radius that matches the DrawerSurface\n const borderRadius = useTheme().effects.roundedCorner4;\n const firstItemStyle = menuItemsToRender && menuItemsToRender[0]?.styles;\n const modifiedFirstItemStyle = useMemo(\n () =>\n merge(firstItemStyle ?? {}, {\n root: {\n borderTopRightRadius: borderRadius,\n borderTopLeftRadius: borderRadius\n }\n }),\n [firstItemStyle, borderRadius]\n );\n\n return (\n <_DrawerSurface\n disableMaxHeight={props.disableMaxHeight}\n styles={props.styles?.drawerSurfaceStyles}\n onLightDismiss={props.onLightDismiss}\n heading={props.heading}\n >\n <Stack styles={props.styles} role=\"menu\" data-ui-id=\"drawer-menu\">\n {menuItemsToRender?.slice(0, 1).map((item) => (\n <DrawerMenuItem\n {...item}\n key={'0'}\n styles={modifiedFirstItemStyle}\n onItemClick={(ev, itemKey) => {\n onItemClick(item, ev, itemKey);\n }}\n />\n ))}\n {menuItemsToRender?.slice(1).map((item, i) => (\n <DrawerMenuItem\n {...item}\n key={`${i + 1}`}\n onItemClick={(ev, itemKey) => {\n onItemClick(item, ev, itemKey);\n }}\n />\n ))}\n </Stack>\n </_DrawerSurface>\n );\n};\n"]}
1
+ {"version":3,"file":"DrawerMenu.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Drawer/DrawerMenu.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAuCvE;;;;GAIG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,EAAE,OAAO,CAAC,CAAC;gBACjC,CAAC,IACD,CACH,CAAC,CACI,CACO,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { merge, Stack } from '@fluentui/react';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { _DrawerSurfaceProps } from '.';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport { BaseCustomStyles } from '../../types';\nimport { DrawerMenuItem, _DrawerMenuItemProps } from './DrawerMenuItem';\nimport { _DrawerSurface, _DrawerSurfaceStyles } from './DrawerSurface';\n\n/**\n * Styles for the {@link _DrawerMenu}.\n *\n * @internal\n */\nexport interface _DrawerMenuStyles extends BaseCustomStyles {\n /** Styles for the {@link DrawerSurface} container. */\n drawerSurfaceStyles?: _DrawerSurfaceStyles;\n}\n\n/**\n * Props for the {@link _DrawerMenu}\n *\n * @internal\n */\nexport interface _DrawerMenuProps {\n items: _DrawerMenuItemProps[];\n\n /**\n * Callback when the drawer's light-dismissal is triggered.\n */\n onLightDismiss: () => void;\n\n /**\n * String to show in heading of drawer menu\n */\n heading?: string;\n\n /**\n * By default, maxHeight value is set to 75%.\n * Set value to true for no default maxHeight to be applied on drawerSurface\n */\n disableMaxHeight?: boolean;\n\n styles?: _DrawerMenuStyles;\n}\n\n/**\n * Takes a set of menu items and returns a created menu inside a {@link _DrawerSurface}.\n *\n * @internal\n */\nexport const _DrawerMenu = (props: _DrawerMenuProps): JSX.Element => {\n // This component breaks from a pure component pattern in order to internally support sub menus.\n // When a sub menu item is clicked the menu items displayed is updated to be that of the submenu.\n // To track this state we store a list of the keys clicked up until this point.\n const [selectedKeyPath, setSelectedKeyPath] = useState<string[]>([]);\n\n // Get the menu items that should be rendered\n const menuItemsToRender = useMemo(() => {\n let items: _DrawerMenuItemProps[] | undefined = props.items;\n for (const subMenuKey of selectedKeyPath) {\n items = items?.find((item) => item.itemKey === subMenuKey)?.subMenuProps;\n }\n return items;\n }, [props.items, selectedKeyPath]);\n\n // When an item is clicked and it contains a submenu, push the key for the submenu. This will ensure\n // a new render is triggered, menuItemsToRender will be re-calculated and the submenu will render.\n const onItemClick = useCallback(\n (\n item: _DrawerMenuItemProps,\n ev?: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement> | undefined,\n itemKey?: string | undefined\n ): void => {\n if (item.subMenuProps) {\n setSelectedKeyPath([...selectedKeyPath, item.itemKey]);\n }\n\n item.onItemClick?.(ev, itemKey);\n },\n [selectedKeyPath]\n );\n\n // Ensure the first item has a border radius that matches the DrawerSurface\n const borderRadius = useTheme().effects.roundedCorner4;\n const firstItemStyle = menuItemsToRender && menuItemsToRender[0]?.styles;\n const modifiedFirstItemStyle = useMemo(\n () =>\n merge(firstItemStyle ?? {}, {\n root: {\n borderTopRightRadius: borderRadius,\n borderTopLeftRadius: borderRadius\n }\n }),\n [firstItemStyle, borderRadius]\n );\n\n return (\n <_DrawerSurface\n disableMaxHeight={props.disableMaxHeight}\n styles={props.styles?.drawerSurfaceStyles}\n onLightDismiss={props.onLightDismiss}\n heading={props.heading}\n >\n <Stack styles={props.styles} role=\"menu\" data-ui-id=\"drawer-menu\">\n {menuItemsToRender?.slice(0, 1).map((item) => (\n <DrawerMenuItem\n {...item}\n key={`${item.itemKey}` + '0'}\n shouldFocusOnMount={true}\n styles={modifiedFirstItemStyle}\n onItemClick={(ev, itemKey) => {\n onItemClick(item, ev, itemKey);\n }}\n />\n ))}\n {menuItemsToRender?.slice(1).map((item, i) => (\n <DrawerMenuItem\n {...item}\n key={`${item.itemKey}` + `${i + 1}`}\n onItemClick={(ev, itemKey) => {\n onItemClick(item, ev, itemKey);\n }}\n />\n ))}\n </Stack>\n </_DrawerSurface>\n );\n};\n"]}
@@ -33,6 +33,10 @@ export interface _DrawerMenuItemProps {
33
33
  * A unique id set for the standard HTML id attibute
34
34
  */
35
35
  id?: string;
36
+ /**
37
+ * Property to set the focus since this is the first item in the menu
38
+ */
39
+ shouldFocusOnMount?: boolean;
36
40
  }
37
41
  /**
38
42
  * Maps the individual item in menuProps.items passed in the {@link DrawerMenu} into a UI component.
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { FontIcon, mergeStyles, Stack, Text } from '@fluentui/react';
3
+ import { FocusZone, FontIcon, mergeStyles, Stack, Text } from '@fluentui/react';
4
4
  import React from 'react';
5
5
  import { useTheme } from '../../theming/FluentThemeProvider';
6
6
  import { submitWithKeyboard } from '../utils/keyboardNavigation';
@@ -15,17 +15,18 @@ export const DrawerMenuItem = (props) => {
15
15
  const onClick = (ev) => props.onItemClick && props.onItemClick(ev, props.itemKey);
16
16
  const onKeyPress = (ev) => onClick && submitWithKeyboard(ev, onClick);
17
17
  const secondaryIcon = props.secondaryIconProps ? (React.createElement(MenuItemIcon, Object.assign({}, props.secondaryIconProps))) : props.subMenuProps ? (React.createElement(MenuItemIcon, { iconName: "ChevronRight" })) : undefined;
18
- return (React.createElement(Stack, { tabIndex: 0, role: "menuitem", horizontal: true, className: mergeStyles(drawerMenuItemRootStyles(theme.palette.neutralLight, theme.fonts.small), props.disabled ? disabledDrawerMenuItemRootStyles(theme.palette.neutralQuaternaryAlt) : undefined, (_a = props.styles) === null || _a === void 0 ? void 0 : _a.root), onKeyPress: props.disabled ? undefined : onKeyPress, onClick: props.disabled ? undefined : onClick, tokens: menuItemChildrenGap, id: props.id },
19
- props.iconProps && (React.createElement(Stack.Item, { role: "presentation", styles: props.disabled ? { root: { color: theme.palette.neutralTertiaryAlt } } : undefined },
20
- React.createElement(MenuItemIcon, Object.assign({}, props.iconProps)))),
21
- React.createElement(Stack.Item, { styles: drawerMenuItemTextStyles, grow: true },
22
- React.createElement(Text, { styles: props.disabled ? { root: { color: theme.palette.neutralTertiaryAlt } } : undefined }, props.text)),
23
- props.secondaryText && (React.createElement(Stack.Item, { styles: drawerMenuItemTextStyles, className: mergeStyles(secondaryTextStyles) },
24
- React.createElement(Text, { styles: {
25
- root: { color: props.disabled ? theme.palette.neutralTertiaryAlt : theme.palette.neutralSecondary }
26
- } }, props.secondaryText))),
27
- props.secondaryComponent && React.createElement(Stack.Item, null, props.secondaryComponent),
28
- secondaryIcon && React.createElement(Stack.Item, null, secondaryIcon)));
18
+ return (React.createElement(FocusZone, { shouldFocusOnMount: props.shouldFocusOnMount },
19
+ React.createElement(Stack, { tabIndex: 0, role: "menuitem", horizontal: true, className: mergeStyles(drawerMenuItemRootStyles(theme.palette.neutralLight, theme.fonts.small), props.disabled ? disabledDrawerMenuItemRootStyles(theme.palette.neutralQuaternaryAlt) : undefined, (_a = props.styles) === null || _a === void 0 ? void 0 : _a.root), onKeyPress: props.disabled ? undefined : onKeyPress, onClick: props.disabled ? undefined : onClick, tokens: menuItemChildrenGap, id: props.id },
20
+ props.iconProps && (React.createElement(Stack.Item, { role: "presentation", styles: props.disabled ? { root: { color: theme.palette.neutralTertiaryAlt } } : undefined },
21
+ React.createElement(MenuItemIcon, Object.assign({}, props.iconProps)))),
22
+ React.createElement(Stack.Item, { styles: drawerMenuItemTextStyles, grow: true },
23
+ React.createElement(Text, { styles: props.disabled ? { root: { color: theme.palette.neutralTertiaryAlt } } : undefined }, props.text)),
24
+ props.secondaryText && (React.createElement(Stack.Item, { styles: drawerMenuItemTextStyles, className: mergeStyles(secondaryTextStyles) },
25
+ React.createElement(Text, { styles: {
26
+ root: { color: props.disabled ? theme.palette.neutralTertiaryAlt : theme.palette.neutralSecondary }
27
+ } }, props.secondaryText))),
28
+ props.secondaryComponent && React.createElement(Stack.Item, null, props.secondaryComponent),
29
+ secondaryIcon && React.createElement(Stack.Item, null, secondaryIcon))));
29
30
  };
30
31
  const MenuItemIcon = (props) => (React.createElement(FontIcon, Object.assign({ className: mergeStyles(iconStyles) }, props)));
31
32
  const menuItemChildrenGap = { childrenGap: '0.5rem' };
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerMenuItem.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components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MAAM,EAAE,MAAM;KACf;CACF,CAAC;AAEF,MAAM,mBAAmB,GAAW;IAClC,2FAA2F;IAC3F,QAAQ,EAAE,KAAK;CAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n FontIcon,\n IFontIconProps,\n IIconProps,\n IRawStyle,\n IStackStyles,\n IStyle,\n mergeStyles,\n Stack,\n Text\n} from '@fluentui/react';\nimport React from 'react';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport { BaseCustomStyles } from '../../types';\nimport { submitWithKeyboard } from '../utils/keyboardNavigation';\n\n/**\n * Props for the DrawerMenuItem\n *\n * @internal\n */\nexport interface _DrawerMenuItemProps {\n onItemClick?: (ev?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, itemKey?: string) => void;\n itemKey: string;\n /** Text that shows at the start of the menu item after any icon supplied */\n text?: string;\n /** Text that shows at the end of the menu item before any secondaryIcon is supplied */\n secondaryText?: string;\n /** A component that shows at the end of the menu item before any secondaryIcon is supplied */\n secondaryComponent?: JSX.Element;\n /** Icon shown at the start of the menu item (before the menu item text) */\n iconProps?: IIconProps;\n /**\n * Icon shown at the end of the menu item.\n * By default if this component has subMenuProps, this icon is the RightChevron.\n */\n secondaryIconProps?: IIconProps;\n styles?: BaseCustomStyles;\n subMenuProps?: _DrawerMenuItemProps[];\n /**\n * Whether the menu item is disabled\n * @defaultvalue false\n */\n disabled?: boolean;\n /**\n * A unique id set for the standard HTML id attibute\n */\n id?: string;\n}\n\n/**\n * Maps the individual item in menuProps.items passed in the {@link DrawerMenu} into a UI component.\n *\n * @private\n */\nexport const DrawerMenuItem = (props: _DrawerMenuItemProps): JSX.Element => {\n const theme = useTheme();\n const onClick = (ev?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>): void =>\n props.onItemClick && props.onItemClick(ev, props.itemKey);\n const onKeyPress = (ev: React.KeyboardEvent<HTMLElement>): void => onClick && submitWithKeyboard(ev, onClick);\n\n const secondaryIcon = props.secondaryIconProps ? (\n <MenuItemIcon {...props.secondaryIconProps} />\n ) : props.subMenuProps ? (\n <MenuItemIcon iconName=\"ChevronRight\" />\n ) : undefined;\n\n return (\n <Stack\n tabIndex={0}\n role=\"menuitem\"\n horizontal\n className={mergeStyles(\n drawerMenuItemRootStyles(theme.palette.neutralLight, theme.fonts.small),\n props.disabled ? disabledDrawerMenuItemRootStyles(theme.palette.neutralQuaternaryAlt) : undefined,\n props.styles?.root\n )}\n onKeyPress={props.disabled ? undefined : onKeyPress}\n onClick={props.disabled ? undefined : onClick}\n tokens={menuItemChildrenGap}\n id={props.id}\n >\n {props.iconProps && (\n <Stack.Item\n role=\"presentation\"\n styles={props.disabled ? { root: { color: theme.palette.neutralTertiaryAlt } } : undefined}\n >\n <MenuItemIcon {...props.iconProps} />\n </Stack.Item>\n )}\n <Stack.Item styles={drawerMenuItemTextStyles} grow>\n <Text styles={props.disabled ? { root: { color: theme.palette.neutralTertiaryAlt } } : undefined}>\n {props.text}\n </Text>\n </Stack.Item>\n {props.secondaryText && (\n <Stack.Item styles={drawerMenuItemTextStyles} className={mergeStyles(secondaryTextStyles)}>\n <Text\n styles={{\n root: { color: props.disabled ? theme.palette.neutralTertiaryAlt : theme.palette.neutralSecondary }\n }}\n >\n {props.secondaryText}\n </Text>\n </Stack.Item>\n )}\n {props.secondaryComponent && <Stack.Item>{props.secondaryComponent}</Stack.Item>}\n {secondaryIcon && <Stack.Item>{secondaryIcon}</Stack.Item>}\n </Stack>\n );\n};\n\nconst MenuItemIcon = (props: IFontIconProps): JSX.Element => (\n <FontIcon className={mergeStyles(iconStyles)} {...props} />\n);\n\nconst menuItemChildrenGap = { childrenGap: '0.5rem' };\n\nconst drawerMenuItemRootStyles = (hoverBackground: string, fontSize: IRawStyle): IStyle => ({\n ...fontSize,\n height: '3rem',\n lineHeight: '3rem',\n padding: '0rem 0.75rem',\n cursor: 'pointer',\n ':hover, :focus': {\n background: hoverBackground\n }\n});\n\nconst disabledDrawerMenuItemRootStyles = (background: string): IStyle => ({\n pointerEvents: 'none',\n background: background,\n ':hover, :focus': {\n background: background\n }\n});\n\n/** Ensure long text entries appropriately show ellipsis instead of wrapping to a new line or showing a scrollbar */\nconst drawerMenuItemTextStyles: IStackStyles = {\n root: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap'\n }\n};\n\nconst iconStyles: IStyle = {\n // Vertically center icons in the menu item. Using line-height does not work for centering fluent SVG icons.\n display: 'flex',\n alignItems: 'center',\n height: '100%',\n\n // This can be removed when we upgrade to fluent-react-icons v2 (that removes the inner span element)\n ' span': {\n display: 'flex',\n alignItems: 'center',\n height: '100%'\n }\n};\n\nconst secondaryTextStyles: IStyle = {\n // limit width for secondaryText in the menu item so it does not overlap with text on left.\n maxWidth: '50%'\n};\n"]}
1
+ {"version":3,"file":"DrawerMenuItem.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Drawer/DrawerMenuItem.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,SAAS,EACT,QAAQ,EAMR,WAAW,EACX,KAAK,EACL,IAAI,EACL,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAwCjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA2B,EAAe,EAAE;;IACzE,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,CAAC,EAAqE,EAAQ,EAAE,CAC9F,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,CAAC,EAAoC,EAAQ,EAAE,CAAC,OAAO,IAAI,kB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EACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,EACjB,gBAAgB,EAAE;QAChB,UAAU,EAAE,eAAe;KAC5B,IACD,CAAC;AAEH,MAAM,gCAAgC,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,CAAC;IACxE,aAAa,EAAE,MAAM;IACrB,UAAU,EAAE,UAAU;IACtB,gBAAgB,EAAE;QAChB,UAAU,EAAE,UAAU;KACvB;CACF,CAAC,CAAC;AAEH,oHAAoH;AACpH,MAAM,wBAAwB,GAAiB;IAC7C,IAAI,EAAE;QACJ,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,UAAU;QACxB,UAAU,EAAE,QAAQ;KACrB;CACF,CAAC;AAEF,MAAM,UAAU,GAAW;IACzB,4GAA4G;IAC5G,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,MAAM;IAEd,qGAAqG;IACrG,OAAO,EAAE;QACP,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,MAAM,EAAE,MAAM;KACf;CACF,CAAC;AAEF,MAAM,mBAAmB,GAAW;IAClC,2FAA2F;IAC3F,QAAQ,EAAE,KAAK;CAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n FocusZone,\n FontIcon,\n IFontIconProps,\n IIconProps,\n IRawStyle,\n IStackStyles,\n IStyle,\n mergeStyles,\n Stack,\n Text\n} from '@fluentui/react';\nimport React from 'react';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport { BaseCustomStyles } from '../../types';\nimport { submitWithKeyboard } from '../utils/keyboardNavigation';\n\n/**\n * Props for the DrawerMenuItem\n *\n * @internal\n */\nexport interface _DrawerMenuItemProps {\n onItemClick?: (ev?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, itemKey?: string) => void;\n itemKey: string;\n /** Text that shows at the start of the menu item after any icon supplied */\n text?: string;\n /** Text that shows at the end of the menu item before any secondaryIcon is supplied */\n secondaryText?: string;\n /** A component that shows at the end of the menu item before any secondaryIcon is supplied */\n secondaryComponent?: JSX.Element;\n /** Icon shown at the start of the menu item (before the menu item text) */\n iconProps?: IIconProps;\n /**\n * Icon shown at the end of the menu item.\n * By default if this component has subMenuProps, this icon is the RightChevron.\n */\n secondaryIconProps?: IIconProps;\n styles?: BaseCustomStyles;\n subMenuProps?: _DrawerMenuItemProps[];\n /**\n * Whether the menu item is disabled\n * @defaultvalue false\n */\n disabled?: boolean;\n /**\n * A unique id set for the standard HTML id attibute\n */\n id?: string;\n /**\n * Property to set the focus since this is the first item in the menu\n */\n shouldFocusOnMount?: boolean;\n}\n\n/**\n * Maps the individual item in menuProps.items passed in the {@link DrawerMenu} into a UI component.\n *\n * @private\n */\nexport const DrawerMenuItem = (props: _DrawerMenuItemProps): JSX.Element => {\n const theme = useTheme();\n const onClick = (ev?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>): void =>\n props.onItemClick && props.onItemClick(ev, props.itemKey);\n const onKeyPress = (ev: React.KeyboardEvent<HTMLElement>): void => onClick && submitWithKeyboard(ev, onClick);\n\n const secondaryIcon = props.secondaryIconProps ? (\n <MenuItemIcon {...props.secondaryIconProps} />\n ) : props.subMenuProps ? (\n <MenuItemIcon iconName=\"ChevronRight\" />\n ) : undefined;\n\n return (\n <FocusZone shouldFocusOnMount={props.shouldFocusOnMount}>\n <Stack\n tabIndex={0}\n role=\"menuitem\"\n horizontal\n className={mergeStyles(\n drawerMenuItemRootStyles(theme.palette.neutralLight, theme.fonts.small),\n props.disabled ? disabledDrawerMenuItemRootStyles(theme.palette.neutralQuaternaryAlt) : undefined,\n props.styles?.root\n )}\n onKeyPress={props.disabled ? undefined : onKeyPress}\n onClick={props.disabled ? undefined : onClick}\n tokens={menuItemChildrenGap}\n id={props.id}\n >\n {props.iconProps && (\n <Stack.Item\n role=\"presentation\"\n styles={props.disabled ? { root: { color: theme.palette.neutralTertiaryAlt } } : undefined}\n >\n <MenuItemIcon {...props.iconProps} />\n </Stack.Item>\n )}\n <Stack.Item styles={drawerMenuItemTextStyles} grow>\n <Text styles={props.disabled ? { root: { color: theme.palette.neutralTertiaryAlt } } : undefined}>\n {props.text}\n </Text>\n </Stack.Item>\n {props.secondaryText && (\n <Stack.Item styles={drawerMenuItemTextStyles} className={mergeStyles(secondaryTextStyles)}>\n <Text\n styles={{\n root: { color: props.disabled ? theme.palette.neutralTertiaryAlt : theme.palette.neutralSecondary }\n }}\n >\n {props.secondaryText}\n </Text>\n </Stack.Item>\n )}\n {props.secondaryComponent && <Stack.Item>{props.secondaryComponent}</Stack.Item>}\n {secondaryIcon && <Stack.Item>{secondaryIcon}</Stack.Item>}\n </Stack>\n </FocusZone>\n );\n};\n\nconst MenuItemIcon = (props: IFontIconProps): JSX.Element => (\n <FontIcon className={mergeStyles(iconStyles)} {...props} />\n);\n\nconst menuItemChildrenGap = { childrenGap: '0.5rem' };\n\nconst drawerMenuItemRootStyles = (hoverBackground: string, fontSize: IRawStyle): IStyle => ({\n ...fontSize,\n height: '3rem',\n lineHeight: '3rem',\n padding: '0rem 0.75rem',\n cursor: 'pointer',\n ':hover, :focus': {\n background: hoverBackground\n }\n});\n\nconst disabledDrawerMenuItemRootStyles = (background: string): IStyle => ({\n pointerEvents: 'none',\n background: background,\n ':hover, :focus': {\n background: background\n }\n});\n\n/** Ensure long text entries appropriately show ellipsis instead of wrapping to a new line or showing a scrollbar */\nconst drawerMenuItemTextStyles: IStackStyles = {\n root: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap'\n }\n};\n\nconst iconStyles: IStyle = {\n // Vertically center icons in the menu item. Using line-height does not work for centering fluent SVG icons.\n display: 'flex',\n alignItems: 'center',\n height: '100%',\n\n // This can be removed when we upgrade to fluent-react-icons v2 (that removes the inner span element)\n ' span': {\n display: 'flex',\n alignItems: 'center',\n height: '100%'\n }\n};\n\nconst secondaryTextStyles: IStyle = {\n // limit width for secondaryText in the menu item so it does not overlap with text on left.\n maxWidth: '50%'\n};\n"]}
@@ -22,7 +22,7 @@ import { Features } from '@azure/communication-calling';
22
22
  import { EventEmitter } from 'events';
23
23
  import { getCallCompositePage, IsCallEndedPage, isCameraOn } from '../utils';
24
24
  import { toFlatCommunicationIdentifier, _toCommunicationIdentifier, _isValidIdentifier } from "../../../../../acs-ui-common/src";
25
- import { isCommunicationUserIdentifier, isPhoneNumberIdentifier } from '@azure/communication-common';
25
+ import { isCommunicationUserIdentifier, isPhoneNumberIdentifier, isMicrosoftTeamsAppIdentifier, isMicrosoftTeamsUserIdentifier } from '@azure/communication-common';
26
26
  import { ParticipantSubscriber } from './ParticipantSubcriber';
27
27
  import { DiagnosticsForwarder } from './DiagnosticsForwarder';
28
28
  import { useEffect, useRef, useState } from 'react';
@@ -699,8 +699,6 @@ export class AzureCommunicationCallAdapter {
699
699
  throw new Error('You are already in the call.');
700
700
  }
701
701
  const idsToAdd = participants.map((participant) => {
702
- // FIXME: `onStartCall` does not allow a Teams user.
703
- // Need some way to return an error if a Teams user is provided.
704
702
  const backendId = _toCommunicationIdentifier(participant);
705
703
  if (isPhoneNumberIdentifier(backendId)) {
706
704
  if ((options === null || options === void 0 ? void 0 : options.alternateCallerId) === undefined) {
@@ -711,6 +709,12 @@ export class AzureCommunicationCallAdapter {
711
709
  else if (isCommunicationUserIdentifier(backendId)) {
712
710
  return backendId;
713
711
  }
712
+ else if (isMicrosoftTeamsAppIdentifier(backendId)) {
713
+ return backendId;
714
+ }
715
+ else if (isMicrosoftTeamsUserIdentifier(backendId)) {
716
+ return backendId;
717
+ }
714
718
  return backendId;
715
719
  });
716
720
  const call = this.handlers.onStartCall(idsToAdd, options);