Skip to content

Commit

Permalink
chore(react-menu): adopt custom JSX pragma (#27544)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsunderhus authored Apr 15, 2023
1 parent 0dfc7e1 commit 2dd9874
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: adopt custom JSX pragma",
"packageName": "@fluentui/react-menu",
"email": "bernardo.sunderhus@gmail.com",
"dependentChangeType": "patch"
}
1 change: 1 addition & 0 deletions packages/react-components/react-menu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@fluentui/react-tabster": "^9.6.4",
"@fluentui/react-theme": "^9.1.7",
"@fluentui/react-utilities": "^9.7.4",
"@fluentui/react-jsx-runtime": "^9.0.0-alpha.0",
"@griffel/react": "^1.5.2",
"@swc/helpers": "^0.4.14"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
/** @jsxRuntime classic */
/** @jsx createElement */

import { createElement } from '@fluentui/react-jsx-runtime';
import { getSlotsNext } from '@fluentui/react-utilities';
import { MenuDividerSlots, MenuDividerState } from './MenuDivider.types';

/**
* Redefine the render function to add slots. Reuse the menudivider structure but add
* slots to children.
*/
export const renderMenuDivider_unstable = (state: MenuDividerState) => {
const { slots, slotProps } = getSlots<MenuDividerSlots>(state);
const { slots, slotProps } = getSlotsNext<MenuDividerSlots>(state);

return <slots.root {...slotProps.root} />;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
/** @jsxRuntime classic */
/** @jsx createElement */

import { createElement } from '@fluentui/react-jsx-runtime';
import { getSlotsNext } from '@fluentui/react-utilities';
import { MenuGroupContextValues, MenuGroupSlots, MenuGroupState } from './MenuGroup.types';
import { MenuGroupContextProvider } from '../../contexts/menuGroupContext';

Expand All @@ -8,7 +11,7 @@ import { MenuGroupContextProvider } from '../../contexts/menuGroupContext';
* slots to children.
*/
export const renderMenuGroup_unstable = (state: MenuGroupState, contextValues: MenuGroupContextValues) => {
const { slots, slotProps } = getSlots<MenuGroupSlots>(state);
const { slots, slotProps } = getSlotsNext<MenuGroupSlots>(state);

return (
<MenuGroupContextProvider value={contextValues.menuGroup}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
/** @jsxRuntime classic */
/** @jsx createElement */

import { createElement } from '@fluentui/react-jsx-runtime';
import { getSlotsNext } from '@fluentui/react-utilities';
import { MenuGroupHeaderSlots, MenuGroupHeaderState } from './MenuGroupHeader.types';

/**
* Redefine the render function to add slots. Reuse the menugroupheader structure but add
* slots to children.
*/
export const renderMenuGroupHeader_unstable = (state: MenuGroupHeaderState) => {
const { slots, slotProps } = getSlots<MenuGroupHeaderSlots>(state);
const { slots, slotProps } = getSlotsNext<MenuGroupHeaderSlots>(state);

return <slots.root {...slotProps.root} />;
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
/** @jsxRuntime classic */
/** @jsx createElement */

import { createElement } from '@fluentui/react-jsx-runtime';
import { getSlotsNext } from '@fluentui/react-utilities';
import type { MenuItemSlots, MenuItemState } from './MenuItem.types';

/**
* Function that renders the final JSX of the component
*/
export const renderMenuItem_unstable = (state: MenuItemState) => {
const { slots, slotProps } = getSlots<MenuItemSlots>(state);
const { slots, slotProps } = getSlotsNext<MenuItemSlots>(state);

return (
<slots.root {...slotProps.root}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
/** @jsxRuntime classic */
/** @jsx createElement */

import { createElement } from '@fluentui/react-jsx-runtime';
import { getSlotsNext } from '@fluentui/react-utilities';
import type { MenuItemCheckboxState } from './MenuItemCheckbox.types';
import type { MenuItemSlots } from '../MenuItem/MenuItem.types';

/** Function that renders the final JSX of the component */
export const renderMenuItemCheckbox_unstable = (state: MenuItemCheckboxState) => {
const { slots, slotProps } = getSlots<MenuItemSlots>(state);
const { slots, slotProps } = getSlotsNext<MenuItemSlots>(state);

return (
<slots.root {...slotProps.root}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
/** @jsxRuntime classic */
/** @jsx createElement */

import { createElement } from '@fluentui/react-jsx-runtime';
import { getSlotsNext } from '@fluentui/react-utilities';
import type { MenuItemRadioState } from './MenuItemRadio.types';
import type { MenuItemSlots } from '../MenuItem/MenuItem.types';

Expand All @@ -8,7 +11,7 @@ import type { MenuItemSlots } from '../MenuItem/MenuItem.types';
* slots to children.
*/
export const renderMenuItemRadio_unstable = (state: MenuItemRadioState) => {
const { slots, slotProps } = getSlots<MenuItemSlots>(state);
const { slots, slotProps } = getSlotsNext<MenuItemSlots>(state);

return (
<slots.root {...slotProps.root}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
/** @jsxRuntime classic */
/** @jsx createElement */

import { createElement } from '@fluentui/react-jsx-runtime';
import { getSlotsNext } from '@fluentui/react-utilities';
import { MenuListContextValues, MenuListSlots, MenuListState } from './MenuList.types';
import { MenuListProvider } from '../../contexts/menuListContext';

/**
* Function that renders the final JSX of the component
*/
export const renderMenuList_unstable = (state: MenuListState, contextValues: MenuListContextValues) => {
const { slots, slotProps } = getSlots<MenuListSlots>(state);
const { slots, slotProps } = getSlotsNext<MenuListSlots>(state);

return (
<MenuListProvider value={contextValues.menuList}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
/** @jsxRuntime classic */
/** @jsx createElement */

import { createElement } from '@fluentui/react-jsx-runtime';
import { getSlotsNext } from '@fluentui/react-utilities';
import { MenuPopoverSlots, MenuPopoverState } from './MenuPopover.types';
import { Portal } from '@fluentui/react-portal';

/**
* Render the final JSX of MenuPopover
*/
export const renderMenuPopover_unstable = (state: MenuPopoverState) => {
const { slots, slotProps } = getSlots<MenuPopoverSlots>(state);
const { slots, slotProps } = getSlotsNext<MenuPopoverSlots>(state);

if (state.inline) {
return <slots.root {...slotProps.root} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import * as React from 'react';
import { getSlots } from '@fluentui/react-utilities';
/** @jsxRuntime classic */
/** @jsx createElement */

import { createElement } from '@fluentui/react-jsx-runtime';
import { getSlotsNext } from '@fluentui/react-utilities';
import type { MenuSplitGroupState, MenuSplitGroupSlots } from './MenuSplitGroup.types';

/**
* Render the final JSX of MenuSplitGroup
*/
export const renderMenuSplitGroup_unstable = (state: MenuSplitGroupState) => {
const { slots, slotProps } = getSlots<MenuSplitGroupSlots>(state);
const { slots, slotProps } = getSlotsNext<MenuSplitGroupSlots>(state);

return <slots.root {...slotProps.root} />;
};

0 comments on commit 2dd9874

Please sign in to comment.