react-aria-components 3.0.0-nightly-5334df7f1-250226 → 3.0.0-nightly-9b3385ac6-250228

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.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAmBM,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAAmD;AAC3F,MAAM,0DAA2B,CAAA,GAAA,0BAAY,EAA4B;AAGzE,MAAM,0DAAuC,CAAA,GAAA,0BAAY,EAA2C;AAKpG,SAAS,0CAAa,KAAwB;IACnD,IAAI,MAAM,CAAA,GAAA,2CAAgB,EAAE,2CAAqB,MAAM,IAAI;IAC3D,QAAQ,CAAA,GAAA,gCAAS,EAAE,KAAK;IACxB,IAAI,UAAC,MAAM,yBAAE,qBAAqB,EAAC,GAAG;IACtC,IAAI,QAAQ,CAAA,GAAA,oDAAmB,EAAE;IACjC,IAAI,WAAW,CAAA,GAAA,mBAAK,EAA2B;IAC/C,IAAI,gBAAgB,CAAA,GAAA,mBAAK,EAAe;IACxC,IAAI,kBACF,cAAc,mBACd,eAAe,EACf,eAAe,mBAAmB,YAClC,QAAQ,EACT,GAAG,CAAA,GAAA,4CAAc,EAAE;QAClB,GAAG,CAAA,GAAA,8CAAmB,EAAE,MAAM;gBAC9B;+BACA;kBACA;uBACA;IACF,GAAG;IAEH,qBACE,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC;gBAA0B;aAAM;YACjC;gBAAC,CAAA,GAAA,4CAAiB;gBAAG;aAAe;YACpC;gBAAC,CAAA,GAAA,0CAAe;gBAAG;aAAe;YAClC;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,KAAK;gBAAQ;aAAE;YAC/B;gBAAC;gBAAsC;8BACrC;qCACA;oBACA,eAAe;gBACjB;aAAE;SACH;OACA,MAAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/Autocomplete.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaAutocompleteProps, CollectionOptions, useAutocomplete} from '@react-aria/autocomplete';\nimport {AutocompleteState, useAutocompleteState} from '@react-stately/autocomplete';\nimport {InputContext} from './Input';\nimport {mergeProps} from '@react-aria/utils';\nimport {Provider, removeDataAttributes, SlotProps, SlottedContextValue, useSlottedContext} from './utils';\nimport React, {createContext, RefObject, useRef} from 'react';\nimport {SearchFieldContext} from './SearchField';\nimport {TextFieldContext} from './TextField';\n\nexport interface AutocompleteProps extends AriaAutocompleteProps, SlotProps {}\n\ninterface InternalAutocompleteContextValue {\n filterFn?: (nodeTextValue: string) => boolean,\n collectionProps: CollectionOptions,\n collectionRef: RefObject<HTMLElement | null>\n}\n\nexport const AutocompleteContext = createContext<SlottedContextValue<Partial<AutocompleteProps>>>(null);\nexport const AutocompleteStateContext = createContext<AutocompleteState | null>(null);\n// This context is to pass the register and filter down to whatever collection component is wrapped by the Autocomplete\n// TODO: export from RAC, but rename to something more appropriate\nexport const UNSTABLE_InternalAutocompleteContext = createContext<InternalAutocompleteContextValue | null>(null);\n\n/**\n * An autocomplete combines a text input with a menu, allowing users to filter a list of options to items matching a query.\n */\nexport function Autocomplete(props: AutocompleteProps) {\n let ctx = useSlottedContext(AutocompleteContext, props.slot);\n props = mergeProps(ctx, props);\n let {filter, disableAutoFocusFirst} = props;\n let state = useAutocompleteState(props);\n let inputRef = useRef<HTMLInputElement | null>(null);\n let collectionRef = useRef<HTMLElement>(null);\n let {\n textFieldProps,\n collectionProps,\n collectionRef: mergedCollectionRef,\n filterFn\n } = useAutocomplete({\n ...removeDataAttributes(props),\n filter,\n disableAutoFocusFirst,\n inputRef,\n collectionRef\n }, state);\n\n return (\n <Provider\n values={[\n [AutocompleteStateContext, state],\n [SearchFieldContext, textFieldProps],\n [TextFieldContext, textFieldProps],\n [InputContext, {ref: inputRef}],\n [UNSTABLE_InternalAutocompleteContext, {\n filterFn,\n collectionProps,\n collectionRef: mergedCollectionRef\n }]\n ]}>\n {props.children}\n </Provider>\n );\n};\n"],"names":[],"version":3,"file":"Autocomplete.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAmBM,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAAmD;AAC3F,MAAM,0DAA2B,CAAA,GAAA,0BAAY,EAA4B;AAGzE,MAAM,0DAAuC,CAAA,GAAA,0BAAY,EAA2C;AAKpG,SAAS,0CAAa,KAAwB;IACnD,IAAI,MAAM,CAAA,GAAA,2CAAgB,EAAE,2CAAqB,MAAM,IAAI;IAC3D,QAAQ,CAAA,GAAA,gCAAS,EAAE,KAAK;IACxB,IAAI,UAAC,MAAM,yBAAE,qBAAqB,EAAC,GAAG;IACtC,IAAI,QAAQ,CAAA,GAAA,oDAAmB,EAAE;IACjC,IAAI,WAAW,CAAA,GAAA,mBAAK,EAA2B;IAC/C,IAAI,gBAAgB,CAAA,GAAA,mBAAK,EAAe;IACxC,IAAI,kBACF,cAAc,mBACd,eAAe,EACf,eAAe,mBAAmB,YAClC,QAAQ,EACT,GAAG,CAAA,GAAA,4CAAc,EAAE;QAClB,GAAG,CAAA,GAAA,8CAAmB,EAAE,MAAM;gBAC9B;+BACA;kBACA;uBACA;IACF,GAAG;IAEH,qBACE,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC;gBAA0B;aAAM;YACjC;gBAAC,CAAA,GAAA,4CAAiB;gBAAG;aAAe;YACpC;gBAAC,CAAA,GAAA,0CAAe;gBAAG;aAAe;YAClC;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,KAAK;gBAAQ;aAAE;YAC/B;gBAAC;gBAAsC;8BACrC;qCACA;oBACA,eAAe;gBACjB;aAAE;SACH;OACA,MAAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/Autocomplete.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaAutocompleteProps, CollectionOptions, useAutocomplete} from '@react-aria/autocomplete';\nimport {AutocompleteState, useAutocompleteState} from '@react-stately/autocomplete';\nimport {InputContext} from './Input';\nimport {mergeProps} from '@react-aria/utils';\nimport {Provider, removeDataAttributes, SlotProps, SlottedContextValue, useSlottedContext} from './utils';\nimport React, {createContext, RefObject, useRef} from 'react';\nimport {SearchFieldContext} from './SearchField';\nimport {TextFieldContext} from './TextField';\n\nexport interface AutocompleteProps extends AriaAutocompleteProps, SlotProps {}\n\ninterface InternalAutocompleteContextValue {\n filterFn?: (nodeTextValue: string) => boolean,\n collectionProps: CollectionOptions,\n collectionRef: RefObject<HTMLElement | null>\n}\n\nexport const AutocompleteContext = createContext<SlottedContextValue<Partial<AutocompleteProps>>>(null);\nexport const AutocompleteStateContext = createContext<AutocompleteState | null>(null);\n// This context is to pass the register and filter down to whatever collection component is wrapped by the Autocomplete\n// TODO: export from RAC, but rename to something more appropriate\nexport const UNSTABLE_InternalAutocompleteContext = createContext<InternalAutocompleteContextValue | null>(null);\n\n/**\n * An autocomplete combines a TextField or SearchField with a Menu or ListBox, allowing users to search or filter a list of suggestions.\n */\nexport function Autocomplete(props: AutocompleteProps) {\n let ctx = useSlottedContext(AutocompleteContext, props.slot);\n props = mergeProps(ctx, props);\n let {filter, disableAutoFocusFirst} = props;\n let state = useAutocompleteState(props);\n let inputRef = useRef<HTMLInputElement | null>(null);\n let collectionRef = useRef<HTMLElement>(null);\n let {\n textFieldProps,\n collectionProps,\n collectionRef: mergedCollectionRef,\n filterFn\n } = useAutocomplete({\n ...removeDataAttributes(props),\n filter,\n disableAutoFocusFirst,\n inputRef,\n collectionRef\n }, state);\n\n return (\n <Provider\n values={[\n [AutocompleteStateContext, state],\n [SearchFieldContext, textFieldProps],\n [TextFieldContext, textFieldProps],\n [InputContext, {ref: inputRef}],\n [UNSTABLE_InternalAutocompleteContext, {\n filterFn,\n collectionProps,\n collectionRef: mergedCollectionRef\n }]\n ]}>\n {props.children}\n </Provider>\n );\n};\n"],"names":[],"version":3,"file":"Autocomplete.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAmBM,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAmD;AAC3F,MAAM,0DAA2B,CAAA,GAAA,oBAAY,EAA4B;AAGzE,MAAM,0DAAuC,CAAA,GAAA,oBAAY,EAA2C;AAKpG,SAAS,0CAAa,KAAwB;IACnD,IAAI,MAAM,CAAA,GAAA,yCAAgB,EAAE,2CAAqB,MAAM,IAAI;IAC3D,QAAQ,CAAA,GAAA,iBAAS,EAAE,KAAK;IACxB,IAAI,UAAC,MAAM,yBAAE,qBAAqB,EAAC,GAAG;IACtC,IAAI,QAAQ,CAAA,GAAA,2BAAmB,EAAE;IACjC,IAAI,WAAW,CAAA,GAAA,aAAK,EAA2B;IAC/C,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAe;IACxC,IAAI,kBACF,cAAc,mBACd,eAAe,EACf,eAAe,mBAAmB,YAClC,QAAQ,EACT,GAAG,CAAA,GAAA,sBAAc,EAAE;QAClB,GAAG,CAAA,GAAA,yCAAmB,EAAE,MAAM;gBAC9B;+BACA;kBACA;uBACA;IACF,GAAG;IAEH,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAA0B;aAAM;YACjC;gBAAC,CAAA,GAAA,yCAAiB;gBAAG;aAAe;YACpC;gBAAC,CAAA,GAAA,yCAAe;gBAAG;aAAe;YAClC;gBAAC,CAAA,GAAA,yCAAW;gBAAG;oBAAC,KAAK;gBAAQ;aAAE;YAC/B;gBAAC;gBAAsC;8BACrC;qCACA;oBACA,eAAe;gBACjB;aAAE;SACH;OACA,MAAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/Autocomplete.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaAutocompleteProps, CollectionOptions, useAutocomplete} from '@react-aria/autocomplete';\nimport {AutocompleteState, useAutocompleteState} from '@react-stately/autocomplete';\nimport {InputContext} from './Input';\nimport {mergeProps} from '@react-aria/utils';\nimport {Provider, removeDataAttributes, SlotProps, SlottedContextValue, useSlottedContext} from './utils';\nimport React, {createContext, RefObject, useRef} from 'react';\nimport {SearchFieldContext} from './SearchField';\nimport {TextFieldContext} from './TextField';\n\nexport interface AutocompleteProps extends AriaAutocompleteProps, SlotProps {}\n\ninterface InternalAutocompleteContextValue {\n filterFn?: (nodeTextValue: string) => boolean,\n collectionProps: CollectionOptions,\n collectionRef: RefObject<HTMLElement | null>\n}\n\nexport const AutocompleteContext = createContext<SlottedContextValue<Partial<AutocompleteProps>>>(null);\nexport const AutocompleteStateContext = createContext<AutocompleteState | null>(null);\n// This context is to pass the register and filter down to whatever collection component is wrapped by the Autocomplete\n// TODO: export from RAC, but rename to something more appropriate\nexport const UNSTABLE_InternalAutocompleteContext = createContext<InternalAutocompleteContextValue | null>(null);\n\n/**\n * An autocomplete combines a text input with a menu, allowing users to filter a list of options to items matching a query.\n */\nexport function Autocomplete(props: AutocompleteProps) {\n let ctx = useSlottedContext(AutocompleteContext, props.slot);\n props = mergeProps(ctx, props);\n let {filter, disableAutoFocusFirst} = props;\n let state = useAutocompleteState(props);\n let inputRef = useRef<HTMLInputElement | null>(null);\n let collectionRef = useRef<HTMLElement>(null);\n let {\n textFieldProps,\n collectionProps,\n collectionRef: mergedCollectionRef,\n filterFn\n } = useAutocomplete({\n ...removeDataAttributes(props),\n filter,\n disableAutoFocusFirst,\n inputRef,\n collectionRef\n }, state);\n\n return (\n <Provider\n values={[\n [AutocompleteStateContext, state],\n [SearchFieldContext, textFieldProps],\n [TextFieldContext, textFieldProps],\n [InputContext, {ref: inputRef}],\n [UNSTABLE_InternalAutocompleteContext, {\n filterFn,\n collectionProps,\n collectionRef: mergedCollectionRef\n }]\n ]}>\n {props.children}\n </Provider>\n );\n};\n"],"names":[],"version":3,"file":"Autocomplete.module.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAmBM,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAmD;AAC3F,MAAM,0DAA2B,CAAA,GAAA,oBAAY,EAA4B;AAGzE,MAAM,0DAAuC,CAAA,GAAA,oBAAY,EAA2C;AAKpG,SAAS,0CAAa,KAAwB;IACnD,IAAI,MAAM,CAAA,GAAA,yCAAgB,EAAE,2CAAqB,MAAM,IAAI;IAC3D,QAAQ,CAAA,GAAA,iBAAS,EAAE,KAAK;IACxB,IAAI,UAAC,MAAM,yBAAE,qBAAqB,EAAC,GAAG;IACtC,IAAI,QAAQ,CAAA,GAAA,2BAAmB,EAAE;IACjC,IAAI,WAAW,CAAA,GAAA,aAAK,EAA2B;IAC/C,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAe;IACxC,IAAI,kBACF,cAAc,mBACd,eAAe,EACf,eAAe,mBAAmB,YAClC,QAAQ,EACT,GAAG,CAAA,GAAA,sBAAc,EAAE;QAClB,GAAG,CAAA,GAAA,yCAAmB,EAAE,MAAM;gBAC9B;+BACA;kBACA;uBACA;IACF,GAAG;IAEH,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAA0B;aAAM;YACjC;gBAAC,CAAA,GAAA,yCAAiB;gBAAG;aAAe;YACpC;gBAAC,CAAA,GAAA,yCAAe;gBAAG;aAAe;YAClC;gBAAC,CAAA,GAAA,yCAAW;gBAAG;oBAAC,KAAK;gBAAQ;aAAE;YAC/B;gBAAC;gBAAsC;8BACrC;qCACA;oBACA,eAAe;gBACjB;aAAE;SACH;OACA,MAAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/Autocomplete.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaAutocompleteProps, CollectionOptions, useAutocomplete} from '@react-aria/autocomplete';\nimport {AutocompleteState, useAutocompleteState} from '@react-stately/autocomplete';\nimport {InputContext} from './Input';\nimport {mergeProps} from '@react-aria/utils';\nimport {Provider, removeDataAttributes, SlotProps, SlottedContextValue, useSlottedContext} from './utils';\nimport React, {createContext, RefObject, useRef} from 'react';\nimport {SearchFieldContext} from './SearchField';\nimport {TextFieldContext} from './TextField';\n\nexport interface AutocompleteProps extends AriaAutocompleteProps, SlotProps {}\n\ninterface InternalAutocompleteContextValue {\n filterFn?: (nodeTextValue: string) => boolean,\n collectionProps: CollectionOptions,\n collectionRef: RefObject<HTMLElement | null>\n}\n\nexport const AutocompleteContext = createContext<SlottedContextValue<Partial<AutocompleteProps>>>(null);\nexport const AutocompleteStateContext = createContext<AutocompleteState | null>(null);\n// This context is to pass the register and filter down to whatever collection component is wrapped by the Autocomplete\n// TODO: export from RAC, but rename to something more appropriate\nexport const UNSTABLE_InternalAutocompleteContext = createContext<InternalAutocompleteContextValue | null>(null);\n\n/**\n * An autocomplete combines a TextField or SearchField with a Menu or ListBox, allowing users to search or filter a list of suggestions.\n */\nexport function Autocomplete(props: AutocompleteProps) {\n let ctx = useSlottedContext(AutocompleteContext, props.slot);\n props = mergeProps(ctx, props);\n let {filter, disableAutoFocusFirst} = props;\n let state = useAutocompleteState(props);\n let inputRef = useRef<HTMLInputElement | null>(null);\n let collectionRef = useRef<HTMLElement>(null);\n let {\n textFieldProps,\n collectionProps,\n collectionRef: mergedCollectionRef,\n filterFn\n } = useAutocomplete({\n ...removeDataAttributes(props),\n filter,\n disableAutoFocusFirst,\n inputRef,\n collectionRef\n }, state);\n\n return (\n <Provider\n values={[\n [AutocompleteStateContext, state],\n [SearchFieldContext, textFieldProps],\n [TextFieldContext, textFieldProps],\n [InputContext, {ref: inputRef}],\n [UNSTABLE_InternalAutocompleteContext, {\n filterFn,\n collectionProps,\n collectionRef: mergedCollectionRef\n }]\n ]}>\n {props.children}\n </Provider>\n );\n};\n"],"names":[],"version":3,"file":"Autocomplete.module.js.map"}
package/dist/Menu.main.js CHANGED
@@ -235,7 +235,7 @@ const $a8f6e7d095d1cc86$export$d9b273488cd8ce6f = /*#__PURE__*/ (0, $2JTht$react
235
235
  // Delay rendering the actual menu until we have the collection so that auto focus works properly.
236
236
  return /*#__PURE__*/ (0, ($parcel$interopDefault($2JTht$react))).createElement((0, $2JTht$reactariacollections.CollectionBuilder), {
237
237
  content: /*#__PURE__*/ (0, ($parcel$interopDefault($2JTht$react))).createElement((0, $2JTht$reactariacollections.Collection), props)
238
- }, (collection)=>collection.size > 0 && /*#__PURE__*/ (0, ($parcel$interopDefault($2JTht$react))).createElement($a8f6e7d095d1cc86$var$MenuInner, {
238
+ }, (collection)=>/*#__PURE__*/ (0, ($parcel$interopDefault($2JTht$react))).createElement($a8f6e7d095d1cc86$var$MenuInner, {
239
239
  props: props,
240
240
  collection: collection,
241
241
  menuRef: ref
@@ -269,14 +269,24 @@ function $a8f6e7d095d1cc86$var$MenuInner({ props: props, collection: collection,
269
269
  defaultClassName: 'react-aria-Menu',
270
270
  className: props.className,
271
271
  style: props.style,
272
- values: {}
272
+ values: {
273
+ isEmpty: state.collection.size === 0
274
+ }
273
275
  });
276
+ let emptyState = null;
277
+ if (state.collection.size === 0 && props.renderEmptyState) emptyState = /*#__PURE__*/ (0, ($parcel$interopDefault($2JTht$react))).createElement("div", {
278
+ role: "menuitem",
279
+ style: {
280
+ display: 'contents'
281
+ }
282
+ }, props.renderEmptyState());
274
283
  return /*#__PURE__*/ (0, ($parcel$interopDefault($2JTht$react))).createElement((0, $2JTht$reactaria.FocusScope), null, /*#__PURE__*/ (0, ($parcel$interopDefault($2JTht$react))).createElement("div", {
275
284
  ...(0, $2JTht$reactariautils.filterDOMProps)(props),
276
285
  ...menuProps,
277
286
  ...renderProps,
278
287
  ref: ref,
279
288
  slot: props.slot || undefined,
289
+ "data-empty": state.collection.size === 0 || undefined,
280
290
  onScroll: props.onScroll
281
291
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($2JTht$react))).createElement((0, $c5ccf687772c0422$exports.Provider), {
282
292
  values: [
@@ -325,7 +335,7 @@ function $a8f6e7d095d1cc86$var$MenuInner({ props: props, collection: collection,
325
335
  collection: state.collection,
326
336
  persistedKeys: (0, $3114c2382242bdc0$exports.usePersistedKeys)(state.selectionManager.focusedKey),
327
337
  scrollRef: ref
328
- }))));
338
+ })), emptyState));
329
339
  }
330
340
  // A subclass of SelectionManager that forwards focus-related properties to the parent,
331
341
  // but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,UAAU,KAAK,QAAQ;QACvB,kBAAkB;QAClB,QAAQ;YACN,GAAG,MAAM;uBACT;YACA,gBAAgB,OAAO,cAAc;YACrC,eAAe,iBAAiB,aAAa;YAC7C,mBAAmB,iBAAiB,iBAAiB;YACrD,YAAY,CAAC,CAAC,KAAK,CAAC,gBAAgB;YACpC,QAAQ,KAAK,CAAC,gBAAgB,KAAK;QACrC;IACF;IAEA,IAAI,cAAiC,MAAM,IAAI,GAAG,MAAM;IAExD,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,2BAAS,EAAE,eAAe,WAAW;QACxC,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,OAAO,UAAU,IAAI;QACpC,gBAAc,aAAa;QAC3B,gBAAc,OAAO,SAAS,IAAI;QAClC,sBAAoB,OAAO,cAAc,IAAI;QAC7C,gBAAc,OAAO,SAAS,IAAI;QAClC,iBAAe,OAAO,UAAU,IAAI;QACpC,uBAAqB,iBAAiB,aAAa,KAAK,SAAS,YAAY,iBAAiB,aAAa;QAC3G,oBAAkB,CAAC,CAAC,KAAK,CAAC,gBAAgB,IAAI;QAC9C,aAAW,KAAK,CAAC,gBAAgB,KAAK,UAAU;qBAChD,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,qCAAU;gBAAG;oBACZ,OAAO;wBACL,CAAC,CAAA,GAAA,sCAAW,EAAE,EAAE;wBAChB,OAAO;wBACP,aAAa;oBACf;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAc;gBAAG;aAAsB;SACzC;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Menu.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps, FocusScope, mergeProps, useMenu, useMenuItem, useMenuSection, useMenuTrigger} from 'react-aria';\nimport {BaseCollection, Collection, CollectionBuilder, createBranchComponent, createLeafComponent} from '@react-aria/collections';\nimport {MenuTriggerProps as BaseMenuTriggerProps, Collection as ICollection, Node, TreeState, useMenuTriggerState, useTreeState} from 'react-stately';\nimport {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {filterDOMProps, mergeRefs, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {FocusStrategy, forwardRefType, HoverEvents, Key, LinkDOMProps, MultipleSelection} from '@react-types/shared';\nimport {HeaderContext} from './Header';\nimport {KeyboardContext} from './Keyboard';\nimport {MultipleSelectionState, SelectionManager, useMultipleSelectionState} from '@react-stately/selection';\nimport {PopoverContext} from './Popover';\nimport {PressResponder, useHover} from '@react-aria/interactions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {RootMenuTriggerState, useSubmenuTriggerState} from '@react-stately/menu';\nimport {SeparatorContext} from './Separator';\nimport {TextContext} from './Text';\nimport {UNSTABLE_InternalAutocompleteContext} from './Autocomplete';\nimport {useSubmenuTrigger} from '@react-aria/menu';\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, HTMLDivElement>>(null);\nexport const MenuStateContext = createContext<TreeState<any> | null>(null);\nexport const RootMenuTriggerStateContext = createContext<RootMenuTriggerState | null>(null);\nconst SelectionManagerContext = createContext<SelectionManager | null>(null);\n\nexport interface MenuTriggerProps extends BaseMenuTriggerProps {\n children: ReactNode\n}\n\nexport function MenuTrigger(props: MenuTriggerProps) {\n let state = useMenuTriggerState(props);\n let ref = useRef<HTMLButtonElement>(null);\n let {menuTriggerProps, menuProps} = useMenuTrigger({\n ...props,\n type: 'menu'\n }, state, ref);\n // Allows menu width to match button\n let [buttonWidth, setButtonWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (ref.current) {\n setButtonWidth(ref.current.offsetWidth + 'px');\n }\n }, [ref]);\n\n useResizeObserver({\n ref: ref,\n onResize: onResize\n });\n let scrollRef = useRef(null);\n\n return (\n <Provider\n values={[\n [MenuContext, {...menuProps, ref: scrollRef}],\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'MenuTrigger',\n triggerRef: ref,\n scrollRef,\n placement: 'bottom start',\n style: {'--trigger-width': buttonWidth} as React.CSSProperties\n }]\n ]}>\n <PressResponder {...menuTriggerProps} ref={ref} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\nexport interface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the submenu).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the submenu to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\nconst SubmenuTriggerContext = createContext<{parentMenuRef: RefObject<HTMLElement | null>, shouldUseVirtualFocus?: boolean} | null>(null);\n\n/**\n * A submenu trigger is used to wrap a submenu's trigger item and the submenu itself.\n *\n * @version alpha\n */\nexport const SubmenuTrigger = /*#__PURE__*/ createBranchComponent('submenutrigger', (props: SubmenuTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let submenuRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n delay: props.delay,\n shouldUseVirtualFocus\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: submenuRef,\n trigger: 'SubmenuTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\n// TODO: make SubdialogTrigger unstable\nexport interface SubDialogTriggerProps {\n /**\n * The contents of the SubDialogTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the subdialog).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the subdialog to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\n/**\n * A subdialog trigger is used to wrap a subdialog's trigger item and the subdialog itself.\n *\n * @version alpha\n */\nexport const SubDialogTrigger = /*#__PURE__*/ createBranchComponent('subdialogtrigger', (props: SubDialogTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let subdialogRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef: subdialogRef,\n type: 'dialog',\n delay: props.delay,\n shouldUseVirtualFocus\n // TODO: might need to have something like isUnavailable like we do for ContextualHelpTrigger\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [DialogContext, {'aria-labelledby': submenuProps['aria-labelledby']}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: subdialogRef,\n trigger: 'SubDialogTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, CollectionProps<T>, StyleProps, SlotProps, ScrollableProps<HTMLDivElement> {}\n\n/**\n * A menu displays a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, MenuContext);\n\n // Delay rendering the actual menu until we have the collection so that auto focus works properly.\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => collection.size > 0 && <MenuInner props={props} collection={collection} menuRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface MenuInnerProps<T> {\n props: MenuProps<T>,\n collection: BaseCollection<object>,\n menuRef: RefObject<HTMLDivElement | null>\n}\n\nfunction MenuInner<T extends object>({props, collection, menuRef: ref}: MenuInnerProps<T>) {\n let {filterFn, collectionProps: autocompleteMenuProps, collectionRef} = useContext(UNSTABLE_InternalAutocompleteContext) || {};\n // Memoed so that useAutocomplete callback ref is properly only called once on mount and not everytime a rerender happens\n ref = useObjectRef(useMemo(() => mergeRefs(ref, collectionRef !== undefined ? collectionRef as RefObject<HTMLDivElement> : null), [collectionRef, ref]));\n let filteredCollection = useMemo(() => filterFn ? collection.filter(filterFn) : collection, [collection, filterFn]);\n let state = useTreeState({\n ...props,\n collection: filteredCollection as ICollection<Node<object>>,\n children: undefined\n });\n let triggerState = useContext(RootMenuTriggerStateContext);\n let {isVirtualized, CollectionRoot} = useContext(CollectionRendererContext);\n let {menuProps} = useMenu({...props, ...autocompleteMenuProps, isVirtualized, onClose: props.onClose || triggerState?.close}, state, ref);\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Menu',\n className: props.className,\n style: props.style,\n values: {}\n });\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...menuProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}>\n <Provider\n values={[\n [MenuStateContext, state],\n [SeparatorContext, {elementType: 'div'}],\n [SectionContext, {name: 'MenuSection', render: MenuSectionInner}],\n [SubmenuTriggerContext, {parentMenuRef: ref, shouldUseVirtualFocus: autocompleteMenuProps?.shouldUseVirtualFocus}],\n [MenuItemContext, null],\n [UNSTABLE_InternalAutocompleteContext, null],\n [SelectionManagerContext, state.selectionManager],\n /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */\n /* We assume the context can never change between defined and undefined. */\n /* eslint-disable-next-line react-hooks/rules-of-hooks */\n [RootMenuTriggerStateContext, triggerState ?? useMenuTriggerState({})]\n ]}>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n </div>\n </FocusScope>\n );\n}\n\nexport interface MenuSectionProps<T> extends SectionProps<T>, MultipleSelection {}\n\n// A subclass of SelectionManager that forwards focus-related properties to the parent,\n// but has its own local selection state.\nclass GroupSelectionManager extends SelectionManager {\n private parent: SelectionManager;\n\n constructor(parent: SelectionManager, state: MultipleSelectionState) {\n super(parent.collection, state);\n this.parent = parent;\n }\n\n get focusedKey() {\n return this.parent.focusedKey;\n }\n\n get isFocused() {\n return this.parent.isFocused;\n }\n\n setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void {\n return this.parent.setFocusedKey(key, childFocusStrategy);\n }\n\n setFocused(isFocused: boolean): void {\n this.parent.setFocused(isFocused);\n }\n\n get childFocusStrategy() {\n return this.parent.childFocusStrategy;\n }\n}\n\nfunction MenuSectionInner<T extends object>(props: MenuSectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>, className = 'react-aria-MenuSection') {\n let state = useContext(MenuStateContext)!;\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let [headingRef, heading] = useSlot();\n let {headingProps, groupProps} = useMenuSection({\n heading,\n 'aria-label': section.props['aria-label'] ?? undefined\n });\n let renderProps = useRenderProps({\n defaultClassName: className,\n className: section.props?.className,\n style: section.props?.style,\n values: {}\n });\n\n let parent = useContext(SelectionManagerContext)!;\n let selectionState = useMultipleSelectionState(props);\n let manager = props.selectionMode != null ? new GroupSelectionManager(parent, selectionState) : parent;\n\n return (\n <section\n {...filterDOMProps(props as any)}\n {...groupProps}\n {...renderProps}\n ref={ref}>\n <Provider\n values={[\n [HeaderContext, {...headingProps, ref: headingRef}],\n [SelectionManagerContext, manager]\n ]}>\n <CollectionBranch collection={state.collection} parent={section} />\n </Provider>\n </section>\n );\n}\n\n/**\n * A MenuSection represents a section within a Menu.\n */\nexport const MenuSection = /*#__PURE__*/ createBranchComponent('section', MenuSectionInner);\n\nexport interface MenuItemRenderProps extends ItemRenderProps {\n /**\n * Whether the item has a submenu.\n *\n * @selector [data-has-submenu]\n */\n hasSubmenu: boolean,\n /**\n * Whether the item's submenu is open.\n *\n * @selector [data-open]\n */\n isOpen: boolean\n}\n\nexport interface MenuItemProps<T = object> extends RenderProps<MenuItemRenderProps>, LinkDOMProps, HoverEvents {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** An accessibility label for this item. */\n 'aria-label'?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /** Handler that is called when the item is selected. */\n onAction?: () => void\n}\n\nconst MenuItemContext = createContext<ContextValue<MenuItemProps, HTMLDivElement>>(null);\n\n/**\n * A MenuItem represents an individual action in a Menu.\n */\nexport const MenuItem = /*#__PURE__*/ createLeafComponent('item', function MenuItem<T extends object>(props: MenuItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n [props, forwardedRef] = useContextProps(props, forwardedRef, MenuItemContext);\n let id = useSlottedContext(MenuItemContext)?.id as string;\n let state = useContext(MenuStateContext)!;\n let ref = useObjectRef<any>(forwardedRef);\n let selectionManager = useContext(SelectionManagerContext)!;\n\n let {menuItemProps, labelProps, descriptionProps, keyboardShortcutProps, ...states} = useMenuItem({\n ...props,\n id,\n key: item.key,\n selectionManager\n }, state, ref);\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: states.isDisabled\n });\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-MenuItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible: states.isFocusVisible,\n selectionMode: selectionManager.selectionMode,\n selectionBehavior: selectionManager.selectionBehavior,\n hasSubmenu: !!props['aria-haspopup'],\n isOpen: props['aria-expanded'] === 'true'\n }\n });\n\n let ElementType: React.ElementType = props.href ? 'a' : 'div';\n\n return (\n <ElementType\n {...mergeProps(menuItemProps, hoverProps)}\n {...renderProps}\n ref={ref}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={states.isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selected={states.isSelected || undefined}\n data-selection-mode={selectionManager.selectionMode === 'none' ? undefined : selectionManager.selectionMode}\n data-has-submenu={!!props['aria-haspopup'] || undefined}\n data-open={props['aria-expanded'] === 'true' || undefined}>\n <Provider\n values={[\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: labelProps,\n label: labelProps,\n description: descriptionProps\n }\n }],\n [KeyboardContext, keyboardShortcutProps]\n ]}>\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AG;aAAsB;SACzC;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Menu.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps, FocusScope, mergeProps, useMenu, useMenuItem, useMenuSection, useMenuTrigger} from 'react-aria';\nimport {BaseCollection, Collection, CollectionBuilder, createBranchComponent, createLeafComponent} from '@react-aria/collections';\nimport {MenuTriggerProps as BaseMenuTriggerProps, Collection as ICollection, Node, TreeState, useMenuTriggerState, useTreeState} from 'react-stately';\nimport {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {filterDOMProps, mergeRefs, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {FocusStrategy, forwardRefType, HoverEvents, Key, LinkDOMProps, MultipleSelection} from '@react-types/shared';\nimport {HeaderContext} from './Header';\nimport {KeyboardContext} from './Keyboard';\nimport {MultipleSelectionState, SelectionManager, useMultipleSelectionState} from '@react-stately/selection';\nimport {PopoverContext} from './Popover';\nimport {PressResponder, useHover} from '@react-aria/interactions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {RootMenuTriggerState, useSubmenuTriggerState} from '@react-stately/menu';\nimport {SeparatorContext} from './Separator';\nimport {TextContext} from './Text';\nimport {UNSTABLE_InternalAutocompleteContext} from './Autocomplete';\nimport {useSubmenuTrigger} from '@react-aria/menu';\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, HTMLDivElement>>(null);\nexport const MenuStateContext = createContext<TreeState<any> | null>(null);\nexport const RootMenuTriggerStateContext = createContext<RootMenuTriggerState | null>(null);\nconst SelectionManagerContext = createContext<SelectionManager | null>(null);\n\nexport interface MenuTriggerProps extends BaseMenuTriggerProps {\n children: ReactNode\n}\n\nexport function MenuTrigger(props: MenuTriggerProps) {\n let state = useMenuTriggerState(props);\n let ref = useRef<HTMLButtonElement>(null);\n let {menuTriggerProps, menuProps} = useMenuTrigger({\n ...props,\n type: 'menu'\n }, state, ref);\n // Allows menu width to match button\n let [buttonWidth, setButtonWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (ref.current) {\n setButtonWidth(ref.current.offsetWidth + 'px');\n }\n }, [ref]);\n\n useResizeObserver({\n ref: ref,\n onResize: onResize\n });\n let scrollRef = useRef(null);\n\n return (\n <Provider\n values={[\n [MenuContext, {...menuProps, ref: scrollRef}],\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'MenuTrigger',\n triggerRef: ref,\n scrollRef,\n placement: 'bottom start',\n style: {'--trigger-width': buttonWidth} as React.CSSProperties\n }]\n ]}>\n <PressResponder {...menuTriggerProps} ref={ref} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\nexport interface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the submenu).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the submenu to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\nconst SubmenuTriggerContext = createContext<{parentMenuRef: RefObject<HTMLElement | null>, shouldUseVirtualFocus?: boolean} | null>(null);\n\n/**\n * A submenu trigger is used to wrap a submenu's trigger item and the submenu itself.\n *\n * @version alpha\n */\nexport const SubmenuTrigger = /*#__PURE__*/ createBranchComponent('submenutrigger', (props: SubmenuTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let submenuRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n delay: props.delay,\n shouldUseVirtualFocus\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: submenuRef,\n trigger: 'SubmenuTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\n// TODO: make SubdialogTrigger unstable\nexport interface SubDialogTriggerProps {\n /**\n * The contents of the SubDialogTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the subdialog).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the subdialog to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\n/**\n * A subdialog trigger is used to wrap a subdialog's trigger item and the subdialog itself.\n *\n * @version alpha\n */\nexport const SubDialogTrigger = /*#__PURE__*/ createBranchComponent('subdialogtrigger', (props: SubDialogTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let subdialogRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef: subdialogRef,\n type: 'dialog',\n delay: props.delay,\n shouldUseVirtualFocus\n // TODO: might need to have something like isUnavailable like we do for ContextualHelpTrigger\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [DialogContext, {'aria-labelledby': submenuProps['aria-labelledby']}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: subdialogRef,\n trigger: 'SubDialogTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\nexport interface MenuRenderProps {\n /**\n * Whether the menu has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean\n}\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<MenuRenderProps>, SlotProps, ScrollableProps<HTMLDivElement> {\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: () => ReactNode\n}\n\n/**\n * A menu displays a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, MenuContext);\n\n // Delay rendering the actual menu until we have the collection so that auto focus works properly.\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <MenuInner props={props} collection={collection} menuRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface MenuInnerProps<T> {\n props: MenuProps<T>,\n collection: BaseCollection<object>,\n menuRef: RefObject<HTMLDivElement | null>\n}\n\nfunction MenuInner<T extends object>({props, collection, menuRef: ref}: MenuInnerProps<T>) {\n let {filterFn, collectionProps: autocompleteMenuProps, collectionRef} = useContext(UNSTABLE_InternalAutocompleteContext) || {};\n // Memoed so that useAutocomplete callback ref is properly only called once on mount and not everytime a rerender happens\n ref = useObjectRef(useMemo(() => mergeRefs(ref, collectionRef !== undefined ? collectionRef as RefObject<HTMLDivElement> : null), [collectionRef, ref]));\n let filteredCollection = useMemo(() => filterFn ? collection.filter(filterFn) : collection, [collection, filterFn]);\n let state = useTreeState({\n ...props,\n collection: filteredCollection as ICollection<Node<object>>,\n children: undefined\n });\n let triggerState = useContext(RootMenuTriggerStateContext);\n let {isVirtualized, CollectionRoot} = useContext(CollectionRendererContext);\n let {menuProps} = useMenu({...props, ...autocompleteMenuProps, isVirtualized, onClose: props.onClose || triggerState?.close}, state, ref);\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Menu',\n className: props.className,\n style: props.style,\n values: {\n isEmpty: state.collection.size === 0\n }\n });\n\n let emptyState: ReactElement | null = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n emptyState = (\n <div\n role=\"menuitem\"\n style={{display: 'contents'}}>\n {props.renderEmptyState()}\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...menuProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-empty={state.collection.size === 0 || undefined}\n onScroll={props.onScroll}>\n <Provider\n values={[\n [MenuStateContext, state],\n [SeparatorContext, {elementType: 'div'}],\n [SectionContext, {name: 'MenuSection', render: MenuSectionInner}],\n [SubmenuTriggerContext, {parentMenuRef: ref, shouldUseVirtualFocus: autocompleteMenuProps?.shouldUseVirtualFocus}],\n [MenuItemContext, null],\n [UNSTABLE_InternalAutocompleteContext, null],\n [SelectionManagerContext, state.selectionManager],\n /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */\n /* We assume the context can never change between defined and undefined. */\n /* eslint-disable-next-line react-hooks/rules-of-hooks */\n [RootMenuTriggerStateContext, triggerState ?? useMenuTriggerState({})]\n ]}>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n );\n}\n\nexport interface MenuSectionProps<T> extends SectionProps<T>, MultipleSelection {}\n\n// A subclass of SelectionManager that forwards focus-related properties to the parent,\n// but has its own local selection state.\nclass GroupSelectionManager extends SelectionManager {\n private parent: SelectionManager;\n\n constructor(parent: SelectionManager, state: MultipleSelectionState) {\n super(parent.collection, state);\n this.parent = parent;\n }\n\n get focusedKey() {\n return this.parent.focusedKey;\n }\n\n get isFocused() {\n return this.parent.isFocused;\n }\n\n setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void {\n return this.parent.setFocusedKey(key, childFocusStrategy);\n }\n\n setFocused(isFocused: boolean): void {\n this.parent.setFocused(isFocused);\n }\n\n get childFocusStrategy() {\n return this.parent.childFocusStrategy;\n }\n}\n\nfunction MenuSectionInner<T extends object>(props: MenuSectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>, className = 'react-aria-MenuSection') {\n let state = useContext(MenuStateContext)!;\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let [headingRef, heading] = useSlot();\n let {headingProps, groupProps} = useMenuSection({\n heading,\n 'aria-label': section.props['aria-label'] ?? undefined\n });\n let renderProps = useRenderProps({\n defaultClassName: className,\n className: section.props?.className,\n style: section.props?.style,\n values: {}\n });\n\n let parent = useContext(SelectionManagerContext)!;\n let selectionState = useMultipleSelectionState(props);\n let manager = props.selectionMode != null ? new GroupSelectionManager(parent, selectionState) : parent;\n\n return (\n <section\n {...filterDOMProps(props as any)}\n {...groupProps}\n {...renderProps}\n ref={ref}>\n <Provider\n values={[\n [HeaderContext, {...headingProps, ref: headingRef}],\n [SelectionManagerContext, manager]\n ]}>\n <CollectionBranch collection={state.collection} parent={section} />\n </Provider>\n </section>\n );\n}\n\n/**\n * A MenuSection represents a section within a Menu.\n */\nexport const MenuSection = /*#__PURE__*/ createBranchComponent('section', MenuSectionInner);\n\nexport interface MenuItemRenderProps extends ItemRenderProps {\n /**\n * Whether the item has a submenu.\n *\n * @selector [data-has-submenu]\n */\n hasSubmenu: boolean,\n /**\n * Whether the item's submenu is open.\n *\n * @selector [data-open]\n */\n isOpen: boolean\n}\n\nexport interface MenuItemProps<T = object> extends RenderProps<MenuItemRenderProps>, LinkDOMProps, HoverEvents {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** An accessibility label for this item. */\n 'aria-label'?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /** Handler that is called when the item is selected. */\n onAction?: () => void\n}\n\nconst MenuItemContext = createContext<ContextValue<MenuItemProps, HTMLDivElement>>(null);\n\n/**\n * A MenuItem represents an individual action in a Menu.\n */\nexport const MenuItem = /*#__PURE__*/ createLeafComponent('item', function MenuItem<T extends object>(props: MenuItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n [props, forwardedRef] = useContextProps(props, forwardedRef, MenuItemContext);\n let id = useSlottedContext(MenuItemContext)?.id as string;\n let state = useContext(MenuStateContext)!;\n let ref = useObjectRef<any>(forwardedRef);\n let selectionManager = useContext(SelectionManagerContext)!;\n\n let {menuItemProps, labelProps, descriptionProps, keyboardShortcutProps, ...states} = useMenuItem({\n ...props,\n id,\n key: item.key,\n selectionManager\n }, state, ref);\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: states.isDisabled\n });\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-MenuItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible: states.isFocusVisible,\n selectionMode: selectionManager.selectionMode,\n selectionBehavior: selectionManager.selectionBehavior,\n hasSubmenu: !!props['aria-haspopup'],\n isOpen: props['aria-expanded'] === 'true'\n }\n });\n\n let ElementType: React.ElementType = props.href ? 'a' : 'div';\n\n return (\n <ElementType\n {...mergeProps(menuItemProps, hoverProps)}\n {...renderProps}\n ref={ref}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={states.isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selected={states.isSelected || undefined}\n data-selection-mode={selectionManager.selectionMode === 'none' ? undefined : selectionManager.selectionMode}\n data-has-submenu={!!props['aria-haspopup'] || undefined}\n data-open={props['aria-expanded'] === 'true' || undefined}>\n <Provider\n values={[\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: labelProps,\n label: labelProps,\n description: descriptionProps\n }\n }],\n [KeyboardContext, keyboardShortcutProps]\n ]}>\n {renderProps.children}\n </Provider>\n </ElementType>\n );\n});\n"],"names":[],"version":3,"file":"Menu.main.js.map"}
package/dist/Menu.mjs CHANGED
@@ -217,7 +217,7 @@ const $3674c52c6b3c5bce$export$d9b273488cd8ce6f = /*#__PURE__*/ (0, $kM2ZM$forwa
217
217
  // Delay rendering the actual menu until we have the collection so that auto focus works properly.
218
218
  return /*#__PURE__*/ (0, $kM2ZM$react).createElement((0, $kM2ZM$CollectionBuilder), {
219
219
  content: /*#__PURE__*/ (0, $kM2ZM$react).createElement((0, $kM2ZM$Collection), props)
220
- }, (collection)=>collection.size > 0 && /*#__PURE__*/ (0, $kM2ZM$react).createElement($3674c52c6b3c5bce$var$MenuInner, {
220
+ }, (collection)=>/*#__PURE__*/ (0, $kM2ZM$react).createElement($3674c52c6b3c5bce$var$MenuInner, {
221
221
  props: props,
222
222
  collection: collection,
223
223
  menuRef: ref
@@ -251,14 +251,24 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
251
251
  defaultClassName: 'react-aria-Menu',
252
252
  className: props.className,
253
253
  style: props.style,
254
- values: {}
254
+ values: {
255
+ isEmpty: state.collection.size === 0
256
+ }
255
257
  });
258
+ let emptyState = null;
259
+ if (state.collection.size === 0 && props.renderEmptyState) emptyState = /*#__PURE__*/ (0, $kM2ZM$react).createElement("div", {
260
+ role: "menuitem",
261
+ style: {
262
+ display: 'contents'
263
+ }
264
+ }, props.renderEmptyState());
256
265
  return /*#__PURE__*/ (0, $kM2ZM$react).createElement((0, $kM2ZM$FocusScope), null, /*#__PURE__*/ (0, $kM2ZM$react).createElement("div", {
257
266
  ...(0, $kM2ZM$filterDOMProps)(props),
258
267
  ...menuProps,
259
268
  ...renderProps,
260
269
  ref: ref,
261
270
  slot: props.slot || undefined,
271
+ "data-empty": state.collection.size === 0 || undefined,
262
272
  onScroll: props.onScroll
263
273
  }, /*#__PURE__*/ (0, $kM2ZM$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
264
274
  values: [
@@ -307,7 +317,7 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
307
317
  collection: state.collection,
308
318
  persistedKeys: (0, $7135fc7d473fd974$export$90e00781bc59d8f9)(state.selectionManager.focusedKey),
309
319
  scrollRef: ref
310
- }))));
320
+ })), emptyState));
311
321
  }
312
322
  // A subclass of SelectionManager that forwards focus-related properties to the parent,
313
323
  // but has its own local selection state.
@@ -217,7 +217,7 @@ const $3674c52c6b3c5bce$export$d9b273488cd8ce6f = /*#__PURE__*/ (0, $kM2ZM$forwa
217
217
  // Delay rendering the actual menu until we have the collection so that auto focus works properly.
218
218
  return /*#__PURE__*/ (0, $kM2ZM$react).createElement((0, $kM2ZM$CollectionBuilder), {
219
219
  content: /*#__PURE__*/ (0, $kM2ZM$react).createElement((0, $kM2ZM$Collection), props)
220
- }, (collection)=>collection.size > 0 && /*#__PURE__*/ (0, $kM2ZM$react).createElement($3674c52c6b3c5bce$var$MenuInner, {
220
+ }, (collection)=>/*#__PURE__*/ (0, $kM2ZM$react).createElement($3674c52c6b3c5bce$var$MenuInner, {
221
221
  props: props,
222
222
  collection: collection,
223
223
  menuRef: ref
@@ -251,14 +251,24 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
251
251
  defaultClassName: 'react-aria-Menu',
252
252
  className: props.className,
253
253
  style: props.style,
254
- values: {}
254
+ values: {
255
+ isEmpty: state.collection.size === 0
256
+ }
255
257
  });
258
+ let emptyState = null;
259
+ if (state.collection.size === 0 && props.renderEmptyState) emptyState = /*#__PURE__*/ (0, $kM2ZM$react).createElement("div", {
260
+ role: "menuitem",
261
+ style: {
262
+ display: 'contents'
263
+ }
264
+ }, props.renderEmptyState());
256
265
  return /*#__PURE__*/ (0, $kM2ZM$react).createElement((0, $kM2ZM$FocusScope), null, /*#__PURE__*/ (0, $kM2ZM$react).createElement("div", {
257
266
  ...(0, $kM2ZM$filterDOMProps)(props),
258
267
  ...menuProps,
259
268
  ...renderProps,
260
269
  ref: ref,
261
270
  slot: props.slot || undefined,
271
+ "data-empty": state.collection.size === 0 || undefined,
262
272
  onScroll: props.onScroll
263
273
  }, /*#__PURE__*/ (0, $kM2ZM$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
264
274
  values: [
@@ -307,7 +317,7 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
307
317
  collection: state.collection,
308
318
  persistedKeys: (0, $7135fc7d473fd974$export$90e00781bc59d8f9)(state.selectionManager.focusedKey),
309
319
  scrollRef: ref
310
- }))));
320
+ })), emptyState));
311
321
  }
312
322
  // A subclass of SelectionManager that forwards focus-related properties to the parent,
313
323
  // but has its own local selection state.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;AAkCM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAgD;AAChF,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAAyB;AAC9D,MAA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;QACrC;IACF;IAEA,IAAI,cAAiC,MAAM,IAAI,GAAG,MAAM;IAExD,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,eAAe,WAAW;QACxC,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,OAAO,UAAU,IAAI;QACpC,gBAAc,aAAa;QAC3B,gBAAc,OAAO,SAAS,IAAI;QAClC,sBAAoB,OAAO,cAAc,IAAI;QAC7C,gBAAc,OAAO,SAAS,IAAI;QAClC,iBAAe,OAAO,UAAU,IAAI;QACpC,uBAAqB,iBAAiB,aAAa,KAAK,SAAS,YAAY,iBAAiB,aAAa;QAC3G,oBAAkB,CAAC,CAAC,KAAK,CAAC,gBAAgB,IAAI;QAC9C,aAAW,KAAK,CAAC,gBAAgB,KAAK,UAAU;qBAChD,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE;wBAChB,OAAO;wBACP,aAAa;oBACf;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAc;gBAAG;aAAsB;SACzC;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Menu.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps, FocusScope, mergeProps, useMenu, useMenuItem, useMenuSection, useMenuTrigger} from 'react-aria';\nimport {BaseCollection, Collection, CollectionBuilder, createBranchComponent, createLeafComponent} from '@react-aria/collections';\nimport {MenuTriggerProps as BaseMenuTriggerProps, Collection as ICollection, Node, TreeState, useMenuTriggerState, useTreeState} from 'react-stately';\nimport {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {filterDOMProps, mergeRefs, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {FocusStrategy, forwardRefType, HoverEvents, Key, LinkDOMProps, MultipleSelection} from '@react-types/shared';\nimport {HeaderContext} from './Header';\nimport {KeyboardContext} from './Keyboard';\nimport {MultipleSelectionState, SelectionManager, useMultipleSelectionState} from '@react-stately/selection';\nimport {PopoverContext} from './Popover';\nimport {PressResponder, useHover} from '@react-aria/interactions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {RootMenuTriggerState, useSubmenuTriggerState} from '@react-stately/menu';\nimport {SeparatorContext} from './Separator';\nimport {TextContext} from './Text';\nimport {UNSTABLE_InternalAutocompleteContext} from './Autocomplete';\nimport {useSubmenuTrigger} from '@react-aria/menu';\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, HTMLDivElement>>(null);\nexport const MenuStateContext = createContext<TreeState<any> | null>(null);\nexport const RootMenuTriggerStateContext = createContext<RootMenuTriggerState | null>(null);\nconst SelectionManagerContext = createContext<SelectionManager | null>(null);\n\nexport interface MenuTriggerProps extends BaseMenuTriggerProps {\n children: ReactNode\n}\n\nexport function MenuTrigger(props: MenuTriggerProps) {\n let state = useMenuTriggerState(props);\n let ref = useRef<HTMLButtonElement>(null);\n let {menuTriggerProps, menuProps} = useMenuTrigger({\n ...props,\n type: 'menu'\n }, state, ref);\n // Allows menu width to match button\n let [buttonWidth, setButtonWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (ref.current) {\n setButtonWidth(ref.current.offsetWidth + 'px');\n }\n }, [ref]);\n\n useResizeObserver({\n ref: ref,\n onResize: onResize\n });\n let scrollRef = useRef(null);\n\n return (\n <Provider\n values={[\n [MenuContext, {...menuProps, ref: scrollRef}],\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'MenuTrigger',\n triggerRef: ref,\n scrollRef,\n placement: 'bottom start',\n style: {'--trigger-width': buttonWidth} as React.CSSProperties\n }]\n ]}>\n <PressResponder {...menuTriggerProps} ref={ref} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\nexport interface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the submenu).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the submenu to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\nconst SubmenuTriggerContext = createContext<{parentMenuRef: RefObject<HTMLElement | null>, shouldUseVirtualFocus?: boolean} | null>(null);\n\n/**\n * A submenu trigger is used to wrap a submenu's trigger item and the submenu itself.\n *\n * @version alpha\n */\nexport const SubmenuTrigger = /*#__PURE__*/ createBranchComponent('submenutrigger', (props: SubmenuTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let submenuRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n delay: props.delay,\n shouldUseVirtualFocus\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: submenuRef,\n trigger: 'SubmenuTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\n// TODO: make SubdialogTrigger unstable\nexport interface SubDialogTriggerProps {\n /**\n * The contents of the SubDialogTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the subdialog).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the subdialog to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\n/**\n * A subdialog trigger is used to wrap a subdialog's trigger item and the subdialog itself.\n *\n * @version alpha\n */\nexport const SubDialogTrigger = /*#__PURE__*/ createBranchComponent('subdialogtrigger', (props: SubDialogTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let subdialogRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef: subdialogRef,\n type: 'dialog',\n delay: props.delay,\n shouldUseVirtualFocus\n // TODO: might need to have something like isUnavailable like we do for ContextualHelpTrigger\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [DialogContext, {'aria-labelledby': submenuProps['aria-labelledby']}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: subdialogRef,\n trigger: 'SubDialogTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, CollectionProps<T>, StyleProps, SlotProps, ScrollableProps<HTMLDivElement> {}\n\n/**\n * A menu displays a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, MenuContext);\n\n // Delay rendering the actual menu until we have the collection so that auto focus works properly.\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => collection.size > 0 && <MenuInner props={props} collection={collection} menuRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface MenuInnerProps<T> {\n props: MenuProps<T>,\n collection: BaseCollection<object>,\n menuRef: RefObject<HTMLDivElement | null>\n}\n\nfunction MenuInner<T extends object>({props, collection, menuRef: ref}: MenuInnerProps<T>) {\n let {filterFn, collectionProps: autocompleteMenuProps, collectionRef} = useContext(UNSTABLE_InternalAutocompleteContext) || {};\n // Memoed so that useAutocomplete callback ref is properly only called once on mount and not everytime a rerender happens\n ref = useObjectRef(useMemo(() => mergeRefs(ref, collectionRef !== undefined ? collectionRef as RefObject<HTMLDivElement> : null), [collectionRef, ref]));\n let filteredCollection = useMemo(() => filterFn ? collection.filter(filterFn) : collection, [collection, filterFn]);\n let state = useTreeState({\n ...props,\n collection: filteredCollection as ICollection<Node<object>>,\n children: undefined\n });\n let triggerState = useContext(RootMenuTriggerStateContext);\n let {isVirtualized, CollectionRoot} = useContext(CollectionRendererContext);\n let {menuProps} = useMenu({...props, ...autocompleteMenuProps, isVirtualized, onClose: props.onClose || triggerState?.close}, state, ref);\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Menu',\n className: props.className,\n style: props.style,\n values: {}\n });\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...menuProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}>\n <Provider\n values={[\n [MenuStateContext, state],\n [SeparatorContext, {elementType: 'div'}],\n [SectionContext, {name: 'MenuSection', render: MenuSectionInner}],\n [SubmenuTriggerContext, {parentMenuRef: ref, shouldUseVirtualFocus: autocompleteMenuProps?.shouldUseVirtualFocus}],\n [MenuItemContext, null],\n [UNSTABLE_InternalAutocompleteContext, null],\n [SelectionManagerContext, state.selectionManager],\n /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */\n /* We assume the context can never change between defined and undefined. */\n /* eslint-disable-next-line react-hooks/rules-of-hooks */\n [RootMenuTriggerStateContext, triggerState ?? useMenuTriggerState({})]\n ]}>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n </div>\n </FocusScope>\n );\n}\n\nexport interface MenuSectionProps<T> extends SectionProps<T>, MultipleSelection {}\n\n// A subclass of SelectionManager that forwards focus-related properties to the parent,\n// but has its own local selection state.\nclass GroupSelectionManager extends SelectionManager {\n private parent: SelectionManager;\n\n constructor(parent: SelectionManager, state: MultipleSelectionState) {\n super(parent.collection, state);\n this.parent = parent;\n }\n\n get focusedKey() {\n return this.parent.focusedKey;\n }\n\n get isFocused() {\n return this.parent.isFocused;\n }\n\n setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void {\n return this.parent.setFocusedKey(key, childFocusStrategy);\n }\n\n setFocused(isFocused: boolean): void {\n this.parent.setFocused(isFocused);\n }\n\n get childFocusStrategy() {\n return this.parent.childFocusStrategy;\n }\n}\n\nfunction MenuSectionInner<T extends object>(props: MenuSectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>, className = 'react-aria-MenuSection') {\n let state = useContext(MenuStateContext)!;\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let [headingRef, heading] = useSlot();\n let {headingProps, groupProps} = useMenuSection({\n heading,\n 'aria-label': section.props['aria-label'] ?? undefined\n });\n let renderProps = useRenderProps({\n defaultClassName: className,\n className: section.props?.className,\n style: section.props?.style,\n values: {}\n });\n\n let parent = useContext(SelectionManagerContext)!;\n let selectionState = useMultipleSelectionState(props);\n let manager = props.selectionMode != null ? new GroupSelectionManager(parent, selectionState) : parent;\n\n return (\n <section\n {...filterDOMProps(props as any)}\n {...groupProps}\n {...renderProps}\n ref={ref}>\n <Provider\n values={[\n [HeaderContext, {...headingProps, ref: headingRef}],\n [SelectionManagerContext, manager]\n ]}>\n <CollectionBranch collection={state.collection} parent={section} />\n </Provider>\n </section>\n );\n}\n\n/**\n * A MenuSection represents a section within a Menu.\n */\nexport const MenuSection = /*#__PURE__*/ createBranchComponent('section', MenuSectionInner);\n\nexport interface MenuItemRenderProps extends ItemRenderProps {\n /**\n * Whether the item has a submenu.\n *\n * @selector [data-has-submenu]\n */\n hasSubmenu: boolean,\n /**\n * Whether the item's submenu is open.\n *\n * @selector [data-open]\n */\n isOpen: boolean\n}\n\nexport interface MenuItemProps<T = object> extends RenderProps<MenuItemRenderProps>, LinkDOMProps, HoverEvents {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** An accessibility label for this item. */\n 'aria-label'?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /** Handler that is called when the item is selected. */\n onAction?: () => void\n}\n\nconst MenuItemContext = createContext<ContextValue<MenuItemProps, HTMLDivElement>>(null);\n\n/**\n * A MenuItem represents an individual action in a Menu.\n */\nexport const MenuItem = /*#__PURE__*/ createLeafComponent('item', function MenuItem<T extends object>(props: MenuItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n [props, forwardedRef] = useContextProps(props, forwardedRef, MenuItemContext);\n let id = useSlottedContext(MenuItemContext)?.id as string;\n let state = useContext(MenuStateContext)!;\n let ref = useObjectRef<any>(forwardedRef);\n let selectionManager = useContext(SelectionManagerContext)!;\n\n let {menuItemProps, labelProps, descriptionProps, keyboardShortcutProps, ...states} = useMenuItem({\n ...props,\n id,\n key: item.key,\n selectionManager\n }, state, ref);\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: states.isDisabled\n });\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-MenuItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible: states.isFocusVisible,\n selectionMode: selectionManager.selectionMode,\n selectionBehavior: selectionManager.selectionBehavior,\n hasSubmenu: !!props['aria-haspopup'],\n isOpen: props['aria-expanded'] === 'true'\n }\n });\n\n let ElementType: React.ElementType = props.href ? 'a' : 'div';\n\n return (\n <ElementType\n {...mergeProps(menuItemProps, hoverProps)}\n {...renderProps}\n ref={ref}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={states.isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selected={states.isSelected || undefined}\n data-selection-mode={selectionManager.selectionMode === 'none' ? undefined : selectionManager.selectionMode}\n data-has-submenu={!!props['aria-haspopup'] || undefined}\n data-open={props['aria-expanded'] === 'true' || undefined}>\n <Provider\n values={[\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: labelProps,\n label: labelProps,\n description: descriptionProps\n }\n }],\n [KeyboardContext, keyboardShortcutProps]\n ]}>\n {renderProps.children}\n </Provider>\n </ElementType>\n );\n});\n"],"names":[],"version":3,"file":"Menu.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;AAkCM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAgD;AAChF,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EA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,IAAI;QACJ,UAAU,KAAK,QAAQ;QACvB,kBAAkB;QAClB,QAAQ;YACN,GAAG,MAAM;uBACT;YACA,gBAAgB,OAAO,cAAc;YACrC,eAAe,iBAAiB,aAAa;YAC7C,mBAAmB,iBAAiB,iBAAiB;YACrD,YAAY,CAAC,CAAC,KAAK,CAAC,gBAAgB;YACpC,QAAQ,KAAK,CAAC,gBAAgB,KAAK;QACrC;IACF;IAEA,IAAI,cAAiC,MAAM,IAAI,GAAG,MAAM;IAExD,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,eAAe,WAAW;QACxC,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,OAAO,UAAU,IAAI;QACpC,gBAAc,aAAa;QAC3B,gBAAc,OAAO,SAAS,IAAI;QAClC,sBAAoB,OAAO,cAAc,IAAI;QAC7C,gBAAc,OAAO,SAAS,IAAI;QAClC,iBAAe,OAAO,UAAU,IAAI;QACpC,uBAAqB,iBAAiB,aAAa,KAAK,SAAS,YAAY,iBAAiB,aAAa;QAC3G,oBAAkB,CAAC,CAAC,KAAK,CAAC,gBAAgB,IAAI;QAC9C,aAAW,KAAK,CAAC,gBAAgB,KAAK,UAAU;qBAChD,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE;wBAChB,OAAO;wBACP,aAAa;oBACf;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAc;gBAAG;aAAsB;SACzC;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Menu.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps, FocusScope, mergeProps, useMenu, useMenuItem, useMenuSection, useMenuTrigger} from 'react-aria';\nimport {BaseCollection, Collection, CollectionBuilder, createBranchComponent, createLeafComponent} from '@react-aria/collections';\nimport {MenuTriggerProps as BaseMenuTriggerProps, Collection as ICollection, Node, TreeState, useMenuTriggerState, useTreeState} from 'react-stately';\nimport {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {filterDOMProps, mergeRefs, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {FocusStrategy, forwardRefType, HoverEvents, Key, LinkDOMProps, MultipleSelection} from '@react-types/shared';\nimport {HeaderContext} from './Header';\nimport {KeyboardContext} from './Keyboard';\nimport {MultipleSelectionState, SelectionManager, useMultipleSelectionState} from '@react-stately/selection';\nimport {PopoverContext} from './Popover';\nimport {PressResponder, useHover} from '@react-aria/interactions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {RootMenuTriggerState, useSubmenuTriggerState} from '@react-stately/menu';\nimport {SeparatorContext} from './Separator';\nimport {TextContext} from './Text';\nimport {UNSTABLE_InternalAutocompleteContext} from './Autocomplete';\nimport {useSubmenuTrigger} from '@react-aria/menu';\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, HTMLDivElement>>(null);\nexport const MenuStateContext = createContext<TreeState<any> | null>(null);\nexport const RootMenuTriggerStateContext = createContext<RootMenuTriggerState | null>(null);\nconst SelectionManagerContext = createContext<SelectionManager | null>(null);\n\nexport interface MenuTriggerProps extends BaseMenuTriggerProps {\n children: ReactNode\n}\n\nexport function MenuTrigger(props: MenuTriggerProps) {\n let state = useMenuTriggerState(props);\n let ref = useRef<HTMLButtonElement>(null);\n let {menuTriggerProps, menuProps} = useMenuTrigger({\n ...props,\n type: 'menu'\n }, state, ref);\n // Allows menu width to match button\n let [buttonWidth, setButtonWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (ref.current) {\n setButtonWidth(ref.current.offsetWidth + 'px');\n }\n }, [ref]);\n\n useResizeObserver({\n ref: ref,\n onResize: onResize\n });\n let scrollRef = useRef(null);\n\n return (\n <Provider\n values={[\n [MenuContext, {...menuProps, ref: scrollRef}],\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'MenuTrigger',\n triggerRef: ref,\n scrollRef,\n placement: 'bottom start',\n style: {'--trigger-width': buttonWidth} as React.CSSProperties\n }]\n ]}>\n <PressResponder {...menuTriggerProps} ref={ref} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\nexport interface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the submenu).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the submenu to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\nconst SubmenuTriggerContext = createContext<{parentMenuRef: RefObject<HTMLElement | null>, shouldUseVirtualFocus?: boolean} | null>(null);\n\n/**\n * A submenu trigger is used to wrap a submenu's trigger item and the submenu itself.\n *\n * @version alpha\n */\nexport const SubmenuTrigger = /*#__PURE__*/ createBranchComponent('submenutrigger', (props: SubmenuTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let submenuRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n delay: props.delay,\n shouldUseVirtualFocus\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: submenuRef,\n trigger: 'SubmenuTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\n// TODO: make SubdialogTrigger unstable\nexport interface SubDialogTriggerProps {\n /**\n * The contents of the SubDialogTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the subdialog).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the subdialog to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\n/**\n * A subdialog trigger is used to wrap a subdialog's trigger item and the subdialog itself.\n *\n * @version alpha\n */\nexport const SubDialogTrigger = /*#__PURE__*/ createBranchComponent('subdialogtrigger', (props: SubDialogTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let subdialogRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef: subdialogRef,\n type: 'dialog',\n delay: props.delay,\n shouldUseVirtualFocus\n // TODO: might need to have something like isUnavailable like we do for ContextualHelpTrigger\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [DialogContext, {'aria-labelledby': submenuProps['aria-labelledby']}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: subdialogRef,\n trigger: 'SubDialogTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\nexport interface MenuRenderProps {\n /**\n * Whether the menu has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean\n}\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<MenuRenderProps>, SlotProps, ScrollableProps<HTMLDivElement> {\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: () => ReactNode\n}\n\n/**\n * A menu displays a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, MenuContext);\n\n // Delay rendering the actual menu until we have the collection so that auto focus works properly.\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <MenuInner props={props} collection={collection} menuRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface MenuInnerProps<T> {\n props: MenuProps<T>,\n collection: BaseCollection<object>,\n menuRef: RefObject<HTMLDivElement | null>\n}\n\nfunction MenuInner<T extends object>({props, collection, menuRef: ref}: MenuInnerProps<T>) {\n let {filterFn, collectionProps: autocompleteMenuProps, collectionRef} = useContext(UNSTABLE_InternalAutocompleteContext) || {};\n // Memoed so that useAutocomplete callback ref is properly only called once on mount and not everytime a rerender happens\n ref = useObjectRef(useMemo(() => mergeRefs(ref, collectionRef !== undefined ? collectionRef as RefObject<HTMLDivElement> : null), [collectionRef, ref]));\n let filteredCollection = useMemo(() => filterFn ? collection.filter(filterFn) : collection, [collection, filterFn]);\n let state = useTreeState({\n ...props,\n collection: filteredCollection as ICollection<Node<object>>,\n children: undefined\n });\n let triggerState = useContext(RootMenuTriggerStateContext);\n let {isVirtualized, CollectionRoot} = useContext(CollectionRendererContext);\n let {menuProps} = useMenu({...props, ...autocompleteMenuProps, isVirtualized, onClose: props.onClose || triggerState?.close}, state, ref);\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Menu',\n className: props.className,\n style: props.style,\n values: {\n isEmpty: state.collection.size === 0\n }\n });\n\n let emptyState: ReactElement | null = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n emptyState = (\n <div\n role=\"menuitem\"\n style={{display: 'contents'}}>\n {props.renderEmptyState()}\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...menuProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-empty={state.collection.size === 0 || undefined}\n onScroll={props.onScroll}>\n <Provider\n values={[\n [MenuStateContext, state],\n [SeparatorContext, {elementType: 'div'}],\n [SectionContext, {name: 'MenuSection', render: MenuSectionInner}],\n [SubmenuTriggerContext, {parentMenuRef: ref, shouldUseVirtualFocus: autocompleteMenuProps?.shouldUseVirtualFocus}],\n [MenuItemContext, null],\n [UNSTABLE_InternalAutocompleteContext, null],\n [SelectionManagerContext, state.selectionManager],\n /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */\n /* We assume the context can never change between defined and undefined. */\n /* eslint-disable-next-line react-hooks/rules-of-hooks */\n [RootMenuTriggerStateContext, triggerState ?? useMenuTriggerState({})]\n ]}>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n );\n}\n\nexport interface MenuSectionProps<T> extends SectionProps<T>, MultipleSelection {}\n\n// A subclass of SelectionManager that forwards focus-related properties to the parent,\n// but has its own local selection state.\nclass GroupSelectionManager extends SelectionManager {\n private parent: SelectionManager;\n\n constructor(parent: SelectionManager, state: MultipleSelectionState) {\n super(parent.collection, state);\n this.parent = parent;\n }\n\n get focusedKey() {\n return this.parent.focusedKey;\n }\n\n get isFocused() {\n return this.parent.isFocused;\n }\n\n setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void {\n return this.parent.setFocusedKey(key, childFocusStrategy);\n }\n\n setFocused(isFocused: boolean): void {\n this.parent.setFocused(isFocused);\n }\n\n get childFocusStrategy() {\n return this.parent.childFocusStrategy;\n }\n}\n\nfunction MenuSectionInner<T extends object>(props: MenuSectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>, className = 'react-aria-MenuSection') {\n let state = useContext(MenuStateContext)!;\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let [headingRef, heading] = useSlot();\n let {headingProps, groupProps} = useMenuSection({\n heading,\n 'aria-label': section.props['aria-label'] ?? undefined\n });\n let renderProps = useRenderProps({\n defaultClassName: className,\n className: section.props?.className,\n style: section.props?.style,\n values: {}\n });\n\n let parent = useContext(SelectionManagerContext)!;\n let selectionState = useMultipleSelectionState(props);\n let manager = props.selectionMode != null ? new GroupSelectionManager(parent, selectionState) : parent;\n\n return (\n <section\n {...filterDOMProps(props as any)}\n {...groupProps}\n {...renderProps}\n ref={ref}>\n <Provider\n values={[\n [HeaderContext, {...headingProps, ref: headingRef}],\n [SelectionManagerContext, manager]\n ]}>\n <CollectionBranch collection={state.collection} parent={section} />\n </Provider>\n </section>\n );\n}\n\n/**\n * A MenuSection represents a section within a Menu.\n */\nexport const MenuSection = /*#__PURE__*/ createBranchComponent('section', MenuSectionInner);\n\nexport interface MenuItemRenderProps extends ItemRenderProps {\n /**\n * Whether the item has a submenu.\n *\n * @selector [data-has-submenu]\n */\n hasSubmenu: boolean,\n /**\n * Whether the item's submenu is open.\n *\n * @selector [data-open]\n */\n isOpen: boolean\n}\n\nexport interface MenuItemProps<T = object> extends RenderProps<MenuItemRenderProps>, LinkDOMProps, HoverEvents {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** An accessibility label for this item. */\n 'aria-label'?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /** Handler that is called when the item is selected. */\n onAction?: () => void\n}\n\nconst MenuItemContext = createContext<ContextValue<MenuItemProps, HTMLDivElement>>(null);\n\n/**\n * A MenuItem represents an individual action in a Menu.\n */\nexport const MenuItem = /*#__PURE__*/ createLeafComponent('item', function MenuItem<T extends object>(props: MenuItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n [props, forwardedRef] = useContextProps(props, forwardedRef, MenuItemContext);\n let id = useSlottedContext(MenuItemContext)?.id as string;\n let state = useContext(MenuStateContext)!;\n let ref = useObjectRef<any>(forwardedRef);\n let selectionManager = useContext(SelectionManagerContext)!;\n\n let {menuItemProps, labelProps, descriptionProps, keyboardShortcutProps, ...states} = useMenuItem({\n ...props,\n id,\n key: item.key,\n selectionManager\n }, state, ref);\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: states.isDisabled\n });\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-MenuItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible: states.isFocusVisible,\n selectionMode: selectionManager.selectionMode,\n selectionBehavior: selectionManager.selectionBehavior,\n hasSubmenu: !!props['aria-haspopup'],\n isOpen: props['aria-expanded'] === 'true'\n }\n });\n\n let ElementType: React.ElementType = props.href ? 'a' : 'div';\n\n return (\n <ElementType\n {...mergeProps(menuItemProps, hoverProps)}\n {...renderProps}\n ref={ref}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={states.isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selected={states.isSelected || undefined}\n data-selection-mode={selectionManager.selectionMode === 'none' ? undefined : selectionManager.selectionMode}\n data-has-submenu={!!props['aria-haspopup'] || undefined}\n data-open={props['aria-expanded'] === 'true' || undefined}>\n <Provider\n values={[\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: labelProps,\n label: labelProps,\n description: descriptionProps\n }\n }],\n [KeyboardContext, keyboardShortcutProps]\n ]}>\n {renderProps.children}\n </Provider>\n </ElementType>\n );\n});\n"],"names":[],"version":3,"file":"Menu.module.js.map"}
@@ -70,7 +70,8 @@ const $177b28eee7968d58$export$63c5fa0b2fdccd2e = /*#__PURE__*/ (0, $3iM7b$react
70
70
  values: {
71
71
  state: state,
72
72
  isDisabled: props.isDisabled || false,
73
- isInvalid: validation.isInvalid || false
73
+ isInvalid: validation.isInvalid || false,
74
+ isRequired: props.isRequired || false
74
75
  },
75
76
  defaultClassName: 'react-aria-NumberField'
76
77
  });
@@ -129,6 +130,7 @@ const $177b28eee7968d58$export$63c5fa0b2fdccd2e = /*#__PURE__*/ (0, $3iM7b$react
129
130
  ref: ref,
130
131
  slot: props.slot || undefined,
131
132
  "data-disabled": props.isDisabled || undefined,
133
+ "data-required": props.isRequired || undefined,
132
134
  "data-invalid": validation.isInvalid || undefined
133
135
  }), props.name && /*#__PURE__*/ (0, ($parcel$interopDefault($3iM7b$react))).createElement("input", {
134
136
  type: "hidden",
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAmCM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAkD;AACzF,MAAM,0DAA0B,CAAA,GAAA,0BAAY,EAA2B;AAKvE,MAAM,4CAA4B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,YAAY,KAAuB,EAAE,GAAi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AAC,GAAG,UAAU;oBAAE,KAAK;gBAAQ;aAAE;YAC9C;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;gBAAQ;aAAE;YAC9C;gBAAC,CAAA,GAAA,uCAAY;gBAAG;oBACd,OAAO;wBACL,WAAW;wBACX,WAAW;oBACb;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,qCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,2CAAgB;gBAAG;aAAW;SAChC;qBACD,0DAAC;QACE,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;QACvC,MAAM,IAAI,kBAAI,0DAAC;QAAM,MAAK;QAAS,MAAM,MAAM,IAAI;QAAE,OAAO,MAAM,MAAM,WAAW,IAAI,KAAK,MAAM,WAAW;;AAGpH","sources":["packages/react-aria-components/src/NumberField.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaNumberFieldProps, useLocale, useNumberField} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, InputDOMProps} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {NumberFieldState, useNumberFieldState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface NumberFieldRenderProps {\n /**\n * Whether the number field is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the number field is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the number field.\n */\n state: NumberFieldState\n}\n\nexport interface NumberFieldProps extends Omit<AriaNumberFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, InputDOMProps, RenderProps<NumberFieldRenderProps>, SlotProps {}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, HTMLDivElement>>(null);\nexport const NumberFieldStateContext = createContext<NumberFieldState | null>(null);\n\n/**\n * A number field allows a user to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport const NumberField = /*#__PURE__*/ (forwardRef as forwardRefType)(function NumberField(props: NumberFieldProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, NumberFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {locale} = useLocale();\n let state = useNumberFieldState({\n ...props,\n locale,\n validationBehavior\n });\n\n let inputRef = useRef<HTMLInputElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n labelProps,\n groupProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useNumberField({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, inputRef);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false\n },\n defaultClassName: 'react-aria-NumberField'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [NumberFieldStateContext, state],\n [GroupContext, groupProps],\n [InputContext, {...inputProps, ref: inputRef}],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {\n slots: {\n increment: incrementButtonProps,\n decrement: decrementButtonProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined} />\n {props.name && <input type=\"hidden\" name={props.name} value={isNaN(state.numberValue) ? '' : state.numberValue} />}\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"NumberField.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAwCM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAkD;AACzF,MAAM,0DAA0B,CAAA,GAAA,0BAAY,EAA2B;AAKvE,MAAM,4CAA4B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,YAAY,KAAuB,EAAE,GAAiC;IACrJ,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE,CAAA,GAAA,qCAAU,MAAM,CAAC;QAC7D,2BAAA;IAAzB,IAAI,qBAAqB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,oCAA5B,kBAAA,OAAsD;IAC/E,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,0BAAQ;IACvB,IAAI,QAAQ,CAAA,GAAA,uCAAkB,EAAE;QAC9B,GAAG,KAAK;gBACR;4BACA;IAC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QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;QACvC,MAAM,IAAI,kBAAI,0DAAC;QAAM,MAAK;QAAS,MAAM,MAAM,IAAI;QAAE,OAAO,MAAM,MAAM,WAAW,IAAI,KAAK,MAAM,WAAW;;AAGpH","sources":["packages/react-aria-components/src/NumberField.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaNumberFieldProps, useLocale, useNumberField} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, InputDOMProps} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {NumberFieldState, useNumberFieldState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface NumberFieldRenderProps {\n /**\n * Whether the number field is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the number field is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the number field is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * State of the number field.\n */\n state: NumberFieldState\n}\n\nexport interface NumberFieldProps extends Omit<AriaNumberFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, InputDOMProps, RenderProps<NumberFieldRenderProps>, SlotProps {}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, HTMLDivElement>>(null);\nexport const NumberFieldStateContext = createContext<NumberFieldState | null>(null);\n\n/**\n * A number field allows a user to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport const NumberField = /*#__PURE__*/ (forwardRef as forwardRefType)(function NumberField(props: NumberFieldProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, NumberFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {locale} = useLocale();\n let state = useNumberFieldState({\n ...props,\n locale,\n validationBehavior\n });\n\n let inputRef = useRef<HTMLInputElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n labelProps,\n groupProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useNumberField({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, inputRef);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-NumberField'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [NumberFieldStateContext, state],\n [GroupContext, groupProps],\n [InputContext, {...inputProps, ref: inputRef}],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {\n slots: {\n increment: incrementButtonProps,\n decrement: decrementButtonProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={validation.isInvalid || undefined} />\n {props.name && <input type=\"hidden\" name={props.name} value={isNaN(state.numberValue) ? '' : state.numberValue} />}\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"NumberField.main.js.map"}
@@ -58,7 +58,8 @@ const $b91743d66a0ed188$export$63c5fa0b2fdccd2e = /*#__PURE__*/ (0, $a4EfP$forwa
58
58
  values: {
59
59
  state: state,
60
60
  isDisabled: props.isDisabled || false,
61
- isInvalid: validation.isInvalid || false
61
+ isInvalid: validation.isInvalid || false,
62
+ isRequired: props.isRequired || false
62
63
  },
63
64
  defaultClassName: 'react-aria-NumberField'
64
65
  });
@@ -117,6 +118,7 @@ const $b91743d66a0ed188$export$63c5fa0b2fdccd2e = /*#__PURE__*/ (0, $a4EfP$forwa
117
118
  ref: ref,
118
119
  slot: props.slot || undefined,
119
120
  "data-disabled": props.isDisabled || undefined,
121
+ "data-required": props.isRequired || undefined,
120
122
  "data-invalid": validation.isInvalid || undefined
121
123
  }), props.name && /*#__PURE__*/ (0, $a4EfP$react).createElement("input", {
122
124
  type: "hidden",
@@ -58,7 +58,8 @@ const $b91743d66a0ed188$export$63c5fa0b2fdccd2e = /*#__PURE__*/ (0, $a4EfP$forwa
58
58
  values: {
59
59
  state: state,
60
60
  isDisabled: props.isDisabled || false,
61
- isInvalid: validation.isInvalid || false
61
+ isInvalid: validation.isInvalid || false,
62
+ isRequired: props.isRequired || false
62
63
  },
63
64
  defaultClassName: 'react-aria-NumberField'
64
65
  });
@@ -117,6 +118,7 @@ const $b91743d66a0ed188$export$63c5fa0b2fdccd2e = /*#__PURE__*/ (0, $a4EfP$forwa
117
118
  ref: ref,
118
119
  slot: props.slot || undefined,
119
120
  "data-disabled": props.isDisabled || undefined,
121
+ "data-required": props.isRequired || undefined,
120
122
  "data-invalid": validation.isInvalid || undefined
121
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AAQ;mBACN;YACA,YAAY,MAAM,UAAU,IAAI;YAChC,WAAW,WAAW,SAAS,IAAI;QACrC;QACA,kBAAkB;IACpB;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE;IAC9B,OAAO,SAAS,EAAE;IAElB,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAAyB;aAAM;YAChC;gBAAC,CAAA,GAAA,yCAAW;gBAAG;aAAW;YAC1B;gBAAC,CAAA,GAAA,yCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;gBAAQ;aAAE;YAC9C;gBAAC,CAAA,GAAA,yCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;gBAAQ;aAAE;YAC9C;gBAAC,CAAA,GAAA,yCAAY;gBAAG;oBACd,OAAO;wBACL,WAAW;wBACX,WAAW;oBACb;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAgB;gBAAG;aAAW;SAChC;qBACD,gCAAC;QACE,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;QACvC,MAAM,IAAI,kBAAI,gCAAC;QAAM,MAAK;QAAS,MAAM,MAAM,IAAI;QAAE,OAAO,MAAM,MAAM,WAAW,IAAI,KAAK,MAAM,WAAW;;AAGpH","sources":["packages/react-aria-components/src/NumberField.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaNumberFieldProps, useLocale, useNumberField} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, InputDOMProps} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {NumberFieldState, useNumberFieldState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface NumberFieldRenderProps {\n /**\n * Whether the number field is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the number field is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the number field.\n */\n state: NumberFieldState\n}\n\nexport interface NumberFieldProps extends Omit<AriaNumberFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, InputDOMProps, RenderProps<NumberFieldRenderProps>, SlotProps {}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, HTMLDivElement>>(null);\nexport const NumberFieldStateContext = createContext<NumberFieldState | null>(null);\n\n/**\n * A number field allows a user to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport const NumberField = /*#__PURE__*/ (forwardRef as forwardRefType)(function NumberField(props: NumberFieldProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, NumberFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {locale} = useLocale();\n let state = useNumberFieldState({\n ...props,\n locale,\n validationBehavior\n });\n\n let inputRef = useRef<HTMLInputElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n labelProps,\n groupProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useNumberField({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, inputRef);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false\n },\n defaultClassName: 'react-aria-NumberField'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [NumberFieldStateContext, state],\n [GroupContext, groupProps],\n [InputContext, {...inputProps, ref: inputRef}],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {\n slots: {\n increment: incrementButtonProps,\n decrement: decrementButtonProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined} />\n {props.name && <input type=\"hidden\" name={props.name} value={isNaN(state.numberValue) ? '' : state.numberValue} />}\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"NumberField.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAwCM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAkD;AACzF,MAAM,0DAA0B,CAAA,GAAA,oBAAY,EAA2B;AAKvE,MAAM,4CAA4B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,YAAY,KAAuB,EAAE,GAAiC;IACrJ,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,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C,GAAG,UAAU;oBAAE,KAAK;gBAAQ;aAAE;YAC9C;gBAAC,CAAA,GAAA,yCAAY;gBAAG;oBACd,OAAO;wBACL,WAAW;wBACX,WAAW;oBACb;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAgB;gBAAG;aAAW;SAChC;qBACD,gCAAC;QACE,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;QACvC,MAAM,IAAI,kBAAI,gCAAC;QAAM,MAAK;QAAS,MAAM,MAAM,IAAI;QAAE,OAAO,MAAM,MAAM,WAAW,IAAI,KAAK,MAAM,WAAW;;AAGpH","sources":["packages/react-aria-components/src/NumberField.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaNumberFieldProps, useLocale, useNumberField} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, InputDOMProps} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {NumberFieldState, useNumberFieldState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface NumberFieldRenderProps {\n /**\n * Whether the number field is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the number field is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the number field is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * State of the number field.\n */\n state: NumberFieldState\n}\n\nexport interface NumberFieldProps extends Omit<AriaNumberFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, InputDOMProps, RenderProps<NumberFieldRenderProps>, SlotProps {}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, HTMLDivElement>>(null);\nexport const NumberFieldStateContext = createContext<NumberFieldState | null>(null);\n\n/**\n * A number field allows a user to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport const NumberField = /*#__PURE__*/ (forwardRef as forwardRefType)(function NumberField(props: NumberFieldProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, NumberFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {locale} = useLocale();\n let state = useNumberFieldState({\n ...props,\n locale,\n validationBehavior\n });\n\n let inputRef = useRef<HTMLInputElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n labelProps,\n groupProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useNumberField({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, inputRef);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-NumberField'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [NumberFieldStateContext, state],\n [GroupContext, groupProps],\n [InputContext, {...inputProps, ref: inputRef}],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {\n slots: {\n increment: incrementButtonProps,\n decrement: decrementButtonProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={validation.isInvalid || undefined} />\n {props.name && <input type=\"hidden\" name={props.name} value={isNaN(state.numberValue) ? '' : state.numberValue} />}\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"NumberField.module.js.map"}
@@ -746,7 +746,8 @@ const $37b9a5d4bd0d4ded$export$b59bdbef9ce70de2 = /*#__PURE__*/ (0, $5VUTk$react
746
746
  selectionBehavior: state.selectionManager.selectionBehavior,
747
747
  isDragging: isDragging,
748
748
  isDropTarget: dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.isDropTarget,
749
- isFocusVisibleWithin: isFocusVisibleWithin
749
+ isFocusVisibleWithin: isFocusVisibleWithin,
750
+ id: item.key
750
751
  }
751
752
  });
752
753
  let TR = $37b9a5d4bd0d4ded$var$useElementType('tr');
@@ -844,7 +845,8 @@ const $37b9a5d4bd0d4ded$export$f6f0c3fe4ec306ea = /*#__PURE__*/ (0, $5VUTk$react
844
845
  isFocused: isFocused,
845
846
  isFocusVisible: isFocusVisible,
846
847
  isPressed: isPressed,
847
- isHovered: isHovered
848
+ isHovered: isHovered,
849
+ id: cell.key
848
850
  }
849
851
  });
850
852
  let TD = $37b9a5d4bd0d4ded$var$useElementType('td');