@fluentui/react-menu-grid-preview 0.0.0-nightly-20250918-0406.1 → 0.0.0-nightly-20250922-0406.1

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.md CHANGED
@@ -1,26 +1,26 @@
1
1
  # Change Log - @fluentui/react-menu-grid-preview
2
2
 
3
- This log was last generated on Thu, 18 Sep 2025 04:21:39 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 22 Sep 2025 04:21:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20250918-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu-grid-preview_v0.0.0-nightly-20250918-0406.1)
7
+ ## [0.0.0-nightly-20250922-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu-grid-preview_v0.0.0-nightly-20250922-0406.1)
8
8
 
9
- Thu, 18 Sep 2025 04:21:39 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-menu-grid-preview_v0.1.1..@fluentui/react-menu-grid-preview_v0.0.0-nightly-20250918-0406.1)
9
+ Mon, 22 Sep 2025 04:21:51 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-menu-grid-preview_v0.1.1..@fluentui/react-menu-grid-preview_v0.0.0-nightly-20250922-0406.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-menu to v0.0.0-nightly-20250918-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/52f253b6e76a0f105dd37ddbdd3fa42183137ec3) by beachball)
16
- - Bump @fluentui/react-table to v0.0.0-nightly-20250918-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/52f253b6e76a0f105dd37ddbdd3fa42183137ec3) by beachball)
17
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20250918-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/52f253b6e76a0f105dd37ddbdd3fa42183137ec3) by beachball)
18
- - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20250918-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/52f253b6e76a0f105dd37ddbdd3fa42183137ec3) by beachball)
19
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20250918-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/52f253b6e76a0f105dd37ddbdd3fa42183137ec3) by beachball)
20
- - Bump @fluentui/react-theme to v0.0.0-nightly-20250918-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/52f253b6e76a0f105dd37ddbdd3fa42183137ec3) by beachball)
21
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20250918-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/52f253b6e76a0f105dd37ddbdd3fa42183137ec3) by beachball)
22
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20250918-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/52f253b6e76a0f105dd37ddbdd3fa42183137ec3) by beachball)
23
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20250918-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/52f253b6e76a0f105dd37ddbdd3fa42183137ec3) by beachball)
15
+ - Bump @fluentui/react-menu to v0.0.0-nightly-20250922-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/9f05569c664ddc5fbbd632f9376f9c3e00f44b96) by beachball)
16
+ - Bump @fluentui/react-table to v0.0.0-nightly-20250922-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/9f05569c664ddc5fbbd632f9376f9c3e00f44b96) by beachball)
17
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20250922-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/9f05569c664ddc5fbbd632f9376f9c3e00f44b96) by beachball)
18
+ - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20250922-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/9f05569c664ddc5fbbd632f9376f9c3e00f44b96) by beachball)
19
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20250922-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/9f05569c664ddc5fbbd632f9376f9c3e00f44b96) by beachball)
20
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20250922-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/9f05569c664ddc5fbbd632f9376f9c3e00f44b96) by beachball)
21
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20250922-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/9f05569c664ddc5fbbd632f9376f9c3e00f44b96) by beachball)
22
+ - Bump @fluentui/react-conformance to v0.0.0-nightly-20250922-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/9f05569c664ddc5fbbd632f9376f9c3e00f44b96) by beachball)
23
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20250922-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/9f05569c664ddc5fbbd632f9376f9c3e00f44b96) by beachball)
24
24
 
25
25
  ## [0.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu-grid-preview_v0.1.1)
26
26
 
@@ -1,10 +1,12 @@
1
1
  import * as React from 'react';
2
- import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
2
+ import { useMergedRefs, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
3
3
  import { useTableCompositeNavigation } from '@fluentui/react-table';
4
4
  import { useMenuContext_unstable } from '@fluentui/react-menu';
5
+ import { useValidateNesting } from '../../utils/useValidateNesting';
5
6
  /**
6
7
  * Returns the props and state required to render the component
7
8
  */ export const useMenuGrid_unstable = (props, ref)=>{
9
+ const validateNestingRef = useValidateNesting('MenuGrid');
8
10
  const triggerId = useMenuContext_unstable((context)=>context.triggerId);
9
11
  const { tableRowTabsterAttribute, tableTabsterAttribute, onTableKeyDown } = useTableCompositeNavigation();
10
12
  return {
@@ -12,7 +14,7 @@ import { useMenuContext_unstable } from '@fluentui/react-menu';
12
14
  root: 'div'
13
15
  },
14
16
  root: slot.always(getIntrinsicElementProps('div', {
15
- ref,
17
+ ref: useMergedRefs(ref, validateNestingRef),
16
18
  role: 'grid',
17
19
  'aria-labelledby': triggerId,
18
20
  onKeyDown: onTableKeyDown,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MenuGrid/useMenuGrid.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useTableCompositeNavigation } from '@fluentui/react-table';\nimport type { MenuGridProps, MenuGridState } from './MenuGrid.types';\nimport { useMenuContext_unstable } from '@fluentui/react-menu';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuGrid_unstable = (props: MenuGridProps, ref: React.Ref<HTMLDivElement>): MenuGridState => {\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const { tableRowTabsterAttribute, tableTabsterAttribute, onTableKeyDown } = useTableCompositeNavigation();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'grid',\n 'aria-labelledby': triggerId,\n onKeyDown: onTableKeyDown,\n ...tableTabsterAttribute,\n ...props,\n }),\n { elementType: 'div' },\n ),\n tableRowTabsterAttribute,\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useTableCompositeNavigation","useMenuContext_unstable","useMenuGrid_unstable","props","ref","triggerId","context","tableRowTabsterAttribute","tableTabsterAttribute","onTableKeyDown","components","root","always","role","onKeyDown","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAC3E,SAASC,2BAA2B,QAAQ,wBAAwB;AAEpE,SAASC,uBAAuB,QAAQ,uBAAuB;AAE/D;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC;IACzD,MAAMC,YAAYJ,wBAAwBK,CAAAA,UAAWA,QAAQD,SAAS;IACtE,MAAM,EAAEE,wBAAwB,EAAEC,qBAAqB,EAAEC,cAAc,EAAE,GAAGT;IAE5E,OAAO;QACLU,YAAY;YACVC,MAAM;QACR;QACAA,MAAMZ,KAAKa,MAAM,CACfd,yBAAyB,OAAO;YAC9BM;YACAS,MAAM;YACN,mBAAmBR;YACnBS,WAAWL;YACX,GAAGD,qBAAqB;YACxB,GAAGL,KAAK;QACV,IACA;YAAEY,aAAa;QAAM;QAEvBR;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/MenuGrid/useMenuGrid.ts"],"sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\n\nimport { useTableCompositeNavigation } from '@fluentui/react-table';\nimport type { MenuGridProps, MenuGridState } from './MenuGrid.types';\nimport { useMenuContext_unstable } from '@fluentui/react-menu';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuGrid_unstable = (props: MenuGridProps, ref: React.Ref<HTMLDivElement>): MenuGridState => {\n const validateNestingRef = useValidateNesting('MenuGrid');\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const { tableRowTabsterAttribute, tableTabsterAttribute, onTableKeyDown } = useTableCompositeNavigation();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, validateNestingRef),\n role: 'grid',\n 'aria-labelledby': triggerId,\n onKeyDown: onTableKeyDown,\n ...tableTabsterAttribute,\n ...props,\n }),\n { elementType: 'div' },\n ),\n tableRowTabsterAttribute,\n };\n};\n"],"names":["React","useMergedRefs","getIntrinsicElementProps","slot","useTableCompositeNavigation","useMenuContext_unstable","useValidateNesting","useMenuGrid_unstable","props","ref","validateNestingRef","triggerId","context","tableRowTabsterAttribute","tableTabsterAttribute","onTableKeyDown","components","root","always","role","onKeyDown","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAEC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAE1F,SAASC,2BAA2B,QAAQ,wBAAwB;AAEpE,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAASC,kBAAkB,QAAQ,iCAAiC;AAEpE;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC;IACzD,MAAMC,qBAAqBJ,mBAAmB;IAC9C,MAAMK,YAAYN,wBAAwBO,CAAAA,UAAWA,QAAQD,SAAS;IACtE,MAAM,EAAEE,wBAAwB,EAAEC,qBAAqB,EAAEC,cAAc,EAAE,GAAGX;IAE5E,OAAO;QACLY,YAAY;YACVC,MAAM;QACR;QACAA,MAAMd,KAAKe,MAAM,CACfhB,yBAAyB,OAAO;YAC9BO,KAAKR,cAAcQ,KAAKC;YACxBS,MAAM;YACN,mBAAmBR;YACnBS,WAAWL;YACX,GAAGD,qBAAqB;YACxB,GAAGN,KAAK;QACV,IACA;YAAEa,aAAa;QAAM;QAEvBR;IACF;AACF,EAAE"}
@@ -1,8 +1,10 @@
1
1
  import * as React from 'react';
2
- import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
2
+ import { useMergedRefs, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
3
+ import { useValidateNesting } from '../../utils/useValidateNesting';
3
4
  /**
4
5
  * Given user props, returns state and render function for a MenuGridCell.
5
6
  */ export function useMenuGridCell_unstable(props, ref) {
7
+ const validateNestingRef = useValidateNesting('MenuGridCell');
6
8
  const { visuallyHidden } = props;
7
9
  return {
8
10
  visuallyHidden,
@@ -10,7 +12,7 @@ import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
10
12
  root: 'div'
11
13
  },
12
14
  root: slot.always(getIntrinsicElementProps('div', {
13
- ref,
15
+ ref: useMergedRefs(ref, validateNestingRef),
14
16
  role: 'gridcell',
15
17
  ...props
16
18
  }), {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MenuGridCell/useMenuGridCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { MenuGridCellProps, MenuGridCellState } from './MenuGridCell.types';\n\n/**\n * Given user props, returns state and render function for a MenuGridCell.\n */\nexport function useMenuGridCell_unstable(props: MenuGridCellProps, ref: React.Ref<HTMLDivElement>): MenuGridCellState {\n const { visuallyHidden } = props;\n\n return {\n visuallyHidden,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'gridcell',\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n"],"names":["React","getIntrinsicElementProps","slot","useMenuGridCell_unstable","props","ref","visuallyHidden","components","root","always","role","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAG3E;;CAEC,GACD,OAAO,SAASC,yBAAyBC,KAAwB,EAAEC,GAA8B;IAC/F,MAAM,EAAEC,cAAc,EAAE,GAAGF;IAE3B,OAAO;QACLE;QACAC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMN,KAAKO,MAAM,CACfR,yBAAyB,OAAO;YAC9BI;YACAK,MAAM;YACN,GAAGN,KAAK;QACV,IACA;YAAEO,aAAa;QAAM;IAEzB;AACF"}
1
+ {"version":3,"sources":["../src/components/MenuGridCell/useMenuGridCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { MenuGridCellProps, MenuGridCellState } from './MenuGridCell.types';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\n/**\n * Given user props, returns state and render function for a MenuGridCell.\n */\nexport function useMenuGridCell_unstable(props: MenuGridCellProps, ref: React.Ref<HTMLDivElement>): MenuGridCellState {\n const validateNestingRef = useValidateNesting('MenuGridCell');\n const { visuallyHidden } = props;\n\n return {\n visuallyHidden,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, validateNestingRef),\n role: 'gridcell',\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n"],"names":["React","useMergedRefs","getIntrinsicElementProps","slot","useValidateNesting","useMenuGridCell_unstable","props","ref","validateNestingRef","visuallyHidden","components","root","always","role","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAEC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAE1F,SAASC,kBAAkB,QAAQ,iCAAiC;AAEpE;;CAEC,GACD,OAAO,SAASC,yBAAyBC,KAAwB,EAAEC,GAA8B;IAC/F,MAAMC,qBAAqBJ,mBAAmB;IAC9C,MAAM,EAAEK,cAAc,EAAE,GAAGH;IAE3B,OAAO;QACLG;QACAC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMR,KAAKS,MAAM,CACfV,yBAAyB,OAAO;YAC9BK,KAAKN,cAAcM,KAAKC;YACxBK,MAAM;YACN,GAAGP,KAAK;QACV,IACA;YAAEQ,aAAa;QAAM;IAEzB;AACF"}
@@ -1,11 +1,13 @@
1
1
  import * as React from 'react';
2
- import { slot } from '@fluentui/react-utilities';
2
+ import { useMergedRefs, slot } from '@fluentui/react-utilities';
3
3
  import { MenuGridCell } from './../MenuGridCell/MenuGridCell';
4
4
  import { MenuGridRow } from './../MenuGridRow/MenuGridRow';
5
+ import { useValidateNesting } from '../../utils/useValidateNesting';
5
6
  /**
6
7
  * Given user props, returns state and render function for a MenuGridItem.
7
8
  */ export function useMenuGridItem_unstable(props, ref) {
8
9
  const { icon, content: _content, subText, firstSubAction, secondSubAction, ...rest } = props;
10
+ const validateNestingRef = useValidateNesting('MenuGridItem');
9
11
  return {
10
12
  components: {
11
13
  root: MenuGridRow,
@@ -16,7 +18,7 @@ import { MenuGridRow } from './../MenuGridRow/MenuGridRow';
16
18
  secondSubAction: MenuGridCell
17
19
  },
18
20
  root: slot.always({
19
- ref,
21
+ ref: useMergedRefs(ref, validateNestingRef),
20
22
  ...rest
21
23
  }, {
22
24
  elementType: MenuGridRow
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MenuGridItem/useMenuGridItem.ts"],"sourcesContent":["import * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\n\nimport { MenuGridItemProps, MenuGridItemState } from './MenuGridItem.types';\nimport { MenuGridCell } from './../MenuGridCell/MenuGridCell';\nimport { MenuGridRow } from './../MenuGridRow/MenuGridRow';\n\n/**\n * Given user props, returns state and render function for a MenuGridItem.\n */\nexport function useMenuGridItem_unstable(props: MenuGridItemProps, ref: React.Ref<HTMLDivElement>): MenuGridItemState {\n const {\n icon,\n content: _content, // `content` is a slot and it's type clashes with the HTMLElement `content` attribute\n subText,\n firstSubAction,\n secondSubAction,\n ...rest\n } = props;\n\n return {\n components: {\n root: MenuGridRow,\n icon: MenuGridCell,\n content: MenuGridCell,\n subText: 'span',\n firstSubAction: MenuGridCell,\n secondSubAction: MenuGridCell,\n },\n root: slot.always(\n {\n ref,\n ...rest,\n },\n { elementType: MenuGridRow },\n ),\n icon: slot.optional(props.icon, { elementType: MenuGridCell }),\n content: slot.optional(props.content, {\n renderByDefault: !!props.children,\n defaultProps: { children: props.children },\n elementType: MenuGridCell,\n }),\n subText: slot.optional(props.subText, { elementType: 'span' }),\n firstSubAction: slot.optional(props.firstSubAction, { elementType: MenuGridCell }),\n secondSubAction: slot.optional(props.secondSubAction, { elementType: MenuGridCell }),\n };\n}\n"],"names":["React","slot","MenuGridCell","MenuGridRow","useMenuGridItem_unstable","props","ref","icon","content","_content","subText","firstSubAction","secondSubAction","rest","components","root","always","elementType","optional","renderByDefault","children","defaultProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AAGjD,SAASC,YAAY,QAAQ,iCAAiC;AAC9D,SAASC,WAAW,QAAQ,+BAA+B;AAE3D;;CAEC,GACD,OAAO,SAASC,yBAAyBC,KAAwB,EAAEC,GAA8B;IAC/F,MAAM,EACJC,IAAI,EACJC,SAASC,QAAQ,EACjBC,OAAO,EACPC,cAAc,EACdC,eAAe,EACf,GAAGC,MACJ,GAAGR;IAEJ,OAAO;QACLS,YAAY;YACVC,MAAMZ;YACNI,MAAML;YACNM,SAASN;YACTQ,SAAS;YACTC,gBAAgBT;YAChBU,iBAAiBV;QACnB;QACAa,MAAMd,KAAKe,MAAM,CACf;YACEV;YACA,GAAGO,IAAI;QACT,GACA;YAAEI,aAAad;QAAY;QAE7BI,MAAMN,KAAKiB,QAAQ,CAACb,MAAME,IAAI,EAAE;YAAEU,aAAaf;QAAa;QAC5DM,SAASP,KAAKiB,QAAQ,CAACb,MAAMG,OAAO,EAAE;YACpCW,iBAAiB,CAAC,CAACd,MAAMe,QAAQ;YACjCC,cAAc;gBAAED,UAAUf,MAAMe,QAAQ;YAAC;YACzCH,aAAaf;QACf;QACAQ,SAAST,KAAKiB,QAAQ,CAACb,MAAMK,OAAO,EAAE;YAAEO,aAAa;QAAO;QAC5DN,gBAAgBV,KAAKiB,QAAQ,CAACb,MAAMM,cAAc,EAAE;YAAEM,aAAaf;QAAa;QAChFU,iBAAiBX,KAAKiB,QAAQ,CAACb,MAAMO,eAAe,EAAE;YAAEK,aAAaf;QAAa;IACpF;AACF"}
1
+ {"version":3,"sources":["../src/components/MenuGridItem/useMenuGridItem.ts"],"sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, slot } from '@fluentui/react-utilities';\n\nimport { MenuGridItemProps, MenuGridItemState } from './MenuGridItem.types';\nimport { MenuGridCell } from './../MenuGridCell/MenuGridCell';\nimport { MenuGridRow } from './../MenuGridRow/MenuGridRow';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\n/**\n * Given user props, returns state and render function for a MenuGridItem.\n */\nexport function useMenuGridItem_unstable(props: MenuGridItemProps, ref: React.Ref<HTMLDivElement>): MenuGridItemState {\n const {\n icon,\n content: _content, // `content` is a slot and it's type clashes with the HTMLElement `content` attribute\n subText,\n firstSubAction,\n secondSubAction,\n ...rest\n } = props;\n const validateNestingRef = useValidateNesting('MenuGridItem');\n\n return {\n components: {\n root: MenuGridRow,\n icon: MenuGridCell,\n content: MenuGridCell,\n subText: 'span',\n firstSubAction: MenuGridCell,\n secondSubAction: MenuGridCell,\n },\n root: slot.always(\n {\n ref: useMergedRefs(ref, validateNestingRef),\n ...rest,\n },\n { elementType: MenuGridRow },\n ),\n icon: slot.optional(props.icon, { elementType: MenuGridCell }),\n content: slot.optional(props.content, {\n renderByDefault: !!props.children,\n defaultProps: { children: props.children },\n elementType: MenuGridCell,\n }),\n subText: slot.optional(props.subText, { elementType: 'span' }),\n firstSubAction: slot.optional(props.firstSubAction, { elementType: MenuGridCell }),\n secondSubAction: slot.optional(props.secondSubAction, { elementType: MenuGridCell }),\n };\n}\n"],"names":["React","useMergedRefs","slot","MenuGridCell","MenuGridRow","useValidateNesting","useMenuGridItem_unstable","props","ref","icon","content","_content","subText","firstSubAction","secondSubAction","rest","validateNestingRef","components","root","always","elementType","optional","renderByDefault","children","defaultProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AAGhE,SAASC,YAAY,QAAQ,iCAAiC;AAC9D,SAASC,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,kBAAkB,QAAQ,iCAAiC;AAEpE;;CAEC,GACD,OAAO,SAASC,yBAAyBC,KAAwB,EAAEC,GAA8B;IAC/F,MAAM,EACJC,IAAI,EACJC,SAASC,QAAQ,EACjBC,OAAO,EACPC,cAAc,EACdC,eAAe,EACf,GAAGC,MACJ,GAAGR;IACJ,MAAMS,qBAAqBX,mBAAmB;IAE9C,OAAO;QACLY,YAAY;YACVC,MAAMd;YACNK,MAAMN;YACNO,SAASP;YACTS,SAAS;YACTC,gBAAgBV;YAChBW,iBAAiBX;QACnB;QACAe,MAAMhB,KAAKiB,MAAM,CACf;YACEX,KAAKP,cAAcO,KAAKQ;YACxB,GAAGD,IAAI;QACT,GACA;YAAEK,aAAahB;QAAY;QAE7BK,MAAMP,KAAKmB,QAAQ,CAACd,MAAME,IAAI,EAAE;YAAEW,aAAajB;QAAa;QAC5DO,SAASR,KAAKmB,QAAQ,CAACd,MAAMG,OAAO,EAAE;YACpCY,iBAAiB,CAAC,CAACf,MAAMgB,QAAQ;YACjCC,cAAc;gBAAED,UAAUhB,MAAMgB,QAAQ;YAAC;YACzCH,aAAajB;QACf;QACAS,SAASV,KAAKmB,QAAQ,CAACd,MAAMK,OAAO,EAAE;YAAEQ,aAAa;QAAO;QAC5DP,gBAAgBX,KAAKmB,QAAQ,CAACd,MAAMM,cAAc,EAAE;YAAEO,aAAajB;QAAa;QAChFW,iBAAiBZ,KAAKmB,QAAQ,CAACd,MAAMO,eAAe,EAAE;YAAEM,aAAajB;QAAa;IACpF;AACF"}
@@ -1,16 +1,18 @@
1
1
  import * as React from 'react';
2
- import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
2
+ import { useMergedRefs, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
3
3
  import { useMenuGridContext_unstable } from '../../contexts/menuGridContext';
4
+ import { useValidateNesting } from '../../utils/useValidateNesting';
4
5
  /**
5
6
  * Given user props, returns state and render function for a MenuGridRow.
6
7
  */ export function useMenuGridRow_unstable(props, ref) {
8
+ const validateNestingRef = useValidateNesting('MenuGridRow');
7
9
  const { tableRowTabsterAttribute } = useMenuGridContext_unstable();
8
10
  return {
9
11
  components: {
10
12
  root: 'div'
11
13
  },
12
14
  root: slot.always(getIntrinsicElementProps('div', {
13
- ref,
15
+ ref: useMergedRefs(ref, validateNestingRef),
14
16
  role: 'row',
15
17
  tabIndex: 0,
16
18
  ...tableRowTabsterAttribute,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MenuGridRow/useMenuGridRow.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\n\nimport { useMenuGridContext_unstable } from '../../contexts/menuGridContext';\nimport { MenuGridRowProps, MenuGridRowState } from './MenuGridRow.types';\n\n/**\n * Given user props, returns state and render function for a MenuGridRow.\n */\nexport function useMenuGridRow_unstable(props: MenuGridRowProps, ref: React.Ref<HTMLDivElement>): MenuGridRowState {\n const { tableRowTabsterAttribute } = useMenuGridContext_unstable();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'row',\n tabIndex: 0,\n ...tableRowTabsterAttribute,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n"],"names":["React","getIntrinsicElementProps","slot","useMenuGridContext_unstable","useMenuGridRow_unstable","props","ref","tableRowTabsterAttribute","components","root","always","role","tabIndex","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAE3E,SAASC,2BAA2B,QAAQ,iCAAiC;AAG7E;;CAEC,GACD,OAAO,SAASC,wBAAwBC,KAAuB,EAAEC,GAA8B;IAC7F,MAAM,EAAEC,wBAAwB,EAAE,GAAGJ;IAErC,OAAO;QACLK,YAAY;YACVC,MAAM;QACR;QACAA,MAAMP,KAAKQ,MAAM,CACfT,yBAAyB,OAAO;YAC9BK;YACAK,MAAM;YACNC,UAAU;YACV,GAAGL,wBAAwB;YAC3B,GAAGF,KAAK;QACV,IACA;YAAEQ,aAAa;QAAM;IAEzB;AACF"}
1
+ {"version":3,"sources":["../src/components/MenuGridRow/useMenuGridRow.ts"],"sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\n\nimport { useMenuGridContext_unstable } from '../../contexts/menuGridContext';\nimport { MenuGridRowProps, MenuGridRowState } from './MenuGridRow.types';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\n/**\n * Given user props, returns state and render function for a MenuGridRow.\n */\nexport function useMenuGridRow_unstable(props: MenuGridRowProps, ref: React.Ref<HTMLDivElement>): MenuGridRowState {\n const validateNestingRef = useValidateNesting('MenuGridRow');\n const { tableRowTabsterAttribute } = useMenuGridContext_unstable();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, validateNestingRef),\n role: 'row',\n tabIndex: 0,\n ...tableRowTabsterAttribute,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n"],"names":["React","useMergedRefs","getIntrinsicElementProps","slot","useMenuGridContext_unstable","useValidateNesting","useMenuGridRow_unstable","props","ref","validateNestingRef","tableRowTabsterAttribute","components","root","always","role","tabIndex","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAEC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAE1F,SAASC,2BAA2B,QAAQ,iCAAiC;AAE7E,SAASC,kBAAkB,QAAQ,iCAAiC;AAEpE;;CAEC,GACD,OAAO,SAASC,wBAAwBC,KAAuB,EAAEC,GAA8B;IAC7F,MAAMC,qBAAqBJ,mBAAmB;IAC9C,MAAM,EAAEK,wBAAwB,EAAE,GAAGN;IAErC,OAAO;QACLO,YAAY;YACVC,MAAM;QACR;QACAA,MAAMT,KAAKU,MAAM,CACfX,yBAAyB,OAAO;YAC9BM,KAAKP,cAAcO,KAAKC;YACxBK,MAAM;YACNC,UAAU;YACV,GAAGL,wBAAwB;YAC3B,GAAGH,KAAK;QACV,IACA;YAAES,aAAa;QAAM;IAEzB;AACF"}
@@ -0,0 +1 @@
1
+ export { useValidateNesting } from './useValidateNesting';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { useValidateNesting } from './useValidateNesting';\n"],"names":["useValidateNesting"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,uBAAuB"}
@@ -0,0 +1,90 @@
1
+ import * as React from 'react';
2
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
3
+ import { useMenuContext_unstable } from '@fluentui/react-menu';
4
+ const menuItemRoleToNameMapping = {
5
+ menuitem: 'MenuItem',
6
+ menuitemcheckbox: 'MenuItemCheckbox',
7
+ menuitemradio: 'MenuItemRadio'
8
+ };
9
+ export const useValidateNesting = (componentName)=>{
10
+ 'use no memo';
11
+ const { targetDocument } = useFluent();
12
+ const triggerRef = useMenuContext_unstable((context)=>context.triggerRef);
13
+ const inline = useMenuContext_unstable((context)=>context.inline);
14
+ const ref = React.useRef(null);
15
+ if (process.env.NODE_ENV !== 'production') {
16
+ // This check should run only in development mode
17
+ // It's okay to disable the ESLint rule because we ar checking env variable statically (not at runtime)
18
+ // eslint-disable-next-line react-hooks/rules-of-hooks
19
+ React.useEffect(()=>{
20
+ let ancestor = ref.current;
21
+ let ancestorRole;
22
+ do {
23
+ var _ancestor_parentElement;
24
+ ancestor = (_ancestor_parentElement = ancestor === null || ancestor === void 0 ? void 0 : ancestor.parentElement) !== null && _ancestor_parentElement !== void 0 ? _ancestor_parentElement : null;
25
+ ancestorRole = ancestor === null || ancestor === void 0 ? void 0 : ancestor.getAttribute('role');
26
+ if (ancestor === null || ancestor === void 0 ? void 0 : ancestor.classList.contains('fui-MenuGrid')) {
27
+ if (componentName === 'MenuGridCell') {
28
+ throw new Error('MenuGridCell is incorrectly nested within MenuGrid. You probably want to wrap it in a MenuGridRow.');
29
+ }
30
+ break;
31
+ }
32
+ if ((ancestor === null || ancestor === void 0 ? void 0 : ancestor.classList.contains('fui-MenuGridRow')) && componentName === 'MenuGridCell') {
33
+ break;
34
+ }
35
+ if ([
36
+ 'menuitem',
37
+ 'menuitemcheckbox',
38
+ 'menuitemradio'
39
+ ].includes(ancestorRole !== null && ancestorRole !== void 0 ? ancestorRole : '')) {
40
+ throw new Error(`${componentName} is incorrectly nested within ${menuItemRoleToNameMapping[ancestorRole]} or within an element with the "${ancestorRole}" role.`);
41
+ }
42
+ if (ancestorRole === 'menu') {
43
+ let message = '';
44
+ let breakAncestorTraversal = false;
45
+ switch(componentName){
46
+ case 'MenuGrid':
47
+ if (inline && getMenuOfTrigger(triggerRef.current, targetDocument) === ancestor) {
48
+ // Handle the case when MenuGrid is inline next to its menu trigger which is a submenu item of the parent menu
49
+ breakAncestorTraversal = true;
50
+ break;
51
+ }
52
+ message = 'MenuGrid is incorrectly nested within MenuList or within an element with the "menu" role.';
53
+ break;
54
+ case 'MenuGridCell':
55
+ message = 'MenuGridCell is incorrectly nested within MenuList or within an element with the "menu" role. You probably want to wrap it in a MenuGridRow.';
56
+ break;
57
+ case 'MenuGridItem':
58
+ message = 'MenuGridItem is incorrectly nested within MenuList or within an element with the "menu" role. You probably want to wrap it in a MenuGrid instead.';
59
+ break;
60
+ case 'MenuGridRow':
61
+ message = 'MenuGridRow is incorrectly nested within MenuList or within an element with the "menu" role. You probably want to wrap it in a MenuGrid instead.';
62
+ break;
63
+ }
64
+ if (breakAncestorTraversal) {
65
+ break;
66
+ }
67
+ throw new Error(message);
68
+ }
69
+ }while (ancestor && ancestor !== (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body))
70
+ }, [
71
+ componentName,
72
+ ref,
73
+ triggerRef,
74
+ inline,
75
+ targetDocument
76
+ ]);
77
+ }
78
+ return ref;
79
+ };
80
+ const getMenuOfTrigger = (trigger, targetDocument)=>{
81
+ let ancestor = trigger === null || trigger === void 0 ? void 0 : trigger.parentElement;
82
+ while(ancestor && ancestor !== (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body)){
83
+ if ((ancestor === null || ancestor === void 0 ? void 0 : ancestor.getAttribute('role')) === 'menu') {
84
+ return ancestor;
85
+ }
86
+ var _ancestor_parentElement;
87
+ ancestor = (_ancestor_parentElement = ancestor === null || ancestor === void 0 ? void 0 : ancestor.parentElement) !== null && _ancestor_parentElement !== void 0 ? _ancestor_parentElement : null;
88
+ }
89
+ return null;
90
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/useValidateNesting.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nimport type { MenuContextValue } from '@fluentui/react-menu';\nimport { useMenuContext_unstable } from '@fluentui/react-menu';\n\ntype NestingComponentName = 'MenuGrid' | 'MenuGridCell' | 'MenuGridItem' | 'MenuGridRow';\ntype MenuItemRoles = 'menuitem' | 'menuitemcheckbox' | 'menuitemradio';\n\nconst menuItemRoleToNameMapping = {\n menuitem: 'MenuItem',\n menuitemcheckbox: 'MenuItemCheckbox',\n menuitemradio: 'MenuItemRadio',\n};\n\nexport const useValidateNesting = (componentName: NestingComponentName): React.RefObject<HTMLElement> => {\n 'use no memo';\n\n const { targetDocument } = useFluent();\n const triggerRef = useMenuContext_unstable((context: MenuContextValue) => context.triggerRef);\n const inline = useMenuContext_unstable((context: MenuContextValue) => context.inline);\n const ref = React.useRef<HTMLElement>(null);\n\n if (process.env.NODE_ENV !== 'production') {\n // This check should run only in development mode\n // It's okay to disable the ESLint rule because we ar checking env variable statically (not at runtime)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n let ancestor = ref.current;\n let ancestorRole;\n\n do {\n ancestor = ancestor?.parentElement ?? null;\n ancestorRole = ancestor?.getAttribute('role');\n if (ancestor?.classList.contains('fui-MenuGrid')) {\n if (componentName === 'MenuGridCell') {\n throw new Error(\n 'MenuGridCell is incorrectly nested within MenuGrid. You probably want to wrap it in a MenuGridRow.',\n );\n }\n break;\n }\n if (ancestor?.classList.contains('fui-MenuGridRow') && componentName === 'MenuGridCell') {\n break;\n }\n if (['menuitem', 'menuitemcheckbox', 'menuitemradio'].includes(ancestorRole ?? '')) {\n throw new Error(\n `${componentName} is incorrectly nested within ${\n menuItemRoleToNameMapping[ancestorRole as MenuItemRoles]\n } or within an element with the \"${ancestorRole}\" role.`,\n );\n }\n if (ancestorRole === 'menu') {\n let message = '';\n let breakAncestorTraversal = false;\n switch (componentName) {\n case 'MenuGrid':\n if (inline && getMenuOfTrigger(triggerRef.current, targetDocument) === ancestor) {\n // Handle the case when MenuGrid is inline next to its menu trigger which is a submenu item of the parent menu\n breakAncestorTraversal = true;\n break;\n }\n message = 'MenuGrid is incorrectly nested within MenuList or within an element with the \"menu\" role.';\n break;\n case 'MenuGridCell':\n message =\n 'MenuGridCell is incorrectly nested within MenuList or within an element with the \"menu\" role. You probably want to wrap it in a MenuGridRow.';\n break;\n case 'MenuGridItem':\n message =\n 'MenuGridItem is incorrectly nested within MenuList or within an element with the \"menu\" role. You probably want to wrap it in a MenuGrid instead.';\n break;\n case 'MenuGridRow':\n message =\n 'MenuGridRow is incorrectly nested within MenuList or within an element with the \"menu\" role. You probably want to wrap it in a MenuGrid instead.';\n break;\n }\n if (breakAncestorTraversal) {\n break;\n }\n throw new Error(message);\n }\n } while (ancestor && ancestor !== targetDocument?.body);\n }, [componentName, ref, triggerRef, inline, targetDocument]);\n }\n return ref;\n};\n\nconst getMenuOfTrigger = (trigger: HTMLElement | null, targetDocument?: Document): HTMLElement | null => {\n let ancestor = trigger?.parentElement;\n while (ancestor && ancestor !== targetDocument?.body) {\n if (ancestor?.getAttribute('role') === 'menu') {\n return ancestor;\n }\n ancestor = ancestor?.parentElement ?? null;\n }\n return null;\n};\n"],"names":["React","useFluent_unstable","useFluent","useMenuContext_unstable","menuItemRoleToNameMapping","menuitem","menuitemcheckbox","menuitemradio","useValidateNesting","componentName","targetDocument","triggerRef","context","inline","ref","useRef","process","env","NODE_ENV","useEffect","ancestor","current","ancestorRole","parentElement","getAttribute","classList","contains","Error","includes","message","breakAncestorTraversal","getMenuOfTrigger","body","trigger"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAGlF,SAASC,uBAAuB,QAAQ,uBAAuB;AAK/D,MAAMC,4BAA4B;IAChCC,UAAU;IACVC,kBAAkB;IAClBC,eAAe;AACjB;AAEA,OAAO,MAAMC,qBAAqB,CAACC;IACjC;IAEA,MAAM,EAAEC,cAAc,EAAE,GAAGR;IAC3B,MAAMS,aAAaR,wBAAwB,CAACS,UAA8BA,QAAQD,UAAU;IAC5F,MAAME,SAASV,wBAAwB,CAACS,UAA8BA,QAAQC,MAAM;IACpF,MAAMC,MAAMd,MAAMe,MAAM,CAAc;IAEtC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,iDAAiD;QACjD,uGAAuG;QACvG,sDAAsD;QACtDlB,MAAMmB,SAAS,CAAC;YACd,IAAIC,WAAWN,IAAIO,OAAO;YAC1B,IAAIC;YAEJ,GAAG;oBACUF;gBAAXA,WAAWA,CAAAA,0BAAAA,qBAAAA,+BAAAA,SAAUG,aAAa,cAAvBH,qCAAAA,0BAA2B;gBACtCE,eAAeF,qBAAAA,+BAAAA,SAAUI,YAAY,CAAC;gBACtC,IAAIJ,qBAAAA,+BAAAA,SAAUK,SAAS,CAACC,QAAQ,CAAC,iBAAiB;oBAChD,IAAIjB,kBAAkB,gBAAgB;wBACpC,MAAM,IAAIkB,MACR;oBAEJ;oBACA;gBACF;gBACA,IAAIP,CAAAA,qBAAAA,+BAAAA,SAAUK,SAAS,CAACC,QAAQ,CAAC,uBAAsBjB,kBAAkB,gBAAgB;oBACvF;gBACF;gBACA,IAAI;oBAAC;oBAAY;oBAAoB;iBAAgB,CAACmB,QAAQ,CAACN,yBAAAA,0BAAAA,eAAgB,KAAK;oBAClF,MAAM,IAAIK,MACR,GAAGlB,cAAc,8BAA8B,EAC7CL,yBAAyB,CAACkB,aAA8B,CACzD,gCAAgC,EAAEA,aAAa,OAAO,CAAC;gBAE5D;gBACA,IAAIA,iBAAiB,QAAQ;oBAC3B,IAAIO,UAAU;oBACd,IAAIC,yBAAyB;oBAC7B,OAAQrB;wBACN,KAAK;4BACH,IAAII,UAAUkB,iBAAiBpB,WAAWU,OAAO,EAAEX,oBAAoBU,UAAU;gCAC/E,8GAA8G;gCAC9GU,yBAAyB;gCACzB;4BACF;4BACAD,UAAU;4BACV;wBACF,KAAK;4BACHA,UACE;4BACF;wBACF,KAAK;4BACHA,UACE;4BACF;wBACF,KAAK;4BACHA,UACE;4BACF;oBACJ;oBACA,IAAIC,wBAAwB;wBAC1B;oBACF;oBACA,MAAM,IAAIH,MAAME;gBAClB;YACF,QAAST,YAAYA,cAAaV,2BAAAA,qCAAAA,eAAgBsB,IAAI,EAAE;QAC1D,GAAG;YAACvB;YAAeK;YAAKH;YAAYE;YAAQH;SAAe;IAC7D;IACA,OAAOI;AACT,EAAE;AAEF,MAAMiB,mBAAmB,CAACE,SAA6BvB;IACrD,IAAIU,WAAWa,oBAAAA,8BAAAA,QAASV,aAAa;IACrC,MAAOH,YAAYA,cAAaV,2BAAAA,qCAAAA,eAAgBsB,IAAI,EAAE;QACpD,IAAIZ,CAAAA,qBAAAA,+BAAAA,SAAUI,YAAY,CAAC,aAAY,QAAQ;YAC7C,OAAOJ;QACT;YACWA;QAAXA,WAAWA,CAAAA,0BAAAA,qBAAAA,+BAAAA,SAAUG,aAAa,cAAvBH,qCAAAA,0BAA2B;IACxC;IACA,OAAO;AACT"}
@@ -13,7 +13,9 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _reactutilities = require("@fluentui/react-utilities");
14
14
  const _reacttable = require("@fluentui/react-table");
15
15
  const _reactmenu = require("@fluentui/react-menu");
16
+ const _useValidateNesting = require("../../utils/useValidateNesting");
16
17
  const useMenuGrid_unstable = (props, ref)=>{
18
+ const validateNestingRef = (0, _useValidateNesting.useValidateNesting)('MenuGrid');
17
19
  const triggerId = (0, _reactmenu.useMenuContext_unstable)((context)=>context.triggerId);
18
20
  const { tableRowTabsterAttribute, tableTabsterAttribute, onTableKeyDown } = (0, _reacttable.useTableCompositeNavigation)();
19
21
  return {
@@ -21,7 +23,7 @@ const useMenuGrid_unstable = (props, ref)=>{
21
23
  root: 'div'
22
24
  },
23
25
  root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
24
- ref,
26
+ ref: (0, _reactutilities.useMergedRefs)(ref, validateNestingRef),
25
27
  role: 'grid',
26
28
  'aria-labelledby': triggerId,
27
29
  onKeyDown: onTableKeyDown,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MenuGrid/useMenuGrid.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useTableCompositeNavigation } from '@fluentui/react-table';\nimport type { MenuGridProps, MenuGridState } from './MenuGrid.types';\nimport { useMenuContext_unstable } from '@fluentui/react-menu';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuGrid_unstable = (props: MenuGridProps, ref: React.Ref<HTMLDivElement>): MenuGridState => {\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const { tableRowTabsterAttribute, tableTabsterAttribute, onTableKeyDown } = useTableCompositeNavigation();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'grid',\n 'aria-labelledby': triggerId,\n onKeyDown: onTableKeyDown,\n ...tableTabsterAttribute,\n ...props,\n }),\n { elementType: 'div' },\n ),\n tableRowTabsterAttribute,\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useTableCompositeNavigation","useMenuContext_unstable","useMenuGrid_unstable","props","ref","triggerId","context","tableRowTabsterAttribute","tableTabsterAttribute","onTableKeyDown","components","root","always","role","onKeyDown","elementType"],"mappings":";;;;+BASaK;;;;;;;iEATU,QAAQ;gCACgB,4BAA4B;4BAC/B,wBAAwB;2BAE5B,uBAAuB;AAKxD,6BAA6B,CAACC,OAAsBC;IACzD,MAAMC,gBAAYJ,kCAAAA,EAAwBK,CAAAA,UAAWA,QAAQD,SAAS;IACtE,MAAM,EAAEE,wBAAwB,EAAEC,qBAAqB,EAAEC,cAAc,EAAE,OAAGT,uCAAAA;IAE5E,OAAO;QACLU,YAAY;YACVC,MAAM;QACR;QACAA,MAAMZ,oBAAAA,CAAKa,MAAM,KACfd,wCAAAA,EAAyB,OAAO;YAC9BM;YACAS,MAAM;YACN,mBAAmBR;YACnBS,WAAWL;YACX,GAAGD,qBAAqB;YACxB,GAAGL,KAAK;QACV,IACA;YAAEY,aAAa;QAAM;QAEvBR;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/MenuGrid/useMenuGrid.ts"],"sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\n\nimport { useTableCompositeNavigation } from '@fluentui/react-table';\nimport type { MenuGridProps, MenuGridState } from './MenuGrid.types';\nimport { useMenuContext_unstable } from '@fluentui/react-menu';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuGrid_unstable = (props: MenuGridProps, ref: React.Ref<HTMLDivElement>): MenuGridState => {\n const validateNestingRef = useValidateNesting('MenuGrid');\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const { tableRowTabsterAttribute, tableTabsterAttribute, onTableKeyDown } = useTableCompositeNavigation();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, validateNestingRef),\n role: 'grid',\n 'aria-labelledby': triggerId,\n onKeyDown: onTableKeyDown,\n ...tableTabsterAttribute,\n ...props,\n }),\n { elementType: 'div' },\n ),\n tableRowTabsterAttribute,\n };\n};\n"],"names":["React","useMergedRefs","getIntrinsicElementProps","slot","useTableCompositeNavigation","useMenuContext_unstable","useValidateNesting","useMenuGrid_unstable","props","ref","validateNestingRef","triggerId","context","tableRowTabsterAttribute","tableTabsterAttribute","onTableKeyDown","components","root","always","role","onKeyDown","elementType"],"mappings":";;;;+BAWaO;;;;;;;iEAXU,QAAQ;gCAC+B,4BAA4B;4BAE9C,wBAAwB;2BAE5B,uBAAuB;oCAC5B,iCAAiC;AAK7D,6BAA6B,CAACC,OAAsBC;IACzD,MAAMC,yBAAqBJ,sCAAAA,EAAmB;IAC9C,MAAMK,YAAYN,sCAAAA,EAAwBO,CAAAA,UAAWA,QAAQD,SAAS;IACtE,MAAM,EAAEE,wBAAwB,EAAEC,qBAAqB,EAAEC,cAAc,EAAE,OAAGX,uCAAAA;IAE5E,OAAO;QACLY,YAAY;YACVC,MAAM;QACR;QACAA,MAAMd,oBAAAA,CAAKe,MAAM,KACfhB,wCAAAA,EAAyB,OAAO;YAC9BO,SAAKR,6BAAAA,EAAcQ,KAAKC;YACxBS,MAAM;YACN,mBAAmBR;YACnBS,WAAWL;YACX,GAAGD,qBAAqB;YACxB,GAAGN,KAAK;QACV,IACA;YAAEa,aAAa;QAAM;QAEvBR;IACF;AACF,EAAE"}
@@ -11,7 +11,9 @@ Object.defineProperty(exports, "useMenuGridCell_unstable", {
11
11
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
12
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _reactutilities = require("@fluentui/react-utilities");
14
+ const _useValidateNesting = require("../../utils/useValidateNesting");
14
15
  function useMenuGridCell_unstable(props, ref) {
16
+ const validateNestingRef = (0, _useValidateNesting.useValidateNesting)('MenuGridCell');
15
17
  const { visuallyHidden } = props;
16
18
  return {
17
19
  visuallyHidden,
@@ -19,7 +21,7 @@ function useMenuGridCell_unstable(props, ref) {
19
21
  root: 'div'
20
22
  },
21
23
  root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
22
- ref,
24
+ ref: (0, _reactutilities.useMergedRefs)(ref, validateNestingRef),
23
25
  role: 'gridcell',
24
26
  ...props
25
27
  }), {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MenuGridCell/useMenuGridCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { MenuGridCellProps, MenuGridCellState } from './MenuGridCell.types';\n\n/**\n * Given user props, returns state and render function for a MenuGridCell.\n */\nexport function useMenuGridCell_unstable(props: MenuGridCellProps, ref: React.Ref<HTMLDivElement>): MenuGridCellState {\n const { visuallyHidden } = props;\n\n return {\n visuallyHidden,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'gridcell',\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n"],"names":["React","getIntrinsicElementProps","slot","useMenuGridCell_unstable","props","ref","visuallyHidden","components","root","always","role","elementType"],"mappings":";;;;+BAOgBG;;;;;;;iEAPO,QAAQ;gCACgB,4BAA4B;AAMpE,kCAAkCC,KAAwB,EAAEC,GAA8B;IAC/F,MAAM,EAAEC,cAAc,EAAE,GAAGF;IAE3B,OAAO;QACLE;QACAC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMN,oBAAAA,CAAKO,MAAM,KACfR,wCAAAA,EAAyB,OAAO;YAC9BI;YACAK,MAAM;YACN,GAAGN,KAAK;QACV,IACA;YAAEO,aAAa;QAAM;IAEzB;AACF"}
1
+ {"version":3,"sources":["../src/components/MenuGridCell/useMenuGridCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { MenuGridCellProps, MenuGridCellState } from './MenuGridCell.types';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\n/**\n * Given user props, returns state and render function for a MenuGridCell.\n */\nexport function useMenuGridCell_unstable(props: MenuGridCellProps, ref: React.Ref<HTMLDivElement>): MenuGridCellState {\n const validateNestingRef = useValidateNesting('MenuGridCell');\n const { visuallyHidden } = props;\n\n return {\n visuallyHidden,\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, validateNestingRef),\n role: 'gridcell',\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n"],"names":["React","useMergedRefs","getIntrinsicElementProps","slot","useValidateNesting","useMenuGridCell_unstable","props","ref","validateNestingRef","visuallyHidden","components","root","always","role","elementType"],"mappings":";;;;+BAQgBK;;;;;;;iEARO,QAAQ;gCAC+B,4BAA4B;oCAEvD,iCAAiC;AAK7D,kCAAkCC,KAAwB,EAAEC,GAA8B;IAC/F,MAAMC,yBAAqBJ,sCAAAA,EAAmB;IAC9C,MAAM,EAAEK,cAAc,EAAE,GAAGH;IAE3B,OAAO;QACLG;QACAC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMR,oBAAAA,CAAKS,MAAM,KACfV,wCAAAA,EAAyB,OAAO;YAC9BK,SAAKN,6BAAAA,EAAcM,KAAKC;YACxBK,MAAM;YACN,GAAGP,KAAK;QACV,IACA;YAAEQ,aAAa;QAAM;IAEzB;AACF"}
@@ -13,8 +13,10 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _reactutilities = require("@fluentui/react-utilities");
14
14
  const _MenuGridCell = require("./../MenuGridCell/MenuGridCell");
15
15
  const _MenuGridRow = require("./../MenuGridRow/MenuGridRow");
16
+ const _useValidateNesting = require("../../utils/useValidateNesting");
16
17
  function useMenuGridItem_unstable(props, ref) {
17
18
  const { icon, content: _content, subText, firstSubAction, secondSubAction, ...rest } = props;
19
+ const validateNestingRef = (0, _useValidateNesting.useValidateNesting)('MenuGridItem');
18
20
  return {
19
21
  components: {
20
22
  root: _MenuGridRow.MenuGridRow,
@@ -25,7 +27,7 @@ function useMenuGridItem_unstable(props, ref) {
25
27
  secondSubAction: _MenuGridCell.MenuGridCell
26
28
  },
27
29
  root: _reactutilities.slot.always({
28
- ref,
30
+ ref: (0, _reactutilities.useMergedRefs)(ref, validateNestingRef),
29
31
  ...rest
30
32
  }, {
31
33
  elementType: _MenuGridRow.MenuGridRow
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MenuGridItem/useMenuGridItem.ts"],"sourcesContent":["import * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\n\nimport { MenuGridItemProps, MenuGridItemState } from './MenuGridItem.types';\nimport { MenuGridCell } from './../MenuGridCell/MenuGridCell';\nimport { MenuGridRow } from './../MenuGridRow/MenuGridRow';\n\n/**\n * Given user props, returns state and render function for a MenuGridItem.\n */\nexport function useMenuGridItem_unstable(props: MenuGridItemProps, ref: React.Ref<HTMLDivElement>): MenuGridItemState {\n const {\n icon,\n content: _content, // `content` is a slot and it's type clashes with the HTMLElement `content` attribute\n subText,\n firstSubAction,\n secondSubAction,\n ...rest\n } = props;\n\n return {\n components: {\n root: MenuGridRow,\n icon: MenuGridCell,\n content: MenuGridCell,\n subText: 'span',\n firstSubAction: MenuGridCell,\n secondSubAction: MenuGridCell,\n },\n root: slot.always(\n {\n ref,\n ...rest,\n },\n { elementType: MenuGridRow },\n ),\n icon: slot.optional(props.icon, { elementType: MenuGridCell }),\n content: slot.optional(props.content, {\n renderByDefault: !!props.children,\n defaultProps: { children: props.children },\n elementType: MenuGridCell,\n }),\n subText: slot.optional(props.subText, { elementType: 'span' }),\n firstSubAction: slot.optional(props.firstSubAction, { elementType: MenuGridCell }),\n secondSubAction: slot.optional(props.secondSubAction, { elementType: MenuGridCell }),\n };\n}\n"],"names":["React","slot","MenuGridCell","MenuGridRow","useMenuGridItem_unstable","props","ref","icon","content","_content","subText","firstSubAction","secondSubAction","rest","components","root","always","elementType","optional","renderByDefault","children","defaultProps"],"mappings":";;;;+BAUgBI;;;;;;;iEAVO,QAAQ;gCACV,4BAA4B;8BAGpB,iCAAiC;6BAClC,+BAA+B;AAKpD,kCAAkCC,KAAwB,EAAEC,GAA8B;IAC/F,MAAM,EACJC,IAAI,EACJC,SAASC,QAAQ,EACjBC,OAAO,EACPC,cAAc,EACdC,eAAe,EACf,GAAGC,MACJ,GAAGR;IAEJ,OAAO;QACLS,YAAY;YACVC,MAAMZ,wBAAAA;YACNI,MAAML,0BAAAA;YACNM,SAASN,0BAAAA;YACTQ,SAAS;YACTC,gBAAgBT,0BAAAA;YAChBU,iBAAiBV,0BAAAA;QACnB;QACAa,MAAMd,oBAAAA,CAAKe,MAAM,CACf;YACEV;YACA,GAAGO,IAAI;QACT,GACA;YAAEI,aAAad,wBAAAA;QAAY;QAE7BI,MAAMN,oBAAAA,CAAKiB,QAAQ,CAACb,MAAME,IAAI,EAAE;YAAEU,aAAaf,0BAAAA;QAAa;QAC5DM,SAASP,oBAAAA,CAAKiB,QAAQ,CAACb,MAAMG,OAAO,EAAE;YACpCW,iBAAiB,CAAC,CAACd,MAAMe,QAAQ;YACjCC,cAAc;gBAAED,UAAUf,MAAMe,QAAQ;YAAC;YACzCH,aAAaf,0BAAAA;QACf;QACAQ,SAAST,oBAAAA,CAAKiB,QAAQ,CAACb,MAAMK,OAAO,EAAE;YAAEO,aAAa;QAAO;QAC5DN,gBAAgBV,oBAAAA,CAAKiB,QAAQ,CAACb,MAAMM,cAAc,EAAE;YAAEM,aAAaf,0BAAAA;QAAa;QAChFU,iBAAiBX,oBAAAA,CAAKiB,QAAQ,CAACb,MAAMO,eAAe,EAAE;YAAEK,aAAaf,0BAAAA;QAAa;IACpF;AACF"}
1
+ {"version":3,"sources":["../src/components/MenuGridItem/useMenuGridItem.ts"],"sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, slot } from '@fluentui/react-utilities';\n\nimport { MenuGridItemProps, MenuGridItemState } from './MenuGridItem.types';\nimport { MenuGridCell } from './../MenuGridCell/MenuGridCell';\nimport { MenuGridRow } from './../MenuGridRow/MenuGridRow';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\n/**\n * Given user props, returns state and render function for a MenuGridItem.\n */\nexport function useMenuGridItem_unstable(props: MenuGridItemProps, ref: React.Ref<HTMLDivElement>): MenuGridItemState {\n const {\n icon,\n content: _content, // `content` is a slot and it's type clashes with the HTMLElement `content` attribute\n subText,\n firstSubAction,\n secondSubAction,\n ...rest\n } = props;\n const validateNestingRef = useValidateNesting('MenuGridItem');\n\n return {\n components: {\n root: MenuGridRow,\n icon: MenuGridCell,\n content: MenuGridCell,\n subText: 'span',\n firstSubAction: MenuGridCell,\n secondSubAction: MenuGridCell,\n },\n root: slot.always(\n {\n ref: useMergedRefs(ref, validateNestingRef),\n ...rest,\n },\n { elementType: MenuGridRow },\n ),\n icon: slot.optional(props.icon, { elementType: MenuGridCell }),\n content: slot.optional(props.content, {\n renderByDefault: !!props.children,\n defaultProps: { children: props.children },\n elementType: MenuGridCell,\n }),\n subText: slot.optional(props.subText, { elementType: 'span' }),\n firstSubAction: slot.optional(props.firstSubAction, { elementType: MenuGridCell }),\n secondSubAction: slot.optional(props.secondSubAction, { elementType: MenuGridCell }),\n };\n}\n"],"names":["React","useMergedRefs","slot","MenuGridCell","MenuGridRow","useValidateNesting","useMenuGridItem_unstable","props","ref","icon","content","_content","subText","firstSubAction","secondSubAction","rest","validateNestingRef","components","root","always","elementType","optional","renderByDefault","children","defaultProps"],"mappings":";;;;+BAWgBM;;;;;;;iEAXO,QAAQ;gCACK,4BAA4B;8BAGnC,iCAAiC;6BAClC,+BAA+B;oCACxB,iCAAiC;AAK7D,kCAAkCC,KAAwB,EAAEC,GAA8B;IAC/F,MAAM,EACJC,IAAI,EACJC,SAASC,QAAQ,EACjBC,OAAO,EACPC,cAAc,EACdC,eAAe,EACf,GAAGC,MACJ,GAAGR;IACJ,MAAMS,yBAAqBX,sCAAAA,EAAmB;IAE9C,OAAO;QACLY,YAAY;YACVC,MAAMd,wBAAAA;YACNK,MAAMN,0BAAAA;YACNO,SAASP,0BAAAA;YACTS,SAAS;YACTC,gBAAgBV,0BAAAA;YAChBW,iBAAiBX,0BAAAA;QACnB;QACAe,MAAMhB,oBAAAA,CAAKiB,MAAM,CACf;YACEX,SAAKP,6BAAAA,EAAcO,KAAKQ;YACxB,GAAGD,IAAI;QACT,GACA;YAAEK,aAAahB,wBAAAA;QAAY;QAE7BK,MAAMP,oBAAAA,CAAKmB,QAAQ,CAACd,MAAME,IAAI,EAAE;YAAEW,aAAajB,0BAAAA;QAAa;QAC5DO,SAASR,oBAAAA,CAAKmB,QAAQ,CAACd,MAAMG,OAAO,EAAE;YACpCY,iBAAiB,CAAC,CAACf,MAAMgB,QAAQ;YACjCC,cAAc;gBAAED,UAAUhB,MAAMgB,QAAQ;YAAC;YACzCH,aAAajB,0BAAAA;QACf;QACAS,SAASV,oBAAAA,CAAKmB,QAAQ,CAACd,MAAMK,OAAO,EAAE;YAAEQ,aAAa;QAAO;QAC5DP,gBAAgBX,oBAAAA,CAAKmB,QAAQ,CAACd,MAAMM,cAAc,EAAE;YAAEO,aAAajB,0BAAAA;QAAa;QAChFW,iBAAiBZ,oBAAAA,CAAKmB,QAAQ,CAACd,MAAMO,eAAe,EAAE;YAAEM,aAAajB,0BAAAA;QAAa;IACpF;AACF"}
@@ -12,14 +12,16 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
12
12
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _reactutilities = require("@fluentui/react-utilities");
14
14
  const _menuGridContext = require("../../contexts/menuGridContext");
15
+ const _useValidateNesting = require("../../utils/useValidateNesting");
15
16
  function useMenuGridRow_unstable(props, ref) {
17
+ const validateNestingRef = (0, _useValidateNesting.useValidateNesting)('MenuGridRow');
16
18
  const { tableRowTabsterAttribute } = (0, _menuGridContext.useMenuGridContext_unstable)();
17
19
  return {
18
20
  components: {
19
21
  root: 'div'
20
22
  },
21
23
  root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
22
- ref,
24
+ ref: (0, _reactutilities.useMergedRefs)(ref, validateNestingRef),
23
25
  role: 'row',
24
26
  tabIndex: 0,
25
27
  ...tableRowTabsterAttribute,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/MenuGridRow/useMenuGridRow.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\n\nimport { useMenuGridContext_unstable } from '../../contexts/menuGridContext';\nimport { MenuGridRowProps, MenuGridRowState } from './MenuGridRow.types';\n\n/**\n * Given user props, returns state and render function for a MenuGridRow.\n */\nexport function useMenuGridRow_unstable(props: MenuGridRowProps, ref: React.Ref<HTMLDivElement>): MenuGridRowState {\n const { tableRowTabsterAttribute } = useMenuGridContext_unstable();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'row',\n tabIndex: 0,\n ...tableRowTabsterAttribute,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n"],"names":["React","getIntrinsicElementProps","slot","useMenuGridContext_unstable","useMenuGridRow_unstable","props","ref","tableRowTabsterAttribute","components","root","always","role","tabIndex","elementType"],"mappings":";;;;+BASgBI;;;;;;;iEATO,QAAQ;gCACgB,4BAA4B;iCAE/B,iCAAiC;AAMtE,iCAAiCC,KAAuB,EAAEC,GAA8B;IAC7F,MAAM,EAAEC,wBAAwB,EAAE,OAAGJ,4CAAAA;IAErC,OAAO;QACLK,YAAY;YACVC,MAAM;QACR;QACAA,MAAMP,oBAAAA,CAAKQ,MAAM,KACfT,wCAAAA,EAAyB,OAAO;YAC9BK;YACAK,MAAM;YACNC,UAAU;YACV,GAAGL,wBAAwB;YAC3B,GAAGF,KAAK;QACV,IACA;YAAEQ,aAAa;QAAM;IAEzB;AACF"}
1
+ {"version":3,"sources":["../src/components/MenuGridRow/useMenuGridRow.ts"],"sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\n\nimport { useMenuGridContext_unstable } from '../../contexts/menuGridContext';\nimport { MenuGridRowProps, MenuGridRowState } from './MenuGridRow.types';\nimport { useValidateNesting } from '../../utils/useValidateNesting';\n\n/**\n * Given user props, returns state and render function for a MenuGridRow.\n */\nexport function useMenuGridRow_unstable(props: MenuGridRowProps, ref: React.Ref<HTMLDivElement>): MenuGridRowState {\n const validateNestingRef = useValidateNesting('MenuGridRow');\n const { tableRowTabsterAttribute } = useMenuGridContext_unstable();\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, validateNestingRef),\n role: 'row',\n tabIndex: 0,\n ...tableRowTabsterAttribute,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n"],"names":["React","useMergedRefs","getIntrinsicElementProps","slot","useMenuGridContext_unstable","useValidateNesting","useMenuGridRow_unstable","props","ref","validateNestingRef","tableRowTabsterAttribute","components","root","always","role","tabIndex","elementType"],"mappings":";;;;+BAUgBM;;;;;;;iEAVO,QAAQ;gCAC+B,4BAA4B;iCAE9C,iCAAiC;oCAE1C,iCAAiC;AAK7D,iCAAiCC,KAAuB,EAAEC,GAA8B;IAC7F,MAAMC,yBAAqBJ,sCAAAA,EAAmB;IAC9C,MAAM,EAAEK,wBAAwB,EAAE,OAAGN,4CAAAA;IAErC,OAAO;QACLO,YAAY;YACVC,MAAM;QACR;QACAA,MAAMT,oBAAAA,CAAKU,MAAM,KACfX,wCAAAA,EAAyB,OAAO;YAC9BM,SAAKP,6BAAAA,EAAcO,KAAKC;YACxBK,MAAM;YACNC,UAAU;YACV,GAAGL,wBAAwB;YAC3B,GAAGH,KAAK;QACV,IACA;YAAES,aAAa;QAAM;IAEzB;AACF"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useValidateNesting", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _useValidateNesting.useValidateNesting;
9
+ }
10
+ });
11
+ const _useValidateNesting = require("./useValidateNesting");
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { useValidateNesting } from './useValidateNesting';\n"],"names":["useValidateNesting"],"mappings":";;;;;;;eAASA,sCAAkB;;;oCAAQ,uBAAuB"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useValidateNesting", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useValidateNesting;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
14
+ const _reactmenu = require("@fluentui/react-menu");
15
+ const menuItemRoleToNameMapping = {
16
+ menuitem: 'MenuItem',
17
+ menuitemcheckbox: 'MenuItemCheckbox',
18
+ menuitemradio: 'MenuItemRadio'
19
+ };
20
+ const useValidateNesting = (componentName)=>{
21
+ 'use no memo';
22
+ const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
23
+ const triggerRef = (0, _reactmenu.useMenuContext_unstable)((context)=>context.triggerRef);
24
+ const inline = (0, _reactmenu.useMenuContext_unstable)((context)=>context.inline);
25
+ const ref = _react.useRef(null);
26
+ if (process.env.NODE_ENV !== 'production') {
27
+ // This check should run only in development mode
28
+ // It's okay to disable the ESLint rule because we ar checking env variable statically (not at runtime)
29
+ // eslint-disable-next-line react-hooks/rules-of-hooks
30
+ _react.useEffect(()=>{
31
+ let ancestor = ref.current;
32
+ let ancestorRole;
33
+ do {
34
+ var _ancestor_parentElement;
35
+ ancestor = (_ancestor_parentElement = ancestor === null || ancestor === void 0 ? void 0 : ancestor.parentElement) !== null && _ancestor_parentElement !== void 0 ? _ancestor_parentElement : null;
36
+ ancestorRole = ancestor === null || ancestor === void 0 ? void 0 : ancestor.getAttribute('role');
37
+ if (ancestor === null || ancestor === void 0 ? void 0 : ancestor.classList.contains('fui-MenuGrid')) {
38
+ if (componentName === 'MenuGridCell') {
39
+ throw new Error('MenuGridCell is incorrectly nested within MenuGrid. You probably want to wrap it in a MenuGridRow.');
40
+ }
41
+ break;
42
+ }
43
+ if ((ancestor === null || ancestor === void 0 ? void 0 : ancestor.classList.contains('fui-MenuGridRow')) && componentName === 'MenuGridCell') {
44
+ break;
45
+ }
46
+ if ([
47
+ 'menuitem',
48
+ 'menuitemcheckbox',
49
+ 'menuitemradio'
50
+ ].includes(ancestorRole !== null && ancestorRole !== void 0 ? ancestorRole : '')) {
51
+ throw new Error(`${componentName} is incorrectly nested within ${menuItemRoleToNameMapping[ancestorRole]} or within an element with the "${ancestorRole}" role.`);
52
+ }
53
+ if (ancestorRole === 'menu') {
54
+ let message = '';
55
+ let breakAncestorTraversal = false;
56
+ switch(componentName){
57
+ case 'MenuGrid':
58
+ if (inline && getMenuOfTrigger(triggerRef.current, targetDocument) === ancestor) {
59
+ // Handle the case when MenuGrid is inline next to its menu trigger which is a submenu item of the parent menu
60
+ breakAncestorTraversal = true;
61
+ break;
62
+ }
63
+ message = 'MenuGrid is incorrectly nested within MenuList or within an element with the "menu" role.';
64
+ break;
65
+ case 'MenuGridCell':
66
+ message = 'MenuGridCell is incorrectly nested within MenuList or within an element with the "menu" role. You probably want to wrap it in a MenuGridRow.';
67
+ break;
68
+ case 'MenuGridItem':
69
+ message = 'MenuGridItem is incorrectly nested within MenuList or within an element with the "menu" role. You probably want to wrap it in a MenuGrid instead.';
70
+ break;
71
+ case 'MenuGridRow':
72
+ message = 'MenuGridRow is incorrectly nested within MenuList or within an element with the "menu" role. You probably want to wrap it in a MenuGrid instead.';
73
+ break;
74
+ }
75
+ if (breakAncestorTraversal) {
76
+ break;
77
+ }
78
+ throw new Error(message);
79
+ }
80
+ }while (ancestor && ancestor !== (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body))
81
+ }, [
82
+ componentName,
83
+ ref,
84
+ triggerRef,
85
+ inline,
86
+ targetDocument
87
+ ]);
88
+ }
89
+ return ref;
90
+ };
91
+ const getMenuOfTrigger = (trigger, targetDocument)=>{
92
+ let ancestor = trigger === null || trigger === void 0 ? void 0 : trigger.parentElement;
93
+ while(ancestor && ancestor !== (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body)){
94
+ if ((ancestor === null || ancestor === void 0 ? void 0 : ancestor.getAttribute('role')) === 'menu') {
95
+ return ancestor;
96
+ }
97
+ var _ancestor_parentElement;
98
+ ancestor = (_ancestor_parentElement = ancestor === null || ancestor === void 0 ? void 0 : ancestor.parentElement) !== null && _ancestor_parentElement !== void 0 ? _ancestor_parentElement : null;
99
+ }
100
+ return null;
101
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/useValidateNesting.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nimport type { MenuContextValue } from '@fluentui/react-menu';\nimport { useMenuContext_unstable } from '@fluentui/react-menu';\n\ntype NestingComponentName = 'MenuGrid' | 'MenuGridCell' | 'MenuGridItem' | 'MenuGridRow';\ntype MenuItemRoles = 'menuitem' | 'menuitemcheckbox' | 'menuitemradio';\n\nconst menuItemRoleToNameMapping = {\n menuitem: 'MenuItem',\n menuitemcheckbox: 'MenuItemCheckbox',\n menuitemradio: 'MenuItemRadio',\n};\n\nexport const useValidateNesting = (componentName: NestingComponentName): React.RefObject<HTMLElement> => {\n 'use no memo';\n\n const { targetDocument } = useFluent();\n const triggerRef = useMenuContext_unstable((context: MenuContextValue) => context.triggerRef);\n const inline = useMenuContext_unstable((context: MenuContextValue) => context.inline);\n const ref = React.useRef<HTMLElement>(null);\n\n if (process.env.NODE_ENV !== 'production') {\n // This check should run only in development mode\n // It's okay to disable the ESLint rule because we ar checking env variable statically (not at runtime)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n let ancestor = ref.current;\n let ancestorRole;\n\n do {\n ancestor = ancestor?.parentElement ?? null;\n ancestorRole = ancestor?.getAttribute('role');\n if (ancestor?.classList.contains('fui-MenuGrid')) {\n if (componentName === 'MenuGridCell') {\n throw new Error(\n 'MenuGridCell is incorrectly nested within MenuGrid. You probably want to wrap it in a MenuGridRow.',\n );\n }\n break;\n }\n if (ancestor?.classList.contains('fui-MenuGridRow') && componentName === 'MenuGridCell') {\n break;\n }\n if (['menuitem', 'menuitemcheckbox', 'menuitemradio'].includes(ancestorRole ?? '')) {\n throw new Error(\n `${componentName} is incorrectly nested within ${\n menuItemRoleToNameMapping[ancestorRole as MenuItemRoles]\n } or within an element with the \"${ancestorRole}\" role.`,\n );\n }\n if (ancestorRole === 'menu') {\n let message = '';\n let breakAncestorTraversal = false;\n switch (componentName) {\n case 'MenuGrid':\n if (inline && getMenuOfTrigger(triggerRef.current, targetDocument) === ancestor) {\n // Handle the case when MenuGrid is inline next to its menu trigger which is a submenu item of the parent menu\n breakAncestorTraversal = true;\n break;\n }\n message = 'MenuGrid is incorrectly nested within MenuList or within an element with the \"menu\" role.';\n break;\n case 'MenuGridCell':\n message =\n 'MenuGridCell is incorrectly nested within MenuList or within an element with the \"menu\" role. You probably want to wrap it in a MenuGridRow.';\n break;\n case 'MenuGridItem':\n message =\n 'MenuGridItem is incorrectly nested within MenuList or within an element with the \"menu\" role. You probably want to wrap it in a MenuGrid instead.';\n break;\n case 'MenuGridRow':\n message =\n 'MenuGridRow is incorrectly nested within MenuList or within an element with the \"menu\" role. You probably want to wrap it in a MenuGrid instead.';\n break;\n }\n if (breakAncestorTraversal) {\n break;\n }\n throw new Error(message);\n }\n } while (ancestor && ancestor !== targetDocument?.body);\n }, [componentName, ref, triggerRef, inline, targetDocument]);\n }\n return ref;\n};\n\nconst getMenuOfTrigger = (trigger: HTMLElement | null, targetDocument?: Document): HTMLElement | null => {\n let ancestor = trigger?.parentElement;\n while (ancestor && ancestor !== targetDocument?.body) {\n if (ancestor?.getAttribute('role') === 'menu') {\n return ancestor;\n }\n ancestor = ancestor?.parentElement ?? null;\n }\n return null;\n};\n"],"names":["React","useFluent_unstable","useFluent","useMenuContext_unstable","menuItemRoleToNameMapping","menuitem","menuitemcheckbox","menuitemradio","useValidateNesting","componentName","targetDocument","triggerRef","context","inline","ref","useRef","process","env","NODE_ENV","useEffect","ancestor","current","ancestorRole","parentElement","getAttribute","classList","contains","Error","includes","message","breakAncestorTraversal","getMenuOfTrigger","body","trigger"],"mappings":";;;;+BAeaQ;;;;;;;iEAfU,QAAQ;qCACiB,kCAAkC;2BAG1C,uBAAuB;AAK/D,MAAMJ,4BAA4B;IAChCC,UAAU;IACVC,kBAAkB;IAClBC,eAAe;AACjB;AAEO,2BAA2B,CAACE;IACjC;IAEA,MAAM,EAAEC,cAAc,EAAE,OAAGR,uCAAAA;IAC3B,MAAMS,aAAaR,sCAAAA,EAAwB,CAACS,UAA8BA,QAAQD,UAAU;IAC5F,MAAME,aAASV,kCAAAA,EAAwB,CAACS,UAA8BA,QAAQC,MAAM;IACpF,MAAMC,MAAMd,OAAMe,MAAM,CAAc;IAEtC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,iDAAiD;QACjD,uGAAuG;QACvG,sDAAsD;QACtDlB,OAAMmB,SAAS,CAAC;YACd,IAAIC,WAAWN,IAAIO,OAAO;YAC1B,IAAIC;YAEJ,GAAG;oBACUF;gBAAXA,WAAWA,CAAAA,0BAAAA,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,KAAAA,IAAAA,SAAUG,aAAAA,AAAa,MAAA,QAAvBH,4BAAAA,KAAAA,IAAAA,0BAA2B;gBACtCE,eAAeF,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,KAAAA,IAAAA,SAAUI,YAAY,CAAC;gBACtC,IAAIJ,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,KAAAA,IAAAA,SAAUK,SAAS,CAACC,QAAQ,CAAC,iBAAiB;oBAChD,IAAIjB,kBAAkB,gBAAgB;wBACpC,MAAM,IAAIkB,MACR;oBAEJ;oBACA;gBACF;gBACA,IAAIP,CAAAA,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,KAAAA,IAAAA,SAAUK,SAAS,CAACC,QAAQ,CAAC,kBAAA,KAAsBjB,kBAAkB,gBAAgB;oBACvF;gBACF;gBACA,IAAI;oBAAC;oBAAY;oBAAoB;iBAAgB,CAACmB,QAAQ,CAACN,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,eAAgB,KAAK;oBAClF,MAAM,IAAIK,MACR,GAAGlB,cAAc,8BAA8B,EAC7CL,yBAAyB,CAACkB,aAA8B,CACzD,gCAAgC,EAAEA,aAAa,OAAO,CAAC;gBAE5D;gBACA,IAAIA,iBAAiB,QAAQ;oBAC3B,IAAIO,UAAU;oBACd,IAAIC,yBAAyB;oBAC7B,OAAQrB;wBACN,KAAK;4BACH,IAAII,UAAUkB,iBAAiBpB,WAAWU,OAAO,EAAEX,oBAAoBU,UAAU;gCAC/E,8GAA8G;gCAC9GU,yBAAyB;gCACzB;4BACF;4BACAD,UAAU;4BACV;wBACF,KAAK;4BACHA,UACE;4BACF;wBACF,KAAK;4BACHA,UACE;4BACF;wBACF,KAAK;4BACHA,UACE;4BACF;oBACJ;oBACA,IAAIC,wBAAwB;wBAC1B;oBACF;oBACA,MAAM,IAAIH,MAAME;gBAClB;YACF,QAAST,YAAYA,cAAaV,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBsB,IAAAA,AAAI,EAAE;QAC1D,GAAG;YAACvB;YAAeK;YAAKH;YAAYE;YAAQH;SAAe;IAC7D;IACA,OAAOI;AACT,EAAE;AAEF,MAAMiB,mBAAmB,CAACE,SAA6BvB;IACrD,IAAIU,WAAWa,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,KAAAA,IAAAA,QAASV,aAAa;IACrC,MAAOH,YAAYA,cAAaV,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBsB,IAAAA,AAAI,EAAE;QACpD,IAAIZ,CAAAA,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,KAAAA,IAAAA,SAAUI,YAAY,CAAC,OAAA,MAAY,QAAQ;YAC7C,OAAOJ;QACT;YACWA;QAAXA,WAAWA,CAAAA,0BAAAA,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,KAAAA,IAAAA,SAAUG,aAAAA,AAAa,MAAA,QAAvBH,4BAAAA,KAAAA,IAAAA,0BAA2B;IACxC;IACA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-menu-grid-preview",
3
- "version": "0.0.0-nightly-20250918-0406.1",
3
+ "version": "0.0.0-nightly-20250922-0406.1",
4
4
  "description": "New fluentui react package",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -19,18 +19,18 @@
19
19
  "license": "MIT",
20
20
  "devDependencies": {
21
21
  "@fluentui/eslint-plugin": "*",
22
- "@fluentui/react-conformance": "0.0.0-nightly-20250918-0406.1",
23
- "@fluentui/react-conformance-griffel": "0.0.0-nightly-20250918-0406.1",
22
+ "@fluentui/react-conformance": "0.0.0-nightly-20250922-0406.1",
23
+ "@fluentui/react-conformance-griffel": "0.0.0-nightly-20250922-0406.1",
24
24
  "@fluentui/scripts-api-extractor": "*"
25
25
  },
26
26
  "dependencies": {
27
- "@fluentui/react-menu": "0.0.0-nightly-20250918-0406.1",
28
- "@fluentui/react-table": "0.0.0-nightly-20250918-0406.1",
29
- "@fluentui/react-tabster": "0.0.0-nightly-20250918-0406.1",
30
- "@fluentui/react-jsx-runtime": "0.0.0-nightly-20250918-0406.1",
31
- "@fluentui/react-shared-contexts": "0.0.0-nightly-20250918-0406.1",
32
- "@fluentui/react-theme": "0.0.0-nightly-20250918-0406.1",
33
- "@fluentui/react-utilities": "0.0.0-nightly-20250918-0406.1",
27
+ "@fluentui/react-menu": "0.0.0-nightly-20250922-0406.1",
28
+ "@fluentui/react-table": "0.0.0-nightly-20250922-0406.1",
29
+ "@fluentui/react-tabster": "0.0.0-nightly-20250922-0406.1",
30
+ "@fluentui/react-jsx-runtime": "0.0.0-nightly-20250922-0406.1",
31
+ "@fluentui/react-shared-contexts": "0.0.0-nightly-20250922-0406.1",
32
+ "@fluentui/react-theme": "0.0.0-nightly-20250922-0406.1",
33
+ "@fluentui/react-utilities": "0.0.0-nightly-20250922-0406.1",
34
34
  "@griffel/react": "^1.5.22",
35
35
  "@swc/helpers": "^0.5.1"
36
36
  },